(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1297],{16282:(e,t)=>{"use strict";function i(e,t){if(void 0===e)throw new Error((null!=t?t:"Value")+" is undefined");return e}function s(e,t){if(null===e)throw new Error((null!=t?t:"Value")+" is null");return e}Object.defineProperty(t,"__esModule",{value:!0}),t.ensureNever=t.ensure=t.ensureNotNull=t.ensureDefined=t.assert=void 0,t.assert=function(e,t){if(!e)throw new Error("Assertion failed"+(t?": "+t:""))},t.ensureDefined=i,t.ensureNotNull=s,t.ensure=function(e,t){return s(i(e,t),t)},t.ensureNever=function(e){}},75496:(e,t)=>{"use strict";function i(e){return Math.round(1e10*e)/1e10}Object.defineProperty(t,"__esModule",{value:!0}),t.alignTo=t.fixComputationError=t.isNaN=t.isInteger=t.isNumber=void 0,t.isNumber=function(e){return"number"==typeof e&&isFinite(e)},t.isInteger=function(e){return"number"==typeof e&&e%1==0},t.isNaN=function(e){return!(e<=0||e>0)},t.fixComputationError=i,t.alignTo=function(e,t){var s=e/t,r=Math.floor(s),n=s-r;return n>2e-10?i(n>.5?(r+1)*t:r*t):e}},73211:(e,t)=>{"use strict";t.hasProperty=t.isObject=void 0,t.isObject=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)},t.hasProperty=function(e,t){return t in e}},71044:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pointInCircle=t.pointInPolygon=t.pointInBox=t.pointInTriangle=t.pointInHalfplane=void 0;var s=i(95196);t.pointInHalfplane=function(e,t){var i=t.edge;return i.A*e.x+i.B*e.y+i.C>0===t.isPositive},t.pointInTriangle=function(e,t,i,r){var n=t.add(i).scaled(.5).add(r).scaled(.5),o=s.intersectLineSegments(t,i,n,e);return null===o&&(null===(o=s.intersectLineSegments(i,r,n,e))&&null===(o=s.intersectLineSegments(r,t,n,e)))},t.pointInBox=function(e,t){return e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y},t.pointInPolygon=function(e,t){for(var i=t.length-1,s=!1,r=e.x,n=e.y,o=0;o=n||l.y=n)&&a.x+(n-a.y)/(l.y-a.y)*(l.x-a.x){"use strict";function i(e,t,i){var s=t.subtract(e),r=i.subtract(e).dotProduct(s)/s.dotProduct(s);return{coeff:r,distance:e.addScaled(s,r).subtract(i).length()}}Object.defineProperty(t,"__esModule",{value:!0}),t.distanceToSegment=t.distanceToLine=void 0,t.distanceToLine=i,t.distanceToSegment=function(e,t,s){var r=i(e,t,s);if(0<=r.coeff&&r.coeff<=1)return r;var n=e.subtract(s).length(),o=t.subtract(s).length();return n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.intersectPolygons=t.intersectPolygonAndHalfplane=t.intersectRayAndBox=t.intersectLineAndBox=t.intersectLineSegments=t.intersectLines=t.intersectLineSegmentAndBox=void 0;var s=i(16282),r=i(72927),n=i(89684),o=i(71044);function a(e,t){var i=e.A,s=t.A,n=e.B,o=t.B,a=e.C,l=t.C,c=i*o-s*n;if(Math.abs(c)<1e-6)return null;var h=(n*l-o*a)/c,d=(s*a-i*l)/c;return new r.Point(h,d)}function l(e,t,i,s){ var r=function(e,t,i,s){var r=t.subtract(e),n=s.subtract(i),o=r.x*n.y-r.y*n.x;if(Math.abs(o)<1e-6)return null;var a=e.subtract(i);return(a.y*n.x-a.x*n.y)/o}(e,t,i,s);if(null===r)return null;var o=t.subtract(e).scaled(r).add(e),a=n.distanceToSegment(i,s,o);return Math.abs(a.distance)<1e-6?r:null}function c(e,t){for(var i=0,s=e;i0&&(r.equalPoints(e[e.length-1],t)||r.equalPoints(e[0],t)))&&(e.push(t),!0)}function d(e,t){for(var i=[],s=0;s=3?i:null}t.intersectLineSegmentAndBox=function(e,t){var i=e[0].x,s=e[0].y,n=e[1].x,o=e[1].y,a=t.min.x,l=t.min.y,c=t.max.x,h=t.max.y;function d(e,t,i,s,r,n){var o=0;return er&&(o|=2),tn&&(o|=8),o}for(var u=d(i,s,a,l,c,h),p=d(n,o,a,l,c,h),_=!1,m=0;;){if(m>1e3)throw new Error("Cohen - Sutherland algorithm: infinity loop");if(m++,!(u|p)){_=!0;break}if(u&p)break;var g=u||p,f=void 0,v=void 0;8&g?(f=i+(n-i)*(h-s)/(o-s),v=h):4&g?(f=i+(n-i)*(l-s)/(o-s),v=l):2&g?(v=s+(o-s)*(c-i)/(n-i),f=c):(v=s+(o-s)*(a-i)/(n-i),f=a),g===u?u=d(i=f,s=v,a,l,c,h):p=d(n=f,o=v,a,l,c,h)}return _?r.equalPoints(r.point(i,s),r.point(n,o))?r.point(i,s):r.lineSegment(r.point(i,s),r.point(n,o)):null},t.intersectLines=a,t.intersectLineSegments=l,t.intersectLineAndBox=function(e,t){var i=t.min.x,n=t.min.y,o=t.max.x,a=t.max.y;if(0===e.A){var l=-e.C/e.B;return n<=l&&l<=a?r.lineSegment(r.point(i,l),r.point(o,l)):null}if(0===e.B){var h=-e.C/e.A;return i<=h&&h<=o?r.lineSegment(r.point(h,n),r.point(h,a)):null}var d=[],u=function(t){var i=function(e,t){return-(e.C+e.A*t)/e.B}(e,t);n<=i&&i<=a&&c(d,new r.Point(t,i))},p=function(t){var s=function(e,t){return-(e.C+e.B*t)/e.A}(e,t);i<=s&&s<=o&&c(d,new r.Point(s,t))};switch(u(i),p(n),u(o),p(a),d.length){case 0:return null;case 1:return d[0];case 2:return r.equalPoints(d[0],d[1])?d[0]:r.lineSegment(d[0],d[1])}return s.assert(!1,"We should have at most two intersection points"),null},t.intersectRayAndBox=function(e,t,i){var s=l(e,t,i.min,new r.Point(i.max.x,i.min.y)),n=l(e,t,new r.Point(i.max.x,i.min.y),i.max),a=l(e,t,i.max,new r.Point(i.min.x,i.max.y)),c=l(e,t,new r.Point(i.min.x,i.max.y),i.min),h=[];if(null!==s&&s>=0&&h.push(s),null!==n&&n>=0&&h.push(n),null!==a&&a>=0&&h.push(a),null!==c&&c>=0&&h.push(c),0===h.length)return null;h.sort((function(e,t){return e-t}));var d=o.pointInBox(e,i)?h[0]:h[h.length-1];return e.addScaled(t.subtract(e),d)},t.intersectPolygonAndHalfplane=d,t.intersectPolygons=function(e,t){for(var i=e,s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}), t.equalBoxes=t.box=t.halfplaneThroughPoint=t.halfplane=t.lineSegment=t.lineThroughPoints=t.line=t.equalPoints=t.point=t.Point=void 0;var i=function(){function e(e,t){this.x=e,this.y=t}return e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.addScaled=function(t,i){return new e(this.x+i*t.x,this.y+i*t.y)},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y)},e.prototype.dotProduct=function(e){return this.x*e.x+this.y*e.y},e.prototype.crossProduct=function(e){return this.x*e.y-this.y*e.x},e.prototype.signedAngle=function(e){return Math.atan2(this.crossProduct(e),this.dotProduct(e))},e.prototype.angle=function(e){return Math.acos(this.dotProduct(e)/(this.length()*e.length()))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.scaled=function(t){return new e(this.x*t,this.y*t)},e.prototype.normalized=function(){return this.scaled(1/this.length())},e.prototype.transposed=function(){return new e(-this.y,this.x)},e.prototype.clone=function(){return new e(this.x,this.y)},e}();function s(e,t){return new i(e,t)}function r(e,t){return e.x===t.x&&e.y===t.y}function n(e,t,i){if(0===e&&0===t)throw new Error("A and B can not be both equal to zero.");return{A:e,B:t,C:i}}function o(e,t){return{edge:e,isPositive:t}}t.Point=i,t.point=s,t.equalPoints=r,t.line=n,t.lineThroughPoints=function(e,t){if(r(e,t))throw new Error("Points should be distinct");return n(e.y-t.y,t.x-e.x,e.x*t.y-t.x*e.y)},t.lineSegment=function(e,t){if(r(e,t))throw new Error("Points of a segment should be distinct");return[e,t]},t.halfplane=o,t.halfplaneThroughPoint=function(e,t){return o(e,e.A*t.x+e.B*t.y+e.C>0)},t.box=function(e,t){return{min:s(Math.min(e.x,t.x),Math.min(e.y,t.y)),max:s(Math.max(e.x,t.x),Math.max(e.y,t.y))}},t.equalBoxes=function(e,t){return r(e.min,t.min)&&r(e.max,t.max)}},51102:(e,t,i)=>{"use strict";t.transformPoint=t.translationMatrix=t.scalingMatrix=t.rotationMatrix=void 0;var s=i(72927);t.rotationMatrix=function(e){var t=Math.cos(e),i=Math.sin(e);return[[t,-i,0],[i,t,0],[0,0,1]]},t.scalingMatrix=function(e,t){return[[e,0,0],[0,t,0],[0,0,1]]},t.translationMatrix=function(e,t){return[[1,0,e],[0,1,t],[0,0,1]]},t.transformPoint=function(e,t){for(var i=[t.x,t.y,1],r=[0,0,0],n=0;n<3;n++)for(var o=0;o<3;o++)r[n]+=i[o]*e[n][o];return new s.Point(r[0],r[1])}},14563:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=i(75496);function r(e,t,i){return s.isNaN(t)||ti?i:Math.round(t)}function n(e,t,i){return s.isNaN(t)||ti?i:Math.round(1e4*t)/1e4}function o(e){return r(0,e,255)}function a(e){return r(0,e,255)}function l(e){return r(0,e,255)}function c(e){return n(0,e,1)}function h(e){return n(0,e,1)}function d(e){return n(0,e,1)}function u(e){return n(0,e,1)}function p(e){return n(0,e,1)}function _(e){return n(0,e,1)}function m(e){var t=e[0]/255,i=e[1]/255,s=e[2]/255,r=Math.min(t,i,s),n=Math.max(t,i,s),o=0,a=0,l=(r+n)/2;if(r===n)o=0,a=0;else{var c=n-r;switch(a=l>.5?c/(2-n-r):c/(n+r),n){case t:o=((i-s)/c+(i1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}function f(e){var t,i,s,r=e[0],n=e[1],c=e[2];if(0===n)t=i=s=c;else{var h=c<.5?c*(1+n):c+n-c*n,d=2*c-h;t=g(d,h,r+1/3),i=g(d,h,r),s=g(d,h,r-1/3)}return[o(255*t),a(255*i),l(255*s)]}t.normalizeRedComponent=o,t.normalizeGreenComponent=a,t.normalizeBlueComponent=l,t.normalizeAlphaComponent=c,t.rgb=function(e,t,i){return[o(e),a(t),l(i)]},t.areEqualRgb=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.rgba=function(e,t,i,s){if(Array.isArray(e)){var r=e;return s=t,[r[0],r[1],r[2],c(s)]}var n=t;return i=i||0,s=s||0,[o(e),a(n),l(i),c(s)]},t.areEqualRgba=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},t.normalizeHue=h,t.normalizeHslSaturation=d,t.normalizeHsvSaturation=u,t.normalizeLightness=p,t.normalizeValue=_,t.hsl=function(e,t,i){return[h(e),d(t),p(i)]},t.areEqualHsl=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.hsv=function(e,t,i){return[h(e),u(t),_(i)]},t.areEqualHsv=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.rgbToHsl=m,t.hslToRgb=f,t.rgbToHsv=function(e){var t=e[0],i=e[1],s=e[2],r=t/255,n=i/255,o=s/255,a=Math.min(r,n,o),l=Math.max(r,n,o),c=l-a,h=0,d=0===l?0:c/l,u=l;if(l===a)h=0;else switch(l){case t:h=((n-o)/c+(n255)throw new Error("invalid threshold value, valid values are [0, 255]");return S(e)>=t?"white":"black"},t.tryParseRgb=D,t.parseRgb=function(e){var t=D(e);if(null!==t)return t;throw new Error("Passed color string does not match any of the known color representations")},t.tryParseRgba=V,t.parseRgba=B},59621:e=>{e.exports={"css-value-chart-controls-bar-height-with-border":"calc(38px + 1px)","css-value-chart-controls-bar-border":"1px"}},72111:()=>{},11739:e=>{e.exports={"tv-spinner__container-rotate":"tv-spinner__container-rotate-19aXx8o_","tv-spinner__left-spin":"tv-spinner__left-spin-19aXx8o_","tv-spinner__right-spin":"tv-spinner__right-spin-19aXx8o_"}},36563:e=>{e.exports={"tv-transition--fade-in":"tv-transition--fade-in-1zC4Mcq2","tv-transition--fade-out":"tv-transition--fade-out-1zC4Mcq2","tv-transition--slide-out":"tv-transition--slide-out-1zC4Mcq2"}},1267:e=>{e.exports={container:"container-e6Js9pSl",inner:"inner-e6Js9pSl","border-left":"border-left-e6Js9pSl","border-right":"border-right-e6Js9pSl","border-top":"border-top-e6Js9pSl","border-bottom":"border-bottom-e6Js9pSl","top-right-radius":"top-right-radius-e6Js9pSl","top-left-radius":"top-left-radius-e6Js9pSl","bottom-right-radius":"bottom-right-radius-e6Js9pSl","bottom-left-radius":"bottom-left-radius-e6Js9pSl"}},54119:()=>{},93801:()=>{},28429:e=>{e.exports={css_value_currency_label_top:"6",css_value_currency_label_radius:"4",css_value_currency_label_text_horizontal_padding:"4",css_value_border_color_light:"#D1D4DC",css_value_border_color_dark:"#363A45", "price-axis-currency-label-wrapper":"price-axis-currency-label-wrapper-25tFaE37","price-axis-currency-label":"price-axis-currency-label-25tFaE37",readonly:"readonly-25tFaE37",multiline:"multiline-25tFaE37","price-axis-currency-label-dropdown":"price-axis-currency-label-dropdown-25tFaE37","price-axis-currency-label-text":"price-axis-currency-label-text-25tFaE37","price-axis-currency-label-arrow-down":"price-axis-currency-label-arrow-down-25tFaE37"}},92175:e=>{e.exports={labelwidth:"19px",labelheight:"19px",bordersize:"2px",bottommargin:"5px",gearheight:"15px",gearwidth:"15px","price-axis-stub":"price-axis-stub-1DJMiIgd",wrapper:"wrapper-1DJMiIgd",label:"label-1DJMiIgd",symbol:"symbol-1DJMiIgd",gear:"gear-1DJMiIgd","fixed-gear":"fixed-gear-1DJMiIgd","fixed-symbol":"fixed-symbol-1DJMiIgd"}},95411:()=>{},46596:()=>{},53805:e=>{e.exports={"css-value-header-toolbar-height":"38px"}},91498:e=>{e.exports={"css-value-pane-controls-padding-left":"1px","css-value-pane-controls-padding-right":"5px"}},8325:()=>{},78746:e=>{e.exports={"common-tooltip":"common-tooltip-36YLR71G","common-tooltip--hidden":"common-tooltip--hidden-36YLR71G","common-tooltip--horizontal":"common-tooltip--horizontal-36YLR71G","common-tooltip--farther":"common-tooltip--farther-36YLR71G","common-tooltip--vertical":"common-tooltip--vertical-36YLR71G","common-tooltip-farther":"common-tooltip-farther-36YLR71G","common-tooltip--direction_normal":"common-tooltip--direction_normal-36YLR71G","common-tooltip__body":"common-tooltip__body-36YLR71G","common-tooltip__button-container":"common-tooltip__button-container-36YLR71G","common-tooltip__body--no-buttons":"common-tooltip__body--no-buttons-36YLR71G","common-tooltip__button":"common-tooltip__button-36YLR71G","common-tooltip--direction_reversed":"common-tooltip--direction_reversed-36YLR71G","common-tooltip__ear-holder":"common-tooltip__ear-holder-36YLR71G","common-tooltip__ear-holder--below":"common-tooltip__ear-holder--below-36YLR71G","common-tooltip__ear-holder--above":"common-tooltip__ear-holder--above-36YLR71G","common-tooltip__ear-holder--before":"common-tooltip__ear-holder--before-36YLR71G","common-tooltip__ear-holder--after":"common-tooltip__ear-holder--after-36YLR71G","common-tooltip__body--with-hotkey":"common-tooltip__body--with-hotkey-36YLR71G","common-tooltip__body--width_wide":"common-tooltip__body--width_wide-36YLR71G","common-tooltip__body--width_narrow":"common-tooltip__body--width_narrow-36YLR71G","common-tooltip__body--no-padding":"common-tooltip__body--no-padding-36YLR71G","common-tooltip__hotkey-block":"common-tooltip__hotkey-block-36YLR71G","common-tooltip__hotkey-block--divider":"common-tooltip__hotkey-block--divider-36YLR71G","common-tooltip__hotkey-text":"common-tooltip__hotkey-text-36YLR71G","common-tooltip__hotkey-button":"common-tooltip__hotkey-button-36YLR71G","common-tooltip__plus-sign":"common-tooltip__plus-sign-36YLR71G"}},53312:(e,t,i)=>{"use strict";i.r(t),i.d(t,{colorsPalette:()=>h,getHexColorByName:()=>d}) ;const s=JSON.parse('{"color-white":"#ffffff","color-black":"#000000","color-cold-gray-50":"#F8F9FD","color-cold-gray-100":"#F0F3FA","color-cold-gray-150":"#E0E3EB","color-cold-gray-200":"#D1D4DC","color-cold-gray-250":"#C1C4CD","color-cold-gray-300":"#B2B5BE","color-cold-gray-350":"#A3A6AF","color-cold-gray-400":"#9598A1","color-cold-gray-450":"#868993","color-cold-gray-500":"#787B86","color-cold-gray-550":"#6A6D78","color-cold-gray-600":"#5D606B","color-cold-gray-650":"#50535E","color-cold-gray-700":"#434651","color-cold-gray-750":"#363A45","color-cold-gray-800":"#2A2E39","color-cold-gray-850":"#1E222D","color-cold-gray-900":"#131722","color-cold-gray-950":"#0C0E15","color-ripe-red-50":"#FFEBEC","color-ripe-red-100":"#FCCBCD","color-ripe-red-200":"#FAA1A4","color-ripe-red-300":"#F77C80","color-ripe-red-400":"#F7525F","color-ripe-red-500":"#F23645","color-ripe-red-600":"#CC2F3C","color-ripe-red-700":"#B22833","color-ripe-red-800":"#991F29","color-ripe-red-900":"#801922","color-ripe-red-a100":"#FF8080","color-ripe-red-a200":"#FF5252","color-ripe-red-a400":"#FF3333","color-ripe-red-a600":"#CC2929","color-ripe-red-a700":"#802028","color-ripe-red-a800":"#4D191D","color-ripe-red-a900":"#331F20","color-tan-orange-50":"#FFF3E0","color-tan-orange-100":"#FFE0B2","color-tan-orange-200":"#FFCC80","color-tan-orange-300":"#ffb74d","color-tan-orange-400":"#FFA726","color-tan-orange-500":"#FF9800","color-tan-orange-600":"#FB8C00","color-tan-orange-700":"#F57C00","color-tan-orange-800":"#EF6C00","color-tan-orange-900":"#e65100","color-tan-orange-a200":"#ffab40","color-tan-orange-a400":"#ff9100","color-tan-orange-a700":"#FF6D00","color-iguana-green-100":"#C8E6C9","color-iguana-green-200":"#A5D6A7","color-iguana-green-300":"#81c784","color-iguana-green-400":"#66BB6A","color-iguana-green-500":"#4caf50","color-iguana-green-600":"#43a047","color-iguana-green-700":"#388e3c","color-iguana-green-800":"#2E7D32","color-iguana-green-900":"#1B5E20","color-iguana-green-a700":"#00c853","color-banana-yellow-100":"#FFF9C4","color-banana-yellow-200":"#FFF59D","color-banana-yellow-300":"#FFF176","color-banana-yellow-400":"#ffee58","color-banana-yellow-500":"#ffeb3b","color-banana-yellow-600":"#fdd835","color-banana-yellow-700":"#fbc02d","color-banana-yellow-800":"#f9a825","color-banana-yellow-900":"#F57F17","color-banana-yellow-a400":"#ffea00","color-banana-yellow-a700":"#ffd600","color-tv-blue-50":"#E3EFFD","color-tv-blue-100":"#BBD9FB","color-tv-blue-200":"#90BFF9","color-tv-blue-300":"#5B9CF6","color-tv-blue-400":"#3179F5","color-tv-blue-500":"#2962FF","color-tv-blue-600":"#1E53E5","color-tv-blue-700":"#1848CC","color-tv-blue-800":"#143EB3","color-tv-blue-900":"#0C3299","color-tv-blue-a100":"#82b1ff","color-tv-blue-a200":"#448aff","color-tv-blue-a400":"#2979ff","color-tv-blue-a600":"#2962FF","color-tv-blue-a700":"#143A87","color-tv-blue-a800":"#142E61","color-tv-blue-a900":"#132042","color-deep-blue-100":"#D1C4E9","color-deep-blue-200":"#B39DDB","color-deep-blue-300":"#9575cd","color-deep-blue-400":"#7e57c2","color-deep-blue-500":"#673ab7","color-deep-blue-700":"#512da8","color-deep-blue-800":"#4527A0","color-deep-blue-900":"#311B92","color-deep-blue-a100":"#b388ff","color-deep-blue-a400":"#651FFF","color-deep-blue-a700":"#6200EA","color-minty-green-50":"#DAF2EE","color-minty-green-100":"#ACE5DC","color-minty-green-200":"#70CCBD","color-minty-green-300":"#42BDA8","color-minty-green-400":"#22AB94","color-minty-green-500":"#089981","color-minty-green-600":"#06806B","color-minty-green-700":"#056656","color-minty-green-800":"#004D40","color-minty-green-900":"#00332A","color-minty-green-a400":"#2BD9BC","color-minty-green-a700":"#24B29B","color-minty-green-a900":"#082621","color-grapes-purple-50":"#F3E5F5","color-grapes-purple-100":"#E1BEE7","color-grapes-purple-200":"#CE93D8","color-grapes-purple-300":"#ba68c8","color-grapes-purple-400":"#ab47bc","color-grapes-purple-500":"#9c27b0","color-grapes-purple-600":"#8e24aa","color-grapes-purple-700":"#7b1fa2","color-grapes-purple-800":"#6A1B9A","color-grapes-purple-900":"#4A148C","color-grapes-purple-a200":"#E040FB","color-grapes-purple-a400":"#D500F9","color-grapes-purple-a700":"#aa00ff","color-berry-pink-100":"#F8BBD0","color-berry-pink-200":"#f48fb1","color-berry-pink-300":"#f06292","color-berry-pink-400":"#ec407a","color-berry-pink-500":"#e91e63","color-berry-pink-600":"#D81B60","color-berry-pink-700":"#C2185B","color-berry-pink-800":"#AD1457","color-berry-pink-900":"#880E4F","color-berry-pink-a100":"#ff80ab","color-berry-pink-a200":"#ff4081","color-sky-blue-100":"#B2EBF2","color-sky-blue-200":"#80DEEA","color-sky-blue-300":"#4dd0e1","color-sky-blue-400":"#26c6da","color-sky-blue-500":"#00bcd4","color-sky-blue-600":"#00acc1","color-sky-blue-700":"#0097A7","color-sky-blue-800":"#00838F","color-sky-blue-900":"#006064","color-sky-blue-a400":"#00e5ff","color-sky-blue-a700":"#00B8D4","color-deep-blue-600":"#5E35B1","color-facebook":"#1877F2","color-deep-facebook":"#1564CA","color-twitter":"#1DA1F2","color-deep-twitter":"#188CD3","color-youtube":"#FF0000","color-linkedin":"#007BB5","color-aqua-spring":"#ebf9f5","color-army-green":"#3d2c12","color-army-green-2":"#31230d","color-athens-gray-1":"#f2f3f5","color-athens-gray-2":"#f7f8fa","color-athens-gray-3":"#eceff2","color-black-180":"#b4b4b4","color-blue-dianne":"#21384d","color-bluish":"#2185cc","color-bright-gray":"#363c4e","color-brownish-grey":"#8d6e63","color-carnation":"#f04561","color-catskill-white":"#e1ecf2","color-charade":"#2f3241","color-charcoal-grey":"#323337","color-curious-blue":"#299dcd","color-dark-blue-grey":"#123440","color-darkness-blue-grey":"#12213b","color-dark-grey":"#292a2d","color-dark-grey-blue":"#28415a","color-dark-sky-blue":"#37a6ef","color-deep-sea-blue":"#016087","color-ebony-clay":"#262b3e","color-foam":"#d7f0fb","color-gull-gray":"#9db2bd","color-humming-bird":"#d3eef9","color-keppel-1":"#37bc9b","color-keppel-2":"#34b293","color-lavender-blush":"#ffedf0","color-lightish-purple":"#a75ee8","color-loblolly":"#c5cbce","color-manatee":"#878ca8","color-mandy":"#eb4d5c","color-medium-blue":"#2e7bb2","color-milk-chocolate":"#6f2626","color-mirage-1":"#131722","color-mirage-2":"#171b29","color-mirage-3":"#1c2030","color-mischka":"#d6d8e0","color-morning-glory":"#9addcc","color-oslo-gray":"#8b8e95","color-pale":"#fff2cf","color-pale-grey-1":"#f9fafb","color-pale-grey-2":"#e7ebee","color-pale-sky":"#6b7988","color-picton-blue-1":"#3bb3e4","color-puerto-rico":"#3bc2a1","color-purple-brown":"#4e2934","color-purple-brown-2":"#3d2028","color-radical-red":"#ff4a68","color-regent-gray":"#8797a5","color-scooter":"#38acdb","color-silver-tree":"#53b987","color-slate-gray":"#758696","color-sundown":"#ffa4b3","color-sunglow":"#ffca3b","color-tan-hide":"#ff9850","color-trout-1":"#4c525e","color-trout-2":"#4f5966","color-violet-1":"#332738","color-violet-2":"#271d2b","color-white-ice":"#ebf7fc","color-wild-watermelon":"#ff5773","color-readonly-input":"#b4b4b4","color-brand-dark":"#2a2c39","color-seeking-alpha-brand":"#ff7200"}'),r=JSON.parse('{"color-bg-primary":"color-white","color-bg-primary-hover":"color-cold-gray-100","color-bg-secondary":"color-white","color-bg-highlight":"color-cold-gray-50","color-bg-scroll-buttons":"color-cold-gray-100","color-legacy-bg-scroll-buttons":"color-cold-gray-850","color-legacy-bg-widget":"color-white","color-text-primary":"color-cold-gray-900","color-text-secondary":"color-cold-gray-500","color-text-tertiary":"color-cold-gray-400","color-text-disabled":"color-cold-gray-300","color-accent-content":"color-cold-gray-900","color-box-shadow":"color-cold-gray-300","color-divider":"color-cold-gray-150","color-divider-hover":"color-cold-gray-100","color-divider-secondary":"color-cold-gray-100","color-active-hover-text":"color-cold-gray-900","color-alert-text":"color-cold-gray-900","color-border-table":"color-cold-gray-100","color-brand":"color-tv-blue-500","color-brand-active":"color-tv-blue-700","color-brand-hover":"color-tv-blue-600","color-chart-page-bg":"color-cold-gray-150","color-common-tooltip-bg":"color-cold-gray-800","color-danger":"color-ripe-red-400","color-danger-hover":"color-ripe-red-500","color-danger-active":"color-ripe-red-600","color-depthrenderer-stroke-style":"color-cold-gray-100","color-highlight-new":"color-tan-orange-50","color-input-bg":"color-white","color-input-publish-bg":"color-white","color-link":"color-tv-blue-500","color-link-hover":"color-tv-blue-600","color-link-active":"color-tv-blue-700","color-list-nth-child-bg":"color-cold-gray-50","color-pane-bg":"color-white","color-pane-secondary-bg":"color-cold-gray-100","color-popup-menu-item-hover-bg":"color-cold-gray-100","color-popup-menu-separator":"color-cold-gray-150","color-screener-description":"color-cold-gray-650","color-success":"color-minty-green-500","color-success-hover":"color-minty-green-600","color-success-active":"color-minty-green-700","color-toolbar-button-text":"color-cold-gray-900","color-toolbar-button-text-hover":"color-cold-gray-900","color-toolbar-button-text-active":"color-tv-blue-500","color-toolbar-button-text-active-hover":"color-tv-blue-600","color-toolbar-button-background-hover":"color-cold-gray-100","color-toolbar-button-background-secondary-hover":"color-cold-gray-150","color-toolbar-toggle-button-background-active":"color-tv-blue-500","color-toolbar-toggle-button-background-active-hover":"color-tv-blue-600","color-toolbar-interactive-element-text-normal":"color-cold-gray-900","color-toolbar-interactive-element-text-hover":"color-cold-gray-900","color-toolbar-opened-element-bg":"color-cold-gray-100","color-tooltip-bg":"color-cold-gray-800","color-tv-dialog-caption":"color-cold-gray-650","color-tv-dropdown-item-hover-bg":"color-cold-gray-100","color-underlined-text":"color-cold-gray-500","color-widget-pages-bg":"color-white","color-warning":"color-tan-orange-500","color-growing":"color-minty-green-400","color-falling":"color-ripe-red-400","color-forex-icon":"color-cold-gray-750","color-list-item-active-bg":"color-tv-blue-400","color-list-item-hover-bg":"color-tv-blue-50","color-list-item-text":"color-cold-gray-800","color-price-axis-label-back":"color-cold-gray-150","color-price-axis-label-text":"color-cold-gray-650","color-price-axis-gear":"color-cold-gray-900","color-price-axis-gear-hover":"color-black","color-price-axis-highlight":"color-cold-gray-150","color-bid":"color-tv-blue-500","color-border":"color-cold-gray-150","color-border-chat-fields":"color-cold-gray-250","color-border-hover":"color-cold-gray-250","color-button-hover-bg":"color-cold-gray-150","color-depthrenderer-fill-style":"color-cold-gray-650","color-disabled-border-and-color":"color-cold-gray-150","color-disabled-input":"color-cold-gray-150","color-empty-container-message":"color-cold-gray-500","color-icons":"color-cold-gray-500","color-input-textarea-readonly":"color-cold-gray-650","color-input-placeholder-text":"color-cold-gray-350","color-item-active-blue":"color-tv-blue-50","color-item-hover-active-bg":"color-tv-blue-100","color-item-hover-bg":"color-tv-blue-100","color-item-hover-blue":"color-tv-blue-100","color-item-selected-blue":"color-tv-blue-50","color-item-active-text":"color-white","color-item-active-bg":"color-tv-blue-500","color-list-item":"color-cold-gray-450","color-news-highlight":"color-tv-blue-100","color-placeholder":"color-cold-gray-350","color-row-hover-active-bg":"color-cold-gray-100","color-sb-scrollbar-body-bg":"color-cold-gray-200","color-section-separator-border":"color-cold-gray-300","color-separator-table-chat":"color-cold-gray-150","color-tag-active-bg":"color-cold-gray-200","color-tag-hover-bg":"color-cold-gray-150","color-text-regular":"color-cold-gray-700","color-tv-button-checked":"color-cold-gray-550","color-scroll-bg":"color-cold-gray-400","color-scroll-border":"color-cold-gray-100","color-widget-border":"color-cold-gray-100","color-scroll-buttons-arrow":"color-white","color-control-intent-default":"color-cold-gray-200","color-control-intent-success":"color-minty-green-600","color-control-intent-primary":"color-tv-blue-500","color-control-intent-warning":"color-tan-orange-500","color-control-intent-danger":"color-ripe-red-500","color-pre-market":"color-tan-orange-600","color-pre-market-bg":"color-tan-orange-400","color-post-market":"color-tv-blue-500","color-post-market-bg":"color-tv-blue-400","color-market-open":"color-minty-green-500","color-market-open-bg":"color-minty-green-400","color-market-closed":"color-cold-gray-400","color-market-holiday":"color-cold-gray-400","color-invalid-symbol":"color-ripe-red-400","color-invalid-symbol-hover":"color-ripe-red-700","color-replay-mode":"color-tv-blue-500","color-replay-mode-icon":"color-white","color-replay-mode-hover":"color-tv-blue-600","color-notaccurate-mode":"color-berry-pink-700","color-notaccurate-mode-bg":"color-berry-pink-400","color-delay-mode":"color-tan-orange-700","color-delay-mode-bg":"color-tan-orange-400","color-eod-mode":"color-grapes-purple-700","color-eod-mode-bg":"color-grapes-purple-400","color-data-problem":"color-ripe-red-600","color-data-problem-bg":"color-ripe-red-400","color-data-problem-hover":"color-ripe-red-700","color-list-item-bg-highlighted":"color-tv-blue-50","color-list-item-bg-selected":"color-tv-blue-100","color-list-item-bg-highlighted-hover":"color-tv-blue-100","color-list-item-bg-selected-hover":"color-tv-blue-200","color-screener-header-bg":"color-white","color-screener-header-bg-hover":"color-cold-gray-100","color-marker-flagged":"color-ripe-red-400","color-marker-flagged-hovered":"color-ripe-red-600","color-ask":"color-ripe-red-400","color-sell":"color-ripe-red-400","color-buy":"color-tv-blue-500","color-neutral":"color-cold-gray-500","color-pro":"color-minty-green-400","color-pro-hover":"color-minty-green-600","color-pro-plus":"color-tv-blue-500","color-pro-plus-hover":"color-tv-blue-600","color-pro-premium":"color-tan-orange-500","color-pro-premium-hover":"color-tan-orange-700","color-trial":"color-cold-gray-500","color-trial-hover":"color-cold-gray-600","color-mod":"color-ripe-red-400","color-mod-hover":"color-ripe-red-600","color-ad":"color-banana-yellow-a700","color-broker-featured":"color-minty-green-400","color-broker-featured-hover":"color-minty-green-600","color-alert-status-active":"color-minty-green-400","color-alert-status-stopped":"color-ripe-red-500","color-alert-status-triggered":"color-tan-orange-500","color-covid19-confirmed":"color-ripe-red-500","color-covid19-recovered":"color-minty-green-500","color-covid19-deaths":"color-cold-gray-450","color-overlay":"color-cold-gray-400","color-search-button-hover":"color-cold-gray-150","color-common-tooltip-text":"color-cold-gray-100","color-replay-data-mode":"color-radical-red","color-legacy-success":"color-keppel-1","color-collapse-tabs-border":"color-athens-gray-3","color-site-widget-hover":"color-athens-gray-1","color-attention":"color-sunglow","color-card-border":"color-cold-gray-150","color-card-border-hover":"color-cold-gray-300","color-background-special-primary":"color-white","color-stroke-special-primary":"color-cold-gray-150","color-selection-bg":"color-tv-blue-100"}') ;var n=i(16282);const o={...s,...r},a={},l=Object.keys(o).length,c=/^#[0-9A-F]{6}$/i;Object.keys(o).forEach(e=>{const t=function e(t,i=[]){const s=o[t];if(!s)return null;if(c.test(s))return s;const r=s;return i.push(t),-1!==i.indexOf(r)?(console.warn("Colors definitions cycled"),s):i.length>l?(console.warn("Too many variables-link in HEX-color search: "+i[0]),null):e(r,i)}(e);a[e]=(0,n.ensureNotNull)(t)});const h=a;function d(e){const t=h[e];if(!t)throw new Error("No such color "+e);return t}},8596:(e,t,i)=>{"use strict";i.d(t,{dur:()=>s,easingFunc:()=>r,CubicBezier:()=>n});const s=350,r={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};class n{constructor(e,t,i,s){this._mX1=e,this._mY1=t,this._mX2=i,this._mY2=s}easingFunc(e){return this._mX1===this._mY1&&this._mX2===this._mY2?e:this._calcBezier(this._getTForX(e))}_a(e,t){return 1-3*t+3*e}_b(e,t){return 3*t-6*e}_c(e){return 3*e}_calcBezier(e){return((this._a(this._mY1,this._mY2)*e+this._b(this._mY1,this._mY2))*e+this._c(this._mY1))*e}_getSlope(e){return 3*this._a(this._mX1,this._mX2)*e*e+2*this._b(this._mX1,this._mX2)*e+this._c(this._mX1)}_getTForX(e){let t=e;for(let i=0;i<4;++i){const i=this._getSlope(t);if(0===i)return t;t-=(this._calcBezier(t)-e)/i}return t}}},30618:(e,t,i)=>{"use strict";i.d(t,{setupChartEventHint:()=>d});var s=i(16282),r=i(79881),n=i(64222),o=i(15521),a=i(33033),l=i(43367),c=i(42998),h=i(27490);function d(e,t=!1){if(!h.enabled("popup_hints"))return;const d=e.getContainer();let u=null,p=null;function _(e,t){if(u)u.show(e,g.bind(null,t));else{const s=o.tool.value();Promise.all([i.e(5453),i.e(5514),i.e(6166)]).then(i.bind(i,25057)).then(i=>{u=new i.ChartEventHintRenderer(d),s===o.tool.value()&&u.show(e,g.bind(null,t))})}}function m(e){return!Boolean(n.getBool(e))}function g(e){n.setValue(e,!0,{forceFlush:!0}),(0,s.ensureNotNull)(u).destroy(),null!==p&&p(),u=null}o.tool.subscribe((function(){if(!m("hint.touchPainting"))return;const e=o.tool.value(),t=(0,a.isLineToolDrawWithoutPoints)(e),i=l.CheckMobile.any();!(0,a.isStudyLineToolName)(e)||"LineToolRegressionTrend"===e||t||i?(0,a.isLineToolName)(e)&&!(0,a.isLineDrawnWithPressedButton)(e)&&!t&&i?_((0,r.t)("Move the point to position the anchor then tap to place"),"hint.touchPainting"):u&&u.hide():_((0,r.t)("Click to set a point"),"hint.touchPainting")})),o.createdLineTool.subscribe(null,(function(){const e=o.tool.value();"LineToolPath"===e&&m("hint.finishBuildPathByDblClick")?_((0,r.t)("Double-click to finish Path"),"hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&m("hint.finishBuildPolylineByDblClick")&&_((0,r.t)("Double-click to finish Polyline"),"hint.finishBuildPolylineByDblClick")})),o.finishedLineTool.subscribe(null,(function(){if(u){ const e=o.tool.value();"LineToolPath"===e?g("hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&g("hint.finishBuildPolylineByDblClick")}})),t||l.CheckMobile.any()||!m("hint.startFocusedZoom")||(p=function(e,t){let i=!1;const s=r=>{r?(i&&t(r),e.onZoom().unsubscribe(null,s)):i||(t(r),i=!0)};return e.onZoom().subscribe(null,s),()=>e.onZoom().unsubscribe(null,s)}(e,(function(e){if(!m("hint.startFocusedZoom"))return;if(e)u&&(p=null,g("hint.startFocusedZoom"));else{const e=c.isMacKeyboard?"⌘":"Ctrl";_((0,r.t)("Press and hold {key} while zooming to maintain the chart position").format({key:e}),"hint.startFocusedZoom")}})))}},82831:(e,t,i)=>{"use strict";i.d(t,{setupChartScreenshotHint:()=>o});var s=i(79881),r=i(18437),n=i(16282);function o(e,t){const o=(0,s.t)("Link to the chart image copied to clipboard {emoji}").format({emoji:"👍"}),a=(0,s.t)("Chart image copied to clipboard {emoji}").format({emoji:"👍"});r.on("onServerScreenshotCopiedToClipboard",()=>h(o),null),r.on("onClientScreenshotCopiedToClipboard",()=>h(a),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(4652),i.e(5514),i.e(92)]).then(i.bind(i,38868)).then(i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))})}}},65726:(e,t,i)=>{"use strict";i.d(t,{getTooltipData:()=>r,setTooltipData:()=>n});const s=new WeakMap;function r(e,t){const i=s.get(e);return i instanceof Function?i(t):i&&i[t]}function n(e,t,i){if(i instanceof Function)return void s.set(e,i);const r=s.get(e),n=void 0===r||r instanceof Function?{}:r;n[t]=i,s.set(e,n)}},19598:(e,t,i)=>{"use strict";i.d(t,{hotKeySerialize:()=>r,hotKeyDeserialize:()=>n});var s=i(79039);function r(e){return(0,s.clean)(JSON.stringify(e))}function n(e){return JSON.parse((0,s.clean)(e,!0))}},74384:(e,t,i)=>{"use strict";i.d(t,{hide:()=>G,show:()=>U,showOnElement:()=>z});var s=i(96404);let r=0,n=0,o=0;function a(){clearTimeout(r),clearTimeout(n),clearTimeout(o)}function l(e,t){r=setTimeout(e,t)}const c="tooltip-root-element";let h;function d(){const e=document.getElementById(c);e?h=e:(h=document.createElement("div"),h.id=c,document.body.appendChild(h))}function u(){h&&(h.innerHTML="")}"interactive"===document.readyState?d():document.addEventListener("DOMContentLoaded",d);var p=i(16282);const _={default:"",white:"theme-white","round-shadow":"theme-round-shadow"},m=Object.keys(_);var g=i(65726),f=i(19598),v=i(67235),S=i(76553),y=(i(95068),i(39197)),b=i(57968),w=i(43367),P=i(78746);function C(e){const t=function(e){const t=e.hasAttribute("data-tooltip")?e.getAttribute("data-tooltip"):e.getAttribute("title");return t&&((0,g.setTooltipData)(e,"text",t),e.removeAttribute("title")),(0,g.getTooltipData)(e,"text")||""}(e),i=e.getBoundingClientRect(),s={h:i.height,w:i.width,x:i.left,y:i.top},r=e.getAttribute("data-color-theme")||"",n=e.classList.contains("common-tooltip-html"),o=parseInt(e.getAttribute("data-tooltip-delay")||""),a=parseInt(e.getAttribute("data-tooltip-debounce")||"");let l={type:"none"};return t&&(l={ type:n?"html":"text",data:t}),{above:e.classList.contains("common-tooltip-above"),below:e.classList.contains("common-tooltip-below"),otl:e.classList.contains("common-tooltip-otl"),otr:e.classList.contains("common-tooltip-otr"),vertical:e.classList.contains("common-tooltip-vertical"),hotkey:e.getAttribute("data-tooltip-hotkey"),narrow:e.classList.contains("common-tooltip-narrow"),wide:e.classList.contains("common-tooltip-wide"),colorTheme:r,tooltipDelay:o,tooltipDebounce:a,rect:s,content:l,target:e}}function T(e){const t=E.cloneNode(!0),i=B(t),{content:s}=e;switch(s.type){case"element":i.innerHTML="",i.appendChild(s.data);break;case"html":i.innerHTML=s.data;break;case"text":if(e.hotkey){const e=V.cloneNode(!0);e.innerText=s.data,i.appendChild(e)}else i.innerText=s.data}if(e.hotkey){const t="none"!==s.type,r=D.cloneNode(!0),n=(0,f.hotKeyDeserialize)(e.hotkey),o=n.keys.map(e=>`${e}`);r.innerHTML=function(e,t){return e.replace(/{\d}|{hotkey_\d}/gi,e=>{const i=Number(e.match(/\d/));return t[i]})}(n.text,o).replace(/\s\+\s/g,`+`),i.classList.add(P["common-tooltip__body--with-hotkey"]),t&&r.classList.add(P["common-tooltip__hotkey-block--divider"]),i.appendChild(r)}return t.addEventListener("contextmenu",y.preventDefault),t}function x(e,t){const i=t.rect;if(!i)return;!function(e,t){const i=m.includes(t)?_[t]:"";e.classList.remove(...m.map(e=>_[e]).filter(e=>!!e)),i&&!e.classList.contains(i)&&e.classList.add(i)}(e,t.colorTheme||"default"),t.addClass&&e.classList.add(t.addClass);const s=B(e),r=e.querySelector("."+P["common-tooltip__button-container"]);s.classList.toggle(P["common-tooltip__body--width_wide"],Boolean(t.wide)),s.classList.toggle(P["common-tooltip__body--no-padding"],Boolean(t.noPadding)),s.classList.toggle(P["common-tooltip__body--width_narrow"],Boolean(t.narrow)),s.classList.toggle(P["common-tooltip__body--no-buttons"],!0),s.style.left=M(0),s.style.width=M(s.clientWidth+(Boolean(t.noPadding)?0:2));const n=document.body.clientWidth,o=w.CheckMobile.iOS()||(0,w.supportTouch)()&&(0,w.isMac)()?window.innerHeight:document.body.clientHeight,a=t.vertical,l=t.extendMargin||a&&i.w<20||!a&&i.h<20;e.classList.toggle(P["common-tooltip--farther"],l),e.classList.toggle(P["common-tooltip--vertical"],a),e.classList.toggle(P["common-tooltip--horizontal"],!a);const c=function(e){return e.querySelector("."+P["common-tooltip__ear-holder"])}(e),h=e.offsetHeight;if(a){const a=10,l=o-10,d=12,u=a+d,p=l-d,_=(0,b.clamp)(i.y+i.h/2,u,p)-h/2,m=_+h;e.style.left=M(i.x+i.w),e.style.top=M(_),_l&&(s.style.top=r.style.top=M(l-m));const{right:g}=(e.querySelector(":last-child")||s).getBoundingClientRect(),f=g+10>n;e.classList.toggle(P["common-tooltip--direction_reversed"],f),e.classList.toggle(P["common-tooltip--direction_normal"],!f);let v=f?"after":"before";(0,S.isRtl)()?(v=t.otr?"after":v,v=t.otl?"before":v):(v=t.otr?"before":v,v=t.otl?"after":v), c.classList.toggle(P["common-tooltip__ear-holder--before"],"before"===v),c.classList.toggle(P["common-tooltip__ear-holder--after"],"after"===v),"after"===v&&(e.style.left="auto",e.style.right=M(n-i.x))}else{const a=i.x-(s.offsetWidth-i.w)/2,l=n-10-e.offsetWidth,d=Math.max(10,Math.min(a,l));e.style.left=M(d);const u=l\n\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\n`,A=`\n\t
\n`,k=`\n\t
\n`,E=(0,v.parseHtmlElement)(L),D=(0,v.parseHtmlElement)(A),V=(0,v.parseHtmlElement)(k);function B(e){return e.querySelector("."+P["common-tooltip__body"])}function N(e,t){return 10+ez(t);if(i()){const e=e=>{e.target instanceof Element&&e.target.contains(t)&&s(null,!0)},s=(r,n=!1)=>{t.removeEventListener("common-tooltip-update",i),t.removeEventListener("mouseleave",s),t.removeEventListener("mousedown",s),document.removeEventListener("scroll",e,{capture:!0}),W&&(W.destroy(),W=null),G(n)};t.addEventListener("common-tooltip-update",i),t.addEventListener("mouseleave",s),t.addEventListener("mousedown",s),document.addEventListener("scroll",e,{capture:!0}),null===W&&(W=(0,R.createGroup)({desc:"Tooltip"}),W.add({desc:"Hide",hotkey:27,handler:s}));break}}}),!0);const H=new MutationObserver(()=>{if(F&&F.options.target){let e;e="isConnected"in F.options.target?F.options.target.isConnected:document.body.contains(F.options.target),e||G()}}),z=(e,t={})=>{ const{content:i,...s}=Y(t),r=C(e),n=Object.assign(r,s);return"none"!==i.type&&(n.content=i),!("none"===n.content.type&&!n.hotkey)&&(n.target=e,U(n),!0)},U=e=>{const t=Y(e),i=T(t);var s;if(F={options:t,element:i},s=i,u(),h&&h.appendChild(s),a(),!O)return I(i),void l(()=>q(i),function(e){return"number"!=typeof e.tooltipDelay||isNaN(e.tooltipDelay)?500:e.tooltipDelay}(t));const{tooltipDebounce:r}=e;"number"!=typeof r||isNaN(r)?q(i):l(()=>q(i),r)};function j(){u(),O=!1,F=null}const G=e=>{if(a(),H.disconnect(),!F)return;if(!e&&!O)return;const{element:t,options:i}=F,s=()=>{t.removeEventListener("mouseleave",s),I(t),e?j():o=setTimeout(()=>{j()},250)};var r,l;i.tooltipHideDelay?(r=()=>{t.querySelector(":hover")?t.addEventListener("mouseleave",s):s()},l=i.tooltipHideDelay,n=setTimeout(r,l)):s()};function q(e){const{options:t}=(0,p.ensureNotNull)(F);if(x(e,t),function(e){e.classList.toggle(P["common-tooltip--hidden"],!1)}(e),H.observe(document,{childList:!0,subtree:!0}),O=!0,t.forceHideOnMove){const e=()=>{document.removeEventListener("mousemove",e),G()};document.addEventListener("mousemove",e)}}function Y(e){if(function(e){return"content"in e}(e))return e;const{inner:t,html:i,text:s,...r}=e;let n={type:"none"};return t&&(n={type:"element",data:t}),s&&(n={type:i?"html":"text",data:s}),{content:n,...r}}},41547:(e,t,i)=>{"use strict";i.d(t,{ChartPage:()=>d});var s=i(32856),r=i.n(s),n=i(30779);function o(e,t){let i=0;for(const{min:s,max:r}of t){if(e0&&t.push({min:e,max:s})}return t.sort((e,t)=>e.min-t.min||e.max-t.max),t}function l(e,t){if(e.length!==t.length)return!1;for(let i=e.length;i--;){if(e[i].min!==t[i].min)return!1;if(e[i].max!==t[i].max)return!1}return!0}var c=i(27490);const h=c.enabled("no_min_chart_width");class d{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this._affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t)=>{let i=t;this._fullscreenArea!==e.name&&(e.availWidth.setValue(t),e.canNegotiate.width&&(i=o(t,e.negotiations.width)));const s=e.container.value();return s&&(s.style.width=i+"px"),e.width.setValue(i),i},this._setHeight=(e,t)=>{let i=t;this._fullscreenArea!==e.name&&(e.availHeight.setValue(t),e.canNegotiate.height&&(i=o(t,e.negotiations.height)));const s=e.container.value();return s&&(s.style.height=i+"px"),e.height.setValue(i),i};const t=e.container.value();if(!t)throw new Error("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe(()=>this.recalculate()),this._height.subscribe(()=>this.recalculate()), this._bridge.visible.subscribe(()=>this._updateVisibility()),this._bridge.fullscreen.subscribe(()=>this._onParentFullscreenChange()),this.recalculate()}allocate(e){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=a(e);l(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=a(e);l(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new(r()),height:new(r()),availWidth:new(r()),availHeight:new(r()),alive:new(r())(!0),container:new(r())(i),visible:new(r())(!0),fullscreen:new(r())(!1),fullscreenable:new(r())("right"===t||"center"===t),rdState:new n.ResizerDetacherState};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe(e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=this._availableAreas[i];if(this._affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()},{callWithLast:!0}),s.rdState.bridge()}free(e){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e;const t=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,r=this._areas.right,n=this._areas.top,o=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),d=this._height.value();let u=0,p=0,_=0,m=0,g=0,f=0,v=0,S=0;if(e===this._recalcSingleRunToken&&l&&this._processVisibility(l)&&(S=this._setHeight(l,d),this._setWidth(l,c)),e===this._recalcSingleRunToken&&t&&this._processVisibility(t)){v=this._setHeight(t,d),f=this._setWidth(t,c),f&&(f+=4);const e=t.container.value();e&&(e.style.top=S+"px")}if(e===this._recalcSingleRunToken&&i&&this._processVisibility(i)){const e=i.container.value();e&&(e.style.top=v+S+"px"),this._setHeight(i,d-v-S),_=this._setWidth(i,c),_&&(_+=4)}if(e===this._recalcSingleRunToken&&s&&this._processVisibility(s)){this._setHeight(s,d);let e=c-_;h||(e-=300),g=this._setWidth(s,e)}if(e===this._recalcSingleRunToken&&r&&this._processVisibility(r)){this._setHeight(r,d-S) ;let e=c-_-g;h||(e-=300),m=this._setWidth(r,e);const t=r.container.value();t&&(t.style.top=S+"px")}const y=g+m,b=y?4:0;if(e===this._recalcSingleRunToken&&n&&this._processVisibility(n)){const e=Math.max(f,_),t=n.container.value();t&&(t.style.left=e+"px",t.style.top=S+"px");const i=c-e-g-m-b;this._setWidth(n,i),u=this._setHeight(n,d)}let w=0;const P=c-_-g-m-b;if(e===this._recalcSingleRunToken&&o&&this._processVisibility(o)){const e=o.container.value();e&&(e.style.left=_+"px",e.classList.toggle("no-border-top-left-radius",!_),e.classList.toggle("no-border-top-right-radius",!y)),this._setWidth(o,P);const t=d-S;w=Math.min(300,t-0),p=this._setHeight(o,t)+4}if(e===this._recalcSingleRunToken&&a&&this._processVisibility(a)){const e=a.container.value();e&&(e.style.left=_+"px",e.style.top=u+S+"px",e.classList.toggle("no-border-bottom-left-radius",!p||!_),e.classList.toggle("no-border-bottom-right-radius",!y||!p)),this._setWidth(a,P);const t=d-u-p-S;this._setHeight(a,Math.max(t,w))}if(e===this._recalcSingleRunToken&&s&&this._affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m+"px",e.style.top=S+"px")}e===this._recalcSingleRunToken&&this._updateVisibility()}_affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return u(e);if(this._width.value()<=567||this._height.value()<=445){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t{"use strict";i.d(t,{ResizerDetacherState:()=>o});var s=i(16282),r=i(32856),n=i.n(r);class o{constructor(e){this._alive=new(n()),this._container=new(n()),this._width=new(n()),this._height=new(n()),this._fullscreen=new(n()),this._detachable=new(n()),this._fullscreenable=new(n()),this._visible=new(n()),this._availWidth=new(n()),this._availHeight=new(n()),this._owner=new(n()),this._ownersStack=[],this.owner=this._owner.readonly(),this._bridge={ alive:this._alive.readonly(),container:this._container.readonly(),width:this._width.readonly(),height:this._height.readonly(),fullscreen:this._fullscreen.readonly(),detachable:this._detachable.readonly(),fullscreenable:this._fullscreenable.readonly(),visible:this._visible.readonly(),availWidth:this._availWidth.readonly(),availHeight:this._availHeight.readonly(),remove:()=>{const e=this._owner.value();e&&e.remove&&e.remove()},negotiateWidth:e=>{const t=this._owner.value();t&&t.negotiateWidth&&t.negotiateWidth(e)},negotiateHeight:e=>{const t=this._owner.value();t&&t.negotiateHeight&&t.negotiateHeight(e)},requestFullscreen:()=>{const e=this._owner.value();e&&e.requestFullscreen&&e.requestFullscreen()},exitFullscreen:()=>{const e=this._owner.value();e&&e.exitFullscreen&&e.exitFullscreen()},detach:e=>{const t=this._owner.value();t&&t.detach&&t.detach(e)},attach:()=>{const e=this._owner.value();e&&e.attach&&e.attach()}},e&&this.pushOwner(e)}bridge(){return this._bridge}pushOwner(e){if(!e.alive.value())return;for(const e of this._ownersStack)this._unsubscribeOwner(e);const t={owner:e};this._ownersStack.push(t),this._subscribeOwner(t)}_subscribeOwner(e){const t=e.owner;if(e.deathWatcher||(this._alive.setValue(!0),e.deathWatcher=t.alive.spawn(),e.deathWatcher.subscribe(t=>{t||this._deadHandler(e)})),this._owner.setValue(t),!e.subscriptions){const i=e.subscriptions=[];this._visible.setValue(!1);const s=(e,t)=>{if(e){const s=e.spawn();i.push(s),s.subscribe(e=>{t.setValue(e)},{callWithLast:!0})}else t.deleteValue()};s(t.container,this._container),s(t.width,this._width),s(t.height,this._height),s(t.fullscreen,this._fullscreen),s(t.detachable,this._detachable),s(t.fullscreenable,this._fullscreenable),s(t.availWidth,this._availWidth),s(t.availHeight,this._availHeight),s(t.visible,this._visible)}}_unsubscribeOwner(e,t){if(e.subscriptions){for(const t of e.subscriptions)t.unsubscribe();e.subscriptions=null}t&&e.deathWatcher&&(e.deathWatcher.unsubscribe(),e.deathWatcher=null)}_deadHandler(e){const t=this._ownersStack.indexOf(e);(0,s.assert)(-1!==t,"sanitized owner should be in stack");for(let e=this._ownersStack.length-1;e>=t;e--)this._unsubscribeOwner(this._ownersStack[e],!0);this._ownersStack.length=t,t>0?this._subscribeOwner(this._ownersStack[t-1]):(this._alive.setValue(!1),this._owner.deleteValue())}}},89979:(e,t,i)=>{"use strict";i.d(t,{Root:()=>d});i(79881);var s=i(32856),r=i.n(s),n=i(30779);class o{constructor(e){this._document=e,this.isFullscreen=new(r());const t=()=>{const e=["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"];for(let t=0;t{this.isVisible.setValue(!e[r])},i(),e.addEventListener(t,i,!1);break}}this.destroy=()=>{i&&(e.removeEventListener(t,i,!1),i=null)}}}var l=i(22900),c=i(16282),h=i(43367);class d{constructor(e){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",e+"px","important")},this._window=e,this._fullscreenApi=new o(e.document),this._viewportType=h.CheckMobile.iOS()&&!(0,l.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,c.ensureDefined)(this._window.visualViewport):this._viewport=this._window;const t=this._layoutSizeSensor=this._window.document.createElement("div");t.id="layout-size-sensor",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.right="0",t.style.bottom="0",t.style.pointerEvents="none",t.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new a(this._window.document);const i={alive:new(r())(!0),fullscreenable:new(r())(!0),container:new(r())(t),width:new(r()),height:new(r()),availWidth:new(r()),availHeight:new(r()),visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe(e=>{e||i!==this._area||this.free()}),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new n.ResizerDetacherState(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=null==t?void 0:t.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){ if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe(e=>{this._resizeHandler&&this._resizeHandler()})}}},98852:(e,t,i)=>{"use strict";i.d(t,{DEFAULT_SIZE:()=>s,spinnerSizeMap:()=>r});const s="large",r={mini:"xsmall",xsmall:"xsmall",small:"small",medium:"medium",large:"large"}},23214:(e,t,i)=>{"use strict";i.d(t,{Spinner:()=>o});i(11739);var s=i(67235),r=i(98852);const n=(0,s.parseHtmlElement)('\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\x3c!--\n\t\t\t\t--\x3e
\n\t\t\t
\n\t\t
\n\t');class o{constructor(e){this._shown=!1,this._el=n.cloneNode(!0),this.setSize(r.spinnerSizeMap[e||r.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach(t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)}),this}style(){return this._el.style}setSize(e){const t=void 0!==e?"tv-spinner--size_"+e:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}},6369:(e,t,i)=>{"use strict";i.d(t,{createStubElem:()=>r});var s=i(1267);function r(e=[],t=[]){const i=document.createElement("div"),r=document.createElement("div");return i.appendChild(r),i.classList.add(s.container),r.classList.add(s.inner),e.forEach(e=>{i.classList.add(s[e])}),t.forEach(e=>{i.classList.add(s[e])}),i}},73900:(e,t,i)=>{"use strict";i.r(t),i.d(t,{lineToolEntityInfo:()=>o,studyEntityInfo:()=>a,seriesEntityInfo:()=>l,entityForDataSource:()=>c});var s=i(17e3),r=i(85125),n=i(67945);function o(e){return{id:e.id(),name:(t=e.toolname,Object.keys(r.supportedLineTools).find(e=>r.supportedLineTools[e].name===t)||null)};var t}function a(e){return{id:e.id(),name:e.metaInfo().description}}function l(e){return{id:e.id(),name:"Main Series"}}function c(e,t){return t===e.mainSeries()?l(e.mainSeries()):(0,s.isStudy)(t)?a(t):(0,n.isLineTool)(t)?o(t):null}},24947:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isLineToolRiskReward:()=>a,LineDataSourceApi:()=>c});var s=i(16282),r=i(47903);const n=new Map([["LineToolRiskRewardLong",2],["LineToolRiskRewardShort",2],["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function o(e){const t=n.get(e.toolname) ;if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function a(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}const l=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class c{constructor(e,t,i){this._source=e,this._model=t,this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(){return this._source.properties().state(l,!0)}setProperties(e){this._setProps(this._source.properties(),e,"")}getPoints(){let e=this._source.points();const t=o(this._source);return e.length>t&&((0,s.assert)(a(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;const t=o(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}ownerSourceId(){return(0,s.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;const i=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){return this._source.isSourceHidden()}getRawPoints(){return this._source.points()}setRawPoint(e,t){this._model.startChangingLinetool(this._source,{...t},e),this._model.changeLinePoint({...t}),this._model.endChangingLinetool(!1)}move(e,t){this._model.startMovingSources([this._source],{logical:e},null,new Map),this._model.moveSources({logical:t},new Map),this._model.endMovingSources(!1)}dataAndViewsReady(){return this._source.dataAndViewsReady()}zorder(){return this._source.zorder()}symbol(){return this._source.properties().symbol.value()}currency(){return this._source.properties().currencyId.value()}unit(){return this._source.properties().unitId.value()}_setProps(e,t,i){for(const s in t){if(!t.hasOwnProperty(s))continue;const n=0===i.length?s:`${i}.${s}`;if(e.hasOwnProperty(s)){const i=t[s];(0,r.isHashObject)(i)?this._setProps(e[s],i,n):e[s].setValue(i)}else console.warn(`Unknown property "${n}"`)}}}},23605:(e,t,i)=>{"use strict" ;i.d(t,{PaneApi:()=>u});var s=i(16282),r=i(95996),n=i(73900),o=i(47903),a=i(79881),l=i(90963),c=i(5980);const h=new l.TranslatedString("change pane height",(0,a.t)("change pane height"));class d extends c.UndoCommand{constructor(e,t,i){super(h),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map(e=>e.stretchFactor())}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){const e=this._model.panes();for(let t=0;t(0,n.entityForDataSource)(e,t)).filter(o.notNull).filter(e=>null!==e.name)}getHeight(){return this._pane.height()}setHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length>1,"Unable to change pane's height if there is only one pane");const r=i.indexOf(this._pane);(0,s.assert)(-1!==r,"Invalid pane index");const n=new d(t,r,e);this._chartWidget.model().undoHistory().pushUndoCommand(n)}moveTo(e){const t=this.paneIndex();t!==e&&((0,s.assert)(e>=0&&e{"use strict";i.d(t,{PriceScaleApi:()=>s});class s{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){ return this._priceScale.getStudies().map(e=>e.id())}currency(){const e=this._priceScale.currency(this._chartModel.availableCurrencies());return null===e?null:{selectedCurrency:e.selectedCurrency,readOnly:e.readOnly}}setCurrency(e){this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){const e=this._priceScale.unit(this._chartModel.availableUnits());return null===e?null:{selectedUnit:e.selectedUnit,readOnly:0===e.availableGroups.size,availableGroups:Array.from(e.availableGroups)}}setUnit(e){this._chartUndoModel.setPriceScaleUnit(this._priceScale,e)}}},9062:(e,t,i)=>{"use strict";function s(e,t){const i=e.dataSourceForId(t);if(null===i)throw new Error(`Chart has no study or shape with id "${t}"`);return i}i.d(t,{SelectionApi:()=>r});class r{constructor(e){this._model=e}add(e){Array.isArray(e)?this._model.selectionMacro(t=>{e.map(s.bind(null,this._model)).forEach(e=>t.addSourceToSelection(e))}):this.add([e])}canBeAddedToSelection(e){const t=s(this._model,e);return this._model.selection().canBeAddedToSelection(t)}set(e){Array.isArray(e)?this._model.selectionMacro(t=>{t.clearSelection(),e.map(s.bind(null,this._model)).forEach(e=>t.addSourceToSelection(e))}):this.set([e])}remove(e){Array.isArray(e)?this._model.selectionMacro(t=>{e.map(s.bind(null,this._model)).forEach(e=>t.removeSourceFromSelection(e))}):this.remove([e])}contains(e){const t=s(this._model,e);return this._model.selection().isSelected(t)}allSources(){return this._model.selection().dataSources().map(e=>e.id())}isEmpty(){return this._model.selection().isEmpty()}clear(){this._model.selectionMacro(e=>{e.clearSelection()})}onChanged(){return this._model.onSelectedSourceChanged()}}},90920:(e,t,i)=>{"use strict";i.d(t,{SeriesApi:()=>l});var s=i(16282),r=i(31495),n=i(3062),o=i(13863),a=i(95996);class l{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){return this._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&new r.MergeUpUndoCommand(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new r.MergeDownUndoCommand(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new n.UnmergeUpUndoCommand(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new n.UnmergeDownUndoCommand(this._model,this._series,null).redo()}detachToRight(){new o.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new o.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new o.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){const t=(0,s.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":new o.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"left",null).redo();break;case"new-right": new o.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"right",null).redo();break;case"no-scale":(0,s.assert)(t.actionNoScaleIsEnabled(this._series),"Unable to leave a pane without any non-overlay price scale"),new o.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"overlay",null).redo();break;default:const i=this._model.dataSourceForId(e);if(null===i)throw new Error(`There is no study with entityId='${e}'`);const r=this._model.paneForSource(i)===t;(0,s.assert)(r,"Study should be on the main pane");const n=(0,s.ensureNotNull)(i.priceScale());new o.MoveToExistingPriceScaleUndoCommand(this._model,this._series,t,n,null).redo()}}isVisible(){return this._series.properties().childs().visible.value()}setVisible(e){this._series.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._series])}sendToBack(){this._model.sendToBack([this._series])}entityId(){return this._series.id()}chartStyleProperties(e){return this._series.properties().childs()[c(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[c(e)].mergeAndFire(t)}barsCount(){return this._series.bars().size()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}isLoading(){return this._series.isLoading()}data(){return this._series.data()}priceScale(){return new a.PriceScaleApi(this._undoModel,this._series.priceScale())}_pane(){return(0,s.ensureNotNull)(this._model.paneForSource(this._series))}}function c(e){switch(e){case 0:return"barStyle";case 1:return"candleStyle";case 2:return"lineStyle";case 3:return"areaStyle";case 4:return"renkoStyle";case 5:return"kagiStyle";case 6:return"pnfStyle";case 7:return"pbStyle";case 8:return"haStyle";case 9:return"hollowCandleStyle";case 10:return"baselineStyle";case 11:return"rangeStyle";case 12:return"hiloStyle";default:(0,s.ensureNever)(e)}throw new Error("unsupported chart style: "+e)}},52703:(e,t,i)=>{"use strict";i.d(t,{StudyApi:()=>S});var s=i(16282),r=i(5729),n=i.n(r),o=i(47903),a=i(70635),l=i(11204),c=i(32158),h=i(3062),d=i(31495),u=i(13863),p=i(21209),_=i(42010),m=i(78333),g=i(95996),f=i(73748),v=i(25682);class S{constructor(e,t){this._onStudyCompleted=new(n()),this._onStudyError=new(n()),this._study=e,this._chartWidget=t,this._undoModel=this._chartWidget.model(),this._model=this._undoModel.model(),this._study.onAboutToBeDestroyed().subscribe(this,()=>{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this)}),this._study.onStatusChanged().subscribe(this,e=>{switch(e.type){case f.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case f.StudyStatusType.Error:this._onStudyError.fire()}})}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return(0,v.getStudyInputsInfo)(this._study.metaInfo())}getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map(t=>{const i=e[t];return{id:t,value:(0, o.isObject)(i)?i.v:i}})}setInputValues(e){const t=this.getInputValues();for(const i of e){void 0!==t.find(e=>e.id===i.id)?this._study.properties().inputs[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&new d.MergeUpUndoCommand(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new d.MergeDownUndoCommand(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new h.UnmergeUpUndoCommand(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new h.UnmergeDownUndoCommand(this._model,this._study,null).redo()}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){return new g.PriceScaleApi(this._undoModel,(0,s.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,s.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(0,s.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,s.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,s.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),new u.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,s.assert)(i===t,"Study should be on the main pane"),new u.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new u.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"left",null).redo();break;case"new-right":new u.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"right",null).redo();break;default:const r=this._model.dataSourceForId(e);if(null===r)throw new Error(`There is no study with entityId='${e}'`);const n=i===this._model.paneForSource(r);(0,s.assert)(n,"Both studies should be on the same pane");const o=(0,s.ensureNotNull)(r.priceScale()),a=(0,c.sourceNewCurrencyOnPinningToPriceScale)(this._study,o,this._model),h=(0,_.sourceNewUnitOnPinningToPriceScale)(this._study,o,this._model);new u.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,o,null).redo(),null!==a&&new l.SetPriceScaleCurrencyUndoCommand(o,a,this._undoModel.chartWidget(),null).redo(),null!==h&&new m.SetPriceScaleUnitUndoCommand(o,h,this._undoModel.chartWidget(),null).redo()}} isVisible(){return this._study.properties().visible.value()}setVisible(e){this._study.properties().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,a.applyOverridesToStudy)(this._study,e)}dataLength(){return this._study.status().type!==f.StudyStatusType.Completed?0:this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){return this._study.isLoading()}properties(){return this._study.properties()}async applyToEntireLayout(){const e=new p.ActionsProvider(this._chartWidget),t=(await e.contextMenuActionsForSources([this._study])).find(e=>"applyStudyToEntireLayout"===e.id);t&&t.execute()}}},25682:(e,t,i)=>{"use strict";i.d(t,{getStudyInputsInfo:()=>r});var s=i(79881);function r(e){return void 0===e.inputs?[]:e.inputs.map(e=>({...e,id:e.id,localizedName:void 0!==e.name?(0,s.t)(e.name,{context:"input"}):""}))}},50388:(e,t,i)=>{"use strict";i.d(t,{ChartSession:()=>u});var s=i(5729),r=i.n(s),n=i(16282),o=i(32856),a=i.n(o),l=i(45259),c=i(65447);const h=(0,c.getLogger)("ChartApi.AbstractSession");var d=i(47903);(0,c.getLogger)("ChartSession");class u extends class{constructor(e,t,i){this._isConnected=new(a())(!1),this._state=0,this._isConnectForbidden=!1,this._sessionId="",this._sessionIdChanged=new(r()),this._chartApi=e,this._sessionPrefix=t,this._shouldReconnectAfterCriticalError=i}destroy(){this._logNormal("Destroying session"),this._isConnected.unsubscribe(),this.disconnect(),this._sessionIdChanged.destroy(),delete this._chartApi,this._logNormal("Session has been destroyed")}isConnected(){return this._isConnected}sessionId(){return this._sessionId}onSessionIdChanged(){return this._sessionIdChanged}connect(){0===this._state&&((0,n.assert)(!this._isConnectForbidden,"Cannot call connect because it is forbidden at this moment"),this._setSessionId(`${this._sessionPrefix}_${(0,l.randomHash)()}`),this._logNormal("Connecting session - wait until transport stay connected"),this._state=1,this._chartApi.createSession(this._sessionId,this))}disconnect(){0!==this._state&&((0,n.assert)(""!==this._sessionId,"sessionId must not be invalid"),this._logNormal("Disconnecting session..."),this._forbidConnectWhile(()=>{this._chartApi.connected()&&this._sendRemoveSession(),this._processDestroyingOnServer()}))}onMessage(e){switch(e.method){case"connected":return void this._onChartApiConnected();case"disconnected":return void this._onChartApiDisconnected();case"critical_error":const t=String(e.params[0]),i=String(e.params[1]);return void this._onCriticalError(t,i)}this._onMessage(e)}_getChartApi(){return this._chartApi}_generateLogMessage(e){return`[${this._sessionId}] ${e}`}_onCriticalError(e,t){this._logError(`Critical error. Reason=${e}, info=${t}.`),this._forbidConnectWhile(()=>{this._processDestroyingOnServer()}),this._shouldReconnectAfterCriticalError?(this._logNormal("Reconnecting after critical error..."),this.connect()):this._logNormal("Reconnecting after critical error skipped")} _onChartApiConnected(){(0,n.assert)(1===this._state,"Session is not registered"),this._logNormal("Transport is connected. Creating session on the server"),this._sendCreateSession(),this._state=2,this._isConnected.setValue(!0)}_onChartApiDisconnected(){this._logNormal("Transport is disconnected. Reconnecting..."),this._forbidConnectWhile(()=>{this._processDestroyingOnServer()}),this.connect()}_setSessionId(e){const t=this._sessionId;this._logNormal(`Changing sessionId: old=${t}, new=${e}`),this._sessionId=e,this._sessionIdChanged.fire(e,t)}_logNormal(e){h.logNormal(this._generateLogMessage(e))}_logError(e){h.logError(this._generateLogMessage(e))}_processDestroyingOnServer(){this._state=0,this._isConnected.setValue(!1),this._chartApi.removeSession(this._sessionId),this._setSessionId("")}_forbidConnectWhile(e){this._isConnectForbidden=!0,e(),this._isConnectForbidden=!1}}{constructor(e,t=!1){super(e,"cs",!1),this._sessionDisabled=!1,this._handler=null,this._criticalError=new(r()),this._disableStatistics=t}destroy(){this._criticalError.destroy(),this._handler=null,super.destroy()}serverTimeOffset(){return this._getChartApi().serverTimeOffset()}switchTimezone(e){return this._getChartApi().switchTimezone(this.sessionId(),e)}defaultResolutions(){return this._getChartApi().defaultResolutions()}availableCurrencies(){return this._getChartApi().availableCurrencies()}availableUnits(){return this._getChartApi().availableUnits()}resolveSymbol(e,t,i){return this._getChartApi().resolveSymbol(this.sessionId(),e,t,i)}requestFirstBarTime(e,t,i){return this._getChartApi().requestFirstBarTime(this.sessionId(),e,t,i)}createSeries(e,t,i,s,r,n,o){return this._getChartApi().createSeries(this.sessionId(),e,t,i,s,r,n,o)}modifySeries(e,t,i,s,r,n){return this._getChartApi().modifySeries(this.sessionId(),e,t,i,s,r,n)}removeSeries(e){return!!this.isConnected().value()&&this._getChartApi().removeSeries(this.sessionId(),e)}requestMoreData(e,t,i){return"number"==typeof e?this._getChartApi().requestMoreData(this.sessionId(),e):this._getChartApi().requestMoreData(this.sessionId(),e,t,i)}requestMoreTickmarks(e,t,i){return(0,d.isNumber)(e)?this._getChartApi().requestMoreTickmarks(this.sessionId(),e):this._getChartApi().requestMoreTickmarks(this.sessionId(),e,t,i)}requestMetadata(e,t){(()=>{this._getChartApi().requestMetadata(this.sessionId(),e,t)})()}isCanCreateStudy(e){return this._getChartApi().isCanCreateStudy(e)}createStudy(e,t,i,s,r,n,o){return this._getChartApi().createStudy(this.sessionId(),e,t,i,s,r,n,o)}rebindStudy(e,t,i,s,r,n,o){return this._getChartApi().rebindStudy(this.sessionId(),e,t,i,s,r,n,o)}modifyStudy(e,t,i,s){return this._getChartApi().modifyStudy(this.sessionId(),e,t,i,s)}removeStudy(e,t){return this._getChartApi().removeStudy(this.sessionId(),e,t)}createPointset(e,t,i,s,r,n){return this._getChartApi().createPointset(this.sessionId(),e,t,i,s,r,n)}modifyPointset(e,t,i,s){return this._getChartApi().modifyPointset(this.sessionId(),e,t,i,s)}removePointset(e){return this._getChartApi().removePointset(this.sessionId(),e)} setVisibleTimeRange(e,t,i,s,r,n){this._getChartApi().setVisibleTimeRange(this.sessionId(),e,t,i,s,!0,r,n)}criticalError(){return this._criticalError}connect(e=null){null!==e&&(this._handler=e),super.connect()}setHandler(e){this._handler=e}connected(){return this.isConnected().value()&&!this._sessionDisabled}disable(){this._sessionDisabled=!0}chartApi(){return this._getChartApi()}_sendCreateSession(){Object.keys(this).forEach(e=>{/^(s|st|symbol_)\d+$/.test(e)&&delete this[e]}),this._getChartApi().chartCreateSession(this.sessionId(),this._disableStatistics)}_sendRemoveSession(){this._getChartApi().chartDeleteSession(this.sessionId())}_onMessage(e){this._handler&&this._handler(e)}_onCriticalError(e,t){this._criticalError.fire(e,t),super._onCriticalError(e,t)}}},85060:(e,t,i)=>{"use strict";var s=i(47903).declareClassAsPureInterface;function r(){}TradingView.WEB_SOCKET_WAS_CONNECTED=!1,r.REBIND_STUDY_STANDALONE_TO_CHILD=1,r.REBIND_STUDY_CHILD_TO_STANDALONE=2,r.prototype.defaultWatchlistSymbols=function(){},r.prototype.defaultResolutions=function(){},r.prototype.availableCurrencies=function(){},r.prototype.availableUnits=function(){},r.prototype.supportedSymbolsTypes=function(){},r.prototype.supportedExchangesList=function(){},r.prototype.symbolsGrouping=function(){},r.prototype.quoteCreateSession=function(e){},r.prototype.quoteDeleteSession=function(e){},r.prototype.quoteSetFields=function(e,t){},r.prototype.quoteAddSymbols=function(e,t){},r.prototype.quoteRemoveSymbols=function(e,t){},r.prototype.quoteFastSymbols=function(e,t){},r.prototype.depthCreateSession=function(e,t,i){},r.prototype.depthDeleteSession=function(e){},r.prototype.depthSetSymbol=function(e,t){},r.prototype.depthClearSymbol=function(e){},r.prototype.depthSetScale=function(e,t){},r.prototype.chartCreateSession=function(e,t){},r.prototype.chartDeleteSession=function(e){},r.prototype.createSession=function(e,t){},r.prototype.removeSession=function(e){},r.prototype.connected=function(){},r.prototype.connect=function(){},r.prototype.disconnect=function(){},r.prototype.switchTimezone=function(e,t){},r.prototype.resolveSymbol=function(e,t,i,s){},r.prototype.createSeries=function(e,t,i,s,r,n,o,a){},r.prototype.removeSeries=function(e,t,i){},r.prototype.modifySeries=function(e,t,i,s,r,n,o){},r.prototype.requestMoreData=function(e,t,i,s){},r.prototype.requestMetadata=function(e,t,i){},r.prototype.isCanCreateStudy=function(e,t){},r.prototype.createStudy=function(e,t,i,s,r,n,o){},r.prototype.rebindStudy=function(e,t,i,s,r,n,o,a){},r.prototype.removeStudy=function(e,t,i){},r.prototype.modifyStudy=function(e,t,i,s,r){},r.prototype.createPointset=function(e,t,i,s,r,n,o){},r.prototype.modifyPointset=function(e,t,i,s,r){},r.prototype.removePointset=function(e,t,i){},r.prototype.requestMoreTickmarks=function(e,t,i,s){},r.prototype.requestFirstBarTime=function(e,t,i,s){},r.prototype._invokeHandler=function(e,t){},r.prototype._sendRequest=function(e,t){},r.prototype._onMessage=function(e){},r.prototype._dispatchNotification=function(e){}, r.prototype._invokeNotificationHandler=function(e,t,i){},r.prototype._notifySessions=function(e){},r.prototype.unpack=function(e){},r.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){},r.prototype.serverTimeOffset=function(){},r.prototype.getMarks=function(e,t,i,s,r){},r.prototype.getTimescaleMarks=function(e,t,i,s,r){},s(r,"ChartApiInterface"),e.exports.HandlerInfo=function(e,t){this.handler=e,this.customId=t},e.exports.ChartApiInterface=r},15755:(e,t,i)=>{"use strict";i.r(t),i.d(t,{setCustomAdapter:()=>_,initialize:()=>m,updateUser:()=>g,getChartsCount:()=>f,getCharts:()=>v,removeChart:()=>S,saveChart:()=>y,getChartContent:()=>b,loadChart:()=>w,removeStudyTemplate:()=>P,getStudyTemplateContent:()=>C,saveStudyTemplate:()=>T,getStudyTemplatesList:()=>x,invalidateStudyTemplatesList:()=>I,getStudyTemplateContentById:()=>M,getStandardStudyTemplateContentById:()=>L,removeStudyTemplateById:()=>A,renameStudyTemplate:()=>k,replaceStudyTemplate:()=>E,getDrawingTemplates:()=>D,loadDrawingTemplate:()=>V,removeDrawingTemplate:()=>B,saveDrawingTemplate:()=>N});var s=i(18437),r=i(65447),n=i(97849);const o=(0,r.getLogger)("Chart.SaveloadAdapter.Library");let a,l,c,h,d=null,u=null;function p(e){return`${c}/${encodeURIComponent(h)}/${e}?client=${encodeURIComponent(a)}&user=${encodeURIComponent(l)}`}function _(e){d=e}function m(e,t,i,s){a=e,l=t,c=i,h=s}function g(e){l=e}function f(e,t){throw new Error("Not implemented")}async function v(){const e=e=>e.map(e=>({id:e.id,name:e.name,image_url:String(e.id),modified_iso:e.timestamp,short_symbol:e.symbol,interval:e.resolution}));if(d)return d.getAllCharts().then(e);try{const t=await fetch(""+p("charts"),{credentials:"same-origin"});if(!t.ok)throw new Error(`Getting chart content response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Get chart content request failed: "+i.message);return e(i.data)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function S(e){if(d)d.removeChart(e);else try{const t=await fetch(`${p("charts")}&chart=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!t.ok)throw new Error(`Remove chart response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Remove drawing template request failed: "+i.message)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function y(e,t,i,s,r){const a=r.id.value(),l={name:e,content:JSON.stringify(s),symbol:t,resolution:i};if(d)return d.saveChart({...l,id:a});try{const e=new FormData;for(const t in l)e.append(t,l[t]);let t=p("charts");null!=a&&(t+="&chart="+encodeURIComponent(a));const i=await fetch(t,{credentials:"same-origin",method:"POST",body:e});if(!i.ok)throw new Error(`Saving chart content response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Saving chart content request failed: "+s.message);return s.id.toString()}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function b(e){const t=t=>{const i=JSON.parse(t);return i.uid=e.id,i} ;if(d)return d.getChartContent(e.id).then(e=>t(e));try{const i=await fetch(`${p("charts")}&chart=${encodeURIComponent(e.id)}`,{credentials:"same-origin"});if(!i.ok)throw new Error(`Getting chart content response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Get chart content request failed: "+s.message);return t(s.data.content)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}function w(e){b(e).then(e=>{s.emit("chart_load_requested",e)},()=>{o.logWarn("Error loading chart")})}async function P(e){try{if(d)return d.removeStudyTemplate({name:e});const t=await fetch(`${p("study_templates")}&template=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!t.ok)throw new Error(`Remove study template response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Remove study template request failed: "+i.message)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function C(e){try{if(d){return{content:await d.getStudyTemplateContent({name:e})}}const t=await fetch(`${p("study_templates")}&template=${encodeURIComponent(e)}`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Get study template response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Get study template request failed: "+i.message);return i.data}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function T(e){try{if(d)return d.saveStudyTemplate(e).then(()=>({error:""})).catch(e=>({error:null!=e?(0,n.errorToString)(e):"error"}));const t=new FormData;t.append("name",e.name),t.append("content",e.content);const i=await fetch(p("study_templates"),{method:"POST",body:t,credentials:"same-origin"});if(!i.ok)throw new Error(`Save study template response was not OK. Status: ${i.status}.`);const s=await i.json();return{error:"ok"===s.status?"":s.status}}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function x(){try{if(u)return u;u=[];const e=e=>(u=e.map(e=>({is_default:!1,name:e.name})),u);if(d)return d.getAllStudyTemplates().then(e);const t=await fetch(p("study_templates"),{method:"GET",credentials:"same-origin"});if(!t.ok)throw new Error(`Study templates list response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Study templates list request failed: "+i.message);return e(i.data)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}function I(){u=null}function M(e,t){throw new Error("Not implemented")}function L(e,t){throw new Error("Not implemented")}function A(e,t){throw new Error("Not implemented")}function k(e,t,i){throw new Error("Not implemented")}function E(e,t,i){throw new Error("Not implemented")}async function D(e){throw new Error("Not implemented")}async function V(e,t){throw new Error("Not implemented")}async function B(e,t){throw new Error("Not implemented")}async function N(e,t,i){throw new Error("Not implemented")}},68606:(e,t,i)=>{"use strict" ;var s=i(16282).ensureNotNull,r=i(42062),n=i(35001).Interval,o=i(20291),a=i(98779),l=i(85060),c=l.ChartApiInterface,h=l.HandlerInfo,d=i(47903).requireFullInterfaceImplementation,u=i(65447).getLogger("Chart.ChartApiLocal"),p=i(89077).TIMEFRAMETYPE,_=i(63059).createDwmAligner;TradingView.STUDY_COUNT_LIMIT=210,JSServer.ChartApi=function(e){this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._connected=!1,this._enabled=!1,this._studyEngine=new o(e),this._callbacks={},this._serverTimeOffset=0;var t=this;this._studyEngine.on("configuration_received",(function(){t._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",(function(e){var i={time:e.value[0]/1e3,open:e.value[1],high:e.value[2],low:e.value[3],close:e.value[4],volume:e.value[5]};t._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={}},JSServer.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},JSServer.ChartApi.prototype.purgeCache=function(e){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache()},JSServer.ChartApi.prototype.defaultWatchlistSymbols=function(){return this._watchlistSettings.default_symbols},JSServer.ChartApi.prototype.defaultResolutions=function(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]},JSServer.ChartApi.prototype.availableCurrencies=function(){var e=this._studyEngine.supportedCurrencies().map((function(e){return"string"==typeof e?{id:e,code:e}:e}));return Promise.resolve(e)},JSServer.ChartApi.prototype.availableUnits=function(){return Promise.resolve(this._studyEngine.supportedUnits())},JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()},JSServer.ChartApi.prototype.supportedExchangesList=function(){return this._studyEngine.supportedExchangesList()},JSServer.ChartApi.prototype.symbolsGrouping=function(){return this._studyEngine.symbolsGrouping()},JSServer.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},JSServer.ChartApi.prototype.unsubscribe=function(e,t){var i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)},JSServer.ChartApi.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},JSServer.ChartApi.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){var s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(var r=0;rn||(TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,i,_,n,a),l&&setTimeout(l,0))}}}if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*r))p();else{var m=TradingView.ChartapiMessagerInstances[e].seriesCompleted,g=TradingView.ChartapiMessagerInstances[e].seriesError;void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=setTimeout(function(){delete this._setVisibleRangeTimeout[e],m.subscribe(null,f,!0),g.subscribe(null,v,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*r)}.bind(this),0)}function f(e,s){e===t&&s===i&&(m.unsubscribe(null,f),g.unsubscribe(null,v),p())}function v(e,s){ e===t&&s===i&&m.unsubscribe(null,f)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,s,o){var a,l,c={},h=!0;if(o.type===p.PeriodBack){var d=this._studyEngine.getSeriesLastBarTime(e,i);if(null===d)return;l=d/1e3;var u=n.parse(o.value),m=this._studyEngine.getSeriesSymbolInfo(e,i);a=r.alignPeriodsBackForVisibleRange(m.session,m.session_holidays,m.corrections,u.letter(),u.multiplier(),1,d)/1e3;var g=_(this._studyEngine.getSeriesInterval(e,i),m);null!==g&&(l=g.timeToExchangeTradingDay(1e3*l)/1e3,a=g.timeToExchangeTradingDay(1e3*a)/1e3),c={applyDefaultRightMargin:!0},h=!1}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,s,a,l,h,c)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o){var a=this;this._notificationHandlers[e][t]=new h((function(r){"series_completed"===r.method&&null!==n&&(a._applyTimeFrame(e,s,t,i,n),n=null),o(r)}),t),this._studyEngine.modifySeries(e,t,s,r,i)},JSServer.ChartApi.prototype.requestMoreData=function(e,t){this._studyEngine.extendSeriesRange(e,t)},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.setWatchlistSettings=function(e){this._watchlistSettings=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(e,t,i){this._notificationHandlers[e][t]=new h(i,t);var s=this.studiesAccessController.getEnabledTools();TradingView.ChartapiMessagerInstances[e].onRequestMetadata(t,s)},JSServer.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounter{"use strict";var s=i(5729),r=function(e,t){this._server=e,this._session=t,this.seriesCompleted=new s,this.seriesError=new s};r.prototype.onRequestMetadata=function(e,t){this._server.receiveLocalResponse({method:"studies_metadata",params:[this._session,e,{errors:[],hash:"",metainfo:t,migrations:[]}]})},r.prototype.onSymbolResolved=function(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})},r.prototype.onSymbolError=function(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})},r.prototype.onStudyError=function(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})},r.prototype.onSeriesLoading=function(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})},r.prototype.onSeriesCompleted=function(e,t,i){this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]}),this.seriesCompleted.fire(e,t)},r.prototype.onSeriesError=function(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}), this.seriesError.fire(e,t)},r.prototype.onStudyCompleted=function(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})},r.prototype.onStudyLoading=function(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})},r.prototype.onTickmarksUpdated=function(e,t){var i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleUpdate=function(e,t){var i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleCompleted=function(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})},r.prototype.onSeriesTimeframeUpdate=function(e,t,i,s,r){var n={method:"series_timeframe",params:[this._session,e,t,i,s,null,!0,r]};this._server.receiveLocalResponse(n)},r.prototype.onPointsetDataUpdate=function(e,t,i){this.onDataUpdate(e,t,i,null)},r.prototype._prepareDataUpdateObjects=function(e){var t={};return e.forEach((function(e){t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t},r.prototype.onDataUpdate=function(e,t,i,s){var r={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})},r.prototype.onDepthData=function(e){this._server.receiveLocalResponse({method:"dd",params:e})},r.prototype.onDepthUpdate=function(e){this._server.receiveLocalResponse({method:"dpu",params:e})},r.prototype.onClearData=function(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})},TradingView.ChartapiMessagerInstances=[],e.exports=r},10706:(e,t,i)=>{"use strict";i.d(t,{DatafeedRequestsCachedProcessor:()=>_});var s=i(16282),r=i(35001),n=i(49382),o=i(77392),a=i(27490),l=i(42062),c=i(63059),h=i(12125);i(95068);function d(e,t){return e.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+"_#_"+t}function u(e){return new Date(e).toISOString()}class p{constructor(e,t,i,s,n,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._nextTime=null,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._destroyed=!1,this._emptyResponsesCount=0,this._datafeed=e,this._symbolInfo=t,this._interval=r.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=n,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void 0===o?1e4:o, this._sessionSpec=new h.SessionSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed,this._destroyed=!0}addSubscription(e,t,i){const s=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),r.Interval.isDWM(this._resolution)&&void 0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&console.warn(`Internal error: invalid date for DWM resolution ${u(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();return setTimeout(()=>{this._destroyed||this._processPendingSubscribers()},0),s}removeSubscription(e){const t=this._pendingSubscribers.find(t=>t.key===e);if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find(t=>t.key===e);if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=setTimeout(()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()},this._resetCacheTimePeriod)));console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}_logMessage(e,t){if(a.enabled("charting_library_debug_mode")||t){const t=this._symbolInfo.currency_code,i=this._symbolInfo.unit_id;console.log(`FEED [${this._symbolInfo.name}|${this._resolution}${t?"|"+t:""}${i?"|"+i:""}]: ${e}`)}}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,s.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,r=(0,n.lowerbound)(this._cache.bars,i,(e,t)=>e.time{e.onErrorCallback(t)})}let t=this._normalizeRange(e[0].range);for(const i of e.map(e=>this._normalizeRange(e.range)))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${u(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach(t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)})},d(this._symbolInfo,this._resolution),()=>{this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null!==e&&this._ensureRequestedTo({to:e,countBack:0})}),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(d(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),u(s.bars[0].time),u(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,n.lowerbound)(this._cache.bars,t,(e,t)=>e.time{if(!this._destroyed)if(a)this._logMessage("getBars callback is already called before",!0);else{if(a=!0,e.length>0){const t=` [${u(e[0].time)} ... ${u(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${o}`)}else this._logMessage("Receiving bars: barset is empty, requested range: "+o);this._requesting=!1,this._processBars(e,t)}},e=>{this._destroyed||(a?this._logMessage("getBars callback is already called before",!0):(a=!0,this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))})}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(u(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?(this._logMessage("EOD received"),this._setEndOfData()):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())}_setEndOfData(){this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0), t&&t.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(a.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[i][t]||!isFinite(e[i][t]))&&console.error("Wrong bars values: all OHLC values should be numbers")}}_putToCache(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy()),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread((e,t)=>t.destroy()),this._threads={}}subscribe(e,t,i,s,r){const n=d(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,r)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void console.warn("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):console.warn("Data thread doesnt exist: "+e)}_createThread(e,t){return new p(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,c.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach(t=>e(t,this._threads[t]))}}},33287:(e,t,i)=>{ "use strict";i.d(t,{barTimeToEndOfPeriod:()=>r,endOfPeriodToBarTime:()=>n});var s=i(78486);function r(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(t+" is out of the instrument session ");return e.endOfBar(i)/1e3}return e.startOfBar(s.SessionStage.LASTBAR_SESSION)/1e3}function n(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(t+" is out of the instrument session ");return e.startOfBar(i)/1e3}return t=e.startOfBar(0)/1e3}},81482:(e,t,i)=>{"use strict";i.d(t,{replaceGraphicsTimesWithTimePointIndexIndex:()=>n});const s=new Map([["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map(e=>e.index)]]),r=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}]]);function n(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,n=new Set;s.forEach((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data){const t=e(s);for(const e of t)i.set(e,-1),n.add(e)}});const o=Array.from(n).sort((e,t)=>e-t);return o.forEach((e,t)=>i.set(e,t)),r.forEach((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data)e(s,i)}),o}},27317:(e,t,i)=>{"use strict";var s=i(27490);window.onload=function(){location.hostname.indexOf(".")>=0&&!function(){try{return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}()&&setTimeout((function(){try{var e=function(){var e=0;return JSON.parse(urlParams.logo).image&&(e="C",s.enabled("link_to_tradingview")||(e="D")),e}();window.ga&&(0!==e&&window.ga("send","event","s",e),urlParams.utm||window.ga("send","event","l"))}catch(e){}}),3e4)}},77848:(e,t,i)=>{"use strict";var s=i(42062),r={};e.exports=function(e,t,i){var n,o,a={},l=r[i]||"out_of_session",c=!1,h=i,d=t,u=null;function p(){var e={};e.symbolname=h,e.status="ok",e.values={},e.values.current_session=l,r[h]=l,TradingView.ChartapiMessagerInstances[d].onQuotesData([d].concat([e]))}function _(){if(n)if(o)l="out_of_session";else{var e=s.isTradingNow((new Date).getTime(),n)?"market":"out_of_session";e!==l&&(l=e,p())}}return e(i,null,(function(e){c||function(e){n=new s.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),o=e.expired,u=setInterval(_,6e4),_(),p()}(e)}),(function(){})),a.stop=function(){c=!0,u&&clearInterval(u)},a.marketStatus=function(){return l},a}},14896:(e,t,i)=>{"use strict";i.d(t,{getChartStyleStudy:()=>n});var s=i(77392);class r{main(e){ const t=e.new_var(s.Std.open(e)),i=e.new_var(s.Std.close(e)),r=t.get(1),n=i.get(1),o=s.Std.ohlc4(e),a=s.Std.na(t.get(1))?(s.Std.open(e)+s.Std.close(e))/2:(r+n)/2;t.set(a),i.set(o);const l=s.Std.max(s.Std.high(e),s.Std.max(a,o)),c=s.Std.min(s.Std.low(e),s.Std.min(a,o)),h=s.Std.volume(e),d=e.symbol;return[d.time,a,l,c,o,h,d.updatetime,d.isBarClosed]}}function n(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))return new r;const t="unknown builder type: "+e.type;throw console.error(t),new Error(t)}},22241:(e,t,i)=>{"use strict";var s=i(35001).Interval,r=i(63059).isAlignmentEnabled,n=i(14896).getChartStyleStudy,o=i(89164).decodeExtendedSymbol,a=i(5280).findSuitableResolutionToBuildFrom,l=function(){var e=i(77392),t=e.StudyEngine,l=e.BarBuilder,c=e.BarSet;function h(e){this.host=e,this.cache={}}function d(t){console.error(t),e.Std.error(t)}h.prototype.getCache=function(e){return this.cache[e]},h.prototype.putCache=function(e,t){this.cache[e]=t},h.prototype.subscribe=function(e,t,i,s,r,n,o,a,l,c){var h=l(o),d=function(e,t,i,s,r,n,o,a){var l=r.has_empty_bars?"_":"";return n+e+s+(t||"")+(i||"")+l+"_"+o.countBack+"_"+o.to+"_"+Boolean(a)}(e,t,i,s,o,a,h,c),u=this.getCache(d);return u||(u=this.createItem(e,t,i,s,o,h,a,c),this.putCache(d,u)),u.listeners.addListener(r,n),{key:d,listener:r}},h.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},h.prototype.removeUnused=function(){var e=[];for(var t in this.cache){if(this.cache[t])0===this.cache[t].listeners.listenersCount()&&e.push(t)}if(0!==e.length){for(var i=0;i{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(35001);function r(e,t){const i=t.multiplier();for(let s=e.length-1;s>=0;s--){const r=Number(e[s]);if(i%r==0)return{error:!1, resolution:`${r}${t.letter()}`}}return{error:!0,errorMessage:n(t.value())}}function n(e){return`Misconfiguration error: it is trying to request ${e} but we cannot build it from lower resolution`}function o(e,t){const i=s.Interval.parse(e);if((i.isWeeks()||i.isMonths())&&t.has_weekly_and_monthly){let e=["1"];i.isWeeks()&&void 0!==t.weekly_multipliers&&(e=t.weekly_multipliers),i.isMonths()&&void 0!==t.monthly_multipliers&&(e=t.monthly_multipliers);const s=r(e,i);if(!s.error)return s}if(i.isDWM()&&(void 0===t.has_daily||t.has_daily))return i.isDays()&&void 0!==t.daily_multipliers?r(t.daily_multipliers,i):void 0===t.daily_multipliers||t.daily_multipliers.includes("1")?{error:!1,resolution:"1D"}:{error:!0,errorMessage:"Misconfiguration error: it is trying to request a resolution but symbol does not support it"};if(i.isDWM())return{error:!0,errorMessage:n(i.value())};if(i.isMinutes()&&!t.has_intraday)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request intraday resolution but symbol does not support it"};if(i.isSeconds()&&!t.has_seconds)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request seconds resolution but symbol does not support it"};if(i.isTicks())return!t.has_ticks||i.multiplier()>1?{error:!0,errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},77392:function(e,t,i){"use strict";var s=i(71181).StudyError,r=i(49382),n=i(47903).inherit,o=i(78486).SessionStage,a=i(35001).Interval,l=i(63059).createDwmAligner,c=i(63059).createTimeToBarTimeAligner,h=i(89164).decodeExtendedSymbol,d=i(89164).encodeExtendedSymbolOrGetSimpleSymbolString,u=function(){var e,t="undefined"!=typeof window?window:i.g,p=t.PineJsCalendar?t.PineJsCalendar:i(84540),_=i(42062),m=i(25853).extrapolateBarsFrontToTime,g={};function f(e,t,i,s,r){var n=r,o=0;if(isNaN(e.get(t-1)))return{index:NaN,value:NaN};for(var a=0;a1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}function S(e,t,i){this._deviation=e;var s=i.new_var(g.high(i)),r=i.new_var(g.low(i));s.get(2*t+1),r.get(2*t+1),this._pivotHigh=new v(t,t,v.HIGH,s,i),this._pivotLow=new v(t,t,v.LOW,r,i),this._lastVal=i.new_var(NaN),this._lastIndex=i.new_var(-1),this._lastType=i.new_var(),this._index=g.n(i),this._isNewBar=i.symbol.isNewBar,this._isBarClosed=i.symbol.isBarClosed;var n=this._lastIndex.get(1),o=this._lastVal.get(1),a=this._lastType.get(1);this._index>1&&this.addPivot(n,o,a), this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}function y(e){this.symbol=e,this.vars=[],this.vars_index=0,this.ctx=[],this.ctx_index=0,this.minimumAdditionalDepth=null}function b(e){this.mindepth=0,this.original=NaN,this.modified=!1,this.symbol=e}function w(e){b.call(this,e)}function P(e,t,i,s,r,n){var o=h(e);const l="string"==typeof o.symbol?o:o.symbol;this.ticker=l.symbol,this.currencyCode=i||l["currency-id"],this.unitId=s||l["unit-id"];var c=l["currency-id"]!==this.currencyCode||l["unit-id"]!==this.unitId;l["currency-id"]=this.currencyCode,l["unit-id"]=this.unitId,c&&(e=d(o)),this.tickerid=e;var u=a.parse(t);this.resolution=u.letter(),this.interval=u.multiplier(),this.period=u.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.session=new _.SessionInfo("Etc/UTC","24x7"),this.script=r,this.isAdditionalDepthAllowed=void 0===o.type,n&&this.set_symbolinfo(n)}function C(e,t,i,s,r,n,o,a,l,c){this.body=n,this.symbols=[],this.runner=r,this.inputCallback=a,this.out=o,this.nonseriesOut=l,this.ctx=new y(this.add_sym(e,t,i,s,c)),this.init()}function T(e){this.symbols=[],this.barsets=[],this.subscription=[],this.host=e,this.isRecalculated=!1,this.isStarted=!1,this.start()}function x(e){this.runner=new T(e)}function I(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0}function M(e,t){this.period=e,this.generateEmptyBars=!!t}function L(){}return g.max_series_default_size=10001,g.n=function(e){return e.symbol.index+1},g.nz=function(e,t){return t=t||0,isFinite(e)?e:t},g.na=function(e){return 0===arguments.length?NaN:isNaN(e)?1:0},g.isZero=function(e){return Math.abs(e)<=1e-10},g.toBool=function(e){return isFinite(e)&&!g.isZero(e)},g.eq=function(e,t){return g.isZero(e-t)},g.neq=function(e,t){return!g.eq(e,t)},g.ge=function(e,t){return g.isZero(e-t)||e>t},g.gt=function(e,t){return!g.isZero(e-t)&&e>t},g.lt=function(e,t){return!g.isZero(e-t)&&e(i||1e-10)},g.less=function(e,t,i){return t-e>(i||1e-10)},g.compare=function(e,t,i){return g.equal(e,t,i)?0:g.greater(e,t,i)?1:-1},g.max=Math.max,g.min=Math.min,g.pow=Math.pow,g.abs=Math.abs,g.log=Math.log,g.log10=function(e){return Math.log(e)/Math.LN10},g.sqrt=Math.sqrt,g.sign=function(e){return isNaN(e)?NaN:g.isZero(e)?0:e>0?1:-1},g.exp=Math.exp,g.sin=Math.sin,g.cos=Math.cos,g.tan=Math.tan,g.asin=Math.asin,g.acos=Math.acos,g.atan=Math.atan,g.floor=Math.floor,g.ceil=Math.ceil,g.round=Math.round, g.avg=function(e,t,i,s,r,n){if(2===arguments.length)return(e+t)/2;for(var o=0,a=0;a=0;--n){var o=t[n];if(!(o>=i.startOfBar(0))){i.moveTo(o);var a=t[n+1];s.push(a)}}s.reverse()}return s},g.iff=function(e,t,i){return g.not(e)?i:t},g.rising=function(e,t){for(var i=1;ie.get(0))return 0;return 1},g.falling=function(e,t){for(var i=1;i=0;r--){s+=(t-r)*e.get(r)}return 2*s/(t*(t+1))},g.vwma=function(e,t,i){var s=i.new_var(g.volume(i)),r=i.new_var(e.get(0)*g.volume(i));return g.sma(r,t,i)/g.sma(s,t,i)},g.swma=function(e,t){return(e.get(0)+2*e.get(1)+2*e.get(2)+e.get(3))/6},g.supertrend=function(e,t,i){var s=u.Std.atr(t,i),r=i.new_var(s).get(1),n=u.Std.hl2(i),o=n+s*e,a=n-s*e,l=u.Std.close(i),c=i.new_var(l).get(1),h=i.new_var(),d=u.Std.nz(h.get(1)),p=i.new_var(),_=u.Std.nz(p.get(1));a=g.gt(a,d)||g.lt(c,d)?a:d,h.set(a),o=g.lt(o,_)||g.gt(c,_)?o:_,p.set(o);var m=u.Std.na(),f=i.new_var(),v=f.get(1),S=-1===(m=u.Std.na(r)?1:v===_?l>o?-1:1:l2&&(T=Math.min(T,y))):(T=Math.max(T,b),g.n(s)>2&&(T=Math.max(T,w))),p.set(T),T},g.alma=function(e,t,i,s){for(var r=Math.floor(i*(t-1)),n=t/s*(t/s),o=[],a=0,l=0;lthis._currentValue.get():ithis._areaRight},v.prototype.update=function(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){for(var e=!0,t=0;tthis._deviation&&this.addPivot(e,t,i);else(i===v.HIGH?t>s:t0&&i.set(e),i},y.prototype.new_unlimited_var=function(e){var t=this.vars;t.length<=this.vars_index&&t.push(new w(this.symbol));var i=t[this.vars_index++];return arguments.length>0&&i.set(e),i},y.prototype.new_ctx=function(){return this.ctx.length<=this.ctx_index&&this.ctx.push(new y(this.symbol)),this.ctx[this.ctx_index++]},y.prototype.prepare=function(e){this.ctx_index=0,this.vars_index=0;for(var t=0;te&&(e=i)}return e},y.prototype.stop=function(){this.symbol=null,this.vars=null},y.prototype.setMinimumAdditionalDepth=function(e){this.minimumAdditionalDepth=e},b.prototype.valueOf=function(){return this.get(0)},b.prototype.get=function(e){return isNaN(e)&&(e=0),e=e||0,this.hist?e>=this.hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=g.max(this.mindepth,e),NaN)},b.prototype._get=function(e){var t=this.hist_pos-e;return t<0&&(t+=this.hist.length),this.hist[t]},b.prototype.set=function(e){this.hist&&(this.hist[this.hist_pos]=e, this.modified=!0)},b.prototype.prepare=function(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this.hist||this.add_hist()):this.set(this.original),this.modified=!1)},b.prototype.add_hist=function(){if(!this.hist){var e=g.na(this.mindepth)?g.max_series_default_size:g.max(this.mindepth+1,1);e=Math.round(e);for(var t=new Array(e),i=0;i=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=e.volume,this.updatetime=e.updatetime,this.isNewBar=i,this.isBarClosed=e.isBarClosed,this.isLastBar=e.isLastBar,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}},C.prototype.calc=function(e){var t=this.ctx,i=this.body;t.prepare(e);var s=i.main(t,this.inputCallback,e);if(s&&"composite"===s.type)for(let e=0;e1&&n.enable_dwm_aligning(this.symbols[0].session,n.session),n},C.prototype.maxAdditionalDepth=function(){return this.symbols[0].isAdditionalDepthAllowed?this.ctx.maxAdditionalDepth():0},C.prototype.stop=function(){this.symbols=null,this.ctx.stop(),this.ctx=null},C.prototype.get_sym=function(e){return this.symbols[e]},T.prototype.add_sym=function(e,t,i,s,r,n){var o=new P(e,t,i,s,r,n);return this.symbols.push(o),o},T.prototype.get_sym=function(e){return this.symbols[e]},T.prototype.out=function(e,t){if(this.nonseriesUpdate){var i=Object.assign({},this.nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)},T.prototype.start=function(){this.isStarted=!0;var e=this.host;this._script=new C(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo);var t=this,i=[],s=this.symbols,r=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+t._script.maxAdditionalDepth()}),n=s[0];function o(t,s,r){i.push(T.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars))}function h(i,s){"series"===(s.nonseries?"nonseries":"series")?t.update(i,s):s.lastBar?(t.nonseriesUpdate=s,s.lastBar.isLastBar=!0,t.symbols[0].lastbar(s.lastBar),t.nonseriesUpdate=null):e.nonseriesOut(p,s)}function d(){return r}o(n,d,(function(e){!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&function(e){function i(i,s){var r=c(i,s)(e),n=l(i,s);return null!==n&&(r=n.timeToExchangeTradingDay(r)),{to:r,countBack:t._script.maxAdditionalDepth()}}for(var r=1;r=0;i--)for(var s=e[i],r=this.barsets[i],n=r.count(),o=0;o{"use strict";const s=i(53312).getHexColorByName;var r=i(77392);i(81137);var n=i(19680).pivotPointsStandardStudyItem,o=i(62649).volumeProfileVisibleRangeStudyItem,a=i(62243).volumeProfileFixedRangeVbPStudyItem,l=i(62243).volumeProfileFixedRangeBSStudyItem,c=i(30934).spreadStudyItem,h=i(67366).ratioStudyItem,d=i(46433).regressionTrendStudyItem;const u=s("color-ripe-red-400"),p=s("color-minty-green-400");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0, defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),r.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),n=r.Std[t(0)](this._context),o=this._context.new_unlimited_var(n);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:""}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),r.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),n=this._context.new_unlimited_var(r.Std.open(this._context)),o=this._context.new_unlimited_var(r.Std.high(this._context)),a=this._context.new_unlimited_var(r.Std.low(this._context)),l=this._context.new_unlimited_var(r.Std.close(this._context));return this._context.select_sym(0),[n.adopt(s,i,1),o.adopt(s,i,1),a.adopt(s,i,1),l.adopt(s,i,1)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:u,width:1,style:0},1:{color:p,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA", histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4}],id:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),r.Std.period(this._context))},this.f_0=function(e,t){return r.Std.gt(e,t)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.volume(this._context),s=r.Std.open(this._context),n=r.Std.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(r.Std.volume(this._context)),d=this._context.new_var(r.Std.open(this._context)),u=this._context.new_var(r.Std.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1),n=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=r.Std.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(n);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),n):this.f_0(s,n),"EMA"===a?_=r.Std.ema(f,l,this._context):"WMA"===a?_=r.Std.wma(f,l,this._context):"SMA"===a&&(_=r.Std.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=i/100,o=Math.ceil(s/2);return[r.Std.zigzag(n,o,this._context),r.Std.zigzagbars(n,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0, name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}this.init=function(){this._times=[]},this._getVerticalLineData=function(t){return r.Std.selectSessionBreaks(t,this._times).map(e)},this.main=function(e,t){if(r.Std.isdwm(e))return null;var i=r.Std.time(e);if(isNaN(i))return null;var s=this._times.length;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var n=this._getVerticalLineData(e);return 0===n.length?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{styleId:"sessBreaks",data:n}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[n,o]=r.Std.supertrend(s,i,e),a=e.new_var(o).get(1);return[n,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},n,o,a,l,c,h,d])},19680:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>d});var s=i(77392),r=i(35001),n=i(5280);class o{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class a{constructor(){this.pivots=[]}}function l(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function c(e,t){if(s.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()=1&&t.multiplier()<=15?"1D":"1W";case r.ResolutionKind.Seconds:case r.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const d={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots"},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),r=t(1),o=t(2),l=t(3);this._data=new a,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=r,this._historicalPivotsToKeep=l,this._pivTimeFrame=o,this._isValidResolution=function(e,t){return(!s.Std.isdaily(e)||"Daily"!==t)&&((!s.Std.isweekly(e)||"Daily"!==t&&"Weekly"!==t)&&(!s.Std.ismonthly(e)||"Daily"!==t&&"Weekly"!==t&&"Monthly"!==t))}(e,this._pivTimeFrame),this._isValidResolution||s.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=h(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,n.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,s.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e){if(!this._isValidResolution)return null;if(e.symbol.time)return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1) ;const t=e.new_var(s.Std.open(e)),i=e.new_var(s.Std.high(e)),r=e.new_var(s.Std.low(e)),n=e.new_var(s.Std.close(e)),a=e.new_var(s.Std.time(e)),l=this._data,h=t.get(0),d=a.get(0),u=t.get(1),p=i.get(1),_=r.get(1),m=n.get(1),g=e.symbol.isLastBar;if(0!==l.pivots.length&&e.symbol.isNewBar){const e=l.pivots[l.pivots.length-1];e.endIndex__t!==d&&(e.endIndex__t=d)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const f=function(e,t,i,r,n,a,l,c){const h=new o;let d=NaN;const u=i-r;switch(c){case 0:d=(i+r+n)/3,h.p=d,h.r1=2*d-r,h.s1=2*d-i,h.r2=d+(i-r),h.s2=d-(i-r),h.r3=2*d+(i-2*r),h.s3=2*d-(2*i-r),h.r4=3*d+(i-3*r),h.s4=3*d-(3*i-r),h.r5=4*d+(i-4*r),h.s5=4*d-(4*i-r);break;case 1:d=(i+r+n)/3,h.p=d,h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+r+2*e)/4,h.p=d,h.r1=2*d-r,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-r),h.s3=r-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+r+n)/3,h.p=d,h.r1=2*d-r,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let o=NaN;o=s.Std.equal(t,n)?i+r+2*n:s.Std.greater(n,t)?2*i+r+n:2*r+i+n,d=o/4,h.p=d,h.r1=o/2-r,h.s1=o/2-i;break;case 5:d=(i+r+n)/3,h.p=d,h.r1=n+1.1*u/12,h.s1=n-1.1*u/12,h.r2=n+1.1*u/6,h.s2=n-1.1*u/6,h.r3=n+1.1*u/4,h.s3=n-1.1*u/4,h.r4=n+1.1*u/2,h.s4=n-1.1*u/2;break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(h,u,p,_,m,d,c(e,d),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(l.pivots=[]),l.pivots.push(f),l.pivots.length>this._historicalPivotsToKeep&&l.pivots.shift(),g?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex(e=>e.startIndex__t>this._firstMainSeriesBarTime)-1,0);e>0&&this._data.pivots.splice(0,e)}}}},67366:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(37796);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1"},constructor:r}},46433:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(77392);function r(e,t,i){const r={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s];const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)), r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],S=[],y=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),S.push(a.get(e)),y.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(y,v,S)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},37796:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>r,spreadRatioDefaults:()=>n,spreadRatioInputs:()=>o,spreadRatioPlots:()=>a,spreadRatioStyles:()=>l});var s=i(77392);class r{init(e,t){e.new_sym(t(1),s.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,r=s.Std[this._source](e);e.select_sym(1);const n=s.Std[this._source](e),o=e.new_unlimited_var(n),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l);return[this._doCalculation(this._scaleFactor1,r,this._scaleFactor2,c)]}} const n={styles:{plot1:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#800080"}},precision:2,inputs:{source:"close",symbol2:""}},o=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],a=[{id:"plot1",type:"line"}],l={plot1:{title:"Plot",histogramBase:0}}},30934:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(37796);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1"},constructor:r}},3782:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(77392);class r{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},39107:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>_});var s=i(16282),r=i(57968),n=i(35001),o=i(77392),a=i(14);class l extends a.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level}))}}}class u extends a.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}class p{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach(t=>e+=t.size),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class _{constructor(e,t,i,r,n,o,a,l,h,d,u,_,m,g){this._freezedBoxes=new c.GraphicsList,this._freezedHists=new c.GraphicsList,this._freezedPocs=new c.GraphicsList, this._freezedVAHists=new c.GraphicsList,this._currentHistsGr=new c.GraphicsList,this._currentVAHistsGr=new c.GraphicsList,this._currentHists=[],this._currentHistsMap=new p,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=l,this._vaVolumePercent=h,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=m,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=o.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),o.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[], this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,o.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),o.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)o.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):o.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s];o.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new u(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._rightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,"ERROR - PocHistItemIndex == "+e),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;o.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._rightBoxTime);i.push(new h(r,e)),i.push(new h(r,t)),i.push(new h(n,t)),i.push(new h(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const a=e.low,l=e.high,c=isNaN(e.volume)?0:e.volume,h=e.isUp,d=(0,s.ensureNotNull)(this._rowsLayout);d.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,a,l);const u=d.rowWidth();if(!o.Std.greater(u,0))return;d.calculate() ;const p=d.getIndexLowVbP(),_=d.getIndexHighVbP(),m=d.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*c,h,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,o=(t+1)*u+m,d=this._rowCoeff(s,o,a,l),p=d*c;e+=d,this._updateResult({start:s,end:o},n*p,h,i,r)}(0,s.assert)(o.Std.equal(e,1,.05),"totalCoeff not equal 1! totalConf = "+e)}}_updateResult(e,t,i,r,n){const a=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const c=(0,s.ensureNotNull)(this._leftBoxTime),h=(0,s.ensureNotNull)(this._rightBoxTime);let d=n.get(e);if(void 0===d)d=new l(this,e.start,e.end,a,c,h),n.set(e,d),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(d),_._addInOrder(d,r,0,r.length,(e,t)=>{let i=o.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=o.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:o.Std.compare(e.priceHigh(),t.priceHigh()))});else{const e=[];for(let t=0;td,maxHHistItems:()=>c,numOfSubHists:()=>h});var s=i(77392),r=i(35001);class n{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN, this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class o extends n{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class a extends n{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var l=i(27490);function c(){return 6e3}function h(e){switch(e){case"Up/Down":return 2;case"Total":return 1;default:s.Std.error("Invalid study argument value: "+e)}}class d{findBasicResolutionForFromTo(e,t,i,n){const o=(0,s.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return l.enabled("charting_library_debug_mode")&&console.log(`Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&s.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new o(t):new a(t)}}},62243:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(16282),r=i(29226),n=i(77392),o=i(77455),a=i(31505),l=i(35001),c=i(79234),h=i(86860),d=i(90957),u=i(14942),p=i(10622),_=i(3782),m=i(64417),g=i(39107);class f extends g.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d){super(e,t,i,n,o,a,!1,l,c,()=>h,d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function y(e){return{constructor:S,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:a.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:a.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:m.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:m.LineStyle.Solid,linewidth:1,plottype:o.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,visible:!1},developingVAHigh:{color:"#0000ff",linestyle:m.LineStyle.Solid,linewidth:1,plottype:o.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,visible:!1},developingVALow:{color:"#0000ff",linestyle:m.LineStyle.Solid,linewidth:1,plottype:o.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,visible:!1}}},graphics:{hhists:{histBars2:{location:a.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:a.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{ developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=y({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=y({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},98083:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});var s=i(16282),r=i(49382);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,(e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(16282),r=i(29226),n=i(77392),o=i(31505),a=i(35001),l=i(79234),c=i(39107),h=i(14942);class d extends c.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,d){super(e,t,i,n,new h.GraphicsList,o,!0,a,l,()=>c,d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){ return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout",name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:o.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,visible:!1},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,visible:!1},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,visible:!1}}},styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},71181:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});class s extends Error{constructor(e){super(e),this.studyError=!0}}},90957:(e,t,i)=>{"use strict";i.d(t,{EraseObj:()=>s,EraseAll:()=>r,GraphicsCmds:()=>n});class s{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class r{primitiveData(){return{action:"all"}}}class n{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map(e=>e.primitiveData())), void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList(e=>e.setOwner(this))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},79234:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null}addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach(i=>t.push(...i.primitivesData(e))),t}deleteErasedItems(){this._forEach(e=>e.deleteErasedItems())}markPostedItems(){this._forEach(e=>e.markPostedItems())}isNaN(){return this._all(e=>e.isNaN())}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},14942:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(14),r=i(49282);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),!0}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),!0}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);return this._setCachedDataValid(!1),!0}deleteErasedItems(){this._items=this._items.filter(e=>!e.isErased())}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},14:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(77392);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}} class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,(e,t)=>!s.Std.equal(e,t))}createDoubleArrayField(e,t){return new o(e,t,this,(e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},10622:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>d});var s=i(90957);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n=i(47903),o=i(49282);function a(e){return Boolean(e.isPosted)}class l{isIgnoredObj(e,t){return l.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return l.isIgnoredObjNaNable(e);const i=e[t];return l.isIgnoredByGeneralRules(e,t)||l.isIgnoredObjNaNable(i)||l.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,o.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,n.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,o.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return a(e)&&e.isPosted()}static isIgnoredObjErased(e){return a(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,n.isArray)(i)&&0===i.length}}class c{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)}}class h{isIgnoredObj(e,t){ if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e)||l.isIgnoredObjPosted(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)||l.isIgnoredObjPosted(i)}}class d extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new c,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new h,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},86860:(e,t,i)=>{"use strict";i.d(t,{StudyGraphicsData:()=>r,Container:()=>n});var s=i(16282);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList(e=>{e.deleteErasedItems(),e.markPostedItems()})}deleteErasedObjs(){this.forEachList(e=>e.deleteErasedItems())}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){ for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},81137:(e,t,i)=>{"use strict";const s=i(53312).getHexColorByName;var r=i(77392);const n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return r.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context));return[r.Std.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.Std.open(t)),s=t.new_var(r.Std.high(t)),n=t.new_var(r.Std.low(t)),o=t.new_var(r.Std.close(t)),a=r.Std.abs(s-o.get(1)),l=r.Std.abs(n-o.get(1)),c=r.Std.abs(s-n),h=r.Std.abs(o.get(1)-i.get(1)),d=r.Std.max(a,l),u=r.Std.iff(a>=r.Std.max(l,c),a-.5*l+.25*h,r.Std.iff(l>=r.Std.max(a,c),l-.5*a+.25*h,c+.25*h));return r.Std.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.Std.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}}, inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return r.Std.gt(e,t)},this.f_1=function(e,t){return r.Std.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=this.f_1(r.Std.close(this._context),r.Std.open(this._context)),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context);return[this.f_2(o,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.Std.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.high(this._context),n=i+1,o=this._context.new_var(s),a=r.Std.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.Std.low(this._context),h=this._context.new_var(c),d=r.Std.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1, isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.Std.ohlc4(this._context)]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(r.Std.high(this._context)),i=r.Std.change(t),s=this._context.new_var(r.Std.low(this._context)),n=-r.Std.change(s),o=this._context.new_var(r.Std.tr(void 0,this._context)),a=r.Std.rma(o,e,this._context),l=this._context.new_var(r.Std.and(r.Std.gt(i,n),r.Std.gt(i,0))?i:0),c=r.Std.fixnan(100*r.Std.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.Std.and(r.Std.gt(n,i),r.Std.gt(n,0))?n:0);return[c,r.Std.fixnan(100*r.Std.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],o=s+n,a=this._context.new_var(r.Std.abs(s-n)/(r.Std.eq(o,0)?1:o));return[100*r.Std.rma(a,t,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[r.Std.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{ palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.Std.change(h);return[c,this.f_1(d)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(r.Std.close(this._context),r.Std.open(this._context),r.Std.high(this._context),r.Std.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t ;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.stdev(l,s,this._context),h=this.f_0(n,c);return[a,this.f_1(a,h),this.f_2(a,h)]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{ styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return r.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.volume(this._context),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context);return[this.f_1(o,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.accdist(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot"}},bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t, this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(r.Std.high(this._context)-r.Std.low(this._context)),s=this._context.new_var(r.Std.ema(i,this.period,this._context));return[r.Std.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=r.Std.high(this._context),a=this._context.new_var(o),l=r.Std.highest(a,i,this._context),c=r.Std.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.Std.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.Std.highest(_,n,this._context),g=this._context.new_var(p);return[r.Std.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return r.Std.ge(e,0)?e:0},this.f_1=function(e){return r.Std.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.Std.sum(c,i,this._context),d=this._context.new_var(l),u=r.Std.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52, isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){var e=r.Std.close(this._context),t=r.Std.hlc3(this._context),i=this._context.new_var(r.Std.high(this._context)),s=r.Std.highest(i,30,this._context),n=r.Std.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.Std.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.Std.sqrt(1+c*c),d=r.Std.round(180*r.Std.acos(1/h)/3.141592653589793),u=r.Std.iff(r.Std.gt(c,0),-d,d),p=r.Std.and(r.Std.gt(u,-2.14),r.Std.le(u,-.71))?7:8,_=r.Std.and(r.Std.gt(u,-3.57),r.Std.le(u,-2.14))?6:p,m=r.Std.and(r.Std.gt(u,-5),r.Std.le(u,-3.57))?5:_,g=r.Std.le(u,-5)?4:m,f=r.Std.and(r.Std.lt(u,2.14),r.Std.ge(u,.71))?3:g,v=r.Std.and(r.Std.lt(u,3.57),r.Std.ge(u,2.14))?2:f,S=r.Std.and(r.Std.lt(u,5),r.Std.ge(u,3.57))?1:v;return[1,r.Std.ge(u,5)?0:S]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t,i,s){ return 100*r.Std.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.atr(1,this._context),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context),h=r.Std.low(this._context),d=this._context.new_var(h),u=r.Std.lowest(d,i,this._context),p=r.Std.log10(i);return[this.f_0(o,c,u,p)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hlc3(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.Std.sma(l,s,this._context),h=this._context.new_var(i),d=r.Std.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.Std.ema(p,o,this._context):"WMA"===n?a=r.Std.wma(p,o,this._context):"SMA"===n&&(a=r.Std.sma(p,o,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1", name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"}},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(r.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?r.Std.nz(e)<=0?1:r.Std.nz(e)+1:r.Std.nz(e)>=0?-1:r.Std.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._context.new_var(i),n=this._input(0),o=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a);var l=r.Std.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.Std.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.Std.roc(s,1)),u=r.Std.percentrank(d,a);return[r.Std.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var o=r.Std.close(this._context),a=this._context.new_var(o),l=r.Std.roc(a,s),c=this._context.new_var(o),h=r.Std.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.Std.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"", name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.Std.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),r.Std.period(this._context),r.Std.close(this._context)),n=this._input(1);this._context.select_sym(1);var o=this._context.new_unlimited_var(this._context.symbol.time),a=r.Std.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(o,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[r.Std.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.Std.period(this._context)),this._context.new_sym(this._input(1),r.Std.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=r.Std.sma(e,i,s),o=r.Std.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.Std.sma(a,i,s)-n*o)/Math.sqrt(r.Std.variance2(e,n,i)*r.Std.variance2(t,o,i))},this.main=function(e,t){this._context=e,this._input=t,this._context.select_sym(1);var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(r.Std.close(this._context)),n=this._context.new_var(r.Std.log(s.get()/s.get(1))),o=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(r.Std.close(this._context)),l=this._context.new_var(r.Std.log(a.get()/a.get(1))),c=this._context.new_var(n.adopt(o,i,0)),h=this.correlationLog(l,c,this.period,this._context);return[r.Std.round(1e3*h)/1e3]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1", bands:[{id:"hline_0",name:"Zero",isHidden:!1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(r.Std.close(this._context)),n=this._context.new_var(r.Std.sma(s,e,this._context)),o=this._context.new_var(r.Std.close(this._context)).get(i)-n,a=r.Std.close(this._context)-n.get(i);return[t?o:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),r.Std.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0, joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.low(this._context),n=this._context.new_var(s),o=r.Std.lowest(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context);return[o,c,r.Std.avg(c,o)]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i);var s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context);return[this.f_0(o,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,r){return e*t*(i-s)/r},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.hl2(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(i,a,r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),c=this._context.new_var(l);return[r.Std.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}], inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o,r.Std.volume(this._context)),l=this._context.new_var(a);return[r.Std.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.Std.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context),h=a,d=c,u=r.Std.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}], inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std[this._input(4)](this._context)),s=r.Std.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.Std.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.Std.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(r.Std.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.Std.change(this._context.new_var(e));return t-(r.Std.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o);var a=this._context.new_var(i),l=r.Std.ema(a,s,this._context),c=this._context.new_var(i),h=r.Std.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9, source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.Std.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.Std.ema(d,a,this._context):"WMA"===o?l=r.Std.wma(d,a,this._context):"SMA"===o&&(l=r.Std.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.Std.wma(o,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21, method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(2)?(i=r.Std.ema(n,this._input(0),this._context),s=r.Std.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.Std.wma(n,this._input(0),this._context),s=r.Std.wma(n,this._input(1),this._context)):(i=r.Std.sma(n,this._input(0),this._context),s=r.Std.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(3)?(i=r.Std.ema(o,this._input(0),this._context),s=r.Std.ema(o,this._input(1),this._context),n=r.Std.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.Std.wma(o,this._input(0),this._context),s=r.Std.wma(o,this._input(1),this._context),n=r.Std.wma(o,this._input(2),this._context)):(i=r.Std.sma(o,this._input(0),this._context),s=r.Std.sma(o,this._input(1),this._context),n=r.Std.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0, visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.Std.stdev(t,i,this._context),a=r.Std.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._context.new_var(r.Std.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*r.Std.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume", shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.Std.gt(e,0)?t:r.Std.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._context.new_var(i),n=r.Std.change(s);return[this.f_0(n,r.Std.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.Std.gt(e,0)?t:r.Std.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(a,r.Std.volume(this._context),a),c=r.Std.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.Std.ema(d,s,this._context):"WMA"===i?h=r.Std.wma(d,s,this._context):"SMA"===i&&(h=r.Std.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);return[r.Std.sar(i,s,n,this._context)]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1, plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.high(this._context),s=this._context.new_var(i),n=r.Std.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.Std.highest(s,a,this._context),h=r.Std.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.Std.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(r.Std.close(this._context));return[r.Std.cum(r.Std.change(e)/e.get(1)*r.Std.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0()[0]]}}},{name:"Rate Of Change",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{ styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ROC",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Rate Of Change",shortDescription:"ROC",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1}],inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"rate_of_change@tv-basicstudies-1",scriptIdPart:"",name:"Rate Of Change",format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._input(0);return[100*(i.get(0)-i.get(s))/i.get(s)]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{length:14,smoothingLine:"SMA",smoothingLength:14}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"length",name:"Length",defval:14,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:14,type:"integer",min:1,max:1e4}],id:"Relative Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Strength Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){return r.Std.max(e,0)},this.f_1=function(e){return-r.Std.min(e,0)},this.f_2=function(e,t){return r.Std.eq(e,0)?100:r.Std.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.Std.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.Std.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.Std.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.Std.ema(f,o,this._context):"WMA"===n?a=r.Std.wma(f,o,this._context):"SMA"===n&&(a=r.Std.sma(f,o,this._context)),[{value:g},{value:a}]}}},{name:"Relative Vigor Index",metainfo:{_metainfoVersion:52,isTVScript:!1, isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Vigor Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Vigor Index",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.swma(n,this._context),a=this._context.new_var(o),l=r.Std.sum(a,i,this._context),c=this.f_0(r.Std.high(this._context),r.Std.low(this._context)),h=this._context.new_var(c),d=r.Std.swma(h,this._context),u=this._context.new_var(d),p=r.Std.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.Std.swma(m,this._context)]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Volatility Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return r.Std.le(e,0)?0:t},this.f_1=function(e,t){return r.Std.gt(e,0)?0:t},this.f_2=function(e,t){return e/(e+t)*100},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(i+12);var s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.stdev(n,i,this._context),a=this._context.new_var(s),l=r.Std.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.Std.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.Std.ema(p,14,this._context);return[this.f_2(d,_)]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{ styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:2e3}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"SMI Ergodic Indicator/Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.Std.ema(c,n,this._context);return[l,h,this.f_0(l,h)]}}},{name:"Smoothed Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#673AB7"}},inputs:{in_0:7,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Smoothed Moving Average",shortDescription:"SMMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"smoothed_moving_average@tv-basicstudies-1",scriptIdPart:"",name:"Smoothed Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r.Std[this._input(1)](this._context);return[r.Std.smma(t,e,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Standard Deviation",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Standard Deviation@tv-basicstudies-1",scriptIdPart:"",name:"Standard Deviation",description:"Standard Deviation",shortDescription:"Standard Deviation",is_price_study:!1,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:u}},inputs:{periods:5,deviations:1}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"deviations",name:"Deviations",type:"float"}],format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){ this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._context.new_var(r.Std.close(this._context));return[r.Std.stdev(n,i,this._context)*s]}}},{name:"Stochastic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"K",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"D",defval:1,type:"integer",min:1,max:1e4},{id:"in_2",name:"smooth",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic",format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.Std.close(this._context),a=r.Std.high(this._context),l=r.Std.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.Std.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.Std.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.Std.sma(m,n,this._context)]}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1, max:1e4},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1e4},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic RSI@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic RSI",format:{precision:2,type:"price"}},constructor:function(){this.f_1=function(e,t,i){var s=i.new_var(r.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3);e.setMinimumAdditionalDepth(s+n+o+a);var l=this._context.new_var(i),c=r.Std.rsi(this.f_1(l,s,this._context),this.f_2(l,s,this._context)),h=this._context.new_var(c),d=this._context.new_var(c),u=this._context.new_var(c),p=r.Std.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.Std.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.Std.sma(g,a,this._context)]}}},{name:"TRIX",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"length",defval:18,type:"integer",min:1,max:2e3}],id:"TRIX@tv-basicstudies-1",scriptIdPart:"",name:"TRIX",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){return r.Std.log(e)},this.f_1=function(e){return 1e4*e},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);e.setMinimumAdditionalDepth(3*i);var s=this.f_0(r.Std.close(this._context)),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.ema(c,i,this._context),d=this._context.new_var(h),u=r.Std.change(d);return[this.f_1(u)]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Triple EMA@tv-basicstudies-1",scriptIdPart:"",name:"Triple EMA",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return 3*(e-t)+i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(3*i) ;var s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.ema(c,i,this._context);return[this.f_0(o,l,h)]}}},{name:"True Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:25,in_1:13,in_2:13}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"True Strength Index",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"True Strength Index",shortDescription:"True Strength Index",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:1,max:4999},{id:"in_1",name:"short",defval:13,type:"integer",min:1,max:4999},{id:"in_2",name:"siglen",defval:13,type:"integer",min:1,max:4999}],id:"True Strength Indicator@tv-basicstudies-1",scriptIdPart:"",name:"True Strength Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)+this._input(2));var o=r.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.Std.ema(c,n,this._context)]}}},{name:"Trend Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Trend Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Trend Strength Index",description:"Trend Strength Index",shortDescription:"Trend Strength Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",type:"integer",name:"Periods"}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.invertedPeriod=1/this.period,this.sumX=(this.period-1)*this.period/2,this.sumXX=(this.period-1)*this.period*(2*this.period-1)/6,this.invertedPeriodSumXSumX=this.invertedPeriod*this.sumX*this.sumX},this.trendStrengthIndex=function(){for(var e=this._context.new_var(r.Std.close(this._context)),t=r.Std.sum(e,this.period,this._context),i=0,s=0,n=0;n0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){return this._context=e,this._input=t,[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{ _metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.Std.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[r.Std.sum(s,i,this._context)/r.Std.sum(n,i,this._context)]},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(r.Std.close(this._context)),n=r.Std.max(r.Std.high(this._context),s.get(1)),o=this._context.new_var(r.Std.close(this._context)),a=r.Std.min(r.Std.low(this._context),o.get(1)),l=r.Std.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return r.Std.sqrt(s)},this.variance=function(e,t,i){var s=r.Std.sma(e,t,i);return this.variance2(e,s,t)},this.variance2=function(e,t,i){var s,r,n=0 ;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(r.Std.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=r.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.Std.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(r.Std.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.Std.close(this._context)),1===this.count)this.atr=r.Std.high(this._context)-r.Std.low(this._context),this.sic=r.Std.close(this._context);else if(this.countthis.sic&&(this.sic=r.Std.close(this._context))}else if(this.count===this.period){e=r.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2], i=this.bars[this.bars.length-2]-r.Std.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,r.Std.close(this._context)>this.sic&&(this.sic=r.Std.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.Std.close(this._context)s?(this.position="LONG",this.sic=r.Std.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.Std.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.hist=null,e.add_hist()},this.init=function(e,t){this._isNewSession=null},this.main=function(e,t){this._context=e,this._input=t;var i=e.new_var(),s=e.new_var(),n=this._context.symbol.time;return n&&(null===this._isNewSession&&(this._isNewSession=r.Std.createNewSessionCheck(e)),this._isNewSession(n)&&(this.f_1(i),this.f_1(s))),i.set(r.Std.nz(i.get(1))+r.Std.hlc3(this._context)*r.Std.volume(this._context)),s.set(r.Std.nz(s.get(1))+r.Std.volume(this._context)),[i.get(0)/s.get(0)]}}},{name:"VWMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.Std.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{ plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero"}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.volume(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._context.new_var(r.Std.low(this._context)),i=this._context.new_var(r.Std.abs(r.Std.high(this._context)-t.get(1))),s=r.Std.sum(i,e,this._context),n=this._context.new_var(r.Std.high(this._context)),o=this._context.new_var(r.Std.abs(r.Std.low(this._context)-n.get(1))),a=r.Std.sum(o,e,this._context),l=this._context.new_var(r.Std.atr(1,this._context)),c=r.Std.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit"},{id:"hline_1",name:"LowerLimit"}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background"}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"}}, constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.high(this._context),n=this._context.new_var(s),o=r.Std.highest(n,i,this._context),a=r.Std.low(this._context),l=this._context.new_var(a),c=r.Std.lowest(l,i,this._context);return[this.f_0(r.Std.close(this._context),o,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=r.Std.hl2(this._context);return[{value:r.Std.smma(c,i,this._context),offset:o},{value:r.Std.smma(c,s,this._context),offset:a},{value:r.Std.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(r.Std.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.Std.and(i,r.Std.lt(t.get(e-c),t.get(e))), s=r.Std.and(s,r.Std.lt(t.get(e+c),t.get(e))),n=r.Std.and(n,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.lt(t.get(e+c+1),t.get(e)))),o=r.Std.and(o,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.lt(t.get(e+c+2),t.get(e))))),a=r.Std.and(a,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.lt(t.get(e+c+3),t.get(e)))))),l=r.Std.and(l,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.and(r.Std.le(t.get(e+4),t.get(e)),r.Std.lt(t.get(e+c+4),t.get(e)))))));var h=r.Std.or(s,r.Std.or(n,r.Std.or(o,r.Std.or(a,l)))),d=r.Std.and(i,h),u=this._context.new_var(r.Std.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.Std.and(p,r.Std.gt(u.get(e-c),u.get(e))),_=r.Std.and(_,r.Std.gt(u.get(e+c),u.get(e))),m=r.Std.and(m,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.gt(u.get(e+c+1),u.get(e)))),g=r.Std.and(g,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.gt(u.get(e+c+2),u.get(e))))),f=r.Std.and(f,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.gt(u.get(e+c+3),u.get(e)))))),v=r.Std.and(v,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.and(r.Std.ge(u.get(e+4),u.get(e)),r.Std.gt(u.get(e+c+4),u.get(e)))))));var S=r.Std.or(_,r.Std.or(m,r.Std.or(g,r.Std.or(f,v))));return[r.Std.and(p,S),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0, linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer"},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer"},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer"},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer"},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer"},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer"},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer"},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer"},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer"},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer"},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer"},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer"}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t ;var i=this._context.new_var(r.Std.close(this._context)),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=r.Std.ema(i,s,this._context),d=r.Std.ema(i,n,this._context),u=r.Std.ema(i,o,this._context),p=r.Std.ema(i,a,this._context),_=r.Std.ema(i,l,this._context),m=r.Std.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),S=this._input(9),y=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.Std.ema(i,g,this._context),r.Std.ema(i,f,this._context),r.Std.ema(i,v,this._context),r.Std.ema(i,S,this._context),r.Std.ema(i,y,this._context),r.Std.ema(i,b,this._context)]}}}]},33860:(e,t,i)=>{"use strict";i.d(t,{PointsetsManager:()=>n});var s=i(35001);const r=(0,i(65447).getLogger)("ChartApi.PointsetsManager");class n{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,n){let o=this._pointsetsDataBySymbol.get(t);void 0===o&&(o=new Map,this._pointsetsDataBySymbol.set(t,o));const a=[];for(const t of s){const[i,s]=t;"number"!=typeof i||Number.isNaN(i)?r.logWarn(`Pointset time is invalid: id=${e}, ${i} of type ${typeof i}`):a.push({point:t,extrapolation:n.extrapolateTimeWithOffsetToTime(1e3*i,s)})}s.length===a.length&&o.set(e,{resolution:i,points:a})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach((i,s)=>{i.delete(e),0===i.size&&t.push(s)});for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach((e,i)=>{if(s.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)})}getUpdatesForSymbol(e,t,i,s){const r=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach((e,n)=>{const o=this._refreshPointsetData(e,t,i,s);null!==o&&r.set(n,o)}),r}_refreshPointsetData(e,t,i,n){if(s.Interval.isEqual(e.resolution,t))for(let t=0;t ${t}`),null;o.push({index:i,value:[a.index,a.timeMs/1e3]})}return o}}},66449:(e,t,i)=>{"use strict";i.d(t,{SessionTimeScale:()=>v});var s=i(16282),r=i(27490),n=i(84540),o=i(49382),a=i(63059),l=i(67620),c=i(33287);function h(e){return 60*e*60*1e3}function d(e){return 60*e*1e3}const u=[{divisor:1,weight:18},{divisor:(p=1,1e3*p),weight:19},{divisor:d(1),weight:20},{divisor:d(5),weight:21},{divisor:d(30),weight:22},{divisor:h(1),weight:30},{divisor:h(3),weight:31},{divisor:h(6),weight:32},{divisor:h(12),weight:33}];var p;function _(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60 ;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=u.length-1;e>=0;--e)if(Math.floor(i/u[e].divisor)!==Math.floor(s/u[e].divisor))return u[e].weight}return 18}function m(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[];for(;s=t.length?(n.push({old:s,new:l.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===l.INVALID_TIME_POINT_INDEX)return-1;if(t.new===l.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1})}function g(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}const f=r.enabled("end_of_period_timescale_marks");class v{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._seriesIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._seriesIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,(e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN}));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;tg(e,i+t));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),(e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i})}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceSeriesBarsTimesTail(e,t){if(0===t.length)return null;if(!this._seriesIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],(e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN}));for(let e=s;ee.timeMs-t.timeMs);const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){let i=0!==this._pointDataByTimePoint.size;if(this._seriesIds.has(e))if(1===this._seriesIds.size)i=!1,this._pointDataByTimePoint.clear();else for(const t of this._sortedTimePoints)t.pointData.series.delete(e);this._addBarsTimesToSeries(e,t,!1);const s=this._seriesIds.size;0===t.length?this._seriesIds.delete(e):this._seriesIds.add(e),i&&this._cleanupPointsData(this._sortedTimePoints);const r=sthis._seriesIds.size,o=r&&2===this._seriesIds.size||n&&1===this._seriesIds.size,a=[];this._pointDataByTimePoint.forEach((e,t)=>{a.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})}),a.sort((e,t)=>e.timeMs-t.timeMs);const l=this._updateTimeScalePoints(a) ;return this._applyTimeScaleChanges(l,o)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToSeries(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,series:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.series.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.series.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=S(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map(e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t}));{const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){ const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t{"use strict";var s=i(77848),r=i(77392),n=i(22241),o=i(89817).SymbolExtrapolator,a=i(66449).SessionTimeScale,l=i(33860).PointsetsManager,c=i(42062),h=i(63059).createDwmAligner,d=i(35001).Interval,u=i(18437),p=i(81447).visitObject,_=i(47903).isObject;i(81137),i(98779);var m=i(10706).DatafeedRequestsCachedProcessor,g=i(94975).timezoneIsAvailable,f=i(63059).isAlignmentEnabled,v=i(89164),S=v.isEncodedExtendedSymbol,y=v.decodeExtendedSymbol,b=i(25436).extractSymbolNameFromSymbolInfo,w=i(81482).replaceGraphicsTimesWithTimePointIndexIndex,P=i(27490);function C(e){var t=e.findIndex((function(e){return-5e6!==e.index}));return-1===t?[]:0===t?e:e.slice(t)}function T(e,t){return e+"_"+t}var x=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&r.overwriteVolumeProfileResolutionForPeriodGetter((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData),t._fireEvent("configuration_received"), t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new m(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),n.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new c.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=c.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i),n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function I(e,t){return e+"_"+t}function M(e,t,i){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")}x.prototype._getSymbolExtrapolator=function(e,t,i){var s=d.normalize(i),r=function(e,t,i){return e+","+t.full_name+","+i}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new o(t,s),this._symbolExtrapolators[r]=n),n},x.prototype._barsCoefficients=function(e,t){if(void 0===y(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},x.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},x.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},x.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},x.prototype._logMessage=function(e){P.enabled("charting_library_debug_mode")&&console.log(e)},x.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},x.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||u.onRealtimeCallback([_[_.length-1]],l,_.length,v,i)}(e,t,i)},nonseriesOut:function(e,t){u.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){S=!0},recalc:function(e,s){p=!1,_.endOfData=S,t.error&&null!==t.error()||(null!==l&&(y._objectsDataCache[l]=_),u.onDataReadyCallback(_,v,i,s))}});if(!y._studiesCache[e]||!y._studiesCache[e][n])throw Error("This should never happen");y._studiesCache[e][n].engine=b}catch(e){if(!e.studyError)throw e;u.onErrorCallback(e.message)}}else u.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,C)},x.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){e=C(e),l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n=0},x.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){s._recreateSourcesForDataRange(t,{to:i})}),0)},x.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(d.isDWM(s.resolution)&&null!=s.symbolInfo){var r=h(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))} var n=this._symbolIdToSymbolRequestString.get(T(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},x.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},x.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},x.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},x.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},x.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];"series"===r.type&&(i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed)}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},x.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},x.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},x.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},x.prototype.createSeries=function(e,t,i,s,n,o,a){this._setEndOfData(e,t,i,!1);var l=new r.OHLCV ;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],u=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||d.isEqual(h.resolution,n)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===u||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===u)void 0!==o.countBack&&null!==c&&(o.countBack+=c.length);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{"use strict";i.d(t,{SymbolExtrapolator:()=>c});var s=i(16282),r=i(49382),n=i(42062),o=i(25853),a=i(35001);function l(e,t){return e.length>t}class c{constructor(e,t,i=2e5){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=a.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,n.newBarBuilder)(t,new n.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],n=this._barsTimes[this._barsTimes.length-1],o=i>n?this._barsTimes.length:(0,r.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,s.assert)(-1!==this._projectionFirstIndex,"something went wrong"),n!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0} ;0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&ethis._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,r.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,s.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,s.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,r.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,r.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,s.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e=e)return;if((0,s.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||l(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times)}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||l(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight((t,i)=>(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times),this._futureBarsCache[this._futureBarsCache.length-1]=e||l(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse())}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||l(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft((t,i)=>{const s=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s}),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},90774:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(15755)},89077:(e,t,i)=>{"use strict";var s,r;function n(e,t){ return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>r,areEqualTimeFrames:()=>n}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={}))},84277:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},17915:(e,t,i)=>{"use strict";i.d(t,{getQuoteSessionInstance:()=>o,destroyQuoteSessions:()=>a});var s=i(6636),r=i.n(s);const n={};function o(e="full"){return n[e]||function(e="full",t){n[e]=t}(e,new(r())(e)),n[e]}function a(){for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];void 0!==t&&t.destroy(),delete n[e]}}},36395:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(45259).randomHash;function r(e){this._chartApi=e,this._sessionid="qs_"+s(),this._sessionstarted=!1}r.prototype.destroy=function(){this._sessionstarted&&(this._chartApi.quoteDeleteSession(this._sessionid),this._sessionid=null,this._sessionstarted=!1)},r.prototype.connected=function(){return this._chartApi.connected()},r.prototype.connect=function(e){this._globalHandler=e,this._chartApi.createSession(this._sessionid,this),this._chartApi.connect()},r.prototype.disconnect=function(){this._chartApi.disconnect()},r.prototype.quoteAddSymbols=function(e){this._chartApi.quoteAddSymbols(this._sessionid,e)},r.prototype.quoteRemoveSymbols=function(e){this._chartApi.quoteRemoveSymbols(this._sessionid,e)},r.prototype.quoteFastSymbols=function(e){this._chartApi.quoteFastSymbols(this._sessionid,e)},r.prototype.quoteSetFields=function(e){this._chartApi.quoteSetFields(this._sessionid,e)},r.prototype.onMessage=function(e){switch(e.method){case"connected":this._sessionstarted||(this._chartApi.quoteCreateSession(this._sessionid),this._sessionstarted=!0);break;case"disconnected":this._sessionstarted=!1}this._globalHandler(e)},r.prototype.quoteHibernateAll=function(e){this._chartApi.quoteHibernateAll(this._sessionid)},TradingView.QuoteSession=r,e&&e.exports&&(e.exports=r)},6636:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(5729),r=i(58848).default,n=i(99479).default,o=i(59104).PriceFormatter;const{uniq:a}=i(4334);var l,c=i(45259),h=i(50494).parseUpdateMode,d=i(7532).deepExtend;function u(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new s,this.onDisconnect=new s,this._quoteApi=new l(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=n(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}l=i(36395), u.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},u.prototype.typeFields={},u.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","current_session","description","exchange","format","fractional","is_tradable","language","local_description","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","update_mode","volume"],u.prototype.typeFields.simpleDetailed=[].concat(u.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),u.prototype.typeFields.full=[],u.prototype.typeFields.watchlist=[].concat(u.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id"]),u.prototype.typeFields.portfolio=["pro_name","short_name","exchange","description","sector","type","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm"],u.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type"],u.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},u.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},u.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},u.prototype.setFields=function(){var e=u.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},u.prototype.onSymbolData=function(e){var t=e.symbolname,i=this._throttledSymbolData[t];i||(i=this._throttledSymbolData[t]={fnDispatch:r(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?d(i.cache,e):i.cache=e,i.fnDispatch(t)},u.prototype._parseUpdateMode=function(e){var t=h(e.update_mode);null!==t&&(e.update_mode=t.mode,e.update_mode_seconds=t.interval)},u.prototype.dipatchSymbolData=function(e){ var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in d(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var r=this._subscriptions[s];r.has(e)&&r.get(e).forEach((function(e){e(t,i)}))}},u.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e];t=[].concat(t);var r=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},r.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),r.length&&this._connected&&(this._quoteApi.quoteAddSymbols(r),this._delayUpdateFastSymbols())},u.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],r=[],n=0;n{"use strict";function s(e,t){return e>1,o=s+r;i(e(o),t)?(s=o+1,n-=r+1):n=r}return s}function n(e,t,i,s=0,n=e.length){return r(t=>e[t],t,i,s,n)}function o(e,t,i=0,r=e.length){return n(e,t,s,i,r)}function a(e,t,i,s=0,r=e.length){let n=r-s;for(;0>1,o=s+r;i(t,e[o])?n=r:(s=o+1,n-=r+1)}return s}function l(e,t,i=0,r=e.length){return a(e,t,s,i,r)}function c(e,t){return e.filter(e=>!t.includes(e))}function h(e,t){const i=e.indexOf(t);return i<0?e.slice():[t].concat(e.slice(0,i)).concat(e.slice(i+1))}function d(e,t,i){const s=new Set(t),r=[],n=[],a=[];return e.forEach((e,t)=>{s.has(e)?n.push(e):(r.push(e),a.push(t))}),i=i{s.has(e)?n.push(e):(r.push(e),a.push(t))}),i=i<=e.length-1?o(a,i):r.length,r.splice(i,0,...n),{newItems:r,movedItemsStartIndex:i}}function p(e,t){const i=new Set;return e.forEach(e=>{t.has(e)&&i.add(e)}),i}i.r(t),i.d(t,{lowerboundExt:()=>r,lowerbound:()=>n,lowerbound_int:()=>o,upperbound:()=>a,upperbound_int:()=>l,subtract:()=>c,moveToHead:()=>h,moveAfter:()=>d,moveBefore:()=>u,intersect:()=>p})},84540:(e,t,i)=>{"use strict";var s=i(10165),r=i(64837).tzData;function n(e){this._name=e;var t=r[e];if(t||(t={time:[],offset:[]},this._invalid=!0),t.time.length!==t.offset.length&&(t={time:[],offset:[]},this._invalid=!0),!t.time_utc){for(var i=t.time,s=t.offset,n=i.length,o=new Array(n),a=0;at){if((r=n-1)0&&e-t[s-1]<=r)return r;return 0},n.prototype.is_valid=function(){return!this._invalid},n._offset=function(e,t,i){var s=o(e,i);return-1===s?0:t[s]};var a=function(e){return 0|e},l=function(e){return 60*e*1e3},c=function(e,t){return h(e)-h(t)},h=function(e){return e<0?a(e/1e3)-(e%1e3!=0?1:0):a(e/1e3)};function d(e){return e%4==0&&(e%100!=0||e%400==0)}var u={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334},p={...s.WeekDays,...s.Months,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440, millisecondsPerDay:l(1440),get_minutes_from_hhmm:function(e){return-1!==e.indexOf(":")&&(e=e.split(":").join("")),e%100+60*a(e/100)},get_year:function(e){return e.getUTCFullYear()},get_month:function(e){return e.getUTCMonth()},get_hours:function(e){return e.getUTCHours()},get_minutes:function(e){return e.getUTCMinutes()},get_seconds:function(e){return e.getUTCSeconds()},get_day_of_month:function(e){return e.getUTCDate()},get_day_of_week:function(e){return e.getUTCDay()+1},get_day_of_year:function(e){var t=e.getUTCMonth(),i=u[t];return t>p.JANUARY+1&&d(e.getUTCFullYear())&&(i+=1),i+e.getUTCDate()},get_week_of_year:function(e){var t=new Date(Date.UTC(e.getUTCFullYear(),0,1)).getUTCDay(),i=0===t?1:8-t,s=p.get_day_of_year(e)-i;return Math.ceil(s/7)+1},get_minutes_from_midnight:function(e){return 60*p.get_hours(e)+p.get_minutes(e)},set_hms:function(e,t,i,s,r,n){e.setUTCHours(t),e.setUTCMinutes(i),e.setUTCSeconds(s),e.setUTCMilliseconds(r),void 0!==n&&p.correct_time(e,n)},correct_time:function(e,t){var i=e.getTime(),s=t.correction_loc(i);e.setTime(i+s)},add_days_considering_dst:function(e,t,i){var s=e.offset_utc(t),r=this.clone(t);this.add_date(r,i);var n=e.offset_utc(r);return r.setTime(r.getTime()+s-n),r},add_date:function(e,t){e.setTime(e.getTime()+t*p.millisecondsPerDay)},add_minutes:function(e,t){e.setTime(e.getTime()+l(t))},clone:function(e){return new Date(e.getTime())},get_days_per_year:function(e){var t=e.getUTCFullYear();return this.days_per_year(t)},days_per_year:function(e){return d(e)?366:365},get_days_in_month:function(e,t){let i;switch(e){case 0:case 2:case 4:case 6:case 7:case 9:case 11:i=31;break;case 1:i=28,d(t)&&i++;break;default:i=30}return i},get_part:function(e,t){switch(t){case p.YEAR:return p.get_year(e);case p.MONTH:return p.get_month(e);case p.DAY_OF_MONTH:return p.get_day_of_month(e);case p.WEEK_OF_YEAR:return p.get_week_of_year(e);case p.DAY_OF_WEEK:return p.get_day_of_week(e);case p.HOUR_OF_DAY:return p.get_hours(e);case p.MINUTE:return p.get_minutes(e);case p.DAY_OF_YEAR:return p.get_day_of_year(e);case p.SECOND:return p.get_seconds(e);default:return e.getTime()}},time_minutes:l,time_seconds:function(e){return 1e3*e},time_minutes_diff:function(e,t){return a(c(e,t)/60)},time_seconds_diff:c,utc_to_cal:function(e,t){return new Date(p.utc_to_cal_ts(e,t))},utc_to_cal_ts:function(e,t){return t+e.offset_utc(t)},get_cal:function(e,t,i,s,r,n,o){var a=new Date(Date.UTC(t,i,s,r||0,n||0,o||0)),l=e.offset_utc(+a);return new Date(a.valueOf()-l)},get_cal_from_unix_timestamp_ms:function(e,t){return new Date(t+e.offset_utc(t))},get_cal_utc:function(e,t,i){return new Date(Date.UTC(e,t,i))},cal_to_utc:function(e,t){var i=t.getTime();return i-e.offset_loc(i)},get_timezone:function(e){return new n(e)},shift_day:function(e,t){var i=e-1;return(i+=t)>6?i%=7:i<0&&(i=(7+i%7)%7),i+1}};e.exports=p},33420:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_SOLID:()=>s,LINESTYLE_DOTTED:()=>r,LINESTYLE_DASHED:()=>n,LINESTYLE_LARGE_DASHED:()=>o,LINESTYLE_SPARSE_DOTTED:()=>a,LINESTYLE_SMALL_DASHED:()=>l}) ;const s=0,r=1,n=2,o=3,a=4,l=5},5025:(e,t,i)=>{"use strict";var s=i(57968),r=s.greaterThan,n=s.lessThan,o=window.CanvasEx=i(33420);o.computeDashPattern=function(e){return[[e.lineWidth,2*e.lineWidth],[5*e.lineWidth,6*e.lineWidth],[6*e.lineWidth,6*e.lineWidth],[e.lineWidth,4*e.lineWidth],[2*e.lineWidth,e.lineWidth]][e.lineStyle-1]},o.drawLine=function(e,t,i,s,r){isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)&&(e.lineStyle!==o.LINESTYLE_SOLID?o.drawDashedLine(e,t,i,s,r):o.drawSolidLine(e,t,i,s,r))},o.drawArrow=function(e,t,i,s,r,n){if(isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)){var o=Math.round(n/2),a=t+o,l=s+o;e.beginPath(),e.moveTo(l,r),e.lineTo(a,i),e.moveTo(t,i+o),e.lineTo(a,i),e.lineTo(t+n,i+o),e.stroke()}},o.drawSolidLine=function(e,t,i,s,r){e.beginPath(),e.moveTo(t,i),e.lineTo(s,r),e.stroke()},o.setLineStyle=function(e,t){e.lineStyle=t;var i=[];t!==o.LINESTYLE_SOLID&&(i=o.computeDashPattern(e)),o.setLineDash(e,i)},o.setLineDash=function(e,t){"function"==typeof e.setLineDash?e.setLineDash(t):void 0!==e.mozDash?e.mozDash=t:void 0!==e.webkitLineDash&&(e.webkitLineDash=t)},o.drawPoly=function(e,t,i){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(var s=0;s0&&(c.thereYet=n,c.cap=Math.max),t-s>0&&(l.thereYet=n,l.cap=Math.max),e.moveTo(t,i);for(var h=t,d=i,u=0,p=!0;!l.thereYet(h,s)||!c.thereYet(d,o);){var _=Math.atan2(o-i,s-t),m=a[u];h=l.cap(s,h+Math.cos(_)*m),d=c.cap(o,d+Math.sin(_)*m),p?e.lineTo(h,d):e.moveTo(h,d),u=(u+1)%a.length,p=!p}},o.setFont=function(e,t){if(e.font!==t)try{e.font=t}catch(e){}},"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.setFont=function(e){o.setFont(this,e)},CanvasRenderingContext2D.prototype.lineStyle=o.LINESTYLE_SOLID),e.exports=o},45053:(e,t,i)=>{"use strict";i.d(t,{combine:()=>n});var s=i(32856),r=i.n(s);function n(e,...t){const i=(...t)=>e(...t.map(e=>e.value())),s=new(r())(i(...t)),n=()=>s.setValue(i(...t)),o=t.map(e=>e.spawn());for(const e of o)e.subscribe(n);return s.readonly().spawn(()=>o.forEach(e=>e.destroy()))}},94975:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ availableTimezones:()=>l,timezoneIsAvailable:()=>c,timezoneTitle:()=>h});var s=i(79881),r=i(48729);const n=[{id:"Etc/UTC",title:(0,s.t)("UTC")},{id:"exchange",title:(0,s.t)("Exchange")}],o=[{id:"Africa/Cairo",title:(0,s.t)("Cairo"),offset:0},{id:"Africa/Johannesburg",title:(0,s.t)("Johannesburg"),offset:0},{id:"Africa/Lagos",title:(0,s.t)("Lagos"),offset:0},{id:"America/Argentina/Buenos_Aires",title:(0,s.t)("Buenos Aires"),offset:0},{id:"America/Bogota",title:(0,s.t)("Bogota"),offset:0},{id:"America/Caracas",title:(0,s.t)("Caracas"),offset:0},{id:"America/Chicago",title:(0,s.t)("Chicago"),offset:0},{id:"America/El_Salvador",title:(0,s.t)("San Salvador"),offset:0},{id:"America/Juneau",title:(0,s.t)("Juneau"),offset:0},{id:"America/Lima",title:(0,s.t)("Lima"),offset:0},{id:"America/Los_Angeles",title:(0,s.t)("Los Angeles"),offset:0},{id:"America/Mexico_City",title:(0,s.t)("Mexico City"),offset:0},{id:"America/New_York",title:(0,s.t)("New York"),offset:0},{id:"America/Phoenix",title:(0,s.t)("Phoenix"),offset:0},{id:"America/Santiago",title:(0,s.t)("Santiago"),offset:0},{id:"America/Sao_Paulo",title:(0,s.t)("Sao Paulo"),offset:0},{id:"America/Toronto",title:(0,s.t)("Toronto"),offset:0},{id:"America/Vancouver",title:(0,s.t)("Vancouver"),offset:0},{id:"US/Mountain",title:(0,s.t)("Denver"),offset:0},{id:"Asia/Almaty",title:(0,s.t)("Almaty"),offset:0},{id:"Asia/Ashkhabad",title:(0,s.t)("Ashgabat"),offset:0},{id:"Asia/Bahrain",title:(0,s.t)("Bahrain"),offset:0},{id:"Asia/Bangkok",title:(0,s.t)("Bangkok"),offset:0},{id:"Asia/Chongqing",title:(0,s.t)("Chongqing"),offset:0},{id:"Asia/Dubai",title:(0,s.t)("Dubai"),offset:0},{id:"Asia/Ho_Chi_Minh",title:(0,s.t)("Ho Chi Minh"),offset:0},{id:"Asia/Hong_Kong",title:(0,s.t)("Hong Kong"),offset:0},{id:"Asia/Jakarta",title:(0,s.t)("Jakarta"),offset:0},{id:"Asia/Jerusalem",title:(0,s.t)("Jerusalem"),offset:0},{id:"Asia/Karachi",title:(0,s.t)("Karachi"),offset:0},{id:"Asia/Kolkata",title:(0,s.t)("Kolkata"),offset:0},{id:"Asia/Kuwait",title:(0,s.t)("Kuwait"),offset:0},{id:"Asia/Manila",title:(0,s.t)("Manila"),offset:0},{id:"Asia/Muscat",title:(0,s.t)("Muscat"),offset:0},{id:"Asia/Qatar",title:(0,s.t)("Qatar"),offset:0},{id:"Asia/Riyadh",title:(0,s.t)("Riyadh"),offset:0},{id:"Asia/Seoul",title:(0,s.t)("Seoul"),offset:0},{id:"Asia/Shanghai",title:(0,s.t)("Shanghai"),offset:0},{id:"Asia/Singapore",title:(0,s.t)("Singapore"),offset:0},{id:"Asia/Taipei",title:(0,s.t)("Taipei"),offset:0},{id:"Asia/Tehran",title:(0,s.t)("Tehran"),offset:0},{id:"Asia/Tokyo",title:(0,s.t)("Tokyo"),offset:0},{id:"Atlantic/Reykjavik",title:(0,s.t)("Reykjavik"),offset:0},{id:"Australia/Adelaide",title:(0,s.t)("Adelaide"),offset:0},{id:"Australia/Brisbane",title:(0,s.t)("Brisbane"),offset:0},{id:"Australia/Perth",title:(0,s.t)("Perth"),offset:0},{id:"Australia/Sydney",title:(0,s.t)("Sydney"),offset:0},{id:"Europe/Amsterdam",title:(0,s.t)("Amsterdam"),offset:0},{id:"Europe/Athens",title:(0,s.t)("Athens"),offset:0},{id:"Europe/Belgrade",title:(0,s.t)("Belgrade"),offset:0},{id:"Europe/Berlin",title:(0,s.t)("Berlin"), offset:0},{id:"Europe/Bratislava",title:(0,s.t)("Bratislava"),offset:0},{id:"Europe/Brussels",title:(0,s.t)("Brussels"),offset:0},{id:"Europe/Bucharest",title:(0,s.t)("Bucharest"),offset:0},{id:"Europe/Copenhagen",title:(0,s.t)("Copenhagen"),offset:0},{id:"Europe/Dublin",title:(0,s.t)("Dublin"),offset:0},{id:"Europe/Helsinki",title:(0,s.t)("Helsinki"),offset:0},{id:"Europe/Istanbul",title:(0,s.t)("Istanbul"),offset:0},{id:"Europe/Lisbon",title:(0,s.t)("Lisbon"),offset:0},{id:"Europe/London",title:(0,s.t)("London"),offset:0},{id:"Europe/Luxembourg",title:(0,s.t)("Luxembourg"),offset:0},{id:"Europe/Madrid",title:(0,s.t)("Madrid"),offset:0},{id:"Europe/Malta",title:(0,s.t)("Malta"),offset:0},{id:"Europe/Moscow",title:(0,s.t)("Moscow"),offset:0},{id:"Europe/Oslo",title:(0,s.t)("Oslo"),offset:0},{id:"Europe/Paris",title:(0,s.t)("Paris"),offset:0},{id:"Europe/Riga",title:(0,s.t)("Riga"),offset:0},{id:"Europe/Rome",title:(0,s.t)("Rome"),offset:0},{id:"Europe/Stockholm",title:(0,s.t)("Stockholm"),offset:0},{id:"Europe/Tallinn",title:(0,s.t)("Tallinn"),offset:0},{id:"Europe/Vilnius",title:(0,s.t)("Vilnius"),offset:0},{id:"Europe/Warsaw",title:(0,s.t)("Warsaw"),offset:0},{id:"Europe/Zurich",title:(0,s.t)("Zurich"),offset:0},{id:"Pacific/Auckland",title:(0,s.t)("New Zealand"),offset:0},{id:"Pacific/Chatham",title:(0,s.t)("Chatham Islands"),offset:0},{id:"Pacific/Fakaofo",title:(0,s.t)("Tokelau"),offset:0},{id:"Pacific/Honolulu",title:(0,s.t)("Honolulu"),offset:0},{id:"Pacific/Norfolk",title:(0,s.t)("Norfolk Island"),offset:0}],a=o.map(({id:e,title:t})=>{const{string:i,offset:s}=(0,r.parseTzOffset)(e);return{id:e,offset:s,title:`(${i}) ${t}`}}).sort((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}),l=n.concat(a);function c(e){for(let t=0;t{"use strict";function s(e){const t={};return{promise:new Promise((i,s)=>{e.subscribe(t,i,!0)}),destroy:()=>{e.unsubscribeAll(t)}}}i.d(t,{delegateToPromise:()=>s})},5729:(e,t,i)=>{"use strict";e=i.nmd(e);const s=i(65447).getLogger("Common.Delegate");function r(){this._listeners=[]}function n(e){return!e.singleshot}r.prototype.subscribe=function(e,t,i){const s={object:e,member:t,singleshot:!!i,skip:!1};this._listeners.push(s)},r.prototype.unsubscribe=function(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}},r.prototype.destroy=function(){delete this._listeners},r.prototype.fire=function(){const e=this._listeners;this._listeners=this._listeners.filter(n);const t=e.length;for(let i=0;i{"use strict";function s(e,t){return e<=t}function r(e,t){return e>=t}function n(e,t,i){return Math.min(Math.max(e,t),i)}function o(e){return e<0?-1:e>0?1:0}function a(e){if(e<0)return!1;for(let t=e;t>1;t/=10)if(t%10!=0)return!1;return!0}function l(e,t,i){return t-e<=i}function c(e,t,i){return Math.abs(e-t)t?1:0}function u(e,t=d){if(e.length<1)throw Error("array is empty");let i=e[0];for(let s=0;s0&&(i=e[s]);return i}function _(e){const t=Math.ceil(e);return t%2!=0?t-1:t}function m(e){return e>0?Math.floor(e):Math.ceil(e)}i.r(t),i.d(t,{lessThan:()=>s,greaterThan:()=>r,clamp:()=>n,sign:()=>o,isBaseDecimal:()=>a,greaterOrEqual:()=>l,equal:()=>c,log10:()=>h,defComparator:()=>d,min:()=>u,max:()=>p,ceiledEven:()=>_,toInt:()=>m})},48729:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>r});var s=i(84540);function r(e,t=Date.now()){const i=(0,s.get_timezone)(e).offset_utc(t);let r="";const n=i/1e3/60/60;n%1&&(r=":"+n%1*60);let o="";return o=n>0?"+"+(n-n%1)+r:0===n?"":String(n-n%1+r),{offset:i,string:"UTC"+o}}},61125:(e,t,i)=>{"use strict";var s=i(27490),r=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],n=function(){var e=[{pattern:"(",ctor:o},{pattern:")",ctor:a},{pattern:"+",ctor:c},{pattern:"-",ctor:h},{pattern:"*",ctor:d},{pattern:"/",ctor:u},{pattern:"^",ctor:p},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:f},{pattern:/\./,ctor:y},{pattern:s.enabled("charting_library_base")?/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!|:.&]*|'.+?'/,ctor:g},{pattern:/'[^']*/,ctor:S},{pattern:/[\0-\x20\s]+/,ctor:n}];function t(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function i(){}function n(e){this.value=e}function o(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}function p(){}i.prototype.toString=function(){return this.value},t(n,i),t(o,i),o.prototype.value="(",t(a,i),a.prototype.value=")",t(l,i),t(c,l),c.prototype.value="+",c.prototype.precedence=0,c.prototype.commutative=!0,t(h,l),h.prototype.value="-",h.prototype.precedence=0,h.prototype.commutative=!1,t(d,l),d.prototype.value="*",d.prototype.precedence=1,d.prototype.commutative=!0,t(u,l),u.prototype.value="/",u.prototype.precedence=1,u.prototype.commutative=!1,t(p,l),p.prototype.value="^",p.prototype.precedence=2, p.prototype.commutative=!1;var _=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,m=/[+\-/*]/;function g(e){this.value=e}function f(e){this.value=e}function v(e){this.value=e}function S(){g.apply(this,arguments)}function y(){f.apply(this,arguments)}t(g,i),g.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=m.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},g.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},g.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return r.some((function(t){return t.t===e}))},t=2;t>=1;--t){var i=this._ticker.slice(0,t);if(e(i)){this._root=i,this._contract=this._ticker.slice(t);break}}},g.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null==e?delete this._exchange:this._exchange=e+""},g.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},g.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},g.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},t(f,i),f.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},f.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},v.prototype.toString=function(){return this.value},t(S,g),S.prototype.isIncomplete=!0,S.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},t(y,f),y.prototype.isIncomplete=!0;var b=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function w(t,i){var s,r=[];e:for(;s=b.exec(t);){for(var o=e.length;o--;)if(s[o+1]){if(e[o].ctor){var a=new e[o].ctor(s[o+1]);a._offset=s.index,r.push(a)}continue e}var l=new v(s[0]);l._offset=s.index,r.push(l)}if(i&&i.recover){var c;for(o=r.length;o--;){var h=r[o];if(h instanceof f||h instanceof g){if(void 0!==c){var d=new g(""),u=r.splice(o,c-o+1,d);d.value=u.map((function(e){return e.value})).join("")}c=o}else h instanceof n||(c=void 0)}}return r}function P(e){for(var t=[],i=0;in.precedence&&(s[s.length-1].minPrecedence=n.precedence);else if(n instanceof o)s.push(t={minPrecedence:1/0,openBraceIndex:r });else if(n instanceof a){var c=e[(t=s.pop()).openBraceIndex-1],h=e[r+1];h instanceof l&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof l)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(r=i.length;r--;)e.splice(i[r],1);return e}function T(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=w(e)).filter((function(e){return e instanceof g})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function x(e){return 1!==(e=T(e)).length?null:e[0]}function I(e,t){return(e=T(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:w,validate:function(e){if(s.enabled("charting_library_base"))return{currentState:"var"};for(var t="init",i={warnings:[],errors:[],isEmpty:!0},r=[],c=0;c{"use strict";i.d(t,{TranslatedString:()=>s});class s{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){return this._originalText}translatedText(){return this._translatedText}format(e){const t={},i={};for(const r of Object.keys(e)){const n=e[r];n instanceof s?(t[r]=n.originalText(),i[r]=n.translatedText()):(t[r]=n.toString(),i[r]=n.toString())}const r=this._originalText.format(t),n=this._translatedText.format(i);return new s(r,n)}}},64837:e=>{e.exports.tzData={"America/New_York":{ time:[-2717668562,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1536530400,-1523224800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-76941e4,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3], offset:[-17762,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Los_Angeles":{ time:[-2717668378,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-769420800,-765410400,-687995940,-662680800,-620866800,-608162400,-589417200,-576108e3,-557967600,-544658400,-526518e3,-513208800,-495068400,-481759200,-463618800,-450309600,-431564400,-418255200,-400114800,-386805600,-368665200,-355356e3,-337215600,-323906400,-305766e3,-292456800,-273711600,-261007200,-242262e3,-226533600,-210812400,-195084e3,-179362800,-163634400,-147913200,-13158e4,-116463600,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-28378,-28800,-25200,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Chicago":{ time:[-2717668236,-1633298400,-1615154400,-1601848800,-1583704800,-1563746400,-1551650400,-1538949600,-1520200800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1067810400,-1045432800,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-769413600,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3], offset:[-21036,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"America/Phoenix":{time:[-2717670498,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-820540740,-812678340,-796867140,-84405600,-68680800,1924966800],offset:[-26898,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"America/Toronto":{ time:[-2366755200,-1632088800,-1615154400,-1601771400,-1583712e3,-1567375200,-1554681600,-1534716e3,-1524088800,-1503266400,-149238e4,-1471816800,-1460930400,-1440972e3,-1428876e3,-1409522400,-1397426400,-1378072800,-1365976800,-1346623200,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1188770400,-1176069600,-1157320800,-1144015200,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-880232400,-76941e4,-765410400,-747266400,-733960800,-715824e3,-702518400,-684374400,-671068800,-652924800,-634176e3,-620863200,-602719200,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3], offset:[-19052,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Vancouver":{ time:[-2713910400,-1632088800,-1615154400,-880236e3,-769420800,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,-368661600,-355356e3,-337212e3,-323906400,-305762400,-292456800,-273708e3,-261007200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3], offset:[-29548,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Argentina/Buenos_Aires":{time:[-2372112e3,-1567468800,-1233446400,-1222992e3,-1205971200,-1194048e3,-117288e4,-1162512e3,-1141344e3,-1130976e3,-1109808e3,-109944e4,-1078272e3,-1067817600,-1046649600,-1036281600,-1015113600,-1004745600,-983577600,-973209600,-952041600,-941587200,-931046400,-900892800,-890352e3,-83376e4,-82728e4,-752284800,-733795200,-197337600,-190857600,-184204800,-164505600,-152668800,-132969600,-121132800,-101433600,-86832e3,-71107200,-54777600,-39052800,-23328e3,-7603200,128131200,136598400,596937600,605059200,624412800,636508800,656467200,667958400,687916800,699408e3,719366400,731462400,938908800,952041600,1198972800,1205625600,1224374400,1237075200,1924981200],offset:[-14028,-15408,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-10800,-10800,-7200,-10800,-7200,-10800]},"America/El_Salvador":{time:[-1546300800,546998400,559699200,578448e3,591148800,1924970400],offset:[-21408,-21600,-18e3,-21600,-18e3,-21600]},"America/Sao_Paulo":{ time:[-1767225600,-1206968400,-1191369600,-1175385600,-1159833600,-633830400,-622076400,-602294400,-59184e4,-570758400,-560217600,-539136e3,-53136e4,-195436800,-184204800,-155174400,-150076800,-128908800,-121132800,-99964800,-89596800,-68428800,-57974400,499737600,511228800,530582400,540259200,562118400,571190400,592963200,602035200,624412800,634694400,656467200,666748800,687916800,697593600,719971200,728438400,750816e3,761702400,782265600,793152e3,813715200,823996800,84456e4,856051200,876096e3,888710400,908064e3,919555200,938908800,951609600,970963200,982454400,1003017600,1013904e3,1036281600,1045353600,1066521600,1076803200,1099353600,1108857600,1129420800,1140307200,1162684800,1172361600,119232e4,1203206400,1224374400,1234656e3,1255824e3,1266710400,1287273600,129816e4,1318723200,1330214400,1350777600,1361059200,1382227200,1392508800,1413676800,1424563200,1445126400,1456012800,1476576e3,1487462400,1508025600,1518912e3,1541289600,1550361600,1924981200],offset:[-11188,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800]},"America/Bogota":{time:[-2707689600,-1739059200,704851200,733881600,1924974e3],offset:[-17776,-17776,-18e3,-14400,-18e3]},"America/Caracas":{time:[-2524521600,-1826755200,-157766400,1197169200,1462069800,1924977600],offset:[-16064,-16060,-16200,-14400,-16200,-14400]},"Europe/Moscow":{time:[-2840140800,-1688256e3,-165681e4,-1641340800,-1627956e3,-1618700400,-1596416400,-1593804521,-1589846400,-1542416400,-1539478800,-1525305600,-1522713600,-1491177600,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1414288800,1925002800], offset:[9017,9017,9079,12679,9079,16279,12679,16279,14400,10800,14400,18e3,14400,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800]},"Europe/Athens":{time:[-2344636800,-1686095940,-1182988800,-1178150400,-906854400,-904867200,-85725e4,-844473600,-828230400,-812419200,-552355200,-541641600,166492800,186195600,198036e3,213764400,228880800,244090800,260330400,275457600,291805200,307418400,323395200,338947200,354682800,370411200,386132400,401860800,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5692,5692,7200,10800,7200,10800,7200,3600,7200,3600,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Belgrade":{ time:[-2713910400,-905821200,-85725e4,-844552800,-828219600,-812498400,-79677e4,-777938400,-766616400,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[4920,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Berlin":{time:[-2422051200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-776556e3,-765925200,-761173200,-748476e3,-733266e3,-717627600,-714603600,-71037e4,-701902800,-684972e3,-670453200,-654127200,-639003600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[3208,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Bratislava":{time:[-3786825600,-2469398400,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-746575200,-733352400,-728514e3,-72126e4,-716421600,-701902800,-684972e3,-670453200,-654213600,-639003600,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3464,3464,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Bucharest":{ time:[-2469398400,-1213142400,-1187049600,-1175468400,-1159747200,-1144018800,-1127692800,-1111964400,-1096243200,-1080514800,-1064793600,-1049065200,-1033344e3,-1017615600,-1001894400,-986166e3,-970444800,-954716400,296611200,307497600,323823600,338950800,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670377600,686106e3,701827200,717555600,733276800,749005200,764726400,780451200,796176e3,811900800,828230400,846374400,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[6264,6264,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/London":{ time:[-3852662400,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-904514400,-896043600,-875484e3,-864594e3,-844034400,-832539600,-812584800,-798066e3,-781048800,-772059600,-764802e3,-748476e3,-733352400,-719445600,-717026400,-706741200,-699483600,-687996e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,-37238400,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800], offset:[-75,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Luxembourg":{time:[-2069712e3,-1692493200,-1680476400,-1662339600,-165015e4,-1632002400,-1618693200,-1612656e3,-1604278800,-1585515600,-1574038800,-1552255200,-1539997200,-1520546400,-1507510800,-1490569200,-1473642e3,-1459116e3,-1444006800,-142767e4,-1411866e3,-1396220400,-1379293200,-1364770800,-1348448400,-1333321200,-1316394e3,-1301266800,-1284339600,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-1191189600,-1175461200,-1160344800,-1143406800,-1127685600,-1111957200,-1096840800,-1080507600,-1063576800,-1049058e3,-1033336800,-1017608400,-1002492e3,-986158800,-969228e3,-950475600,-942012e3,-935182800,-85725e4,-844552800,-828219600,-812498400,-797979600,-781048800,-766616400,-745452e3,-733266e3,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[1476,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Madrid":{time:[-2177453684,-1631926800,-1616886e3,-1601168400,-158535e4,-1442451600,-142767e4,-1379293200,-1364770800,-1348448400,-1333321200,-1316390400,-1301266800,-1284339600,-1269817200,-1026954e3,-1017615600,-1001898e3,-999478800,-986083200,-954111600,-940208400,-873075600,-862614e3,-842835600,-828313200,-811386e3,-796863600,-779936400,-765414e3,-748486800,-733964400,-652323600,-639010800,135126e3,150253200,166575600,181702800,196815600,212547600,22887e4,243997200,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[-884,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Paris":{time:[-2486592e3,-1855958400,-1689814800,-1680393600,-1665363600,-1648339200,-1635123600,-1616889600,-1604278800,-158544e4,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1470618e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1253494800,-1238371200,-1221440400,-1206921600,-1191200400,-1175472e3,-1160355600,-1143417600,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942012e3,-932432400,-85725e4,-844552800,-828219600,-812498400,-800064e3,-796258800,-781048800,-766616400,196822800,212547600,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[561,561,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Rome":{time:[-3252096e3,-2403562204,-1690761600,-168048e4,-1664755200,-1648944e3,-163512e4,-1616889600,-1604275200,-1585526400,-1571011200,-1555286400,-932428800,-85725e4,-844552800,-828219600,-812498400,-798066e3,-781048800,-76671e4,-750895200,-733352400,-719452800,-70191e4,-689205600,-670453200,-114048e3,-103161600,-81993600,-71708400,-50544e3,-40258800,-18489600,-8204400,1296e4,23245200,43804800,54694800,75859200,86749200,107913600,118198800,138758400,149648400,170812800,181098e3,202262400,212547600,233107200,243997200,265161600,276051600,296611200,307501200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[2996,2996,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Warsaw":{time:[-2840140800,-1717027200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1600466400,-1587157200,-1501718400,-931730400,-85725e4,-844552800,-828219600,-812498400,-796600800,-778723200,-762652800,-748483200,-733266e3,-715212e3,-701902800,-684972e3,-670453200,-654127200,-639003600,-397090800,-386805600,-371084400,-355356e3,-334191600,-323301600,-307580400,-291852e3,-271292400,-260402400,-239842800,-228952800,-208393200,-197503200,-176338800,-166053600,228877200,244000800,260326800,276055200,291776400,307504800,323830800,338954400,354675600,370404e3,386125200,401853600,417574800,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[5040,5040,3600,7200,3600,7200,3600,7200,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Istanbul":{time:[-2840140800,-1869868800,-1693699200,-168048e4,-1570406400,-1552176e3,-1538352e3,-1522540800,-1507507200,-1490572800,-1440201600,-1428019200,-1409702400,-1396483200,-931046400,-922665600,-917827200,-892425600,-875836800,-764726400,-744336e3,-733795200,-716428800,-701913600,-684979200,-670464e3,-654134400,-639014400,-62208e4,-60696e4,-590025600,-575510400,-235612800,-194832e3,-177724800,-165715200,107917200,121226400,133927200,152676e3,164685600,184125600,196221600,215575200,228880800,245815200,260330400,267926400,428464800,433908e3,468122400,482806800,496720800,512528400,528256800,543978e3,559706400,575427600,591156e3,606877200,622605600,638326800,65466e4,670381200,686109600,701830800,717559200,733280400,749008800,764125200,780458400,796179600,811908e3,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301281200,1319947200,1332644400,1351396800,1364698800,1382846400,1396234800,1414296e3,1427598e3,1446955200,1459047600,1473206400,1925002800],offset:[6952,7016,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,10800,14400,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,10800]},"Europe/Zurich":{ time:[-3675196800,-2385244800,-904431600,-891122400,-872982e3,-859672800,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2048,1786,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Australia/Sydney":{time:[-2364076800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800], offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Australia/Brisbane":{time:[-2366755200,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,625629600,636519600,657079200,667969200,688528800,699418800,1925028e3],offset:[36728,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3]},"Australia/Adelaide":{time:[-2364076800,-2230156800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,637729200,657079200,667969200,688528800,701233200,719978400,731473200,752032800,764132400,783482400,796186800,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,972784800,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800], offset:[33260,32400,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800]},"Australia/ACT":{time:[-2364076800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Asia/Almaty":{ time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1925013600],offset:[18468,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,21600,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600]},"Asia/Ashkhabad":{time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,192501e4],offset:[14012,14400,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,18e3,14400,18e3]},"Asia/Tokyo":{time:[-2587678861,-683769600,-672274800,-654739200,-640825200,-620265600,-609375600,-588816e3,-577926e3,1925024400],offset:[33539,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400]},"Asia/Taipei":{time:[-2335219200,-1017792e3,-766191600,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-639100800,-620784e3,-607564800,-589248e3,-576028800,-562896e3,-541728e3,-528681600,-510192e3,-497145600,-478656e3,-465609600,-449798400,-433987200,-418176e3,-402451200,-38664e4,-370915200,-355104e3,-339379200,-323568e3,-302486400,-291945600,-270950400,-260409600,134006400,149817600,165542400,181353600,299635200,307584e3,1925020800],offset:[29160,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Singapore":{time:[-2177452800,-2038176e3,-1167609600,-1073001600,-894153600,-879638400,-766972800,378691200,1925020800],offset:[24925,24925,25200,26400,26400,27e3,32400,27e3,28800]},"Asia/Karachi":{time:[-1988150400,-862617600,-764121600,-576115200,38793600,1018137600,1033862400,1212278400,1225497600,1239753600,1257033600,192501e4],offset:[16092,19800,23400,19800,18e3,18e3,21600,18e3,21600,18e3,21600,18e3]},"Asia/Manila":{time:[-3944678400,-2229292800,-1046649600,-1038700800,-873244800,-794188800,-496195200,-489283200,259372800,275184e3,1925020800],offset:[-57360,29040,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Shanghai":{ time:[-2177452800,-1600646400,-1585872e3,-933638400,-922060800,-908841600,-888796800,-881020800,-767836800,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-649987200,515556e3,527047200,545191200,558496800,577245600,589946400,608695200,622000800,640144800,653450400,671594400,6849e5,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Seoul":{time:[-1948752e3,-1830384e3,-767318400,-681177600,-672192e3,-654739200,-640828800,-623376e3,-609379200,-588816e3,-577929600,-498096e3,-462672e3,-451699200,-429753600,-418262400,-399513600,-387417600,-368064e3,-355968e3,-336614400,-324518400,-305164800,-293068800,-264902400,547610400,560919600,57906e4,592369200,1925024400],offset:[30472,30600,32400,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,32400,36e3,32400,36e3,32400]},"Asia/Tehran":{time:[-1704153600,-757382400,247190400,259286400,277776e3,283996800,290822400,306547200,322444800,338515200,673228800,685497600,701222400,71712e4,732758400,748656e3,764294400,780192e3,795830400,811728e3,827366400,843264e3,858988800,874886400,890524800,906422400,922060800,937958400,953596800,969494400,985219200,1001116800,1016755200,1032652800,1048291200,1064188800,1079827200,1095724800,1111449600,1127347200,1206057600,1221955200,123768e4,1253577600,1269216e3,1285113600,1300752e3,1316649600,1332288e3,1348185600,1363910400,1379808e3,1395446400,1411344e3,1426982400,144288e4,1458518400,1474416e3,1490140800,1506038400,1521676800,1537574400,1553212800,1569110400,1584748800,1600646400,1616371200,1632268800,1647907200,1663804800,1679443200,1695340800,1710979200,1726876800,1742601600,1758499200,1774137600,1790035200,1805673600,1821571200,1837209600,1853107200,1868745600,1884643200,1900368e3,1916265600,1931904e3],offset:[12344,12344,12600,14400,18e3,14400,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600]},"Asia/Dubai":{time:[-1577923200,1925006400],offset:[13272,14400]},"Asia/Kolkata":{time:[-3645216e3,-3155673600,-2019686400,-891561600,-872035200,-862617600,-764121600,1925011800],offset:[21208,21200,19270,19800,23400,19800,23400,19800]},"Asia/Hong_Kong":{ time:[-2056663398,-900882e3,-891547200,-884217600,-761176800,-747878400,-728508600,-717021e3,-697059e3,-683757e3,-668028600,-654726600,-636579e3,-623277e3,-605129400,-591827400,-573679800,-559773e3,-541625400,-528323400,-510179400,-498083400,-478729800,-466633800,-446675400,-435184200,-415225800,-403129800,-383776200,-371680200,-352326600,-340230600,-320877e3,-308781e3,-288822600,-277331400,-257373e3,-245881800,-225923400,-213827400,-194473800,-182377800,-163024200,-148509e3,-132784200,-117059400,-101334600,-85609800,-69280200,-53555400,-37830600,-22105800,-6381e3,9343800,25068600,40793400,56518200,72243e3,88572600,104297400,120022200,126070200,151471800,167196600,182921400,198646200,214371e3,295414200,309324600,1925020800],offset:[27402,28800,32400,30600,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Bangkok":{time:[-2840140800,-1570060800,1925017200],offset:[24124,24124,25200]},"Asia/Chongqing":{time:[-2177452800,-1600646400,-1585872e3,-933638400,-922060800,-908841600,-888796800,-881020800,-767836800,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-649987200,515556e3,527047200,545191200,558496800,577245600,589946400,608695200,622000800,640144800,653450400,671594400,6849e5,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Jerusalem":{ time:[-2840140800,-1640995200,-933631200,-923086800,-919029600,-857336400,-844293600,-825800400,-812671200,-794178e3,-779839200,-762642e3,-748303200,-731106e3,-681948e3,-673214400,-667947600,-652312800,-636411600,-622072800,-608936400,-591832800,-572475600,-558568800,-542840400,-527724e3,-514414800,-490831200,-482965200,-459381600,-451515600,-428536800,-418251600,-400111200,-387406800,142387200,150854400,167184e3,178675200,334108800,337741200,452649600,46233e4,482284800,494380800,516758400,526435200,545443200,558489600,576633600,589334400,609897600,620784e3,638323200,651628800,669772800,683683200,701827200,715737600,733708800,747187200,765158400,778032e3,796608e3,810086400,826848e3,842832e3,858902400,874195200,890352e3,90504e4,923018400,936324e3,955677600,970794e3,986778e3,1001293200,1017363600,1033952400,1048813200,1065142800,1081299600,1095814800,1112320800,1128823200,1143770400,1159668e3,117522e4,1189908e3,1206669600,1223172e3,1238119200,1254016800,1269568800,1284256800,1301623200,1317520800,1333072800,1348365600,1364522400,1382839200,1395972e3,1414288800,1427421600,1445738400,1458871200,1477792800,1490320800,1509242400,1521770400,1540692e3,1553824800,1572141600,1585274400,1603591200,1616724e3,1635645600,1648173600,1667095200,1679623200,1698544800,1711677600,1729994400,1743127200,1761444e3,1774576800,1792893600,1806026400,1824948e3,1837476e3,1856397600,1868925600,1887847200,190098e4,1919296800,1932429600],offset:[8454,8440,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,14400,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Asia/Kuwait":{time:[-719625600,1925002800],offset:[11212,10800]},"Asia/Muscat":{time:[-1577923200,1925006400],offset:[13272,14400]},"Asia/Qatar":{time:[-1577923200,76204800,1925002800],offset:[12368,14400,10800]},"Asia/Riyadh":{time:[-719625600,1925002800],offset:[11212,10800]},"Pacific/Auckland":{ time:[-3192393600,-1330293600,-1320012e3,-1300658400,-1287352800,-1269208800,-1255903200,-1237759200,-1224453600,-1206309600,-1192399200,-117486e4,-1160949600,-1143410400,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-757382400,152676e3,162356400,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,510116400,530676e3,541566e3,562125600,573620400,59418e4,60507e4,623815200,637729200,655264800,669178800,686714400,700628400,718164e3,732682800,749613600,764132400,781063200,795582e3,812512800,827031600,844567200,858481200,876016800,889930800,907466400,921985200,938916e3,953434800,970365600,984884400,100242e4,1016334e3,1033869600,1047783600,1065319200,1079838e3,1096768800,1111287600,1128218400,1142737200,1159668e3,1174186800,1191117600,1207450800,1222567200,1238900400,1254016800,127035e4,1285466400,1301799600,1316916e3,1333249200,1348970400,1365303600,138042e4,1396753200,1411869600,1428202800,1443319200,1459652400,1474768800,1491102e3,1506218400,1522551600,1538272800,1554606e3,1569722400,1586055600,1601172e3,1617505200,1632621600,1648954800,1664071200,1680404400,1695520800,1712458800,1727575200,1743908400,1759024800,1775358e3,1790474400,1806807600,1821924e3,1838257200,1853373600,1869706800,1885428e3,1901761200,1916877600,1933210800],offset:[41944,41400,45e3,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800]},"Pacific/Chatham":{ time:[-3192393600,-757382400,152678700,162359100,183523500,195018300,215577900,226467900,247027500,257917500,278477100,289367100,309926700,320816700,341376300,352266300,372825900,384320700,404880300,415770300,436329900,447219900,467779500,478669500,499229100,510119100,530678700,541568700,562128300,573623100,594182700,605072700,623817900,637731900,655267500,669181500,686717100,700631100,718166700,732685500,749616300,764135100,781065900,795584700,812515500,827034300,844569900,858483900,876019500,889933500,907469100,921987900,938918700,953437500,970368300,984887100,1002422700,1016336700,1033872300,1047786300,1065321900,1079840700,1096771500,1111290300,1128221100,1142739900,1159670700,1174189500,1191120300,1207453500,1222569900,1238903100,1254019500,1270352700,1285469100,1301802300,1316918700,1333251900,1348973100,1365306300,1380422700,1396755900,1411872300,1428205500,1443321900,1459655100,1474771500,1491104700,1506221100,1522554300,1538275500,1554608700,1569725100,1586058300,1601174700,1617507900,1632624300,1648957500,1664073900,1680407100,1695523500,1712461500,1727577900,1743911100,1759027500,1775360700,1790477100,1806810300,1821926700,1838259900,1853376300,1869709500,1885430700,1901763900,1916880300,1933213500],offset:[44028,44100,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500]},"Pacific/Fakaofo":{time:[-2177452800,1325203200,1925038800],offset:[-41096,-39600,46800]},"Pacific/Honolulu":{time:[-2334139200,-1157320800,-1155470400,-880236e3,-769429800,-765410400,-712188e3,1924956e3],offset:[-37886,-37800,-34200,-37800,-34200,-34200,-37800,-36e3]},"America/Mexico_City":{ time:[-1514763396,-1343091600,-1234828800,-1220317200,-1207180800,-1191369600,-975283200,-963187200,-917136e3,-907372800,-821923200,-810086400,-627523200,-613008e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,989114400,1001815200,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1175392800,1193536800,1207447200,1224986400,1238896800,1256436e3,1270346400,1288490400,1301796e3,131994e4,1333245600,1351389600,13653e5,1382839200,1396749600,1414288800,1428199200,1445738400,1459648800,1477792800,1491098400,1509242400,1522548e3,1540692e3,1554602400,1572141600,1586052e3,1603591200,1617501600,1635645600,1648951200,1667095200,1680400800,1698544800,1712455200,1729994400,1743904800,1761444e3,1775354400,1792893600,1806804e3,1824948e3,1838253600,1856397600,1869703200,1887847200,1901757600,1919296800,1933207200],offset:[-23796,-25200,-21600,-25200,-21600,-25200,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"Africa/Cairo":{time:[-2185401600,-929836800,-923097600,-906163200,-892857600,-875836800,-857779200,-844300800,-825811200,-812678400,-794188800,-779846400,-762652800,-399081600,-38664e4,-368323200,-355104e3,-336783600,-323643600,-305161200,-292021200,-273625200,-260485200,-242089200,-228949200,-210553200,-197413200,-178930800,-165790800,-147394800,-134254800,-115858800,-102632400,-84322800,-71096400,-52700400,-39474e3,-21164400,-7938e3,10371600,23598e3,41907600,55134e3,7353e4,86756400,105066e3,118292400,136602e3,149828400,168138e3,181364400,199760400,212986800,231296400,244522800,262832400,276058800,294368400,307594800,325990800,339217200,357526800,370753200,396406800,402289200,426819600,433825200,452221200,465447600,483757200,496983600,515293200,528519600,546829200,560055600,578451600,591678e3,610419600,623214e3,641523600,65475e4,673059600,686286e3,704682e3,717908400,736218e3,749444400,767754e3,780980400,799027200,812332800,830476800,843782400,861926400,875232e3,893376e3,906681600,925430400,938736e3,95688e4,970185600,988329600,1001635200,1019779200,1033084800,1051228800,1064534400,1083283200,1096588800,1114732800,1128038400,1146182400,1158883200,1177632e3,1189123200,1209081600,1219968e3,1240531200,1250812800,1272585600,1281484800,1284076800,1285891200,1400198400,1403827200,1406851200,1411689600,1924999200], offset:[7509,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Africa/Johannesburg":{time:[-2458166400,-2109283200,-860968800,-845244e3,-829519200,-813794400,1924999200],offset:[6720,5400,7200,10800,7200,10800,7200]},"Asia/Kathmandu":{time:[-1577923200,504921600,1925012700],offset:[20476,19800,20700]},"US/Mountain":{time:[-2717668796,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1538949600,-1534111200,-880236e3,-769417200,-765410400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3], offset:[-25196,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"Europe/Helsinki":{time:[-2890252800,-1535932800,-875664e3,-859762800,354679200,370407600,386128800,401857200,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5989,5989,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Stockholm":{ time:[-2871676800,-2208988800,-1692493200,-1680476400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[4332,3614,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Copenhagen":{time:[-2524521600,-2398291200,-1692493200,-1680483600,-935107200,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-769381200,-747007200,-736376400,-715212e3,-706741200,-683157600,-675291600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400], offset:[3020,3020,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Atlantic/Reykjavik":{time:[-1956614400,-1668214800,-1647212400,-1636678800,-161343e4,-1605142800,-1581894e3,-1539565200,-153135e4,-968029200,-952293600,-942012e3,-920239200,-909961200,-888789600,-877906800,-857944800,-846457200,-826495200,-815007600,-795045600,-783558e3,-762991200,-752108400,-731541600,-717634800,-700092e3,-686185200,-668642400,-654735600,-636588e3,-623286e3,-605743200,-591836400,-573688800,-559782e3,-542239200,-528332400,-510789600,-496882800,-47934e4,-465433200,-447890400,-433983600,-415836e3,-401929200,-384386400,-370479600,-352936800,-33903e4,-321487200,-307580400,-290037600,-276130800,-258588e3,-244681200,-226533600,-212626800,-195084e3,-181177200,-163634400,-149727600,-132184800,-118278e3,-100735200,-86828400,-68680800,-54774e3,1924992e3],offset:[-5280,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0]},"Europe/Tallinn":{time:[-2840140800,-1638316800,-1632002400,-1618693200,-1593820800,-1535932800,-927936e3,-892944e3,-85725e4,-844552800,-828219600,-812498400,-797644800,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909288e3,92259e4,941342400,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3], offset:[5940,5940,3600,7200,3600,5940,7200,10800,7200,3600,7200,3600,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Riga":{time:[-2840140800,-1632002400,-1618693200,-1601676e3,-1597266e3,-1377302400,-928022400,-899510400,-85725e4,-844552800,-828219600,-812498400,-79677e4,-795830400,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,843966e3,859690800,877838400,891140400,909288e3,92259e4,941342400,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5794,5794,9394,5794,9394,5794,7200,10800,7200,3600,7200,3600,7200,3600,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Vilnius":{ time:[-2840140800,-1672531200,-1585094400,-1561248e3,-1553558400,-928195200,-900115200,-85725e4,-844552800,-828219600,-812498400,-802137600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891140400,909284400,922586400,941338800,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[6076,5040,5736,3600,7200,3600,10800,7200,3600,7200,3600,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,7200,3600,7200,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"America/Lima":{time:[-2524521600,-1938556800,-1009843200,-1002067200,-986774400,-971049600,-955324800,-9396e5,504921600,512697600,536457600,544233600,631152e3,638928e3,757382400,765158400,1924974e3],offset:[-18492,-18516,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Santiago":{ time:[-2524521600,-1892678400,-1688428800,-1619222400,-1593820800,-1336003200,-13176e5,-1304380800,-1286064e3,-1272844800,-1254528e3,-1241308800,-1222992e3,-1209772800,-1191369600,-1178150400,-870566400,-865296e3,-740534400,-736387200,-718070400,-713667600,-36633600,-23932800,-3369600,7516800,24451200,37756800,55900800,69206400,87955200,100656e3,118195200,132105600,150854400,163555200,182304e3,195609600,213753600,227059200,245203200,258508800,277257600,289958400,308707200,321408e3,340156800,353462400,371606400,384912e3,403056e3,416361600,434505600,447811200,46656e4,479260800,498009600,510710400,529459200,545184e3,560908800,574214400,592358400,605664e3,624412800,637113600,653443200,668563200,687312e3,700617600,718761600,732067200,750211200,763516800,781660800,794966400,813715200,826416e3,845164800,85968e4,876614400,88992e4,906854400,923184e3,939513600,952819200,971568e3,984268800,1003017600,1015718400,1034467200,1047168e3,1065916800,1079222400,1097366400,1110672e3,1128816e3,1142121600,1160870400,1173571200,119232e4,1206835200,1223769600,1237075200,1255219200,1270339200,1286668800,1304812800,1313884800,1335657600,1346544e3,1367107200,1378598400,1398556800,1410048e3,1463270400,1471132800,149472e4,1502582400,1526169600,1534032e3,1554595200,1567900800,1586044800,1599350400,1617494400,16308e5,1648944e3,1662249600,1680393600,1693699200,1712448e3,1725753600,1743897600,1757203200,1775347200,1788652800,1806796800,1820102400,1838246400,1851552e3,1870300800,1883001600,1901750400,1915056e3,19332e5],offset:[-16966,-16966,-18e3,-16966,-14400,-16966,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-10800,-14400,-18e3,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800]},"Asia/Bahrain":{time:[-1577923200,76204800,1925002800],offset:[12368,14400,10800]},"Asia/Jakarta":{time:[-3231273600,-1451693568,-117288e4,-876614400,-766022400,-683856e3,-620784e3,-189388800,1925017200],offset:[25632,25632,26400,27e3,32400,27e3,28800,27e3,25200]},"Africa/Lagos":{time:[-2035584e3,-1940889600,-1767225600,-1588464e3,1924995600],offset:[815,0,815,1800,3600]},"Pacific/Norfolk":{ time:[-2177452800,-599616e3,152071200,162961200,1443924e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[40312,40320,41400,45e3,41400,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200]},"America/Juneau":{time:[-3225169588,-2188987200,-880236e3,-769420800,-765410400,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,438998400,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[54139,-32261,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-32400,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400]},"Asia/Ho_Chi_Minh":{time:[-2004048e3,-1851552e3,-852080400,-782614800,-767836800,-718070400,-457747200,-315622800,171849600,1925017200],offset:[25600,25590,25200,28800,32400,25200,28800,25200,28800,25200]},"Australia/Perth":{ time:[-2337897600,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,152071200,162961200,436327200,447217200,690343200,699418800,1165111200,1174791600,1193536800,1206846e3,1224986400,1238295600,1925020800],offset:[27804,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Europe/Malta":{time:[-2403475200,-1690761600,-168048e4,-1664755200,-1648944e3,-163512e4,-1616889600,-1604275200,-1585526400,-1571011200,-1555286400,-932428800,-85725e4,-844552800,-828219600,-812584800,-798066e3,-781048800,-76671e4,-750895200,-733352400,-719452800,-70191e4,-689205600,-670453200,-114048e3,-103161600,-81993600,-71708400,-50544e3,-40258800,-18489600,-8204400,1296e4,23245200,43804800,54694800,75859200,86749200,102384e3,118112400,135734400,148525200,167191200,180496800,198640800,211946400,230090400,243396e3,26154e4,274845600,292989600,306295200,323316e3,338349600,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3484,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Amsterdam":{ time:[-4260211200,-1693699200,-168048e4,-1663452e3,-1650142800,-1633212e3,-1617483600,-1601157600,-1586034e3,-1569708e3,-1554584400,-1538258400,-1523134800,-15075e5,-1490562e3,-1470175200,-1459112400,-1443996e3,-1427662800,-1406671200,-1396213200,-1376949600,-1364763600,-1345413600,-1333314e3,-1313791200,-1301259600,-1282255200,-126981e4,-1250719200,-1238360400,-1219183200,-1206910800,-1186956e3,-1175461200,-1156024800,-1143406800,-1124488800,-1111957200,-1092952800,-1080507600,-1061330400,-1049058e3,-1029189600,-1025740800,-1017608400,-998258400,-986158800,-966722400,-954104400,-935020800,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-766616400,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[1172,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,4800,1200,4800,1200,4800,1200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Brussels":{ time:[-2840140800,-2450994150,-1740355200,-1693699200,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1613822400,-1604278800,-1585526400,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1473642e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-1191189600,-1175461200,-1160344800,-1143406800,-1127685600,-1111957200,-1096840800,-1080507600,-1063576800,-1049058e3,-1033336800,-1017608400,-1002492e3,-986158800,-969228e3,-950475600,-942012e3,-934664400,-85725e4,-844552800,-828219600,-812498400,-798066e3,-781048800,-766616400,-745452e3,-733266e3,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[1050,1050,0,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Lisbon":{ time:[-1830386205,-1689555600,-1677798e3,-1667437200,-1647734400,-1635814800,-1616198400,-1604365200,-1584662400,-1572742800,-155304e4,-1541206800,-1521504e3,-1442451600,-1426809600,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1221440400,-1206921600,-1191200400,-1175472e3,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942022800,-922665600,-906944400,-891129600,-877309200,-873680400,-864e6,-857952e3,-845859600,-842835600,-831340800,-825897600,-81441e4,-810781200,-799891200,-794448e3,-782960400,-779331600,-768441600,-762998400,-749091600,-733363200,-717631200,-701902800,-686181600,-670453200,-654732e3,-639003600,-623282400,-607554e3,-591832800,-575499600,-559778400,-54405e4,-528328800,-512600400,-496879200,-481150800,-465429600,-449701200,-43398e4,-417646800,-401925600,-386197200,-370476e3,-354747600,-339026400,-323298e3,-307576800,-291848400,-276127200,-260398800,-244677600,-228344400,-212623200,-196894800,-181173600,-165445200,-149724e3,-133995600,-118274400,212547600,228268800,243997200,260323200,276051600,291772800,307504800,323222400,338954400,354675600,370404e3,386125200,401853600,417578400,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575427600,591156e3,606877200,622605600,638326800,65466e4,670381200,686109600,701830800,717559200,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-2205,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,7200,3600,7200,3600,7200,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Dublin":{ time:[-2821651200,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-733352400,-719445600,-699483600,-684972e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-1500,-1521,2079,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Oslo":{ time:[-2366755200,-1691881200,-1680566400,-927507600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-340840800,-324507600,-308786400,-293058e3,-277336800,-261608400,-245887200,-230158800,-214437600,-198709200,-182988e3,-166654800,-147909600,-135205200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2580,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]}}},36054:(e,t,i)=>{"use strict";i.d(t,{Version:()=>r});var s=i(16282);class r{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof r)return new r(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new r(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new r(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0, s.assert)(!isNaN(n),"Bad version string: "+e),new r(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}r.ZERO=new r(0,0)},78556:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>a});var s=i(32856),r=i.n(s),n=i(47903);function o(e,t){return(0,n.deepEquals)(e,t)[0]}class a extends(r()){constructor(e,t=o){super(e),this._comparator=t}setValue(e,t){!1===this._comparator(this.value(),e)&&super.setValue(e,t)}}},32856:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(65447).getLogger("Common.WatchedValue");function r(){}function n(e){if(!(this instanceof n))return new n(e);arguments.length>0&&(this._value=e),this._listeners=[]}n.prototype.value=function(){return this._owner?this._owner._value:this._value},n.prototype.setValue=function(e,t){var i=this._owner?this._owner:this;if("function"==typeof i.hook&&(e=i.hook(e)),i.writeLock)return i._value;var r=i._value===e||Number.isNaN(i._value)&&Number.isNaN(e);if(!t&&r&&i.hasOwnProperty("_value"))return e;i._value=e;for(var n=i._listeners.slice(),o=0,a=0;a{"use strict";i.d(t,{TOOLBAR_WIDTH_EXPANDED:()=>s,TOOLBAR_WIDTH_COLLAPSED:()=>r});const s=52,r=5},1940:(e,t,i)=>{"use strict";i.d(t,{DrawingToolbarBootloader:()=>a});var s=i(90096),r=i(31911),n=i(26134),o=i(6369);class a extends n.ChunkLoader{constructor(e){super(),this._opts=e,s.isDrawingToolbarVisible.value()&&(this._opts.resizerBridge.negotiateWidth(r.TOOLBAR_WIDTH_EXPANDED),this._opts.resizerBridge.container.value().appendChild((0,o.createStubElem)()))}_startLoading(){return Promise.all([i.e(3876),i.e(7610),i.e(9448),i.e(3894),i.e(2359),i.e(6473),i.e(1941),i.e(4336),i.e(6062),i.e(5514),i.e(306),i.e(4940),i.e(1529),i.e(5383),i.e(1890),i.e(5254),i.e(3463),i.e(2878)]).then(i.bind(i,23788)).then(e=>new e.DrawingToolbarRenderer(this._opts.resizerBridge.container.value(),{...this._opts}))}}},90096:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>c});var s=i(64222),r=i(27490),n=i(32856),o=i.n(n);const a=!r.enabled("hide_left_toolbar_by_default"),l=s.getBool("ChartDrawingToolbarWidget.visible",a),c=new(o())(l)},64457:(e,t,i)=>{"use strict";i.d(t,{HeaderToolbarBootloader:()=>o});var s=i(6535),r=i(6369),n=i(26134);class o extends n.ChunkLoader{constructor(e,t){super(),this._toolsBootloader=e,this._headerProps=t,this._headerProps.resizerBridge.negotiateHeight(s.HEADER_TOOLBAR_HEIGHT_EXPANDED),this._headerProps.resizerBridge.container.value().appendChild((0,r.createStubElem)())}_startLoading(){return Promise.all([this._toolsBootloader.load(),this._loadHeaderToolbar()]).then(([e,t])=>new t(this._headerProps.resizerBridge.container.value(),{...this._headerProps,tools:e}))}_loadHeaderToolbar(){return Promise.all([i.e(587),i.e(9354),i.e(5514),i.e(1529),i.e(5383),i.e(2444),i.e(3005)]).then(i.bind(i,48186)).then(e=>e.HeaderToolbarRenderer)}}},6535:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>r,HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n});var s=i(53805);const r=parseInt(s["css-value-header-toolbar-height"]),n=3},215:(e,t,i)=>{"use strict";i.d(t,{RestrictedToolsetBootloader:()=>r});var s=i(26134);class r extends s.ChunkLoader{_startLoading(){return Promise.all([i.e(3876),i.e(7610),i.e(9448),i.e(3894),i.e(3996),i.e(7936),i.e(8604),i.e(2359),i.e(2273),i.e(6473),i.e(9843),i.e(6637),i.e(6612),i.e(3537),i.e(7757),i.e(4336),i.e(1413),i.e(5514),i.e(306),i.e(4940),i.e(1529),i.e(5383),i.e(7962),i.e(3463),i.e(5516)]).then(i.bind(i,40916)).then(e=>e.getRestrictedToolSet())}}},62685:(e,t,i)=>{"use strict";i.d(t,{FavoriteStudyTemplateService:()=>r});var s=i(24261);class r extends s.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_STUDY_TEMPLATES_CHANGED","StudyTemplates.quicks",[])}remove(e){this.set(this.get().filter(t=>t!==e))}}},3306:(e,t,i)=>{"use strict";i.d(t,{DropdownApi:()=>s});class s{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){ this._headerToolbar.removeDropdown(this._dropdownId)}}},34449:(e,t,i)=>{"use strict";var s;i.d(t,{ACTION_ID:()=>s}),function(e){e.TVActionId="TVActionId",e.ChartApplyIndicatorsToAllCharts="Chart.ApplyIndicatorsToAllCharts",e.ChartChangeTimeZone="Chart.ChangeTimeZone",e.ChartDialogsShowChangeInterval="Chart.Dialogs.ShowChangeInterval",e.ChartDialogsShowChangeSymbol="Chart.Dialogs.ShowChangeSymbol",e.ChartDialogsShowCompareOrAddSymbol="Chart.Dialogs.ShowCompareOrAddSymbol",e.ChartDialogsShowGeneralSettings="Chart.Dialogs.ShowGeneralSettings",e.ChartDialogsShowGeneralSettingsScalesTab="Chart.Dialogs.ShowGeneralSettings.ScalesTab",e.ChartDialogsShowGeneralSettingsSymbolTab="Chart.Dialogs.ShowGeneralSettings.SymbolTab",e.ChartDialogsShowGoToDate="Chart.Dialogs.ShowGoToDate",e.ChartDialogsShowInsertIndicators="Chart.Dialogs.ShowInsertIndicators",e.ChartDialogsShowSymbolInfo="Chart.Dialogs.ShowSymbolInfo",e.ChartDrawingToolbarToggleVisibility="Chart.DrawingToolbar.ToggleVisibility",e.ChartLinesToggleBidAskLinesVisibility="Chart.Lines.ToggleBidAskLinesVisibility",e.ChartLinesToggleHighLowLinesVisibility="Chart.Lines.ToggleHighLowLinesVisibility",e.ChartLinesToggleSeriesPrevCloseLineVisibility="Chart.Lines.ToggleSeriesPrevCloseLineVisibility",e.ChartLinesToggleSeriesPriceLineVisibility="Chart.Lines.ToggleSeriesPriceLineVisibility",e.ChartLineToolPitchforkChangeTypeToInside="Chart.LineTool.Pitchfork.ChangeTypeToInside",e.ChartLineToolPitchforkChangeTypeToModifiedSchiff="Chart.LineTool.Pitchfork.ChangeTypeToModifiedSchiff",e.ChartLineToolPitchforkChangeTypeToOriginal="Chart.LineTool.Pitchfork.ChangeTypeToOriginal",e.ChartLineToolPitchforkChangeTypeToSchiff="Chart.LineTool.Pitchfork.ChangeTypeToSchiff",e.ChartMarksToggleVisibility="Chart.Marks.ToggleVisibility",e.ChartMoveChartInLayout="Chart.MoveChartInLayout",e.ChartMoveChartInLayoutBack="Chart.MoveChartInLayout.Back",e.ChartMoveChartInLayoutForward="Chart.MoveChartInLayout.Forward",e.ChartObjectTreeShow="Chart.ObjectTree.Show",e.ChartPriceScaleLabelsToggleBidAskLabelsVisibility="Chart.PriceScale.Labels.ToggleBidAskLabelsVisibility",e.ChartPriceScaleLabelsToggleHighLowPriceLabelsVisibility="Chart.PriceScale.Labels.ToggleHighLowPriceLabelsVisibility",e.ChartPriceScaleLabelsToggleIndicatorsNameLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsNameLabelsVisibility",e.ChartPriceScaleLabelsToggleIndicatorsValueLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsValueLabelsVisibility",e.ChartPriceScaleLabelsToggleSeriesLastValueVisibility="Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",e.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility="Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",e.ChartPriceScaleLabelsToggleSymbolPrevCloseValueVisibility="Chart.PriceScale.Labels.ToggleSymbolPrevCloseValueVisibility",e.ChartPriceScaleMergeAllScalesToLeft="Chart.PriceScale.MergeAllScalesToLeft",e.ChartPriceScaleMergeAllScalesToRight="Chart.PriceScale.MergeAllScalesToRight",e.ChartPriceScaleMoveToLeft="Chart.PriceScale.MoveToLeft", e.ChartPriceScaleMoveToRight="Chart.PriceScale.MoveToRight",e.ChartPriceScaleToggleAddOrderPlusButtonVisibility="Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",e.ChartPriceScaleToggleAutoScaleSeriesOnly="Chart.PriceScale.ToggleAutoScaleSeriesOnly",e.ChartPriceScaleToggleCountdownToBarCloseVisibility="Chart.PriceScale.ToggleCountdownToBarCloseVisibility",e.ChartPriceScaleToggleCurrencyVisibility="Chart.PriceScale.ToggleCurrencyVisibility",e.ChartPriceScaleToggleUnitVisibility="Chart.PriceScale.ToggleUnitVisibility",e.ChartRedo="Chart.Redo",e.ChartRemoveAllIndicators="Chart.RemoveAllIndicators",e.ChartRemoveAllIndicatorsAndLineTools="Chart.RemoveAllIndicatorsAndLineTools",e.ChartRemoveAllLineTools="Chart.RemoveAllLineTools",e.ChartScalesReset="Chart.Scales.Reset",e.ChartScalesToggleLockPriceToBarRatio="Chart.Scales.ToggleLockPriceToBarRatio",e.ChartSelectedObjectHide="Chart.SelectedObject.Hide",e.ChartSelectedObjectRemove="Chart.SelectedObject.Remove",e.ChartSelectedObjectShowSettingsDialog="Chart.SelectedObject.ShowSettingsDialog",e.ChartSelectedObjectToggleLocked="Chart.SelectedObject.ToggleLocked",e.ChartSeriesPriceScaleToggleAutoScale="Chart.Series.PriceScale.ToggleAutoScale",e.ChartSeriesPriceScaleToggleIndexedTo100="Chart.Series.PriceScale.ToggleIndexedTo100",e.ChartSeriesPriceScaleToggleInvertPriceScale="Chart.Series.PriceScale.ToggleInvertPriceScale",e.ChartSeriesPriceScaleToggleLogarithmic="Chart.Series.PriceScale.ToggleLogarithmic",e.ChartSeriesPriceScaleTogglePercentage="Chart.Series.PriceScale.TogglePercentage",e.ChartSeriesPriceScaleToggleRegular="Chart.Series.PriceScale.ToggleRegular",e.ChartSessionBreaksToggleVisibility="Chart.SessionBreaks.ToggleVisibility",e.ChartTimeScaleReset="Chart.TimeScale.Reset",e.ChartUndo="Chart.Undo"}(s||(s={}))},46374:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Action:()=>l,ActionAsync:()=>c,Separator:()=>h,Loader:()=>d});var s=i(16282),r=i(5729),n=i.n(r),o=i(42998),a=i(45259);class l{constructor(e,t=a.guid()){this.type="action",this._destroyed=!1,this._binding=null,(0,s.assert)(void 0!==e.actionId,"actionId must be defined"),this.id=t,this._onUpdate=new(n()),this._options=e,this.update(e)}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){return this._options.label||""}getSubItems(){return this._options.subItems||[]}isDisabled(){return!0===this._options.disabled}isActive(){return!0===this._options.active}isCheckable(){return!0===this._options.checkable}isChecked(){return!0===this._options.checked}isLoading(){return!0===this._options.loading}getSize(){var e;return null!==(e=this._options.size)&&void 0!==e?e:"normal"}getPayload(){return this._options.payload}update(e){this._destroyed||(this._unbindShortcut(),e.hotkeyHash&&(this._options.shortcutHint=(0,o.humanReadableHash)(e.hotkeyHash)),this._options=Object.assign(this._options,e),this._bindShortcut(),this._onUpdate.fire(this))}onUpdate(){return this._onUpdate}getState(){return{actionId:this._options.actionId,label:this.getLabel(), disabled:this.isDisabled(),active:this.isActive(),subItems:this.getSubItems(),checkable:this.isCheckable(),checked:this.isChecked(),loading:this.isLoading(),size:this.getSize(),doNotCloseOnClick:this._options.doNotCloseOnClick||!1,shortcutHint:this._options.shortcutHint,hint:this._options.hint,icon:this._options.icon,iconChecked:this._options.iconChecked,toolbox:this._options.toolbox,showToolboxOnHover:this._options.showToolboxOnHover||!1,statName:this._options.statName,name:this._options.name,invisibleHotkey:this._options.invisibleHotkey,noInteractive:this._options.noInteractive}}getBinding(){return this._binding}setBinding(e){this._binding=e}destroy(){var e,t;this._destroyed=!0,this._onUpdate.destroy(),null!==this._binding&&this._binding.destroy(),this._unbindShortcut(),null===(t=(e=this._options).onDestroy)||void 0===t||t.call(e)}options(){return this._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;const e="string"==typeof this._options.label?this._options.label:this._options.name;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash,desc:e,handler:()=>this.execute(),isDisabled:()=>this.isDisabled()})}_unbindShortcut(){this._hotkeyAction&&(this._hotkeyAction.destroy(),delete this._hotkeyAction)}}class c extends l{constructor(e,t,i){super({actionId:e},i),this._loader=t,this._loaded=!1}loadOptions(){return this._loadingPromise||(this._loadingPromise=this._loader().then(e=>{this._loaded=!0,this.update(e)})),this._loadingPromise}getState(){return this.loadOptions(),super.getState()}isLoading(){return!this.isLoaded()}isLoaded(){return this._loaded}}class h{constructor(e){this.type="separator",this.id=a.guid(),this._hint=e}getHint(){return this._hint}}class d extends l{constructor(e){super({actionId:e})}isLoading(){return!0}getSize(){return"big"}}},21209:(e,t,i)=>{"use strict";i.d(t,{defaultContextMenuOptions:()=>Le,createMTPredictorActions:()=>Ae,createLinesAction:()=>ke,createSyncDrawingActions:()=>Ee,ActionsProvider:()=>De});var s=i(16282),r=i(65447),n=(i(93302),i(47903)),o=i(27490),a=i(46374),l=i(28745),c=i(20509),h=i(17e3),d=(i(89366),i(58891)),u=i(98824),p=i(42998),_=(i(17722),i(33508)),m=i(32643),g=i(41543),f=i(95316),v=i(67945),S=i(58007),y=i(22675),b=i(79881),w=i(90963),P=i(15521);(0,r.getLogger)("Chart.ActionsProvider");const C=new w.TranslatedString("show alert label lines",(0,b.t)("show alert label lines")),T=new w.TranslatedString("hide alert label lines",(0,b.t)("hide alert label lines")),x=new w.TranslatedString("change visibility",(0,b.t)("change visibility")),I=new w.TranslatedString("pin to scale {label}",(0,b.t)("pin to scale {label}")),M=new w.TranslatedString("pin to right scale",(0,b.t)("pin to right scale")),L=new w.TranslatedString("pin to left scale",(0,b.t)("pin to left scale")),A=(new w.TranslatedString("change earnings visibility",(0,b.t)("change earnings visibility")),new w.TranslatedString("change dividends visibility",(0,b.t)("change dividends visibility")),new w.TranslatedString("change splits visibility",(0, b.t)("change splits visibility")),new w.TranslatedString("show all ideas",(0,b.t)("show all ideas"))),k=new w.TranslatedString("show ideas of followed users",(0,b.t)("show ideas of followed users")),E=new w.TranslatedString("show my ideas only",(0,b.t)("show my ideas only")),D=(new w.TranslatedString("change events visibility on chart",(0,b.t)("change events visibility on chart")),new w.TranslatedString("add this symbol to entire layout",(0,b.t)("add this symbol to entire layout"))),V=new w.TranslatedString("add this indicator to entire layout",(0,b.t)("add this indicator to entire layout")),B=(new w.TranslatedString("add this strategy to entire layout",(0,b.t)("add this strategy to entire layout")),new w.TranslatedString("add this financial metric to entire layout",(0,b.t)("add this financial metric to entire layout")),new w.TranslatedString("apply drawing template",(0,b.t)("apply drawing template")),new w.TranslatedString("lock objects",(0,b.t)("lock objects"))),N=new w.TranslatedString("unlock objects",(0,b.t)("unlock objects")),R=((0,b.t)("Add alert"),(0,b.t)("Add alert on {series}"),(0,b.t)("Add alert on {drawing}"),(0,y.appendEllipsis)((0,b.t)("Edit {title} alert"))),O=(0,b.t)("Extend alert lines"),F=((0,b.t)("Trade"),(0,y.appendEllipsis)((0,b.t)("Create limit order")),(0,b.t)("Show")),W=(0,b.t)("Hide"),H=((0,b.t)("MTPredictor"),(0,b.t)("Apply Manual Risk/Reward"),(0,b.t)("Apply Manual Decision Point"),(0,b.t)("Analyze Trade Setup"),(0,b.t)("Apply Elliott Wave"),(0,b.t)("Apply Elliott Wave Intermediate"),(0,b.t)("Apply Elliott Wave Major"),(0,b.t)("Apply Elliott Wave Minor"),(0,b.t)("Apply WPT Up Wave"),(0,b.t)("Up Wave 1 or A"),(0,b.t)("Up Wave 2 or B"),(0,b.t)("Up Wave C"),(0,b.t)("Up Wave 3"),(0,b.t)("Up Wave 4"),(0,b.t)("Up Wave 5"),(0,b.t)("Apply WPT Down Wave"),(0,b.t)("Down Wave 1 or A"),(0,b.t)("Down Wave 2 or B"),(0,b.t)("Down Wave C"),(0,b.t)("Down Wave 3"),(0,b.t)("Down Wave 4"),(0,b.t)("Down Wave 5"),(0,b.t)("Pinned to scale {label} (hidden)")),z=(0,b.t)("Pinned to right scale (hidden)"),U=(0,b.t)("Pin to scale {label} (hidden)"),j=(0,b.t)("Pin to right scale (hidden)"),G=(0,b.t)("Pinned to scale {label}"),q=(0,b.t)("Pinned to right scale"),Y=(0,b.t)("Pin to scale {label}"),$=(0,b.t)("Pin to right scale"),K=(0,b.t)("Pinned to left scale (hidden)"),X=(0,b.t)("Pin to left scale (hidden)"),Z=(0,b.t)("Pinned to left scale"),J=(0,b.t)("Pin to left scale"),Q=(0,b.t)("Pin to new left scale"),ee=(0,b.t)("Pin to new right scale"),te=(0,b.t)("Pin to scale (now {label})"),ie=(0,b.t)("Pin to scale (now no scale)"),se=(0,b.t)("Pin to scale (now left)"),re=(0,b.t)("Pin to scale (now right)"),ne=(0,b.t)("No scale (fullscreen)"),oe=(0,b.t)("Move to"),ae=(0,b.t)("Existing pane above"),le=(0,b.t)("New pane above"),ce=(0,b.t)("Existing pane below"),he=(0,b.t)("New pane below"),de=(0,b.t)("Bring to front"),ue=(0,b.t)("Send to back"),pe=(0,b.t)("Bring forward"),_e=(0,b.t)("Send backward"),me=(0,b.t)("Visual order"),ge=(0,b.t)("Lines"),fe=((0,y.appendEllipsis)((0,b.t)("Add indicator/strategy on {studyTitle}")),(0, y.appendEllipsis)((0,b.t)("Add financial metric for {instrumentName}")),(0,y.appendEllipsis)((0,b.t)("Settings"))),ve=((0,b.t)("Apply default"),(0,y.appendEllipsis)((0,b.t)("Save as")),(0,b.t)("Copy")),Se=(0,b.t)("Clone"),ye=((0,b.t)("Template"),(0,b.t)("Go to {lineToolName}")),be=(0,b.t)("Unlock"),we=(0,b.t)("Lock"),Pe=((0,b.t)("Show earnings"),(0,b.t)("Show dividends"),(0,b.t)("Show splits"),(0,b.t)("Show all ideas")),Ce=(0,b.t)("Show ideas of followed users"),Te=(0,b.t)("Show my ideas only"),xe=((0,y.appendEllipsis)((0,b.t)("Settings")),(0,b.t)("Hide events on chart"),(0,b.t)("Add this symbol to entire layout")),Ie=(0,b.t)("Add this indicator to entire layout"),Me=((0,b.t)("Add this strategy to entire layout"),(0,b.t)("Add this financial metric to entire layout"),(0,b.t)("No sync"),(0,b.t)("Sync in layout"),(0,y.appendEllipsis)((0,b.t)("Symbol info"))),Le={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};function Ae(e,t,i,s){return null}function ke(e){const t=e.actions(),i=[t.showPriceLine];return i.push(t.showHighLowAverageClosePriceLines),new a.Action({actionId:"Chart.Lines",label:ge,statName:"Lines",subItems:i})}function Ee(e,t){const i=[];if(P.isToolCreatingNow.value())return i;return i}class De{constructor(e,t){this._chartWidget=e,this._options=(0,n.merge)((0,n.clone)(Le),t||{})}async contextMenuActionsForSources(e){const t=e[0],i=this._options;if(t===this._chartWidget.model().mainSeries()&&i.mainSeries)return this._contextMenuActionsForSeries(t);if((0,h.isStudy)(t)&&i.studies)return this._contextMenuActionsForStudy(t);if((0,v.isLineTool)(t)&&i.lineTools){const t=e.filter(v.isLineTool);return this._contextMenuActionsForLineTool(t)}return[]}_isReadOnly(){return this._chartWidget.readOnly()}_createActionHide(e){return new a.Action({actionId:"Chart.SelectedObject.Hide",label:W,icon:i(62781),statName:"HideSelectedObject",onExecute:this._chartWidget.hideDataSources.bind(this._chartWidget,[e])})}_createActionShow(e){const t=new a.Action({actionId:"Chart.SelectedObject.Show",checkable:!0,label:F,icon:i(4754),statName:"ToggleShow"}),s=new l.ActionBinder(t,e.properties().visible,this._chartWidget.model(),x);return t.setBinding(s),s.setValue(e.properties().visible.value()),t}_createActionScale(e){const t=(0,s.ensureNotNull)(e.priceScale()),r=this._chartWidget.model().model(),n=(0,s.ensureNotNull)(r.paneForSource(e)),o=n.priceScalePosition(t),l=("left"===o?n.leftPriceScales():n.rightPriceScales()).indexOf(t),h=r.priceScaleSlotsCount().totallySlots<2?"dontneedname":"needname",d="overlay"===o?"":(0,c.getPriceAxisNameInfo)(o,l).label,u=te.format({label:d}),p={"left-needname":u,"left-dontneedname":se,"right-needname":u,"right-dontneedname":re,"overlay-needname":ie,"overlay-dontneedname":ie}[o+"-"+h];return new a.Action({actionId:"Chart.Source.ChangePriceScale",label:p,icon:i(2116),subItems:this._createActionScaleItems(e)})}_createActionScaleDetach(e,t,i,r){ const n=this._chartWidget.model().model(),o=(0,s.ensureNotNull)(n.paneForSource(e));if(!o.canCreateNewPriceScale())return null;const l=(0,s.ensureNotNull)(e.priceScale()),h=l.canDetachSource(e),d=o.priceScalePosition(l),u=h||d!==t;if(!u)return null;const p=n.priceScaleSlotsCount(),_={left:{labelled:Y,sided:Q},right:{labelled:Y,sided:ee}},m="left"===t?o.leftPriceScales().length:o.rightPriceScales().length,g=p[t]>m?"labelled":"sided",f=(0,c.getPriceAxisNameInfo)(t,m).label,v=_[t][g].format({label:f});return new a.Action({actionId:"Chart.Source.ChangePriceScale",checkable:!1,disabled:!u,label:v,statName:r,payload:e,onExecute:i})}_onDetachLeft(e){const t=e.getPayload(),i=this._chartWidget.model().model(),r=(0,s.ensureNotNull)(i.paneForSource(t));this._chartWidget.model().detachToLeft(t,r)}_onDetachRight(e){const t=e.getPayload(),i=this._chartWidget.model().model(),r=(0,s.ensureNotNull)(i.paneForSource(t));this._chartWidget.model().detachToRight(t,r)}_createActionScaleDetachLeft(e){return this._createActionScaleDetach(e,"left",this._onDetachLeft.bind(this),"ToggleScaleLeft")}_createActionScaleDetachRight(e){return this._createActionScaleDetach(e,"right",this._onDetachRight.bind(this),"ToggleScaleRight")}_onMoveToScale(e){const t=e.getPayload();if(t.datasource.priceScale()===t.priceScale)return;const i=this._chartWidget.model().model(),r=(0,s.ensureNotNull)(i.paneForSource(t.datasource));this._chartWidget.model().moveToScale(t.datasource,r,t.priceScale,t.undoText)}_createMoveToScaleAction(e,t,i,s){const r=e.priceScale()===t;return new a.Action({actionId:"Chart.Source.MoveToOtherScale",checkable:!0,checked:r,label:i,statName:"ToggleScale",payload:{datasource:e,priceScale:t,undoText:s},onExecute:this._onMoveToScale.bind(this)})}_onNoScale(e){const t=e.getPayload().datasource,i=this._chartWidget.model().model(),r=(0,s.ensureNotNull)(i.paneForSource(t));r.isOverlay(t)||this._chartWidget.model().detachNoScale(t,r)}_createActionNoScale(e){const t=this._chartWidget.model().model(),i=(0,s.ensureNotNull)(t.paneForSource(e)),r=i.actionNoScaleIsEnabled(e);return new a.Action({actionId:"Chart.Source.MoveToNoScale",checkable:!0,checked:i.isOverlay(e),label:ne,disabled:!r,statName:"ToggleNoScale",payload:{datasource:e},onExecute:this._onNoScale.bind(this)})}_createActionScaleItems(e){const t=[],i=this._chartWidget.model().model(),r=(0,s.ensureNotNull)(i.paneForSource(e)),n=i.priceScaleSlotsCount().totallySlots>1,o=r.rightPriceScales(),l=r.leftPriceScales(),h=this._createActionScaleDetachRight(e),d=this._createActionScaleDetachLeft(e),u=o.length+l.length+(null===h?0:1)+(null===d?0:1)>2,p={right:{hidden:{checked:{labelled:H,sided:z},unchecked:{labelled:U,sided:j}},visible:{checked:{labelled:G,sided:q},unchecked:{labelled:Y,sided:$}}},left:{hidden:{checked:{labelled:H,sided:K},unchecked:{labelled:U,sided:X}},visible:{checked:{labelled:G,sided:Z},unchecked:{labelled:Y,sided:J}}}},_={right:M,left:L},m={left:r.visibleLeftPriceScales(),right:r.visibleRightPriceScales()},g=(t,i)=>{ const s=("right"===i?o:l)[t],r=m[i].includes(s)?"visible":"hidden",a=e.priceScale()===s?"checked":"unchecked",h=n?"labelled":"sided",d=p[i],u=(0,c.getPriceAxisNameInfo)(i,t).label;return{actionText:d[r][a][h].format({label:u}),undoText:n?I.format({label:u}):_[i]}};t.push(...o.map((t,i)=>{const s=g(i,"right");return this._createMoveToScaleAction(e,t,s.actionText,s.undoText)})),null!==h&&t.push(h);u&&(o.length>0||null!==h)&&t.push(new a.Separator);t.push(...l.map((t,i)=>{const s=g(i,"left");return this._createMoveToScaleAction(e,t,s.actionText,s.undoText)})),null!==d&&t.push(d);u&&(l.length>0||null!==d)&&t.push(new a.Separator);return t.push(this._createActionNoScale(e)),t}_createVisualOrderAction(e){const t=this._chartWidget.model(),s=t.availableZOrderOperations(e),r=[new a.Action({actionId:"Chart.Source.VisualOrder.BringToFront",label:de,statName:"BringToFront",disabled:!s.bringToFrontEnabled,onExecute:()=>t.bringToFront(e)}),new a.Action({actionId:"Chart.Source.VisualOrder.SendToBack",label:ue,statName:"SendToBack",disabled:!s.sendToBackEnabled,onExecute:()=>t.sendToBack(e)}),new a.Action({actionId:"Chart.Source.VisualOrder.BringForward",label:pe,statName:"BringForward",disabled:!s.bringForwardEnabled,onExecute:()=>t.bringForward(e)}),new a.Action({actionId:"Chart.Source.VisualOrder.SendBackward",label:_e,statName:"SendBackward",disabled:!s.sendBackwardEnabled,onExecute:()=>t.sendBackward(e)})];return new a.Action({actionId:"Chart.Source.VisualOrder",label:me,icon:i(94817),statName:"VisualOrder",subItems:r})}_createActionMergeUp(e){const t=this._chartWidget.model();return t.model().isMergeUpAvailableForSource(e)?new a.Action({actionId:"Chart.Source.MergeUp",label:ae,statName:"MergeUp",onExecute:()=>t.mergeSourceUp(e)}):null}_createActionUnmergeUp(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new a.Action({actionId:"Chart.Source.UnmergeUp",label:le,statName:"UnmergeUp",onExecute:()=>t.unmergeSourceUp(e)}):null}_createActionMergeDown(e){const t=this._chartWidget.model();return t.model().isMergeDownAvailableForSource(e)?new a.Action({actionId:"Chart.Source.MergeDown",label:ce,statName:"MergeDown",onExecute:()=>t.mergeSourceDown(e)}):null}_createActionUnmergeDown(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new a.Action({actionId:"Chart.Source.UnmergeDown",label:he,statName:"UnmergeDown",onExecute:()=>t.unmergeSourceDown(e)}):null}_mergeContentMenuItems(e){return[this._createActionMergeUp(e),this._createActionUnmergeUp(e),this._createActionMergeDown(e),this._createActionUnmergeDown(e)].filter(n.notNull)}_createActionMove(e){const t=this._mergeContentMenuItems(e);return t.length>0?new a.Action({actionId:"Chart.Source.MoveToPane",label:oe,icon:i(63310),subItems:t}):null}_contextMenuActionsForSeries(e){var t;const i=[],r=e.properties().childs().visible.value(),n=this._chartWidget.model().model(),l=((0,s.ensureNotNull)(n.paneForSource(e)),this._chartWidget.actions()) ;if(this._isReadOnly())i.push(r?this._createActionHide(e):this._createActionShow(e)),i.push(new a.Separator),i.push(this._createActionScale(e));else{0,i.length>0&&!(i[i.length-1]instanceof a.Separator)&&i.push(new a.Separator),o.enabled("symbol_info")&&i.push(l.showSymbolInfoDialog);n.mainSeries().symbolInfo();0,i.length>0&&!(i[i.length-1]instanceof a.Separator)&&i.push(new a.Separator),i.push(this._createVisualOrderAction([e]));const s=this._createActionMove(e);null!==s&&i.push(s),i.push(this._createActionScale(e)),i.push(r?this._createActionHide(e):this._createActionShow(e)),i.push(new a.Separator),i.push(ke(this._chartWidget)),i.push(new a.Separator);Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&l.addToWatchlist&&i.push(l.addToWatchlist),o.enabled("text_notes")&&i.push(l.addToTextNotes),i[i.length-1]instanceof a.Separator||i.push(new a.Separator),o.enabled("show_chart_property_page")&&!this._chartWidget.onWidget()&&i.push(l.mainSeriesPropertiesAction),i[i.length-1]instanceof a.Separator&&i.pop()}return i}_createActionAddChildStudy(e){throw new Error("unsupported")}_createActionAddFundamentals(e){return null}_createActionShowSymbolInfoDialog(e,t){return new a.Action({actionId:"Chart.Dialogs.ShowSymbolInfo",label:Me,icon:i(96527),checkable:!1,statName:"SymbolInfo",onExecute:()=>{const i=e.symbol(),s={symbolInfo:e.symbolInfo(),unitName:e=>t.name(e)};(0,g.showSymbolInfoDialog)(i,s)}})}_createActionShowProperties(e){return new a.Action({actionId:"Chart.Indicator.ShowSettingsDialog",label:fe,icon:i(78544),statName:"EditSelectedObject",onExecute:()=>this._chartWidget.showSourceProperties(e)})}_contextMenuActionsForStudy(e){const t=this._chartWidget.actions(),i=e.properties().visible.value(),s=[];if(!e.userEditEnabled())return s;if(this._chartWidget.readOnly())s.push(i?this._createActionHide(e):this._createActionShow(e)),s.push(new a.Separator),e.constructor instanceof d.NonSeriesStudy||s.push(this._createActionScale(e));else{0,o.enabled("study_on_study")&&e.canHaveChildren()&&s.push(this._createActionAddChildStudy(e));const r=this._createApplyToEntireLayoutCommand(e);if(null!==r&&s.push(r),s.length>0&&!(s[s.length-1]instanceof a.Separator)&&s.push(new a.Separator),o.enabled("symbol_info")&&(e instanceof m.StudyCompare||e instanceof _.study_Overlay)&&null!==e.symbolInfo()&&(s.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),s.push(new a.Separator)),s.push(this._createVisualOrderAction([e])),!(e.constructor instanceof d.NonSeriesStudy)){const t=this._createActionMove(e);null!==t&&s.push(t),s.push(this._createActionScale(e))}s.push(new a.Separator);const n=e.metaInfo();if(e.copiable()){const t=new a.Action({actionId:"Chart.Clipboard.CopySource",label:ve,shortcutHint:(0,p.humanReadableHash)(p.Modifiers.Mod+67),statName:"Copy",onExecute:()=>{this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}});s.push(t)}s.push(i?this._createActionHide(e):this._createActionShow(e)),s.push(t.studyRemove),s.push(new a.Separator), o.enabled("property_pages")&&new u.MetaInfoHelper(n).hasUserEditableOptions()&&s.push(this._createActionShowProperties(e)),s[s.length-1]instanceof a.Separator&&s.pop()}return s}_createEditAlertDrawingAction(e){return new TVAction({label:R.format({title:e.title()}),icon:TbbiEditAlertSvg,statName:"EditAlert",onExecute:()=>{window.runOrSignIn(()=>{e.editAlert("pane_context_menu_edit_alert")},{source:"Alert edit from pane context menu"})}})}_createLineToolTemplateAction(e){return null}_createActionToggleLockLineTools(e){const t=e[0].properties().frozen.value(),s=t?be:we;return new a.Action({actionId:"Chart.SelectedObject.ToggleLocked",label:s,statName:"ToggleLockSelectedObject",checkable:!0,icon:i(t?65511:26971),onExecute:()=>{if(1===e.length)this._chartWidget.toggleLockSelectedObject();else{const i=t?N:B,s=this._chartWidget.model();s.withMacro(i,()=>{e.forEach(e=>{s.setProperty(e.properties().frozen,!t,i)})})}}})}async _contextMenuActionsForLineTool(e){const t=[],s=this._chartWidget.actions(),r=(this._chartWidget.model().model(),()=>{t.push(this._createVisualOrderAction(e))}),n=()=>{const s=e.filter(e=>e.cloneable());if(s.length>0){const e=new a.Action({actionId:"Chart.LineTool.Clone",label:Se,icon:i(58589),shortcutHint:(0,p.humanReadableModifiers)(p.Modifiers.Mod)+"Drag",statName:"Clone",onExecute:()=>this._chartWidget.model().cloneLineTools(s,!1)},"Clone");t.push(e)}return!!s.length},l=()=>{const i=e.filter(e=>e.copiable());if(i.length>0){const e=new a.Action({actionId:"Chart.Clipboard.CopyLineTools",label:ve,shortcutHint:(0,p.humanReadableHash)(p.Modifiers.Mod+67),statName:"Copy",onExecute:()=>this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy(i)},"Copy");t.push(e)}return!!i.length},c=()=>{const e=Ee(this._chartWidget);return t.push(...e),e.length>0},h=e=>{const i=new a.Action({actionId:"Chart.ScrollToLineTool",label:ye.format({lineToolName:e.title()}),statName:"GoToLineTool",checkable:!1,onExecute:async()=>this._chartWidget.model().scrollToLineTool(e)});t.push(i)},d=e=>{const t=this._chartWidget.model().model().lineToolsGroupModel(),i=e.map(e=>t.groupForLineTool(e));return new Set(i).size<=1};if(1===e.length){const i=e[0];if(this._chartWidget.readOnly())t.push(s.lineHide);else if(i.userEditEnabled()){0,r(),this._options.objectTree&&s.paneObjectTree&&t.push(s.paneObjectTree),t.push(new a.Separator);let e=n();e=l()||e,e=c()||e,e&&t.push(new a.Separator),t.push(this._createActionToggleLockLineTools([i])),t.push(s.lineHide),t.push(s.lineRemove),i.points().length>0&&this._options.gotoLineTool&&(t.push(new a.Separator),h(i));const d=await this._chartWidget.propertiesDefinitionsForSource(i);if(o.enabled("property_pages")&&null!==d&&(t.push(new a.Separator),t.push(s.format)),i.additionalActions){t.push(new a.Separator);const e=i.additionalActions(this._chartWidget.model());t.push(...e)}}}else this._options.objectTree&&s.paneObjectTree&&t.push(s.paneObjectTree),d(e)&&r(),t.length>0&&t.push(new a.Separator),n(),l(),c(),t.push(new a.Separator),t.push(this._createActionToggleLockLineTools(e)),t.push(s.lineHide), t.push(s.lineRemove),o.enabled("property_pages")&&(t.push(new a.Separator),t.push(s.format));return t}_createEarningsShow(){return null}_createDividendsShow(){return null}_createSplitsShow(){return null}_contextMenuActionsForESD(){return[]}_contextMenuActionsForPublishedTimeline(e){const t=this._chartWidget.actions(),i=[];if(i.push(t.lineHide),window.is_authenticated){const t=e.properties().childs().filter,s=new TVAction({checked:t.value()===PublishedChartsFilter.None,checkable:!0,label:Pe,name:"ToggleAllIdeas",statName:"ToggleAllIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.None,A)}),r=new TVAction({checked:t.value()===PublishedChartsFilter.Following,checkable:!0,label:Ce,name:"ToggleIdeasOfPeopleAndUser",statName:"ToggleIdeasOfPeopleAndUser",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.Following,k)}),n=new TVAction({checked:t.value()===PublishedChartsFilter.Private,checkable:!0,label:Te,name:"ToggleUserIdeas",statName:"ToggleUserIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.Private,E)});i.push(new a.Separator,s,r,n)}return i}_contextMenuActionsForTradingDrawings(e){return e.contextMenuItems()}_createAlertToggleHorzLineLabelAction(e){const t=getGlobalAlertSettingsProperty().childs().line.childs().visible,i=t.value()?T:C;return new TVAction({checkable:!0,label:O,checked:t.value(),statName:"ToggleExtendAlertLine",onExecute:()=>this._chartWidget.model().setProperty(t,!t.value(),i)})}_contextMenuActionsForAlertLabel(e){const t=e.alert(),i=[];return t.get("active")?i.push(AlertActionCreator.stopAlert(t)):i.push(AlertActionCreator.restartAlert(t,"alert_label_context_menu_restart")),i.push(AlertActionCreator.editAlert(t,"alert_label_context_menu_edit")),i.push(AlertActionCreator.deleteAlert(t)),i.push(new a.Separator),i.push(this._createAlertToggleHorzLineLabelAction(e)),i}_contextMenuActionsForChartEvents(e){return[]}_createApplyToEntireLayoutCommand(e){if(!this._chartWidget.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return null;const t=this._chartWidget.model().model();if(e.parentSource()!==t.mainSeries())return null;const i=(0,s.ensureNotNull)(t.paneForSource(e)),r=t.paneForSource(t.mainSeries())===i,n=e instanceof m.StudyCompare&&e.priceScale()===t.mainSeries().priceScale()&&(0,s.ensureNotNull)(e.priceScale()).isPercentage(),o=r?void 0:t.panes().indexOf(i);let l=Ie,c=V,h="AddStudyToEntireLayout";return(0,S.isSymbolSource)(e)&&(l=xe,c=D,h="AddSymbolToEntireLayout"),new a.Action({actionId:"Chart.AddIndicatorToAllCharts",label:l,statName:h,onExecute:()=>{const i=(0,s.ensureNotNull)((0,f.clipboardDataForSources)(t.id(),[e])),a=this._chartWidget.chartWidgetCollection(),l={isOnMainPane:r,asCompare:n,paneIndex:o};a.applyIndicatorToAllCharts(this._chartWidget,i,l,c)}},"applyStudyToEntireLayout")}}},85125:(e,t,i)=>{"use strict";i.r(t),i.d(t,{supportedLineTools:()=>s});const s={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{ name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute"},note:{name:"LineToolNote"},anchored_note:{name:"LineToolNoteAbsolute"},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},fib_channel:{name:"LineToolFibChannel"},xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{ name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}}},95316:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>o});var s=i(16282),r=i(17e3),n=i(67945);function o(e,t){if(1===t.length&&(0,r.isStudy)(t[0])){const e=t[0];return{title:e.title(),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter(e=>e.copiable()&&(0,n.isLineTool)(e)).map(t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i}),i.sources.length>0?(1===i.sources.length?i.title=t[0].title&&t[0].title():i.title="Drawings",i):null}},63939:(e,t,i)=>{"use strict";i.d(t,{addBrandingSource:()=>z});var s=i(99479),r=i(72927),n=i(71044),o=i(53312),a=i(16282),l=i(79881),c=i(27490),h=i(73853),d=i(10288),u=i(83939),p=i(50968),_=i(99432),m=i(55430),g=i(16932),f=i(97663),v=i(54837),S=i(92137);i(8325);const y=c.enabled("adaptive_logo"),b=c.enabled("small_no_display"),w=c.enabled("38914"),P="Ch{0}ar{1}t{2}by{3}{4}".format("",""," "," ","TradingView"),C="po{0}wer{1}ed{2}by{3}{4}".format("",""," "," ","TradingView"),T="by{3}{4}".format("",""," "," ","TradingView"),x=w?T:C,I=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),M=window.urlParams||{};window.initData;M.no_referral_id&&enable(M.referral_id||"","aggressive");(0,l.t)("By TradingView"),(0,l.t)("{symbol} financials by TradingView"),(0,l.t)("More features on tradingview.com"),(0,l.t)("powered by");const L=(0,l.t)(P),A=(0,l.t)(x);function k(e){return"px EuclidCircular"===e?.1:0}class E extends h.CustomSourceBase{constructor(e,t,i,r){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=16,this._layout="site_branding",this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._cubicBezier=new u.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._mainSeries=this._model.mainSeries(),this._showAllowance=i,this._showForPro=Boolean(r),this._checkLayout(),"widget_custom_branding"!==this._layout&&"fundamental_custom_branding"!==this._layout||(this._left=8,this._bottom=5);const n=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,s.default)(n,200),n(),window.addEventListener("resize",this._resizeHandlerDelayed),this._monitorCanvas=(0,g.createDisconnectedBoundCanvas)(document,new g.Size(0,0)), this._monitorCanvas.subscribeCanvasConfigured(()=>{this._init()}),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)}}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy()}paneViews(e){if(window.TradingView.printing)return[];if(!this._showAllowance())return[];if("site_branding"===this._layout&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=c.enabled("move_logo_to_main_pane");return t&&e.isMainPane()||!t&&e.isLast()||e.isMaximized()?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e,t){return this._paneHeight=e,this._canvasWidth=t,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){return!this._showBranding||c.enabled("logo_without_link")?null:this._powBy&&"widget_custom_no_powered_branding"!==this._layout&&"fundamental_custom_no_powered_branding"!==this._layout&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))?new d.HitTestResult(d.HitTestResult.CUSTOM,{hideCrosshairLinesOnHover:!0,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()}}):null}tvUrl(){let e=new URL("https://www.tradingview.com/");if(this._customLogoLink)return this._customLogoLink;if("library_branding"===this._layout||"library_custom_branding"===this._layout){let t;switch(!0){case c.enabled("charting_library"):t="library";break;case c.enabled("trading_terminal"):t="trading-terminal"}return e.searchParams.append("utm_source",window.location.origin),e.searchParams.append("utm_medium","library"),t&&e.searchParams.append("utm_campaign",t),e.toString()}return e.toString()}draw(e,t){if(!this._showBranding)return;let i=0;M.utm=!0,(0,g.drawScaled)(e,t.pixelRatio,()=>{this._powBy&&this._powBy.show&&(i=this._powBy.height,e.save(),e.translate(this._left,this._paneHeight-this._bottom-i),this._powBy.draw(e,t,this._canvasWidth),e.restore()),this._custom&&this._custom.show&&(e.save(),e.translate(this._left,this._paneHeight-this._bottom-i-this._custom.height),this._custom.draw(e,t),e.restore())})}_init(){const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new W(this._layout,(null==e?void 0:e.name)||"",this._model,()=>this._model.fullUpdate()),this._custom=new H(this._layout,this._customLogoSrc,()=>this._model.fullUpdate()),this._openAnimation=null,this._closeAnimation=null}_checkLayout(){if(c.enabled("widget"))0;else if(c.enabled("charting_library")||c.enabled("trading_terminal")){ const e=JSON.parse(M.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=c.enabled("widget_logo"),c.enabled("link_to_tradingview")?this._layout="library_custom_branding":this._layout="library_custom_no_powered_branding"):(this._layout="library_branding",this._needToShow=c.enabled("widget_logo"))}else this._layout="site_branding"}_startOpenAnimation(){null===this._openAnimation&&(null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null),this._openAnimation=(0,_.doAnimate)({from:this._currentStateForAnimation(),to:this._openedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}_startCloseAnimation(){null===this._closeAnimation&&(null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null),this._closeAnimation=(0,_.doAnimate)({from:this._currentStateForAnimation(),to:this._closedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}_currentStateForAnimation(){return(0,a.ensureNotNull)(this._powBy).width}_closedStateForAnimation(){return(0,a.ensureNotNull)(this._powBy).minimizedAnimationWidth()}_openedStateForAnimation(){return(0,a.ensureNotNull)(this._powBy).maximizedAnimationWidth()}_animatedDrawStep(e,t){(0,a.ensureNotNull)(this._powBy).animatedDrawStep(e,t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openLink(){if("site_branding"===this._layout)return!1;c.enabled("widget");return(0,a.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function D(e){return!y||e>500}const V={customBrandingTradingViewText:o.colorsPalette["color-brand"],customBrandingText:o.colorsPalette["color-cold-gray-850"],background:o.colorsPalette["color-cold-gray-900"],shadow:(0,p.generateColor)(o.colorsPalette["color-white"],91),text:o.colorsPalette["color-white"],staticTextBackground:(0,p.generateColor)(o.colorsPalette["color-cold-gray-800"],20),logo:o.colorsPalette["color-white"]},B={customBrandingTradingViewText:o.colorsPalette["color-brand"],customBrandingText:o.colorsPalette["color-cold-gray-850"],background:o.colorsPalette["color-white"],shadow:(0,p.generateColor)(o.colorsPalette["color-black"],91),text:o.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,p.generateColor)(o.colorsPalette["color-white"],20),logo:o.colorsPalette["color-cold-gray-900"]};const N={};function R(e,t){const i=N[e];if(void 0!==i)return i.image||null;const s={};return N[e]=s,function(e){return new Promise(t=>{const i=f.replace(/fill="#[\da-f]{6}"/i,`fill="${e}"`),s=new Image;s.onload=()=>{s.onload=null,t(s)},s.src=URL.createObjectURL(new Blob([i],{type:"image/svg+xml"}))})}(e).then(e=>{s.image=e,t()}),null}function O(e){const{a:t,d:i,e:s,f:n}=e;return new r.Point(s/t,n/i)}class F{constructor(){this._originPoint=null} hitTest(e){const t=this._getHitTestBox();if(t)return(0,n.pointInBox)(e,t)}_getHitTestBox(){const e=this._originPoint;if(e){const{x:t,y:i}=e;return(0,r.box)(e,new r.Point(t+this.width,i+this.height))}}}class W extends F{constructor(e,t,i,s){if(super(),this.show=!0,this.borderRadius=0,this._needDisplayImage=!1,this._imageWidth=22,this._imageHeight=11,this._animatedWidth=32,this._font="px "+v.CHART_FONT_FAMILY,this._txt="TradingView",this._textWidth=0,this._maximizedAnimationTextWidth=0,this._textWidthCache=new S.TextWidthCache,this._pixelRatio=1,this._model=i,this._layout=e,this._symbol=t,this.showAnimatedBranding=c.enabled("show_animated_logo")||"widget_branding"===this._layout,this._fontSize=this.showAnimatedBranding?11:14,this.showAnimatedBranding||"widget_custom_branding"!==this._layout&&"fundamental_custom_branding"!==this._layout||(this._fontSize=12),this.width=32,this.height=this._fontSize+2,this._onReadyCallback=s,this._init(),document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(this._fontSize+"px EuclidCircular")?this._font="px EuclidCircular":document.fonts.load(this._fontSize+"px EuclidCircular",this._txt).then(()=>{this._font="px EuclidCircular",this._recalculateMetrics()})}this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this.showAnimatedBranding}minimizedAnimationWidth(){return 32}maximizedAnimationWidth(){return this._maximizedAnimationTextWidth+32-3}animatedDrawStep(e,t){this._animatedWidth=t}draw(e,t,i){t.pixelRatio!==this._pixelRatio&&(this._textWidthCache.reset(),this._pixelRatio=t.pixelRatio);const s=this._colors;if(this.showAnimatedBranding)this._needDisplayImage&&null!==this._getLogoImage(s.logo)&&(e.save(),e.translate(-Math.ceil((32-this._imageWidth)/2),Math.floor((32-this._imageHeight)/2)),this._originPoint=O(e.getTransform()),this.borderRadius=16,this._drawFillRectWithRoundedCorner(e,-.5,0,this._animatedWidth,32,this.borderRadius),this._drawLogoImage(e,Math.round((32-this._imageWidth)/2),Math.round((32-this._imageHeight)/2)+0),this._animatedWidth>32&&(e.translate(Math.round(32),Math.round(this._fontSize*k(this._font))),this._drawFillTextCropWidth(e,this._animatedWidth-32)),e.restore(),this.width=this._animatedWidth);else if("widget_custom_branding"===this._layout||"fundamental_custom_branding"===this._layout){e.font=this._fontSize+this._font;const t=e.measureText(this._txt).width+2;this.width=t+e.measureText("TradingView").width+2,this._originPoint=O(e.getTransform()),e.save(),e.globalAlpha=.7,e.fillStyle=this._colors.customBrandingText,e.fillText(this._txt,0,12),e.fillStyle=this._colors.customBrandingTradingViewText,e.fillText("TradingView",t,12),e.restore()}else if(function(e){return!b||e>480}(i))if(this._needDisplayImage&&null!==this._getLogoImage(s.logo)){e.save(),e.translate(-Math.ceil((32-this._imageWidth)/2),Math.floor((32-this._imageHeight)/2)),this._originPoint=O(e.getTransform()),this.borderRadius=16, this._drawBgCircle(e),e.drawImage((0,a.ensureNotNull)(this._getLogoImage(s.logo)),Math.round((32-this._imageWidth)/2),Math.round((32-this._imageHeight)/2)+0);const t=D(i);t&&(e.translate(37,Math.round(this._fontSize*k(this._font))),this._drawTextStroke(e),this._drawTextFill(e)),e.restore(),this.width=32,t&&(this.width+=this._maximizedAnimationTextWidth)}else{const t=D(i);t&&(e.save(),e.translate(I?-.5:0,-.5),this._drawTextStroke(e),this._drawTextFill(e),e.restore()),t&&(this.width=this._maximizedAnimationTextWidth)}else this.width=0}_init(){this._checkLayout(),this.show&&(this.height=this._needDisplayImage?32:this._fontSize+2,this._updateColors(),this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_recalculateMetrics(){const e=(0,g.createDisconnectedBoundCanvas)(document,new g.Size(0,0)),t=(0,g.getPretransformedContext2D)(e,!0);t.font=this._fontSize+this._font,this._textWidth=Math.ceil(t.measureText(this._txt).width)+2;let i=this._textWidth+8;i%2==0&&(i+=1),this._maximizedAnimationTextWidth=i,this._textWidthCache.reset()}_updateColors(){this._colors=this._model.isDark()?V:B}_getLogoImage(e){return R(e,this._onReadyCallback)}_checkLayout(){switch(this._layout){case"widget_branding":case"widget_referral_branding":case"widget_custom_branding":case"fundamental_branding":case"fundamental_custom_branding":case"library_custom_branding":case"library_branding":case"site_branding":this.show=!0;break;case"widget_custom_no_powered_branding":case"fundamental_custom_no_powered_branding":case"library_custom_no_powered_branding":this.show=!1}switch(this._layout){case"library_branding":this._needDisplayImage=!0,this._txt=L;break;case"library_custom_branding":this._txt=A}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,16+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,16+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawFillTextCropWidth(e,t){e.save(),e.beginPath(),e.rect(0,0,t,this.height),e.clip(),this._drawTextFill(e),e.restore()}_drawBgCircle(e){const t=this.borderRadius,i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,r,n){e.save(),(0,m.drawRoundRect)(e,t-1,i-1,s+2,r+2,n),e.fillStyle=this._colors.shadow,e.fill(),e.closePath(),e.restore(),e.save(),(0,m.drawRoundRect)(e,t,i,s,r,n),e.fillStyle=this._colors.background,e.fill(),e.closePath(),e.restore()}_drawLogoImage(e,t,i){e.drawImage((0,a.ensureNotNull)(this._getLogoImage(this._colors.logo)),t,i)}} class H extends F{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()}),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t){this._ready&&(e.drawImage(this._img,-.5,-.5,this.width,this.height),this._originPoint=O(e.getTransform()))}_checkLayout(){switch(this._layout){case"widget_custom_branding":case"widget_custom_no_powered_branding":case"fundamental_custom_branding":case"fundamental_custom_no_powered_branding":case"library_custom_branding":case"library_custom_no_powered_branding":this.show=!0;break;case"site_branding":case"widget_branding":case"widget_referral_branding":case"fundamental_branding":case"library_branding":this.show=!1}}}function z(e,t){function i(t){const i=e.getAll();if(1===i.length)return!0;const s=i[0].hasModel()&&i[0].model();return s&&s.model()===t}e.addCustomSource("branding",(e,s)=>new E(e,s,i.bind(null,s),t))}},16932:(e,t,i)=>{"use strict";i.d(t,{Size:()=>o,getCanvasDevicePixelRatio:()=>a,getContext2D:()=>l,getPrescaledContext2D:()=>c,getPretransformedContext2D:()=>h,fillRect:()=>d,clearRect:()=>u,drawScaled:()=>p,createDisconnectedCanvas:()=>_,createDisconnectedBoundCanvas:()=>m,createBoundCanvas:()=>f,calcTextHorizontalShift:()=>v,disableSelection:()=>S});var s=i(68545),r=i(16282),n=i(76553);class o{constructor(e,t){this.w=e,this.h=t}equals(e){return this.w===e.w&&this.h===e.h}}function a(e){var t,i;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}function l(e){const t=(0,r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function c(e){const t=(0,r.ensureNotNull)(e.getContext("2d")),i=a(e);return t.setTransform(i,0,0,i,0,0),t}function h(e,t){const i=(0,r.ensureNotNull)(e.canvas.getContext("2d"));return i.setTransform(e.pixelRatio,0,0,e.pixelRatio,0,0),t||i.translate(.5,.5),i}function d(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function u(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function p(e,t,i){e.save(),e.scale(t,t),i(),e.restore()}function _(e,t,i){const s=g(e);return void 0===i&&(i=a(s)),s.width=t.w*i,s.height=t.h*i,s}function m(e,t){const i=g(e),r=(0,s.bindToDevicePixelRatio)(i,{allowDownsampling:!1});return r.resizeCanvas({width:t.w,height:t.h}),r}function g(e){const t=e.createElement("canvas");return S(t),t}function f(e,t){const i=g((0,r.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=(0,s.bindToDevicePixelRatio)(i,{allowDownsampling:!1});return n.resizeCanvas({width:t.w,height:t.h}),n}function v(e,t){return"center"===e.textAlign?0:(0,n.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t} function S(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}},9884:(e,t,i)=>{"use strict";i.d(t,{ChartChangesWatcher:()=>n});var s=i(5729),r=i.n(s);class n{constructor(e,t,i,s){this._undoHistoryHasChanges=!1,this._hasChanges=!1,this._recalculateHaveChanges=()=>{const e=this._undoHistoryHasChanges||this._lineToolsHaveChanges.value();e!==this._hasChanges&&(this._hasChanges=e,this._onValueChanged.fire(e))},this._undoHistory=e,this._lineToolsHaveChanges=t,this._chartSaver=i,this._globalEvents=s,this._onValueChanged=new(r()),this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy()}hasChanges(){return this._hasChanges}getOnChange(){return this._onValueChanged}_subscribe(){this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),this._chartSaver.chartSaved().subscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges)}_unsubscribe(){this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),this._chartSaver.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges)}_setUndoHistoryHasChanges(e){this._undoHistoryHasChanges=e,this._recalculateHaveChanges()}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){e&&!e.customFlag("doesnt_affect_save")&&this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1)}}},14734:(e,t,i)=>{"use strict";i.d(t,{shiftPressed:()=>p,modifierPressed:()=>_,globalEnvironmentState:()=>m,ChartHotkeysListener:()=>g});var s=i(60934),r=i(42998),n=i(15738),o=i(32856),a=i.n(o),l=i(57296);const c=new(a())(Boolean(s.pressedKeys.value()&r.Modifiers.Shift)),h=new(a())(Boolean(s.pressedKeys.value()&r.Modifiers.Mod)),d=new(a())(Boolean(s.pressedKeys.value()&r.Modifiers.Alt)),u=[r.Modifiers.None,r.Modifiers.Alt,r.Modifiers.Mod,r.Modifiers.Alt+r.Modifiers.Shift];function p(){return c}function _(){return h}function m(){return new l.EnvironmentState({altKey:d.value(),ctrlKey:_().value(),metaKey:_().value(),shiftKey:p().value()})}s.pressedKeys.subscribe(e=>{c.setValue(Boolean(e&r.Modifiers.Shift)),h.setValue(Boolean(e&r.Modifiers.Mod)),d.setValue(Boolean(e&r.Modifiers.Alt))});class g{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){ null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){this._chartWidget.hasModel()&&window.document.activeElement===window.document.body&&this._chartWidget.isActive()&&(this._handleMoveDrawingsKeyDown(e)||this._handleScrollKeyDown(e)||this._handleZoomKeyDown(e))&&e.preventDefault()}_keyupHandler(e){this._chartWidget.hasModel()&&this._handleScrollKeyUp(e)}_handleMoveDrawingsKeyDown(e){const t=255&(0,r.hashFromEvent)(e),i=this._chartWidget.model();switch(t){case 37:return i.moveSelectedToolsLeft();case 39:return i.moveSelectedToolsRight();case 38:return i.moveSelectedToolsUp();case 40:return i.moveSelectedToolsDown()}return!1}_handleScrollKeyDown(e){if(null!==this._pressedKeyCode)return!1;const t=(0,r.hashFromEvent)(e),i=255&t,s=(0,r.modifiersFromEvent)(e);let o;if(37===i)o=1;else{if(39!==i)return!1;o=-1}return!(r.isMacKeyboard&&s===r.Modifiers.Mod||!u.includes(s))&&(!(0,n.isNativeUIInteraction)(t,e.target)&&(this._pressedKeyCode=i,s===r.Modifiers.None?this._chartWidget.scrollHelper().moveByBar(o):s===r.Modifiers.Alt||s===r.Modifiers.Mod?this._chartWidget.scrollHelper().move(o):-1===o?this._chartWidget.model().timeScale().scrollToRealtime(!0):this._chartWidget.model().timeScale().scrollToFirstBar(),!0))}_handleScrollKeyUp(e){if(null===this._pressedKeyCode)return!1;const t=(0,r.hashFromEvent)(e);if((0,n.isNativeUIInteraction)(t,e.target))return!1;return(255&t)===this._pressedKeyCode&&(this._pressedKeyCode=null,this._chartWidget.scrollHelper().stopMove(),!0)}_handleZoomKeyDown(e){const t=(0,r.hashFromEvent)(e),i=255&t;if((0,r.modifiersFromEvent)(e)!==r.Modifiers.Mod||(0,n.isNativeUIInteraction)(t,e.target))return!1;const s=this._chartWidget.model();if(38===i)s.zoomIn();else{if(40!==i)return!1;s.zoomOut()}return!0}}},30566:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetApiBase:()=>P});var s=i(16282),r=i(79881),n=i(90963),o=i(35001),a=i(42062),l=i(33287);class c{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset()}}var h=i(5729),d=i.n(h),u=i(94975);const p=new n.TranslatedString("change timezone",(0,r.t)("change timezone"));class _{constructor(e){this._onTimezoneChanged=new(d()),this._chartWidget=e,this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,e=>{this._onTimezoneChanged.fire(e.value())}), e.onAboutToBeDestroyed().subscribe(this,()=>{this._timezoneProperty.unsubscribeAll(this)},!0)}availableTimezones(){return u.availableTimezones}getTimezone(){const e=this._timezoneProperty.value();return(0,s.ensureDefined)(u.availableTimezones.find(t=>t.id===e))}setTimezone(e,t){(0,s.assert)((0,u.timezoneIsAvailable)(e),"Incorrect timezone: "+e),(null==t?void 0:t.disableUndo)?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,p)}onTimezoneChanged(){return this._onTimezoneChanged}}var m=i(73900),g=i(18174),f=i(7346);function v(e,t){const i=()=>{e.completed().unsubscribe(null,s),t(!1)},s=()=>{e.error().unsubscribe(null,i),t(!0)};e.completed().subscribe(null,i,!0),e.error().subscribe(null,s,!0)}var S=i(63059);const y=new n.TranslatedString("change price to bar ratio",(0,r.t)("change price to bar ratio")),b=new n.TranslatedString("toggle lock scale",(0,r.t)("toggle lock scale")),w=new n.TranslatedString("change series style",(0,r.t)("change series style"));class P{constructor(e,t){this._visibleBarsChanged=new(d()),this._crosshairMoved=new(d()),this._ranges=null,this._alignerResolution=o.Interval.parse(""),this._alignerSymbolInfo=null,this._dwmAligner=null,this._chartWidget=e,this._activateChart=t,this._timezoneApi=new _(e),this._chartWidget.withModel(this,()=>{this._chartWidget.model().crossHairSource().moved().subscribe(this,this._onCrosshairMoved)})}getPriceToBarRatio(){return this._chartWidget.model().model().mainSeriesScaleRatioProperty().value()}setPriceToBarRatio(e,t){const i=this._chartWidget.model(),s=i.model(),r=s.mainSeriesScaleRatioProperty();(null==t?void 0:t.disableUndo)?new f.SetScaleRatioPropertiesCommand(r,e,null,s).redo():i.setScaleRatioProperty(r,e,y)}isPriceToBarRatioLocked(){return this._chartWidget.model().model().mainSeries().priceScale().isLockScale()}setPriceToBarRatioLocked(e,t){const i=this._chartWidget.model(),s=i.model(),r=s.mainSeries().priceScale();(null==t?void 0:t.disableUndo)?new g.SetPriceScaleModeCommand({lockScale:e},r,null,s).redo():i.setPriceScaleMode({lockScale:e},r,b)}onDataLoaded(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())}onSymbolChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())}onIntervalChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())}onVisibleRangeChanged(){return this._makeSubscriptionFromDelegate(this._visibleBarsChanged)}onChartTypeChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onStyleChanged())}onSeriesTimeframe(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesTimeFrame())}whenChartReady(e){this._chartWidget.withModel(this,e)}crossHairMoved(){return this._makeSubscriptionFromDelegate(this._crosshairMoved)}setSymbol(e,t){if(e===this.symbol())return void(null==t||t());const i=e=>{!e&&t&&t() },s=this._chartWidget.model().mainSeries().dataEvents();t&&v(s,i),this._activateChart(),this._chartWidget.setSymbol(e)}setResolution(e,t){const i=o.Interval.normalize(e);if(null===i||i===this.resolution())return void(null==t||t());const s=e=>{!e&&t&&t()},r=this._chartWidget.model().mainSeries().dataEvents();t&&v(r,s),this._activateChart(),this._chartWidget.setResolution(i)}setChartType(e,t){const i=this._chartWidget.model().mainSeries().properties().childs().style;if(i.value()===e)return void(null==t||t());const s=e=>{!e&&t&&t()},r=this._chartWidget.model().mainSeries().dataEvents();t&&v(r,s),this._chartWidget.model().setChartStyleProperty(i,e,w)}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(m.studyEntityInfo)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.isMaximizedPane()){let t=0,i=0;e.forEach(e=>{t+=e.height(),i+=e.stretchFactor()});const s=i/t;return e.map(e=>Math.round(e.stretchFactor()/s*100)/100)}return e.map(e=>e.height())}setAllPanesHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");const r=i.reduce((e,t)=>e+t.stretchFactor(),0)/e.reduce((e,t)=>e+t);e.forEach((e,t)=>{const s=e*r;i[t].setStretchFactor(s)}),t.fullUpdate()}sessions(){return this._chartWidget.model().model().sessions()}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}getTimezoneApi(){return this._timezoneApi}exportData(e){const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),i.e(9498).then(i.bind(i,70867)).then(e=>e.exportData(this._chartWidget.model().model(),t))}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return(0,l.barTimeToEndOfPeriod)(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return(0,l.endOfPeriodToBarTime)(t.barBuilder,e,t.intervalObj)}properties(){return this._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){return this._chartWidget.chartPainted()}axesSizeReady(){for(const e of this._chartWidget.paneWidgets()){for(const t of e.leftPriceAxisesContainer().axes())if(!t.sizeReady())return!1;for(const t of e.rightPriceAxisesContainer().axes())if(!t.sizeReady())return!1}return!0}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}ranges(){throw new Error("not implemented")}getTimeScale(){return new c(this._chartWidget.model().timeScale())}_destroy(){this._chartWidget.hasModel()&&this._chartWidget.model().crossHairSource().moved().unsubscribeAll(this)}_createStudy(e){return Promise.reject("Pine and java studies are not supported")}_convertTimeToPublic(e){const t=this._getSeriesAligner() ;return null!==t?t.timeToExchangeTradingDay(1e3*e)/1e3:e}_convertIndexToPublicTime(e){const t=this._chartWidget.model(),i=t.timeScale();if(i.isEmpty())return null;const r=i.points(),n=(0,s.ensureNotNull)(r.firstIndex()),o=(0,s.ensureNotNull)(r.lastIndex());let a=null;if(n<=e&&e<=o)a=r.valueAt(e);else if(e>o){const r=t.mainSeries().syncModel();if(null!==r){const t=(0,s.ensureNotNull)(i.indexToTimePoint(o));a=r.projectTime(t,e-o)}}return null!==a&&(a=this._convertTimeToPublic(a)),a}_convertTimeFromPublic(e){const t=this._getSeriesAligner();return null!==t?t.timeToSessionStart(1e3*e)/1e3:e}_getSeriesAligner(){const e=this._chartWidget.model().mainSeries(),t=e.interval(),i=o.Interval.parse(t),s=e.symbolInfo();return this._alignerResolution.isEqualTo(i)&&this._alignerSymbolInfo===s||(this._dwmAligner=null===s?null:(0,S.createDwmAligner)(t,s),this._alignerResolution=i,this._alignerSymbolInfo=s),this._dwmAligner}_onCrosshairMoved(e){const t=this._convertIndexToPublicTime(e.index);null!==t&&this._crosshairMoved.fire({price:e.price,time:t})}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,s.ensureNotNull)(e.mainSeries().symbolInfo()),r=e.mainSeries().interval(),n=new a.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,a.newBarBuilder)(r,n,n),intervalObj:o.Interval.parse(r)}}}},83233:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetBase:()=>Et});var s=i(16282),r=i(79881),n=i(65447);function o(e,t){const i=Object.create(Object.getPrototypeOf(e));for(const s of t)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var a=i(64222),l=i(43367),c=i(61389),h=i(18437),d=i(58738);let u;class p extends d.DialogRenderer{constructor(){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(){this._load().then(e=>e.show())}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return u||(u=new p),u}_load(){return Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3894),i.e(3996),i.e(8193),i.e(7936),i.e(8604),i.e(2359),i.e(9843),i.e(6637),i.e(7400),i.e(5984),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7962),i.e(7703),i.e(7799),i.e(4862)]).then(i.bind(i,72651)).then(e=>{var t,i;return null===(t=this._dialog)||void 0===t||t.hide(),null===(i=this._dialog)||void 0===i||i.visible().unsubscribe(this._subscribe),this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog})}}var _=i(47903),m=i(45053),g=i(2073);var f=i(67945),v=i(17e3),S=i(69881),y=i(11092),b=i(47329),w=i(55663),P=i(72927),C=i(53312),T=i(90963),x=i(87910),I=i(7532),M=i(10288),L=i(23221),A=i(57296),k=i(21698),E=i(15521),D=i(81262),V=i(43492),B=i(29448),N=i(16932),R=i(55430),O=i(79204),F=i(99182),W=i(5025),H=i(92137),z=i(73395),U=i(87438),j=i(54837),G=i(65726),q=i(57968),Y=i(25292),$=i(28429) ;class K{constructor(){this._width=null,this._currencyInfo=null,this._unitInfo=null,this._fontSize=0,this._currencyAndUnitLabelsWrapper=document.createElement("div"),this._currencyAndUnitLabelsWrapper.className=$["price-axis-currency-label-wrapper"],this._controlsContainer=document.createElement("table"),this._controlsContainer.className=$["price-axis-currency-label"],this._currencyAndUnitLabelsWrapper.appendChild(this._controlsContainer),this._currencyLabelTr=document.createElement("tr"),this._currencyLabelTr.className=$["price-axis-currency-label-dropdown"],this._currencyLabelTr.classList.add("apply-common-tooltip"),(0,G.setTooltipData)(this._currencyLabelTr,"text",e=>this._currencyTooltipContent());const e=document.createElement("td");this._currencyText=document.createElement("span"),this._currencyText.className=$["price-axis-currency-label-text"],e.appendChild(this._currencyText),this._currencyLabelTr.appendChild(e);const t=document.createElement("td");this._currencyArrowDown=document.createElement("span"),this._currencyArrowDown.className=$["price-axis-currency-label-arrow-down"],this._currencyArrowDown.innerHTML=Y,t.appendChild(this._currencyArrowDown),this._currencyLabelTr.appendChild(t),this._unitLabelTr=document.createElement("tr"),this._unitLabelTr.className=$["price-axis-currency-label-dropdown"],this._unitLabelTr.classList.add("apply-common-tooltip"),(0,G.setTooltipData)(this._unitLabelTr,"text",e=>this._unitTooltipContent());const i=document.createElement("td");this._unitText=document.createElement("span"),this._unitText.className=$["price-axis-currency-label-text"],i.appendChild(this._unitText),this._unitLabelTr.appendChild(i);const s=document.createElement("td");this._unitArrowDown=document.createElement("span"),this._unitArrowDown.className=$["price-axis-currency-label-arrow-down"],this._unitArrowDown.innerHTML=Y,s.appendChild(this._unitArrowDown),this._unitLabelTr.appendChild(s),this._controlsContainer.appendChild(this._currencyLabelTr),this._controlsContainer.appendChild(this._unitLabelTr),this.hideCurrency(),this.hideUnit()}element(){return this._currencyAndUnitLabelsWrapper}currencyLabelElement(){return this._currencyLabelTr}unitLabelElement(){return this._unitLabelTr}isVisible(){return this.currencyLabelVisible()||this.unitLabelVisible()}width(){if(null!==this._width)return this._width;let e=0;if(this.currencyLabelVisible()){const t=this._currencyLabelTr.getBoundingClientRect();e=Math.max(e,t.right-t.left+1+8)}if(this.unitLabelVisible()){const t=this._unitLabelTr.getBoundingClientRect();e=Math.max(e,t.right-t.left+1+8)}return this._width=e,e}drawLabel(e,t,i,s){if(!this.isVisible())return;const r=this.currencyLabelVisible()?this._currencyText.textContent||"":this._unitText.textContent||"",n=this._unitText.textContent||"";e.font=(0,z.makeFont)(this._fontSize,j.CHART_FONT_FAMILY);const o=new H.TextWidthCache,a=2*Number($.css_value_currency_label_text_horizontal_padding)+Math.max(o.measureText(e,r),o.measureText(e,n)),l=o.yMidCorrection(e,r),c=o.yMidCorrection(e,n),h=Math.round(t/2*i),d=(0, q.ceiledEven)(a*i/2),u=this._controlsContainer.style,p=Math.round(this.labelTop()*i),_=Math.round(this.labelBottom()*i),m=_-p,g=Math.round(Number($.css_value_currency_label_radius)*i);(0,R.drawRoundRect)(e,h-d,p,2*d,m,g),e.fillStyle=u.backgroundColor,e.fill();const f=Math.max(1,Math.floor(i));e.lineWidth=f,e.strokeStyle=s?$.css_value_border_color_dark:$.css_value_border_color_light,(0,R.drawRoundRect)(e,h-d+f/2,p+f/2,2*d-f,m-f,g),e.stroke();const v=p+(_-p-1)/2,S=this._isMultiLine();S&&(0,R.drawHorizontalLine)(e,Math.floor(v+f/2),h-d,h+d);const y=this._oneLineHeight()/2*i,b=S?Math.ceil(v-y):v,w=Math.ceil(v+y);e.fillStyle=u.color,e.textBaseline="middle",e.textAlign="center",(0,N.drawScaled)(e,i,()=>e.fillText(r,h/i,(b+l)/i)),S&&(0,N.drawScaled)(e,i,()=>e.fillText(n,h/i,(w+c)/i))}showCurrency(){this._currencyLabelTr.classList.remove("js-hidden"),this._width=null,this._updateMultiLine(),this._updateVisibility()}hideCurrency(){this._currencyLabelTr.classList.add("js-hidden"),this._width=null,this._updateMultiLine(),this._updateVisibility()}showUnit(){this._unitLabelTr.classList.remove("js-hidden"),this._width=null,this._updateMultiLine(),this._updateVisibility()}hideUnit(){this._unitLabelTr.classList.add("js-hidden"),this._width=null,this._updateMultiLine(),this._updateVisibility()}currencyLabelVisible(){return!this._currencyLabelTr.classList.contains("js-hidden")}unitLabelVisible(){return!this._unitLabelTr.classList.contains("js-hidden")}setCurrencyInfo(e){if(this._currencyInfo===e)return!1;this._currencyInfo=e;const t=null===e.selectedCurrency?(0,r.t)("Mixed"):(0,s.ensureDefined)(e.displayedValues.get(e.selectedCurrency));return this._currencyText.textContent!==t&&(this._currencyText.textContent=t,this._width=null),this._currencyArrowDown.classList.contains("js-hidden")!==e.readOnly&&(this._currencyArrowDown.classList.toggle("js-hidden",e.readOnly),this._currencyLabelTr.classList.toggle($.readonly,e.readOnly),this._width=null),!0}setUnitInfo(e){if(null!==this._unitInfo&&this._unitInfo.selectedUnit===e.selectedUnit&&0===this._unitInfo.availableGroups.size==(0===e.availableGroups.size)&&this._unitInfo.originalUnits.size===e.originalUnits.size)return this._unitInfo=e,!1;this._unitInfo=e;const t=null===e.selectedUnit?(0,r.t)("Mixed"):(0,s.ensureDefined)(e.names.get(e.selectedUnit));return this._unitText.textContent!==t&&(this._unitText.textContent=t,this._width=null),this._unitArrowDown.classList.contains("js-hidden")!==(0===e.availableGroups.size)&&(this._unitArrowDown.classList.toggle("js-hidden",0===e.availableGroups.size),this._unitLabelTr.classList.toggle($.readonly,0===e.availableGroups.size),this._width=null),!0}updateColors(e,t){const i=this._controlsContainer.style;i.background=e,i.color=t}currencyInfo(){return this._currencyInfo}unitInfo(){return this._unitInfo}setFontSize(e){this._fontSize!==e&&(this._fontSize=e,this._currencyLabelTr.style.fontSize=e+"px",this._unitLabelTr.style.fontSize=e+"px",this._width=null,this._setLineHeight(this._oneLineHeight()))}labelTop(){return Number($.css_value_currency_label_top)} labelBottom(){const e=this.labelTop(),t=this._oneLineHeight();let i=e+t;return this._isMultiLine()&&(i+=t+1),i}_currencyTooltipContent(){const e=this._currencyInfo;return null===e?"":null===e.selectedCurrency?Array.from(e.currencies).map(t=>(0,s.ensureDefined)(e.displayedValues.get(t))).join(", "):""}_unitTooltipContent(){const e=this._unitInfo;return null===e?"":null===e.selectedUnit?Array.from(e.units).map(t=>(0,s.ensureDefined)(e.names.get(t))).join(", "):e.descriptions.get(e.selectedUnit)||""}_setLineHeight(e){this._currencyLabelTr.style.lineHeight=e+"px",this._unitLabelTr.style.lineHeight=e+"px"}_updateMultiLine(){this._controlsContainer.classList.toggle($.multiline,this._isMultiLine())}_updateVisibility(){this._currencyAndUnitLabelsWrapper.classList.toggle("js-hidden",!this.isVisible())}_oneLineHeight(){return 7+this._fontSize}_isMultiLine(){return this.unitLabelVisible()&&this.currencyLabelVisible()}}async function X(e,t,s){const[r,n]=await Promise.all([Promise.all([i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(3996),i.e(3708),i.e(6473),i.e(3537),i.e(339),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(3590),i.e(2704)]).then(i.bind(i,23412)),t()]);return r.showUnitConversion(e,s,n)}var Z=i(6799);function J(e,t){let{deltaX:i,deltaY:s}=e;switch(i/=100,s/=100,t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,s*=120;break;case t.DOM_DELTA_LINE:i*=32,s*=32}return{deltaX:i,deltaY:s}}class Q{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset(),this._totalDeltaX+=e.deltaX,this._totalDeltaY+=e.deltaY,this._prevWheelTime=e.timeStamp;const t={deltaX:e.deltaX,deltaY:e.deltaY};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(t.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(t.deltaX=0)),J(t,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var ee=i(42998),te=i(28745),ie=i(43434),se=i(27490),re=i(21209),ne=i(46374),oe=i(97033);i(95411);const ae=new T.TranslatedString("change no overlapping labels",(0,r.t)("change no overlapping labels")),le=(0,r.t)("Merge all scales into one"),ce=(0,r.t)("Labels"),he=(0,r.t)("Currencies"),de=(0,r.t)("Units"),ue=(0,r.t)("Reset price scale"),pe=(0,r.t)("Auto (fits data to screen)"),_e=(0,r.t)("Percent",{context:"scale_menu"}),me=(0,r.t)("Indexed to 100",{context:"scale_menu"}),ge=(0,r.t)("Logarithmic",{context:"scale_menu"}),fe=(0,r.t)("Regular",{context:"scale_menu"}),ve=(0,r.t)("No overlapping labels",{context:"scale_menu"}),Se=(0,r.t)("Invert scale",{context:"scale_menu"});const ye=function(e){const t=new ie.LimitedPrecisionNumericFormatter(e);return(e,i)=>(0,_.isNumber)(i)&&!e.isLog()?t.format(i):""}(4),be={contextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,contextMenu:{general:!0,source:!0},pressedMouseMoveScale:!0,mouseWheelScale:!0,pinchScale:!0,croppedTickMarks:!0};class we{constructor(e,t,i,s,r,n,o,a,l){this._actions=null,this._priceScale=null, this._widthCache=new H.TextWidthCache(1e3),this._color=null,this._fontSize=null,this._currencyFontSize=0,this._currencyLabelWidth=null,this._isVisible=!0,this._updateTimeout=null,this._currencyMenu=null,this._unitMenu=null,this._prevOptimalWidth=0,this._size=new N.Size(-1,-1),this._currentCursorClassName="",this._destroyed=!1,this._highlighted=!1,this._mouseWheelHelper=null,this._dragScaleActive=!1,this._offset=NaN,this._pinching=!1,this._chart=e,this._pane=t,this._undoModel=i,this._properties=s,this._isLeft="left"===n,this._options=(0,_.merge)((0,_.clone)(be),o),this._rendererOptionsProvider=r,this._backgroundBasedTheme=l,this._cell=document.createElement("div"),this._cell.className="price-axis",this._cell.style.width="25px",this._cell.style.left="0",this._canvasConfiguredHandler=()=>{this._undoModel.model().lightUpdate()},this._canvasBinding=(0,N.createBoundCanvas)(this._cell,new N.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const c=this._canvasBinding.canvas;c.style.position="absolute",c.style.zIndex="1",c.style.left="0",c.style.top="0",this._topCanvasConfiguredHandler=()=>this._undoModel.model().lightUpdate(),this._topCanvasBinding=(0,N.createBoundCanvas)(this._cell,new N.Size(16,16)),this._topCanvasBinding.subscribeCanvasConfigured(this._topCanvasConfiguredHandler);const h=this._topCanvasBinding.canvas;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this._mouseEventHandler=new B.MouseEventHandler(this._cell,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._options.currencyConversionEnabled||this._options.unitConversionEnabled?(this._currencyLabel=new K,this._cell.appendChild(this._currencyLabel.element())):this._currencyLabel=null,this._properties.childs().fontSize.subscribe(this,this._onFontSizeChanged),this._options.mouseWheelScale&&(this._mouseWheelHelper=new Q,this._cell.addEventListener("wheel",this._onMousewheel.bind(this),{passive:!1})),this._axisInfo=a,this._offset=0,this.restoreDefaultCursor(),this.update()}getContextMenuActions(){this._initActions();const e=(0,s.ensureNotNull)(this._actions),t=this._chart.actions(),i=[];return i.push(e.reset,new ne.Separator,this._autoScaleAction()),this._isMainSeriesAxis()&&i.push(this._lockScaleAction()),i.push(t.scaleSeriesOnly,this._invertAction(),new ne.Separator,this._regularScaleAction(),this._percentageAction(),this._indexedTo100Action(),this._logAction(),new ne.Separator),l.CheckMobile.any()||(i.push(this._createMergeScalesAction()),i.push(new ne.Separator)),se.enabled("fundamental_widget")||i.push(new ne.Action({actionId:"Chart.PriceScale.Labels",label:ce,subItems:[t.showSymbolLabelsAction,t.showSeriesLastValue,null,null,t.showHighLowAverageClosePriceLabels,null,t.showStudyPlotNamesAction,t.showStudyLastValue,e.alignLabels].filter(Boolean)})),i.push((0,re.createLinesAction)(this._chart)),this._options.countdownEnabled&&i.push(t.showCountdown),this._options.currencyConversionEnabled&&i.push(t.showCurrency), this._options.unitConversionEnabled&&i.push(t.showUnit),this._undoModel.crossHairSource().isMenuEnabled()&&i.push(t.addPlusButton),!(0,l.onWidget)()&&se.enabled("show_chart_property_page")&&se.enabled("chart_property_page_scales")&&t.scalesProperties&&i.push(new ne.Separator,t.scalesProperties),i}getElement(){return this._cell}onOptimalWidthNeedToBeRecalculated(e){const t=this.optimalWidth();(this._prevOptimalWidth{this._undoModel.model().fullUpdate(),this._updateTimeout=null},100)),this._prevOptimalWidth=t}optimalWidth(){var e;if(!this.isVisible())return 0;let t=0;const i=this.rendererOptions();if(this._pane.hasState()){const i=(0,N.getContext2D)(this._canvasBinding.canvas);(0,W.setFont)(i,this.baseFont());const s=this.backLabels(!0);for(let e=s.length;e--;){if(!s[e].isAxisLabelVisible())continue;const r=this._widthCache.measureText(i,s[e].text());t=Math.max(t,r);const n=s[e].secondLineText();n&&(t=Math.max(t,this._widthCache.measureText(i,n)));const o=s[e].thirdLineText();o&&(t=Math.max(t,this._widthCache.measureText(i,o)))}const r=this.priceScale(),n=r.marks();n.length>0&&(t=Math.max(t,this._widthCache.measureText(i,n[0].label),this._widthCache.measureText(i,n[n.length-1].label)));const o=(null===(e=r.mainSource())||void 0===e?void 0:e.firstValue())||null;if(null!==o){const e=r.coordinateToPrice(1,o),s=r.coordinateToPrice(this._size.h-2,o);t=Math.max(t,this._widthCache.measureText(i,r.formatPrice(Math.floor(Math.min(e,s))+.11111111111111,o)),this._widthCache.measureText(i,r.formatPrice(Math.ceil(Math.max(e,s))-.11111111111111,o)))}}let r=0;this._isCurrencyLabelVisible()&&(null===this._currencyLabelWidth&&(this._currencyLabelWidth=(0,s.ensureNotNull)(this._currencyLabel).width()),r=this._currencyLabelWidth);const n=t||34;let o=Math.max(r,Math.ceil(i.borderSize+i.offsetSize+i.paddingInner+i.paddingOuter+n+4));return o+=o%2,o}backLabels(e){const t=[],i=this._grouppedSources(),s=s=>{for(const r of s){if(!e&&i.topLevelSources.has(r))continue;const s=r.priceAxisViews(this._pane.state(),this.priceScale());if(s)for(const e of s)t.push(e)}};return s(i.sources),s(this._pane.state().customSources()),t}setSizeAndOffset(e,t){if(e.w<0||e.h<0)throw new Error("Try to set invalid size to PriceAxisWidget "+JSON.stringify(e));this._size.equals(e)||(this._size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._topCanvasBinding.resizeCanvas({width:e.w,height:e.h}),this._cell.style.width=e.w+"px",this._cell.style.height=e.h+"px",this._cell.style.minWidth=e.w+"px"),this._offset!==t&&(this._offset=t,this._cell.style.left=t+"px")}getWidth(){return this._size.w}getImage(){const e=this._size,t=(0,N.createDisconnectedCanvas)(document,e);if((0,N.getPrescaledContext2D)(t).drawImage(this._canvasBinding.canvas,0,0,e.w,e.h),null!==this._currencyLabel&&this._currencyLabel.isVisible()){const i=this._undoModel.model().isDark();this._currencyLabel.drawLabel((0,N.getContext2D)(t),e.w,(0,N.getCanvasDevicePixelRatio)(t),i)}return t}update(){}paint(e){ if(this._isVisible&&e!==b.InvalidationLevel.None){if(e>b.InvalidationLevel.Cursor){const e=(0,N.getContext2D)(this._canvasBinding.canvas);this._alignLabels(),this._drawBackground(e,this._canvasBinding.pixelRatio),this._drawBorder(e,this._canvasBinding.pixelRatio),this._pane.hasState()&&(this.updateCurrencyLabel(),this._drawTickMarks(e,this._canvasBinding.pixelRatio),this._drawBackLabels(e,this._canvasBinding.pixelRatio))}if(this._pane.hasState()){const e=(0,N.getContext2D)(this._topCanvasBinding.canvas),t=this._topCanvasBinding.pixelRatio;e.clearRect(0,0,Math.ceil(this._size.w*t)+1,Math.ceil(this._size.h*t)+1),this._drawCrossHairLabel(e,t)}}}restoreDefaultCursor(){this._setCursor("")}priceScale(){return(0,s.ensureNotNull)(this._priceScale)}setPriceScale(e){this._priceScale!==e&&(null!==this._priceScale&&(this._priceScale.onMarksChanged().unsubscribe(this,this.onOptimalWidthNeedToBeRecalculated),this._priceScale.modeChanged().unsubscribeAll(this)),this._priceScale=e,null!==e&&(e.onMarksChanged().subscribe(this,this.onOptimalWidthNeedToBeRecalculated),e.modeChanged().subscribe(this,()=>this.onOptimalWidthNeedToBeRecalculated(!0))))}isVisible(){return this._isVisible}setVisible(e){(e=!!e)!==this._isVisible&&(this._cell.style.display=e?"table-cell":"none",this._isVisible=e)}destroy(){null!==this._currencyMenu&&(this._currencyMenu.close(),this._currencyMenu=null),null!==this._unitMenu&&(this._unitMenu.close(),this._unitMenu=null),this._topCanvasBinding.unsubscribeCanvasConfigured(this._topCanvasConfiguredHandler),this._topCanvasBinding.destroy(),this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),null!==this._priceScale&&(this._priceScale.onMarksChanged().unsubscribe(this,this.onOptimalWidthNeedToBeRecalculated),this._priceScale.modeChanged().unsubscribeAll(this)),this._priceScale=null,this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._mouseEventHandler.destroy(),this._properties.childs().fontSize.unsubscribe(this,this._onFontSizeChanged),null!==this._actions&&this._actions.reset&&this._actions.reset.destroy(),this._destroyed=!0}axisInfo(){return this._axisInfo}setHighlighted(e){this._highlighted=e}backgroundColor(){return this._pane.state().model().backgroundColor().value()}backgroundTopColor(){return this._pane.state().model().backgroundTopColor().value()}lineColor(){return this._properties.childs().lineColor.value()}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,z.makeFont)(this.fontSize(),j.CHART_FONT_FAMILY,"")}rendererOptions(){let e=this._rendererOptionsProvider.options();return this._color===e.color&&this._fontSize===e.fontSize||(this._color=e.color),this._fontSize!==e.fontSize&&(this._widthCache.reset(),this._fontSize=e.fontSize,this._currencyLabelWidth=null,this._currencyFontSize=0,this._updateCurrencyLabelFont(),this.onOptimalWidthNeedToBeRecalculated()),e}mouseEnterEvent(e){this._mouseEnterOrTouchStartEvent(e)} mouseMoveEvent(e){this._mouseOrTouchMoveEvent(e)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseOrTouchMoveEvent(e),this._mouseEnterOrTouchStartEvent(e),this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}pinchStartEvent(){}pinchEvent(e,t,i){if(this._zoomAvailable()&&this._options.pinchScale){if(this._dragScaleActive&&this._finishScale(),!this._pinching)return this._pinching=!0,void this._undoModel.startTwoPointsScalePrice(this._pane.state(),this.priceScale(),t.y,i.y);this._undoModel.twoPointsScalePriceTo(this._pane.state(),this.priceScale(),t.y,i.y)}}pinchEndEvent(){this._pinching=!1,this._undoModel.endTwoPointsScalePrice(this._pane.state(),this.priceScale())}mouseDownOutsideEvent(){this._finishScale()}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseLeaveOrTouchEndEvent(e),this._mouseUpOrTouchEndEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}mouseLeaveEvent(e){this._mouseLeaveOrTouchEndEvent(e)}mouseDoubleClickEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}doubleTapEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}contextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}touchContextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}dataSourceAtPoint(e,t){const i=this._grouppedSources(),s=[...i.sources,...i.topLevelSources,...this._pane.state().customSources()];let r=null,n=null;if(!this._priceScale)return null;const o=(e,t)=>{var i;const s=null!==(i=null==n?void 0:n.result())&&void 0!==i?i:0;e.result()>s&&(n=e,r=t)},a=new P.Point(e,t),l=this._pane.state();for(let e=s.length-1;e>=0;--e){const t=s[e],i=t.priceAxisViews(l,this._priceScale);if(i&&0!==i.length)for(let e=i.length-1;e>=0;--e){const s=i[e].renderer();if(void 0!==s.hitTest){const e=s.hitTest(a,this._size.w,this._isLeft?"left":"right");null!==e&&o(e,t)}}}return r}reset(){const e=this._pane.state(),t=this.priceScale();this._undoModel.resetPriceScale(e,t),this.onOptimalWidthNeedToBeRecalculated(!0)}sizeReady(){return this.getWidth()>=this.optimalWidth()&&null===this._updateTimeout}updateCurrencyLabel(){if(null===this._currencyLabel)return;let e=!1;if(this._options.currencyConversionEnabled){const t=this.priceScale().currency(this._undoModel.model().availableCurrencies());null!==t&&this._properties.childs().showCurrency.value()?(e=!this._currencyLabel.currencyLabelVisible(),this._currencyLabel.showCurrency(),this._currencyLabel.updateColors(this.backgroundTopColor(),this.textColor()),e=this._currencyLabel.setCurrencyInfo(t)||e):(e=this._currencyLabel.currencyLabelVisible(),this._currencyLabel.hideCurrency())}if(this._options.unitConversionEnabled){const t=this.priceScale().unit(this._undoModel.model().availableUnits());null!==t&&this._properties.childs().showUnit.value()?(e=e||!this._currencyLabel.unitLabelVisible(),this._currencyLabel.showUnit(),this._currencyLabel.updateColors(this.backgroundTopColor(),this.textColor()), e=this._currencyLabel.setUnitInfo(t)||e):(e=e||this._currencyLabel.unitLabelVisible(),this._currencyLabel.hideUnit())}this._updateCurrencyLabelFont(),e&&(this._currencyLabelWidth=null)}_grouppedSources(){var e;const t=this._pane,i=t.state().model(),s=this._sameSideSources().slice(),r=t.state(),n=this.priceScale(),o=new Set,a=null!==(e=i.lineBeingEdited())&&void 0!==e?e:i.lineBeingCreated();a&&o.add(a);const l=i.customSourceBeingMoved();null!==l&&o.add(l),i.sourcesBeingMoved().forEach(e=>o.add(e)),i.selection().allSources().forEach(e=>o.add(e));const c=i.hoveredSource();null!==c&&o.add(c);if(n===r.defaultPriceScale()){const e=this._pane.state().dataSources();for(const t of e)r.isOverlay(t)&&s.push(t)}return{sources:s,topLevelSources:o}}_isCurrencyLabelVisible(){return null!==this._currencyLabel&&this._currencyLabel.isVisible()}_updateCurrencyLabelFont(){if(null===this._currencyLabel)return;const e=this.fontSize();e!==this._currencyFontSize&&(this._currencyLabel.setFontSize(e),this._currencyFontSize=e,this._currencyLabelWidth=null,this.onOptimalWidthNeedToBeRecalculated())}_alignLabels(){const e=this._size.h;let t=e/2;const i=[],s=this.priceScale(),r=s.orderedSources().slice(),n=this._pane.state(),o=this.rendererOptions();if(s===n.defaultPriceScale()){const e=n.priceDataSources();for(let t=0;t{if(t.ignoreAlignment()||!t.isVisible())return!1;const i=t.height(o),s=t.floatCoordinate();return s>-i&&se.floatCoordinate()<=t),c=i.filter(e=>e.floatCoordinate()>t);l.sort((e,t)=>t.floatCoordinate()-e.floatCoordinate()),l.length>0&&c.length>0&&c.push(l[0]),c.sort((e,t)=>e.floatCoordinate()-t.floatCoordinate());for(const e of i)e.setFixedCoordinate(e.coordinate());if(s.properties().childs().alignLabels.value()){for(let e=1;en-s&&t.setFixedCoordinate(n-s)}for(let e=1;e{if(this._options.croppedTickMarks)return{visible:!0,yCorrection:this._widthCache.yMidCorrection(e,t.label)};const i=t.coord-a/2,s=t.coord+a/2,r=!(s>this._size.h||ithis._size.h||i{for(let s=i.length;s--;){if(!c[s].visible)continue;const r=i[s];e.fillText(r.label,o/t,r.coord+c[s].yCorrection)}}),e.restore()}_hasAlertLabel(){return!1}_showCurrenciesContextMenu(){if(null!==this._currencyMenu&&this._currencyMenu.isOpened())return void this._currencyMenu.close();(0,U.trackEvent)("GUI","Currency conversion");X(he,()=>async function(e,t,s){return(await Promise.all([i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(3996),i.e(3708),i.e(6473),i.e(3537),i.e(339),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(3590),i.e(2704)]).then(i.bind(i,99207))).currencyActions(e,t,s)}(this._undoModel,(0,s.ensureNotNull)(this._currencyLabel).currencyInfo(),this.priceScale()),(0,s.ensureNotNull)(this._currencyLabel).currencyLabelElement()).then(e=>{this._destroyed?e.close():this._currencyMenu=e})}_showUnitsContextMenu(){if(null!==this._unitMenu&&this._unitMenu.isOpened())return void this._unitMenu.close();(0,U.trackEvent)("GUI","Unit conversion");X(de,()=>async function(e,t,s){return(await Promise.all([i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(3996),i.e(3708),i.e(6473),i.e(3537),i.e(339),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(3590),i.e(2704)]).then(i.bind(i,10768))).unitActions(e,t,s)}(this._undoModel,(0,s.ensureNotNull)(this._currencyLabel).unitInfo(),this.priceScale()),(0,s.ensureNotNull)(this._currencyLabel).unitLabelElement()).then(e=>{this._destroyed?e.close():this._unitMenu=e})}_onFontSizeChanged(){this._currencyLabelWidth=null,this._currencyFontSize=0,this._updateCurrencyLabelFont(),this.onOptimalWidthNeedToBeRecalculated()}_mouseOrTouchMoveEvent(e){if(!this._priceScale)return;this.dataSourceAtPoint(e.localX,e.localY)?this._setCursorClassName("pointer"):this._setResizeCursor()}_mouseDownOrTouchStartEvent(e){this._zoomAvailable()&&this._options.pressedMouseMoveScale&&!this._pinching&&(this._dragScaleActive=!0,this._undoModel.startScalePrice(this._pane.state(),this.priceScale(),e.localY))}_mouseEnterOrTouchStartEvent(e){this._setResizeCursor()}_pressedMouseOrTouchMoveEvent(e){if(this._dragScaleActive){const t=this.priceScale();this._undoModel.scalePriceTo(this._pane.state(),t,e.localY)}}_mouseUpOrTouchEndEvent(e){this._finishScale()}_finishScale(){this._dragScaleActive&&(this._undoModel.endScalePrice(this._pane.state(),this.priceScale()),this.restoreDefaultCursor(),this._dragScaleActive=!1)}_mouseClickOrTapEvent(e){if(this._currencyLabel){if(this._currencyLabel.currencyLabelElement().contains(e.target))return void this._showCurrenciesContextMenu();if(this._currencyLabel.unitLabelElement().contains(e.target))return void this._showUnitsContextMenu()}const t=this.dataSourceAtPoint(e.localX,e.localY);t&&this._undoModel.selectionMacro(e=>{e.selection().isSelected(t)||(e.clearSelection(),e.addSourceToSelection(t))})}_mouseLeaveOrTouchEndEvent(e){this._setCursorClassName("")}_mouseDoubleClickOrDoubleTapEvent(e){const t=this.dataSourceAtPoint(e.localX,e.localY);t?this._pane.processDoubleClickOnSource(t):(this.reset(),(0,U.trackEvent)("GUI","Double click price scale"))} _contextMenuOrTouchContextMenuEvent(e){if(this._options.contextMenuEnabled){const t=this.dataSourceAtPoint(e.localX,e.localY);if(null!==t&&this._options.contextMenu.source){return void this._undoModel.model().selectionMacro(i=>{i.selection().isSelected(t)||(i.clearSelection(),i.addSourceToSelection(t)),this._pane.showContextMenuForSelection(e)})}this._options.contextMenu.general&&Z.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"PriceScaleContextMenu"},{menuName:"PriceScaleContextMenu"})}}_setResizeCursor(){const e=this.priceScale();e.isPercentage()||e.isIndexedTo100()?this._setCursorClassName(""):this._zoomAvailable()&&(this._options.pressedMouseMoveScale||this._options.mouseWheelScale)&&this._setCursorClassName("ns-resize")}_setCursorClassName(e){let t="";e&&(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t)}_zoomAvailable(){return!this.priceScale().isEmpty()&&this._undoModel.model().zoomEnabled()}_onMousewheel(e){if(!this._zoomAvailable()||!this._options.mouseWheelScale)return;const t=(0,s.ensureNotNull)(this._mouseWheelHelper).processWheel(e).deltaY;if(0===t)return;e.cancelable&&e.preventDefault();const i=this._undoModel,r=this._pane.state(),n=this.priceScale(),o=this._cell.getBoundingClientRect(),a=e.clientY-o.top,l=a+15*t;i.startScalePrice(r,this.priceScale(),a,!0),i.scalePriceTo(r,n,l),i.endScalePrice(r,n),e.stopPropagation()}_drawCrossHairLabel(e,t){var i,s;e.save();const r=this._pane.state(),n=r.model(),o=this.priceScale(),a=[],l=this.priceScale()===r.defaultPriceScale(),c=null!==(i=n.lineBeingEdited())&&void 0!==i?i:n.lineBeingCreated();if(c&&(c.priceScale()===o||l&&r.isOverlay(c))){const e=c.priceAxisViews(r,o);e&&e.length&&a.push(e)}const h=n.customSourceBeingMoved();this._addViewsOrMaxMin(null===h?[]:[h],a),this._addViewsOrMaxMin(n.sourcesBeingMoved(),a),this._addViewsOrMaxMin(n.selection().allSources(),a);const d=n.hoveredSource();if(d){const e=r.customSources().includes(d)?o:d.priceScale();if(!n.selection().isSelected(d)&&(this._isFromSameSide(e)||l&&r.isOverlay(d))){const e=null===(s=n.hoveredSource())||void 0===s?void 0:s.priceAxisViews(r,o);e&&e.length&&a.push(e)}}const u=n.crossHairSource().priceAxisViews(r,o);u&&u.length&&a.push(u);const p=this.rendererOptions(),_=this._isLeft?"right":"left";a.forEach(i=>{i.forEach(i=>{e.save(),i.renderer().draw(e,p,this._widthCache,this._size.w,this._size.h,_,t),e.restore()})}),e.restore()}_drawBackground(e,t){const i=Math.ceil(this._size.w*t),s=Math.ceil(this._size.h*t),r=this.backgroundTopColor(),n=this.backgroundColor();if(r===n?(0,N.clearRect)(e,0,0,i+1,s+1,this.backgroundColor()):(0,R.clearRectWithGradient)(e,0,0,i+1,s+1,r,n),this._highlighted){e.globalAlpha=.5;const t=F.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight");(0,N.fillRect)(e,0,0,i+1,s+1,t),e.globalAlpha=1} const o=this._pane.state().model(),a=this.priceScale(),l=o.selection().lineDataSources().filter(e=>e.priceScale()===a).reduce((e,t)=>{const i=t.priceAxisPoints();return 0===i.length?e:e.concat(i)},[]);l.length>0&&this._hightlightBackground(e,l,this.priceScale().mainSource(),t);const c=o.crossHairSource();c.startMeasurePoint()&&this._hightlightBackground(e,c.measurePoints(),this.priceScale().mainSource(),t)}_drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t)),s=this._isLeft?Math.floor(this._size.w*t)-i:0;e.fillRect(s,0,i,Math.ceil(this._size.h*t)+1),e.restore()}_drawBackLabels(e,t){e.save();const i=this.backLabels(),s=this.rendererOptions(),r=this._isLeft?"right":"left";for(const n of i)n.isAxisLabelVisible()&&(e.save(),n.renderer().draw(e,s,this._widthCache,this._size.w,this._size.h,r,t),e.restore());e.restore()}_hightlightBackground(e,t,i,s){if(!i)return;const r=i.firstValue();if(null===r)return;let n=t[0].price,o=t[0].price;for(let e=1;ei.isOverlay(e)||this._isFromSameSide(e.priceScale()))),0!==e.length)if(1===e.length){const r=e[0].priceAxisViews(i,s);r&&r.length&&t.push(r)}else t.push(this._minMaxViews(e))}_minMaxViews(e){const t=this._pane.state(),i=this.priceScale(),s=[];let r=1/0,n=-1/0,o=null,a=null;for(const s of e){const e=s.priceAxisViews(t,i);if(e&&e.length)for(let t=0;t=n&&(n=s,a=i),s<=r&&(r=s,o=i)}}return a&&s.push(a),o&&s.push(o),s}_isFromSameSide(e){return null!==e&&(this._isLeft?this._pane.state().leftPriceScales():this._pane.state().rightPriceScales()).includes(e)}_sameSideSources(){const e=this._pane.state().sourcesByGroup();return this._isLeft?e.leftPriceScalesSources():e.rightPriceScalesSources()}_initActions(){if(!this._pane.hasState()||null!==this._actions)return;const e=this._undoModel,t=new ne.Action({actionId:"Chart.PriceScale.Reset",label:ue,icon:oe,shortcutHint:(0,ee.humanReadableHash)(ee.Modifiers.Alt+82),statName:"ResetScale",onExecute:()=>this.reset()}),i=new ne.Action({actionId:"Chart.PriceScale.ToggleAutoScale",label:pe,checkable:!0,checked:!0,statName:"ToggleAutoScale",onExecute:()=>{e.togglePriceScaleAutoScaleMode(this.priceScale()),this._updateScalesActions()}}),s=new ne.Action({actionId:"Chart.PriceScale.TogglePercentage",label:_e,checkable:!0,checked:this.priceScale().isPercentage(),statName:"TogglePercantage",onExecute:()=>{e.togglePriceScalePercentageScaleMode(this.priceScale()),this._updateScalesActions()}}),r=new ne.Action({actionId:"Chart.PriceScale.ToggleIndexedTo100",label:me,checkable:!0,checked:this.priceScale().isIndexedTo100(), statName:"ToggleIndexedTo100",onExecute:()=>{e.togglePriceScaleIndexedTo100ScaleMode(this.priceScale()),this._updateScalesActions()}}),n=new ne.Action({actionId:"Chart.PriceScale.ToggleLogarithmic",label:ge,checkable:!0,checked:this.priceScale().isLog(),statName:"ToggleLogScale",onExecute:()=>{e.togglePriceScaleLogScaleMode(this.priceScale()),this._updateScalesActions()}}),o=new ne.Action({actionId:"Chart.PriceScale.ToggleRegular",label:fe,checkable:!0,checked:this.priceScale().isRegular(),statName:"ToggleRegularScale",onExecute:()=>{e.setPriceScaleRegularScaleMode(this.priceScale()),this._updateScalesActions()}}),a=new ne.Action({actionId:"Chart.PriceScale.Labels.ToggleNoOverlappingLabelsVisibility",label:ve,checkable:!0,checked:this.priceScale().properties().childs().alignLabels.value(),statName:"TogglePreciseLabels"});a.setBinding(new te.ActionBinder(a,this.priceScale().properties().childs().alignLabels,e,ae));const l=new ne.Action({actionId:"Chart.PriceScale.ToggleInvertScale",label:Se,checkable:!0,checked:this.priceScale().isInverted(),statName:"Invert Scale",onExecute:()=>{e.invertPriceScale(this.priceScale()),this._updateScalesActions()}});this._actions={reset:t,setAutoScale:i,setPercentage:s,setIndexedTo100:r,setLog:n,setRegular:o,alignLabels:a,invertScale:l},this._updateScalesActions()}_logAction(){return this._isMainSeriesAxis()?this._chart.actions().logSeriesScale:(0,s.ensureNotNull)(this._actions).setLog}_percentageAction(){return this._isMainSeriesAxis()?this._chart.actions().percentSeriesScale:(0,s.ensureNotNull)(this._actions).setPercentage}_indexedTo100Action(){return this._isMainSeriesAxis()?this._chart.actions().indexedTo100SeriesScale:(0,s.ensureNotNull)(this._actions).setIndexedTo100}_autoScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().autoSeriesScale:(0,s.ensureNotNull)(this._actions).setAutoScale}_regularScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().regularSeriesScale:(0,s.ensureNotNull)(this._actions).setRegular}_lockScaleAction(){const e=this._chart.actions().lockSeriesScale,t=ye(this.priceScale(),this._undoModel.model().mainSeriesScaleRatio());return e.update({hint:t}),e}_invertAction(){return this._isMainSeriesAxis()?this._chart.actions().invertSeriesScale:(0,s.ensureNotNull)(this._actions).invertScale}_isMainSeriesAxis(){return this.priceScale().hasMainSeries()}_updateScalesActions(){const e=this.priceScale(),t=this._isMainSeriesAxis(),i=(0,s.ensureNotNull)(e.mainSource()).properties(),r=t&&e.isLockScale(),n=t&&6===i.style.value(),o=(0,s.ensureNotNull)(this._actions);o.setRegular.update({checked:e.isRegular(),disabled:r||n}),o.setPercentage.update({checked:e.isPercentage(),disabled:r||n}),o.setIndexedTo100.update({checked:e.isIndexedTo100(),disabled:r||n}),o.setLog.update({checked:e.isLog(),disabled:r||n}),o.setAutoScale.update({checked:e.isAutoScale(),disabled:e.properties().childs().autoScaleDisabled.value()})}_createMergeScalesAction(){const e=this._chart.actions(),t=this._undoModel.model().priceScaleSlotsCount() ;if(t.left+t.right===1)return 0===t.left?e.moveScaleToLeft:e.moveScaleToRight;const i=[];return i.push(e.mergeLeftScalesAction),i.push(e.mergeRightScalesAction),new ne.Action({actionId:"Chart.PriceScale.MergeAllScales",label:le,subItems:i})}_setCursor(e){let t="";"grabbing"!==e&&"ns-resize"!==e||(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}}function Pe(e,t){return e.position-t.position}function Ce(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}class Te{constructor(e,t,i,s){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._terminated=!1,this._minSpeed=e,this._maxSpeed=t,this._dumpingCoeff=i,this._minMove=s}addPosition(e,t){if(null!==this._position1){if(this._position1.time===t)return void(this._position1.position=e);if(Math.abs(this._position1.position-e)50)return;let i=0;const s=Ce(this._position1,this._position2,this._maxSpeed),r=Pe(this._position1,this._position2),n=[s],o=[r];if(i+=r,null!==this._position3){const e=Ce(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=Pe(this._position2,this._position3);if(n.push(e),o.push(t),i+=t,null!==this._position4){const e=Ce(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=Pe(this._position3,this._position4);n.push(e),o.push(t),i+=t}}}}let a=0;for(let e=0;ea&&(e.hittest=t,e.source=i,e.renderer=s,e.isCustom=r)}const rt={contextMenuEnabled:!0,contextMenu:re.defaultContextMenuOptions,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,controlsEnabled:!0,propertyPagesEnabled:!0,sourceSelectionEnabled:!0,countdownEnabled:!0},nt=new Map([[M.AreaName.Text,"Text"],[M.AreaName.Style,"Style"]]),ot=!se.enabled("display_legend_on_all_charts");class at{constructor(e,t,i,r){this._legendWidget=null,this._paneControls=null,this._isDestroyed=!1,this._trackCrosshairOnlyAfterLongTap=(0,x.lastMouseOrTouchEventInfo)().isTouch,this._startTrackPoint=null,this._exitTrackingModeOnNextTry=!1,this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._preventSourceChange=!1,this._clonningAtMoveLineTools=null,this._startCloningPoint=null,this._size=new N.Size(0,0),this._themedTopColor=null,this._initCrossHairPosition=null,this._firstZoomPoint=null,this._editDialog=null,this._processing=!1,this._touchMove=!1,this._startTouchPoint=null,this._isSelecting=!1,this._prevHoveredHittest=null,this._contextMenuX=0,this._contextMenuY=0,this._startScrollingPos=null,this._isScrolling=!1,this._scrollPriceScale=null,this._scrollXAnimation=null,this._scrollYAnimation=null,this._prevPinchScale=1,this._pinching=!1,this._wasPinched=!1,this._longTap=!1,this._contextMenuOpenedOnLastTap=!1,this._paneControlsResizeObserver=null,this._hideNotMainSourcesInLegendSpawn=null,this._hideWholeLegend=null,this._lastClickedSource=null,this._customLegendWidgetsFactoryMap=new Map,this._prevMoveEventPosition=null,this._onMagnetStateChangedListener=this._onMagnetStateChanged.bind(this),this._onShiftKeyStateChangedListener=this._onShiftKeyStateChanged.bind(this),this._currentCursorClassName="",this._lastFinishedToolId=null,this._needResetMeasureLater=!1,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._prevTooltipData=null,this._errorRenderer=null,this._highlightedPriceAxis=new(Ie())({owner:"",axis:null}),this._canvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._topCanvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._recalculateLegendVisibility=()=>{const e=(0, s.ensureNotNull)(this._hideWholeLegend),t=this._chartModel().crossHairSource().measurePane();null!==t?e.setValue(t===this._state):e.setValue((0,E.toolIsMeasure)(E.tool.value()))},this._chart=e,this._state=t,this._options=(0,_.merge)((0,_.clone)(rt),i),this._paneWidgetsSharedState=r,this._state&&(this._state.onDestroyed().subscribe(this,this._onStateDestroyed,!0),this._state.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged));const n={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(n.contextMenu=this._options.priceScaleContextMenu);const o=(e,t,i,s,r)=>new we(this._chart,this,this._chartUndoModel(),i,t,e,n,s,r),a=e.properties().childs().scalesProperties,l=this._chartModel().rendererOptionsProvider(),c={backgroundBasedTheme:e.backgroundBasedTheme(),rendererOptionsProvider:l,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value()},h={showLabels:!1};this._lhsPriceAxisesContainer=new O.PriceAxisesContainer(a,"left",o,c,h),this._rhsPriceAxisesContainer=new O.PriceAxisesContainer(a,"right",o,c,h),this._paneCell=document.createElement("td"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._div.setAttribute("data-name","pane-widget-chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=(0,N.createBoundCanvas)(this._div,new N.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const d=this._canvasBinding.canvas;d.style.position="absolute",d.style.left="0",d.style.top="0",this._topCanvasBinding=(0,N.createBoundCanvas)(this._div,new N.Size(16,16)),this._topCanvasBinding.subscribeCanvasConfigured(this._topCanvasConfiguredHandler);const u=this._topCanvasBinding.canvas;u.style.position="absolute",u.style.left="0",u.style.top="0",this._rowElement=document.createElement("tr"),this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(),(0,Re.magnetEnabled)().subscribe(this._onMagnetStateChangedListener),(0,Oe.shiftPressed)().subscribe(this._onShiftKeyStateChangedListener),this._paneCell.addEventListener("dragover",e=>{ e.dataTransfer&&Array.from(e.dataTransfer.files).some(blobImageFilter)&&e.preventDefault()}),this.setCursorForTool(),this._mouseEventHandler=new B.MouseEventHandler(this._topCanvasBinding.canvas,this,{treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag}),this._prevHoveredHittest=null,this._highlightedPriceAxis.subscribe(e=>this._highlightPriceAxisByLabel(e.axis)),this._prevPinchScale=0,this._isDestroyed=!1}destroy(){var e;this._chart.onPaneWidgetDestroyed(this),this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeCanvasConfigured(this._topCanvasConfiguredHandler),this._topCanvasBinding.destroy(),this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),null!==this._hideNotMainSourcesInLegendSpawn&&this._hideNotMainSourcesInLegendSpawn.destroy(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&(this.state().onDestroyed().unsubscribeAll(this),this.state().dataSourcesCollectionChanged().unsubscribeAll(this)),(0,Re.magnetEnabled)().unsubscribe(this._onMagnetStateChangedListener),(0,Oe.shiftPressed)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this),null!==this._hideWholeLegend&&(E.tool.unsubscribe(this._recalculateLegendVisibility),this._chartModel().crossHairSource().measuringEnabled().unsubscribeAll(this)),this._errorRenderer&&this._errorRenderer.then(e=>{e.destroy(),this._errorRenderer=null}),this._prevHoveredHittest=null,this._mouseEventHandler.destroy(),null===(e=this._rowElement.parentElement)||void 0===e||e.removeChild(this._rowElement),this._isDestroyed=!0}size(){return this._size}setSize(e){(0,s.assert)(e.w>=0&&e.h>=0,"Try to set invalid size to PaneWidget "+JSON.stringify(e)),this._size.equals(e)||(this._size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._topCanvasBinding.resizeCanvas({width:e.w,height:e.h}),this._paneCell.style.width=e.w+"px",this._paneCell.style.height=e.h+"px",this._div.style.width=e.w+"px",this._div.style.height=e.h+"px",this._rowElement.classList.toggle("js-hidden",0===e.h),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.w))}width(){return this._size.w}height(){return this._size.h}backgroundColor(){return this._chartModel().backgroundColor().value()}highlightedPriceAxis(){return this._highlightedPriceAxis}processDoubleClickOnSource(e,t){(0,k.isDataSource)(e)&&e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}stretchFactor(){return this._state?this._state.stretchFactor():0}setStretchFactor(e){this.hasState()&&this.state().setStretchFactor(e)} setCursorForTool(e,t,i){if(t&&t.control()&&e)return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case Ve.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case Ve.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case Ve.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case Ve.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case Ve.PaneCursorType.Default:this._setCursorClassName("default");break;case Ve.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case Ve.PaneCursorType.Grabbing:this._setCursorClassName("grabbing")}return}const s=E.tool.value();if((0,E.toolIsCursor)(s)){if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}if("eraser"===s)return void this._setCursorClassName("eraser");if("zoom"===s)return void this._setCursorClassName("zoom-in");const r=E.cursorTool.value();"dot"!==r?"arrow"!==r?this._setCursorClassName(""):this._setCursorClassName("default"):this._setCursorClassName("dot")}showContextMenuForSelection(e){const t=this._chartUndoModel().selection();if(t.isEmpty())return;const i=t.dataSources().filter(e=>e.hasContextMenu());this.showContextMenuForSources(i,e)}async showContextMenuForSources(e,t,i){var s;if(!e.length)return Promise.resolve(null);const r=e[0],n=(0,_.merge)((0,_.clone)(this._options.contextMenu),i||{}),o=new re.ActionsProvider(this._chart,n);if(r===this._chartUndoModel().crossHairSource())return r.handleContextMenuEvent(t),Promise.resolve(null);{const i=await o.contextMenuActionsForSources(e);if(0===i.length)return Promise.resolve(null);{let e;return e=r instanceof We.Series?{menuName:"ObjectTreeContextMenu",detail:{type:"series",id:r.instanceId()}}:(0,f.isLineTool)(r)?{menuName:"ObjectTreeContextMenu",detail:{type:"shape",id:null!==(s=null==r?void 0:r.id())&&void 0!==s?s:null}}:{menuName:"ObjectTreeContextMenu",detail:{type:"study",id:(null==r?void 0:r.id())||null}},Z.ContextMenuManager.createMenu(i,void 0,e).then(e=>(e.show(t),e))}}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return(0,s.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&(this.state().onDestroyed().unsubscribeAll(this),this.state().dataSourcesCollectionChanged().unsubscribeAll(this)),this._state=e,this.hasState()&&(this.state().onDestroyed().subscribe(this,this._onStateDestroyed,!0),this.state().dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),this.updatePriceAxisWidgets()))}getScreenshotData(e){const t=[],i=[];let s,r=[] ;const n=this.state().sourcesByGroup().priceSources().slice().reverse(),o=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();for(const a of n){const n=a.statusView();if((0,v.isStudy)(a)&&(o.showLegend.value()||(null==e?void 0:e.showCollapsedStudies))){const s=o.showStudyTitles.value(),r=s;a.properties().visible.value()&&n&&r&&(t.push(s?a.statusProvider(null==e?void 0:e.status).text():""),i.push(a.valuesProvider().getValues(null)))}else a===this._chartModel().mainSeries()&&n&&o.showSeriesTitle.value()&&(s=a.statusProvider((null==e?void 0:e.status)||{}).text(),r=a.valuesProvider().getValues(null))}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvas.toDataURL(),canvas:this._canvasBinding.canvas,contentWidth:this._size.w,contentHeight:this._size.h,studies:t,studiesValues:i,containsMainSeries:this.containsMainSeries(),mainSeriesText:s,mainSeriesValues:r}}updatePriceAxisWidgets(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount(),s=this.state(),r=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(r,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}update(){this.hasState()&&(this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e=b.InvalidationLevel.None){this.hasState()&&null!==this._legendWidget&&(e===b.InvalidationLevel.Full?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e){this._themedTopColor=e.topColor,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvas}hasCanvas(e){return this._canvasBinding.canvas===e||this._topCanvasBinding.canvas===e}pinchStartEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),this._options.handleScale.pinch&&(this._terminateActiveAnimations(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this)))}pinchEvent(e,t,i,s){if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return;const r=10*(s-this._prevPinchScale);this._prevPinchScale=s,this._chartModel().zoomTime(e.x,r,!0),this._prevPinchScale=s}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){ this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){this._onMouseEvent(),this.hasState()&&this._mouseDownOrTouchStartEvent(e,(0,s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY)))}touchStartEvent(e){if(this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch())return;const t=this._chartModel().crossHairSource(),i=!this._trackCrosshairOnlyAfterLongTap&&t.pane===this._state&&Number.isFinite(t.originX())&&Number.isFinite(t.originY())&&Math.abs(t.originX()-e.localX)+Math.abs(t.originY()-e.localY)<5;this._onTouchEvent(),this._chart.setActivePaneWidget(this);const r=(0,s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));i&&(r.source===t||t.selectPointMode().value()?this.startTrackingMode(new P.Point(e.localX,e.localY),new P.Point(e.localX,e.localY)):!this._chart.readOnly()&&(0,f.isLineTool)(r.source)&&r.source.userEditEnabled()&&this._chartUndoModel().selectionMacro(e=>{var t;e.clearSelection(),e.addSourceToSelection(r.source,null===(t=r.hittest)||void 0===t?void 0:t.data())})),this._mouseDownOrTouchStartEvent(e,r),this._mouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){var t,i;if(this._chart.readOnly())return;const r=this._dataSourceAtPoint(e.localX,e.localY);if(null===r||r.isCustom||null===r.source)return;if(((null===(t=r.hittest)||void 0===t?void 0:t.result())||0)<=M.HitTestResult.MOVEPOINT_BACKGROUND)return;const n=new A.EnvironmentState(e),o=null===(i=r.hittest)||void 0===i?void 0:i.eraseMarker();if(n.control()&&void 0!==o&&r.source.processErase)return void r.source.processErase(this._chartUndoModel(),o);const a=this._chartUndoModel();a.selection().isSelected(r.source)||a.selectionMacro(e=>{e.clearSelection();const t=(0,s.ensureNotNull)(r.source);e.addSourceToSelection(t,it(r,t))}),this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){if(null===this._state||this._preventTouchEventsExceptPinch())return;if(this._onTouchEvent(),this._longTap=!0,null!==this._startTrackPoint||!this._trackingModeShouldBeActive())return;const t=this._chartModel().selection();if(!t.isEmpty()){const i=(0,s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY)) ;if(null!==i.source&&t.isSelected(i.source))return}this.startTrackingMode(new P.Point(e.localX,e.localY),new P.Point(e.localX,e.localY),new A.EnvironmentState(e))}mouseEnterEvent(e){this._onMouseEvent(),this.hasState()&&(this._chart.setActivePaneWidget(this),this._setCursorPosition(e.localX,e.localY,new A.EnvironmentState(e)))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(){this._processOutsideClick({hittest:null,isCustom:!1,renderer:null,source:null})}cancelZoom(){this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this._startChangeLineToolParams=null,this._startMoveSourceParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._chartUndoModel().selectionMacro(e=>e.clearSelection()),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this._setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e,t){if(!this._chartUndoModel()||!this.hasState())return;this._state&&(e.priceScaleSideMaxLevel("left")>b.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>b.InvalidationLevel.Cursor)&&(this._recalculatePriceScales(),this._chartModel().updateCrosshairPositionByOriginCoords());const i=e.fullInvalidation();if(i>b.InvalidationLevel.Cursor){const e=this._chartModel().crossHairSource(),t=e.originX(),i=e.originY();if(e.pane===this._state&&Number.isFinite(t)&&Number.isFinite(i)){const e=this._dataSourceAtPoint(t,i);null!==e&&this._updateHoveredSource(e,(0,Oe.globalEnvironmentState)())}}if(this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left")),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right")),i!==b.InvalidationLevel.None){if(i>b.InvalidationLevel.Cursor){const e=(0,s.ensureNotNull)(this._canvasBinding.canvas.getContext("2d"));e.setTransform(1,0,0,1,0,0);const i=this._canvasRenderParams();this._drawBackground(e,i),this._state&&this._drawSources(e,i,t)}if(this._state){const e=(0,s.ensureNotNull)(this._topCanvasBinding.canvas.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=this._topCanvasRenderParams() ;e.clearRect(0,0,Math.ceil(this._size.w*t.pixelRatio),Math.ceil(this._size.h*t.pixelRatio)),this._drawSeriesTopViews(e,t),this._drawCrossHair(e,t),this._drawActiveLineTools(e,t)}}}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0&&!(0,Ee.isLineDrawnWithPressedButton)(t.toolname)){const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(),this.setCursorForTool()}drawRightThere(e){if((0,f.isLineToolName)(e)&&this.hasState()){const t=this._chartUndoModel(),i=t.crossHairSource(),s=t.model().magnet().align(i.price,i.index,this.state());t.createLineTool(this.state(),{index:i.index,price:s},e)}}cancelMeasuring(){this._chartUndoModel().crossHairSource().clearMeasure(),(0,E.resetToCursor)(),this.setCursorForTool()}async setErrorMessage(e){var t,i,s;e&&!this._errorRenderer&&(this._errorRenderer=this._createErrorBlock()),null===(t=await this._errorRenderer)||void 0===t||t.update({message:null==e?void 0:e.message,icon:(null===(i=this._state)||void 0===i?void 0:i.containsMainSeries())||(null===(s=this._state)||void 0===s?void 0:s.isMaximized())?null==e?void 0:e.icon:void 0,backgroundColor:`linear-gradient(${this._chartModel().backgroundTopColor().value()}, ${this._chartModel().backgroundColor().value()})`,textColor:this._chartModel().isDark()?Ge:je})}_topCanvasRenderParams(){return{pixelRatio:this._topCanvasBinding.pixelRatio,physicalWidth:this._topCanvasBinding.canvas.width,physicalHeight:this._topCanvasBinding.canvas.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_canvasRenderParams(){return{pixelRatio:this._canvasBinding.pixelRatio,physicalWidth:this._canvasBinding.canvas.width,physicalHeight:this._canvasBinding.canvas.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,r){return!(!(0,E.toolIsMeasure)(E.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,i),s=this._chartModel().magnet().align(s,r,this.state()),t.startMeasuring({price:s,index:r},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?(0,E.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const r=this._chart.model().model().zoomEnabled();if("zoom"===E.tool.value()&&r){const r=this._chartUndoModel(),n=r.timeScale().indexToCoordinate(i)-.5*r.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,s), this._chartModel().crossHairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),r=(0,s.ensureNotNull)(t.mainDataSource()).firstValue(),n=i.coordinateToPrice(e.localY,(0,s.ensureNotNull)(r)),o=this._chartUndoModel(),a=Math.round(o.timeScale().coordinateToIndex(e.localX)),l=(0,s.ensureNotNull)(this._firstZoomPoint);a!==l.index&&o.zoomToViewport(l.index,a,l.price,n,t),this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,(0,E.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if(e.source&&"eraser"===E.tool.value()&&!e.isCustom&&(!(i=e.source)||!i.customization||!i.customization.disableErasing)){const i=this._chartUndoModel();if(null!==e.hittest&&((0,f.isLineTool)(e.source)||(0,v.isStudy)(e.source))){const s=e.hittest.eraseMarker();return t.control()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1}_tryStartChangingLineTool(e,t,i,r){var n,o;if(e.isTouch&&null!==this._startTrackPoint)return!1;const a=t.hittest;if((!e.isTouch||!this._preventSourceChange)&&a&&(0,f.isLineTool)(t.source)&&a.result()===M.HitTestResult.CHANGEPOINT){const l=this._chartUndoModel(),c=(0,s.ensure)(null===(n=this.state().mainDataSource())||void 0===n?void 0:n.firstValue()),h=(0,s.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,c);l.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(t.source,a.data())});const d=l.model().magnet().align(h,r,this.state()),u=null===(o=a.data())||void 0===o?void 0:o.pointIndex;return this._startChangeLineToolParams={source:t.source,startPoint:{index:r,price:d},screenPoint:{x:e.localX,y:e.localY},pointIndex:u,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.control()){const t=this._chartUndoModel().selection().dataSources().filter(e=>e.cloneable());if(s&&s.cloneable()&&t.push(s),t.length>0)return this._clonningAtMoveLineTools=t.map(e=>e.id()),this._startCloningPoint=new P.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t,i){const r=this._chartUndoModel(),n=this._chartModel();if(t.control()&&this._clonningAtMoveLineTools){const o=new P.Point(e.localX,e.localY),a=(0,s.ensureNotNull)(this._startCloningPoint).subtract(o).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=n.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const n=this.cloneLineTools(l,!0).map(e=>(0,s.ensureNotNull)(r.model().dataSourceForId(e)));r.selectionMacro(e=>{e.clearSelection();let t=null;n.forEach(s=>{null===t&&(t=it(i,s)),e.addSourceToSelection(s,t)})});const o=new P.Point(e.localX,e.localY),a=(0,s.ensureNotNull)(n[0].priceScale()),c=(0,s.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:r.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,(0,s.ensureNotNull)(c))};r.startMovingSources(n,{logical:h,screen:o},null,t), this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,r){var n,o;const a=E.tool.value();if(!this.hasState()||(0,Ee.isLineToolDrawWithoutPoints)(a))return;const l=this._chartUndoModel();let c=!1,h=null;(0,E.hideAllDrawings)().value()&&(0,He.toggleHideMode)(),(0,E.lockDrawings)().setValue(!1),e.isTouch&&!e.stylus&&((0,f.isLineToolName)(a)&&!(0,Ee.isLineDrawnWithPressedButton)(a)||l.lineBeingCreated())&&this._initToolCreationModeParams(e);const d=l.lineBeingCreated();if(d&&!(0,Ee.isLineDrawnWithPressedButton)(d.toolname)){const a=(0,s.ensure)(null===(n=d.ownerSource())||void 0===n?void 0:n.firstValue());if(e.isTouch&&!e.stylus){if(!this._startTouchPoint){this._startTouchPoint=new P.Point(e.pageX,e.pageY);const t=d.points(),i=t[t.length-1],r=l.timeScale().indexToCoordinate(i.index),n=(0,s.ensureNotNull)(d.priceScale()).priceToCoordinate(i.price,a);return void(this._initCrossHairPosition=new P.Point(r,n))}}else if(!e.isTouch){h=d;const n=l.model().paneForSource(d);if(n!==this._state&&null!==n){const i=this._externalPaneXCoord(n,e.localX),r=this._externalPaneYCoord(n,e.localY);c=l.continueCreatingLine({index:Math.round(l.timeScale().coordinateToIndex(i)),price:(0,s.ensure)(null===(o=d.priceScale())||void 0===o?void 0:o.coordinateToPrice(r,a))},t)}else{const e=l.model().magnet().align(r,i,this.state());c=l.continueCreatingLine({index:i,price:e},t)}}}else if(!e.isTouch||e.stylus||(0,Ee.isLineDrawnWithPressedButton)(a)){const e={index:i,price:l.model().magnet().align(r,i,this.state())};h=l.createLineTool(this.state(),e,a),l.lineBeingCreated()||(c=!0)}const u=(0,s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));h&&l.selectionMacro(e=>{var t;return e.addSourceToSelection((0,s.ensureNotNull)(h),null===(t=u.hittest)||void 0===t?void 0:t.data())}),c&&h&&(this._finishTool(h,u),e.preventDefault())}_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let r=null;if(null===t.source||t.source.isSelectionEnabled()){let n=e.isTouch?Boolean(t.hittest&&t.hittest.result()>=M.HitTestResult.MOVEPOINT_BACKGROUND):Boolean(t.hittest&&t.hittest.result()>M.HitTestResult.MOVEPOINT_BACKGROUND);this._preventSourceChange&&(n=!1),s.selectionMacro(e=>{var s;n&&t.source?(i.control()||e.selection().isSelected(t.source)||e.clearSelection(),i.control()&&e.selection().isSelected(t.source)?(r=t.source,e.removeSourceFromSelection(t.source)):e.addSourceToSelection(t.source,null===(s=t.hittest)||void 0===s?void 0:s.data()),e.selection().allSources().length>1&&(0,U.trackEvent)("GUI","Multiselect","Click Select")):i.control()||e.clearSelection()})}return r}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,t)}_updateCommonTooltip(e,t){let i=null;if(null!==e&&null!==e.hittest){const t=e.hittest.data();t&&(i=t.tooltip||null)}if(null===this._prevTooltipData&&null===i)return;if(null===i||""===i.text)return this._prevTooltipData=null,void(0,Be.hide)(t);if(this._prevTooltipData&&(0, w.default)(i,this._prevTooltipData))return;this._prevTooltipData=i;const s=(0,_.clone)(i);if(void 0!==s.rect){const e=this._paneCell.getBoundingClientRect();s.rect.x+=e.left,s.rect.y+=e.top}(0,Be.show)(s)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e)._setCursorPosition(t,i,s)}_setCursorPosition(e,t,i){this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){var t;null===(t=(0,s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY)).hittest)||void 0===t||t.tryCallMouseUpOrTouchEndHandler(e)}_crossHairShouldBeVisible(){const e=this._chartModel().crossHairSource();return(0,f.isLineToolName)(E.tool.value())||(0,E.toolIsMeasure)(E.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){if(!this.hasState())return null;const i={source:null,hittest:null,isCustom:!1,renderer:null},s=this._chartUndoModel();if((0,f.isLineToolName)(E.tool.value())||null!==s.lineBeingCreated())return i;if(this._currentChangingLineToolHitTest)return this._currentChangingLineToolHitTest;if(this._currentMovingHitTest)return this._currentMovingHitTest;const r=this.state(),n=r.height(),o=r.width(),a=st.bind(null,i),l=this._canvasRenderParams(),c=new P.Point(e,t),h=r.sourcesByGroup(),d=s.selection();this._hitTestSources(l,d.dataSources(),c,a,!1),this._hitTestSources(l,d.customSources(),c,a,!0);const u=new Set(d.allSources().map(e=>e.id()));this._hitTestSources(l,[s.crossHairSource()],c,a,!1,u),this._hitTestSources(l,r.customSources(L.CustomSourceLayer.Topmost),c,a,!0,u),this._hitTestSources(l,h.tradingSources(),c,a,!1,u),this._hitTestSources(l,r.customSources(L.CustomSourceLayer.Foreground),c,a,!0,u);const p=[...this._chartModel().multiPaneSources(r),...h.hitTestSources()];if(this._hitTestSources(l,p,c,a,!1,u),this.containsMainSeries()){const e=s.barsMarksSources();for(let t=0;t=0;--s){const h=t[s];if(void 0!==o&&o.has(h.id()))continue ;const d=h.paneViews(a);if(null!==d&&0!==d.length)for(let t=d.length-1;t>=0;--t){const s=d[t].renderer(l,c);if(s&&s.hitTest){const t=s.hitTest(i,e);null!==t&&r(t,h,s,n)}}}}_tryStartMovingLineTool(e,t,i,r){var n,o;if(null===t.source||!t.source.movable()||null!==this._startTrackPoint)return!1;if(!this._preventSourceChange){const a=this._chartUndoModel(),l=(0,s.ensureNotNull)((0,s.ensureNotNull)(this._state).mainDataSource()).firstValue(),c=(0,s.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,(0,s.ensureNotNull)(l)),h=(t.source.isSelectionEnabled()?a.selection().allSources():[t.source]).filter(Fe),d=new P.Point(e.localX,e.localY),u={index:r,price:c},p=null===(o=null===(n=t.hittest)||void 0===n?void 0:n.data())||void 0===o?void 0:o.activeItem;return this._startMoveSourceParams={source:h,startPoint:{logical:u,screen:d},activeItem:void 0===p?null:p,envState:i},!0}return this._startMoveSourceParams=null,!1}_chartModel(){return this._chart.model().model()}_chartUndoModel(){return this._chart.model()}_externalPaneXCoord(e,t){t+=this._div.getBoundingClientRect().left+document.body.scrollLeft;const i=(0,s.ensureNotNull)(this._chart.paneByState(e)),r=i._div.getBoundingClientRect().left+document.body.scrollLeft;return i._correctXCoord(t-r)}_externalPaneYCoord(e,t){t+=this._div.getBoundingClientRect().top+document.body.scrollTop;const i=(0,s.ensureNotNull)(this._chart.paneByState(e)),r=i._div.getBoundingClientRect().top+document.body.scrollTop;return i._correctYCoord(t-r)}_correctXCoord(e){return Math.max(0,Math.min(e,this._size.w-1))}_correctYCoord(e){return Math.max(0,Math.min(e,this._size.h-1))}_processScroll(e){if(!this._chart.model().model().scrollEnabled())return;const t=Date.now();this._startScrollingPos||this._preventScroll()||(this._startScrollingPos={x:e.clientX,y:e.clientY,timestamp:t,localX:e.localX,localY:e.localY}),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(e.localX,t),null!==this._scrollYAnimation&&this._scrollYAnimation.addPosition(e.localY,t);const i=this._chartUndoModel();let s=this.state().defaultPriceScale();if(this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==e.clientX||this._startScrollingPos.y!==e.clientY))return i.beginUndoMacro(qe,!0),null===this._scrollXAnimation&&this._options.useKineticScroll&&(this._scrollXAnimation=new Te(.2,7,.997,15),this._scrollXAnimation.addPosition(this._startScrollingPos.localX,this._startScrollingPos.timestamp),this._scrollXAnimation.addPosition(e.localX,t)),this._scrollYAnimation,i.selection().isEmpty()||(s=i.selection().allSources()[0].priceScale()),null===s||s.isEmpty()||(this._scrollPriceScale=s,i.startScrollPrice(this.state(),s,e.localY)),i.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool(),void this._paneWidgetsSharedState.setScrollingPane(this);this._isScrolling&&(null!==this._scrollPriceScale&&i.scrollPriceTo(this.state(),this._scrollPriceScale,e.localY),i.scrollTimeTo(e.localX))}_finishScroll(){const e=this._chartUndoModel();e.endScrollTime(), null!==this._scrollPriceScale&&e.endScrollPrice(this.state(),this._scrollPriceScale),e.endUndoMacro(),this._isScrolling=!1,this._startScrollingPos=null,this._scrollPriceScale=null,this.setCursorForTool(),this._paneWidgetsSharedState.setScrollingPane(null)}_endScroll(e){if(!this._isScrolling)return!1;const t=this._isScrolling&&this._scrollUndoCommandInStack();if(this._isScrolling){const i=Date.now();null!==this._scrollXAnimation&&this._scrollXAnimation.start(e.localX,i),null!==this._scrollYAnimation&&this._scrollYAnimation.start(e.localY,i);const s=this._chartUndoModel(),r=null===this._scrollXAnimation||this._scrollXAnimation.finished(i),n=null===this._scrollYAnimation||this._scrollYAnimation.finished(i);if(r&&n)return this._finishScroll(),t;r?(s.endScrollTime(),this._paneWidgetsSharedState.setScrollingPane(null)):n&&(this._scrollPriceScale&&s.endScrollPrice(this.state(),this._scrollPriceScale),this._scrollPriceScale=null);const o=s.timeScale(),a=this._scrollXAnimation,l=this._scrollYAnimation,c=()=>{if((null===a||a.terminated())&&(null===l||l.terminated()))return;const e=Date.now();let t=null===a||a.finished(e);const i=null===l||l.finished(e);if(null!==a&&!a.terminated()){const i=o.rightOffset();s.scrollTimeTo(a.getPosition(e)),i===o.rightOffset()&&(t=!0,this._scrollXAnimation=null)}null===l||l.terminated()||null===this._scrollPriceScale||s.scrollPriceTo(this.state(),this._scrollPriceScale,l.getPosition(e)),t&&i?this._finishScroll():requestAnimationFrame(c)};requestAnimationFrame(c)}return t}_terminateActiveAnimations(){const e=Date.now(),t=null===this._scrollXAnimation||this._scrollXAnimation.finished(e),i=null===this._scrollYAnimation||this._scrollYAnimation.finished(e);null===this._scrollXAnimation&&null===this._scrollYAnimation||t&&i||this._finishScroll(),null!==this._scrollXAnimation&&(this._scrollXAnimation.terminate(),this._scrollXAnimation=null),null!==this._scrollYAnimation&&(this._scrollYAnimation.terminate(),this._scrollYAnimation=null)}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||(0,f.isLineToolName)(E.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint}_isSelectPointModeEnabled(){return this._chartUndoModel().crossHairSource().selectPointMode().value()}_preventCrossHairMove(){return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e,t=null){const i=this._chartUndoModel(),s=E.tool.value();if((0,E.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),i.selectionMacro(i=>{i.addSourceToSelection(e,it(t,e))}),(0,Ee.isTextToolName)(s)){const t=i.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,De.TabNames.text,void 0,t).then(e=>{0})}this._lastFinishedToolId=e.id(),(0,h.emit)("drawing_event",e.id(),"create"),(0,ke.trackDrawingCreated)(e)}_alignSourcesThatBeingMoved(e,t,i,s){ const r=this._chartUndoModel(),n=r.timeScale().coordinateToIndex(t);r.model().sourcesBeingMoved().forEach(e=>{var o,a;let l=n,c=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());if(null!==c){if((0,v.isStudy)(e)){const e=r.mainSeries(),t=e.bars().firstIndex(),i=e.bars().lastIndex();null!==t&&null!==i&&(l=Math.min(Math.max(n,t),i)),c=this._chartModel().magnet().align(c,n,this.state())}null!==this._currentMovingHitTest&&void 0!==(null===(a=null===(o=this._currentMovingHitTest.hittest)||void 0===o?void 0:o.data())||void 0===a?void 0:a.cursorType)||this.setCursorForTool(),r.moveSources({screen:new P.Point(t,i),logical:{index:l,price:c}},s)}})}_resetMeasureIfRequired(){this._needResetMeasureLater&&((0,E.resetToCursor)(),this._needResetMeasureLater=!1)}_drawBackground(e,t){const i=Math.ceil(t.pixelRatio*this._size.w),s=Math.ceil(t.pixelRatio*this._size.h),r=this._chartModel(),n=r.backgroundTopColor().value(),o=r.backgroundColor().value();n===o?(0,N.clearRect)(e,0,0,i+1,s+1,o):(0,R.clearRectWithGradient)(e,0,0,i+1,s+1,n,o)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;const s=this.state();if(!s.containsMainSeries())return;const r=i.paneViews(),n=s.height(),o=s.width();for(const i of r){e.save();const s=i.renderer(n,o);s&&s.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crossHairSource();!i.visible&&(0,E.lockTimeAxis)().value()&&(i.setLockedPosition((0,s.ensureNotNull)(this._state)),i.updateAllViews()),this._drawSourceImpl(e,t,Je,Ze,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved(),i.customSourceBeingMoved()].filter(e=>!!e);for(const r of s){(i.paneForSource(r)===this.state()||(0,k.isDataSource)(r)&&r.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,Je,Ze,r)}}_drawSeriesTopViews(e,t){this.state().containsMainSeries()&&this._drawSourceImpl(e,t,Qe,Ze,this._chartUndoModel().mainSeries())}_drawSources(e,t,i){const s=this.state(),r=s.model(),n=s.sourcesByGroup(),o=n.tradingSources(),a=[...r.multiPaneSources(s),...n.generalSources()],l=n.phantomSources(),c=s.customSources(L.CustomSourceLayer.Background).slice(),h=s.customSources(L.CustomSourceLayer.Foreground).slice(),d=s.customSources(L.CustomSourceLayer.Topmost).slice();{const e=r.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,Je,Ze,r.gridSource()),this._drawWatermark(e,t);for(const i of c)this._drawSourceImpl(e,t,Je,Xe,i);for(const i of a)this._drawSourceImpl(e,t,Je,Xe,i);for(const i of h)this._drawSourceImpl(e,t,Je,Xe,i);for(const i of l)this._drawSourceImpl(e,t,Je,Xe,i);const u=new Set;[r.lineBeingCreated(),r.lineBeingEdited(),...r.sourcesBeingMoved(),r.customSourceBeingMoved()].filter(_.notNull).forEach(e=>u.add(e.id()));let p=r.hoveredSource();null!==p&&(Ke(p)||u.has(p.id())||(0,k.isDataSource)(p)&&!a.includes(p)?p=null:u.add(p.id()));const m=r.selection().allSources().filter(e=>!((0,k.isDataSource)(e)&&!a.includes(e))&&(!u.has(e.id())&&!Ke(e)));m.forEach(e=>u.add(e.id()));{ for(const i of c)this._drawSourceImpl(e,t,Je,Ze,i,u);for(const i of a)this._drawSourceImpl(e,t,Je,Ze,i,u);for(const i of h)this._drawSourceImpl(e,t,Je,Ze,i,u);const i=r.activeStrategySource().value();i&&this.containsMainSeries()&&this._drawSourceImpl(e,t,tt,Ze,i)}for(const i of o)this._drawSourceImpl(e,t,Je,Xe,i);for(const i of d)this._drawSourceImpl(e,t,Je,Xe,i);for(const i of a)this._drawSourceImpl(e,t,et,Ze,i,u);for(const i of h)this._drawSourceImpl(e,t,et,Ze,i,u);this._drawBarsMarks(e,t,i);for(const i of o)this._drawSourceImpl(e,t,Je,Ze,i,u);for(const i of d)this._drawSourceImpl(e,t,Je,Ze,i,u);for(const i of m)this._drawSourceImpl(e,t,Je,Ze,i);for(const i of m)this._drawSourceImpl(e,t,et,Ze,i);p&&(this._drawSourceImpl(e,t,Je,Ze,p),this._drawSourceImpl(e,t,et,Ze,p));for(const i of l)this._drawSourceImpl(e,t,Je,Ze,i,u);{const e=r.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,r,n){if(n&&n.has(r.id()))return;const o=this.state(),a=o.height(),l=o.width(),c=i(r,this.state());if(c)for(const i of c){const r=i.renderer(a,l);r&&(e.save(),s(r,e,t),e.restore())}}_drawBarsMarks(e,t,i){if(this.containsMainSeries()&&!i){const i=this._chartUndoModel().barsMarksSources();for(const s of i)this._drawSourceImpl(e,t,Je,Ze,s)}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof D.UndoMacroCommand))return!1;if(t.isEmpty())return!1;const i=t.commands()[0];return i instanceof Le.PriceScaleChangeUndoCommand||i instanceof Me.TimeScaleChangeUndoCommand}_onStateDestroyed(){this.setState(null)}_getHideNotMainSourcesValue(){return ot&&!this._chart.isActive()&&!this._chart.crossHairSyncEnabled()}_onDataSourcesCollectionChanged(){this._startMoveSourceParams=null}_processMouseEnterLeaveMoveHandlers(e,t){var i,s,r,n;null!==this._prevHoveredHittest&&this._prevHoveredHittest.renderer!==e.renderer&&((0,M.tryCallHandler)(t,null===(s=null===(i=this._prevHoveredHittest.hittest)||void 0===i?void 0:i.data())||void 0===s?void 0:s.mouseLeaveHandler),this._prevHoveredHittest=null),t.isTouch||(e.hittest&&(null===(r=this._prevHoveredHittest)||void 0===r?void 0:r.renderer)!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t),this._prevHoveredHittest=e),null===(n=e.hittest)||void 0===n||n.tryCallMouseMoveHandler(t))}_startChangeOrMoveLineToolIfNeeded(){if(null!==this._startChangeLineToolParams){const e=this._startChangeLineToolParams;this._chartUndoModel().startChangingLinetool(e.source,e.startPoint,e.pointIndex,e.envState)}if(null!==this._startMoveSourceParams){const e=this._startMoveSourceParams;this._chartUndoModel().startMovingSources(e.source,e.startPoint,e.activeItem,e.envState)}this._startMoveSourceParams=null,this._startChangeLineToolParams=null}_trackingModeShouldBeActive(){ return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e){let t=null;const i=this._chartModel();if(e.source&&(t=e.isCustom?i.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==t){const e=this._lastClickedSource.id;let t=this._lastClickedSource.isCustom?i.customSourceForName(e):i.dataSourceForId(e);null!==t||this._lastClickedSource.isCustom||(t=this._chartUndoModel().barMarksSourceForId(e)),null!==t&&t.onClickOutside&&(t.onClickOutside(),this._chartModel().updateSource(t))}this._lastClickedSource=null!==t?{id:t,isCustom:e.isCustom}:null}_mouseClickOrTapEvent(e){var t,i,r;if(!this.hasState())return;const n=this._dataSourceAtPoint(e.localX,e.localY),o=n&&n.source,a=this._chartUndoModel(),l=Boolean(null===(i=null===(t=null==n?void 0:n.hittest)||void 0===t?void 0:t.data())||void 0===i?void 0:i.hideCrosshairLinesOnHover);this._processOutsideClick((0,s.ensureNotNull)(n)),!this._isSelectPointModeEnabled()||l||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||a.crossHairSource().trySelectCurrentPoint(),(null===(r=null==n?void 0:n.hittest)||void 0===r?void 0:r.tryCallClickOrTapHandler(e))&&a.model().updateSource((0,s.ensureNotNull)(o)),!e.isTouch||this._isSelectPointModeEnabled()||n&&n.source===a.crossHairSource()||this._tryExitTrackingMode(),o instanceof V.BarsMarksContainer&&n&&n.hittest&&n.hittest.data()&&o.onClicked((0,s.ensureNotNull)(n.hittest).data()),o&&(0,f.isLineTool)(o)&&this._lastFinishedToolId!==o.id()&&(0,h.emit)("drawing_event",o.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e,t){var i,r,n,o,a,l,c,d;if(e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null,this._terminateActiveAnimations(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}(0,h.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null);const u=this._chartUndoModel(),p=new A.EnvironmentState(e);u.mainSeries().clearGotoDateResult();const _=this.state().defaultPriceScale();if(_.isEmpty()||u.timeScale().isEmpty())return;const m=u.crossHairSource();if(!e.isTouch&&!(0,Ee.isLineDrawnWithPressedButton)(E.tool.value())){const t=u.lineBeingCreated(),i=null!==t?u.model().paneForSource(t):null;null!==i&&i!==this._state?this._setCursorPositionOnExternalPane(i,e.localX,e.localY,p):this._setCursorPosition(e.localX,e.localY,p)}e.isTouch&&(0,f.isLineToolName)(E.tool.value())&&((0,Ee.isLineDrawnWithPressedButton)(E.tool.value())||null!==m.pane?(0, Ee.isLineDrawnWithPressedButton)(E.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const g=(0,s.ensureNotNull)(this.state().mainDataSource()).firstValue();if(null===g)return void(this._chart.readOnly()||(this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,p),t.source&&(0,Ae.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this)));let v=_.coordinateToPrice(e.localY,g),S=this._chartModel().timeScale().coordinateToIndex(e.localX);if(m.startMeasurePoint()&&m.endMeasurePoint()&&m.clearMeasure(),p.shift()&&!(null===(n=null===(r=null===(i=t.hittest)||void 0===i?void 0:i.data())||void 0===r?void 0:r.hasOwnShortcutsBehaviourFor)||void 0===n?void 0:n.shiftKey)&&(0,E.toolIsCursor)(E.tool.value())&&u.selection().isEmpty()&&E.tool.setValue("measure"),(e.isTouch&&!e.stylus||!this._tryStartMeasure(e,m,p,v,S))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,m))&&!this._tryFinishZoom(e)&&!this._tryStartZoom(e,v,S,p)){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=m.currentPoint(),this._startTrackPoint=new P.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new P.Point(e.localX,e.localY),new P.Point(e.localX,e.localY),new A.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t.source||!u.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,E.toolIsMeasure)(E.tool.value())||null!==m.measurePane()))return void this._initToolCreationModeParams(e);if((0,f.isLineToolName)(E.tool.value())||u.lineBeingCreated())return p.shift()||u.selectionMacro(e=>e.clearSelection()),void this._mouseDownEventForLineTool(e,p,S,v)}if(null===(o=t.hittest)||void 0===o||o.tryCallMouseDownOrTouchStartHandler(e),!this._chart.readOnly()){const i=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,p);if(t.hittest&&t.source&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return u.model().setMovingCustomSource(t.source,i),this._currentMovingHitTest=t,void u.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection((0,s.ensureNotNull)(t.source),(0,s.ensureNotNull)(i))})}else if((null==i?void 0:i.areaName)===M.AreaName.SourceItemMove){const r=null==i?void 0:i.activeItem;if(void 0!==r)return u.startCustomMoving(t.source,r,e),this._currentMovingHitTest=t,void u.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection((0,s.ensureNotNull)(t.source),(0,s.ensureNotNull)(i))})}}if(this._tryHandleEraserMouseDown(t,p))return;const r=t.source&&(0,f.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,E.lockDrawings)().value()||r)&&!t.isCustom){if(t.source&&!t.source.userEditEnabled())return;const s=null===(l=null===(a=t.hittest)||void 0===a?void 0:a.data())||void 0===l?void 0:l.snappingPrice,r=null===(d=null===(c=t.hittest)||void 0===c?void 0:c.data())||void 0===d?void 0:d.snappingIndex ;let n=e.localY,o=e.localX;if(void 0!==s&&(n=_.priceToCoordinate(s,g),v=s),void 0!==r&&(o=this._chartModel().timeScale().indexToCoordinate(r),S=r),n===e.localY&&o===e.localX||(e={...e,localY:n,localX:o},this._setCursorPosition(e.localX,e.localY,p)),this._tryStartChangingLineTool(e,t,p,S))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,t.hittest&&((y=t.hittest.result())===M.HitTestResult.MOVEPOINT||y===M.HitTestResult.MOVEPOINT_BACKGROUND&&(0,x.lastMouseOrTouchEventInfo)().isTouch)){if(this._tryStartCloning(e,t,p,i))return;if(this._tryStartMovingLineTool(e,t,p,S))return void(this._currentMovingHitTest=t);this._currentMovingHitTest=null}}if(t.source&&(0,Ae.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var y;t&&t.hittest&&t.hittest.result()===M.HitTestResult.REGULAR||(this._processing=!0)}}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;const r=e.isTouch&&null!==this._startTrackPoint,n=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null;const o=this._chartUndoModel(),a=o.model().customSourceMovingHitTestData();null!==a||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const l=o.model(),c=l.crossHairSource(),d=this._dataSourceAtPoint(e.localX,e.localY),u=null==d?void 0:d.hittest;if(c.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(c.selection());o.selectionMacro(t=>{let i=null;e.forEach(e=>{null===i&&(i=it(d,e)),t.addSourceToSelection(e,i)})}),c.clearSelection(),(0,U.trackEvent)("GUI","Multiselect","Area Select")}(0,h.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const p=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const _=new A.EnvironmentState(e),m=E.tool.value();if(e.isTouch&&((0,E.toolIsMeasure)(m)||null!==c.measurePane())){if(!p&&!e.stylus&&null===c.measurePane()&&c.pane!==this._state)return void this._setCursorPosition(e.localX,e.localY);if(!p&&!e.stylus&&this._tryStartMeasure(e,c,_,c.price,c.index))return;if((!p||e.stylus)&&this._tryFinishMeasure(e,c))return}if(e.isTouch&&!p&&!(0,Ee.isLineDrawnWithPressedButton)(m)&&(0,f.isLineToolName)(m)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(c.pane!==this._state)return void this._setCursorPosition(e.localX,e.localY,_);const i=c.currentPoint(),r=this.state().defaultPriceScale(),n=(0,s.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:r.coordinateToPrice(i.y,n)},l=(0,s.ensureNotNull)(o.createLineTool(this.state(),a,m));return o.selectionMacro(e=>{e.addSourceToSelection(l)}),o.lineBeingCreated()||(this._finishTool(l,d),e.preventDefault()),void(this._startTouchPoint=null)} const g=o.lineBeingCreated();if(g&&!(0,Ee.isLineDrawnWithPressedButton)(g.toolname)&&e.isTouch&&(this._startTouchPoint||e.stylus)){if(this._startTouchPoint=null,!p||e.stylus){const t=g.points()[g.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new A.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(g,d),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed())return void o.endCustomMoving();if(null!==a)return a.beingMoved&&((0,M.tryCallHandler)(e,a.mouseUpHandler,a.touchEndHandler),this.setCursorForTool()),void l.setMovingCustomSource(null,null);if(l.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,Ee.isLineDrawnWithPressedButton)(m)&&!this._isSelectPointModeEnabled()){const t=o.lineBeingCreated();null!==t&&((0,ke.trackDrawingCreated)(t),t.finish());const r=this.state().defaultPriceScale();if(r.isEmpty())return;if(!t)return;const n=(0,s.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=r.coordinateToPrice(e.localY,n),l={index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(l)}if(l.sourcesBeingMoved().length)return o.endMovingSource(!1,!1),l.sourcesBeingMoved().filter(f.isLineTool).forEach(e=>{this.setCursorForTool(e)}),void l.invalidate(b.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localXM.HitTestResult.MOVEPOINT_BACKGROUND||(0,x.lastMouseOrTouchEventInfo)().isTouch)&&o.selectionMacro(e=>{e.clearSelection();const t=(0,s.ensureNotNull)(d.source);e.addSourceToSelection(t,it(d,t))}),e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=(0, s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const r=e.localX,n=e.localY;this._prevMoveEventPosition=new P.Point(r,n);const o=new A.EnvironmentState(e);if(null===this._firstZoomPoint){if(this._updateHoveredSource(t,o,e),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,r,n,o)}e.isTouch||this._setCursorPosition(r,n,o)}else this._processMouseMoveWhileZoom(e,o)}_pressedMouseOrTouchMoveEvent(e){var t;if(!this.hasState()||this._pinching||e.isTouch&&this._contextMenuOpenedOnLastTap)return;this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const i=new A.EnvironmentState(e),r=this._chartUndoModel(),n=r.crossHairSource(),o=e.localX,a=e.localY;if(this._prevMoveEventPosition=new P.Point(o,a),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const l=E.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,f.isLineToolName)(l)&&!(0,Ee.isLineDrawnWithPressedButton)(l)&&!r.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const c=n.measurePane();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,E.toolIsMeasure)(l)||null!==c))return void(e.stylus?this._setCursorPosition(e.localX,e.localY,new A.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,c||this.state()));const h=r.lineBeingCreated();if(e.isTouch&&!e.stylus&&h&&!(0,Ee.isLineDrawnWithPressedButton)(h.toolname)){if(this._startTouchPoint){const t=(0,s.ensureNotNull)(r.lineBeingCreated()),i=(0,s.ensureNotNull)(r.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,s.ensureNotNull)(this._initCrossHairPosition),t=new P.Point(o,a).subtract(this._startTrackPoint),r=e.add(t);this._setCursorPosition(r.x,r.y,i)}else e.isTouch&&this._preventCrossHairMove()||this._setCursorPosition(o,a,i);const d=this._isSelectPointModeEnabled();if((0,f.isLineToolName)(l)&&!(0,Ee.isLineDrawnWithPressedButton)(l)&&!d&&!i.control())return;if((0,Ee.isLineDrawnWithPressedButton)(l)&&!d){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const n=r.lineBeingCreated();if(!n)return;const o=new P.Point(e.localX,e.localY),a=(0,s.ensure)(null===(t=n.ownerSource())||void 0===t?void 0:t.firstValue());return o.price=i.coordinateToPrice(e.localY,a),o.index=Math.round(r.timeScale().coordinateToIndex(e.localX)),void r.continueCreatingLine(o)}if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(r.timeScale().isEmpty())return ;const u=this._options.handleScroll;if((!u.pressedMouseMove||e.isTouch)&&(!u.horzTouchDrag&&!u.vertTouchDrag||!e.isTouch))return;if(r.customMoveBeingProcessed())return void r.processCustomMove(e);const p=r.model().customSourceMovingHitTestData();if(null!==p&&(this._updateCommonTooltip(null,!0),r.model().processingCustomSourceMove(),(0,M.tryCallHandler)(e,p.pressedMouseMoveHandler,p.touchMoveHandler),!(0,M.shouldDefaultActionBeExecuted)(e,p,"pressedMouseMoveHandler","touchMoveHandler")))return;if(r.model().lineBeingEdited())return void this._setCursorPosition(o,a,i);if(r.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(r.model().sourcesBeingMoved(),e.localX,e.localY,i);const _=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new A.EnvironmentState(e),_))return;const m=(0,E.toolIsMeasure)(l)||n.startMeasurePoint()&&n.endMeasurePoint();this._chart.readOnly()||!i.control()||(0,f.isLineToolName)(l)||m||d?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this._setCursorPosition(e.localX,e.localY,new A.EnvironmentState(e))):this._isSelecting||(n.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t,i;if(!this.hasState())return;const s=this._chartUndoModel();if(!s)return;const r=s.crossHairSource();e.isTouch||null!==r.measurePane()&&null===r.endMeasurePoint()||this._clearCursorPosition(),s.model().setHoveredSource(null,null),null!==this._prevHoveredHittest&&((0,M.tryCallHandler)(e,null===(i=null===(t=this._prevHoveredHittest.hittest)||void 0===t?void 0:t.data())||void 0===i?void 0:i.mouseLeaveHandler),this._prevHoveredHittest=null),this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget()}_mouseDoubleClickOrDoubleTapEvent(e){var t;if(!this.hasState())return;const i=!this._chart.readOnly()&&!(0,f.isLineToolName)(E.tool.value())&&(0,s.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY))||null;if(null===i)return;if(i.isCustom)return void(null===(t=i.hittest)||void 0===t||t.tryCallDblClickOrDblTapHandler(e));let r=i.hittest&&i.source||null;r&&i.hittest&&i.hittest.result()<=M.HitTestResult.MOVEPOINT_BACKGROUND&&!e.isTouch&&(r=null),r&&!r.isSelectionEnabled()&&(r=null),r?this.processDoubleClickOnSource(r,i.hittest?i.hittest:void 0):this._chart.readOnly()||(0,f.isLineToolName)(E.tool.value())||this._chartUndoModel().lineBeingCreated()||!this._chartUndoModel().selection().isEmpty()||this._chart.toggleMaximizePane(this)}_contextMenuEvent(e){var t;const i=this._chartUndoModel();if(i.crossHairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return i.crossHairSource().clearMeasure(),void(0,E.resetToCursor)(!0);if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,E.toolIsCursor)(E.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,E.resetToCursor)(!0),this.setCursorForTool(),void(i.lineBeingCreated()&&i.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return ;const s=this._dataSourceAtPoint(e.localX,e.localY),r=s?s.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const n=s&&s.hittest?s.hittest.result():0,o=n>=M.HitTestResult.REGULAR||n>=M.HitTestResult.MOVEPOINT_BACKGROUND&&e.isTouch;this._chart.updateActions(),i.selectionMacro(t=>{null!==r&&o?t.selection().isSelected(r)||(t.clearSelection(),t.addSourceToSelection(r,it(s,r))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())}),s&&o&&null!==r&&((0,k.isDataSource)(r)&&r.hasContextMenu()?r.isSelectionEnabled()?this.showContextMenuForSelection(e):this.showContextMenuForSources([r],e):null===(t=s.hittest)||void 0===t||t.tryCallContextMenuHandler(e))}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crossHairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new P.Point(e.localX,e.localY),new P.Point(i.x,e.localY),new A.EnvironmentState(e))}}_showContextMenu(e){const t=e=>e instanceof ne.Separator,i=this._customActions(),s=this._initActions(e).filter(e=>null!==e);i.remove.forEach(e=>{for(let t=0;t0;e--)t(r[e])&&t(r[e-1])&&r.splice(e,1);r.length&&t(r[0])&&r.splice(0,1),r.length&&t(r[r.length-1])&&r.splice(r.length-1,1),Z.ContextMenuManager.showMenu(r,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}_initActions(e){var t,i;const s=this._chart.actions(),r=[];r.push(s.chartReset),r.push(new ne.Separator),se.enabled("datasource_copypaste")&&!this.state().isEmpty()&&(r.push(new ne.Action({actionId:"Chart.Clipboard.PasteSource",label:Ye.replace("%s","").trim(),shortcutHint:(0,ee.humanReadableHash)(ee.Modifiers.Mod+86),statName:"Paste",onExecute:()=>this._chart.chartWidgetCollection().clipboard.uiRequestPaste(this.state())})),r.push(new ne.Separator)),r[r.length-1]instanceof ne.Separator||r.push(new ne.Separator);return Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&s.addToWatchlist&&r.push(s.addToWatchlist),se.enabled("text_notes")&&r.push(s.addToTextNotes),r[r.length-1]instanceof ne.Separator||r.push(new ne.Separator),r.push(this._createLockTimeAxisAction(e)),r.push(new ne.Separator),r.push((0,re.createLinesAction)(this._chart)),se.enabled("charting_library_base")||r.push(s.applyColorTheme),r[r.length-1]instanceof ne.Separator||r.push(new ne.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(r.push(s.applyStudiesToAllCharts),r.push(new ne.Separator)), r.push(s.paneRemoveAllDrawingTools),r.push(s.paneRemoveAllStudies),r.push(new ne.Separator),(null===(i=window.pro)||void 0===i?void 0:i.hasPackage("mtp-mtpredictor"))&&this.state().containsMainSeries()&&r.push((0,re.createMTPredictorActions)(this._chart,this.state(),this._contextMenuX,this._contextMenuY),new ne.Separator),r.push(s.hideAllMarks),r.push(new ne.Separator),se.enabled("show_chart_property_page")&&r.push(s.chartProperties),r[r.length-1]instanceof ne.Separator&&r.pop(),r}_loadAndCreateLegendWidget(){Promise.all([i.e(439),i.e(5514),i.e(1529),i.e(5093)]).then(i.bind(i,56786)).then(e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=(0,I.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!l.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled};const r=new(Ie())(this._getHideNotMainSourcesValue());this._hideNotMainSourcesInLegendSpawn=(0,m.combine)(()=>({}),this._chart.chartWidgetCollection().activeChartWidget,this._chart.chartWidgetCollection().lock.crosshair),this._hideNotMainSourcesInLegendSpawn.subscribe(()=>{r.setValue(this._getHideNotMainSourcesValue())}),this._hideWholeLegend=new(Ie())(!1),E.tool.subscribe(this._recalculateLegendVisibility),this._chartModel().crossHairSource().measuringEnabled().subscribe(this,this._recalculateLegendVisibility),this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme(),r,this._hideWholeLegend,i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),updateActions:this._chart.updateActions.bind(this._chart),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart)}),this._div.appendChild(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,s.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))})}_loadAndCreatePaneControlsWidget(){Promise.all([Promise.all([i.e(439),i.e(5514),i.e(1529),i.e(5093)]).then(i.bind(i,17904)),Promise.all([i.e(439),i.e(5514),i.e(1529),i.e(5093)]).then(i.bind(i,1529))]).then(([e,t])=>{if(this._isDestroyed)return;const i=e.PaneControlsWidget;this._paneControls=new i(this._chartUndoModel(),this,{backgroundThemeName:this._chart.backgroundTopTheme()},{ toggleMaximizePane:this._chart.toggleMaximizePane.bind(this._chart)},this._div),this._paneControls.updateWidgetModeByWidth(this._size.w),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new t.default(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement())})}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+ze+Ue;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(A.EnvironmentState.create((0,Oe.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,f.isLineToolName)(E.tool.value())&&t.crossHairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(E.isStudyEditingNow.value()&&this._setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this._setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(De.TabNames.symbol);else if((0,f.isLineTool)(e)||(0,v.isStudy)(e)){let i;const s=null==t?void 0:t.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=nt.get(e))}this._chart.showChartPropertiesForSource(e,i).then(e=>{this._editDialog=e})}}_initToolCreationModeParams(e){this._startTouchPoint=new P.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crossHairSource();this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint());const r=e.pageX,n=e.pageY,o=(0,s.ensureNotNull)(this._initCrossHairPosition),a=new P.Point(r,n).subtract((0,s.ensureNotNull)(this._startTouchPoint)),l=o.add(a);this._setCursorPosition(l.x,l.y,new A.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(){const e=this.state();for(const t of e.leftPriceScales())e.recalculatePriceScale(t);for(const t of e.rightPriceScales())e.recalculatePriceScale(t) ;for(const t of e.sourcesByGroup().overlayPriceScaleSources())(0,f.isLineTool)(t)||e.recalculatePriceScale(t.priceScale())}_createLockTimeAxisAction(e){const t=(0,E.lockTimeAxis)().value();return new ne.Action({actionId:"Chart.Crosshair.LockVerticalCursor",label:$e,statName:"LockCursorInTime",checkable:!0,checked:t,onExecute:()=>this._toggleLockTimeAxis(e.localX,!t)})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i);null!==s&&E.lockTimeAxisTime.setValue(s)}(0,E.lockTimeAxis)().setValue(t)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){var s,r,n;const o=this._chartUndoModel(),a=o.model();let l=!1;const c=e&&e.source,h=this._chart.readOnly();if(h&&!(0,f.isLineTool)(e.source)||this._editDialog&&this._editDialog.visible().value())h&&(a.setHoveredSource(null,null),this.setCursorForTool());else{const d=E.tool.value();let u=null;if(!this._processing&&((0,E.toolIsCursor)(d)||"eraser"===d&&!h||t.control()||!o.lineBeingCreated())){const{hittest:t}=e;l=Boolean(null===(s=null==t?void 0:t.data())||void 0===s?void 0:s.hideCrosshairLinesOnHover),t&&t.result()>M.HitTestResult.MOVEPOINT_BACKGROUND?(u=c,!(null==c?void 0:c.isHoveredEnabled())||"eraser"===d&&c===o.mainSeries()?a.setHoveredSource(null,null):a.setHoveredSource(c,null==t?void 0:t.data())):a.setHoveredSource(null,null)}h?this.setCursorForTool(u,t,Ve.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(u,t,null===(n=null===(r=null==e?void 0:e.hittest)||void 0===r?void 0:r.data())||void 0===n?void 0:n.cursorType));const p=a.customSourceBeingMoved(),_=null!==p?[p]:a.sourcesBeingMoved(),m=e.source;if((!_.length||null!==m&&-1===_.indexOf(m))&&this._updateCommonTooltip(e),!h&&null!==e.hittest&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case Ve.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case Ve.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case Ve.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case Ve.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),a.crossHairSource().setLinesShouldBeHidden(l)}async _createErrorBlock(){const e=new(await async function(){return(await Promise.all([i.e(5527),i.e(5514),i.e(139)]).then(i.bind(i,39450))).ErrorCardRenderer}());return this._div.insertBefore(e.container,this._topCanvasBinding.canvas.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!se.enabled("custom_items_in_context_menu"))return e;const r=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let n;if(i&&!i.isEmpty()){const e=(0, s.ensureNotNull)(this.state().mainDataSource()).firstValue();n=i.coordinateToPrice(this._contextMenuY,(0,s.ensureNotNull)(e))}return(0,h.emit)("onContextMenu",{unixtime:null!=r?r.getTime()/1e3:void 0,price:n,callback:t=>{[...t].forEach(t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new ne.Separator:new ne.Action({actionId:"Chart.ExternalActionId",label:t.text,onExecute:t.click}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}})}}),e}_highlightPriceAxisByLabel(e){this._lhsPriceAxisesContainer.highlightPriceAxisByLabel(e),this._rhsPriceAxisesContainer.highlightPriceAxisByLabel(e)}}var lt=i(14563);i(54119);class ct{constructor(e,t,i){this._handleEl=null,this._startY=0,this._totalStretch=0,this._prevStretchA=0,this._pixelStretchFactor=0,this._minPaneStretch=0,this._maxPaneStretch=0,this._colorCache={lineColor:"",backgroundColor:"",color:""},this._chart=e,this._paneA=e.paneWidgets()[t],this._paneB=e.paneWidgets()[i],this._row=document.createElement("tr"),this._cell=document.createElement("td"),this._row.appendChild(this._cell),this._cell.classList.add("pane-separator"),this._cell.setAttribute("colspan","3"),this._cell.style.background=this._color(),this.adjustSize(),this._cell.addEventListener("click",()=>{});const s=document.createElement("div");s.classList.add("handle"),this._cell.appendChild(s),this._mouseEventHandler=new B.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s}destroy(){this._mouseEventHandler.destroy(),this._row.parentElement&&this._row.parentElement.removeChild(this._row)}getElement(){return this._row}hide(){this._row.classList.add("js-hidden")}show(){this._row.classList.remove("js-hidden")}adjustSize(){this._row.style.height=ct.height()+"px"}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}update(){this._cell.style.background=this._color().toString()}paint(){}image(){const e=this._paneA.leftPriceAxisesContainer().getWidth(),t=this._paneA.width(),i=this._paneA.rightPriceAxisesContainer().getWidth(),s=this._color(),r=(0,N.createDisconnectedCanvas)(document,new N.Size(e,1)),n=(0,N.getPrescaledContext2D)(r);n.fillStyle=s,n.fillRect(0,0,e,1);const o=(0,N.createDisconnectedCanvas)(document,new N.Size(t,1)),a=(0,N.getPrescaledContext2D)(o);a.fillStyle=s,a.fillRect(0,0,t,1);const l=(0,N.createDisconnectedCanvas)(document,new N.Size(i,1)),c=(0,N.getPrescaledContext2D)(l);return c.fillStyle=s,c.fillRect(0,0,i,1),{type:"separator",leftAxis:{content:r.toDataURL(),canvas:r,contentWidth:e,contentHeight:1},rightAxis:{content:l.toDataURL(),canvas:l,contentWidth:i,contentHeight:1},content:o.toDataURL(),canvas:o,contentWidth:t,contentHeight:1}}static height(){const e=window.devicePixelRatio||1;return e>=1?1:1/e} _mouseDownOrTouchStartEvent(e){this._startY=e.pageY,this._prevStretchA=this._paneA.state().stretchFactor(),this._totalStretch=this._paneA.state().stretchFactor()+this._paneB.state().stretchFactor();const t=this._paneA.height()+this._paneB.height();this._pixelStretchFactor=this._totalStretch/t,this._minPaneStretch=30*this._pixelStretchFactor,this._maxPaneStretch=this._totalStretch-this._minPaneStretch,(0,s.ensureNotNull)(this._handleEl).classList.add("i-active")}_pressedMouseOrTouchMoveEvent(e){const t=(e.pageY-this._startY)*this._pixelStretchFactor,i=(0,q.clamp)(this._prevStretchA+t,this._minPaneStretch,this._maxPaneStretch);this._paneA.state().setStretchFactor(i),this._paneB.state().setStretchFactor(this._totalStretch-i),this._chart.model().model().fullUpdate()}_mouseUpOrTouchEndEvent(e){this._chart.model().addPaneStretchFactorUndoCommand(this._paneA.state(),this._paneB.state(),this._prevStretchA,this._paneA.state().stretchFactor()),this._startY=0,this._totalStretch=0,this._prevStretchA=0,this._pixelStretchFactor=0,this._minPaneStretch=0,this._maxPaneStretch=0,(0,s.ensureNotNull)(this._handleEl).classList.remove("i-active")}_color(){const e=this._chart.properties().childs().scalesProperties.childs().lineColor.value(),t=this._chart.model().model().backgroundColor().value();if(this._colorCache.lineColor!==e||this._colorCache.backgroundColor!==t){const i=(0,lt.parseRgba)(t),s=(0,lt.parseRgba)(e),r=0===i[3]&&0===s[3]?"rgba(0,0,0,0)":(0,lt.rgbaToString)((0,lt.blendRgba)(i,s));this._colorCache={lineColor:e,backgroundColor:t,color:r}}return this._colorCache.color}}var ht=i(5729),dt=i.n(ht);function ut(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var pt=i(50968);const _t=new T.TranslatedString("move left",(0,r.t)("move left")),mt=new T.TranslatedString("move right",(0,r.t)("move right")),gt={moving:"wait_finishing",wait_finishing:"stop",stop:"moving"};class ft{constructor(e){this._chartModel=null,this._currentDistance=0,this._deferredFinishTimeout=0,this._finishingTimeout=0,this._moveType="",this._startTime=0,this._state="stop",this._movingTimeout=0,this._chart=e,this._chart.withModel(this,()=>{this._chartModel=this._chart.model()})}destroy(){clearTimeout(this._movingTimeout)}move(e){if(null!==this._chartModel&&"stop"===this._state&&this._chartModel.beginUndoMacro(1===e?_t:mt),this._state=gt.stop,this._moveType="animated",this._deferredFinishTimeout&&(clearTimeout(this._deferredFinishTimeout),this._deferredFinishTimeout=0),this._finishingTimeout&&(clearTimeout(this._finishingTimeout),this._finishingTimeout=0),this._startTime=Date.now(),0===this._movingTimeout){const t=this._startTime,i=10,s=()=>{this.moveStep(t,0,50*e,1e3),this._movingTimeout=setTimeout(s,i)};this._movingTimeout=setTimeout(s,i)}}moveStep(e,t,i,s){if(null!==this._chartModel&&!this._chartModel.timeScale().isEmpty()){const r=Date.now();r1||!isFinite(n))&&(n=1);const o=1-Math.pow(1-n,3);return this._currentDistance=(i-t)*o+t,this._chartModel.scrollChart(this._currentDistance),n}}moveByBar(e){if(null!==this._chartModel){ const t=this._chartModel.timeScale();if(t.isEmpty())return;if("stop"===this._state&&this._chartModel.beginUndoMacro(1===e?_t:mt),null!==t.visibleBarsStrictRange()){const e=t.indexToCoordinate(t.visibleBarsStrictRange().lastBar())+t.barSpacing()/2;Math.abs(t.width()-e)>t.barSpacing()/6&&this._chartModel.scrollChart(t.width()-e)}if(this._state=gt.stop,this._moveType="by_bar",this._startTime=Date.now(),!this._movingTimeout){let t=0,i=150;const s=400,r=()=>{this._moveByBarStep(e),t++,i>100&&(i-=t/5*20),this._movingTimeout=setTimeout(r,i)};this._movingTimeout=setTimeout(r,s),this._moveByBarStep(e)}}}stopMove(){"by_bar"===this._moveType?this.stopMoveByBar():this._stopMove()}stopMoveByBar(){"moving"===this._state&&(clearTimeout(this._movingTimeout),this._movingTimeout=0,this._state=gt.wait_finishing,this._moveType="",this._movingTimeout=0,this._currentDistance=0,null!==this._chartModel&&this._chartModel.endUndoMacro())}_finishMove(){clearTimeout(this._movingTimeout),this._movingTimeout=0,this._deferredFinishTimeout=0;const e=this._currentDistance,t=Date.now(),i=()=>{const s=this.moveStep(t,e,0,700);s&&s<1?this._finishingTimeout=setTimeout(i,10):null!==this._chartModel&&(this._state=gt.wait_finishing,this._moveType="",this._movingTimeout=0,this._currentDistance=0,this._chartModel.endUndoMacro())};this._finishingTimeout=setTimeout(i,10)}_stopMove(){"moving"===this._state&&(this._state=gt.moving,Date.now()-this._startTime<200?this._deferredFinishTimeout=setTimeout(this._finishMove.bind(this),200-(Date.now()-this._startTime)):this._finishMove())}_moveByBarStep(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;this._chartModel.scrollChartByBar(e)}}}var vt=i(25436),St=i(1467);class yt{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,s.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0,s.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,s.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}let bt=null;function wt(e,t,s,r,n){ return Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3894),i.e(3996),i.e(4078),i.e(8193),i.e(7936),i.e(3708),i.e(706),i.e(8604),i.e(9602),i.e(8858),i.e(6473),i.e(6548),i.e(9305),i.e(2778),i.e(83),i.e(8933),i.e(587),i.e(1778),i.e(8969),i.e(6333),i.e(2321),i.e(6612),i.e(2162),i.e(2091),i.e(6143),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7591),i.e(9772),i.e(8680),i.e(708),i.e(2391),i.e(7365),i.e(847),i.e(2444),i.e(8625),i.e(7703),i.e(9628),i.e(7371),i.e(4093),i.e(739),i.e(6265)]).then(i.bind(i,19442)).then(i=>{const o=new(0,i.EditObjectDialogRenderer)(e,t,r,n);return o.show(s),o})}let Pt=null;var Ct=i(65528);const Tt={[De.TabNames.symbol]:"symbol",[De.TabNames.legend]:"legend",[De.TabNames.scales]:"scales",[De.TabNames.trading]:"trading",[De.TabNames.events]:"events",[De.TabNames.timezoneSessions]:"appearance",[De.TabNames.text]:"text",[De.TabNames.style]:"style",[De.TabNames.visibility]:"visibility"},xt={[De.TabNames.style]:"style",[De.TabNames.visibility]:"visibilities"};async function It(e,t,s={},r,n){const o=r.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=xt[l]),(0,f.isStudyLineTool)(e)&&function(e){return[Ct.LineToolVbPFixed].some(t=>e instanceof t)}(e))return o.propertiesDefinitionsForSource(e).then(i=>null!==i?wt(e,t,s,n,i):null);if((0,v.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,f.isLineTool)(e))return o.propertiesDefinitionsForSource(e).then(s=>{if(null!==s){return function(e){return Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3894),i.e(3996),i.e(4078),i.e(8193),i.e(7936),i.e(3708),i.e(706),i.e(8604),i.e(9602),i.e(8858),i.e(6548),i.e(9305),i.e(2778),i.e(83),i.e(8933),i.e(587),i.e(1778),i.e(8969),i.e(6333),i.e(2091),i.e(5637),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7591),i.e(9772),i.e(8680),i.e(708),i.e(2391),i.e(7365),i.e(847),i.e(2444),i.e(8625),i.e(7703),i.e(739),i.e(6780)]).then(i.bind(i,35971)).then(t=>{const i=new(0,t.SourcePropertiesEditorRenderer)(e);return null!==Pt&&Pt.hide(),i.show(),Pt=i,i})}({propertyPages:s,model:t,source:e,activePageId:l&&Tt[l]})}return null});if((0,v.isStudy)(e)&&!(0,v.isESDStudy)(e))return wt(e,t,s,n);{const t=(0,v.isESDStudy)(e)?"events":l&&Tt[l],i=r.getChartPropertiesDialogRenderer();return i.setActivePage(t),i.show()}}const Mt=(0,se.enabled)("chart_content_overrides_by_defaults"),Lt=(0,n.getLogger)("ChartWidget",{color:"#606"});const At={addToWatchlistEnabled:!0,showFinancialsEnabled:!1,sourceSelectionEnabled:!0,propertyPagesEnabled:!0,paneContextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,goToDateEnabled:!1,marketStatusWidgetEnabled:!0,chartWarningWidgetEnabled:!0,dataProblemWidgetEnabled:!0,paneControlsEnabled:!0,isSymbolAvailable:e=>Promise.resolve(!0),legendWidgetEnabled:!0,chartEventsEnabled:!0,esdEnabled:!1,croppedTickMarks:!0,countdownEnabled:!0, lastPriceAnimationEnabled:!0,useKineticScroll:l.CheckMobile.any(),indicatorsDialogShortcutEnabled:!0,handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:{time:!0,price:!0}},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}};function kt(e,t,i,s=0){const r=t.mainSeries().syncModel(),n=e.mainSeries().syncModel();let o=i;if(null!==r&&null!==n){const t=e.createSyncPoint(r,n);0!==s&&(i=r.projectTime(i,s)),o=t.sourceTimeToTargetTime(i)}return e.timeScale().points().roughIndex(o,n&&n.distance.bind(n))}class Et{constructor(e,t,i){this.activePaneWidget=null,this._model=null,this._paneWidgets=[],this._maximizedPaneWidget=null,this._timeAxisWidget=null,this._paneSeparators=[],this._controlBarNavigation=null,this._lineToolsSynchronizer=null,this._modelCreated=new(dt()),this._isDestroyed=!1,this._customLegendWidgetsFactoryMap=new Map,this._backgroundTopTheme=new(Ie())("light"),this._backgroundBasedTheme=new(Ie())("light"),this._backgroundBottomTheme=new(Ie())("light"),this._lhsAxesWidth=0,this._rhsAxesWidth=0,this._lhsPriceAxisWidthChanged=new(dt()),this._rhsPriceAxisWidthChanged=new(dt()),this._mainDiv=null,this._parent=null,this._elTooltipDiv=null,this._hotkeysListener=null,this._mouseWheelHelper=null,this._onWheelBound=null,this._justActivated=!1,this._inited=!1,this._containsData=!1,this._initialLoading=!1,this._defTimeframe=void 0,this._removeMaximizeHotkey=null,this._metaInfoRepository=null,this._invalidationMask=null,this._drawPlanned=!1,this._drawRafId=0,this._inLoadingState=!1,this._timingsMeter=null,this._tagsChanged=new(dt()),this._redraw=new(dt()),this._isVisible=new(Ie())(!0),this._collapsed=new(Ie())(!1),this._dataWindowWidget=null,this._mainSeriesErrorMessage=null,this._properties=null,this._updateThemedColorBound=this._updateThemedColor.bind(this),this._saveChartService=null,this._objectTreeDialogController=null,this._chartPaintedPromise=null,this._noExchangeSubscrptionWarning=null,this._paneWidgetsSharedState=new yt,this._brokerName="",this._onZoom=new(dt()),this._id=t,this._layoutId=i,this._options=(0,_.merge)((0,_.clone)(At),e),this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._subscribeToDrawingState(),this.withModel(this,()=>{const e=this.model().model();e.backgroundTopColor().subscribe(this._updateThemedColorBound),e.backgroundColor().subscribe(this._updateThemedColorBound)}),this._subscribeToMainSeriesErrors(),this._scrollHelper=new ft(this),this._objectTreeDialogController=p.getInstance(),this._properties=new y.DefaultProperty("chartproperties",void 0,void 0,this._options.useUserChartPreferences),this._properties.addExclusion("scalesProperties.axisHighlightColor"),this._properties.addExclusion("scalesProperties.axisLineToolLabelBackgroundColorActive"),this._properties.addExclusion("scalesProperties.axisLineToolLabelBackgroundColorCommon"),this._properties.addExclusion("scalesProperties.showPriceScaleCrosshairLabel"),this._properties.addExclusion("scalesProperties.showTimeScaleCrosshairLabel")} destroy(){var e,t,i;null===(e=this._lineToolsSynchronizer)||void 0===e||e.destroy(),null===(t=this._noExchangeSubscrptionWarning)||void 0===t||t.destroy(),window.loginStateChange.unsubscribe(this,this._handleLoginStateChanged),null!==this._model&&(this._model.model().backgroundTopColor().unsubscribe(this._updateThemedColorBound),this._model.model().backgroundColor().unsubscribe(this._updateThemedColorBound),this._model.destroy()),this._customLegendWidgetsFactoryMap.clear(),this._scrollHelper.destroy(),null===(i=this._mainSeriesErrorMessage)||void 0===i||i.destroy(),this._isDestroyed=!0}lineToolSynchronizer(){return this._lineToolsSynchronizer}model(){return(0,s.ensureNotNull)(this._model)}id(){return this._id}layoutId(){return this._layoutId}isVisible(){return this._isVisible.value()}setVisible(e){this._isVisible.setValue(e)}setCollapsed(e){this._collapsed.setValue(e)}async showChartPropertiesForSources(e){if(!(0,se.enabled)("property_pages"))return Promise.resolve(null);const{sources:t}=e,n=(0,s.ensureNotNull)(this._model),o=t.map(e=>e.properties().childs().intervalsVisibilities).reduce((e,t)=>{for(const i in t)if(ut(t,i)){const s=t[i],r=e[i];r?r.push(s):e[i]=[s]}return e},{});const[{createPropertyPage:a},{getSelectionIntervalsVisibilitiesPropertiesDefinition:l}]=await Promise.all([Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,97806)),Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,63725))]);return async function(e){const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3894),i.e(3996),i.e(4078),i.e(8193),i.e(7936),i.e(3708),i.e(706),i.e(8604),i.e(9602),i.e(8858),i.e(6548),i.e(9305),i.e(2778),i.e(83),i.e(8933),i.e(587),i.e(1778),i.e(8969),i.e(6333),i.e(2091),i.e(5637),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7591),i.e(9772),i.e(8680),i.e(708),i.e(2391),i.e(7365),i.e(847),i.e(2444),i.e(8625),i.e(7703),i.e(739),i.e(6780)]).then(i.bind(i,88114)),s=new t(e);return null!==bt&&(bt.hide(),bt=s),s.show(),s}({sources:t,propertyPage:a(l(o,n),"visibility",(0,r.t)("Visibility")),undoModel:n})}getPriceAxisWidthChangedByName(e){return"left"===e?this._lhsPriceAxisWidthChanged:this._rhsPriceAxisWidthChanged}getPriceAxisMaxWidthByName(e){return"left"===e?this._lhsAxesWidth:this._rhsAxesWidth}timeAxisHeight(){return null!==this._timeAxisWidget?this._timeAxisWidget.size.h:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){return null!==this._model}onZoom(){return this._onZoom}images(e){window.TradingView.printing=!0;const t=this.model().selection().allSources();this.model().selectionMacro(e=>e.clearSelection());const i=(t,i)=>{t.paint(i,this.onWidget());const s={showCollapsedStudies:Boolean(null==e?void 0:e.showCollapsedStudies),status:null==e?void 0:e.status};return t.getScreenshotData(s)},s=[];if(null!==this._maximizedPaneWidget){const e=this._paneWidgets.indexOf(this._maximizedPaneWidget) ;s.push(i(this._maximizedPaneWidget,b.InvalidationMask.light().invalidateForPane(e)))}else for(let e=0;e{t.forEach(t=>{e.addSourceToSelection(t)})}),this.model().model().lightUpdate();const n=this.mainSeriesQuotesAndMetainfo();return{panes:s,timeAxis:r,colors:{text:this.properties().childs().scalesProperties.childs().textColor.value(),bg:this.properties().childs().paneProperties.childs().background.value(),scales:this.properties().childs().scalesProperties.childs().lineColor.value()},meta:n.meta,ohlc:n.ohlc,quotes:n.quotes}}setSaveChartService(e){this._saveChartService=e,null!==this._lineToolsSynchronizer&&this._lineToolsSynchronizer.setSaveChartService(e)}getSaveChartService(){return this._saveChartService}mainSeriesQuotesAndMetainfo(){let e,t,i;const s=this._model&&this._model.mainSeries();if(s){const r=e=>null==e?"":s.formatter().format(e,void 0,void 0,!0,!1)+"",n=e=>null==e?"":e+"";e={resolution:s.interval(),symbol:s.symbol(),values:s.valuesProvider().getValues(null)};const o=s.symbolInfo();o&&(e.symbol=o.full_name,e.description=o.description,e.exchange=o.exchange);const a=s.bars().last();null!==a&&(t=a.value.slice(1,5).map(r));const l=s.quotes();l&&(i={change:r(l.change),changePercent:n(l.change_percent),last:r(l.last_price)})}return{meta:e,ohlc:t,quotes:i}}updateCrossHairPositionIfNeeded(){if(this._model){const e=E.tool.value();this._model.model().setCurrentTool(e);const t=(0,x.lastMouseOrTouchEventInfo)();if(t.isTouch){const e=this._maximizedPaneWidget||this._paneWidgets[0];if(e.hasState()&&(!t.stylus&&(this._isLineToolModeExceptBrush()||(0,E.toolIsMeasure)(E.tool.value()))||this.selectPointMode().value())){const t=e.state(),i=.5*this._model.model().timeScale().width(),s=.5*t.defaultPriceScale().height();this._model.model().setAndSaveCurrentPosition(i,s,t)}}this._model&&t.isTouch&&this._model.model().crossHairSource().updateAllViews()}}trackingModePaneWidget(){if(!(0,x.lastMouseOrTouchEventInfo)().isTouch)return null;for(const e of this.paneWidgets())if(e.trackingModeEnabled())return e;return null}startTrackingMode(){if((0,x.lastMouseOrTouchEventInfo)().isTouch){this.exitTrackingMode(),this.updateCrossHairPositionIfNeeded();const e=this._maximizedPaneWidget||this._paneWidgets[0],t=this.model().model().crossHairSource().currentPoint();e.startTrackingMode(t,t)}}exitTrackingMode(){(0,x.lastMouseOrTouchEventInfo)().isTouch&&this.paneWidgets().some(e=>e.trackingModeEnabled())&&(this.paneWidgets().forEach(e=>e.exitTrackingMode()),this.model().model().clearCurrentPosition())}onToolChanged(){this.selectPointMode().value()&&this.cancelRequestSelectPoint(),this.exitTrackingMode()}setInLoadingState(e){this._inLoadingState=e}paint(e){ const t=null!=e?e:b.InvalidationMask.full();t.validationActions().forEach(e=>e()),this._paneWidgets.forEach((e,i)=>{null!==this._maximizedPaneWidget&&this._maximizedPaneWidget!==e||e.paint(t.invalidateForPane(i),!1)}),this._timeAxisWidget&&this._timeAxisWidget.paint(t.invalidateForTimeScale()),this._redraw.fire()}GUIResetScales(){(0,U.trackEvent)("GUI","Reset Scales"),null!==this._model&&this._model.resetScales()}maximizedPaneWidget(){return this._maximizedPaneWidget}isMaximizedPane(){return null!==this._maximizedPaneWidget}unsetActivePaneWidget(){this.activePaneWidget=null}setActivePaneWidget(e){this.activePaneWidget=e}onPaneWidgetDestroyed(e){this.activePaneWidget===e&&(this.activePaneWidget=null)}backgroundTopTheme(){return this._backgroundTopTheme.readonly()}backgroundBasedTheme(){return this._backgroundBasedTheme.readonly()}backgroundBottomTheme(){return this._backgroundBottomTheme.readonly()}lineToolsAndGroupsDTO(){return(0,s.ensureNotNull)(this._lineToolsSynchronizer).prepareDTO()}resetLineToolsInvalidated(e,t,i){(0,s.ensureNotNull)(this._lineToolsSynchronizer).resetInvalidated(e,t,i)}applyLineToolUpdateNotification(e,t){(0,s.ensureNotNull)(this._lineToolsSynchronizer).applyLineToolUpdateNotification(e,t)}reloadAllLineTools(e){(0,s.ensureNotNull)(this._lineToolsSynchronizer).reloadAllLineTools(e)}startApplyingLineToolUpdateNotification(){var e;null===(e=this._lineToolsSynchronizer)||void 0===e||e.startApplyingLineToolUpdateNotification()}endApplyingLineToolUpdateNotification(){var e;null===(e=this._lineToolsSynchronizer)||void 0===e||e.endApplyingLineToolUpdateNotification()}applyAlertIdByExternalSource(e,t){var i;null===(i=this._lineToolsSynchronizer)||void 0===i||i.applyAlertIdByExternalSource(e,t)}deleteAlertByExternalSource(e,t){var i;null===(i=this._lineToolsSynchronizer)||void 0===i||i.deleteAlertByExternalSource(e)}shouldBeSavedEvenIfHidden(){return this.model().model().shouldBeSavedEvenIfHidden()}showObjectsTreeDialog(){var e;null===(e=this._objectTreeDialogController)||void 0===e||e.show()}addCustomWidgetToLegend(e,t){this._customLegendWidgetsFactoryMap.set(e,t);for(const i of this.paneWidgets())i.addCustomWidgetToLegend(e,t)}applyIndicatorsToAllChartsAvailable(){if(!this.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return!1;for(const e of this.model().model().panes()){if(e.sourcesByGroup().all().some(e=>(0,v.isStudy)(e)&&!(0,v.isESDStudy)(e)))return!0}return!1}restoreState(e,t,i){this._adjustSize();(0,s.ensureNotNull)(this._model).restoreState(this._content,t,i);this._setActions()}addCompareAsOverlay(e,t){const i=this.model();return(0,s.ensureDefined)(this._options.isSymbolAvailable)(e).then(s=>{if(!s)return null;const r=i.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"});return r.setForceOverlay(!0),r.setPreferredPriceScale("as-series"),r.setTargetPriceScaleMode({percentage:!0}),void 0!==t&&r.setPropertiesState({allowExtendTimeScale:t}),r.insert(async()=>({inputs:{symbol:e}}))})}scrollHelper(){return this._scrollHelper}setBroker(e){var t;this._brokerName=e, null===(t=this._lineToolsSynchronizer)||void 0===t||t.setBroker(e)}chartPainted(){return this._drawPlanned?(null===this._chartPaintedPromise&&(this._chartPaintedPromise=(0,c.createDeferredPromise)()),this._chartPaintedPromise.promise):Promise.resolve()}setDataWindowWidget(e){this._dataWindowWidget=e}removeDataWindowWidget(){this._dataWindowWidget=null}showSelectedSourcesProperties(){const e=(0,s.ensureNotNull)(this._model).selection().dataSources(),t=e.length;1===t?this.showSourceProperties(e[0]):t>0&&e.every(e=>(0,f.isLineTool)(e))&&this.showChartPropertiesForSources({sources:e})}async _showChartProperties(e,t,i,s){if(!this._model)return null;t&&((0,a.setValue)("properties_dialog.active_tab.chart",t),i.tabName=t);const r=await It(e,this._model,i,this._options.chartWidgetCollection,s);return(null==r?void 0:r.visible().value())?r:null}_createLineToolsSynchronizerIfNeeded(){0}_updateThemedColor(){const e=this.model().model(),t=e.backgroundColorAtYPercentFromTop(.5);let i=e.backgroundTopColor().value(),s=e.backgroundColor().value();const r=(0,pt.isColorDark)(t),n=(0,pt.isColorDark)(i),o=(0,pt.isColorDark)(s);this.widget().classList.toggle("chart-widget--themed-dark",r),this.widget().classList.toggle("chart-widget--themed-light",!r),this.widget().classList.toggle("chart-widget__top--themed-dark",n),this.widget().classList.toggle("chart-widget__top--themed-light",!n),this.widget().classList.toggle("chart-widget__bottom--themed-dark",o),this.widget().classList.toggle("chart-widget__bottom--themed-light",!o),this._backgroundTopTheme.setValue(n?"dark":"light"),this._backgroundBasedTheme.setValue(r?"dark":"light"),this._backgroundBottomTheme.setValue(o?"dark":"light"),i===s&&(0,F.isStdThemedDefaultValue)("chartProperties.paneProperties.background",i,this._backgroundBasedTheme.value())&&(i=null,s=null);for(const e of this._paneWidgets)e.updateThemedColors({topColor:i,bottomColor:s})}_isLineToolModeExceptBrush(){const e=E.tool.value();return(0,f.isLineToolName)(e)&&!(0,f.isLineDrawnWithPressedButton)(e)&&!this.selectPointMode().value()}_cancelCreatingLine(){const e=(0,s.ensureNotNull)(this._model).model(),t=e.lineBeingCreated();if(null!==t){const i=(0,s.ensureNotNull)(e.paneForSource(t));(0,s.ensureNotNull)(this.paneByState(i)).cancelCreatingLineTool()}const i=e.crossHairSource().measurePane();if(null!==i){(0,s.ensureNotNull)(this.paneByState(i)).cancelMeasuring()}}_adjustSize(e){var t;let i=0;const s=null===this._model?null:this._model.model().priceScaleSlotsCount(),r=new Uint32Array(null===s?0:s.left),n=new Uint32Array(null===s?0:s.right),o=(0,N.getCanvasDevicePixelRatio)(document.body),a=(e,t)=>e+t,l=(e,t)=>{t.forEach((t,i)=>{e[i]=Math.max(e[i],t)})};for(const e of this._paneWidgets)if(!this._maximizedPaneWidget||this._maximizedPaneWidget===e){e.leftPriceAxisesContainer().updateCurrencyLabels();const t=e.leftPriceAxisesContainer().optimalWidths();e.rightPriceAxisesContainer().updateCurrencyLabels();const s=e.rightPriceAxisesContainer().optimalWidths();l(r,t),l(n,s),i+=e.stretchFactor()}let c=r.reduce(a,0),d=n.reduce(a,0) ;const u=this._width(),p=this._height();let _=Math.max(u-c-d,0);if(_<=102){c=0,d=0,_=u;for(let e=0;e=61?v:0;S%2&&(S+=1);const y=f+S,b=p0){ const e=new ct(this,s-1,s);this._paneSeparators.push(e),this._timeAxisWidget?this._elMainTable.insertBefore(e.getElement(),this._timeAxisWidget.getElement()):this._elMainTable.appendChild(e.getElement())}this._timeAxisWidget?this._elMainTable.insertBefore(i.getElement(),this._timeAxisWidget.getElement()):this._elMainTable.appendChild(i.getElement())}for(let i=0;i{this._controlBarNavigation=new e.ControlBarNavigation(this,(0, s.ensureNotNull)(this._mainDiv),this._options.controlBar),this._model&&this._adjustSize()}),this._options.handleScale.mouseWheel||this._options.handleScroll.mouseWheel){this._mouseWheelHelper=new Q;const e=this._onMousewheel.bind(this);this._onWheelBound=e,this._mainDiv.addEventListener("wheel",e,{passive:!1})}this.resize(),this._justActivated=!1,this.withModel(this,()=>{r.appendChild(n),n.addEventListener("mousedown",this._beginRequestActive.bind(this)),n.addEventListener("mouseup",this._endRequestActive.bind(this)),n.addEventListener("touchstart",this._beginRequestActive.bind(this)),n.addEventListener("touchmove",this._endRequestActive.bind(this)),n.addEventListener("touchend",this._endRequestActive.bind(this)),n.addEventListener("click",this._requestActive.bind(this))}),this._inited&&(null!==this._timeAxisWidget&&(this._timeAxisWidget.destroy(),this._timeAxisWidget=null),this._paneWidgets.forEach(e=>{e.destroy()}),this._paneWidgets.length=0,this._paneSeparators.forEach(e=>{e.destroy()}),this._paneSeparators.length=0,this._update(b.InvalidationMask.full()))}_makeDefaultModel(){let e;if(this._content&&this._content.timeScale.points){const t=this._content.timeScale.points.items[0];e={startDate:t}}if(!(0,s.ensureNotNull)(this._metaInfoRepository).getInternalMetaInfoArray())throw new Error("Cannot create chart model: studies metainfo is absent");const t=()=>{this._drawPlanned=!1,this._drawRafId=0,this._inLoadingState||(this._invalidationMask&&(this._update(this._invalidationMask),this._invalidationMask=null),null!==this._chartPaintedPromise&&(this._chartPaintedPromise.resolve(),this._chartPaintedPromise=null))},i=()=>{var i,r;const n={readOnly:this.readOnly(),isSnapshot:!!this._containsData,...o(this._options,["timeScale","crossHair","esdEnabled","countdownEnabled","lastPriceAnimationEnabled","currencyConversionEnabled","unitConversionEnabled","watermarkEnabled","shiftVisibleRangeOnNewBar","hideIdeas","onWidget"])};let a;a=this._collapsed;const l=function(e,t,i,s,r,n,o,a,l,c,h){const d=new g.ChartUndoModel(e,t,i,s,r,n,o,a,l,c,h);return d.model().fullUpdate(),d}(this._chartSession,e=>{if(!(e instanceof b.InvalidationMask))throw new Error("Invalid mask");null!==this._invalidationMask?this._invalidationMask.merge(e):this._invalidationMask=e,this._drawPlanned||(this._drawPlanned=!0,this._options.visible.when(()=>{const e=!document.hidden,i=this.screen&&this.screen.isShown();null!==this._timingsMeter&&e&&!i&&this._timingsMeter.startWaitingDraw();const r=(0,s.ensureNotNull)((0,s.ensureNotNull)(this._parent).ownerDocument.defaultView);this._drawRafId=r.requestAnimationFrame(t)}))},this.properties(),e,(0,s.ensureNotNull)(this._metaInfoRepository),this,this._options.undoHistory,this._options.barsMarksContainersFactory,n,a,null!==(r=null===(i=this._saveChartService)||void 0===i?void 0:i.autoSaveEnabled())&&void 0!==r?r:new(Ie())(!0));return this._createSessions(l.model()),l};(0,se.enabled)("lean_chart_load")?this._model=this._model||i():this._model=i(),this._createVolumeIfNeeded();if(this._content){let e={} ;Mt&&this._initialLoading&&(e={symbol:this._defSymbol,interval:this._defInterval,style:this._defStyle}),this.restoreState(this._content,this._containsData,e),Mt&&this._defSymbol&&this.model().model().recalculatePriceRangeOnce()}else this._setActions();return this._createLineToolsSynchronizerIfNeeded(),(()=>{const e=(0,s.ensureNotNull)(this._model);e.onTagsChanged().subscribe(this,()=>this.onModelTagsChanged()),this._initBackgroundColor(),this._updateGui(),this._modelCreated.fire(e),this._tagsChanged.fire();const t=e.mainSeries(),i=t.properties().childs();this._defTimeframe&&t.setDefaultTimeframe(this._defTimeframe),e.lineCancelled().subscribe(this,()=>this.onLineCancelled()),t.dataEvents().symbolNotPermitted().subscribe(null,e=>{i.symbol.setValue(e)}),i.style.unsubscribe(this,this._onChartStyleChanged),i.style.subscribe(this,this._onChartStyleChanged),t.dataEvents().completed().subscribe(this,()=>this._addPerfMark("SeriesCompleted"),!0),t.dataEvents().barReceived().subscribe(this,()=>this._addPerfMark("SeriesFirstDataReceived"),!0);this._options;t.dataEvents().chartTypeNotPermitted().subscribe(null,()=>{i.interval.setValue("D")}),t.dataEvents().intradaySpreadNotPermitted().subscribe(null,()=>{i.interval.setValue("D")}),t.dataEvents().customIntervalNotPermitted().subscribe(null,()=>{i.interval.setValue((0,St.getDefaultResolution)((0,vt.isRangeStyle)(i.style.value())))}),t.dataEvents().intradayExchangeNotPermitted().subscribe(null,()=>{i.interval.setValue("D")}),t.requestingResolutionWhenNotSupported.subscribe(null,e=>t.setInterval(e)),t.requestingStyleIsNotSupported.subscribe(null,()=>{const i=t.interval(),s=e.model().defaultResolutions(),r=(0,vt.getLastUsedSingleValueBasedStyle)(),n=(0,St.getResolutionByChartStyle)(r,i,s);t.setChartStyleWithIntervalIfNeeded(r,n)}),t.requestingStyleSupportRecovered.subscribe(null,i=>{const s=t.interval(),r=e.model().defaultResolutions(),n=(0,St.getResolutionByChartStyle)(i,s,r);t.setChartStyleWithIntervalIfNeeded(i,n)})})()}_initBarsMarksSources(){this.withModel(this,()=>{for(const e of this.model().barsMarksSources())e.onNeedRepaint.subscribe(this,()=>this.model().model().lightUpdate())})}_handleLoginStateChanged(){0}_subscribeToMainSeriesErrors(){this.withModel(this,()=>{const e=this.model().model().mainSeries();let t;t=new(Ie())(!1).readonly(),this._mainSeriesErrorMessage=(0,m.combine)((e,t,i)=>{switch(t){case 4:return{message:(0,r.t)("Invalid symbol"),icon:"ghost"};case 1:case 2:break;default:if(i)return{message:(0,r.t)("No data here"),icon:"ghost"}}return null},t,(0,S.createWVFromGetterAndSubscription)(()=>e.status(),e.onStatusChanged()),(0,S.createWVFromGetterAndSubscription)(()=>!e.bars().size(),e.dataEvents().dataUpdated()),(0,S.createWVFromGetterAndSubscription)(()=>({}),this.model().model().onChartThemeLoaded())),this._mainSeriesErrorMessage.subscribe(e=>{this._paneWidgets.forEach(t=>t.setErrorMessage(e))},{callWithLast:!0})})}_subscribeToDrawingState(){if(this._options.readOnly)return;(0,E.init)();const e=(e,t)=>{if(null===this._model)return;const i=this._model.model() ;e.model!==i&&t(i,this._model)};E.createdLineTool.subscribe(null,t=>{e(t,(e,i)=>{const r=(0,s.ensureNotNull)(e.paneForSource(e.mainSeries()));let n,o=null;if(void 0===t.pointPositionPercents){if(o=kt(e,t.model,t.point.timeStamp),null===o)return;n=t.point.price}else{const i=t.pointPositionPercents.x*e.timeScale().width(),s=e.mainSeries().priceScale(),r=t.pointPositionPercents.y*s.height(),a=e.mainSeries().firstValue();if(null===a)return;o=e.timeScale().coordinateToIndex(i),n=s.coordinateToPrice(r,a)}const a={index:(0,s.ensureNotNull)(o),price:n},l=i.createLineTool(r,a,t.linetool,t.properties,t.linkKey,e.mainSeries(),!0);null!==l&&!Boolean(this.model().lineBeingCreated())&&t.finalState&&l.restoreExternalPoints(t.finalState,{indexesChanged:!0,pricesChanged:!0})})}),E.continuedLineTool.subscribe(null,t=>{e(t,(e,i)=>{var s;const r=kt(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price},o=e.lineBeingCreated();if(null===o)return;i.continueExternalLine(n,null!==(s=t.envState)&&void 0!==s?s:void 0,!!t.finalState)&&t.finalState&&o.restoreExternalPoints(t.finalState,{indexesChanged:!0,pricesChanged:!0})})}),E.cancelledLineTool.subscribe(null,t=>{e(t,(e,t)=>{e.cancelCreatingLine()})}),E.beenSetLineToolLastPoint.subscribe(null,t=>{e(t,(e,i)=>{const s=e.lineBeingCreated();if(null===s||s.linkKey().value()!==t.linkKey)return;const r=kt(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price};s.setLastPoint(n),s.updateAllViews(),e.lightUpdate()})}),E.startedMovingLineTool.subscribe(null,t=>{e(t,(e,i)=>{var s;const r=t.linkKeys.map(f.lineToolByLinkKey.bind(null,e)).filter(_.notNull);if(r.length){const i=kt(e,t.model,t.point.timeStamp);if(null===i)return;const n={index:i,price:t.point.price},o=null!==(s=t.activeItem)&&void 0!==s?s:null,a=r[0].pointToScreenPoint(n);a&&e.startMovingSources(r,{logical:n,screen:a},o,t.pointPositionPercents,null===t.envState?void 0:t.envState,!0)}})}),E.movedLineTool.subscribe(null,t=>{e(t,(e,i)=>{var s;const r=e.sourcesBeingMoved().filter(f.isLineTool).filter(e=>(e=>t.linkKeys.some(t=>e.linkKey().value()===t))(e));if(!r.length)return;const n=kt(e,t.model,t.point.timeStamp);if(null===n)return;const o={index:n,price:t.point.price},a=r[0].pointToScreenPoint(o);a&&e.moveSources({logical:o,screen:a},t.pointPositionPercents,null!==(s=t.envState)&&void 0!==s?s:void 0,!0)})}),E.finishedMovingLineTool.subscribe(null,t=>{e(t,(e,i)=>{const s=e.sourcesBeingMoved().filter(f.isLineTool);if(0===s.length)return;s.forEach(i=>{const s=(e=>{for(let i=0;i{e(t,(e,i)=>{var s;const r=(0,f.lineToolByLinkKey)(e,t.linkKey);if(null!==r){const i=r.getPoint(t.pointIndex),n=i?i.index:kt(e,t.model,t.point.timeStamp) ;if(null===n)return;if(r.isActualSymbol()&&r.isActualCurrency()&&r.isActualUnit()){const i={index:n,price:t.point.price};e.startChangingLinetool(r,i,t.pointIndex,null!==(s=t.envState)&&void 0!==s?s:void 0,!0)}}})}),E.changedLineTool.subscribe(null,t=>{e(t,(e,i)=>{const r=e.lineBeingEdited();if(null===r||r.linkKey().value()!==t.linkKey)return;let n=null;if(n=t.changes.indexesChanged?kt(e,t.model,t.point.timeStamp):(0,s.ensureNotNull)(e.linePointBeingChanged()).index,null!==n&&r.isActualSymbol()&&r.isActualCurrency()&&r.isActualUnit()){const i={index:n,price:t.point.price};e.changeLinePoint(i,void 0,!0)}})}),E.finishedChangingLineTool.subscribe(null,t=>{e(t,(e,i)=>{const s=(0,f.lineToolByLinkKey)(e,t.linkKey);null!==s&&s.isActualSymbol()&&s.isActualCurrency()&&s.isActualUnit()&&null!==e.lineBeingEdited()&&e.endChangingLinetool(!!t.finalState,!0),null!==s&&t.finalState&&s.restoreExternalPoints(t.finalState,t.changes)})}),E.removedLineTool.subscribe(null,t=>{e(t,(e,i)=>{const{withUndo:s,unlink:r,linkKey:n}=t,o=(0,f.lineToolByLinkKey)(e,n);if(null!==o)r&&o.detachAlert(),s?i.removeSource(o,!1):e.removeSource(o);else if(this._lineToolsSynchronizer){const{sourceTitle:e,symbol:o,lineToolState:a}=t;i.removeUnloadedLineTool({lineToolsSynchronizer:this._lineToolsSynchronizer,state:a,unlink:r,sourceTitle:e,linkKey:n,symbol:o,withUndo:s})}})}),E.finishedLineTool.subscribe(null,t=>{e(t,(e,i)=>{const s=(0,f.lineToolByLinkKey)(e,t.linkKey);null!==s&&(0,f.isLineDrawnWithPressedButton)(s.toolname)&&s.finish()})}),E.changedLineStyle.subscribe(null,t=>{e(t,(e,i)=>{const s=(0,f.lineToolByLinkKey)(e,t.linkKey);null!==s&&(s.restoreExternalState(t.state),s.propertiesChanged(!0),t.alertId&&s.syncAlert(t.alertId))})}),E.restoredLineToolState.subscribe(null,t=>{e(t,(e,i)=>{const s=(0,f.lineToolByLinkKey)(e,t.linkKey);if(null!==s){const i={...t.state};i.indexes=t.state.points.map(i=>({index:kt(e,t.model,i.time_t),price:i.price})),e.restoreLineToolState(s,i)}})}),E.restoredLineTool.subscribe(null,t=>{e(t,(e,i)=>{e.restoreSource(t.state.restorePane,t.state.paneIndex,t.state.paneState,t.state.sourceState,null)})}),E.copiedLineTool.subscribe(null,t=>{e(t,(e,i)=>{const r=(0,s.ensureNotNull)(e.paneForSource(e.mainSeries()));let n;const o=(0,f.createLineToolProperties)(t.linetool,t.state,e);if(t.pointPositionPercents){const e={index:0,price:0};if(n=i.createLineTool(r,e,t.linetool,o,t.linkKey,void 0,!0),null===n)return;n.restorePositionPercents((0,s.ensureDefined)(t.pointPositionPercents))}else{const a=t.points.map(i=>({index:(0,s.ensureNotNull)(kt(e,t.model,i.timeStamp)),price:i.price})),l=a[0];if(n=i.createLineTool(r,l,t.linetool,o,t.linkKey,void 0,!0),null===n)return;if(e.lineBeingCreated())for(let e=1;e{"use strict";i.r(t),i.d(t,{applyIndicatorToAllChartsImpl:()=>j,applyIndicatorsToAllChartsImpl:()=>U,applyLineToolUpdateNotificationImpl:()=>X,chartsSymbolsImpl:()=>Q,copyScreenshotToClipboard:()=>re,createChartStorageSubscriptionsIfRequired:()=>ee,createClipboardHandler:()=>Z,downloadScreenshot:()=>se,getAsyncStateForChartImpl:()=>$,getClientSnapshot:()=>oe,getSnapshot:()=>ne,getStateForChartImpl:()=>Y,lineToolsAndGroupsDTOsImpl:()=>q,resetLineToolsInvalidatedImpl:()=>K,setBrokerImpl:()=>J,takeScreenshot:()=>te,takeServerScreenshot:()=>ie});var s=i(16282),r=i(79881),n=i(90963),o=i(5980);class a extends o.UndoCommand{constructor(e,t){super(null),this._chartModel=e,this._targetIndex=t}redo(){const e=this._chartModel.createPane(this._targetIndex,void 0,this._paneId);this._paneId=e.id()}undo(){const e=(0,s.ensureDefined)(this._paneId),t=this._chartModel.panes().find(t=>t.id()===e);void 0!==t&&this._chartModel.removePane(t)}createdPaneId(){return this._paneId}}var l=i(65447),c=i(5225),h=i(33350);const d=(0,l.getLogger)("Clipboard");class u{constructor(e){this._e=e}write(e){return(0,h.writeImpl)(this._toRaw(e),this._e)}_toRaw(e){const t={files:[]};t.text=e.text,void 0!==e.app?t.html=this._serializeAppData(e.app,e.text):e.html&&(t.html=e.html);for(const i of e.files||[])t.files.push(i);return t}_serializeAppData(e,t){return`${t?(0,c.htmlEscape)(t.slice(0,256)):"📈"}`}}class p{constructor(e){this._e=e}async read(){this._e&&0===this._e.eventPhase&&(d.logWarn("Cannot use an already dispatched ClipboardEvent for reading"),this._e=null);const e=this._e?this._readUsingEvent(this._e):await this._readUsingApi();return this._fromRaw(e)}_readUsingEvent(e){const t=(0,s.ensure)(e.clipboardData);e.preventDefault();const i={files:[]};for(let e=0;e0&&(t.files=e.files),t}_parseAppData(e){if(-1===e.slice(0,1024).indexOf("data-tradingview-clip"))return ;const t=(new DOMParser).parseFromString(e,"text/html").querySelector("[data-tradingview-clip]");return t?t.getAttribute("data-tradingview-clip")||"":void 0}_readBlobAsText(e){return new Promise((t,i)=>{const s=new FileReader;s.onloadend=()=>{t(s.result)},s.onerror=()=>{i(s.error)},s.readAsText(e)})}}var _=i(15738);function m(e){const t=e.target;return null!==t&&1===t.nodeType&&(0,_.isTextEditingField)(t)}function g(e){const t=e.target;if(null===t)return!1;const i=(t.ownerDocument||t).getSelection();return null!==i&&!i.isCollapsed}class f extends class{constructor(e){this._callbacks=Object.assign({},e),this._boundOnCopy=this._onCopyEv.bind(this),this._boundOnCut=this._onCutEv.bind(this),this._boundOnPaste=this._onPasteEv.bind(this)}listen(){document.addEventListener("copy",this._boundOnCopy),document.addEventListener("cut",this._boundOnCut),document.addEventListener("paste",this._boundOnPaste)}async peek(){if("granted"!==(await navigator.permissions.query({name:"clipboard-read"})).state)throw new Error("clipboard-read is not granted");return new p(null).read()}uiRequestCopy(e){this._callbacks.copyRequested&&this._callbacks.copyRequested(new u(null),e)}uiRequestCut(e){this._callbacks.cutRequested&&this._callbacks.cutRequested(new u(null),e)}uiRequestPaste(e){this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new p(null),e)}destroy(){document.removeEventListener("copy",this._boundOnCopy),document.removeEventListener("cut",this._boundOnCut),document.removeEventListener("paste",this._boundOnPaste)}_onCopyEv(e){e.defaultPrevented||this._callbacks.copyRequested&&this._callbacks.copyRequested(new u(e))}_onCutEv(e){e.defaultPrevented||this._callbacks.cutRequested&&this._callbacks.cutRequested(new u(e))}_onPasteEv(e){e.defaultPrevented||this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new p(e))}}{_onCopyEv(e){if(!m(e)&&!g(e))return super._onCopyEv(e)}_onCutEv(e){if(!m(e)&&!g(e))return super._onCutEv(e)}_onPasteEv(e){if(!m(e))return super._onPasteEv(e)}}const v=()=>i.e(4389).then(i.bind(i,71138));function S(e,t={}){return v().then(i=>i.copyToClipboardImageOfChart(e,t))}function y(e,t={}){return v().then(i=>i.getImageOfChartSilently(e,t))}var b=i(18437),w=i(22900),P=i(99182),C=i(1799),T=i(72927),x=i(14563),I=i(71577),M=i(49382),L=i(16932),A=i(54837),k=i(73395),E=i(38069),D=i(27490),V=i(6857);const B=!D.enabled("widget_logo");function N(e,t=null,i=null){let s={};if("number"==typeof e)return{relativePositions:{[e]:{l:t,t:i}},nextElementLeft:e,nextElementTop:e};const[r,...n]=e;if("v"===r){let e=null;for(const r of n){const n=N(r,t,i);s={...s,...n.relativePositions},i=n.nextElementTop,e=n.nextElementLeft}t=e}if("h"===r){let e=null;for(const r of n){const n=N(r,t,i);s={...s,...n.relativePositions},t=n.nextElementLeft,e=n.nextElementTop}i=e}return{relativePositions:s,nextElementTop:i,nextElementLeft:t}}const R=function(e){const t={};for(const i of Object.keys(e)){const s=N(e[i]).relativePositions;t[i]=s}return t}(E);function O(e,t,i,s){return(0,L.drawScaled)(e,s,()=>{e.fillText(i,t.x/s,t.y/s)}), e.measureText(i).width*s}function F(e){return e.map(e=>({...e,title:""}))}function W(e,t){const i=[{text:e.trim()}];for(const e of t)e.visible&&(""!==i[i.length-1].text&&i.push({text:" "}),e.title&&i.push({text:e.title}),i.push({text:e.value,color:e.color}));return i}class H{constructor(e,t){this._logoTextColor=null,this._snapshotData=e,t=t||{},this._options={backgroundColor:P.themes[e.theme].getThemedColor("color-bg-primary"),borderColor:P.themes[e.theme].getThemedColor("color-border"),font:A.CHART_FONT_FAMILY,fontSize:12,legendMode:"vertical",hideResolution:!1,showHeaderPublishedBy:!1,showHeaderMainSymbol:!1,...t};const i=R[e.layout],s=e.charts.map(e=>function(e){const t=e.panes[0],i=t.canvas.width+t.leftAxis.canvas.width+t.rightAxis.canvas.width;let s=0;for(const t of e.panes)s+=t.canvas.height;return void 0!==e.timeAxis&&(s+=e.timeAxis.canvas.height),new L.Size(i,s)}(e));if(this._pixelRatio=e.hidpiRatio,this._chartsGeometry=e.charts.map((e,t)=>function e(t,i,s,r){let n=Math.round(10*r),o=Math.round(10*r);const a=s[t];if(null!==a.l){const t=e(a.l,i,s,r);n=t.x+t.width+Math.round(5*r)}if(null!==a.t){const t=e(a.t,i,s,r);o=t.y+t.height+Math.round(5*r)}const l=i[t];return{x:n,y:o,width:l.w,height:l.h}}(t,s,i,this._pixelRatio)),!B){let i=e.theme;void 0!==t.backgroundColor&&(i="black"===(0,x.rgbToBlackWhiteString)((0,x.parseRgb)(t.backgroundColor),150)?I.StdTheme.Dark:I.StdTheme.Light),this._logoTextColor=P.themes[i].getThemedColor("color-text-primary")}this._headerDefaultTextColor=P.themes[e.theme].getThemedColor("color-text-primary")}async getImage(){const e=this._pixelRatio;let t=0,i=0,s=0;const r=this._headerItems();if(r.length>0){s=Math.ceil(1.4*this._options.fontSize*e)*r.length}i+=s;let n=0,o=0;for(const e of this._chartsGeometry)n=Math.max(n,e.x+e.width),o=Math.max(o,e.y+e.height);const a=i;t+=n,i+=o,t+=Math.round(10*e);const l=B?Math.round(10*e):Math.round(35*e),c=i;i+=l;const h=(0,L.createDisconnectedCanvas)(document,new L.Size(t,i),1),d=(0,L.getContext2D)(h);d.font=(0,k.makeFont)(this._options.fontSize,this._options.font),d.textBaseline="top",d.fillStyle=this._options.backgroundColor,d.fillRect(0,0,t,i),r.length>0&&this._drawHeader(d,r,t,new T.Point(Math.round(10*e),Math.round(10*e)));for(let e=0;e{const s=new Image;s.width=e,s.height=t,s.onload=()=>{i({image:s,width:e,height:t})},s.src=n})}(Math.round(20*e),Math.round(15*e),this._logoTextColor);d.fillStyle=this._logoTextColor,d.font=(0,k.makeFont)(13,A.CHART_FONT_FAMILY);const i=c+Math.round(l/2-t.height/2);!function(e,t,i,s,r){e.save(),e.drawImage(s.image,t,i,s.width,s.height), e.textBaseline="bottom";const n=(t+s.width)/r+3,o=(i+s.height)/r;(0,L.drawScaled)(e,r,()=>{e.fillText("TradingView",n,o)}),e.restore()}(d,Math.round(10*e),i,t,e)}return h}_drawChart(e,t,i,s){i.save(),i.translate(t.x+s.x,t.y+s.y);let r=0;for(const t of e.panes){let s=0;const n=t.leftAxis.canvas.width+Math.round(8*this._pixelRatio),o=r,a=r+Math.round(10*this._pixelRatio);t.leftAxis.contentWidth>0&&(i.drawImage(t.leftAxis.canvas,s,r),s+=t.leftAxis.canvas.width),i.drawImage(t.canvas,s,r),s+=t.canvas.width,t.rightAxis.contentWidth>0&&i.drawImage(t.rightAxis.canvas,s,r),"pane"===t.type&&(i.fillStyle=e.colors.text,this._drawLegend(t,i,new T.Point(n,a),o)),r+=t.canvas.height}if(void 0!==e.timeAxis){let t=0;e.timeAxis.lhsStub.contentWidth>0&&(i.drawImage(e.timeAxis.lhsStub.canvas,t,r),t+=e.timeAxis.lhsStub.canvas.width),i.drawImage(e.timeAxis.canvas,t,r),t+=e.timeAxis.canvas.width,e.timeAxis.rhsStub.contentWidth>0&&i.drawImage(e.timeAxis.rhsStub.canvas,t,r)}i.strokeStyle=this._options.borderColor,i.strokeRect(0,0,t.width,t.height),i.restore()}_headerItems(){var e,t,i,s;const r=[];if(this._options.showHeaderPublishedBy&&this._snapshotData.publishedBy)for(const e of this._snapshotData.publishedBy)r.push([{text:e}]);if(this._options.showHeaderMainSymbol){const n=this._snapshotData.charts[0],o=`${null===(e=n.meta)||void 0===e?void 0:e.symbol}, ${null===(t=n.meta)||void 0===t?void 0:t.resolution}`;r.push(W(o,null!==(s=null===(i=n.meta)||void 0===i?void 0:i.values)&&void 0!==s?s:[]))}return r}_drawHeader(e,t,i,s){e.save(),e.fillStyle=this._headerDefaultTextColor;const r=Math.ceil(1.4*this._options.fontSize*this._pixelRatio);t.forEach((t,n)=>{this._drawLegendLine(e,new T.Point(s.x,s.y+r*n),i,t,!0)}),e.restore()}_drawLegend(e,t,i,s){let r=!0;const n=Math.ceil(1.4*this._options.fontSize*this._pixelRatio);let o=i.x,a=i.y;if(e.mainSeriesText&&a+ne.text).join("");let o=t.x;const a=function(e,t,i,s){if(e.measureText(t).width*s<=i)return{text:t,elided:!1};const r=e.measureText("...").width*s,n=[];for(let e=0;ee.measureText(t.slice(0,o+1)).width*s+r>i);return{text:(t=t.slice(0,o)).trim(),elided:!0}}(e,n,i-o,this._pixelRatio);if(a.elided&&!r)return null;const l=[];let c=0;for(const e of s){if(c+e.text.length>a.text.length)break;l.push(e.text),c+=e.text.length}const h=l.join("").trim().length;c=0;for(const i of s){if(c+i.text.length>h)break;i.color&&(e.save(), e.fillStyle=i.color),o+=O(e,new T.Point(o,t.y),i.text,this._pixelRatio),i.color&&e.restore(),c+=i.text.length}return a.elided&&(o+=O(e,new T.Point(o,t.y),"...",this._pixelRatio)),o}}const z=new n.TranslatedString("apply indicators to entire layout",(0,r.t)("apply indicators to entire layout"));(0,r.t)("Please give us a clipboard writing permission in your browser or press {keystroke}"),(0,r.t)("Couldn't copy"),(0,r.t)("Couldn't cut"),(0,r.t)("Couldn't paste"),(0,r.t)("{userName} published on {customer}, {date}"),(0,r.t)("Published on {customer}, {date}");function U(e,t){const i=t.model().model().studyTemplate();e.undoHistory.beginUndoMacro(z);for(let s=0;se.id()===n))}const c=t.pasteSourceFromClip(o,i,!0);if(c&&1===c.length){const e=c[0];if(r.asCompare){const i=(0,s.ensureNotNull)(t.mainSeries().priceScale());t.moveToScale(e,(0,s.ensureDefined)(o),i,n),t.setPriceScaleMode({percentage:!0},i,null)}}t.model().lightUpdate()}}e.undoHistory.endUndoMacro()}function G(e){let t=1;for(;e.has(""+t);)t++;return""+t}function q(e){const t=new Map,i=e.chartsCountToSave(),s=new Set;for(let r=0;r{const s=(r=i.chartId,null!==(o=null===(n=e.chartWidgetsDefs.find(e=>e.chartWidget.id()===r))||void 0===n?void 0:n.chartWidget)&&void 0!==o?o:null);var r,n,o;null==s||s.resetLineToolsInvalidated(t,i.savedDto,i.sharingMode)})}function X(e,t,i,s){const r=e.map(e=>e.chartWidget);r.forEach(e=>e.startApplyingLineToolUpdateNotification());try{r.filter(e=>e.id()===t||"not-shared"!==s).forEach(e=>e.applyLineToolUpdateNotification(i,s))}finally{r.forEach(e=>e.endApplyingLineToolUpdateNotification())}}function Z(e){return new f({copyRequested:(t,i)=>{ e.activeChartWidget.value().model().clipboardCopy(t,i)},cutRequested:(t,i)=>{e.activeChartWidget.value().model().clipboardCut(t,i)},pasteRequested:(t,i)=>{(i?i.model().undoModel():e.activeChartWidget.value().model()).clipboardPaste(t,i)}})}function J(e,t){0}function Q(e){const t={};return e.chartWidgetsDefs.map(e=>e.chartWidget).forEach(e=>t[e.id()]=function(e){var t,i;const s={},r=e.model().mainSeries(),n=r.properties().childs(),o=r.symbolInfo();s.resolution=n.interval.value(),s.symbol_type=null!==o&&o.type||"",s.exchange=null!==o&&o.exchange||"",s.listed_exchange=null!==o&&o.listed_exchange||"";const a=null!==(t=null==o?void 0:o.legs)&&void 0!==t?t:[];if(null!==o&&r.isSpread()){const e=a[0];let t=o.base_name[0];t=t.split(":")[1],s.symbol=e,s.short_name=t,s.expression=o.full_name}else s.symbol=null!==o&&o.ticker||n.symbol.value(),s.short_name=n.shortName.value();const l=null!==(i=null==o?void 0:o.base_name)&&void 0!==i?i:[];return s.legs=a.map((e,t)=>({symbol:e,pro_symbol:l[t]})),s}(e)),t}function ee(e,t){0}function te(e,t){return y(t,{snapshotUrl:e}).then(e=>((0,b.emit)("onScreenshotReady",e),e))}function ie(e,t){const i={snapshotUrl:e};const s=(0,w.isOnMobileAppPage)("any");return(s?y:S)(t,i).then(e=>((0,b.emit)("onScreenshotReady",e),s||(0,b.emit)("onServerScreenshotCopiedToClipboard"),e))}function se(e){return function(e){return v().then(t=>t.downloadClientScreenshot(e))}(e)}function re(e){return function(e){return v().then(t=>t.copyToClipboardClientScreenshot(e))}(e).then(()=>{(0,b.emit)("onClientScreenshotCopiedToClipboard")})}function ne(e,t,i,s){const r=Math.max(1,window.devicePixelRatio||1),n=e.getAll();const o=e.maximizedChartWidget();if(s&&s.onlyActiveChart||o)return{layout:"s",hidpiRatio:r,theme:(0,P.getCurrentTheme)().name,charts:[e.activeChartWidget.value().images(s)],publishedBy:void 0};const a=[],l=C.layouts[e.layout.value()].count,c={showCollapsedStudies:(s=s||{}).showCollapsedStudies,status:s.status};for(let e=0;e{"use strict";i.r(t),i.d(t,{setChartFontFamily:()=>s,CHART_FONT_FAMILY:()=>r});function s(e){r=e}let r="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, SegoeUI, Ubuntu, sans-serif"},18905:(e,t,i)=>{"use strict";var s=i(5729);i(59621) ;var r=i(79881).t,n=i(90963).TranslatedString,o=i(16282),a=o.assert,l=o.ensureDefined,c=i(49382).moveToHead,h=i(56569).TimeAxisWidget,d=i(95975).Series,u=i(27490),p=i(28745).ActionBinder,_=i(64222).setValue,m=i(89366).TabNames,g=i(98737).showGoToDateDialog,f=i(42998),v=i(60934),S=i(99392).showConfirmInputsDialog,y=i(16932).disableSelection,b=i(674),w=i(39951).Study,P=i(73228).StudyStub,C=i(17e3).isStudy,T=i(76117).LineDataSource,x=i(67945),I=x.isLineTool,M=x.isStudyLineTool,L=i(46374),A=L.Action,k=(L.Separator,i(34449).ACTION_ID),E=(i(17722).ToolboxType,i(15521)),D=i(35001).Interval,V=i(25436),B=V.getDefaultStyle,N=V.hasVolume,R=i(41543).showSymbolInfoDialog,O=i(47329).InvalidationMask,F=i(47329).InvalidationLevel,W=i(24287).linking,H=i(21273).showChangeIntervalDialogAsync,z=i(96811),U=z.activateKeyPressHandler,j=z.showDialog,G=i(94975),q=G.availableTimezones,Y=G.timezoneIsAvailable,$=i(35036).toggleHideMode,K=i(50388).ChartSession,X=i(85062),Z=i(23214).Spinner,J=i(87438).trackEvent,Q=i(87910).lastMouseOrTouchEventInfo,ee=i(83265).LoadingScreen,te=i(18130),ie=i(65447).getLogger("ChartWidget",{color:"#606"}),se=i(22675).appendEllipsis,re=i(27640).StudyMetaInfoRepository,ne=i(1799).isMultipleLayout,oe=i(73305).addPerfMark,ae=i(18437),le=i(69881).combineProperty,ce=i(83233).ChartWidgetBase,he=i(43367).CheckMobile.any(),de=i(89077).TIMEFRAMETYPE,ue=i(61389).createDeferredPromise,pe=i(92932).addPlusButtonProperty;var _e=new n("change resolution",r("change resolution")),me=new n("change timezone",r("change timezone")),ge=new n("scale price chart only",r("scale price chart only")),fe=new n("stay in drawing mode",r("stay in drawing mode")),ve=(new n("hide all drawing tools",r("hide all drawing tools")),new n("hide marks on bars",r("hide marks on bars"))),Se=new n("change symbol last value visibility",r("change symbol last value visibility")),ye=(new n("change symbol previous close value visibility",r("change symbol previous close value visibility")),new n("change previous close price line visibility",r("change previous close price line visibility")),new n("change symbol labels visibility",r("change symbol labels visibility"))),be=new n("change indicators name labels visibility",r("change indicators name labels visibility")),we=new n("change indicators value labels visibility",r("change indicators value labels visibility")),Pe=(new n("change bid and ask labels visibility",r("change bid and ask labels visibility")),new n("change bid and ask lines visibility",r("change bid and ask lines visibility")),new n("change pre/post market price label visibility",r("change pre/post market price label visibility")),new n("change pre/post market price line visibility",r("change pre/post market price line visibility")), new n("change high and low price lines visibility",r("change high and low price lines visibility"))),Ce=new n("change high and low price labels visibility",r("change high and low price labels visibility")),Te=new n("change countdown to bar close visibility",r("change countdown to bar close visibility")),xe=new n("change currency label visibility",r("change currency label visibility")),Ie=new n("change unit label visibility",r("change unit label visibility")),Me=new n("change plus button visibility",r("change plus button visibility")),Le=new n("change price line visibility",r("change price line visibility")),Ae=new n("hide {title}",r("hide {title}")),ke=new n("unlock {title}",r("unlock {title}")),Ee=new n("lock {title}",r("lock {title}")),De=new n("change session breaks visibility",r("change session breaks visibility")),Ve=r("On the left"),Be=r("On the right"),Ne=r("Move scale to left"),Re=r("Move scale to right");class Oe extends ce{constructor(e,t,i){super(e,t,i),this._options.timeScaleWidget&&(this._options.timeScaleWidget.pressedMouseMoveScale=this._options.handleScale.axisPressedMouseMove.time);var r=this;this._startSpinner(this._options.container.value());var n=this._options.content,o=this._options.readOnly;this._removeMaximizeHotkey=null,r._hotkeys=v.createGroup({desc:"Chart actions",isDisabled:function(){return!r._isActive}});var a=this._options.containsData,l=this._options.onWidget,c=this._options.onCmeWidget;c&&ie.logWarn("[ChartWidget] 'onCmeWidget' option is depricated");var h=this._options.widgetCustomer,d=this._options.timezone,u=this._options.hideSymbolSearch,p=this._options.defSymbol,_=D.isValid(this._options.defInterval)?this._options.defInterval:void 0,m=parseInt(this._options.defStyle),g=V.isValidStyle(m)?m:void 0,f=this._options.defSessionId,S=void 0!==this._options.defTimeframe?{value:this._options.defTimeframe.toUpperCase(),type:de.PeriodBack}:void 0;this._chartWidgetCollection=this._options.chartWidgetCollection,this._content=n,this._initialLoading=this._options.initialLoading,this._readOnly=o,this._containsData=a,this._showChartEvents=!a&&this._options.chartEventsEnabled,this._defSymbol=p,this._defInterval=_,this._defTimeframe=S,this._defStyle=g,this._onWidget=!!l,this._compareSymbols=this._options.compareSymbols,this._onWidget&&(c?this._widgetCustomer="cme":h&&(this._widgetCustomer=h)),this._hideSymbolSearch=u,this._frameTime=30,this._model=null,this._metaInfo={},this._drawRafId=0,this._compareDialog=this._chartWidgetCollection.getCompareDialogRenderer();var y=this._contentSeriesProperties();y&&(p=y.symbol,_=y.interval),void 0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0);var b=this._options.useUserChartPreferences?te.defaults("chartproperties.mainSeriesProperties"):te.factoryDefaults("chartproperties.mainSeriesProperties");this._properties.mainSeriesProperties.merge(b),this._properties.mainSeriesProperties.hasChild("esdBreaksStyle")&&this._properties.mainSeriesProperties.removeProperty("esdBreaksStyle"),_=_||b.interval||"D", V.isValidStyle(g)||(g=V.isValidStyle(b.style)?b.style:B(D.isRange(_))),this._properties.mainSeriesProperties.merge({visible:!0,symbol:p||DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:_,currencyId:null,unitId:null,style:g,sessionId:f,lineStyle:{styleType:te.factoryDefaults("chartproperties.mainSeriesProperties.lineStyle.styleType")}}),this._containsData&&this._properties.mainSeriesProperties.merge({showCountdown:!1}),d&&Y(d)&&this._properties.timezone.setValue(d),this._tagsChanged=new s,this._disconnected=new s,this._reconnectBailout=new s,this._connected=new s,this._onScroll=new s,this.chartWidgetInitialized=new s,this._chartSession=new K(ChartApiInstance),this._metaInfoRepository=new re(this._chartSession),this._timingsMeter=null,this._isActive=this._options.isActive,this._options.container.subscribe((function(e){r._setElement(e)}),{callWithLast:!0});var w=function(){r.resize()};this._options.width.subscribe(w),this._options.height.subscribe(w),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this)),this._aboutToBeDestroyed=new s,this._actions=null,this._definitionsViewModel=null,this._backgroundTopColorSpawn=null,this._backgroundBottomColorSpawn=null,this._hintDefferedPromise=null,this._activeHint=null}isInitialized(){return Boolean(this._inited)}compareSymbols(){return this._compareSymbols}async _getChartPropertyDefinitionsViewModel(){if(null===this._definitionsViewModel){const{ChartPropertyDefinitionsViewModel:e}=await Promise.all([i.e(8680),i.e(5019),i.e(3596)]).then(i.bind(i,24249));if(this._isDestroyed)throw new Error("Chart widget already destroyed");await new Promise(e=>this.withModel(null,e)),null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this.model(),this.properties(),this._options))}return this._definitionsViewModel}_initMaximizeHotkey(e){var t=this;function i(e){e.defaultPrevented||f.modifiersFromEvent(e)===f.Modifiers.Alt&&e.stopPropagation()}function s(e){e.defaultPrevented||f.modifiersFromEvent(e)===f.Modifiers.Alt&&(e.preventDefault(),e.stopPropagation(),t.toggleFullscreen())}return e.addEventListener("mousedown",i,!0),e.addEventListener("click",s,!0),function(){e.removeEventListener("mousedown",i,!0),e.removeEventListener("click",s,!0)}}toggleFullscreen(){var e=this.getResizerDetacher();e.fullscreenable.value()&&(e.fullscreen.value()?e.exitFullscreen():e.requestFullscreen())}_beginRequestActive(){var e=this._chartWidgetCollection.activeChartWidget.value()!==this;if(this._chartWidgetCollection.activeChartWidget.setValue(this),e){const e=Q();e.isTouch&&!e.stylus&&this._isLineToolModeExceptBrush()&&this.updateCrossHairPositionIfNeeded(),this._justActivated=!0}}_endRequestActive(){var e=this;this._justActivated&&setTimeout((function(){e._justActivated=!1}),0)}_requestActive(){this._beginRequestActive(),this._endRequestActive()}justActivated(){return this._justActivated}setTimezone(e){e&&Y(e)?this._properties.timezone.setValue(e):console.warn("Incorrect timezone: "+JSON.stringify(e))}getTimezone(){return this._properties.timezone.value() }refreshMarks(){this.model().barsMarksSources().forEach((function(e){e.refreshData()}))}clearMarks(){this.model().barsMarksSources().forEach((function(e){e.clearMarks()}))}metaInfoRepository(){return this._metaInfoRepository}_init(){var e=this;this.hasModel()&&this.model().mainSeries().clearData(),this.initColors(),this._makeDefaultGui();var t=function(){e._checkObsoleteTimezone(),e._chartSession&&e._chartSession.connected()&&this._model.restart(),this._content&&(this.initColors(),this._updateGui(),this.update()),this._resizeHandler=function(){this._adjustSize(),this.paint()}.bind(this),this._resizeHandler(),this._parent.appendChild(this._mainDiv),this._spinner&&(this._spinner.stop(),delete this._spinner),this._keydownEventListener=function(e){27===e.which&&e.preventDefault()},window.addEventListener("keydown:chart_"+this._id,this._keydownEventListener),this._initBarsMarksSources(),this._activateSymbolSearchHotkeys(),this.model().timeScale().onScroll().subscribe(this,(function(){this._onScroll.fire()})),this._inited=!0}.bind(this),i=this._makeDefaultModel();void 0===i?t():i.then(t)}_activateSymbolSearchHotkeys(){this.readOnly()||this._hideSymbolSearch||U()}_checkObsoleteTimezone(){var e=this._properties.timezone.value();Y(e)||this._properties.timezone.setValue({UTC:"Etc/UTC",EST:"America/New_York",CST:"America/Chicago",PST:"America/Los_Angeles"}[e]||"exchange")}initColors(){this._properties.scalesProperties.lineColor.listeners().subscribe(this,Oe.prototype.setScaleLineColor),this._properties.scalesProperties.textColor.listeners().subscribe(this,Oe.prototype.setScaleTextColor)}_initBackgroundColor(){null===this._backgroundTopColorSpawn&&(this._backgroundTopColorSpawn=this._model.model().backgroundTopColor().spawn(),this._backgroundTopColorSpawn.subscribe(this._onBackgroundColorChanged.bind(this))),null===this._backgroundBottomColorSpawn&&(this._backgroundBottomColorSpawn=this._model.model().backgroundColor().spawn(),this._backgroundBottomColorSpawn.subscribe(this._onBackgroundColorChanged.bind(this)))}paneWidgets(){return this._paneWidgets}paneByCanvas(e){for(var t=0;t{e=e||i.getCurrentTheme().name,i.loadTheme(e,!0,!0,t._chartWidgetCollection)})}actions(){return null===this._actions&&this._setActions(),this._actions}_setActions(){this._actions&&this._actions.addToWatchlist&&(this._actions.addToWatchlist.destroy(),delete this._actions.addToWatchlist);var e,t=this;this._readOnly,this._hotkeys.add({desc:"Maximize",hotkey:v.Modifiers.Alt+13,handler:function(){t.toggleFullscreen()},isDisabled:function(){return!t._options.fullscreenable.value()}}),this._hotkeys.add({desc:"Cancel selection",hotkey:27,handler:function(){t.selectPointMode().value()?t.cancelRequestSelectPoint():t._model.selectionMacro((function(e){t._cancelCreatingLine(),e.clearSelection()}))},isDisabled:function(){var e=0===t._model.selection().allSources().length,i=null===t._model.crossHairSource().measurePane(),s=!t.selectPointMode().value(),r=e&&i&&s;return!t._model||r}}),t.withModel(null,(function(){var e=function(){t._hotkeys.promote()} ;t._model.onSelectedSourceChanged().subscribe(null,e),t._model.crossHairSource().measuringEnabled().subscribe(null,t=>{t&&e()})}));var s=new A({actionId:k.ChartScalesReset,label:r("Reset chart"),icon:i(97033),statName:"ResetChart",onExecute:this.GUIResetScales.bind(this),hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Alt+82}),n=new A({actionId:k.ChartSeriesPriceScaleToggleInvertPriceScale,label:r("Invert scale"),statName:"Invert Scale",checkable:!0,onExecute:function(){t._model.invertPriceScale(t._model.mainSeries().priceScale())},hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Alt+73}),o=new A({actionId:k.ChartSeriesPriceScaleToggleAutoScale,label:r("Auto (fits data to screen)"),checkable:!0,onExecute:function(){var e=t._model.mainSeries().priceScale();t._model.togglePriceScaleAutoScaleMode(e),o.update({checked:e.isAutoScale()})}}),a=new A({actionId:k.ChartScalesToggleLockPriceToBarRatio,label:r("Lock price to bar ratio"),checkable:!0,statName:"ToggleLockScale",onExecute:function(){t._model.togglePriceScaleLockScaleMode(t._model.mainSeries().priceScale())}}),l=new A({actionId:k.ChartSeriesPriceScaleToggleRegular,label:r("Regular"),checkable:!0,statName:"ToggleRegularScale",onExecute:function(){var e=t._model.mainSeries().priceScale();t._model.setPriceScaleRegularScaleMode(e),l.update({checked:e.isRegular()})}}),c=new A({actionId:k.ChartSeriesPriceScaleTogglePercentage,label:r("Percent"),checkable:!0,statName:"TogglePercantage",onExecute:function(){t._model.togglePriceScalePercentageScaleMode(t._model.mainSeries().priceScale())},hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Alt+80}),h=new A({actionId:k.ChartSeriesPriceScaleToggleIndexedTo100,label:r("Indexed to 100"),checkable:!0,statName:"ToggleIndexedTo100",onExecute:function(){t._model.togglePriceScaleIndexedTo100ScaleMode(t._model.mainSeries().priceScale())}}),d=new A({actionId:k.ChartSeriesPriceScaleToggleLogarithmic,label:r("Logarithmic"),statName:"ToggleLogScale",checkable:!0,onExecute:function(){t._model.togglePriceScaleLogScaleMode(t._model.mainSeries().priceScale())},hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Alt+76}),S=new A({actionId:k.ChartUndo,label:r("Undo"),onExecute:function(){J("GUI","Undo"),t._model.undoHistory().undo()},disabled:!0,hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Mod+90}),y=new A({actionId:k.ChartRedo,label:r("Redo"),onExecute:function(){J("GUI","Redo"),t._model.undoHistory().redo()},disabled:!0,hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Mod+89});t.withModel(null,(function(){t._model.undoHistory().undoStack().onChange().subscribe(t,t.updateUndoRedo),t._model.undoHistory().redoStack().onChange().subscribe(t,t.updateUndoRedo)}));var w=new A({actionId:k.ChartChangeTimeZone,label:r("Time zone"),statName:"TimeZone"}),P=new A({actionId:k.ChartDialogsShowChangeSymbol,label:se(r("Change Symbol")),statName:"ChangeSymbol",onExecute:function(){j({defaultValue:""})}});_("symboledit.dialog_last_entry","");var C={actionId:k.ChartDialogsShowChangeInterval,label:se(r("Change interval")),statName:"ChangeInterval", onExecute:function(){H({initVal:W.interval.value(),selectOnInit:!0})}};!u.enabled("show_interval_dialog_on_key_press")||this.readOnly()||this._hideSymbolSearch||(C.shortcutHint=",",C.hotkeyGroup=this._hotkeys,C.hotkeyHash=188);var T,x=new A(C);if(!TradingView.onWidget()){if(this._options.addToWatchlistEnabled){const e={hotkeyGroup:this._hotkeys};T=new WatchListAction(this,e)}0}var I=new A({actionId:k.ChartTimeScaleReset,label:r("Reset time scale"),icon:i(97033),statName:"ResetScale",onExecute:function(){t.model().resetTimeScale()},hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Mod+v.Modifiers.Alt+81}),M=new A({actionId:k.ChartRemoveAllIndicators,label:r("Remove indicators"),statName:"RemoveAllIndicators",onExecute:this.removeAllStudies.bind(this)}),L=new A({actionId:k.ChartRemoveAllLineTools,label:r("Remove drawings"),statName:"RemoveAllDrawingTools",onExecute:this.removeAllDrawingTools.bind(this)}),D=new A({actionId:k.ChartRemoveAllIndicatorsAndLineTools,label:r("All indicators and drawing tools"),statName:"RemoveAllIndicatorsAndDrawingTools",onExecute:this.removeAllStudiesDrawingTools.bind(this)}),V=this.chartWidgetCollection(),B=new A({actionId:k.ChartApplyIndicatorsToAllCharts,label:r("Apply these indicators to entire layout"),statName:"ApplyIndicatorsToAllCharts",onExecute:function(){V.applyIndicatorsToAllCharts(t)}}),N={actionId:k.ChartDialogsShowInsertIndicators,label:se(r("Insert indicator")),statName:"InsertIndicator",onExecute:function(){t.showIndicators()}};this._options.indicatorsDialogShortcutEnabled&&(N.hotkeyGroup=this._hotkeys,N.hotkeyHash=191,this._hotkeys.add({handler:function(){this.showIndicators()}.bind(this),desc:"Show insert indicator dialog",hotkey:111}));var F,z=new A(N),U=new A({actionId:k.ChartDialogsShowCompareOrAddSymbol,label:se(r("Compare or Add Symbol")),statName:"CompareOrAddSymbol",onExecute:this.toggleCompareOrAdd.bind(this)}),G=new A({actionId:k.ChartObjectTreeShow,label:se(r("Object Tree")),statName:"ObjectsTree",onExecute:this.showObjectsTreePanelOrDialog.bind(this)}),q=new A({actionId:k.ChartDialogsShowGeneralSettings,label:se(r("Settings")),icon:i(78544),statName:"ChartProperties",onExecute:function(){t.showGeneralChartProperties()}}),Y=new A({actionId:k.ChartDialogsShowGeneralSettingsSymbolTab,label:se(r("Settings")),icon:i(78544),statName:"MainSeriesProperties",onExecute:function(){t.showGeneralChartProperties(m.symbol)}}),K=new A({actionId:k.ChartSelectedObjectToggleLocked,label:r("Lock/unlock"),statName:"ToggleLockSelectedObject",onExecute:this.toggleLockSelectedObject.bind(this)}),X=new A({actionId:k.ChartSelectedObjectHide,label:r("Hide"),icon:i(62781),statName:"HideSelectedObject",onExecute:this.hideSelectedObject.bind(this)});u.enabled("property_pages")&&(F=new A({actionId:k.ChartSelectedObjectShowSettingsDialog,label:se(r("Settings")),icon:i(78544),statName:"EditSelectedObject",onExecute:function(){t.showSelectedSourcesProperties()}})),this.withModel(null,(function(){var e=t.model().mainSeries(),i=e.properties() ;i.priceAxisProperties.subscribe(t,t._updateScalesActions),e.priceScaleAboutToBeChanged().subscribe(t,(function(){i.priceAxisProperties.unsubscribeAll(t)})),e.priceScaleChanged().subscribe(t,(function(){i.priceAxisProperties.subscribe(t,t._updateScalesActions),t._updateScalesActions()}))}));var Z=new A({actionId:k.ChartPriceScaleToggleAutoScaleSeriesOnly,label:r("Scale price chart only"),checkable:!0,statName:"ScalePriceChartOnly"});Z.binder=new p(Z,this._properties.scalesProperties.scaleSeriesOnly,this.model(),ge);var Q=this.model().model();this._properties.scalesProperties.scaleSeriesOnly.listeners().subscribe(null,(function(){Q.recalculateAllPanes(),Q.invalidate(O.full())}));var ee=new A({actionId:k.ChartDrawingToolbarToggleVisibility,label:r("Drawings toolbar"),checkable:!0,statName:"ToggleDrawingToolbar"}),te=this._options.isDrawingToolbarVisible;te&&(te.subscribe((function(e){ee.update({checked:e})}),{callWithLast:!0}),ee.update({onExecute:function(){te.setValue(!te.value())}}));var ie=new A({actionId:"",label:r("Stay in drawing mode"),checkable:!0,statName:"ToggleStayInDrawingMode"});ie.binder=new p(ie,E.properties().stayInDrawingMode,this.model(),fe),this._hotkeys.add({handler:function(){$()},desc:"Hide all drawing tools",hotkey:v.Modifiers.Mod+v.Modifiers.Alt+72});var re=new A({actionId:k.ChartMarksToggleVisibility,label:r("Hide marks on bars"),checkable:!0,statName:"ToggleHideMarksOnBars"});re.binder=new p(re,E.hideMarksOnBars(),this.model(),ve,(function(){E.hideMarksOnBars().setValue(this.value())}));const ne=this.properties().scalesProperties;var oe=new A({actionId:k.ChartPriceScaleLabelsToggleSeriesLastValueVisibility,label:r("Symbol last price label"),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"});oe.binder=new p(oe,ne.showSeriesLastValue,this.model(),Se);var ae=new A({actionId:k.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility,label:r("Symbol name label"),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"});ae.binding=new p(ae,ne.showSymbolLabels,this.model(),ye);const ce=le((e,t)=>e||!1,ne.showStudyLastValue,ne.showFundamentalLastValue);var he=new A({actionId:k.ChartPriceScaleLabelsToggleIndicatorsValueLabelsVisibility,label:r("Indicators value labels"),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsPriceLabels"});he.binder=new p(he,ce,this.model(),null,()=>{const e=!ce.value();this.model().beginUndoMacro(we),this.model().setProperty(ne.showStudyLastValue,e,null),this.model().endUndoMacro()});const de=le((e,t)=>e||!1,ne.showStudyPlotLabels,ne.showFundamentalNameLabel);var ue=new A({actionId:k.ChartPriceScaleLabelsToggleIndicatorsNameLabelsVisibility,label:r("Indicators name labels"),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsNameLabels"});ue.binding=new p(ue,de,this.model(),null,()=>{const e=!de.value();this.model().beginUndoMacro(be),this.model().setProperty(ne.showStudyPlotLabels,e,null),this.model().endUndoMacro()});var _e=this.model().mainSeries().properties().highLowAvgPrice,me=new A({ actionId:k.ChartPriceScaleLabelsToggleHighLowPriceLabelsVisibility,label:r("High and low price labels"),checkable:!0,checked:!1,statName:"ToggleHighLowAverageClosePriceLabels"});const Ae=le((e,t)=>e||t,_e.highLowPriceLabelsVisible,new b(!1));me.binding=new p(me,Ae,this.model(),null,()=>{const e=!Ae.value();this.model().beginUndoMacro(Ce),this.model().setProperty(_e.highLowPriceLabelsVisible,e,null),this.model().endUndoMacro()});const ke=le((e,t)=>e||t,_e.highLowPriceLinesVisible,new b(!1));var Ee=new A({actionId:k.ChartLinesToggleHighLowLinesVisibility,label:r("High and low price lines"),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLine"});Ee.binding=new p(Ee,ke,this.model(),null,()=>{const e=!ke.value();this.model().beginUndoMacro(Pe),this.model().setProperty(_e.highLowPriceLinesVisible,e,null),this.model().endUndoMacro()});var De=new A({actionId:k.ChartPriceScaleToggleCountdownToBarCloseVisibility,label:r("Countdown to bar close"),checkable:!0,checked:!1,statName:"ToggleCountdown"});De.binder=new p(De,this.model().mainSeries().properties().showCountdown,this.model(),Te);var Oe=new A({actionId:k.ChartPriceScaleToggleCurrencyVisibility,label:r("Currency"),checkable:!0,checked:!0,statName:"ToggleScalesCurrency"});Oe.binder=new p(Oe,ne.showCurrency,this.model(),xe);var Fe=new A({actionId:k.ChartPriceScaleToggleUnitVisibility,label:r("Unit"),checkable:!0,checked:!0,statName:"ToggleScalesUnit"});Fe.binder=new p(Fe,ne.showUnit,this.model(),Ie);var We=new A({actionId:k.ChartPriceScaleToggleAddOrderPlusButtonVisibility,label:r("Plus button"),checkable:!0,checked:pe.value(),statName:"ToggleAddOrderPlusButton"});We.binder=new p(We,pe,this.model(),Me);var He=null;this._options.goToDateEnabled&&(He=new A({actionId:k.ChartDialogsShowGoToDate,label:se(r("Go to date")),statName:"GoToDate",onExecute:function(){var e=t._chartWidgetCollection.activeChartWidget.value();g(e)},hotkeyGroup:this._hotkeys,hotkeyHash:v.Modifiers.Alt+71}));var ze=new A({actionId:k.ChartDialogsShowSymbolInfo,label:se(r("Symbol info")),icon:i(96527),checkable:!1,statName:"SymbolInfo",onExecute:function(){var e=t.model().mainSeries().symbol(),i=t.model().mainSeries().symbolInfo(),s=t.model().model().availableUnits(),r=t.model().model().unitConversionEnabled();R(e,{symbolInfo:i,showUnit:r,unitName:function(e){return s.name(e)}})}}),Ue=new A({actionId:k.ChartPriceScaleMergeAllScalesToLeft,label:Ve,statName:"MergeAllScalesToLeft",onExecute:function(){t.model().mergeAllScales("left")}}),je=new A({actionId:k.ChartPriceScaleMergeAllScalesToRight,label:Be,statName:"MergeAllScalesToRight",onExecute:function(){t.model().mergeAllScales("right")}}),Ge=new A({actionId:k.ChartPriceScaleMoveToLeft,label:Ne,statName:"MoveScaleToLeft",onExecute:function(){t.model().mergeAllScales("left")}}),qe=new A({actionId:k.ChartPriceScaleMoveToRight,label:Re,statName:"MoveScaleToRight",onExecute:function(){t.model().mergeAllScales("right")}});var Ye=u.enabled("show_object_tree");if(this._actions={chartProperties:q,mainSeriesPropertiesAction:Y,timeScaleReset:I,chartReset:s, invertSeriesScale:n,logSeriesScale:d,autoSeriesScale:o,lockSeriesScale:a,regularSeriesScale:l,percentSeriesScale:c,indexedTo100SeriesScale:h,compareOrAdd:U,paneObjectTree:Ye?G:void 0,insertIndicator:z,symbolSearch:P,showSymbolInfoDialog:ze,changeInterval:x,seriesHide:X,studyHide:X,lineToggleLock:K,lineHide:X,scaleSeriesOnly:Z,drawingToolbarAction:ee,stayInDrawingModeAction:ie,hideAllMarks:re,applyTimeZone:w,showCountdown:De,showCurrency:Oe,showUnit:Fe,addPlusButton:We,showSeriesLastValue:oe,showHighLowAverageClosePriceLabels:me,showHighLowAverageClosePriceLines:Ee,showSymbolLabelsAction:ae,showStudyLastValue:he,showStudyPlotNamesAction:ue,undo:S,redo:y,mergeLeftScalesAction:Ue,mergeRightScalesAction:je,moveScaleToLeft:Ge,moveScaleToRight:qe,moveChartAction:void 0},e&&(this._actions.scalesProperties=e),T&&(this._actions.addToWatchlist=T),u.enabled("show_source_code")&&(this._actions.viewSourceCode=new TVAction({label:se(r("Source code")),statName:"OpenSelectedObjectSource",onExecute:this.openSelectedObjectSource.bind(this)})),!TradingView.onWidget()&&u.enabled("text_notes")&&(this._actions.addToTextNotes=void 0),null!==He&&(this._actions.gotoDate=He),this.createSessionBreaksActions(),!this.readOnly()){var $e=new A({actionId:k.ChartSelectedObjectRemove,label:r("Remove"),icon:i(23353),statName:"RemoveSelectedObject",onExecute:function(){var e=this._chartWidgetCollection.activeChartWidget.value();e||(e=this),e.removeSelectedSources()}.bind(this),hotkeyGroup:this._hotkeys,hotkeyHash:f.isMacKeyboard?8:46});this._hotkeys.add({handler:function(){this.removeSelectedSources()}.bind(this),desc:"Remove selected source",hotkey:f.isMacKeyboard?46:8}),this._actions.paneRemoveAllStudies=M,this._actions.paneRemoveAllDrawingTools=L,this._actions.paneRemoveAllStudiesDrawingTools=D,this._actions.applyStudiesToAllCharts=B,this._actions.studyRemove=$e,this._actions.lineRemove=$e,u.enabled("property_pages")&&(this._actions.format=F)}this._actions.showPriceLine=new A({actionId:k.ChartLinesToggleSeriesPriceLineVisibility,label:r("Price line"),checkable:!0,statName:"TogglePriceLine"}),this._actions.showPriceLine.binding=new p(this._actions.showPriceLine,this.model().mainSeries().properties().showPriceLine,this.model(),Le),this.readOnly()||(this._hotkeys.add({desc:"Draw Horizontal Line here",hotkey:v.Modifiers.Alt+72,handler:function(){t.activePaneWidget&&t.activePaneWidget.drawRightThere("LineToolHorzLine")}}),this._hotkeys.add({desc:"Draw Horizontal Ray here",hotkey:v.Modifiers.Alt+74,handler:function(){t.activePaneWidget&&t.activePaneWidget.drawRightThere("LineToolHorzRay")}}),this._hotkeys.add({desc:"Draw Vertical Line here",hotkey:v.Modifiers.Alt+86,handler:function(){t.activePaneWidget&&t.activePaneWidget.drawRightThere("LineToolVertLine")}}),this._hotkeys.add({desc:"Draw Cross Line here",hotkey:v.Modifiers.Alt+67,handler:function(){t.activePaneWidget&&t.activePaneWidget.drawRightThere("LineToolCrossLine")}}),this._hotkeys.add({desc:"Draw Trend Line",hotkey:v.Modifiers.Alt+84,handler:function(){ t.activePaneWidget&&E.tool.setValue("LineToolTrendLine")}}),this._hotkeys.add({desc:"Draw Fib Retracement",hotkey:v.Modifiers.Alt+70,handler:function(){t.activePaneWidget&&E.tool.setValue("LineToolFibRetracement")}})),this._updateScalesActions()}options(){return this._options}executeActionById(e){if("takeScreenshot"===e)return console.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),void this._chartWidgetCollection.takeScreenshot();e in this._actions?this._actions[e]instanceof A&&this._actions[e].execute():console.warn("Unknown action id: "+e)}getCheckableActionState(e){if(e in this._actions){var t=this._actions[e];if(t instanceof A&&t.isCheckable())return t.isChecked();console.warn("Action "+e+" has no state")}else console.warn("Unknown action id: "+e);return null}_updateScalesActions(){if(null!==this._actions){var e=this.model().mainSeries(),t=e.priceScale(),i=e.properties(),s=t.isLockScale(),r=i.style.value()===d.STYLE_PNF;this._actions.percentSeriesScale.update({disabled:s||r,checked:t.isPercentage()}),this._actions.logSeriesScale.update({disabled:s||r,checked:t.isLog()}),this._actions.regularSeriesScale.update({disabled:s||r,checked:t.isRegular()}),this._actions.indexedTo100SeriesScale.update({disabled:s||r,checked:t.isIndexedTo100()}),this._actions.invertSeriesScale.update({checked:t.isInverted()}),this._actions.lockSeriesScale.update({checked:t.isLockScale()}),this._actions.autoSeriesScale.update({checked:t.isAutoScale(),disabled:t.properties().autoScaleDisabled.value()})}}removeAllStudies(){this._model.removeAllStudies()}removeAllDrawingTools(){this._model.removeAllDrawingTools()}removeAllStudiesDrawingTools(){this._model.removeAllStudiesAndDrawingTools()}defaultSymbol(){return this._defSymbol}connect(){this._handler=function(e){this._onData(e)}.bind(this),this._boundOnChartSessionIsConnectedChanged=this._onChartSessionIsConnectedChanged.bind(this),this._chartSession.isConnected().subscribe(this._boundOnChartSessionIsConnectedChanged),this._chartSession.criticalError().subscribe(this,this._onChartSessionCriticalError),this._chartSession.connect(this._handler)}finishInitWithoutConnect(){this._chartSession.disable(),this._init(),this.chartWidgetInitialized.fire()}reconnect(){this._chartSession.disconnect(),this._chartSession.connect()}update(){if(this._model){for(var e=0;eF.Cursor&&this._timeAxisWidget.update(),this.paint(e),this._dataWindowWidget){var s=e.maxPaneInvalidation();s===F.Full?this._dataWindowWidget.fullUpdate():s>F.None&&this._dataWindowWidget.update()}for(var r=0;r0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state}updateUndoRedo(){this._model&&(this.actions().undo.update({disabled:this._model.undoHistory().undoStack().isEmpty()}),this.actions().redo.update({disabled:this._model.undoHistory().redoStack().isEmpty()}))}createSessionBreaksActions(){var e=new A({actionId:k.ChartSessionBreaksToggleVisibility,label:r("Session breaks"),checkable:!0,statName:"ToggleSessionBreaks"});e.binder=new p(e,this._model.chartModel().sessions().properties().graphics.vertlines.sessBreaks.visible,this.model(),De),this._actions.sessionBreaks=e} updateActionForIntradayOnly(e){e&&e instanceof A&&e.update({disabled:this.model().mainSeries().isDWM()})}containsVolume(){return this.model().dataSources().some((function(e){return e instanceof w&&"Volume"===e.metaInfo().shortId}))}containsStudyByPredicate(e){return!!this._model&&this._model.dataSources().some((function(t){if(!(t instanceof w))return!1;var i=t.metaInfo();return e(i)}))}containsStudy(e){return this.containsStudyByPredicate((function(t){return t.id===e||t.fullId===e}))}isSmall(){return this._width()<550||this._height()<300}onWidget(){return this._onWidget}onCmeWidget(){return"cme"===this.widgetCustomer()}widgetCustomer(){return this._widgetCustomer}resize(){var e=this._height()+"px",t=this._width()+"px";this._mainDiv.style.height=e,this._mainDiv.style.width=t,this._elMainTable.style.height=e,this._elMainTable.style.width=t,this._resizeHandler&&this._mainDiv&&this._resizeHandler()}chartSession(){return this._chartSession}onLineCancelled(){E.resetToCursor()}_startSpinner(e){this._spinner||e&&(this._spinner=(new Z).spin(e))}isJustClonedChart(){return!!(this._options||{}).justCloned}applyOverrides(e){var t={};for(var i in e)i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=e[i]);if(applyPropertiesOverrides(this.properties(),null,!1,t,null),this._model){applyPropertiesOverrides(this._model.model().properties(),null,!1,t),applyPropertiesOverrides(this._model.mainSeries().properties(),null,!1,t,"mainSeriesProperties"),this._model.model().sessions().applyOverrides(t);const e=this._model.chartModel().watermarkSource();null!==e&&e.applyOverrides(t)}}applyStudiesOverrides(e){X.mergeDefaultsOverrides(e),this._applyStudiesOverrides()}setActive(e){this._isActive=e,Q().isTouch&&(e&&this.selectPointMode().value()?this.startTrackingMode():this.exitTrackingMode()),this._paneWidgets.forEach((function(e){e.update()})),e||this.model().selectionMacro((function(e){e.clearSelection()}))}isActive(){return this._isActive}trackTime(){return this._chartWidgetCollection.lock.trackTime}crossHairSyncEnabled(){return this._chartWidgetCollection.lock.crosshair.value()}isMultipleLayout(){return ne(this._chartWidgetCollection.layout.value())}selectPointMode(){return this._model.model().selectPointMode()}cancelRequestSelectPoint(){this._model.model().cancelRequestSelectPoint()}requestSelectPoint(e,t){var i=this;return new Promise((function(s,r){if(a()){E.resetToCursor(!0),i._model.lineBeingCreated()&&i._model.cancelCreatingLine();var n=!1,o={};i._model.model().onPointSelected().subscribe(o,(function(e,t){n=!0,i._isVisible.unsubscribe(a),i._hideHint(),s({point:e,pane:t})}),!0),i._model.model().requestSelectPoint(e),i.startTrackingMode(),void 0!==t&&i._showHint(t),i._isVisible.subscribe(a),i.selectPointMode().subscribe((function(){setTimeout((function(){n||(i.selectPointMode().value()||i._hideHint(),i._model.model().onPointSelected().unsubscribeAll(o),i._isVisible.unsubscribe(a),r("cancelled"))}))}),{once:!0})}function a(){return!!i.isVisible()||(r("Chartwidget must be visible"),i.cancelRequestSelectPoint(),!1)}}))} showReplayOrderConfirmationDialog(){if(!this.model().isInReplay())return Promise.resolve()}_addPerfMark(e){oe("ChartWidget."+this._id+"."+e)}requestFullscreen(){this._options.requestFullscreen()}getResizerDetacher(){return this._options}_createHint(){if(null===this._hintDefferedPromise){var e=ue();this._hintDefferedPromise=e;var t=this;Promise.all([i.e(5453),i.e(5514),i.e(6166)]).then(i.bind(i,25057)).then((function(i){e.resolve(new i.ChartEventHintRenderer(t._chartWidgetCollection.getContainer()))}))}return this._hintDefferedPromise?l(this._hintDefferedPromise).promise:null}_showHint(e){if(u.enabled("popup_hints"))if(null!==this._activeHint)this._activeHint.show(e);else{var t=this,i=this._createHint();null!==i&&i.then((function(i){if(null!==i){if(t._activeHint=i,void 0===e)return;t._activeHint.show(e)}}))}}_hideHint(){null!==this._activeHint&&this._activeHint.hide()}}e.exports.ChartWidget=Oe,e.exports.trackingModeIsAvailable=he},4184:(e,t,i)=>{"use strict";var s=i(16282).ensureNotNull,r=i(70635).applyOverridesToStudy,n=i(85062),o=i(24947),a=o.LineDataSourceApi,l=o.isLineToolRiskReward,c=i(52703).StudyApi,h=i(90920).SeriesApi,d=i(9062).SelectionApi,u=i(23605).PaneApi,p=i(63059).createDwmAligner,_=i(35001).Interval,m=i(85125).supportedLineTools,g=i(97102).showTooManyStudiesNotice,f=i(47903),v=f.isNumber,S=f.deepEquals,y=i(67945).createLineToolProperties,b=i(67945).prepareLineToolPropertiesByOwnerSource,w=i(73900).lineToolEntityInfo,P=i(75798).LineToolsGroupControllerApi,C=i(40597).RemoveSourcesCommand,T=i(33033).isLineDrawnWithPressedButton,x=i(30566).ChartWidgetApiBase,I=i(15521);i(87438).trackEvent;function M(e,t){return t.map((function(t){return e.dataSourceForId(t)}))}e.exports=class extends x{constructor(e,t){super(e,t),this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap,this._selectionApi=null,this._prevVisibleRange=null,this._chartWidget.onAboutToBeDestroyed().subscribe(this,this._destroy,!0),this._chartWidget.withModel(this,(function(){this._chartWidget.model().timeScale().logicalRangeChanged().subscribe(this,this._onLogicalRangeChanged)}))}id(){return this._chartWidget.id()}_getPaneApi(e){var t=this._panes.get(e);return void 0===t&&(t=new u(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){var t=this._studies.get(e);return void 0===t&&(t=new c(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){var t=this._lineDataSources.get(e);return void 0===t&&(t=new a(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{var t=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();return e.map(e=>{var s=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}})}}),this._lineDataSources.set(e,t)),t}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}setZoomEnabled(e){ this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(){this._chartWidget.clearMarks()}symbol(){return this._chartWidget.getSymbol()}symbolExt(){var e=this._chartWidget.model().mainSeries().symbolInfo();return e?{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type,pro_name:e.pro_name,typespecs:e.typespecs}:null}resolution(){return this._chartWidget.model().mainSeries().properties().interval.value()}resetData(){this._chartWidget.model().mainSeries().rerequestData()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");var i=this._chartWidget.model().model().dataSourceForId(e);if(i){var s=i.properties();s&&s.visible&&s.visible.setValue(t)}}availableZOrderOperations(e){var t=M(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}insertAfter(e,t){var i=this._chartWidget.model().model(),s=M(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertAfter(s,r)}insertBefore(e,t){var i=this._chartWidget.model().model(),s=M(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertBefore(s,r)}bringForward(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}showPropertiesDialog(e){var t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error("Study or shape "+e+" does not exist");this._chartWidget.showChartPropertiesForSource(t)}getAllShapes(){return this._chartWidget.model().model().allLineTools().map(w).filter((function(e){return null!==e.name}))}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}removeEntity(e,t){var i=this._chartWidget.model().chartModel().dataSourceForId(e);i?t&&t.disableUndo?new C(this._chartWidget.model().chartModel(),[i],"").redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn("Can't find a source with id: "+e)}removeEntityWithUndo(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);this._chartWidget.model().removeSource(t,!1)}selection(){return null===this._selectionApi&&(this._selectionApi=new d(this._chartWidget.model().model())),this._selectionApi}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}drawOnAllCharts(e){I.drawOnAllCharts.setValue(e)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}setVisibleRange(e,t){return new Promise(function(i){this._chartWidget.setVisibleTimeRange(e.from,e.to,t,i)}.bind(this))}getVisibleRange(){var e={from:0,to:0 },t=this._chartWidget.model().timeScale();if(t.isEmpty())return e;var i=t.coordinateToVisibleIndex(0),s=t.coordinateToVisibleIndex(t.width()-1),r=this._convertIndexToPublicTime(s);return null===r||(e.from=this._convertIndexToPublicTime(Math.max(t.points().firstIndex(),i)),e.to=r),e}getVisiblePriceRange(){return console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}_createTradingPrimitive(e,t){var i=this;var r,n,o=this._chartWidget.model().model(),a=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(a,(r=TradingView.CLOSE_PLOT,{index:(n=s(i._chartWidget.model().mainSeries().bars().last())).index,price:n.value[r]}),e)._adapter}createOrderLine(e){e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)}createPositionLine(e){e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)}createExecutionShape(e){e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)}createShape(e,t){return this.createMultipointShape([e],t)}_alignPoints(e){var t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval();if(t.timeScale().isEmpty()||!_.isDWM(s))return e;var r=p(s,i.symbolInfo());return null===r?e:e.map((function(e){return r.timeToSessionStart(1e3*e)/1e3}))}_convertUserPointsToDataSource(e){var t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),r=i.data();if(t.timeScale().isEmpty())return null;var n=e.map((function(e){return e.time||0})),o=this._alignPoints(n);function a(e,t,n){var o=s.closestIndexLeft(e)||0,a={index:o},l=s.valueAt(o);if(e>l&&o===s.lastIndex())(c=i.syncModel().distance(l,e)).success&&(a.index=a.index+c.result);else if(e2)throw new Error("Wrong points count for "+t.shape+". Required 1 or 2");2===h.length&&(p.startChanging(1,h[1]),p.setPoint(1,h[1]),p.endChanging())}else{var _=p.pointsCount();if(_!==h.length&&-1!==_)throw new Error("Wrong points count for "+t.shape+". Required "+_);for(var g=T(s.name),f=1;f{"use strict";var s=i(5729),r=i(16282).assert,n=i(79881).t,o=i(61389).createDeferredPromise,a=(n=i(79881).t,i(90963).TranslatedString),l=i(1799).layouts,c=i(18905),h=i(43367).supportTouch,d=i(43367).isEdge,u=i(80437).createUndoHistory,p=i(15521),_=i(60934),m=i(42998),g=i(18437),f=i(27490),v=i(55796).SetChartLayoutCommand,S=i(32856),y=i(30779).ResizerDetacherState,b=i(76456).delegateToPromise,w=i(23248).UserDefinedBarsMarks,P=i(1608).UserDefinedTimescaleMarks,C=i(65447).getLogger("Chart.ChartWidgetCollection"),T=i(39197).preventDefaultForContextMenu,x=(i(87438).trackEvent,i(41591).ChangeToolBarsThemeUndoCommand);const{getCurrentTheme:I}=i(99182) ;var M=i(74645),L=i(91840).rangesAreEqual,A=i(72087).GeneralChartPropertiesRenderer,k=i(1467).setLastUsedResolution,E=i(98489).CompareDialogRenderer,D=i(22900).isOnMobileAppPage,V=i(78102),B=V.applyIndicatorsToAllChartsImpl,N=V.applyIndicatorToAllChartsImpl,R=V.lineToolsAndGroupsDTOsImpl,O=V.getStateForChartImpl,F=V.resetLineToolsInvalidatedImpl,W=V.applyLineToolUpdateNotificationImpl,H=V.createClipboardHandler,z=V.chartsSymbolsImpl,U={saveChartEnabled:!0,takeScreenshotEnabled:!0,publishedChartsEnabled:!0},j=new a("symbol lock",n("symbol lock")),G=new a("interval lock",n("interval lock")),q=new a("track time",n("track time")),Y=new a("change symbol",n("change symbol")),$=new a("change resolution",n("change resolution")),K=new a("sync time",n("sync time")),X=new a("apply chart theme",n("apply chart theme")),Z=new a("change series style",n("change series style"));n("Detached chart"),n("Bar Replay isn't available for this chart type. Do you want to exit Bar Replay?");e.exports=function(e){var t=this,n=Object.assign({},U,e),a=1,J=2,Q=0,ee=0,te=new S,ie=n.readOnly||!1,se=[],re=0,ne=new S,oe=new S,ae=null,le="s",ce=new S,he=[],de=!1,ue=!1,pe=!1,_e=new S(!1),me=new S(!1),ge=new S(!1),fe=new S(TVSettings.getBool("chart.syncCrosshair",!0)),ve=_.createGroup({desc:"Layout"}),Se=null,ye=null,be=fe.value();fe.subscribe((function(e){be=e=!!e,TVSettings.setValue("chart.syncCrosshair",e);for(var t=0;t{const t=e.chartWidget.lineToolSynchronizer();return null!==t&&t.hasChanges().value()}))}function Re(){se.forEach((function(e){const t=e.chartWidget;t.onZoom().unsubscribeAll(this),t.onScroll().unsubscribeAll(this),t.withModel(null,()=>{const e=t.lineToolSynchronizer();null!==e&&(e.hasChanges().unsubscribe(Ne),Ne())})}))}var Oe,Fe=null,We=null,He=null;n.seriesControlBarEnabled&&(Oe=Q+ee+"px",(Fe=document.createElement("div")).style.left=Oe,Fe.style.right=Oe,Fe.style.bottom=Oe,Fe.classList.add("chart-toolbar","chart-controls-bar"),Ae.appendChild(Fe),Promise.all([i.e(3876),i.e(7610),i.e(4595),i.e(9448),i.e(3894),i.e(3996),i.e(7936),i.e(2273),i.e(6473),i.e(9843),i.e(1778),i.e(7607),i.e(167),i.e(5514),i.e(306),i.e(4940),i.e(1529),i.e(5383),i.e(7962),i.e(7260)]).then(i.bind(i,99740)).then(({BottomToolbarRenderer:e})=>{ var i=n.resizerBridge,r=[i.container.spawn(),i.width.spawn(),i.height.spawn()],o=i.container.value(),a=new s,l=function(){a.fire()};r.forEach((function(e){e.subscribe(l)})),We=new e(Fe,a,(function(){var e=o.getBoundingClientRect(),t=Ge();return t.top=e.top+t.top,t.left=e.left+t.left,t}),t,ChartApiInstance,xe,n.seriesControlBar),He=function(){null!==We&&(We.destroy(),We=null,Fe.remove(),Fe=null),r.forEach((function(e){e.destroy()})),a.destroy()}}));var ze=new A(t),Ue=new E(t);function je(){return{undoHistory:Le,chartWidgetsDefs:se,chartsCountToSave:qe,actualLayoutCount:Ye,savedChartWidgetOptions:he,activeChartWidget:te,options:n,parent:Ae,toastsFactory:null,setChartStorageNotificationSubscription:e=>{ye=e},widgetOptions:xe}}function Ge(){var e=Q+ee,t=Fe?Fe.offsetHeight:0;return{width:Pe.value()-2*e,height:Ce.value()-a-t-e,top:a,left:e}}function qe(){return Ye()}function Ye(){return l[le].count}function $e(e,t,i,s,r){return O(je(),e,t,i,s,r)}function Ke(){var e;e=Te?[Te]:se.slice(0,ae.count).filter((function(e){return!e.hiddenInLayout.value()}));for(var t=0;tr.chartWidget.setCollapsed(r.collapsed.value())),n.resizerBridge.visible.subscribe(o),o(),function(e){for(var t=0,i=0,s=0;se.chartWidget.hasModel())&&(lt(),g.emit("layout_changed"))}function nt(e,t){const i=Qe(Object.assign({},xe,he.shift()||function(){const e=te.value();if(e){const t=e.state();return t.chartId=st(it),t.shouldBeSavedEvenIfHidden=!1,{content:t}}}(),0===e||_e.value()?void 0:{defSymbol:null}));return i.modelCreated().subscribe(null,t||rt,!0),i}function ot(e){e.hiddenInLayout.setValue(!0);const t=e.container.value();t.parentNode&&t.parentNode.removeChild(t),e.fullscreen.setValue(!1)}function at(e){(e=At(e))in l||(e="s"),Re();var t=le,i=l[e].count;g.emit("layout_about_to_be_changed",e),we.setValue(e),le=e,ae=l[e];for(var s=i;s=i&&(!r||!Ze(r));if(Te?Te===r:s1),r.fullscreen.setValue(Te===r),r.collapsed.setValue(n)}else r&&(ot(r),r.collapsed.setValue(n))}Ke(),lt(),function(){for(var e=ae.count,t=e,i=0;i1)}(),rt(),se.forEach((function(e){const t=e.chartWidget;t.onZoom().subscribe(this,e=>De.fire(e)),t.onScroll().subscribe(this,()=>Ve.fire()),t.withModel(null,()=>{const e=t.lineToolSynchronizer();null!==e&&(e.hasChanges().subscribe(Ne),Ne())})})),oe.value()<1&&i>0&&se[i-1].rdState.bridge().attach()}function lt(){var e=Math.min(ae.count,se.length)-1;if(e<0)te.deleteValue();else{var t=re;t<0&&(t=0),t>e&&(t=e),te.setValue(se[t].chartWidget)}}function ct(){for(var e=se.length;e--;){var t=e===re;se[e].container.value().classList.toggle("active",t),se[e].container.value().classList.toggle("inactive",!t)}}function ht(e){}Pe.subscribe(Ke),Ce.subscribe(Ke),this.updateLayout=Ke;var dt=new s,ut=new S,pt=new S,_t=null;function mt(e){var t=e.mainSeries().properties();t.style.subscribe(null,gt),gt(t.style),e.model().onSelectedSourceChanged().subscribe(null,ft),ft(e.selection().allSources())}function gt(e){ut.setValue(e.value())}function ft(){var e=_t.model();pt.setValue(e.selection().allSources())}function vt(e){for(var t=!1,i=0;i=l[e].count)return e;return"s"}function kt(e,t){if(ue=!0,pe=Boolean(t),he=[],e){e.charts||(e={layout:"s",charts:[e]});var i=new Set;e.charts.forEach((function(e){e.chartId&&i.add(e.chartId)})),e.charts.forEach((function(e){if(!e.chartId){var t=st((function(e){return i.has(e)}));i.add(t),e.chartId=t}})),le=At(e.layout||"s");for(var s=0;snull===Te?null:Te.chartWidget,destroy:function(){bt.fire(),xt(!1),null!==He&&(He(),He=null),Re(),se.forEach((function(e){ void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.destroy()})),n.resizerBridge.remove(),window.removeEventListener("resize",Ke),p.tool.unsubscribe(Et),p.tool.unsubscribe(Dt),ke.resolve(),Ae.remove(),It.clear(),Mt.clear(),ve.destroy(),ye&&ye.destroy(),Lt&&Lt.destroy()},onAboutToBeDestroyed:bt,layout:we.readonly(),setLayout:at,activeChartWidget:te,viewMode:ce,activeChartStyle:ut.readonly(),setChartStyleToWidget:function(e,t){t||(t=te.value()),t&&function(e,t){var i=e.model(),s=i.mainSeries().properties().style;i.setChartStyleProperty(s,t,Z)}(t,e)},selectedSources:pt.readonly(),metaInfo:Me,state:function(e,i,s,r){for(var n=[],o=qe(),a=0;ae.chartWidget?e.chartWidget:new Promise(e=>{const i=nt(t,()=>e(i));ot(se[t])}))).then(t=>{o?(r&&new x(a,s,n).redo(),t.forEach((function(t){t.model().model().restoreTheme(e,i,o)}))):(Le.beginUndoMacro(X),r&&Le.pushUndoCommand(new x(a,s,n)),t.forEach((function(t){t.model().model().restoreTheme(e,i)})),Le.endUndoMacro())})},applyIndicatorsToAllCharts:function(e){B(je(),e)},applyIndicatorsToAllChartsAvailable:function(){return!ie&&Ye()>1},applyIndicatorToAllCharts:function(e,t,i,s){N(je(),e,t,i,s)},setActive:xt,inlineChartsCount:oe.readonly(),revertToInline:function(){tt(null);for(var e=0;e0||e.isStatusBad())Bt();else{var i=e.dataEvents(),s=function(){Bt(),i.barReceived().unsubscribe(null,s),i.completed().unsubscribe(null,s),i.error().unsubscribe(null,s)};i.barReceived().subscribe(null,s),i.completed().subscribe(null,s),i.error().subscribe(null,s)}}))}})),h()){var Nt=p.tool.setValue;p.tool.setValue=function(){t.selectedSources.value()&&t.activeChartWidget.value().model().lineBeingCreated()&&t.activeChartWidget.value().model().cancelCreatingLine(),Nt.apply(p.tool,arguments)}}(function e(){return se.every(e=>e.chartWidget.hasModel())?Promise.resolve(se.map(e=>e.chartWidget)):Promise.all(se.map(e=>e.chartWidget.hasModel()||b(e.chartWidget.modelCreated()).promise)).then(()=>e())})().then((function(e){return Promise.all(e.map(e=>{const t=e.model().mainSeries();return t.symbolResolvingActive().value()?b(t.dataEvents().symbolResolved()).promise:t.symbolInfo()}))})).then((function(){window.saver&&window.is_authenticated&&n.widgetOptions.justCloned&&window.saver.saveChartSilently()})).catch(C.logError.bind(C))}},6799:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,r=i(46374),n=i(79424);!function(e){let t=null,s=null;const o=[],a={createAction:e=>new r.Action({...e,actionId:"Chart.CustomActionId"}),createAsyncAction:e=>new r.ActionAsync("Chart.CustomActionId",e),createSeparator:()=>new r.Separator};async function l(e,r={},n={menuName:""},l){let h;null!==t&&(e=await t(e,a));const d=()=>{const e=o.indexOf(h);-1!==e&&o.splice(e,1),void 0!==l&&l()};if(null!==s)h=await s(e,n,d),c();else{const t=await Promise.all([i.e(7610),i.e(3894),i.e(706),i.e(8604),i.e(2359),i.e(2273),i.e(7607),i.e(4985),i.e(5514),i.e(306),i.e(4940),i.e(8434),i.e(1584)]).then(i.bind(i,90872));h=new t.ContextMenuRenderer(e,r,d,c)}return o.push(h),h}function c(){(0,n.globalCloseMenu)()}e.createMenu=l,e.showMenu=function(e,t,i={},s,r){return l(e,i,s,r).then(e=>e.show(t))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=c,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{DialogRenderer:()=>n});var s=i(32856),r=i.n(s);class n{constructor(){this._container=document.createElement("div"),this._visibility=new(r())(!1)}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},89366:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},88933:(e,t,i)=>{"use strict";function s(e){return e.getAll().some(e=>e.isInitialized())}function r(e,t){const i=e.getAll(),s=()=>{t(),i.forEach(e=>{e.chartWidgetInitialized.unsubscribe(null,s)})};i.forEach(e=>{e.chartWidgetInitialized.subscribe(null,s,!0)})}i.r(t),i.d(t,{isAnyChartWidgetInitialized:()=>s,waitAnyChartWidgetInitialized:()=>r})},65109:(e,t,i)=>{"use strict";i.d(t,{getFavoriteDrawingToolbarPromise:()=>o,createFavoriteDrawingToolbar:()=>a});i(79881);var s=i(6535);let r=null,n=null;function o(){return n}function a(){null===n&&(n=Promise.all([i.e(3876),i.e(7610),i.e(9448),i.e(3894),i.e(3996),i.e(4078),i.e(7936),i.e(706),i.e(8604),i.e(2359),i.e(2273),i.e(6548),i.e(9843),i.e(7607),i.e(6637),i.e(1941),i.e(4985),i.e(3223),i.e(5514),i.e(306),i.e(4940),i.e(708),i.e(7962),i.e(1890),i.e(5254),i.e(8434),i.e(2306)]).then(i.bind(i,55753)).then(({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),r)))}},20509:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>o});const s=["Z","Y","X","W","V","U","T","S"],r=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function o(e,t){const i="left"===e?s:r;return new n(t{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>s});i(86573);const s={id:"ChartWidgetCollectionService"};var r;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(r||(r={}))},47329:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>a,defaultInvalidationLevel:()=>o});var s,r=i(16282);class n{constructor(e=o){this._paneInvalidationLevel=o,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePriceScale(e,t,i){const s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,r=s.get(t)||o;s.set(t,Math.max(r,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}getterForPriceScaleInvalidationLevelBySide(e){ const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||o,this._invalidationLevel)}priceScaleSideMaxLevel(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;let i=this._invalidationLevel;return t.size>0&&t.forEach(e=>{e>i&&(i=e)}),i}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._paneInvalidationLevel=Math.max(this._paneInvalidationLevel,e._paneInvalidationLevel),e._leftPriceScalesInvalidationMap.forEach((e,t)=>{const i=this._leftPriceScalesInvalidationMap.get(t)||o;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))}),e._rightPriceScalesInvalidationMap.forEach((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||o;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})}}!function(e){e[e.None=0]="None",e[e.Cursor=1]="Cursor",e[e.Light=2]="Light",e[e.Full=3]="Full"}(s||(s={}));const o=s.None;class a{constructor(e=o){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeAxisInvalidationLevel=o,this._invalidatedPanes=new Map,this._additionalActions=[],this._invalidationLevel=e}invalidateAll(e){this._invalidationLevel!==e&&(this._invalidationLevel=Math.max(this._invalidationLevel,e),this._invalidatedPanes.forEach(e=>{e.invalidateAll(this._invalidationLevel)}))}invalidateAllPane(e,t){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidateAll(t)}invalidatePriceScale(e,t,i,s){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e){this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e)}invalidatePanesOrder(){this._panesOrderChanged=!0}lockVisibleTimeRangeOnResize(){this._keepVisibleTimeRangeOnResize=!0}fullInvalidation(){return this._invalidationLevel}maxPaneInvalidation(){const e=[];return this._invalidatedPanes.forEach(t=>{e.push(t.fullInvalidation())}),Math.max(...e,this._invalidationLevel)}invalidateForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidateForTimeScale(){return Math.max(this._timeAxisInvalidationLevel,this._invalidationLevel)}validationActions(){return this._additionalActions}addValidationAction(e){this._additionalActions.push(e)}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._panesOrderChanged=this._panesOrderChanged||e._panesOrderChanged,this._keepVisibleTimeRangeOnResize=this._keepVisibleTimeRangeOnResize||e._keepVisibleTimeRangeOnResize,this._invalidatedPanes.forEach(e=>{e.invalidateAll(this._invalidationLevel)}),e._invalidatedPanes.forEach((e,t)=>{this._invalidatedPanes.has(t)||this._invalidatedPanes.set(t,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)}), this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e._timeAxisInvalidationLevel);for(let t=0;t{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(43367).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function r(){return s}function n(e){s=e}},1799:(e,t,i)=>{"use strict";i.d(t,{layouts:()=>r,isMultipleLayout:()=>n});i(38069);let s;s={};const r={...{s:{title:"1 chart",count:1,sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e}}},...s};function n(e){return!function(e){return"s"===e}(e)}},75798:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroupControllerApi:()=>o});var s=i(36512),r=i(16282),n=i(67945);class o{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map(e=>e.id)}shapesInGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));return(0,s.sortSources)(t.lineTools()).map(e=>e.id())}excludeShapeFromGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}availableZOrderOperations(e){const t=(0,r.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,r.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,r.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)} getGroupName(e){return(0,r.ensureDefined)(this._groupById(e)).name()}setGroupName(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map(e=>(0,r.ensureNotNull)(this._model.dataSourceForId(e)));return!t.some(e=>!(0,n.isLineTool)(e))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find(t=>t.id===e)}}},83265:(e,t,i)=>{"use strict";i.d(t,{LoadingScreen:()=>o});var s=i(27490),r=i(26254),n=i(60183);class o{constructor(e,t){this._showed=!1,this._cw=e,this._element=document.createElement("div"),this._element.classList.add("chart-loading-screen"),this._shield=document.createElement("div"),this._shield.classList.add("chart-loading-screen-shield"),this._element.appendChild(this._shield),t.appendChild(this._element),this._cw.withModel(this,this._connectToModel)}show(){this._cw.setInLoadingState(!0),this._showed||(this._showed=!0,this._show())}hide(){this._cw.setInLoadingState(!1),this._showed&&this._hide()}isShown(){return this._showed}_connectToModel(){const e=this._cw.model().mainSeries().dataEvents();e.symbolError().subscribe(this,e=>{e!==n.permissionDenied&&this.hide()}),e.seriesError().subscribe(this,()=>{(0,s.enabled)("hide_loading_screen_on_series_error")&&this.hide()}),e.completed().subscribe(this,this.hide)}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t;if(e.backgroundType.value()===r.ColorType.Solid)t=e.background.value();else{t=`linear-gradient(${e.backgroundGradientStartColor.value()},${e.backgroundGradientEndColor.value()})`}this._shield.style.background=t,this._element.classList.add("fade")}_hide(){this._showed=!1,this._element.classList.remove("fade")}}},29448:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>h});var s=i(43367),r=i(16282),n=i(47903),o=i(52541),a=i(87910);const l=s.isSafari?"click":"auxclick",c={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1};class h{constructor(e,t,i){this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._startPinchMiddlePoint=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!s.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount, this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handler.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._handler=t,this._options=(0,n.merge)((0,n.clone)(c),i||{}),this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handler.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=m(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=_(e),null!==this._startPinchMiddlePoint)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(u(t),(0,r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll ;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handler.touchMoveEvent),(0,o.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(u(e),(0,r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=m(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=_(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handler.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(u(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handler.tapEvent),this._handler.tapEvent&&(0,o.preventDefault)(e));0===this._tapCount&&(0,o.preventDefault)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,o.preventDefault)(e))}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),s.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handler.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return;const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=_(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=u(t), this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handler.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=u(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;s.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=u(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=u(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));{const e=this._target.ownerDocument,t=e=>{this._handler.mouseDownOutsideEvent&&(e.target&&this._target.contains(e.target)||this._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",t)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}s.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),(0,o.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(l,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",()=>{},{ passive:!1})}_initPinch(){void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",e=>this._checkPinchState(e.touches),{passive:!0}),this._target.addEventListener("touchmove",e=>{if(2===e.touches.length&&null!==this._startPinchMiddlePoint&&void 0!==this._handler.pinchEvent){const t=e.touches[0],i=e.touches[1],s=p(t,i)/this._startPinchDistance,r=d(this._target);this._handler.pinchEvent(this._startPinchMiddlePoint,{x:t.clientX-r.left,y:t.clientY-r.top},{x:i.clientX-r.left,y:i.clientY-r.top},s),(0,o.preventDefault)(e)}},{passive:!1}),this._target.addEventListener("touchend",e=>{this._checkPinchState(e.touches)}))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handler.pinchStartEvent){const t=d(this._target),i=e[0],s=e[1],r={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top};this._startPinchMiddlePoint={x:(r.x+n.x)/2,y:(r.y+n.y)/2},this._startPinchDistance=p(i,s),this._handler.pinchStartEvent(this._startPinchMiddlePoint,r,n)}this._clearLongTapTimeout()}_stopPinch(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.mouseLeaveEvent),this._acceptMouseLeave=!s.CheckMobile.iOS()}_longTapHandler(e){const t=m(e.touches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handler.longTapEvent),this._processTouchEvent(i,this._handler.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,o.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:_(e){"touchstart"!==e.type&&(0,o.preventDefault)(e)}}}}function d(e){return e.getBoundingClientRect()||{left:0,top:0}}function u(e){return{x:e.pageX,y:e.pageY}}function p(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function _(e){return e.timeStamp||performance.now()}function m(e,t){for(let i=0;i{"use strict";i.d(t,{navigationButtonsVisibilityKey:()=>r,property:()=>n,availableValues:()=>o,actualBehavior:()=>a});var s=i(23952);const r="NavigationButtons.visibility",{property:n,availableValues:o,actualBehavior:a}=(0,s.createVisibilityController)(r)},42028:(e,t,i)=>{"use strict";i.d(t,{property:()=>n,availableValues:()=>o,actualBehavior:()=>a});var s=i(23952),r=i(49044);const{property:n,availableValues:o,actualBehavior:a}=(0,s.createVisibilityController)("PaneButtons.visibility",r.navigationButtonsVisibilityKey)},79204:(e,t,i)=>{"use strict";i.d(t,{PriceAxisesContainer:()=>T});var s=i(16282),r=i(16932),n=i(55430),o=i(47329),a=i(72927),l=i(73395),c=i(99182),h=i(3948),d=i(92175),u=i(54837);const p=parseInt(d.labelheight),_=parseInt(d.bottommargin);function m(e){return e/11}class g{constructor(){this._wrapper=document.createElement("div"),this._element=document.createElement("div"),this._labelElement=document.createElement("div"),this._gearElement=document.createElement("div"),this._currentScale=1,this._info=null,this._mode="auto",this._wrapper.appendChild(this._element),this._wrapper.classList.add(d.wrapper),this._element.classList.add(d.label),this._labelElement.className=d.symbol,this._element.appendChild(this._labelElement),this._gearElement.className=d.gear,this._gearElement.innerHTML=h,this._element.appendChild(this._gearElement)}getElement(){return this._wrapper}setMode(e){this._mode!==e&&(this._mode=e)}align(e,t){const i=m(t);Math.abs(i-this._currentScale)>.1&&(this._currentScale=i,Math.abs(this._currentScale-1)>.1?this._element.style.transform=`scale(${this._currentScale})`:(this._currentScale=1,this._element.style.transform=""))}drawLabelForScreenshot(e,t){if(null===this._info||"gear"===this._mode)return;const i=(0,l.makeFont)(t.fontSize,u.CHART_FONT_FAMILY);e.fillStyle=c.themes[t.theme].getThemedColor("color-price-axis-label-back"),e.globalAlpha=.5,e.beginPath();const s=m(t.fontSize)*p/2,r=(0,a.point)(t.offset+t.width/2,t.height/2);e.arc(r.x,r.y,s,0,2*Math.PI,!0),e.fill(),e.globalAlpha=1,e.fillStyle=c.themes[t.theme].getThemedColor("color-price-axis-label-text"),e.textAlign="center",e.font=i,e.textBaseline="middle",e.fillText(this._info.label,r.x,r.y)}setAxisNameInfo(e){this._info=e,null!==e&&(this._labelElement.textContent=e.label)}static height(e){return(p+_)*e}}var f=i(5729),v=i.n(f),S=i(29448),y=i(6799),b=i(65726);const w={enableTooltip:!0,showLabels:!0,enableMenu:!0,enableHighlight:!0};class P{constructor(e,t,i,s,n){this._invalidated=!0,this._size=new r.Size(0,0),this._offset=0,this._axisInfo=null,this._onLabelHovered=new(v()),this._highlighted=!1,this._labelMode="auto", this._fixedLabelMode=null,this._canvasConfiguredHandler=()=>this.update(),this._isLeft="left"===e,this._rendererOptionsProvider=s.rendererOptionsProvider,this._sourcesTitlesProvider=s.sourcesTitlesProvider,this._contextMenuItemsProvider=s.contextMenuItemsProvider,this._backgroundBasedTheme=s.backgroundBasedTheme,this._getBackgroundTopColor=s.getBackgroundTopColor,this._getBackgroundBottomColor=s.getBackgroundBottomColor,this._showHorizontalBorder=Boolean(s.showHorizontalBorder),this._properties=t,this._axisInfo=i,this._labelOptions={...w,...n},this._properties.lineColor.subscribe(this,this._onPropertyChanged),this._cell=document.createElement("div"),this._cell.classList.add(d["price-axis-stub"]),this._labelOptions.enableTooltip&&this._cell.classList.add("apply-common-tooltip"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.position="absolute",this._cell.style.left="0",this._cell.style.overflow="hidden",this._labelOptions.showLabels?(this._label=new g,this._label.setAxisNameInfo(this._axisInfo),this._cell.appendChild(this._label.getElement()),this._labelOptions.enableTooltip&&(0,b.setTooltipData)(this._cell,"text",e=>this._tooltipContent())):this._label=null,this._mouseEventHandler=new S.MouseEventHandler(this._cell,this,{treatHorzTouchDragAsPageScroll:!0,treatVertTouchDragAsPageScroll:!0}),this._canvasBinding=(0,r.createBoundCanvas)(this._cell,new r.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const o=this._canvasBinding.canvas;o.style.position="absolute",o.style.left="0",o.style.top="0"}destroy(){this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),this._properties.lineColor.unsubscribe(this,this._onPropertyChanged),this._mouseEventHandler.destroy()}mouseEnterEvent(e){this._mouseOrTouchEnterEvent(e)}touchStartEvent(e){this._mouseOrTouchEnterEvent(e)}mouseLeaveEvent(e){this._mouseOrTouchLeaveEvent(e)}touchEndEvent(e){this._mouseOrTouchLeaveEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}update(){this._invalidated=!0}getElement(){return this._cell}onLabelHovered(){return this._onLabelHovered}setSizeAndOffset(e,t){if(e.w<0||e.h<0)throw new Error("Try to set invalid size to PriceAxisStub "+JSON.stringify(e));this._size.equals(e)||(this._size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._cell.style.width=e.w+"px",this._cell.style.minWidth=e.w+"px",this._cell.style.height=e.h+"px",this._invalidated=!0),this._offset!==t&&(this._offset=t,this._cell.style.left=t+"px")}paint(e){if(e{this.setLabelMode((0,s.ensureNotNull)(this._fixedLabelMode)),this._fixedLabelMode=null})}}var C=i(20509);class T{constructor(e,t,i,s,n){this._axises=[],this._stubs=[], this._size=new r.Size(0,0),this._onLabelHovered=new(v()),this._scalesProperties=e,this._priceAxisWidgetFactory=i,this._rendererOptionsProvider=s.rendererOptionsProvider,this._titlesProvider=s.titlesProvider,this._stubContextMenuProvider=s.stubContextMenuProvider,this._backgroundBasedTheme=s.backgroundBasedTheme,this._getBackgroundTopColor=s.getBackgroundTopColor,this._getBackgroundBottomColor=s.getBackgroundBottomColor,this._showHorisontalBorder=Boolean(s.showHorizontalBorder),this._labelsOptions={...w,...n};const o=this._scalesProperties.childs();this._stubProperties={lineColor:o.lineColor,fontSize:o.fontSize},this._side=t,this._cell=document.createElement("td"),this._cell.classList.add("chart-markup-table","price-axis-container"),this._cell.style.width="25px",this._cell.style.position="relative"}destroy(){this.setScales([],0,0,0)}onLabelHovered(){return this._onLabelHovered}setScales(e,t,i,r){for(;e.length>this._axises.length&&this._axises.lengtho;){const e=(0,s.ensureDefined)(this._stubs.pop());e.onLabelHovered().unsubscribeAll(this),this._cell.removeChild(e.getElement()),e.destroy()}for(;this._stubs.length{this._labelsOptions.showLabels&&this._labelsOptions.enableHighlight&&this._onLabelHovered.fire({owner:t,axis:(0,s.ensureNotNull)(e)},i)}),this._stubs.push(i),this._cell.appendChild(i.getElement())}const a=this._labelsOptions.enableMenu;1===r?this._stubs.forEach((e,t)=>e.setLabelMode(a?"gear":"symbol")):this._stubs.forEach((e,t)=>e.setLabelMode(te.updateCurrencyLabel())}optimalWidths(){return this._axises.map(e=>e.optimalWidth())}setSizes(e,t){this._size=new r.Size(t.reduce((e,t)=>e+t,0),e),this._cell.style.width=this._size.w+"px",this._cell.style.minWidth=this._size.w+"px",this._cell.style.height=this._size.h+"px",t.length!==this._axises.length+this._stubs.length&&(0,s.assert)(t.length===this._axises.length+this._stubs.length,"Widgets count should be the same as widths one");let i=0;this._forEachWidgetFromLeft((s,n)=>{const o=t[n];s.setSizeAndOffset(new r.Size(o,e),i),i+=o})}update(){this._axises.forEach(e=>e.update()),this._stubs.forEach(e=>e.update())}paint(e){this._axises.forEach((t,i)=>t.paint(e(i))), this._stubs.forEach((t,i)=>t.paint(e(i)))}paintStubs(e){this._stubs.forEach(t=>t.paint(e))}restoreDefaultCursor(){this._axises.forEach(e=>e.restoreDefaultCursor())}getWidth(){return this._size.w}findAxisWidgetForScale(e){const t=this._axises.find(t=>t.priceScale()===e);return void 0===t?null:t}getScreenshotData(){const e=this._getImage();return{canvas:e,content:e.toDataURL(),contentHeight:this._size.h,contentWidth:this._size.w}}getImage(){return this._getImage()}slotsCount(){return this._axises.length+this._stubs.length}highlightPriceAxisByLabel(e){this._axises.forEach(t=>{const i=t.axisInfo();t.setHighlighted(null!==i&&i.equals(e))})}axes(){return this._axises}_stubParams(e){return{rendererOptionsProvider:this._rendererOptionsProvider,backgroundBasedTheme:this._backgroundBasedTheme,sourcesTitlesProvider:()=>this._titlesProvider(this._side,e),contextMenuItemsProvider:()=>this._stubContextMenuProvider(this._side,e),getBackgroundTopColor:this._getBackgroundTopColor,getBackgroundBottomColor:this._getBackgroundBottomColor,showHorizontalBorder:this._showHorisontalBorder}}_getImage(){const e=(0,r.createDisconnectedCanvas)(document,this._size),t=(0,r.getPrescaledContext2D)(e);let i=0;return this._forEachWidgetFromLeft((e,s)=>{const r=e.getWidth();0!==r&&(t.drawImage(e.getImage(),i,0,r,this._size.h),i+=r)}),e}_forEachWidgetFromLeft(e){const t=[...this._axises,...this._stubs],i="left"===this._side,s=i?-1:t.length,r=i?-1:1;for(let n=i?t.length-1:0;n!==s;n+=r)e(t[n],n,t)}}},28745:(e,t,i)=>{"use strict";i.d(t,{ActionBinder:()=>s});class s{constructor(e,t,i,s,r=null){this._property=t,this._undoModel=i,this._undoText=s,this._action=e,this.setValue(t.value()),t.subscribe(this,this._propertyChanged),null!==r?e.update({onExecute:r.bind(this)}):e.update({onExecute:this._onActionCallback.bind(this)})}destroy(){this._property.unsubscribe(this,this._propertyChanged)}value(){return this._action.isChecked()}setValue(e){this._action.update({checked:Boolean(e)})}_onActionCallback(){this._undoModel.setProperty(this._property,this.value(),this._undoText)}_propertyChanged(e){this.setValue(e.value())}}},12642:(e,t,i)=>{"use strict";i.d(t,{isCustomStudy:()=>r});const s={VbPFixed:!0,PivotPointsStandard:!0,VbPVisible:!0};function r(e){return e in s}},98824:(e,t,i)=>{"use strict";i.d(t,{MetaInfoHelper:()=>p});var s=i(16282),r=i(85062),n=i.n(r),o=i(77455),a=i(47903),l=i(65447);const c=["first_visible_bar_time","last_visible_bar_time"];function h(e){return!e.groupId&&!e.isHidden&&!c.includes(e.id)}var d=i(12642);const u=(0,l.getLogger)("Platform.GUI.PropertyDialog.Indicators.MetaInfo");class p{constructor(e){this._metaInfo=e}hasUserEditableInputs(){return this._metaInfo.inputs.some(h)}getUserEditableInputs(){return this._metaInfo.inputs.filter(h)}hasUserEditableProperties(){return n().isScriptStrategy(this._metaInfo)}hasUserEditableStyles(){const e=this._metaInfo;return e.plots.length>0||void 0!==e.bands||void 0!==e.filledAreas||(0,d.isCustomStudy)(e.shortId)||n().isScriptStrategy(this._metaInfo)||Object.values(e.graphics).some(e=>void 0!==e)} getUserEditablePlots(){const e=new Set,t=this._metaInfo;return t.plots.filter(i=>{if((0,o.isColorerPlot)(i)||(0,o.isTextColorerPlot)(i)||(0,o.isDataOffsetPlot)(i)||(0,o.isOhlcColorerPlot)(i)||(0,o.isAlertConditionPlot)(i))return!1;if((0,o.isOhlcPlot)(i)){const r=i.target;if(e.has(r))return!1;e.add(r);const n=(0,s.ensureDefined)(t.ohlcPlots);return!(0,s.ensureDefined)(n[r]).isHidden}{const e=t.styles?t.styles[i.id]:void 0;return void 0===e||!e.isHidden}})}hasUserEditableOptions(){return this.hasUserEditableInputs()||this.hasUserEditableProperties()||this.hasUserEditableStyles()}getStrategyProperties(){const e=this._metaInfo,t=e.inputs.filter(m),i={..._};for(const s of t){const t=s.internalID;i[t]=s,_.hasOwnProperty(t)||u.logWarn(`Unknown strategy input internal id ${t} in ${e.fullId}`)}return(0,a.clone)(i)}}const _={currency:void 0,backtest_fill_limits_assumption:void 0,calc_on_every_tick:void 0,calc_on_order_fills:void 0,commission_value:void 0,commission_type:void 0,initial_capital:void 0,pyramiding:void 0,slippage:void 0,default_qty_type:void 0,default_qty_value:void 0,margin_long:void 0,margin_short:void 0};function m(e){return"strategy_props"===e.groupId}},6696:(e,t,i)=>{"use strict";i.d(t,{checkAuthBeforeSaveLoad:()=>r});var s=i(27490);function r(e,t){s.enabled("saveload_requires_authentication")?window.runOrSignIn(e,t):e()}},24261:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>n,CommonJsonStoreService:()=>o});var s=i(5729),r=i.n(s);class n{constructor(e,t,i,s,n){this._onChange=new(r()),this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=s,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class o extends n{_serialize(e){return e}_deserialize(e){return e}}},93357:(e,t,i)=>{"use strict";i.d(t,{LoadChartService:()=>d});var s=i(27490),r=i(24261);class n extends r.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_CHARTS_CHANGED","loadChartDialog.favorites",{})}}var o=i(90774),a=i(2308),l=i(64222),c=i(6696),h=i(58738);class d extends h.DialogRenderer{constructor(e=null){super(),this._favoriteChartsService=new n(a.TVXWindowEvents,l),this._chartWidgetCollection=null,this._promise=null,this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._getChartEntry=e=>({id:e.id,url:e.url,title:e.name, symbol:e.short_symbol,interval:e.interval,toolsCount:0,modified:e.modified_iso,active:()=>this._isActiveChart(e.id),openAction:()=>o.backend.loadChart(e),deleteAction:()=>o.backend.removeChart(e.image_url).then(()=>this._deleteChart(e.id)),favoriteAction:this._updateFavorites}),this._updateFavorites=e=>this._favoriteChartsService.set(e),this._isActiveChart=e=>null!==this._chartWidgetCollection&&e===this._chartWidgetCollection.metaInfo.id.value(),this._deleteChart=e=>{this._isActiveChart(e)&&(s.enabled("saveload_storage_customization")?null!==this._chartWidgetCollection&&this._chartWidgetCollection.clearChartMetaInfo():location.href="/chart/"+location.search)},this._chartWidgetCollection=e}showLoadDialog(){(0,c.checkAuthBeforeSaveLoad)(this._showLoadDialog.bind(this),{source:"Load chart",sourceMeta:"Chart"})}show(){this.showLoadDialog()}hide(){var e,t;null===(e=this._dialog)||void 0===e||e.hide(),null===(t=this._dialog)||void 0===t||t.visible().unsubscribe(this._subscribe)}_showLoadDialog(){(s.enabled("saveload_requires_authentication")&&!window.is_authenticated?Promise.resolve([]):o.backend.getCharts()).then(e=>e.map(this._getChartEntry)).then(e=>{const t=this._promise=Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3708),i.e(8604),i.e(2359),i.e(7400),i.e(7353),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(5030),i.e(7799),i.e(5009)]).then(i.bind(i,59879)).then(i=>{if(this._promise===t){this._dialog&&(this._dialog.hide(),this._dialog.visible().unsubscribe(this._subscribe));const t={charts:e,favoriteChartsService:this._favoriteChartsService,chartWidgetCollection:this._chartWidgetCollection};this._dialog=new i.LoadChartDialogRenderer(t),this._dialog.visible().subscribe(this._subscribe),this._dialog.show()}})})}}},72757:(e,t,i)=>{"use strict";i.d(t,{SaveChartService:()=>g});var s=i(27490),r=i(32856),n=i.n(r),o=i(18437),a=i(9884),l=i(6696);i(95068),i(67869);var c=i(79881);i(90774);async function h(){return!0}var d=i(87614);class u{constructor(e,t){this._visibility=new(n())(!1),this._chartWidgetCollection=e,this._doSave=t}hide(){var e;null===(e=this._hide)||void 0===e||e.call(this),this._visibility.setValue(!1)}visible(){return this._visibility.readonly()}}class p extends u{cloneChart(){this._cloneChart().then(()=>this._visibility.setValue(!0))}show(){(0,l.checkAuthBeforeSaveLoad)(this.cloneChart.bind(this),{source:"Clone chart"})}async _cloneChart(){const e=this._chartWidgetCollection,t=await h(),i=e.metaInfo.name.value();t&&(this._hide=await(0,d.showRename)({title:(0,c.t)("Copy Chart Layout"),text:(0,c.t)("Enter a new chart layout name")+":",maxLength:64,initValue:(0,c.t)("{title} copy",{context:"ex: AAPL chart copy"}).format({title:e.metaInfo.name.value()}),onRename:({newValue:t,dialogClose:r})=>{s.enabled("saveload_storage_customization")&&(e.metaInfo.uid.deleteValue(),e.metaInfo.id.deleteValue(),e.metaInfo.name.setValue(t),this._doSave(void 0,void 0,()=>{e.metaInfo.name.setValue(i)})),r()},onClose:()=>this._visibility.setValue(!1)}))}}class _ extends u{ show(e,t,i){this._saveNewChart(e,t,i).then(()=>this._visibility.setValue(!0))}async _saveNewChart(e,t,i){const s=this._chartWidgetCollection,r=s.metaInfo.name.value();await h()&&(this._hide=await(0,d.showRename)({title:(0,c.t)("Save New Chart Layout"),text:(0,c.t)("Enter a new chart layout name")+":",maxLength:64,initValue:r,onRename:({newValue:n,dialogClose:o})=>{s.metaInfo.name.setValue(n),this._doSave(e,t,()=>{s.metaInfo.name.setValue(r),null==i||i()}),o()},onClose:()=>this._visibility.setValue(!1)}))}}class m extends u{show(){this._renameChart(),this._visibility.setValue(!0)}_renameChart(){(0,l.checkAuthBeforeSaveLoad)(async()=>{const e=this._chartWidgetCollection,t=e.metaInfo.name.value();this._hide=await(0,d.showRename)({title:(0,c.t)("Rename Chart Layout"),text:(0,c.t)("Enter a new chart layout name")+":",maxLength:64,initValue:t,onRename:({newValue:i,dialogClose:s})=>{e.metaInfo.name.setValue(i),this._doSave(void 0,void 0,()=>{e.metaInfo.name.setValue(t)}),s()},onClose:()=>this._visibility.setValue(!1)})},{source:"Rename chart"})}}class g{constructor(e,t){this._autosaveTimer=null,this._watchedAutoSaveEnabled=new(n()),this._toggleAutoSaveEnabledHandler=this._toggleAutoSaveEnabled.bind(this),this._doSave=(e,t,i,s)=>{const r=this._chartWidgetCollection;void 0!==e&&e(),this._chartSaver.saveChartSilently(e=>{var i;i=r.metaInfo.uid.value(),"/chart/"===location.pathname&&(location.href="/chart/"+i),void 0!==t&&t(e)},()=>{void 0!==i&&i()},{autoSave:Boolean(s)})},this._chartWidgetCollection=e,this._chartSaver=t,this._createController=new _(e,this._doSave),this._renameController=new m(e,this._doSave),this._saveAsController=new p(e,this._doSave),this._chartChangesWatcher=new a.ChartChangesWatcher(e.undoHistory,e.lineToolSynchronizerHasChanges,t,o),e.saveKeysPressed().subscribe(this,this.saveChartOrShowTitleDialog),this._chartChangesWatcher.getOnChange().subscribe(this,this._onStateChanged)}autoSaveEnabled(){return this._watchedAutoSaveEnabled}destroy(){0}getCreateController(){return this._createController}getRenameController(){return this._renameController}getSaveAsController(){return this._saveAsController}cloneChart(){this._saveAsController.cloneChart()}saveChartAs(){this._saveAsController.show()}renameChart(){this._renameController.show()}saveNewChart(e,t,i){this._createController.show(e,t,i)}saveExistentChart(e,t,i){this._doSave(e,t,i)}hasChanges(){return this._chartChangesWatcher.hasChanges()}saveChartOrShowTitleDialog(e,t,i){const s=window.saver.isSaveInProcess(),r=this._chartChangesWatcher.hasChanges(),n=!!this._chartWidgetCollection.metaInfo.id.value();window.is_authenticated&&(s||!r&&n)||(0,l.checkAuthBeforeSaveLoad)(()=>{null!=this._chartWidgetCollection.metaInfo.id.value()?this.saveExistentChart(e,t,i):this.saveNewChart(e,t,i)},{source:"Save chart",sourceMeta:"Chart"})}whenReadyToSave(e){this._chartSaver.whenReadyToSave(e)}saveToJSON(){return this._chartSaver.saveToJSON()}saveChartSilently(e,t,i){this._chartSaver.saveChartSilently(e,t,i)}setAutoSaveEnabled(e){ window.is_authenticated&&window.saver.isSaveInProcess()||(0,l.checkAuthBeforeSaveLoad)(()=>{this._watchedAutoSaveEnabled.setValue(e)},{source:"AutoSave chart"})}saveChartLineTools(e,t,i){return this._chartSaver.saveChartLineTools(e,t,i)}_autoSaveEnabledSettingHandler(e){0}_toggleAutoSaveEnabled(e){0}_enableAutoSave(){0}_disableAutoSave(){0}_onStateChanged(e){e?this._startAutosave():this._stopAutosave()}_startAutosave(){s.enabled("charts_auto_save")&&null===this._autosaveTimer&&(this._autosaveTimer=setTimeout(()=>{this._autosaveTimer=null,this._chartWidgetCollection.metaInfo.id.value()&&this._doSave(void 0,void 0,void 0,!0)},6e4))}_stopAutosave(){null!==this._autosaveTimer&&(clearInterval(this._autosaveTimer),this._autosaveTimer=null)}}},10616:(e,t,i)=>{"use strict";i.d(t,{showMarketOpenStatusProperty:()=>o,restoreShowMarketOpenStatusProperty:()=>a});var s=i(68137),r=i(64222);function n(){return r.getBool("Chart.ShowMarketOpenStatus",!0)}const o=(0,s.createPrimitiveProperty)(n());function a(){o.setValue(!0),r.remove("Chart.ShowMarketOpenStatus")}r.onSync.subscribe(null,()=>o.setValue(n())),o.subscribe(null,()=>r.setValue("Chart.ShowMarketOpenStatus",o.value()))},96431:(e,t,i)=>{"use strict";i.d(t,{StudyTemplates:()=>p});var s=i(79881),r=i(90774),n=i(87438),o=i(5729),a=i.n(o),l=i(32856),c=i.n(l),h=i(87614);const d=(0,i(65447).getLogger)("Platform.StudyTemplates"),u=(0,s.t)("Do you really want to delete Study Template '{name}' ?");class p{constructor(e){this._chartWidgetCollection=e.chartWidgetCollection,this._favoriteStudyTemplatesService=e.favoriteStudyTemplatesService,window.loginStateChange.subscribe(null,r.backend.invalidateStudyTemplatesList),this._list=new(c())([]),this._onChange=new(a()),this._list.subscribe(()=>this._onChange.fire())}findRecordByName(e){return this._list.value().find(t=>t.name===e)||null}showSaveAsDialog(){const e=this._chartWidgetCollection.activeChartWidget.value().model();Promise.all([i.e(3876),i.e(7039),i.e(4595),i.e(5698),i.e(3996),i.e(4078),i.e(8193),i.e(706),i.e(9602),i.e(2273),i.e(83),i.e(1403),i.e(5514),i.e(306),i.e(2402),i.e(3590),i.e(1829),i.e(7591),i.e(6631)]).then(i.bind(i,10342)).then(t=>{new t.StudyTemplateSaver({controller:e,onSave:e=>{this._list.setValue(e)}}).show()})}applyTemplate(e){const t=this.findRecordByName(e);null!==t?window.runOrSignIn(()=>{const e=this._chartWidgetCollection.activeChartWidget.value(),i=i=>{(0,n.trackEvent)("GUI","Load Study Template"),e.model().applyStudyTemplate(JSON.parse(i.content),t.name)};void 0!==t.id?t.is_default?r.backend.getStandardStudyTemplateContentById(t.id,i):r.backend.getStudyTemplateContentById(t.id,i):r.backend.getStudyTemplateContent(t.name).then(i)},{source:"Study templates apply"}):d.logNormal(`Template ${e} not found in cache`)}deleteStudyTemplate(e){const t=this.findRecordByName(e);null!==t?this._removeTemplate(t):d.logNormal(`Template ${e} not found in cache`)}list(){return this._list.value()}getOnChange(){return this._onChange}refreshStudyTemplateList(e){r.backend.getStudyTemplatesList().then(t=>{this._list.setValue(t), void 0!==e&&e()})}invalidate(){r.backend.invalidateStudyTemplatesList()}_removeTemplate(e){window.runOrSignIn(()=>{(0,h.showConfirm)({text:u.format({name:e.name}),onConfirm:({dialogClose:t})=>new Promise(i=>{const s=()=>{this.refreshStudyTemplateList(()=>{const s=this.list();this._list.setValue(s.filter(t=>t!==e)),this._favoriteStudyTemplatesService&&this._favoriteStudyTemplatesService.remove(e.name),i(),t()})};r.backend.invalidateStudyTemplatesList(),void 0!==e.id?r.backend.removeStudyTemplateById(e.id,s):r.backend.removeStudyTemplate(e.name).then(s)})})},{source:"Study templates delete"})}}},72454:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>c,globalKeypressMatches:()=>h,intervalIsSupported:()=>l,parseIntervalValue:()=>a});var s=i(27490),r=i(1467),n=i(24287),o=i(35001);new RegExp("^quandl","i");function a(e){let t;t=/^[,\s]*(^[1-9][0-9]*)?\s*([hdwmst]?)\s*$/i;const i=t.exec(e)||[],s=~~i[1],r=i[2]&&i[2].toUpperCase()||null,n={qty:!s&&r?1:s,unit:r};return n.error=!s&&!r,n.intraday=!(n.error||n.unit&&"H"!==n.unit&&"S"!==n.unit&&"T"!==n.unit),n}function l(e){if(s.enabled("allow_supported_resolutions_set_only")){const t=o.Interval.normalize(e);return null!==t&&(0,r.isAvailable)(t)}{const t=a(e);if(t.error)return!1;if(t.intraday)return n.linking.intraday.value();{const e=n.linking.supportedResolutions.value();return!e||null!==t.unit&&!!~e.indexOf(t.unit)}}}function c(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function h(e){return!e.ctrlKey&&(!e.metaKey&&(!!e.charCode&&(!(!e.which||e.which<=32)&&(null===e.target||!/^(input|textarea)$/i.test(e.target.tagName)))))}},40801:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(4595),i.e(5698),i.e(3996),i.e(7936),i.e(3708),i.e(8858),i.e(5514),i.e(306),i.e(2402),i.e(1529),i.e(5383),i.e(3590),i.e(5030),i.e(9772),i.e(1754)]).then(i.bind(i,99319))}i.d(t,{loadNewSymbolSearch:()=>s})},56569:(e,t,i)=>{"use strict";i.d(t,{TimeAxisWidget:()=>w});var s=i(16282),r=i(79881),n=i(90963),o=i(73395),a=i(29448),l=i(16932),c=i(47329),h=i(47903),d=i(92137),u=i(54837),p=i(5729),_=i.n(p),m=i(79204),g=i(58252),f=i(46374),v=i(21698),S=i(87438),y=i(6799);i(46596);const b={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0};new n.TranslatedString("change session",(0,r.t)("change session")),(0,r.t)("Session");class w{constructor(e,t,i,s,r){this._rendererOptions=null,this._onLabelHovered=new(_()),this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,h.merge)((0,h.clone)(b),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("tr"),this._backgroundBasedTheme=r;const n=()=>this.backgroundColor(),o=()=>{throw new Error("Time axis does not support real price scales")},c={titlesProvider:i,stubContextMenuProvider:(e,t)=>{const i=this.getContextMenuActions(!0);let r=s(e,t);if(r[r.length-1]===this.chart.actions().scalesProperties){const e=[new f.Separator].concat(i);Array.prototype.splice.apply(r,[r.length-2,0,...e])}else r.push(new f.Separator), r=r.concat(i);return r},backgroundBasedTheme:r,rendererOptionsProvider:e.model().model().rendererOptionsProvider(),getBackgroundTopColor:n,getBackgroundBottomColor:n,showHorizontalBorder:!0};this._lhsStubContainer=new m.PriceAxisesContainer(this._properties,"left",o,c,this._options.priceAxisLabelsOptions),this._lhsStubContainer.onLabelHovered().subscribe(this,(e,t)=>{this._onLabelHovered.fire(e,t)}),this._rhsStubContainer=new m.PriceAxisesContainer(this._properties,"right",o,c,this._options.priceAxisLabelsOptions),this._rhsStubContainer.onLabelHovered().subscribe(this,(e,t)=>{this._onLabelHovered.fire(e,t)}),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("td"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,l.createBoundCanvas)(this._dv,new l.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const d=this._canvasBinding.canvas;d.style.position="absolute",d.style.zIndex="1",d.style.left="0",d.style.top="0",this._topCanvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._topCanvasBinding=(0,l.createBoundCanvas)(this._dv,new l.Size(16,16)),this._topCanvasBinding.subscribeCanvasConfigured(this._topCanvasConfiguredHandler);const u=this._topCanvasBinding.canvas;u.style.position="absolute",u.style.zIndex="2",u.style.left="0",u.style.top="0",this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=g.MINUTE_SPAN,this._mouseEventHandler=new a.MouseEventHandler(this._topCanvasBinding.canvas,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=new l.Size(0,0)}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeCanvasConfigured(this._topCanvasConfiguredHandler),this._topCanvasBinding.destroy(),this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),this._rhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.destroy(),this._rhsStubContainer.destroy(),this.chart.properties().childs().paneProperties.childs().background.unsubscribeAll(this)}setCursor(e){let t="";"grabbing"!==e&&"ew-resize"!==e||(t="time-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}restoreDefaultCursor(){this.setCursor("")}getElement(){return this._element}optimalHeight(){const e=this.rendererOptions() ;return Math.ceil(e.borderSize+e.offsetSize+e.fontSize+e.paddingTop+e.paddingBottom+e.labelBottomOffset)}setSizes(e,t,i){this.size&&this.size.equals(e)||(this.size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._topCanvasBinding.resizeCanvas({width:e.w,height:e.h}),this._cell.style.width=e.w+"px",this._cell.style.height=e.h+"px"),this._lhsStubContainer.setSizes(e.h,t),this._rhsStubContainer.setSizes(e.h,i)}rendererOptions(){if(!this._rendererOptions||this._rendererOptions.fontSize!==this.fontSize()){const e=this.fontSize();this._rendererOptions={borderSize:1,offsetSize:5,fontSize:e,font:(0,o.makeFont)(e,u.CHART_FONT_FAMILY,""),widthCache:new d.TextWidthCache,paddingTop:3*e/12,paddingBottom:3*e/12,paddingHorizontal:9*e/12,labelBottomOffset:4*e/12}}return this._rendererOptions}backgroundColor(){return this.chart.model().model().backgroundColor().value()}lineColor(){return this._properties.childs().lineColor.value()}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,o.makeFont)(this.fontSize(),u.CHART_FONT_FAMILY)}baseBoldFont(){return(0,o.makeFont)(this.fontSize(),u.CHART_FONT_FAMILY,"","bold")}hasCanvas(e){return this._canvasBinding.canvas===e||this._topCanvasBinding.canvas===e}onLabelHovered(){return this._onLabelHovered}getScreenshotData(){return{content:this._canvasBinding.canvas.toDataURL(),canvas:this._canvasBinding.canvas,contentWidth:this.size.w,contentHeight:this.size.h,lhsStub:this._lhsStubContainer.getScreenshotData(),rhsStub:this._rhsStubContainer.getScreenshotData()}}getContextMenuActions(e){const t=this.chart;t.updateActions();const i=t.actions(),s=[];return e||s.push(i.timeScaleReset,new f.Separator),this._options.timezoneMenuEnabled&&s.push(i.applyTimeZone),s.push(i.sessionBreaks),s}update(){if(!this.chart.hasModel())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=g.YEAR_SPAN;for(const t of e)this._minVisibleSpan=Math.min(t.span,this._minVisibleSpan)}}updatePriceAxisStubs(){const e=this.chart.model().model(),t=this.chart.isMaximizedPane()?(0,s.ensureNotNull)(this.chart.maximizedPaneWidget()).state():e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount();this._lhsStubContainer.setScales([],i.left,t.leftPriceScales().length,i.left+i.right),this._rhsStubContainer.setScales([],i.right,t.rightPriceScales().length,i.left+i.right)}paint(e){if(e===c.InvalidationLevel.None)return;const t=(0,l.getContext2D)(this._topCanvasBinding.canvas);if(e>c.InvalidationLevel.Cursor){const i=(0,l.getContext2D)(this._canvasBinding.canvas),s=this._canvasBinding.pixelRatio;this.drawBackground(i,s),this.chart.hasModel()&&(this.drawBorder(i,s),this.drawTickMarks(i,s),this.drawBackLabels(i,s),this.drawCrossHairLabel(t,s)),this._lhsStubContainer.paintStubs(e),this._rhsStubContainer.paintStubs(e)}this.drawCrossHairLabel(t,this._topCanvasBinding.pixelRatio)}drawBackground(e,t){if((0, l.clearRect)(e,0,0,Math.ceil(this.size.w*t)+1,Math.ceil(this.size.h*t)+1,this.backgroundColor()),!this.chart.hasModel())return;const i=this.chart.model();if(!i.timeScale().isEmpty()){const s=i.model().selection().lineDataSources().reduce((e,t)=>{const i=t.timeAxisPoints();return 0===i.length?e:e.concat(i)},[]);s.length>0&&this._hightlightBackground(e,s,t)}const s=i.model().crossHairSource();s.startMeasurePoint()&&this._hightlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t)),s=Math.ceil(this.size.w*t);e.fillRect(0,0,s+1,i),e.restore()}drawTickMarks(e,t){const i=this.chart.model().timeScale().marks();if(!i||0===i.length)return;let s=i.reduce((e,t)=>e.span>t.span?e:t,i[0]).span;s>30&&s<40&&(s=30),e.save(),e.strokeStyle=this.lineColor();const r=this.rendererOptions(),n=r.borderSize+r.offsetSize+r.paddingTop+r.fontSize/2;e.textAlign="center",e.textBaseline="middle",e.fillStyle=this.textColor(),(0,l.drawScaled)(e,t,()=>{e.font=this.baseFont();for(let t=0;t=s&&e.fillText(r.label,r.coord,n)}}),e.restore()}drawBackLabels(e,t){var i;e.save();const s=new Set,r=this.chart.model().model();let n=r.dataSources();const o=r.selection().allSources();for(const e of o)s.add(e);r.hoveredSource()&&s.add(r.hoveredSource());for(const e of r.sourcesBeingMoved())s.add(e);const a=r.customSourceBeingMoved();null!==a&&s.add(a);const l=null!==(i=r.lineBeingEdited())&&void 0!==i?i:r.lineBeingCreated();l&&s.add(l),s.add(this.chart.model().crossHairSource()),n=n.concat(r.customSources());const c=this.rendererOptions();for(let i=0;i=s&&(s=a,n=o),a<=i&&(i=a,r=o)}}return n&&t.push(n),r&&t.push(r),t}_zoomAvailable(){return!this.chart.model().timeScale().isEmpty()&&this.chart.model().model().zoomEnabled()&&this._options.pressedMouseMoveScale}_mouseDownOrTouchStartEvent(e){if(this._mousedown||!this._zoomAvailable())return;this._mousedown=!0;const t=this.chart.model();t.timeScale().isEmpty()||t.startScaleTime(e.localX)}_pressedMouseOrTouchMoveEvent(e){this._zoomAvailable()&&this.chart.model().scaleTimeTo(e.localX)}_mouseUpOrTouchEndEvent(e){this._zoomAvailable()&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_contextMenuOrTouchContextMenuEvent(e){this._options.contextMenuEnabled&&y.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"TimeScaleContextMenu"},{menuName:"TimeScaleContextMenu"})}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){(0,S.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}}},80525:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(86573);const r={id:"TradingService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}},75938:(e,t,i)=>{"use strict";i.d(t,{TradingViewApiBase:()=>d});i(16282);var s=i(24287),r=i(87438),n=i(99182),o=i(14829),a=i(5729),l=i.n(a);class c{constructor(e){this._toolbarThemeChanged=new(l()),this._onWatchedThemeChanged=e=>{this._toolbarThemeChanged.fire(e)},this._opts=e,o.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){o.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every(e=>(0,n.isStdTheme)((0, n.extractThemeFromModel)(e.model())));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,n.loadTheme)(e,!0,!1,this._opts.chartWidgetCollection,t,i)}setStdThemeForLayout(e,t=!0){(0,o.setTheme)(e),t&&(0,n.syncTheme)()}getCurrentThemeName(){return(0,n.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}function h(){throw new Error("not implemented")}class d{constructor(e){this._studyTemplatesDrawer=null,this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null;const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:r,financialsDialog:n,saveChartService:o,loadChartService:a}=e;this._chartWidgetCollection=i,this._studyMarket=r,this._financialsDialog=n,this._saveChartService=o,this._loadChartLayoutDialog=a,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=s.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,()=>this.destroy(),!0)}destroy(){var e,t,i;this._supportedChartStylesSpawn.destroy(),null===(e=this._intervalsService)||void 0===e||e.destroy(),null===(t=this._themesApi)||void 0===t||t.destroy(),null===(i=this._widgebarApi)||void 0===i||i.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._isDestroyed=!0}themes(){return null===this._themesApi&&(this._themesApi=new c({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){var e,t,i,s,r,n;return{Indicators:this._studyMarket,Financials:this._financialsDialog,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:null!==(t=null===(e=this._saveChartService)||void 0===e?void 0:e.getSaveAsController())&&void 0!==t?t:null,ChartLayoutRename:null!==(s=null===(i=this._saveChartService)||void 0===i?void 0:i.getRenameController())&&void 0!==s?s:null,ChartLayoutCreate:null!==(n=null===(r=this._saveChartService)||void 0===r?void 0:r.getCreateController())&&void 0!==n?n:null,ChartLayoutLoad:this._loadChartLayoutDialog,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null}}studyTemplatesDrawerApi(){h()}intervalsService(){h()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}disableTrackingEvents(){(0,r.disableTrackingEvents)()}setSymbolSearchUI(e){h()}setLayout(e,t){(null==t?void 0:t.withUndo)?this._chartWidgetCollection.setChartLayoutWithUndo(e):this._chartWidgetCollection.setLayout(e)}watchlist(){h()}setWatchlistApiPromise(e){h()}news(){h()}setNewsApiPromise(e){h()}widgetbar(){h()}setWidgetbarApiPromise(e){h()}}},54736:(e,t,i)=>{"use strict" ;var s=i(5729),r=i(32856),n=i(24287).linking,o=i(4184),a=i(1799).layouts,l=i(18437),c=i(6799).ContextMenuManager,h=i(15521),d=i(1467),u=i(90774).backend,p=i(65447),_=i(87614).showWarning,m=i(87614).showConfirm,g=i(85125),f=i(28164).CLOSE_POPUPS_AND_DIALOGS_COMMAND,v=i(35001).Interval,S=i(11092).saveDefaultProperties,y=i(9884).ChartChangesWatcher,b=i(75938).TradingViewApiBase,w=i(85062),P=i(25682).getStudyInputsInfo;e.exports=class extends b{constructor(e){const{chartWidgetCollection:t,chartApiInstance:i=null,saveChartService:r,loadChartService:o,alertsDispatcher:a,supportTicketData:l,favoriteServices:c,studyMarket:h=null,financialsDialog:d=null}=e;super({chartApiInstance:i,chartWidgetCollection:t,studyMarket:h,financialsDialog:d,saveChartService:r,loadChartService:o}),this._chartApiInstance=i,this._loadChartService=o,this._alertsDispatcher=a,this._supportTicketData=l,this._favoriteServices=c,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._magnetEnabledWatchedValue=null,this._magnetModeWatchedValue=null,this._replayApi=null,this._chartChangesWatcher=null,this._hasChartChangesWatchedValue=null,this._getDataSourceHub=function(){return t.activeChartWidget.value().model().model()},this._chartWidgetCollection.getResizerDetacher=function(){return t.activeChartWidget.value().getResizerDetacher()},this._alertService=this._alertsDispatcher?new(void 0)(this._alertsDispatcher,this._getDataSourceHub):null,this._activeChangedChangedDelegate=new s,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=new WeakMap,this._activateChart=function(e){t.activeChartWidget.setValue(e)},this.linking=n}subscribe(e,t){l.subscribe(e,t)}unsubscribe(e,t){l.unsubscribe(e,t)}onContextMenu(e){l.subscribe("onContextMenu",(function(t){t.callback(e(t.unixtime,t.price))}))}onGrayedObjectClicked(e){l.subscribe("onGrayedObjectClicked",e)}activeChart(){return this._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())}_getChartWidgetApi(e){var t=this._chartWidgets.get(e);return void 0===t&&(t=new o(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}onActiveChartChanged(){return this._activeChangedChangedDelegate}changeSymbol(e,t,i){n.interval.setValue(v.normalize(t)),n.symbol.setValue(e),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}layout(){return this._chartWidgetCollection.layout.value()}layoutName(){return this._chartWidgetCollection.metaInfo.name.value()}layoutNameWatchedValue(){return this._chartWidgetCollection.metaInfo.name.readonly()}layoutSettingsDrawer(){throw new Error("not implemented")}chartsCount(){return a[this.layout()].count}viewMode(){throw new Error("not implemented")}viewModeWatchedValue(){throw new Error("not implemented")}setForceFullscreenMode(){throw new Error("not implemented")}setMultichartMode(){throw new Error("not implemented")}setActiveChart(e){throw new Error("not implemented")}chart(e){ if(void 0===e&&(e=0),e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}getSymbolInterval(e){var t={symbol:n.symbol.value(),interval:n.interval.value()};return e&&e(t),t}saveChart(e){if(this._saveChartService){var t=this;this._saveChartService.whenReadyToSave((function(){var i=t._saveChartService.saveToJSON();return e&&e(JSON.parse(i.content))}))}}loadChart(e){this._chartApiInstance.disconnect(),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),this._chartApiInstance.connect(),n.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")}getStudiesList(){return this._chartApiInstance.allStudiesMetadata().filter((function(e){return!e.is_hidden_study})).map((function(e){return e.description}))}getStudyInputs(e){{const t=w.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return P(t)}}getSavedCharts(e){u.getCharts().then(e)}loadChartFromServer(e){u.loadChart(e)}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}setAutosave(e){this._saveChartService&&this._saveChartService.autoSaveEnabled().setValue(e)}removeChartFromServer(e,t){u.removeChart(e).then(t)}getIntervals(){var e=[],t=d.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),d.mergeResolutions(e,t)}closePopupsAndDialogs(){for(var e=document.querySelectorAll("._tv-dialog-title-close"),t=0;t{"use strict";i.d(t,{createVisibilityController:()=>l});var s=i(79881),r=i(96404),n=i(68137),o=i(64222);function a(e){return"alwaysOn"===e||"alwaysOff"===e?e:"visibleOnMouseOver"}function l(e,t){let i,l;function c(){if(!i){i=(0,n.createPrimitiveProperty)();let s=o.getValue(e);void 0===s&&void 0!==t&&(s=o.getValue(t)),i.setValue(a(s)),i.subscribe(i,t=>{o.setValue(e,a(t.value()))})}return i}return{property:c,availableValues:function(){return[{id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:(0,s.t)("Visible on mouse over")},{id:"alwaysOn",value:"alwaysOn",title:(0,s.t)("Always visible")},{id:"alwaysOff",value:"alwaysOff",title:(0,s.t)("Always invisible")}]},actualBehavior:function(){if(!l){l=(0,n.createPrimitiveProperty)();const e=c(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),l&&l.setValue(t)};e.subscribe(l,t),t()}return l}}}},92932:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>o,restoreAddPlusButtonSettingsValue:()=>a});var s=i(64222),r=i(68137);function n(){return s.getBool("add_plus_button",!0)}const o=(0,r.createPrimitiveProperty)(n());function a(){o.setValue(!0),s.remove("add_plus_button")}s.onSync.subscribe(null,()=>o.setValue(n())),o.listeners().subscribe(null,()=>s.setValue("add_plus_button",o.value()))},63103:(e,t,i)=>{"use strict";i.d(t,{AppliedTimeFrame:()=>r});var s=i(78556);class r{constructor(e){this._appliedTimeFrame=new s.WatchedObject(null),this._appliedTimeFrameInfo=null, this._appliedTimeFrameChangedBound=this._appliedTimeFrameChanged.bind(this),this._model=e,e.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),this._appliedTimeFrame.subscribe(this._appliedTimeFrameChangedBound)}destroy(){this._appliedTimeFrame.unsubscribe(this._appliedTimeFrameChangedBound),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.mainSeries().dataEvents().seriesTimeFrame().unsubscribeAll(this)}appliedTimeFrame(){return this._appliedTimeFrame}_appliedTimeFrameChanged(){this._model.timeScale().logicalRangeChanged().unsubscribe(this,this._invalidateAppliedTimeFrame)}_onSeriesTimeFrame(e,t,i,s){if(s){const e=this._model.timeScale();this._appliedTimeFrameInfo={logicalRange:e.logicalRange(),baseIndex:e.baseIndex()},e.logicalRangeChanged().subscribe(this,this._invalidateAppliedTimeFrame)}}_invalidateAppliedTimeFrame(){if(null===this._appliedTimeFrameInfo)return;const e=this._model.timeScale(),t=e.logicalRange(),i=e.baseIndex(),s=this._appliedTimeFrameInfo.logicalRange,r=this._appliedTimeFrameInfo.baseIndex;(null===t||null===s||Math.abs(i-t.left()-(r-s.left()))>=.01||Math.abs(i-t.right()-(r-s.right()))>=.01)&&this._appliedTimeFrame.setValue(null)}}},2460:(e,t,i)=>{"use strict";i.d(t,{defaultsPreferencesByWhiteList:()=>C,preferencesByWhiteList:()=>P});var s=i(47903),r=i(23221);var n=i(65447),o=i(84995),a=i(18130),l=i(18742),c=i(7532),h=i(26254);const d=(0,n.getLogger)("Chart.ApplyPreferencesToAllCharts"),u={color:"",style:0},p={autoScale:!1,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!1,isInverted:!1,indexedTo100:!1},_={backgroundType:h.ColorType.Solid,background:"",backgroundGradientStartColor:"",backgroundGradientEndColor:"",topMargin:0,bottomMargin:0,rightOffset:0,horzGridProperties:(0,c.deepExtend)({},u),vertGridProperties:(0,c.deepExtend)({},u),crossHairProperties:(0,c.deepExtend)({},{color:"",style:0,transparency:0,width:0}),legendProperties:(0,c.deepExtend)({},{showStudyArguments:!1,showStudyTitles:!1,showStudyValues:!1,showSeriesTitle:!1,showSeriesOHLC:!1,showLegend:!1,showBarChange:!0,showVolume:!1,showBackground:!0,backgroundTransparency:0}),axisProperties:(0,c.deepExtend)({},p)},m={lineColor:"",textColor:"",fontSize:0,scaleSeriesOnly:!1,showSeriesLastValue:!1,seriesLastValueMode:o.PriceAxisLastValueMode.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalLastValue:!1,showFundamentalNameLabel:!1,showCurrency:!0,showUnit:!0,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0},g={...m},f={visible:!1,futureOnly:!1,breaks:(0,c.deepExtend)({},{color:"",visible:!1,style:0,width:0})},v={style:0,minTick:"",showPriceLine:!1,priceLineWidth:0,priceLineColor:"",baseLineColor:"",showPrevClosePriceLine:!1,showCountdown:!0,prevClosePriceLineWidth:0,sessionId:"regular",prevClosePriceLineColor:"",esdShowDividends:!1,esdShowSplits:!1,esdShowEarnings:!1, esdShowBreaks:!1,dividendsAdjustment:!1,backAdjustment:!1,settlementAsClose:!0,statusViewStyle:(0,c.deepExtend)({},{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"}),priceAxisProperties:(0,c.deepExtend)({},p),highLowAvgPrice:(0,c.deepExtend)({},{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLineVisible:!1,averageClosePriceLabelVisible:!1}),candleStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",drawWick:!1,drawBorder:!1,drawBody:!0,borderColor:"",borderUpColor:"",borderDownColor:"",wickColor:"",wickUpColor:"",wickDownColor:"",barColorsOnPrevClose:!1}),hollowCandleStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",drawWick:!1,drawBorder:!1,drawBody:!0,borderColor:"",borderUpColor:"",borderDownColor:"",wickColor:"",wickUpColor:"",wickDownColor:""}),barStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0}),lineStyle:(0,c.deepExtend)({},{color:"",linestyle:0,linewidth:0,styleType:0}),areaStyle:(0,c.deepExtend)({},{color1:"",color2:"",linecolor:"",linestyle:0,linewidth:0,transparency:0}),baselineStyle:(0,c.deepExtend)({},{topFillColor1:"",topFillColor2:"",bottomFillColor1:"",bottomFillColor2:"",topLineColor:"",bottomLineColor:"",baselineColor:"",topLineWidth:0,bottomLineWidth:0,transparency:0,baseLevelPercentage:0}),hiloStyle:(0,c.deepExtend)({},{color:"",showBorders:!1,borderColor:"",showLabels:!1,labelColor:"",fontSize:0,drawBody:!0}),haStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",drawWick:!1,drawBorder:!1,drawBody:!0,borderColor:"",borderUpColor:"",borderDownColor:"",wickColor:"",wickUpColor:"",wickDownColor:"",showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{}}),renkoStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",borderUpColor:"",borderDownColor:"",upColorProjection:"",downColorProjection:"",borderUpColorProjection:"",borderDownColorProjection:"",wickUpColor:"",wickDownColor:"",inputs:{boxSize:0,style:"",atrLength:0,wicks:!1,sources:"",source:""}}),pbStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",borderUpColor:"",borderDownColor:"",upColorProjection:"",downColorProjection:"",borderUpColorProjection:"",borderDownColorProjection:"",inputs:{source:"",lb:0}}),kagiStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",upColorProjection:"",downColorProjection:"",inputs:{style:"",atrLength:0,reversalAmount:0}}),pnfStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",upColorProjection:"",downColorProjection:"",inputs:{reversalAmount:0,boxSize:0,style:"",atrLength:0}}),rangeStyle:(0,c.deepExtend)({},{upColor:"",downColor:"",upColorProjection:"",downColorProjection:"",thinBars:!1,inputs:{range:0,phantomBars:!1}})},S={priceScaleSelectionStrategyName:"auto",timeScale:(0,c.deepExtend)({},{defaultRightOffset:0}),mainSeries:(0,c.deepExtend)({},v),sessions:(0,c.deepExtend)({},l.sessionsPreferencesDefault),paneProperties:(0,c.deepExtend)({},_),chartEventsSourceProperties:(0,c.deepExtend)({},f),tradingProperties:(0,c.deepExtend)({},r.tradingPreferencesDefault)},y={timezone:"",scalesProperties:(0,c.deepExtend)({},g),...S },b={scalesProperties:(0,c.deepExtend)({},m),...S};function w(e,t,i,r,n=!0){if(void 0===t[e])return d.logDebug(`We haven't had this property ${r}.${e} yet, please, remove it from whiteList`),null;if((0,s.isObject)(i[e])){const s=Object.keys(i[e]);let o="";return s.map(s=>({[s]:w(s,t[e],i[e],`${r}.${e}`,n)})).reduce((e,t)=>(o=Object.keys(t)[0],e[o]=t[o],e),{})}return n?t[e].value():t[e]}function P(e,t,i=y){const s={timezone:"",priceScaleSelectionStrategyName:"auto",timeScale:{defaultRightOffset:e.timeScale().defaultRightOffset().value()},mainSeries:{},sessions:{},paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{}},r=["timeScale","mainSeries","sessions"],n=i.mainSeries,o=Object.keys(i),a=Object.keys(n),l=t.properties(),c=e.properties(),h=i.sessions,d=Object.keys(h),u=e.sessions().properties();return a.forEach(e=>{s.mainSeries[e]=w(e,l,n,"mainSeries")}),d.forEach(e=>{s.sessions[e]=w(e,u,h,"sessions")}),o.forEach(e=>{r.includes(e)||(s[e]=w(e,c,i,"preferences"))}),s}function C(e,t,i=b){const s={timeScale:{defaultRightOffset:e.timeScale().rightOffsetDefaultValue()},mainSeries:{},sessions:(0,c.deepExtend)({},l.sessionsPreferencesDefault),paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{},priceScaleSelectionStrategyName:"auto"},r=["timeScale","mainSeries","sessions"],n=i.mainSeries,o=Object.keys(i),h=Object.keys(n),d=(0,a.factoryDefaults)("chartproperties.mainSeriesProperties"),u=(0,a.factoryDefaults)("chartproperties");return h.forEach(e=>{s.mainSeries[e]=w(e,d,n,"mainSeries",!1)}),o.forEach(e=>{r.includes(e)||(s[e]=w(e,u,i,"preferences",!1))}),s}},28417:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>r});var s=i(53312);const r={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]}},63059:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>c,isAlignmentEnabled:()=>h,createTimeToBarTimeAligner:()=>d});var s=i(84540),r=i(27490),n=i(35001),o=i(91789),a=i(42062);const l=new o.SessionInfo("Etc/UTC","0000-0000:1234567");function c(e,t){if(!h()||!n.Interval.isDWM(e))return null;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),r=(0,a.newBarBuilder)(e,i,l);return{timeToSessionStart:e=>r.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=s.utc_to_cal(i.timezone,e),r=i.spec.correctTradingDay(t);return s.set_hms(r,0,0,0,0,s.get_timezone("Etc/UTC")),r.getTime()}}}function h(){return!r.enabled("disable_resolution_rebuild")}function d(e,t){if(!h())return e=>e;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),s=(0,a.newBarBuilder)(e,i,i,!1);return e=>s.alignTimeIfPossible(e)}},91789:(e,t,i)=>{"use strict";i.d(t,{SessionInfo:()=>o,BarBuilderBase:()=>a});var s=i(84540),r=i(78486),n=i(12125);class o{constructor(e,t,i,s){this.init(e,t,i,s)}init(e,t,i,r){this.timezone=s.get_timezone(e),this.spec=new n.SessionSpec(e,t,i,r)}}class a{alignTime(e){if(isNaN(e))return NaN;let t=this.indexOfBar(e);return t===r.SessionStage.POST_SESSION&&(this.moveTo(e), t=this.indexOfBar(e)),t<0?NaN:this.startOfBar(t)}}},42062:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SessionInfo:()=>o.SessionInfo,alignExchangeTimeToSessionStartAndReturnUTC:()=>C,alignPeriodsBackForDataRequest:()=>y,alignPeriodsBackForVisibleRange:()=>b,getPeriodsBetweenDates:()=>P,isTradingNow:()=>T,newBarBuilder:()=>S});var s=i(84540),r=i(35001),n=i(57968),o=i(91789),a=i(78486);class l extends o.BarBuilderBase{constructor(e,t){super(),this._sessionStartMs=-Number.MAX_VALUE,this._sessionEndMs=-Number.MAX_VALUE,this._periodSec=e,this._session=t}alignTimeIfPossible(e){const t=this.alignTime(e);return isNaN(t)?e:t}indexOfBar(e){return e=this._sessionEndMs?a.SessionStage.POST_SESSION:(0,n.toInt)(s.time_seconds_diff(e,this._sessionStartMs)/this._periodSec)}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._session.timezone,this._sessionStartMs-1),t=this._session.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._session.timezone,t)}if(e===a.SessionStage.POST_SESSION)return this._sessionEndMs;if(e<0)throw new Error("Negative offset is not supported");return this._sessionStartMs+s.time_seconds(this._periodSec*e)}endOfBar(e){if(e<0)throw new Error("Index cannot be negative");const t=this.startOfBar(e)+1e3*this._periodSec;return t>this._sessionEndMs?this._sessionEndMs:t}isLastBar(e,t){return t>=this._sessionStartMs+s.time_seconds(this._periodSec*(e+1)-1)}moveTo(e){const t=this._session.timezone,i=s.utc_to_cal(t,e),r=this._session.spec.alignToSessionStart(i);this._sessionStartMs=s.cal_to_utc(t,i),s.add_minutes(i,r),this._sessionEndMs=s.cal_to_utc(t,i)}indexOfLastBarInSession(){return(0,n.toInt)((this._sessionEndMs-1-this._sessionStartMs)/1e3/this._periodSec)}moveNext(){this.moveTo(this._sessionEndMs)}}var c=i(24604);function h(e,t){const i=s.clone(t),r=e.businessDaysToCalendarDays(i,1);r>1&&s.add_date(i,r-1);const n=e.leftBorderOfDailyBar(i);if(null===n)throw new Error("Cannot calculate left border of daily bar");return s.cal_to_utc(s.get_timezone(e.timezone()),n)}class d extends o.BarBuilderBase{constructor(e,t,i,s,r=!1){super(),this._periodStart=-Number.MAX_VALUE,this._periodEnd=-Number.MAX_VALUE,this._periodLastBarStart=-Number.MAX_VALUE,this._periodStartDay=new c.BusinessDay(0,0,0),this._periodEndDay=new c.BusinessDay(0,0,0),this._period=i,this._sessionTgt=e,this._builder=s,this._useBusinessDays=r,this._sessionSrc=r?new o.SessionInfo("Etc/UTC","24x7"):t||e}builder(){return this._builder}alignTimeIfPossible(e){return this.tradingDayToSessionStart(e)}tradingDayToSessionStart(e){return this.moveTo(e),this.startOfBar(0)}indexOfBar(e){if(this._useBusinessDays){const t=c.BusinessDay.fromCalendar(s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e));return t.before(this._periodStartDay)?a.SessionStage.PRE_SESSION:this._periodEndDay.before(t)?a.SessionStage.POST_SESSION:0}return e=this._periodEnd?a.SessionStage.POST_SESSION:0}startOfBar(e){ if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._sessionTgt.timezone,this._periodStart-1),t=this._sessionTgt.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._sessionTgt.timezone,t)-1}return e===a.SessionStage.POST_SESSION||e>0?this._periodEnd:e===a.SessionStage.LASTBAR_SESSION?this._periodLastBarStart:this._periodStart}moveTo(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e);this._sessionSrc.spec.correctTradingDay(t);const i=s.get_year(t),r=this._indexOfPeriodInYear(t),n=r+this._period,o=this._sessionTgt.spec,a=this._sessionTgt.timezone,l=this._builder.startOfPeriod(a,r,i);this._periodStart=h(o,l);const d=s.clone(l),u=o.businessDaysToCalendarDays(d,1);u>1&&s.add_date(d,u-1),this._periodStartDay=c.BusinessDay.fromCalendar(d);const p=this._builder.startOfPeriod(a,n,i);this._periodEnd=h(o,p);const _=s.clone(p);for(s.add_date(_,-1);o.isCalWeekEnd(_);)s.add_date(_,-1);this._periodEndDay=c.BusinessDay.fromCalendar(_),s.add_date(p,-1),function(e,t){for(;e.isCalWeekEnd(t);)s.add_date(t,-1)}(this._sessionTgt.spec,p),this._periodLastBarStart=h(o,p),(this._periodLastBarStart=this._periodLastBarStart}currentRange(){return{from:this._periodStartDay,to:this._periodEndDay}}indexOfBarInYear(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e),i=s.get_year(t),r=this._builder.indexOfPeriod(t),o=this._sessionTgt.timezone;let a=this._builder.startOfPeriod(o,r,i),l=h(this._sessionTgt.spec,a);return a=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),l),i=0&&(r-=7),(0,n.toInt)((r+i)/7))}class _{indexOfPeriod(e){return s.get_day_of_year(e)-1}startOfPeriod(e,t,i){const r=s.days_per_year(i);return s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1+Math.min(t,r))}}class m extends _{constructor(e){super(),this._sessionsSpec=e}indexOfPeriod(e){return super.indexOfPeriod(e)-function(e,t){const i=p(e,t),r=s.get_cal(s.get_timezone("Etc/UTC"),s.get_year(t),s.JANUARY,1);s.add_date(r,7*i);const n=i*e.weekEndsCount()+e.holidaysFromYearStart(r),o=s.get_day_of_year(t)-s.get_day_of_year(r);return n+o-e.calendarDaysToBusinessDays(r,o)}(this._sessionsSpec,e)}startOfPeriod(e,t,i){const r=7-this._sessionsSpec.weekEndsCount(),o=Math.max(0,(0, n.toInt)(t/r)-1),a=s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1),l=s.get_days_per_year(a);if(s.add_date(a,7*o),(t-=r*o-this._sessionsSpec.holidaysFromYearStart(a))>0){const e=this._sessionsSpec.businessDaysToCalendarDays(a,t);s.add_date(a,e)}let c=s.get_day_of_year(a)-1;return is.get_days_per_year(r)?this.startOfPeriod(e,0,i+1):(s.add_date(r,a),r)}}class v{indexOfPeriod(e){return s.get_month(e)}startOfPeriod(e,t,i){if(t<0){const e=(0,n.toInt)((11-t)/12);i-=e,t+=12*e}else t>s.DECEMBER&&(i++,t=s.JANUARY);return s.get_cal(s.get_timezone("Etc/UTC"),i,t,1)}}function S(e,t,i,s=!1){const n=r.Interval.parse(e),o=n.multiplier();return n.isMinutes()?new l(60*o,t):n.isSeconds()?new l(o,t):n.isTicks()?new l(1,t):n.isRange()?new l(60*o,t):new d(t,i,o,function(e,t){switch(e){case r.ResolutionKind.Days:return new g(t);case r.ResolutionKind.Weeks:return new f(t);case r.ResolutionKind.Months:return new v}throw new Error("Unknown dwm resolution: "+e)}(n.kind(),t),s)}function y(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,0)}function b(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,1)}function w(e,t,i,s,n,a,l,c){const h=r.Interval.parse(n+s);if(h.isMonths()){const e=new Date(l);return 0===c&&e.setUTCDate(1),function(e,t){x(e,Math.floor(t/12));let i=e.getUTCMonth()-t%12;i<0&&(x(e,1),i+=12);e.setUTCMonth(i);for(;e.getUTCMonth()!==i;)I(e,1)}(e,a*h.multiplier()),e.getTime()}const d=new o.SessionInfo("Etc/UTC",e,t,i),u=h.inMilliseconds(),p=h.isDWM();let _;_=p?864e5:60*d.spec.maxTradingDayLength()*1e3;let m=0;m=h.isWeeks()?7:7-d.spec.weekEndsCount();const g=_/u,f=m*g;let v;if(a=g&&(f=_/6048e5*g),Math.ceil(f)} function C(e,t){const i=s.clone(t);return e.alignToSessionStart(i),s.cal_to_utc(s.get_timezone(e.timezone()),i)}function T(e,t){const i=s.utc_to_cal(t.timezone,+e);let r=s.get_day_of_week(i),n=s.get_minutes_from_midnight(i);const o=t.spec.findSession(t.spec.getWeekIndex(i),r,n).getEntry();return o.isOvernight()&&n>o.startOffset()+o.length()&&r===o.dayOfWeek()-1&&(r++,n-=1440),r===o.dayOfWeek()&&n>=o.startOffset()&&n{"use strict";i.d(t,{BusinessDay:()=>r});var s=i(84540);class r{constructor(e,t,i){this.year=e,this.month=t,this.day=i}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(e){return this.year>e.year||this.year===e.year&&this.month>e.month||this.year===e.year&&this.month===e.month&&this.day>e.day?1:this.year===e.year&&this.month===e.month&&this.day===e.day?0:-1}before(e){return-1===this.compareTo(e)}toCalendar(e){return s.get_cal(s.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const t=this.toCalendar(s.get_timezone("Etc/UTC"));return s.add_date(t,e),r.fromCalendar(t)}static fromCalendar(e){return new r(s.get_year(e),s.get_month(e)+1,s.get_day_of_month(e))}}},78486:(e,t,i)=>{"use strict";var s;i.d(t,{SessionStage:()=>s}),function(e){e[e.PRE_SESSION=-1]="PRE_SESSION",e[e.POST_SESSION=-2]="POST_SESSION",e[e.LASTBAR_SESSION=-3]="LASTBAR_SESSION"}(s||(s={}))},25853:(e,t,i)=>{"use strict";i.d(t,{extrapolateBarsFrontToTime:()=>r,extrapolateBarsFrontByCount:()=>n});var s=i(78486);function r(e,t,i,s,n=!1){if(t>i){const o=r(e,i,t,s,n);return o.count=-o.count,o}return o(e,t,1,(e,t)=>t>i||0!==s&&e>s,n)}function n(e,t,i,s=!1){const r=i<0?-1:1;return o(e,t,r,(e,t)=>e>=i*r,s)}function o(e,t,i,r,n){let o=0,a=t;e.moveTo(a);let l=0,c=Number.MAX_VALUE,h=!1,d=t;const u=[];for(;!r(o,a);){if(l>15)throw new Error("Internal error 0x10 while extrapolating.");const r=e.indexOfBar(a);if(r===s.SessionStage.PRE_SESSION&&1===i)a=e.startOfBar(0),e.moveTo(a);else if(r===s.SessionStage.PRE_SESSION&&-1===i)a=e.startOfBar(s.SessionStage.PRE_SESSION),e.moveTo(a);else if(r===s.SessionStage.POST_SESSION&&1===i)a=e.startOfBar(s.SessionStage.POST_SESSION),e.moveTo(a);else{if(r===s.SessionStage.POST_SESSION&&-1===i)throw new Error("Internal error 0x12 while extrapolating.");{const p=e.startOfBar(r);if(p>t&&i>0||t>p&&i<0){if(h&&c===p)throw new Error("Internal error 0x11 while extrapolating.");h=!0,c=p,l=0,o++,d=p,n&&u.push(d)}if(0===r&&-1===i)a=p-1;else{a=e.startOfBar(r+i);const t=e.startOfBar(s.SessionStage.POST_SESSION);a>t&&(e.moveTo(t),a=e.startOfBar(0))}}}l++}return{time:d,times:u,count:o}}},12125:(e,t,i)=>{"use strict";i.d(t,{SessionSpec:()=>f});var s=i(84540),r=i(49382),n=i(24604);function o(e,t){return e.compareTo(t)}class a{constructor(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}start(){return this._start+s.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start} sessionStartDaysOffset(){return this._start>=0?0:this._start%s.minutesPerDay==0?-Math.ceil(this._start/s.minutesPerDay):-Math.floor(this._start/s.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%s.minutesPerDay==0?-Math.ceil(e/s.minutesPerDay):-Math.floor(e/s.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return es.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*s.minutesPerDay+this._start}compareTo(e){const t=this.weight(),i=t+this._length,s=e.weight(),r=s+e._length;return t<=s&&ss?1:-1}contains(e){const t=60*s.get_hours(e)+s.get_minutes(e);let i=s.get_day_of_week(e)-this._dayOfWeek;i>0&&(i-=7);const r=i*s.minutesPerDay+t;return r>=this._start&&r=48&&e<=57}class _{constructor(){this.entries=[],this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(e,t){var i;let s=!1;this._clear(),this.timezone=e;const{hasErrors:r,spec:n}=this._parseFirstDayOfWeek(t);if("24x7"===n.toLowerCase())for(const e of d)this.entries.push(_._createSessionEntry(e,0,0,0,0));else{let e=!1;const t=new Map;for(const i of n.split("|")){const r=i.split(":");if(1!==r.length&&2!==r.length){s=!0,u.logError("Bad session section: "+i);continue}const n=1===r.length;if(n){if(e){s=!0,u.logError("Duplicated default section: "+i);continue}e=!0}const o=n?h:_._parseWorkingDays(r[1]);for(const e of o)n&&t.has(e)||t.set(e,r[0])}for(const e of d){const i=t.get(e);if(void 0!==i)for(const t of i.split(",")){const{hasErrors:i,sessionEntry:r}=_._parseSessionEntry(e,t);i&&(s=i),this.entries.push(r)}}}this.entries.sort(o);const a=new Map;for(const e of this.entries){const t=e.dayOfWeek();a.set(t,e.length()+(null!==(i=a.get(t))&&void 0!==i?i:0))}return this.maxTradingDayLength=0,a.forEach(e=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,e)}),this.weekEndsCount=7-a.size,s||r}static parseHolidaysAndCorrections(e,t,i){const r=new Map,n=new Map,o=e=>{const t=this._parseDay(e),i=t.toString(),s=n.get(i);return void 0!==s?s:(n.set(i,t),t)};if(""!==t){const e=[];for(const i of t.split(",")){if(8!==i.length)throw new Error("bad holiday date: "+i);const t=o(i);r.set(t,e)}}if(""===i)return r;const l=s.get_timezone("Etc/UTC");for(const e of i.split(";")){const t=e.split(":");if(2!==t.length)throw new Error("bad correction section: "+e);const i=[];if("dayoff"!==t[0])for(const e of t[0].split(","))i.push(this._parseSessionEntry(1,e).sessionEntry) ;for(const e of t[1].split(",")){if(8!==e.length)throw new Error("bad correction date: "+e);const t=o(e),n=s.get_day_of_week(s.get_cal(l,t.year,t.month-1,t.day)),c=[];for(const e of i)c.push(new a(n,e.startOffset(),e.length()));r.set(t,c)}}return r}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const t=e.split(";");if(t.length>2)return u.logError("Only one `first day` specification expected @ session "+e),{hasErrors:!0,spec:e};if(1===t.length)return{hasErrors:!1,spec:e};let i=1;let r=t[0].indexOf("-")>=0?NaN:parseInt(t[0]);return isNaN(r)&&(i=0,r=parseInt(t[1])),rs.SATURDAY?(u.logError(`Unexpected day index @ session: ${e}; day index ${r}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=r,{hasErrors:!1,spec:t[i]})}static _parseDay(e){const t=parseInt(e.substring(0,4)),i=parseInt(e.substring(4,6)),s=parseInt(e.substring(6,8));return new n.BusinessDay(t,i,s)}static _parseSessionEntry(e,t){let i=!1,s=t.split("-");2!==s.length&&(i=!0,u.logError("Bad sessions entry: "+t),s=["0000","0000"]);let r=0,n=s[0];if(n.includes("F")){const e=n.split("F");n=e[0],r=""!==e[1]?parseInt(e[1]):1}let o=0,a=s[1];if(a.includes("F")){const e=a.split("F");a=e[0],o=""!==e[1]?parseInt(e[1]):1}if(!this._isCorrectSession(n)||!this._isCorrectSession(a))throw new Error("Incorrect entry syntax: "+t);const l=n,c=a;return{hasErrors:i,sessionEntry:this._createSessionEntry(e,_._minutesFromHHMM(l),_._minutesFromHHMM(c),r,o)}}static _isCorrectSession(e){return 4===e.length&&p(e.charCodeAt(0))&&p(e.charCodeAt(1))&&p(e.charCodeAt(2))&&p(e.charCodeAt(3))}static _parseWorkingDays(e){const t=[];for(let i=0;i0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);return new a(e,t,i-t)}}function m(e,t){return e.compareTo(t)<0}function g(e,t){const i=(0,r.lowerbound)(e,t,(e,t)=>-1===e.day.compareTo(t));return i===e.length?null:e[i]}class f{constructor(e="Etc/UTC",t="0000-0000",i="",r=""){this._entries=[],this._firstDayOfWeek=s.MONDAY,this._entriesHash=new Map,this._holidayAndCorrectionMap=new Map,this._holidaySessions=[];const n=new _;n.parseSessions(e,t),this._entries=n.entries,this._timezone=n.timezone,this._spec=t,this._firstDayOfWeek=n.firstDayOfWeek,this._weekEndsCount=n.weekEndsCount,this._maxTradingDayLength=n.maxTradingDayLength;const o=_.parseHolidaysAndCorrections(e,i,r),a=s.get_timezone(e);this._isThereCorrections=""!==i||""!==r,o.forEach((e,t)=>{this._holidayAndCorrectionMap.set(t.toString(),e),this._holidaySessions.push({day:t,sessions:e});const i=this.getWeekIndex(t.toCalendar(a));this._entriesHash.set(i,null)}),this._holidaySessions.sort((e,t)=>e.day.compareTo(t.day))}entries(){return this._entries}timezone(){return this._timezone}spec(){return this._spec}firstDayOfWeek(){return this._firstDayOfWeek}addSessionEntry(e,t,i,r,n){0===i&&(i=s.minutesPerDay), r===n&&i<=t&&(r+=1),r>0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);const o=i-t;this._entries.push(new a(e,t,o))}longestSessionLength(){let e=0,t=0;for(const t of this._holidaySessions)t.sessions.forEach(t=>{e=Math.max(e,t.length())});return this._entries.forEach(e=>{t=Math.max(t,e.length())}),Math.max(e,t)}isWeekEnd(e){const t=(0,r.lowerbound)(this._entries,new a(e,0,0),(e,t)=>e.dayOfWeek()this._entries.length-1||this._entries[t].dayOfWeek()!==e}isCalWeekEnd(e){const t=s.get_day_of_week(e);if(!this._isThereCorrections)return this.isWeekEnd(t);const i=n.BusinessDay.fromCalendar(e),r=this._holidayAndCorrectionMap.get(i.toString());return void 0===r?this.isWeekEnd(t):0===r.length}hasWeekEnds(){return this.weekEndsCount()>0}weekEndsCount(){return this._weekEndsCount}maxTradingDayLength(){return this._maxTradingDayLength}holidaysFromYearStart(e){if(!this._isThereCorrections)return 0;const t=s.get_timezone(this._timezone),i=new n.BusinessDay(s.get_year(e),s.JANUARY,1),r=n.BusinessDay.fromCalendar(e);let o=0;const a=this._selectHolidays(i,r);for(let e=0;et.start()%e==0&&t.length()%e==0)}indexOfSession(e,t,i){const n=this._getEntriesForWeek(e);let o=(0,r.lowerbound)(n,new a(t,i,0),m);if(o!==n.length)return new l(e,o,n);let c=e;const h=7-t+this._firstDayOfWeek-1;for(i=-(s.minutesPerDay-i+h*s.minutesPerDay);;){c++;const e=this._getEntriesForWeek(c);if(0!==e.length)return o=(0,r.lowerbound)(e,new a(this._firstDayOfWeek,i,0),m),new l(c,o,e)}}findSession(e,t,i,s=0){const r=this.indexOfSession(e,t,i),n=r.entries;let o=r.entryIndex;if(0!==s){const e=n[o].dayOfWeek(),t=s>0?1:-1;for(;;){const i=o+t;if(i<0||i>=n.length||n[i].dayOfWeek()!==e)break;o=i}}return new l(r.weekIndex,o,n)}getWeekIndex(e){if(!this._isThereCorrections)return 0;const t=s.get_day_of_week(e)-s.SUNDAY,i=s.get_timezone("Etc/UTC"),r=s.get_cal(i,s.get_year(e),s.get_month(e),s.get_day_of_month(e)-t);return Math.floor((r.getTime()+621672192e5)/1e3/86400/7)}correctTradingDay(e){const t=s.get_day_of_week(e),i=60*s.get_hours(e)+s.get_minutes(e),r=this.getWeekIndex(e),n=this.findSession(r,t,i,0),o=n.getEntry().dayOfWeek()-t+7*(n.weekIndex-r);return 0!==o&&s.add_date(e,o),e}alignToSessionStart(e,t=0){const i=s.get_day_of_week(e),r=60*s.get_hours(e)+s.get_minutes(e),n=this.getWeekIndex(e),o=this.findSession(n,i,r,t),a=o.getEntry(),l=a.dayOfWeek()-i+7*(o.weekIndex-n);0!==l&&s.add_date(e,l);const c=a.startOffset();return s.set_hms(e,c/60,c%60,0,0,s.get_timezone(this._timezone)),a.length()}businessDaysToCalendarDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;oi);)e[a].dayOfWeek()=t)return n}i++,r=s.SUNDAY}return n}calendarDaysToBusinessDays(e,t){ let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;ni);)e[a].dayOfWeek()=t)return o}i++,r=s.SUNDAY}return o}alignToNearestSessionStart(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionStart.bind(this))}alignToNearestSessionEnd(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionEnd.bind(this))}leftBorderOfDailyBar(e){const t=this._getEntriesForDay(e);return 0===t.length?null:(t.sort(o),this._getLeftEntryBorder(e,t[0]))}bordersOfDailyBar(e){const t=this._getEntriesForDay(e);if(0===t.length)return null;t.sort(o);const i=this._getLeftEntryBorder(e,t[0]),r=t[t.length-1],n=s.clone(e);let a=60*(r.startOffset()+r.length())-1;const l=Math.floor(a/3600);return a-=3600*l,s.set_hms(n,l,a/60,a%60,0,s.get_timezone(this._timezone)),{from:i,to:n}}getEntriesForWeekByCalendar(e){const t=this.getWeekIndex(e);return this._getEntriesForWeek(t)}_getEntriesForWeek(e){let t=this._entriesHash.get(e);if(void 0===t)return this._entries;if(null!==t)return t;const i=s.get_timezone(this._timezone);t=this._entries.slice();const r=this._weekIndexToCalendar(e),a=this._weekIndexToCalendar(e+1),l=n.BusinessDay.fromCalendar(r),c=n.BusinessDay.fromCalendar(a),h=this._selectHolidays(l,c);for(const e of h){const r=e.day.toCalendar(i),n=s.get_day_of_week(r);t=t.filter(e=>e.dayOfWeek()!==n),t=t.concat(e.sessions)}return t.sort(o),this._entriesHash.set(e,t),t}_selectHolidays(e,t){const i=[];let s=e;for(;;){const e=g(this._holidaySessions,s);if(null===e)return i;if(!e.day.before(t))return i;i.push(e),s=e.day.addDays(1)}}_weekIndexToCalendar(e){const t=1e3*(86400*e*7+86400)-621672192e5,i=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),t),r=s.get_timezone("Etc/UTC");return s.get_cal(r,s.get_year(i),s.get_month(i),s.get_day_of_month(i))}_alignToNearestSessionValue(e,t,i){const r=s.get_day_of_week(e),n=60*s.get_hours(e)+s.get_minutes(e),o=this.getWeekIndex(e);let a=this.findSession(o,r,n);if(a.getEntry().contains(e)&&o===a.weekIndex||1===t)return i(a,s.clone(e),t);let c=a.entryIndex-1;if(c<0){let e=a.weekIndex,t=a.entries;for(;c<0;)e--,t=this._getEntriesForWeek(e),c+=t.length;a=new l(e,c,t)}else a=new l(a.weekIndex,c,a.entries);return i(a,s.clone(e),t)}_entrySessionStart(e,t,i){return this._entrySessionValue(e,t,i,e=>60*e.start())}_entrySessionEnd(e,t,i){return this._entrySessionValue(e,t,i,e=>60*(e.start()+e.length())-1)}_entrySessionValue(e,t,i,r){let n=s.get_day_of_week(t);const o=e.getEntry();let a=o.dayOfWeek()-o.sessionStartDaysOffset();const l=this.getWeekIndex(t);let c=e.weekIndex-l,h=!1;if(a0&&i>=0||c<0&&i<0)&&s.add_date(t,7*c),!o.contains(t)){let e=a-n;h&&i<0&&(e=-(7-a+n)),s.add_date(t,e),n=s.get_day_of_week(t)}o.isOvernight()&&n===o.dayOfWeek()&&s.add_date(t,-o.sessionStartDaysOffset());let d=r(o);const u=Math.floor(d/3600);return d-=3600*u,s.set_hms(t,u,d/60,d%60,0,s.get_timezone(this._timezone)),t} _getEntriesForDay(e){const t=s.get_day_of_week(e);return this._getEntriesForWeek(this.getWeekIndex(e)).filter(e=>e.dayOfWeek()===t)}_getLeftEntryBorder(e,t){const i=s.clone(e),r=t.startOffset();return s.set_hms(i,r/60,r%60,0,0,s.get_timezone(this._timezone)),i}}},23248:(e,t,i)=>{"use strict";i.d(t,{UserDefinedBarsMarks:()=>d});var s=i(15521),r=i(43492),n=i(16282);function o(e,t,i){return new Promise(s=>{i&&e.classList.remove(i),e.classList.add(t);const r=i=>{i.target===e&&i.animationName===t&&(e.removeEventListener(i.type,r),s(i))};e.addEventListener("animationend",r,!1),e.addEventListener("webkitAnimationEnd",r,!1),e.addEventListener("MSAnimationEnd",r,!1)})}function a(e){return o(e,"tv-transition--fade-in","tv-transition--fade-out")}class l extends class{constructor(){this._source=null,this._tooltipHovered=!1,this._layout=null,this._container=null,this._context=null,this._plateArrowSize=14,this._handleTouchMouseLeave=e=>{(0,n.ensureNotNull)(this._layout).contains(e.target)||this._clearHovered()},this._setHovered=()=>{this._tooltipHovered=!0,document.addEventListener("touchstart",this._handleTouchMouseLeave),a((0,n.ensureNotNull)(this._layout))},this._clearHovered=()=>{var e;this._tooltipHovered=!1,document.removeEventListener("touchstart",this._handleTouchMouseLeave),null===(e=this._source)||void 0===e||e.onNeedRepaint.fire()}}showPlate(e,t){if(this._currentId!==e.id||!this._layout||null===this._layout.parentNode){this._currentId=e.id,this._createLayout();const i=(0,n.ensureNotNull)(this._layout);this._getContainer(t).appendChild(i),i.addEventListener("mouseenter",this._setHovered),i.addEventListener("mouseleave",this._clearHovered)}const i=(0,n.ensureNotNull)(this._layout);let s=Math.round(e.barWidth/2);s>15&&(s=15),s<10&&(s=10),this._updatePlate(e);const r=t.canvas.getBoundingClientRect(),o=e.x-i.offsetWidth{t.remove(),e()})}setSource(e){this._source=e}removeLayout(){var e;this._tooltipHovered||null===(e=this._layout)||void 0===e||e.remove()}toggleLayout(e){(0,n.ensureNotNull)(this._layout).style.visibility=e?"visible":"hidden"}_getContainer(e){return this._container&&this._context===e||(this._context=e,this._container=e.canvas.parentElement),(0,n.ensureNotNull)(this._container)}}{constructor(){super(...arguments),this._layoutText=null}_createLayout(){this._layout=document.createElement("div"),this._layout.classList.add("bar-mark-tooltip"),this._layoutText=document.createElement("div"),this._layoutText.classList.add("text"),this._layout.appendChild(this._layoutText)}_updatePlate(e){this._currentId=e.id;const t=(0,n.ensureNotNull)(this._layout) ;t.style.borderColor=e.theme.border,t.style.marginTop=e.tooltipMargin+"px";const i=(0,n.ensureNotNull)(this._layoutText);i.innerHTML=e.text,t.appendChild(i)}}class c{constructor(e,t){this._tooltips={},this._hoveredId=null,this._tooltipFactory=e,this.source=t}showPlate(e,t){const i=this._findOrCreateTooltip(e);null!==i&&(i.drawPlate(e,t),i.plateData=e)}draw(e,t){this._hoveredId=null;for(const t of e)t.hovered&&(this._hoveredId=t.id);for(const i of e)this.showPlate(i,t)}endDraw(){var e,t;for(const i in this._tooltips)if(this._tooltips.hasOwnProperty(i)){const s=(0,n.ensureDefined)(this._tooltips[i]);s.toggleVisibility(),this._hoveredId&&(null===(e=s.plateData)||void 0===e?void 0:e.id)!==this._hoveredId&&!(null===(t=s.plateData)||void 0===t?void 0:t.pinned)&&(s.remove(),delete this._tooltips[i])}}removeAll(){for(const e in this._tooltips)if(this._tooltips.hasOwnProperty(e)){(0,n.ensureDefined)(this._tooltips[e]).remove()}this._tooltips={}}removeTooltip(e){delete this._tooltips[e]}_createTooltip(){return new h(this,this._tooltipFactory())}_findOrCreateTooltip(e){let t=this._tooltips[e.id];return void 0===t&&(e.hovered||e.pinned)&&(t=this._createTooltip(),this._tooltips[e.id]=t),t||null}}class h{constructor(e,t){this._visible=!1,this._renderer=e,this._tooltip=t}drawPlate(e,t){this._visible=!0,this._tooltip.setSource(this._renderer.source),this._tooltip.showPlate(e,t),e.hovered||e.pinned||this._tooltip.hide(()=>this._renderer.removeTooltip(e.id))}remove(){this._tooltip.removeLayout()}toggleVisibility(){this._tooltip.toggleLayout(this._visible),this._visible=!1}}class d extends r.BarsMarksContainer{constructor(e){super(e),this.toolname="UserDefinedBarsMarks",(0,s.hideMarksOnBars)().subscribe(this,()=>{this.properties().childs().visible.setValue(!(0,s.hideMarksOnBars)().value())})}destroy(){(0,s.hideMarksOnBars)().unsubscribeAll(this),super.destroy()}userEditEnabled(){return!1}onClicked(e){var t,i,s;const r=null===(t=null==e?void 0:e.activeItem)||void 0===t?void 0:t.id;null===(s=(i=this._marks[r]).onClicked)||void 0===s||s.call(i)}clearMarks(){super.clearMarks(),this.onNeedRepaint.fire()}updatePlateData(e,t){return{...t,barWidth:this.barWidth(),text:e.text,tooltipMargin:-1*Math.max(e.minSize/2,.4*this.barWidth())}}hasContextMenu(){return!1}calcIsActualCurrency(){this._isActualCurrency=!0}calcIsActualUnit(){this._isActualUnit=!0}_initialize(){this.properties().childs().visible.setValue(!0)}_plateViewData(e){const t={text:e.text};return"object"==typeof e.color&&(t.theme="user_defined_theme",t.overridedTheme={},t.overridedTheme.border=e.color.border,t.overridedTheme.background=e.color.background),t}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return;const i=this.roundRange(this._rangeDifference(e)),s=this._model.mainSeries().properties().childs().interval.value();window.ChartApiInstance.getMarks(t,i.start,i.end,t=>{for(const e of t)this._marks[e.id]=e;this._loadedRange=this._rangeUnion(e,this._loadedRange),this.onNeedRepaint.fire()},s)}_createTooltipRenderer(){return new c(()=>new l,this)}}},1608:(e,t,i)=>{ "use strict";i.d(t,{UserDefinedTimescaleMarks:()=>E});var s=i(16282),r=i(18437),n=i(43492),o=i(15521),a=i(72927),l=i(47903),c=i(87088),h=i(92137),d=i(16932),u=i(69819),p=i(71044),_=i(5025),m=i(33420),g=i(55430),f=i(21344);class v{constructor(e,t,i){this._data=e,this._hittest=t,this._textWidthCache=i}draw(e,t){const i=t.pixelRatio,s=this._data.centerPoint,r=Math.round(s.x*i),n=Math.round(s.y*i),o=Math.max(1,Math.floor(i))%2/2,l=new a.Point(r+o,n-o);this._drawLollipop(e,l,t),this._drawLabel(e,l,t.pixelRatio)}hitTest(e,t){const i=(0,f.interactionTolerance)().esd,s=this._data.centerPoint.y-this._data.style.lollipop.height/2-i,r=this._data.centerPoint.x-this._data.style.lollipop.width/2-i,n=(0,a.box)(new a.Point(r,s),new a.Point(r+this._data.style.lollipop.width+2*i,s+this._data.style.lollipop.height+2*i));return(0,p.pointInBox)(e,n)?this._hittest:null}_drawLollipop(e,t,i){const s=this._data.style,r=i.pixelRatio,n=Math.max(1,Math.floor(r));let o=Math.round(s.lollipop.width*r);o%2!=n%2&&(o+=1);const a=o/2;s.lollipop.fillCircle&&s.lollipop.backgroundColor&&(e.fillStyle=s.lollipop.backgroundColor,(0,g.createCircle)(e,t.x,t.y,a),e.fill());const l=Math.round(s.lollipop.lineWidth*r);e.strokeStyle=s.lollipop.strokeStyle,e.lineWidth=l,(0,_.setLineStyle)(e,m.LINESTYLE_SOLID);const c=a-Math.round(1*r+l/2);(0,g.createCircle)(e,t.x,t.y,c),s.lollipop.fillCircle&&s.lollipop.fillStyle&&(e.fillStyle=s.lollipop.fillStyle,e.fill()),e.stroke()}_drawLabel(e,t,i){const s=this._data.style.lollipop.text,r=s.label;e.textAlign="center",e.textBaseline="middle",e.fillStyle=s.strokeStyle,e.font=s.font;const n=this._textWidthCache.yMidCorrection(e,r);e.translate(t.x,t.y+((s.deltaY||0)+n)*i),(0,d.drawScaled)(e,i,()=>{e.fillText(r,0,0)})}}var S=i(10288);var y=i(50968),b=i(73395),w=i(54837);const P={fillPath:new Path2D("M8.961.92a3 3 0 0 1 3.078 0l7.5 4.48A3 3 0 0 1 21 7.975V20a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V7.975A3 3 0 0 1 1.461 5.4l7.5-4.48z"),strokePath:new Path2D("M9.867 2.742c.39-.23.875-.23 1.266 0l7.5 4.406c.382.225.617.635.617 1.078V20c0 .69-.56 1.25-1.25 1.25H3c-.69 0-1.25-.56-1.25-1.25V8.226c0-.443.235-.853.617-1.078l7.5-4.406z")},C={fillPath:new Path2D("M8.961 22.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 15.025V3a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 17.6l7.5 4.48z"),strokePath:new Path2D("M9.866 20.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V3c0-.69-.56-1.25-1.25-1.25H3c-.69 0-1.25.56-1.25 1.25v11.765c0 .443.234.853.616 1.078l7.5 4.414z")},T={fillPath:new Path2D("M3 0h15c1.662 0 3 1.338 3 3v15c0 1.662-1.338 3-3 3H3c-1.662 0-3-1.338-3-3V3c0-1.662 1.338-3 3-3z"),strokePath:new Path2D("M3 1.75h15c.693 0 1.25.557 1.25 1.25v15c0 .693-.557 1.25-1.25 1.25H3c-.692 0-1.25-.558-1.25-1.25V3c0-.692.558-1.25 1.25-1.25z")};function x(e,t,i,s,r){const n=i.pixelRatio;e.save(),e.translate(t.x-s.lollipop.width*n/2,t.y-s.lollipop.height*n/2),e.scale(n,n),s.lollipop.fillCircle&&s.lollipop.backgroundColor&&(e.fillStyle=s.lollipop.backgroundColor,e.fill(r.fillPath)),e.strokeStyle=s.lollipop.strokeStyle, e.lineWidth=Math.round(s.lollipop.lineWidth*n)/n,(0,_.setLineStyle)(e,m.LINESTYLE_SOLID),s.lollipop.fillCircle&&s.lollipop.fillStyle&&(e.fillStyle=s.lollipop.fillStyle,e.fill(r.strokePath)),e.stroke(r.strokePath),e.restore()}function I(e,t,i,s){x(e,t,i,s,P)}function M(e,t,i,s){x(e,t,i,s,C)}function L(e,t,i,s){x(e,t,i,s,T)}class A extends v{_drawLollipop(e,t,i){const s=this._data.style;switch(s.shape){case"earningUp":I(e,t,i,s);break;case"earningDown":M(e,t,i,s);break;case"earning":L(e,t,i,s);break;default:super._drawLollipop(e,t,i)}}}class k extends class{constructor(e,t,i){this._invalidated=!1,this._renderer=new c.CompositeRenderer,this._textWidthCache=new h.TextWidthCache,this._stylesCache=null,this._lollipops={},this._lollipopsCounter=0,this._lastClickedId=null,this.onPaneBgChange=()=>{this._recreateStyles(this._model)},this._lastClickedId=null,this._model=e,this._source=t,this._hitTestHandler=i,this._recreateStyles(e),e.backgroundColor().subscribe(this.onPaneBgChange),e.mainSeries().onSymbolIntervalChanged().subscribe(this,this._onSymbolOrIntervalChanged)}destroy(){this._model.backgroundColor().unsubscribe(this.onPaneBgChange),this._model.mainSeries().onSymbolIntervalChanged().unsubscribeAll(this)}onClickOutside(e){var t;if(null===this._lastClickedId||!e)return void this.clearLastClicked();let i=null;if(function(e){return void 0!==e.touches}(e)){if(1!==e.touches.length)return;{const t=(0,s.ensureNotNull)(e.target).getBoundingClientRect(),r=e.touches[0];i=new a.Point(r.clientX-t.left,r.clientY-t.top)}}else i=new a.Point(e.offsetX,e.offsetY);const r=this._renderer.hitTest(i,{physicalHeight:0,physicalWidth:0,pixelRatio:1,cssHeight:0,cssWidth:0});null!==r&&(null===(t=r.data())||void 0===t?void 0:t.activeItem)===(0,s.ensureDefined)(this._lollipops[this._lastClickedId]).itemIndex||this.clearLastClicked()}clearLastClicked(){const e=null!==this._lastClickedId&&this._lollipops[this._lastClickedId]||null;null!==e&&(e.active=!1),this._lastClickedId=null}getLastClickedLollipopId(){return this._lastClickedId}update(){this._invalidated=!0}afterUpdate(e,t,i,s){}showBarLine(){return!0}getStyle(e){const t=e.active?"active":e.hovered?"hovered":"default";let i=t;if(e.stack&&(i+="_stack:"+e.stack),"active"===i)return this.activeStyle;if("hovered"===i)return this.hoveredStyle;if("default"===i)return this.defaultStyle;if(this._stylesCache||(this._stylesCache={}),!this._stylesCache[i]){const s=(0,l.clone)("active"===t?this.activeStyle:"hovered"===t?this.hoveredStyle:this.defaultStyle);e.stack&&(s.lollipop.incHeight=25*e.stack),this._stylesCache[i]=s}return this._stylesCache[i]}hasTooltip(e){return!0}_getY(){let e=0;const t=this._model.panes();for(let i=t.length;i--;){const s=t[i];s.containsMainSeries()&&(e+=s.height())}return e}_createRenderers(e,t){this._renderer.clear();const i=new d.Size(e,t);for(const e in this._lollipops)if(this._lollipops.hasOwnProperty(e)){const t=(0,s.ensureDefined)(this._lollipops[e]);if(t.visible){const e=this.getStyle(t),s={id:t.id, centerPoint:new a.Point(t.basePoint.x,t.basePoint.y-e.lollipop.bottom-e.lollipop.height/2-(e.lollipop.incHeight||0)),style:e},r={activeItem:t.itemIndex,clickHandler:this._lollipopMouseClickHandler.bind(this,s,i),tapHandler:this._lollipopMouseClickHandler.bind(this,s,i)};if(this._renderer.append(this._createRendererForLollipop(s,r)),(t.hovered||t.active)&&this.hasTooltip(t)&&t.barY&&this.showBarLine()){const i={color:e.barLine.strokeStyle,linestyle:e.barLine.lineStyle,linewidth:e.barLine.lineWidth,x:t.basePoint.x,top:0,bottom:t.basePoint.y-e.lollipop.bottom-e.lollipop.height},s=new u.VerticalLineRenderer;s.setData(i),this._renderer.insert(s,0)}}}}_recreateStyles(e){this._stylesCache=null}_createRendererForLollipop(e,t){return new v(e,new S.HitTestResult(S.HitTestResult.CUSTOM,t),this._textWidthCache)}_lollipopMouseClickHandler(e,t,i){i.preventDefault();const r=e.id;if(this._lastClickedId=this._lastClickedId===r?null:r,null===this._lastClickedId)return;const n={target:i.target,targetSize:t,point:new a.Point(e.centerPoint.x,e.centerPoint.y-e.style.lollipop.height/2-8),marginTop:15};this._hitTestHandler(n,()=>{const e=(0,s.ensureDefined)(this._lollipops[r]),t=this.createTooltipContent(e);return t?[t]:null})}_onSymbolOrIntervalChanged(){this._lollipops={},this._lollipopsCounter=0,this._renderer.clear(),this.clearLastClicked()}}{constructor(e,t,i){super(e,t,i),this.stylesCache={},this.templatesCache={},this._itemIndexToId=new Map,this.source=t}createTooltipContent(e){return e.items?{title:e.items[0],subTitle:e.items[1],style:{color:e.color}}:null}clearCaches(){this.clearLastClicked(),this._lollipops={},this._lollipopsCounter=0}update(){this._invalidated=!0}renderer(e,t){return this._invalidated&&(this._createLollipops(t,e),this._invalidated=!1),this._renderer}getStyle(e){const t=e.active?"active":e.hovered?"hovered":"default";return this._generateStyle(t,e.color,e.label,e.stack,e.shape)}hasTooltip(e){return Boolean(e.items&&e.items.length)}getLollipopIdByIndex(e){return this._itemIndexToId.get(e)}_createRendererForLollipop(e,t){return new A(e,new S.HitTestResult(S.HitTestResult.CUSTOM,t),this._textWidthCache)}_createLollipops(e,t){const i=this._model.timeScale(),s=super._getY(),r=this._model.lastHittestData(),n=this._model.hoveredSource(),o=this.source.marks(),l=new Map;Object.keys(o).forEach(e=>{var t;const c=o[e],h=c.id,d=c.index;if(null!=d){const e=h===this.getLastClickedLollipopId(),o=this._lollipops[h],u=void 0!==o?o.itemIndex:this._lollipopsCounter++;this._itemIndexToId.has(u)||this._itemIndexToId.set(u,h);const p=n===this.source&&null!==r&&r.activeItem===u,_=(null!==(t=l.get(d))&&void 0!==t?t:-1)+1;l.set(d,_),this._lollipops[h]={id:h,itemIndex:u,basePoint:new a.Point(i.indexToCoordinate(d)+1,s),hovered:p,active:e,barY:null,label:c.label,color:c.color,items:c.tooltip,visible:!0,stack:_,shape:c.shape}}}),super._createRenderers(e,t)}_generateStyle(e,t,i,s,r){let n=e+t+i;if(void 0!==s&&(n+="_stack"+s),!(n in this.stylesCache)){const o="hovered"===e;let a="active"===e;const l=o||a;let c="white";a?c=t:o&&(c=(0, y.generateColor)(t,85),c===t&&(a=!0));const h={barLine:{lineStyle:m.LINESTYLE_DASHED,lineWidth:1,strokeStyle:t},lollipop:{width:21,height:21,lineWidth:1.5,bottom:2,fillStyle:c,fillCircle:l,strokeStyle:t,text:{label:i,strokeStyle:a?"white":t,font:(0,b.makeFont)(12,w.CHART_FONT_FAMILY)}},shape:r};void 0!==s&&(h.lollipop.incHeight=25*s),this.stylesCache[n]=h}return this.stylesCache[n]}}class E extends n.BarsMarksContainer{constructor(e){super(e),this.toolname="UserDefinedTimescaleMarks",this._requestedPointsets=new Set,(0,o.hideMarksOnBars)().subscribe(this,()=>this._properties.childs().visible.setValue(!(0,o.hideMarksOnBars)().value())),this._paneView=new k(e,this,this._showTooltip.bind(this))}destroy(){(0,o.hideMarksOnBars)().unsubscribeAll(this),super.destroy()}userEditEnabled(){return!1}onClicked(e){if(null!==e){const t=this._paneView.getLollipopIdByIndex(e.activeItem);(0,r.emit)("onTimescaleMarkClick",t)}}clearMarks(){const e=this._model.chartApi();e.isConnected().value()&&Object.keys(this._marks).forEach(t=>{const i=this._getPointsetId(t);e.removePointset(i)}),this._requestedPointsets.clear(),super.clearMarks(),this._paneView.clearCaches(),this.onNeedRepaint.fire()}updatePlateData(e,t){return{...t,barWidth:this.barWidth(),text:e.text,tooltipMargin:-1*Math.max(e.minSize/2,.4*this.barWidth())}}hasContextMenu(){return!1}paneViews(){return this._properties.childs().visible.value()?[this._paneView]:[]}updateAllViews(){this._paneView.update()}onClickOutside(e){this._paneView.onClickOutside(e)}_createTooltipRenderer(){return null}_initialize(){this._properties.childs().visible.setValue(!0)}_plateViewData(e){return{text:e.text}}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return;const i=this.roundRange(this._rangeDifference(e)),r=this._model.mainSeries(),n=r.seriesSource().symbolInstanceId(),o=r.properties().childs().interval.value();window.ChartApiInstance.getTimescaleMarks(t,i.start,i.end,t=>{const i=this._model.chartApi();for(const e of t){e.index=null;const t=e.id,r=this._getPointsetId(t.toString()),a=this._marks[t];if(a&&null!==a.index&&(a.tickmark===e.tickmark?e.index=a.index:this._requestedPointsets.has(r)&&i.isConnected().value()&&(i.removePointset(r),this._requestedPointsets.delete(r))),this._marks[t]=e,null===e.index&&i.isConnected().value()){this._requestedPointsets.add(r);const t=[[e.tickmark,0]];i.createPointset(r,"turnaround",(0,s.ensureNotNull)(n),o,t,e=>this._onPointsetData(e))}}this._loadedRange=this._rangeUnion(e,this._loadedRange),this.updateAllViews(),this.onNeedRepaint.fire()},o)}_getPointsetId(e){return"pointsetMark_"+e}_onPointsetData(e){if("data_update"===e.method){const t=e.params.customId.split("_")[1],i=this._marks[t],s=e.params.plots;i&&1===s.length&&(i.index=s[0].value[0])}this.updateAllViews()}async _showTooltip(e,t){const s=t();if(!s)return;const r=this._model.timeScale(),n=[r.onScroll(),r.barSpacingChanged(),this._model.mainSeries().onSymbolIntervalChanged()],o=this.onClickOutside.bind(this) ;(await Promise.all([i.e(7610),i.e(3894),i.e(6253),i.e(5514),i.e(306),i.e(4940),i.e(9039)]).then(i.bind(i,14391))).showLollipopTooltip({items:s,position:e,customCloseSubscriptions:n,onClickOutside:o})}}},36559:(e,t,i)=>{"use strict";var s=i(61627).PlotRowSearchMode,r=i(50968).rgbaFromInteger;function n(){this.backColorers=[]}function o(e){n.call(this),this._series=e}function a(e,t){n.call(this),this._study=e,this._plotIndex=t}n.prototype.barStyle=function(e,t,i){for(var s={},r=this.backColorers.length-1;r>=0;r--)this.backColorers[r].applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s},n.prototype.pushBackBarColorer=function(e){this.backColorers.push(e)},n.prototype.applyBarStyle=function(e,t,i){throw new Error("This function is supposed to be reimplemented in a subclass")},inherit(o,n),o.upColor=function(e,t){switch(e.style.value()){case TradingView.Series.STYLE_LINE:return e.lineStyle.color.value();case TradingView.Series.STYLE_AREA:return e.areaStyle.linecolor.value();case TradingView.Series.STYLE_BARS:return e.barStyle.upColor.value();case TradingView.Series.STYLE_CANDLES:return e.candleStyle.upColor.value();case TradingView.Series.STYLE_HOLLOW_CANDLES:return e.hollowCandleStyle.upColor.value();case TradingView.Series.STYLE_HEIKEN_ASHI:return e.haStyle.upColor.value();case TradingView.Series.STYLE_BASELINE:return e.baselineStyle.topLineColor.value();case TradingView.Series.STYLE_HILO:return e.hiloStyle.color.value()}throw new Error("Unknown series style")},o.downColor=function(e,t){switch(e.style.value()){case TradingView.Series.STYLE_LINE:return e.lineStyle.color.value();case TradingView.Series.STYLE_AREA:return e.areaStyle.linecolor.value();case TradingView.Series.STYLE_BARS:return e.barStyle.downColor.value();case TradingView.Series.STYLE_CANDLES:return e.candleStyle.downColor.value();case TradingView.Series.STYLE_HOLLOW_CANDLES:return e.hollowCandleStyle.downColor.value();case TradingView.Series.STYLE_HEIKEN_ASHI:return e.haStyle.downColor.value();case TradingView.Series.STYLE_BASELINE:return e.baselineStyle.bottomLineColor.value();case TradingView.Series.STYLE_HILO:return e.hiloStyle.color.value()}throw new Error("Unknown series style")},o.prototype._applyLineStyle=function(e,t,i,s,r){i.barColor=o.upColor(r)},o.prototype._applyAreaStyle=function(e,t,i,s,r){i.barColor=o.upColor(r)},o.prototype._applyBarStyle=function(e,t,i,s,r){var n=o.upColor(r),a=o.downColor(r),l=this.findBar(e,!1,s);if(r.barStyle.barColorsOnPrevClose.value()){var c=this.findPrevBar(e,!1,s);i.barColor=c[TradingView.CLOSE_PLOT]<=l[TradingView.CLOSE_PLOT]?n:a,i.barBorderColor=c[TradingView.CLOSE_PLOT]<=l[TradingView.CLOSE_PLOT]?n:a}else i.barColor=l[TradingView.OPEN_PLOT]<=l[TradingView.CLOSE_PLOT]?n:a,i.barBorderColor=l[TradingView.OPEN_PLOT]<=l[TradingView.CLOSE_PLOT]?n:a},o.prototype._applyCandleStyle=function(e,t,i,s,r){ var n,a=o.upColor(r,t),l=o.downColor(r,t),c=r.candleStyle.borderUpColor?r.candleStyle.borderUpColor.value():r.candleStyle.borderColor.value(),h=r.candleStyle.borderDownColor?r.candleStyle.borderDownColor.value():r.candleStyle.borderColor.value(),d=r.candleStyle.wickUpColor?r.candleStyle.wickUpColor.value():r.candleStyle.wickColor.value(),u=r.candleStyle.wickDownColor?r.candleStyle.wickDownColor.value():r.candleStyle.wickColor.value(),p=this.findBar(e,!1,s);r.candleStyle.barColorsOnPrevClose.value()&&this._series.data().first().index!==e?n=this.findPrevBar(e,!1,s)[TradingView.CLOSE_PLOT]<=p[TradingView.CLOSE_PLOT]:n=p[TradingView.OPEN_PLOT]<=p[TradingView.CLOSE_PLOT];i.barColor=n?a:l,i.barBorderColor=n?c:h,i.barWickColor=n?d:u},o.prototype._applyHollowCandleStyle=function(e,t,i,s,r){var n,a=o.upColor(r,t),l=o.downColor(r,t),c=r.hollowCandleStyle.borderUpColor?r.hollowCandleStyle.borderUpColor.value():r.hollowCandleStyle.borderColor.value(),h=r.hollowCandleStyle.borderDownColor?r.hollowCandleStyle.borderDownColor.value():r.hollowCandleStyle.borderColor.value(),d=r.hollowCandleStyle.wickUpColor?r.hollowCandleStyle.wickUpColor.value():r.hollowCandleStyle.wickColor.value(),u=r.hollowCandleStyle.wickDownColor?r.hollowCandleStyle.wickDownColor.value():r.hollowCandleStyle.wickColor.value(),p=this.findBar(e,!1,s),_=this.findPrevBar(e,!1,s);n=this._series.data().first().index!==e?_[TradingView.CLOSE_PLOT]<=p[TradingView.CLOSE_PLOT]:p[TradingView.OPEN_PLOT]<=p[TradingView.CLOSE_PLOT],i.barColor=n?a:l,i.barBorderColor=n?c:h,i.barWickColor=n?d:u,i.isBarHollow=p[TradingView.OPEN_PLOT]<=p[TradingView.CLOSE_PLOT]},o.prototype._applyHAStyle=function(e,t,i,s,r){var n,a=o.upColor(r,t),l=o.downColor(r,t),c=r.haStyle.borderUpColor.value(),h=r.haStyle.borderDownColor.value(),d=r.haStyle.wickUpColor.value(),u=r.haStyle.wickDownColor.value(),p=this.findBar(e,t,s);r.haStyle.barColorsOnPrevClose.value()?n=this.findPrevBar(e,t,s)[TradingView.CLOSE_PLOT]<=p[TradingView.CLOSE_PLOT]:n=p[TradingView.OPEN_PLOT]<=p[TradingView.CLOSE_PLOT];i.barColor=n?a:l,i.barBorderColor=n?c:h,i.barWickColor=n?d:u},o.prototype._applyBaseLineStyle=function(e,t,i,s,r){var n=this.findBar(e,t,s),a=r.baselineStyle,l=this._series.priceScale(),c=Math.round(l.height()*(Math.abs(100-a.baseLevelPercentage.value())/100)),h=this._series.firstValue(),d=l.coordinateToPrice(c,h);n[TradingView.CLOSE_PLOT]>d?i.barColor=o.upColor(r,t):i.barColor=o.downColor(r,t)},o.prototype._applyHiLoStyle=function(e,t,i,s,r){i.barColor=o.upColor(r,t),i.barBorderColor=r.hiloStyle.borderColor.value()},o.prototype.applyBarStyle=function(e,t,i,s){i||(i={}),i.barColor=null,i.barBorderColor=null,i.barWickColor=null,i.isBarHollow=null,i.isBarUp=null,i.upColor=null,i.downColor=null,i.isTwoColorBar=null,i.isMergedBar=null;var r=this._series.properties();switch(r.style.value()){case TradingView.Series.STYLE_LINE:this._applyLineStyle(e,t,i,s,r);break;case TradingView.Series.STYLE_AREA:this._applyAreaStyle(e,t,i,s,r);break;case TradingView.Series.STYLE_BARS:this._applyBarStyle(e,t,i,s,r);break ;case TradingView.Series.STYLE_CANDLES:this._applyCandleStyle(e,t,i,s,r);break;case TradingView.Series.STYLE_HOLLOW_CANDLES:this._applyHollowCandleStyle(e,t,i,s,r);break;case TradingView.Series.STYLE_HEIKEN_ASHI:this._applyHAStyle(e,t,i,s,r);break;case TradingView.Series.STYLE_BASELINE:this._applyBaseLineStyle(e,t,i,s,r);break;case TradingView.Series.STYLE_HILO:this._applyHiLoStyle(e,t,i,s,r)}return i},o.prototype.getSeriesBars=function(e){return e?this._series.nsBars():this._series.bars()},o.prototype._findBarFieldValue=function(e,t,i){var s=this.getSeriesBars(i).valueAt(e);if(null!==s)return s[t]},o.prototype.findBar=function(e,t,i){return i?i.value:this.getSeriesBars(t).valueAt(e)||[]},o.prototype.findPrevBar=function(e,t,i){if(i&&i.previousValue)return i.previousValue;var r=this._series.bars().search(e-1,s.NearestLeft,TradingView.CLOSE_PLOT);return null!==r?r.value:[]},inherit(a,n),a.prototype.getBars=function(){return this._study.series().bars()},a.prototype.firstColoredBar=function(e){for(var t=e,i=0;ie+l)return i;var c=s.styles[a.id];if(c.visible&&!c.visible.value())return i;var h=o.valueAt(e-l);if(null===h)return i;var d=h[this._plotIndex+1];if(null==d)return i;if(d=Math.round(d),n.isRGB)i.barColor=r(d),i.upColor=i.barColor,i.downColor=i.barColor;else{var u=n.plots[this._plotIndex].palette,p=s.palettes[u],_=n.palettes[u].valToIndex?n.palettes[u].valToIndex[d]:d,m=p.colors[_].color.value();i.barColor=m,i.upColor=m.color,i.downColor=m.color}return i},t.SeriesBarColorer=o,t.StudyBarColorer=a},45672:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>r});var s=i(16282);class r{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},31707:(e,t,i)=>{"use strict";i.d(t,{ChartModelBase:()=>Ut});var s=i(99479),r=i(16282),n=i(72927),o=i(14563),a=i(53312),l=i(14829),c=i(87438),h=i(61389),d=i(18437),u=i(23221),p=i(21698),_=i(49382),m=i(67945);class g{constructor(){this._items=[],this._set=new Set,this._dataSourcesCache=null,this._customSourcesCache=null,this._lineSourcesCache=null}isEmpty(){return 0===this._items.length} add(e){if(this._items.length>0&&!(0,m.isLineTool)(this._items[0])&&this.clear(),(0,m.isLineTool)(e)){const t=(0,_.lowerbound)(this._items,e,(e,t)=>e.zorder()!(0,p.isDataSource)(e))),this._customSourcesCache}checkLineToolSelection(){this._items.forEach(e=>(0,m.isLineTool)(e)&&e.calcIsActualSymbol()),this._items=this._items.filter(e=>!(0,m.isLineTool)(e)||e.isActualSymbol()),this._invalidateCache()}remove(e){this._items=this._items.filter(t=>t!==e),this._set.delete(e),this._invalidateCache()}clear(){this._items=[],this._set.clear(),this._invalidateCache()}_invalidateCache(){this._customSourcesCache=null,this._dataSourcesCache=null,this._lineSourcesCache=null}}var f=i(65618),v=i.n(f),S=i(73228),y=i(35001),b=i(11092),w=i(674),P=i.n(w),C=i(73395),T=i(54837);class x{constructor(e){this._rendererOptions={borderSize:1,offsetSize:5,fontSize:NaN,font:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,lineSpacing:0},this._chartModel=e}options(){const e=this._rendererOptions,t=this._chartModel.properties().childs(),i=t.scalesProperties.childs().fontSize.value();return e.fontSize!==i&&(e.fontSize=i,e.font=(0,C.makeFont)(i,T.CHART_FONT_FAMILY,""),e.paddingTop=2.5/12*i,e.paddingBottom=e.paddingTop,e.paddingInner=i/12*e.offsetSize,e.paddingOuter=i/12*e.offsetSize,e.lineSpacing=2/12*i),e.color=t.scalesProperties.childs().textColor.value(),e.paneBackgroundColor=t.paneProperties.childs().background.value(),this._rendererOptions}}var I=i(7171),M=i(19625),L=i(59104),A=i(18130),k=i(73853),E=i(27490),D=i(25436),V=i(18742);const B=new L.PriceFormatter;class N extends k.CustomSourceBase{constructor(e,t,i){super(e,t),this._studySource=null,this._paneViews=[],this._metaInfo=null,this._destroyed=!1,this._isStarted=!1,this._loadedGraphics=null,this._doubleClickHandler=i;const s=t.mainSeries();this._properties=new b.DefaultProperty("sessions"),(0,A.applyDefaultsOverrides)(this._properties.childs().graphics,void 0,!1,"sessions"),this._removeDuplicateProperties(),this._properties.subscribe(this,this._onPropertiesChanged),t.studyMetaInfoRepository().findById({type:"java",studyId:"Sessions@tv-basicstudies"}).then(e=>{this._destroyed||null===this._loadedGraphics&&(this._setMetaInfo(e),null!==this._metaInfo&&(this._studySource=new I.StudyDataSource(t.chartApi(),s.seriesSource(),"sessions_",this._metaInfo),this._createPaneViews(), this._studySource.dataCleared().subscribe(this,this.updateAllViews),this._studySource.dataUpdated().subscribe(this,this.updateAllViews),this._studySource.setInputs({}),this._processHibernate()))}),t.timeScale().onReset().subscribe(this,this._clearData),t.timeScale().logicalRangeChanged().subscribe(this,this.updateAllViews),t.mainSeries().sessionIdProxyProperty().subscribe(this,this._updateVisibleOfPreAndPostMarketBackground),t.mainSeries().properties().childs().interval.subscribe(this,this._processHibernate),this._updateVisibleOfPreAndPostMarketBackground(t.mainSeries().properties().childs().sessionId)}applyOverrides(e){(0,A.applyPropertiesOverrides)(this._properties.childs().graphics,void 0,!1,e,"sessions"),this._model.updateSource(this)}start(){this._isStarted=!0,this._processHibernate()}restart(){this._clearData(),E.enabled("stop_study_on_restart")&&this.stop(),this.start()}isStarted(){return this._isStarted}stop(){this._isStarted=!1,null!==this._studySource&&this._studySource.stop()}isHoveredEnabled(){return!1}paneViews(e){return this._paneViews}updateAllViews(){this._paneViews.forEach(e=>e.update())}updateViewsForPane(e){this.updateAllViews()}destroy(){this._destroyed=!0,null!==this._studySource&&(this._studySource.dataCleared().unsubscribeAll(this),this._studySource.dataUpdated().unsubscribeAll(this),this._studySource.destroy(),this._studySource=null),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.timeScale().onReset().unsubscribeAll(this),this._model.mainSeries().sessionIdProxyProperty().unsubscribeAll(this),this._model.mainSeries().properties().childs().interval.unsubscribeAll(this),this._properties.unsubscribeAll(this)}series(){return this._model.mainSeries()}priceScale(){return this.series().priceScale()}graphics(){return this._loadedGraphics||(0,r.ensureNotNull)(this._studySource).graphics()}properties(){return this._properties}graphicsInfo(){return(0,r.ensureNotNull)(this._metaInfo).graphics}firstValue(e){return this._model.mainSeries().firstValue()}formatter(){return B}state(e){const t={properties:this._properties.state()};return e&&null!==this._metaInfo&&(t.data={graphics:(0,M.saveStudyGraphics)(this.graphics()),metaInfo:this._metaInfo}),t}restoreState(e,t){const i=e.properties;this._migrateOutOfSessionProperty(i),this._properties.mergeAndFire(i),this._removeDuplicateProperties(),this._updateVisibleOfPreAndPostMarketBackground(this._model.mainSeries().properties().childs().sessionId),void 0!==e.data&&t&&(this._loadStudyGraphics(e.data.graphics),this._setMetaInfo(e.data.metaInfo),this._createPaneViews())}restoreOldState(e,t){const i={properties:{graphics:e.state.graphics}};void 0!==e.data&&void 0!==e.metaInfo&&t&&(i.data={metaInfo:e.metaInfo,graphics:e.data.graphics}),this.restoreState(i,t)}applyPreferences(e){this._properties.mergePreferences(e)}metaInfo(){return(0,r.ensureNotNull)(this._metaInfo)}_loadStudyGraphics(e){const t=e.backgrounds;if(void 0!==t){const e=t.findIndex(e=>"inSession"===e.styleId);-1!==e&&t.splice(e,1)}this._loadedGraphics=(0,M.loadStudyGraphics)(e)} _setMetaInfo(e){const t=e.graphics.backgrounds;void 0!==t&&void 0!==t.inSession&&delete t.inSession,this._metaInfo=e}_updateVisibleOfPreAndPostMarketBackground(e){const t=!(0,D.isRegularSessionId)(e.value());this._outOfSessionVisibilityProperty().setValue(t),this._preMarketVisibilityProperty().setValue(t),this._postMarketVisibilityProperty().setValue(t)}_clearData(){null!==this._studySource&&this._studySource.clearData()}_createPaneViews(){const e={doubleClickHandler:this._doubleClickHandler};(0,M.createGraphicsPaneViews)(this,this._model,e).then(e=>{this._paneViews=e,this._model.lightUpdate()})}_onPropertiesChanged(){this._processHibernate(),this.updateAllViews()}_processHibernate(){if(null!==this._studySource){const e=this._canBeHibernated(),t=this._isHibernated(),i=this._studySource.isStarted();!t&&e&&i?this._studySource.stop():!t||e||i||this._studySource.start()}}_canBeHibernated(){const e=this._model.mainSeries(),t=this._preMarketVisibilityProperty().value()&&this._postMarketVisibilityProperty().value()&&this._outOfSessionVisibilityProperty().value();return e.isDWM()||!t&&!this._vertLinesVisibleProperty().value()}_isHibernated(){return this._isStarted&&(null===this._studySource||!this._studySource.isStarted())}_outOfSessionVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().outOfSession.childs().visible}_preMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().preMarket.childs().visible}_postMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().postMarket.childs().visible}_vertLinesVisibleProperty(){return this._properties.childs().graphics.childs().vertlines.childs().sessBreaks.childs().visible}_removeDuplicateProperties(){this._properties.hasChild("properties")&&(this._properties.removeProperty("properties"),(0,b.saveDefaultProperties)(!0),this._properties.childChanged("",null),(0,b.saveDefaultProperties)(!1))}_migrateOutOfSessionProperty(e){const t=e.graphics.backgrounds;if(void 0!==t){const i=t.outOfSession;i.color===(0,r.ensureDefined)(V.sessionsPreferencesDefault.graphics.backgrounds).outOfSession.color||"postMarket"in t||(e.graphics.backgrounds={...t,postMarket:{color:i.color,transparency:i.transparency,visible:i.visible},preMarket:{color:i.color,transparency:i.transparency,visible:i.visible}})}}}var R=i(17e3),O=i(5729),F=i.n(O),W=i(32856),H=i.n(W),z=i(47329),U=i(37923),j=i(83939),G=i(65447),q=i(99432),Y=i(57968),$=i(47903),K=i(7532),X=i(45672);class Z{constructor(e,t){(0,r.assert)(e<=t,"The left value should be greater than or equal to the right value"),this._left=e,this._right=t}left(){return this._left}right(){return this._right}length(){return this._right-this._left+1}contains(e){return this._left<=e&&e<=this._right}equals(e){return this._left===e.left()&&this._right===e.right()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}const J=(0,G.getLogger)("Chart.TimePoints");class Q{constructor(){this._zoffset=0,this._items=[]}clear(){this._zoffset=0, this._items=[]}size(){return this._items.length}firstIndex(){return this._offsetToIndex(0)}lastIndex(){return this._offsetToIndex(this._items.length-1)}merge(e,t,i){if(0===i.length)return J.logError("merge: 'values' does not contain any time points"),[];if(t>this._zoffset&&e+t>0)return J.logError("merge: when the first time point index is updated, we should fill the time points starting from the first one"),[];if(0===this._items.length)return this._items=i,this._zoffset=t,[{change:"rebuild",index:this._validOffsetToIndex(0)}];const s=e+this._zoffset;if(s<0){const r=Math.abs(s);if(i.lengththis._items.length){const e=o-this._items.length;for(let t=n;tthis._items[this._items.length-1])return t?this._validOffsetToIndex(this._items.length-1):null;for(let i=0;io){const i=e-o;if(i<500&&null!=t)return t(l,i);return l+i*c}return null}roughIndex(e,t=null){const i=this._items;if(!i.length||i.length<2)return null;const s=i.length-1,r=this._validOffsetToIndex(0),n=this._validOffsetToIndex(s),o=i[0],a=i[s];if(e>=o&&e<=a)return this.closestIndexLeft(e);const l=(a-o)/(n-r);if(ea){const i=e-a;let s=Math.trunc(i/l);if(s<500&&null!==t){const i=t(a,e);i.success&&(s=i.result)}return n+s}return null} closestIndexLeft(e){const t=this._items;if(!t.length)return null;if(Number.isNaN(e))return null;let i=t.length-1;if(e>=t[i])return this._validOffsetToIndex(i);let s=0;const r=t[s];if(es+1;){const r=s+i>>1,n=t[r];if(n>e)i=r;else{if(!(n{this.setRightOffset(e)}), this._options.preserveBarSpacing&&(this._barSpacing=this._scalesProperties.childs().barSpacing.value()||6),this._barSpacingChanged.subscribe(this,this._maxRightOffsetOnChanged),this._widthChanged.subscribe(this,this._maxRightOffsetOnChanged)}destroy(){this._barSpacingChanged.unsubscribeAll(this),this._barSpacingChanged.destroy(),this._widthChanged.unsubscribeAll(this),this._widthChanged.destroy()}isEmpty(){return 0===this._width||0===this._points.size()}update(e,t,i,s){this._visibleBarsInvalidated=!0,i.length>0&&this._points.merge(e,t,i),this._tickMarks.merge(s),this._correctOffset()}addTail(e,t,i){this._tickMarks.removeTail(t);const s=e.params,n=(0,r.ensureDefined)(this._tickMarks.maxIndex)+(i?0:1);for(let e=0;e0&&(i*=this._width/e.width)),this._tryToUpdateBarSpacing(this._barSpacing,i),this._correctOffset(),this._rightOffsetChanged.fire(this._rightOffset)}marks(){if(this.isEmpty())return null;const e=this._barSpacing,t=5*((this._scalesProperties.childs().fontSize.value()||0)+4),i=Math.round(t/e),s=(0,r.ensureNotNull)(this.visibleBarsStrictRange()),n=Math.max(s.firstBar(),s.firstBar()-i),o=Math.max(s.lastBar(),s.lastBar()-i),a=this._tickMarks.build(e,t),l=[];for(const e of a){if(!(n<=e.index&&e.index<=o))continue;const t=this._tickMarks.indexToTime(e.index);null!==t&&l.push({coord:this.indexToCoordinate(e.index),label:this.formatLabel(t,e.span),span:e.span,major:e.label>=se.DAY_SPAN})}return l}visibleBarsStrictRange(){return this._visibleBarsInvalidated&&(this._visibleBarsInvalidated=!1,this._updateVisibleBars()),this._visibleBars.strictRange()}visibleBarsStrictRangeChanged(){return this._visibleBarsChanged}logicalRangeChanged(){return this._logicalRangeChanged}tickMarks(){return this._tickMarks}points(){return this._points}width(){return this._width}setWidth(e,t){if(!Number.isFinite(e)||e<=0)return void de.logWarn("setWidth: invalid argument: "+e);if(this._width===e)return;if(this._visibleBarsInvalidated=!0,(t||this._options.lockVisibleTimeRangeOnResize)&&this._width){const t=this._barSpacing*e/this._width;this._tryToUpdateBarSpacing(this._barSpacing,t) }else this._width&&this.setBarSpacing(this._barSpacing);if(null!==this._leftEdgeIndex){if((0,r.ensureNotNull)(this.visibleBarsStrictRange()).firstBar()<=this._leftEdgeIndex){const t=this._width-e;this._rightOffset-=Math.round(t/this._barSpacing)+1}}this._width=e,this._widthChanged.fire(e);const i=this._rightOffset;this._correctOffset(),this._rightOffset!==i&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}setLeftEdgeFix(e){this._leftEdgeIndex=e;const t=this.visibleBarsStrictRange();if(null===t)return;const i=t.firstBar()-e;if(i<0){const e=this._rightOffset-i-1;this.scrollToOffsetAnimated(e,500)}}indexToCoordinate(e){if(this.isEmpty())return 0;if(!(0,$.isInteger)(e))return 0;const t=this.baseIndex()+this._rightOffset-e;return this._width-(t+.5)*this._barSpacing-1}indexToUserTime(e){return this._tickMarks.indexToTime(e)}timePointToIndex(e){return this._points.indexOf(e,!0)}indexToTimePoint(e){return this._points.valueAt(e)}timeToCoordinate(e){const t=this._points.closestIndexLeft(e);if(null===t)return null;const i=(0,r.ensureNotNull)(this._points.valueAt(t)),s=this.indexToCoordinate(t);if(s<=0||s>=this._width)return null;const n=this.barSpacing(),o=this.baseIndex(),a=s+(e-i)/((0,r.ensureNotNull)(this._points.valueAt(o))-(0,r.ensureNotNull)(this._points.valueAt(o-1)))*n+1;return a<=0||a>=this._width?null:a}barIndexesToCoordinates(e){const t=this.baseIndex();for(const i of e){const e=i.time,s=t+this._rightOffset-e,r=this._width-(s+.5)*this._barSpacing-1;i.time=r,i.exactTime=r}}timedValuesToCoordinates(e){const t=this.baseIndex()+this._rightOffset,i=this._width-t*this._barSpacing-.5*this._barSpacing-1;for(const t of e)t.x=i+t.x*this._barSpacing}indexesToCoordinates(e,t){if(this.isEmpty())return;void 0===t&&(t=e.length);const i=this.baseIndex()+this._rightOffset,s=this._width-i*this._barSpacing-.5*this._barSpacing-1,r=this._barSpacing,n=e;for(let i=0;i{void 0!==t&&t(),this._requestMoreData()};if(e){const e=this._rightOffset,t=this.maxRightOffset();t>0&&i>t&&(i=t);const r=this._model;(0,q.doAnimate)({from:e,to:i,duration:1e3,easing:j.easingFunc.easeInOutQuint,onComplete:s,onStep:(e,t)=>{this._visibleBarsInvalidated=!0,this._updateRightOffset(t),r.recalculateAllPanes(),r.lightUpdate(),r.recalcVisibleRangeStudies()}})}else this._visibleBarsInvalidated=!0,this._updateRightOffset(i),s()}scrollToFirstBar(){this._model.gotoTime(new Date("1800-01-01").getTime())}scrollToOffsetAnimated(e,t){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");const i=void 0===t?400:t;if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const s=this._rightOffset,r=Date.now(),n=()=>{this._visibleBarsInvalidated=!0;const t=(Date.now()-r)/i ;if(t>=1)return this._updateRightOffset(e),this._visibleBarsInvalidated=!0,this._model.recalculateAllPanes(),void this._model.lightUpdate();const o=s+(e-s)*t;this._updateRightOffset(o),this._model.recalculateAllPanes(),setTimeout(n,20)};n()}defaultRightOffset(){return this._defaultRightOffset}rightOffsetDefaultValue(){return 10}barSpacing(){return this._barSpacing}setBarSpacing(e){Number.isFinite(e)?(e=this.getValidBarSpacing(e),this._tryToUpdateBarSpacing(this._barSpacing,e)&&(this._correctOffset(),this._options.preserveBarSpacing&&((0,b.saveDefaultProperties)(!0),this._scalesProperties.childs().barSpacing.setValue(this._barSpacing),(0,b.saveDefaultProperties)(!1)),this._model.recalculateAllPanes(),this._model.lightUpdate())):de.logWarn("setBarSpacing: invalid argument: "+e)}barSpacingChanged(){return this._barSpacingChanged}getValidBarSpacing(e){return null==e&&(e=this.barSpacing()),ethis.maxBarSpacing()?this.maxBarSpacing():e}isValidBarSpacing(e){return e>=this.minBarSpacing()&&e<=this.maxBarSpacing()}preserveBarSpacing(){return this._options.preserveBarSpacing}normalizeBarIndex(e){let t=0,i=0;const s=this.baseIndex(),n=(0,r.ensureNotNull)(this._points.firstIndex());return es?(t=(0,r.ensureNotNull)(this._points.valueAt(s)),i=e-s):(t=(0,r.ensureNotNull)(this._points.valueAt(e)),i=0),{time_t:t,offset:i}}denormalizeTimePoint(e){const t=this._points.indexOf(e.time_t,!1);if(null!==t)return t+e.offset}rightOffset(){return this._rightOffset}rightOffsetChanged(){return this._rightOffsetChanged}minRightOffset(){const e=this.points().firstIndex(),t=this._baseIndex;if(null===e||null===t)return null;if(null!==this._leftEdgeIndex){const e=this.width()/this._barSpacing;return this._leftEdgeIndex-t+e-1}return e-t-1+he}maxRightOffset(){return this.width()/this._barSpacing-he}maxRightOffsetChanged(){return this._maxRightOffsetChanged}onReset(){return this._resetDelegate}scrollStartPoint(){return this._scrollStartPoint}baseIndex(){return this._baseIndex||0}zoom(e,t,i){if(!Number.isFinite(e)||!Number.isFinite(t))return void de.logWarn(`zoom: invalid arguments: ${e}, ${t}, ${i}`);const s=this.coordinateToIndex(e),r=this.barSpacing(),n=r+t*(r/10);this.setBarSpacing(n);(void 0!==i?!i:this._options.rightBarStaysOnScroll)||this.setRightOffset(this.rightOffset()-.5+(s-this._coordinateToFloatIndex(e))),this._requestMoreData()}zoomToBarsRange(e,t){if(null!==this._leftEdgeIndex&&(e=Math.max(e,this._leftEdgeIndex)),t<=e)return;const i=this.baseIndex(),s=this._rightOffset;this._rightOffset=t-i;const r=Math.max(t-e+1,he);this.setBarSpacing(this.width()/r),this._visibleBarsInvalidated=!0,this._correctOffset(),this._rightOffset!==s&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}coordinateToIndex(e){return Math.ceil(this._coordinateToFloatIndex(e))}coordinateToVisibleIndex(e){let t;if(0===e){const e=this._coordinateToFloatIndex(-1);t=Math.floor(e)+1}else t=this.coordinateToIndex(e) ;const i=this.visibleBarsStrictRange();return null===i||i.contains(t)||(t=Math.min(Math.max(i.firstBar(),t),i.lastBar())),t}canZoomIn(){return this.barSpacing()this._options.minBarSpacing}minBarSpacing(){return this._options.minBarSpacing}maxBarSpacing(){const e=this.width();return ce?e:e/he}resetRightOffset(){this.setRightOffset(this._defaultRightOffset.value())}reset(){this._visibleBarsInvalidated=!0,this._points=new Q,this._scrollStartPoint=null,this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._tickMarks.reset(),this._leftEdgeIndex=null,this._resetDelegate.fire(),this.disconnect()}disconnect(){this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1}setBaseIndex(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._baseIndex=e,this._correctOffset()):de.logDebug("setBaseIndex: invalid argument: "+e)}resetBaseIndex(){this._visibleBarsInvalidated=!0,this._baseIndex=null}setRightOffset(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._updateRightOffset(e)):de.logWarn("setRightOffset: invalid argument: "+e)}correctBarSpacing(){this.isEmpty()||this.points().size()this.formatLabelImpl(e,t)),this._formattedBySpan.set(t,i)),i.format(new Date(e))}formatLabelImpl(e,t){if(!(e&&e instanceof Date))return"incorrect time" ;const i=function(e,t){if(ee&&(this._rightOffset=e,this._visibleBarsInvalidated=!0);const t=this.minRightOffset();null!==t&&this._rightOffsett.code?1:0}class Ce{constructor(e){this._convertibleItems=e,this._idsToItems=new Map;for(const t of e)this._idsToItems.set(t.id,t)}convertible(e){return void 0!==this._idsToItems.get(e)}item(e){var t;return null!==(t=this._idsToItems.get(e))&&void 0!==t?t:null}size(){return this._convertibleItems.length}filterConvertible(e,t){const i=this._convertibleItems.filter(function(e,t){return i=>!e.has(i.id)&&t(i.id)}(e,t));return i.sort(Pe),i}}class Te{constructor(e){this._allGroups=new Set,this._idToName=new Map,this._idToDescription=new Map,this._groupedUnitIds=new Map,this._groupedUnits=new Map,this._groupById=new Map,this._size=0,this._units=e;for(const t in e)if(e.hasOwnProperty(t)){this._allGroups.add(t),this._groupedUnitIds.set(t,new Set(e[t].map(e=>e.id))),this._groupedUnits.set(t,e[t]);for(const i of e[t])this._size++,this._idToName.set(i.id,i.name),this._idToDescription.set(i.id,i.description),this._groupById.set(i.id,t)}}unitsChanged(e){return this._units!==e}size(){return this._size}name(e){return this._idToName.get(e)||e}description(e){return this._idToDescription.get(e)||e}unitGroupById(e){return this._groupById.get(e)||null}allGroups(){return new Set(this._allGroups)}unitsByGroups(e){const t=[];return e.forEach(e=>{const i=this._groupedUnits.get(e);void 0!==i&&t.push({name:e,units:i})}),t}convertible(e,t){for(const i of t){const t=this._groupedUnitIds.get(i) ;if(void 0!==t&&t.has(e))return!0}return!1}}var xe=i(75496);class Ie{constructor(e){this._source=null,this._sourcePane=null,this._currentToolSupportsPhantomMode=!1,this._model=e}destroy(){this._source=null,this._sourcePane=null}source(){return this._source}onToolChanged(){this._removeSource();const e=this._model.currentTool();this._currentToolSupportsPhantomMode=(0,m.isLineToolName)(e)&&(0,m.supportsPhantomMode)(e)}onCursorPositionUpdated(){if(!this._currentToolSupportsPhantomMode)return;const e=this._model.crossHairSource();if(this._sourcePane!==e.pane&&this._removeSource(),null===e.pane||!(0,xe.isNumber)(e.index)||!(0,xe.isNumber)(e.price))return void this._removeSource();const t={index:e.index,price:e.price};null!==this._source?this._source.setPoint(0,t):(this._source=this._model.createLineTool(e.pane,t,this._model.currentTool(),void 0,null),this._sourcePane=e.pane)}_removeSource(){null!==this._source&&(this._model.removeSource(this._source),this._source=null,this._sourcePane=null)}}var Me=i(61627),Le=i(38536),Ae=i(70599);class ke{align(e,t,i){let s=e;if(!(0,Ae.magnetEnabled)().value())return s;const n=i.mainDataSource();if(null===n)return s;const o=n.model().mainSeries();if(n!==o)return s;const a=o.priceScale(),l=o.bars();if(a.isEmpty()||!l.contains(t))return s;const c=l.valueAt(t);if(null===c)return s;const h=[];null!==o.priceSource()?h.push(o.barFunction()(c)):h.push(c[1],c[2],c[3],c[4]);const d=(0,r.ensure)(o.firstValue()),u=h.map(e=>({y:a.priceToCoordinate(e,d),price:e})),p=a.priceToCoordinate(e,d);u.sort((e,t)=>Math.abs(e.y-p)-Math.abs(t.y-p));const _=u[0];return((0,Ae.magnetMode)().value()===Le.MagnetMode.StrongMagnet||Math.abs(_.y-p)<50)&&(s=_.price),s}}var Ee=i(25303),De=i(84540),Ve=i(63059),Be=i(58007),Ne=i(46015),Re=i(5025),Oe=i(55430);class Fe{constructor(){this._data=null}setData(e){this._data=e}draw(e,t){if(null===this._data)return;const i=t.pixelRatio,s=Math.max(1,Math.floor(i));e.lineWidth=s;const r=Math.ceil(this._data.h*i),n=Math.ceil(this._data.w*i);if(e.save(),e.lineCap="butt",this._data.vertLinesVisible){e.strokeStyle=this._data.vertLinesColor,(0,Re.setLineStyle)(e,this._data.vertLineStyle);for(const t of this._data.timeMarks){const s=Math.round(t.coord*i);(0,Oe.drawVerticalLine)(e,s,0,r)}}if(this._data.horzLinesVisible){e.strokeStyle=this._data.horzLinesColor,(0,Re.setLineStyle)(e,this._data.horzLineStyle);for(const t of this._data.priceMarks){const s=Math.round(t.coord*i);(0,Oe.drawHorizontalLine)(e,s,0,n)}}e.restore()}hitTest(e){return null}}class We{constructor(e){this._renderer=new Fe,this._pane=e}update(){}renderer(){const e=this._pane.defaultPriceScale(),t=this._pane.model().timeScale();if(e.isEmpty()||t.isEmpty())return null;const i=this._pane.model().properties().childs().paneProperties.childs(),s=t.marks(),r={horzLinesVisible:!0,vertLinesVisible:!0,horzLinesColor:i.horzGridProperties.childs().color.value(),vertLinesColor:i.vertGridProperties.childs().color.value(),horzLineStyle:i.horzGridProperties.childs().style.value(),vertLineStyle:i.vertGridProperties.childs().style.value(), priceMarks:e.marks(),timeMarks:null!==s?s:[],w:this._pane.width(),h:this._pane.height()};return this._renderer.setData(r),this._renderer}}class He extends Ne.DataSource{id(){return"grid"}paneViews(e){return[new We(e)]}}var ze=i(95426);class Ue extends ze.PriceAxisView{constructor(e,t,i){super(),this._source=e,this._priceScale=t,this._priceProvider=i,this._properties=e.model().properties().childs().scalesProperties}setHitTestData(e){this._hitTestData=e}additionalPadding(e){return 0}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._priceScale,r=s.mainSource(),n=null!==r?r.firstValue():null;if(!this._isVisible()||s.isEmpty()||null===n)return;const o=this._priceProvider(s);if(null===o)return;i.background=this._bgColor(),i.textColor=this.generateTextColor(i.background);const a=this.additionalPadding(s.fontSize());i.additionalPaddingTop=a,i.additionalPaddingBottom=a,i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0,t.visible=!0,t.hitTestData=this._hitTestData}}const je={normalBgColor:a.colorsPalette["color-cold-gray-750"],hoveredBgColor:a.colorsPalette["color-cold-gray-600"]},Ge={normalBgColor:a.colorsPalette["color-cold-gray-900"],hoveredBgColor:a.colorsPalette["color-cold-gray-650"]};class qe extends Ue{additionalPadding(e){return 2/12*e}_isVisible(){return this._properties.childs().showPriceScaleCrosshairLabel.value()&&this._source.visible&&null!==this._source.pane}_bgColor(){return this._getThemedColors().normalBgColor}_updateRendererData(e,t,i){const s=t.visible;super._updateRendererData(e,t,i),this._source.isHovered()?t.backgroung=this._getThemedColors().hoveredBgColor:t.backgroung=void 0,s||(t.visible=s)}_getThemedColors(){return this._source.model().isDark()?je:Ge}}class Ye extends Ue{_isVisible(){return null!==this._source.measurePane()}_bgColor(){return this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}}var $e=i(13114),Ke=(i(46374),i(6799));i(50044);function Xe(e){const t=e.priceScale();return null===t?0:t.isPercentage()||t.isIndexedTo100()?2:1}class Ze extends $e.PanePriceAxisView{constructor(e,t,i,s,r){super(e,t,s),this._crossHairMenuCachedState=null,this._hasActions=!1,this._tooltipText=null,this._gaOrigin="CH menu",this._crosshairPriceAxisView=e,e.setPaneRendererLabelIcon(0),this._crosshair=t,this._scale=i,this._options=r}_updateImpl(e,t){super._updateImpl(e,t);const i=this._crosshair.y,s=this._chartModel.properties().childs().scalesProperties.childs().fontSize.value(),r=this._chartModel.timeScale().width(),n=this._crosshair.model().priceAxisRendererOptions(),o=s+2*this._crosshairPriceAxisView.additionalPadding(s)+n.paddingTop+n.paddingBottom,a=o,l=i-o/2,c=r-a,h=this._crosshair.pane,d=this._mainDataSourceOnPane(),u=d&&d.symbolSource(),p=!!u&&(u.isConvertedToOtherCurrency()||u.isConvertedToOtherUnit());if(null!==d){const e=Xe(d),t=d.idForAlert(),i=this._chartModel.isInReplay(),s=this._crossHairMenuCachedState ;null!==s&&s.id===t&&s.priceScale===e&&s.isCurrencyOrUnitConverted===p&&s.isInReplay===i||(this._updateTooltipAndActionsAvaliability(d,e,p),this._crossHairMenuCachedState={id:t,priceScale:e,isCurrencyOrUnitConverted:p,isInReplay:i})}const _=null!==d&&(0,Be.isSymbolSource)(d)?d.symbol():null,m=Boolean(_)||!1;this._crosshairPriceAxisView.setPaneLabelVisible(m);const g=null!==h&&0!==h.leftPriceScales().length&&m,f=null!==h&&0!==h.rightPriceScales().length&&m,v=r-a/2,S=this._tooltipText?{text:this._tooltipText,rect:{x:v,y:l,w:0,h:0}}:void 0;this._data={left:g,right:f,xl:0,xr:c,y:l,containerWidth:a,containerHeight:o,clickHandler:this._handleClick.bind(this),tooltip:S},this._crosshairPriceAxisView.setHitTestData(this._data)}_priceScale(){return this._scale}_updateTooltipAndActionsAvaliability(e,t,i){this._tooltipText=null,this._hasActions=!1;if(!(1===t))return;this._chartModel.isInReplay();let s=0;let r=0;1===s&&(this._tooltipText=(0,oe.t)("Add Horizontal Line")),this._crosshairPriceAxisView.setPaneRendererLabelIcon(r),this._hasActions=0!==s}_handleClick(e,t,i){(0,c.trackEvent)(this._gaOrigin,"click");const s=this._mainDataSourceOnPane(),r=null!==s&&(0,Be.isSymbolSource)(s)?s.symbol():null,n={pageX:i.pageX,pageY:i.pageY,clientX:i.clientX,clientY:i.clientY,screenX:i.screenX,screenY:i.screenY,price:this._crosshair.price,symbol:r};d.emit("onPlusClick",n)}_getMenuItems(e){return Promise.resolve([])}_createAlertMenuItems(e){return Promise.resolve([])}_createTradingMenuItems(){return Promise.resolve([])}_createAddHorizontalLineMenuItem(){return[]}_getActionAddAlert(e){return null}_getActionAddHorizontalLine(e){return null}_getValue(e,t){const i=e.priceScale(),s=e.firstValue();if(null===i||null===s)return null;return i.isPercentage()||i.isIndexedTo100()?null:i.coordinateToPrice(t,s)}_formatValue(e,t){return t.formatter().format(e)}_addAlert(e,t){}_addHorizontalLineTool(e,t){}_showContextMenu(e,t,i,s){const n="left"===s;setTimeout(()=>{const t=(0,r.ensureDefined)(this._data),s=n?t.xl:t.xr,o=i.localX-s,a=i.clientX-o,l=i.clientX-o+t.containerWidth;Ke.ContextMenuManager.showMenu(e,{clientX:n?a:l,clientY:i.clientY-t.containerHeight/2,boxHeight:t.containerHeight,attachToXBy:n?"left":"right",attachToYBy:"auto-strict"},void 0,{menuName:"CrosshairMenuView"})})}_mainDataSourceOnPane(){const e=this._crosshair.pane;return null!==e?e.mainDataSource():null}}var Je=i(33420),Qe=i(87910),et=i(10288);class tt{constructor(e){this._data=e}hitTest(e){return void 0===this._data.clickHandler?null:new et.HitTestResult(et.HitTestResult.CUSTOM,{clickHandler:this._data.clickHandler,tapHandler:this._data.clickHandler})}draw(e,t){const i=t.pixelRatio,s=this._data.vertLinesVisible,r=this._data.horzLinesVisible;if(!s&&!r)return;e.save(),e.lineWidth=Math.max(1,Math.floor(this._data.lineWidth*i)),e.strokeStyle=this._data.color,e.fillStyle=this._data.color,e.lineCap="butt",(0,Re.setLineStyle)(e,this._data.lineStyle);const n=Math.round(this._data.x*i),o=Math.round(this._data.y*i),a=Math.ceil(this._data.w*i),l=Math.ceil(this._data.h*i);s&&n>=0&&(0, Oe.drawVerticalLine)(e,n,0,l),r&&o>=0&&(0,Oe.drawHorizontalLine)(e,o,0,a),this._data.drawCenter&&(e.beginPath(),e.arc(n,o,Math.round(3*i),0,2*Math.PI,!0),e.fillStyle=this._data.color,e.fill()),e.restore()}}const it=a.colorsPalette["color-tv-blue-500"];class st{constructor(e,t){this._rendererData={},this._renderer=new tt(this._rendererData),this._source=e,this._pane=t}update(){}renderer(e,t){const i=this._source.selectPointMode().value(),s=this._source.visible&&(this._source.areLinesVisible||i)&&!this._source.linesShouldBeHidden(),n=this._rendererData;if(!s||null===this._pane)return null;const o=this._source.paneForPointSelect(),a=null!==o?this._source.pane===o&&this._pane===o:this._pane===this._source.pane;if(i&&this._source.isOnHoveredChartWidget()&&a){const e=(0,r.ensureNotNull)(this._source.pointToSelect());n.color=this._source.lineColor()||it,n.lineWidth=1,n.lineStyle=Je.LINESTYLE_SOLID,n.horzLinesVisible=!0,n.vertLinesVisible=!0,n.drawCenter=!1,"time"===e?n.horzLinesVisible=!1:"price"===e&&(n.vertLinesVisible=!1)}else{const e=this._source.properties(),t=this._source.model().currentTool(),i=(0,Qe.lastMouseOrTouchEventInfo)(),s=i.isTouch&&!i.stylus&&((0,m.isLineToolName)(t)||(0,ve.toolIsMeasure)(t));let r;r=s?it:e.childs().color.value();const o=e.childs().transparency.value();!s&&o>0&&(r=(0,ye.generateColor)(r,o)),n.color=r,n.horzLinesVisible=this._pane===this._source.pane,n.vertLinesVisible=!0,n.lineWidth=e.childs().width.value(),n.lineStyle=e.childs().style.value(),n.drawCenter=s&&this._pane===this._source.pane}return n.w=this._pane.width(),n.h=this._pane.height(),n.x=void 0!==this._source.lockedX&&isFinite(this._source.lockedX)&&this._source.lockedX||this._source.x,n.y=this._source.y,this._renderer}}var rt=i(72095);const nt={backgroundColor:(0,ye.generateColor)(a.colorsPalette["color-tv-blue-500"],70),borderColor:(0,ye.generateColor)(a.colorsPalette["color-tv-blue-500"],20)};class ot{constructor(e){this._renderer=new rt.RectangleRenderer,this._rectangle=null,this._crosshair=e}update(){const e=this._crosshair.selection();null!==e&&null!==this._crosshair.pane?this._rectangle=this._crosshair.pane.logicalRectToPixels(e):this._rectangle=null}renderer(e,t){if(!this._rectangle)return null;const i={backcolor:nt.backgroundColor,color:nt.borderColor,fillBackground:!0,linewidth:1,points:[this._rectangle.min,this._rectangle.max],extendLeft:!1,extendRight:!1};return this._renderer.setData(i),this._renderer}}var at=i(76553),lt=i(62159),ct=i(85421),ht=i(1953),dt=i(76559),ut=i(6397),pt=i(44896),_t=i(87088),mt=i(71172);const gt=(0,oe.t)("{count} bars"),ft=(0,oe.t)("Vol"),vt=new lt.PercentageFormatter,St=new ht.TimeSpanFormatter,yt=new dt.VolumeFormatter,bt=(0,a.getHexColorByName)("color-tv-blue-500"),wt=(0,a.getHexColorByName)("color-ripe-red-400"),Pt={bgColorPositive:(0,ye.generateColor)(bt,80),bgColorNegative:(0,ye.generateColor)(wt,80),colorPositive:(0,a.getHexColorByName)("color-tv-blue-600"),colorNegative:(0,a.getHexColorByName)("color-ripe-red-400"),labelBgColorPositive:bt,labelBgColorNegative:wt};class Ct{ constructor(e,t){this._pipFormatter=null,this._lastSymbolInfo=null,this._horzTrenRenderer=new ut.TrendLineRenderer,this._vertTrenRenderer=new ut.TrendLineRenderer,this._bgRenderer=new rt.RectangleRenderer,this._labelRenderer=new pt.TextRenderer,this._p1=null,this._p2=null,this._label=null,this._source=e,this._pane=t}update(){const[e,t]=this._source.measurePoints();if(void 0===t)return this._p1=null,void(this._p2=null);const i=(0,r.ensureNotNull)(this._source.measurePane()),s=e.price,o=t.price,a=t.price-s,l=t.index-e.index,c=(0,at.forceLTRStr)(""+l),h=(0,r.ensureNotNull)(i.mainDataSource());let d=(0,r.ensureNotNull)(h.formatter()).format(a);if(Math.abs(s)>1e-8){const e=a/Math.abs(s);d+=" ("+vt.format(100*e)+")"}const u=(0,at.forceLTRStr)(d);this._label=u+"\n"+gt.format({count:c});const p=(0,r.ensureNotNull)(h.firstValue()),_=this._source.model().timeScale().indexToCoordinate(e.index),m=this._source.model().timeScale().indexToCoordinate(t.index),g=i.defaultPriceScale().priceToCoordinate(s,p),f=i.defaultPriceScale().priceToCoordinate(o,p);this._p1=new n.Point(_,g),this._p2=new n.Point(m,f);const v=this._source.model().timeScale().indexToUserTime(e.index),S=this._source.model().timeScale().indexToUserTime(t.index);let y=null;if(null!==v&&null!==S){const e=this._pane.model().mainSeries().symbolInfo();null!==e&&e!==this._lastSymbolInfo&&(this._pipFormatter=new ct.PipFormatter(e.pricescale,e.minmov,e.type,e.minmove2),this._lastSymbolInfo=e),y=(S.valueOf()-v.valueOf())/1e3}const b=this._pipFormatter?this._pipFormatter.format(a):null,w=null!==b?" , "+b:"",P=null!==y?St.format(y):null,C=null!==P?", "+(0,at.startWithLTR)(P):"";this._label=(0,at.forceLTRStr)(u+w)+"\n"+gt.format({count:c})+C;const x=this._source.measureVolume();Number.isNaN(x)||(this._label+=`\n${ft} ${yt.format(x)}`);const I=o=50?mt.LineEnd.Arrow:mt.LineEnd.Normal};this._horzTrenRenderer.setData(s)}{const e=Math.round(k.x),t=new n.Point(e,this._p1.y),i=new n.Point(e,this._p2.y),s={points:[t,i],color:M,linewidth:1,linestyle:Je.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:mt.LineEnd.Normal,rightend:Math.abs(t.y-i.y)>=50?mt.LineEnd.Arrow:mt.LineEnd.Normal};this._vertTrenRenderer.setData(s)}const E={x:0,y:10},D=.5*(this._p1.x+this._p2.x),V=this._p2.y,B=new n.Point(D,V),N=(R=(0,r.ensureNotNull)(this._label),{points:[B],text:R,color:"#FFFFFF",horzAlign:"center",vertAlign:"middle",font:T.CHART_FONT_FAMILY,offsetX:E.x,offsetY:E.y,bold:!1,italic:!1,fontsize:12,padding:8,highlightBorder:!1,backgroundColor:L, backgroundTransparency:10,backgroundVertInflate:5,backgroundHorzInflate:5,backgroundRoundRect:4});var R;this._labelRenderer.setData(N);const O=this._labelRenderer.measure(),F=(0,pt.calculateLabelPosition)(O,this._p1,this._p2,E,this._pane.height());this._labelRenderer.setPoints([F])}renderer(){if(null===this._p1||null===this._p2)return null;const e=new _t.CompositeRenderer;return e.append(this._bgRenderer),e.append(this._horzTrenRenderer),e.append(this._vertTrenRenderer),e.append(this._labelRenderer),e}}var Tt=i(58729);class xt extends Tt.ScaledPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){e.translate(this._data.x-this._data.width/2,this._data.y-this._data.height/2),e.strokeStyle="rgba(153,153,153,.3)",e.lineWidth=2,e.beginPath(),this._drawShackle(e),e.stroke(),e.closePath(),e.strokeStyle="rgba(153,153,153,.7)",e.lineWidth=1,e.beginPath(),e.rect(0,this._data.height-this._data.bodyHeight+.5,this._data.width,this._data.bodyHeight),e.closePath(),e.stroke(),e.translate(0,-1),e.strokeStyle="#777",e.beginPath(),this._drawShackle(e),e.stroke(),e.closePath(),e.fillStyle="rgba(255,255,255,.7)",e.beginPath(),e.rect(1,this._data.height-this._data.bodyHeight+1.5,this._data.width-2,this._data.bodyHeight-2),e.fill(),e.beginPath(),e.rect(.5,this._data.height-this._data.bodyHeight+1,this._data.width-1,this._data.bodyHeight-1),e.stroke(),e.closePath(),e.fillStyle="#777",e.fillRect(this._data.width/2-.5,this._data.height-this._data.bodyHeight/2,1,2)}_drawShackle(e){const t=(this._data.width-3)/2,i=this._data.height-this._data.bodyHeight;e.moveTo(1.5,t),e.arc(this._data.width/2,t,t,Math.PI,2*Math.PI),i>t&&(e.moveTo(1.5,t),e.lineTo(1.5,i),e.moveTo(this._data.width-1.5,t),e.lineTo(this._data.width-1.5,i))}}class It{constructor(e,t,i){this._horzVisible=!1,this._source=e,this._pane=t,this._axis=i||"x"}update(){}renderer(e,t){const i=this._source.visible&&this._source.areLinesVisible,s=(0,ve.lockTimeAxis)().value(),n=i&&this._horzVisible,o=i||s;if("y"===this._axis&&!n||!o)return null;const a="y"===this._axis?this._pane.width()-4.5:(0,r.ensureDefined)(this._source.lockedX)+1,l="y"===this._axis?this._source.y:this._pane.height()-5.5-1;return new xt({x:a,y:l,width:9,height:11,bodyHeight:7})}}var Mt=i(43367),Lt=i(92932),At=i(62043);const kt=(0,oe.t)("n/a");class Et extends At.DataWindowView{constructor(e){super(),this._invalidated=!0,this._dateItem=new At.DataWindowItem((0,oe.t)("Date"),""),this._timeItem=new At.DataWindowItem((0,oe.t)("Time"),""),this._model=e,this._items.push(this._dateItem),this._items.push(this._timeItem)}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}_updateImpl(){const e=this._model.mainSeries().isDWM();if(this._timeItem.setVisible(!e),this._timeItem.setValue(kt),this._dateItem.setValue(kt),this._model.timeScale().isEmpty())return;let t=this._model.crossHairSource().appliedIndex();if(!(0,xe.isNumber)(t)){const e=this._model.mainSeries().data().last();if(null===e)return;t=e.index} const i=this._model.timeScale().indexToUserTime(t);null!==i&&(this._dateItem.setValue(this._model.dateFormatter().format(i)),e||this._timeItem.setValue(this._model.timeFormatter().format(i)))}}var Dt=i(87758);class Vt extends Dt.TimeAxisView{constructor(e,t,i=!1){super(e),this._indexProvider=t,this._highlighted=i,this._properties=e.properties().childs().scalesProperties}_getBgColor(){const e=this._model.isDark();return this._highlighted?this._properties.childs().axisLineToolLabelBackgroundColorCommon.value():e?a.colorsPalette["color-cold-gray-750"]:a.colorsPalette["color-cold-gray-900"]}_getIndex(){return this._model.crossHairSource().visible?this._indexProvider():null}_isVisible(){return this._properties.childs().showTimeScaleCrosshairLabel.value()}}var Bt=i(96370);const Nt={menuEnabled:!1,menuForMainSourceOnly:!1,disableTradingMenuActions:!1,disableDrawHorizLineMenuAction:!1};class Rt extends Ne.DataSource{constructor(e,t,i){super(),this.pane=null,this.price=NaN,this.index=NaN,this.visible=!0,this.areLinesVisible=!0,this.x=NaN,this.y=NaN,this._measuringEnabled=new(F()),this._measurePane=null,this._startMeasurePoint=null,this._endMeasurePoint=null,this._lastValidMeasurePoint=null,this._isOnHoveredChartWidget=!1,this._selectPointMode=new(H())(!1),this._selectionPane=null,this._selectionView=new ot(this),this._selectionStartPoint=null,this._measurePaneView=null,this._timeLockPaneView=null,this._priceAxisViews=new Map,this._panePriceAxisViews=new Map,this._startMeasurePriceAxisViews=new Map,this._endMeasurePriceAxisViews=new Map,this._originX=NaN,this._originY=NaN,this._subscribed=!1,this._movedDelegate=new(F()),this._pointSelectedDelegate=new(F()),this._requestedPoint=null,this._paneForRequestedPoint=null,this._selectLineColor=null,this._volumeCalculator=null,this._model=e,this._options=Object.assign({},Nt,i||{}),this._linesShouldBeHidden=this._model.readOnly(),this._dataWindowView=new Et(e),this.setSelectionEnabled(!1);const s=e=>t=>t===(0,r.ensureNotNull)(this._measurePane).defaultPriceScale()?e():null;this._currentPosPriceProvider=e=>{const t=(0,r.ensureNotNull)(this.pane);if(e===t.defaultPriceScale())return this.price;const i=(0,r.ensureNotNull)(t.defaultPriceScale().mainSource()).firstValue();if(null===i)return null;const s=t.defaultPriceScale().priceToCoordinate(this.price,i),n=(0,r.ensureNotNull)(e.mainSource()).firstValue();return null===n?null:e.coordinateToPrice(s,n)},this._startMeasurePriceProvider=s(()=>(0,r.ensureNotNull)(this._startMeasurePoint).price),this._endMeasurePriceProvider=s(()=>(0,r.ensureNotNull)(this._lastMeasurePoint()).price),this._properties=t;this._timeAxisView=new Vt(e,()=>this.appliedIndex(),!1),this._startMeasureTimeAxisView=new Vt(e,()=>(0,r.ensureNotNull)(this._startMeasurePoint).index,!0),this._endMeasureTimeAxisView=new Vt(e,()=>(0,r.ensureNotNull)(this._lastMeasurePoint()).index,!0),e.readOnly()||ve.cursorTool.subscribe(e=>this.areLinesVisible="arrow"!==e,{callWithLast:!0})}destroy(){null!==this._volumeCalculator&&this._volumeCalculator.destroy()}moved(){return this._movedDelegate }originX(){return this._originX}originY(){return this._originY}saveOriginCoords(e,t){this._originX=e,this._originY=t}clearOriginCoords(){this._originX=NaN,this._originY=NaN}currentPoint(){return new n.Point(this.x,this.y)}model(){return this._model}appliedIndex(){return Number.isFinite(this.lockedIndex)?this.lockedIndex:this.index}startMeasurePoint(){return this._startMeasurePoint||null}endMeasurePoint(){return this._endMeasurePoint||null}measureVolume(){if(null===this._volumeCalculator)return NaN;const[e,t]=this.measurePoints();return void 0===t?NaN:this._volumeCalculator.volume(e.index,t.index)}measurePane(){return this._measurePane||null}startMeasuring(e,t){this._startMeasurePoint=e,this._measurePane=t,this._measuringEnabled.fire(!0),t.containsMainSeries()&&((0,r.assert)(null===this._volumeCalculator),this._volumeCalculator=new Bt.SeriesTimeRangeVolumeCalculator(this.model().mainSeries())),this._model.updatePane(t)}finishMeasure(e){this._endMeasurePoint=e}clearMeasure(){delete this._measurePane,delete this._startMeasurePoint,delete this._endMeasurePoint,delete this._lastValidMeasurePoint,this._model.lightUpdate(),null!==this._volumeCalculator&&(this._volumeCalculator.destroy(),this._volumeCalculator=null),this._measuringEnabled.fire(!1)}measuringEnabled(){return this._measuringEnabled}measurePoints(){this.updateAllViews();const e=[(0,r.ensureNotNull)(this._startMeasurePoint)],t=this._lastMeasurePoint();return null!==t&&e.push(t),e}startSelection(e){this._selectionStartPoint=this.currentLogicalPoint(),this._selectionPane=e}clearSelection(){this._selectionStartPoint=null,this._selectionPane=null}selection(){return this._selectionStartPoint?{p1:this._selectionStartPoint,p2:this.currentLogicalPoint()}:null}currentLogicalPoint(){return{index:this.appliedIndex(),price:this.price}}selectPointMode(){return this._selectPointMode}lineColor(){return this._selectLineColor}cancelRequestSelectPoint(){this._selectPointMode.value()&&this._setSelectPointModeState(!1)}requestSelectPoint(e){(0,r.assert)(!this._selectPointMode.value(),"Point already requested");const{pointType:t,pane:i,lineColor:s=null}=e;i&&((0,r.assert)(-1!==this._model.panes().indexOf(i),"Chartmodel doesn't contains specified pane"),this._paneForRequestedPoint=i,this._model.panesCollectionChanged().subscribe(this,this._paneCollectionChanged)),this._selectLineColor=s,this._requestedPoint=t,this._setSelectPointModeState(!0)}onPointSelected(){return this._pointSelectedDelegate}trySelectCurrentPoint(){const e=(0,r.ensureNotNull)(this._requestedPoint);if(!this._model.mainSeries().bars().contains(this.index)&&"price"!==e)return;const t=(0,r.ensureNotNull)(this.pane);if(this._paneForRequestedPoint&&this._paneForRequestedPoint!==t)return;let i,s;if("price"===e||(i=this._model.timeScale().indexToTimePoint(this.index),null!==i)){if("time"!==e){const e=t.mainDataSource();if(null===e)return;const i=e.firstValue(),r=e.priceScale();if(null===i||null===r)return;s=r.coordinateToPrice(this.y,i)}this._setSelectPointModeState(!1),this._pointSelectedDelegate.fire({time:i,price:s},t)} }isOnHoveredChartWidget(){return this._isOnHoveredChartWidget}setOnHoveredChartWidget(e){this._isOnHoveredChartWidget=e}clearPosition(){this.visible=!1,this.index=NaN,this.price=NaN,this.x=NaN,this.y=NaN,this.pane=null,this.clearOriginCoords()}setPosition(e,t,i){return this._subscribed||(this._model.mainSeries().onRestarted().subscribe(this,this.clearMeasure),this._subscribed=!0),this.setLockedPosition(i),this.visible=!0,this._tryToUpdateViews(e,t,i)}setLinesShouldBeHidden(e){this._linesShouldBeHidden=e}linesShouldBeHidden(){return this._linesShouldBeHidden}handleContextMenuEvent(e){this._selectPointMode.value()&&this._setSelectPointModeState(!1)}properties(){return this._properties}priceAxisViews(e,t){const i=null===this._requestedPoint||"time"!==this._requestedPoint||!this._isOnHoveredChartWidget,s=[];return this.pane===e&&i&&s.push(this._createPriceAxisViewOnDemand(this._priceAxisViews,this._panePriceAxisViews,e,t,this._currentPosPriceProvider,qe,!0)[0]),this._startMeasurePoint&&s.push(this._createPriceAxisViewOnDemand(this._startMeasurePriceAxisViews,null,e,t,this._startMeasurePriceProvider,Ye)[0]),this._lastMeasurePoint()&&s.push(this._createPriceAxisViewOnDemand(this._endMeasurePriceAxisViews,null,e,t,this._endMeasurePriceProvider,Ye)[0]),s}timeAxisViews(){const e=[],t=null===this._requestedPoint||"price"!==this._requestedPoint||!this._isOnHoveredChartWidget;return!this._linesShouldBeHidden&&(this.visible||(0,ve.lockTimeAxis)().value())&&t&&e.push(this._timeAxisView),this._startMeasurePoint&&e.push(this._startMeasureTimeAxisView),this._lastMeasurePoint()&&e.push(this._endMeasureTimeAxisView),e}paneViews(e){if(void 0===e)return null;const t=[new st(this,e)];if(e===this._selectionPane&&t.push(this._selectionView),e===this._measurePane&&(null===this._measurePaneView&&(this._measurePaneView=new Ct(this,e)),this._measurePaneView.update(),t.push(this._measurePaneView)),Lt.addPlusButtonProperty.value()){const i=e===this.pane,s=!Mt.CheckMobile.any()||window.screen.width>=320,r=ve.tool.value(),n=(0,m.isLineToolName)(r),o=null!==this._model.lineBeingEdited()||null!==this._model.lineBeingCreated()||this._model.sourcesBeingMoved().length>0||null!==this._model.customSourceBeingMoved()||(0,ve.toolIsMeasure)(r);if(i&&this._isOnHoveredChartWidget&&!this._selectPointMode.value()&&s&&!n&&!o){const i=e.mainDataSource();if(null!==i){const s=i.priceScale();if(null!==s){const i=this._createPriceAxisViewOnDemand(this._priceAxisViews,this._panePriceAxisViews,e,s,this._currentPosPriceProvider,qe,!0)[1];null!==i&&t.push(i)}}}}return(0,ve.lockTimeAxis)().value()&&(null===this._timeLockPaneView&&(this._timeLockPaneView=new It(this,e)),t.push(this._timeLockPaneView)),t}dataWindowView(){return this._dataWindowView}updateAllViews(){this._priceAxisViews.forEach(e=>{e.forEach(e=>e.update())}),this._panePriceAxisViews.forEach(e=>{e.forEach(e=>e.update())}),this._startMeasurePoint&&(this._startMeasurePriceAxisViews.forEach(e=>{e.forEach(e=>e.update())}),this._startMeasureTimeAxisView.update()), this._lastMeasurePoint()&&(this._endMeasurePriceAxisViews.forEach(e=>{e.forEach(e=>e.update())}),this._endMeasureTimeAxisView.update()),this._timeAxisView.update(),this._selectionView.update(),this._dataWindowView.update()}setLockedPosition(e){delete this.lockedIndex,delete this.lockedX,e!==this._measurePane&&(0,ve.lockTimeAxis)().value()&&(this.lockedIndex=this._model.timeScale().points().roughIndex(ve.lockTimeAxisTime.value()),null!==this.lockedIndex&&(this.lockedX=this._model.timeScale().indexToCoordinate(this.lockedIndex)))}isMenuEnabled(){return this._options.menuEnabled}isHoveredEnabled(){return Lt.addPlusButtonProperty.value()}isHovered(){return this._model.hoveredSource()===this}pointToSelect(){return this._requestedPoint}paneForPointSelect(){return this._paneForRequestedPoint}_lastMeasurePoint(){return this._endMeasurePoint?this._endMeasurePoint:(null!==this.pane&&this._measurePane===this.pane&&(this._lastValidMeasurePoint={price:this._model.magnet().align(this.price,this.index,this.pane),index:this.index}),this._lastValidMeasurePoint||null)}_createPriceAxisViewOnDemand(e,t,i,s,n,o,a=!1){let l=e.get(i),c=null!==t?t.get(i):void 0;void 0===l&&(l=new Map,e.set(i,l),this._options.menuEnabled&&null!==t&&(c=new Map,t.set(i,c)),a&&i.onDestroyed().subscribe(this,()=>this._onPaneDestroyed(i)));let h=l.get(s);if(void 0===h){if(h=new o(this,s,n),l.set(s,h),void 0!==c){const e=new Ze(h,this,s,this._model,this._options);c.set(s,e)}a&&s.lastSourceRemoved().subscribe(this,()=>this._onPriceScaleCleared(s))}let d=null;return void 0!==c&&(d=(0,r.ensureDefined)(c.get(s))),[h,d]}_onPaneDestroyed(e){e.onDestroyed().unsubscribeAll(this),this._priceAxisViews.delete(e),this._panePriceAxisViews.delete(e),this._startMeasurePriceAxisViews.delete(e),this._endMeasurePriceAxisViews.delete(e)}_onPriceScaleCleared(e){e.lastSourceRemoved().unsubscribeAll(this),this._priceAxisViews.forEach(t=>t.delete(e)),this._panePriceAxisViews.forEach(t=>t.delete(e)),this._startMeasurePriceAxisViews.forEach(t=>t.delete(e)),this._endMeasurePriceAxisViews.forEach(t=>t.delete(e))}_tryToUpdateViews(e,t,i){return!!this._tryToUpdateData(e,t,i)&&(this.updateAllViews(),this._movedDelegate.fire({index:this.index,price:this.price}),!0)}_tryToUpdateData(e,t,i){const s=this.x,n=this.y,o=this.price,a=this.index,l=this.pane,c=this._priceScaleByPane(i);if(this.index=e,this.x=isNaN(e)?NaN:this._model.timeScale().indexToCoordinate(e),null!==c&&null!==i){this.pane=i,this.price=t;const e=(0,r.ensureNotNull)(i.mainDataSource()).firstValue();this.y=null===e?NaN:c.priceToCoordinate(t,e)}else this.pane=null,this.price=NaN,this.y=NaN;return s!==this.x||n!==this.y||a!==this.index||o!==this.price||l!==this.pane}_priceScaleByPane(e){return e&&!e.defaultPriceScale().isEmpty()?e.defaultPriceScale():null}_setSelectPointModeState(e){e||(this._requestedPoint=null,this._selectLineColor=null,this._paneForRequestedPoint&&(this._paneForRequestedPoint=null,this._model.panesCollectionChanged().unsubscribe(this,this._paneCollectionChanged))),ve.isPointSelectedNow.setValue(e), this._selectPointMode.setValue(e),this._model.lightUpdate()}_paneCollectionChanged(e){const t=this._paneForRequestedPoint;null!==t&&-1===e.indexOf(t)&&this.cancelRequestSelectPoint()}}var Ot=i(95975);const Ft=(0,G.getLogger)("Chart.ChartModel");function Wt(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}function Ht(e){var t,i;for(let s=e.length;s--;){const r=e[s].dataSources();for(let e=r.length;e--;)null===(t=r[e].dataWindowView())||void 0===t||t.update();const n=e[s].priceDataSources();for(let e=n.length;e--;)null===(i=n[e].legendView())||void 0===i||i.update()}}const zt={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,shiftVisibleRangeOnNewBar:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,lastPriceAnimationEnabled:!0,onWidget:!1,hideIdeas:!1};class Ut{constructor(e,t,i,r,n,o,a,c,h,d){this._onRearrangePanes=new(F()),this._lineToolsGroupModel=new fe.LineToolsGroupModel,this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,this._lineBeingEdited=null,this._linePointBeingEdited=null,this._linePointBeingChanged=null,this._customSourceBeingMovedHitTestData=null,this._customSourceBeingMoved=null,this._dataSourceCollectionChanged=new(F()),this._sourceProperitesChanged=new(F()),this._sourceZOrderChanged=new(F()),this._symbolSourceResolved=new(F()),this._symbolSourceResolvingActive=new(H())(!1),this._adjustForDividendsAvailability=new(H())(0),this._adjustForDividendsEnabled=new(H())(!1),this._sessions=null,this._currentTool="",this._lineBeingCreated=null,this._paneBeingCreatedLineOn=null,this._lineCancelled=new(F()),this._phantomSourceContainer=new Ie(this),this._destroyed=!1,this._isSettingsExternalPosition=!1,this._isTimeScrolling=!1,this._magnet=new ke,this._scrollingState=null,this._modelIntervals=[],this._rendererOptionsProvider=new x(this),this._cachedStudiesMaxOffset=0,this._panes=[],this._tagsChanged=new(F()),this._strategySources=[],this._strategySourcesChange=new(F()),this._activeStrategySource=new(H())(null),this._panesCollectionChanged=new(F()),this._scrollEnabled=E.enabled("chart_scroll"),this._zoomEnabled=E.enabled("chart_zoom"),this._isScalesResetAvailableChanged=new(F()),this._isScalesResetAvailable=!1,this._esdWatcher=null,this._alertsWatcher=null,this._hoveredSource=null,this._hoveredSourceChanged=new(F()),this._lastHoveredHittestData=null,this._lastSelectedHittestData=null,this._topmostCustomSources=[],this._fgCustomSources=[],this._bgCustomSources=[],this._allCustomSources=[],this._customSourcesMap=new Map,this._multiPaneSources=[],this._showLegendProperty=new(P()),this._id=(0,Se.guid)(),this._chartSaveTime=null,this._availableCurrenciesList=null,this._availableCurrencies=new Ce([]),this._availableUnitsObject=null,this._availableUnits=new Te({}),this._shouldBeSavedEvenIfHidden=!1,this._watchedThemeSpawn=l.watchedTheme.spawn(),this._gradientColorsCache=null,this._recalcVRStudiesParams={},this._recalcColorStudiesParams={},this._recalcVisibleRangeStudiesImplDebounced=(0,s.default)(this._recalcVisibleRangeStudiesImpl.bind(this,this._recalcVRStudiesParams),500), this._recalcColorStudiesImplDebounced=(0,s.default)(this._recalcColorStudiesImpl.bind(this,this._recalcColorStudiesParams),250),this._width=0,this._resetScales=new(F()),this._chartThemeLoaded=new(F()),this._selection=new g,this._selectedSourceChanged=new(F()),this._symbolSourceCollectionChanged=new(F()),this._gridSource=new He,this._clearSelection=()=>{this._lastSelectedHittestData=null,this._selection.clear()},this._removeSourceFromSelection=e=>{this._selection.remove(e)},this._addSourceToSelection=(e,t)=>{const i=this._selection.isSelected(e);i&&this._lastSelectedHittestData===t||e&&!e.isSelectionEnabled()||(this._lastSelectedHittestData=t||null,i||this._selection.add(e))},this._recalcSymbolResolvingActive=()=>{for(const e of this._panes)if(e.symbolSourceResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._recalcAdjustForDividendsAvailibility=()=>{var e,t,i,s;if(this._symbolSourceResolvingActive.value())return void this._adjustForDividendsAvailability.setValue(0);const r=this.mainSeries();switch(null!==(t=null===(e=r.symbolInfo())||void 0===e?void 0:e.allowed_adjustment)&&void 0!==t?t:"none"){case"dividends":return void this._adjustForDividendsAvailability.setValue(2);case"splits":return void this._adjustForDividendsAvailability.setValue(1);case"any":return void this._adjustForDividendsAvailability.setValue(3)}for(const e of this.symbolSources()){if(e.symbolHibernated().value()||e===r)continue;if("any"===(null!==(s=null===(i=e.symbolInfo())||void 0===i?void 0:i.allowed_adjustment)&&void 0!==s?s:"none"))return void this._adjustForDividendsAvailability.setValue(3)}this._adjustForDividendsAvailability.setValue(0)},this._recalcAdjustForDividendsEnabled=()=>{switch(this._adjustForDividendsAvailability.value()){case 2:return void this._adjustForDividendsEnabled.setValue(!0);case 0:case 1:return void this._adjustForDividendsEnabled.setValue(!1)}this._adjustForDividendsEnabled.setValue(this.mainSeries().properties().childs().dividendsAdjustment.value())},this._chartApi=e,this._invalidateHandler=t,this._undoModel=o,this._properties=i,this._options=(0,$.merge)((0,$.clone)(zt),c),this._collapsedWV=h,this._isAutoSaveEnabled=d,this._studiesMetaInfoRepository=n,this._readOnly=this._options.readOnly,this._isSnapshot=this._options.isSnapshot,this._chartSaveTime=(new Date).valueOf(),this._backgroundColor=new(H())(this._getBackgroundColor()),this._backgroundTopColor=new(H())(this._getBackgroundColor(!0)),this._properties.childs().paneProperties.childs().background.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundType.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.subscribe(this,this._updateBackgroundColor),this._backgroundColor.subscribe(this.recalcColorStudies.bind(this,!1)), this._backgroundTopColor.subscribe(this.recalcColorStudies.bind(this,!1)),this._watchedThemeSpawn.subscribe(this._updateBackgroundColor.bind(this)),this._symbolSourceResolvingActive.subscribe(this._recalcAdjustForDividendsAvailibility),this.setStudiesMetaData(this._studiesMetaInfoRepository.getInternalMetaInfoArray(),this._studiesMetaInfoRepository.getMigrations()),(0,ve.init)();const u=this._readOnly?new(P())((0,A.defaults)("chartproperties.paneProperties.crossHairProperties")):this._properties.childs().paneProperties.childs().crossHairProperties;this.m_crossHairSource=new Rt(this,u,this._options.crossHair),this.m_crossHairSource.selectPointMode().subscribe(e=>{if(e&&this.lineBeingCreated()){const e=ve.tool.value();this.cancelCreatingLine(),ve.tool.setValue(e)}}),this._tagsChanged=new(F());const p=new b.DefaultProperty("chartproperties.mainSeriesProperties");p.addExclusion("minTick"),p.addExclusion("priceAxisProperties.lockScale"),p.addExclusion("priceAxisProperties.percentage"),p.addExclusion("priceAxisProperties.indexedTo100"),p.addExclusion("priceAxisProperties.isInverted"),p.addExclusion("priceAxisProperties.log"),p.addExclusion("priceAxisProperties.logDisabled"),p.addExclusion("priceAxisProperties.percentageDisabled"),p.addExclusion("priceAxisProperties.autoScaleDisabled"),p.merge(i.childs().mainSeriesProperties.state()),this._timeScale=new ue(this,this._options.timeScale);const _={countdownEnabled:this._options.countdownEnabled,lastPriceAnimationEnabled:this._options.lastPriceAnimationEnabled};this.m_mainSeries=new Ot.Series(this,p,_,r),this.m_mainSeries.onStyleChanged().subscribe(this._timeScale,this._timeScale.invalidateVisibleBars);const m=()=>this.fullUpdate();this.m_mainSeries.properties().childs().showCountdown.subscribe(this,()=>{this.m_mainSeries.updateAllViews(),m()});const f=i.childs().scalesProperties.childs();f.showCurrency.subscribe(this,m),f.showUnit.subscribe(this,m),this._timeScale.visibleBarsStrictRangeChanged().subscribe(this.m_mainSeries,this.m_mainSeries.clearHighLowAvgPriceCache),this.createPane(void 0,{axisProperties:p.childs().priceAxisProperties.state(["autoScale"])}),this._adjustForDividendsAvailability.subscribe(this._recalcAdjustForDividendsEnabled),this.mainSeries().properties().childs().dividendsAdjustment.subscribe(this,this._recalcAdjustForDividendsEnabled),this._recalcAdjustForDividendsEnabled(),this._boundUpdateStudiesMaxOffset=this._updateStudiesMaxOffset.bind(this)}setStudiesMetaData(e,t){this._studiesMetaData=e,this._studyVersioning=new(v())(this._studiesMetaData,t)}version(){return 3}collapsed(){return this._collapsedWV}chartSaveTime(){return this._chartSaveTime}setChartSaveTime(e){this._chartSaveTime=e}destroy(){this._phantomSourceContainer.destroy(),this._hoveredSourceChanged.destroy(),null!==this._watermarkSource&&(this._watermarkSource.destroy(),this._watermarkSource=null),Array.from(this._customSourcesMap.keys()).forEach(this._removeCustomSource,this),(0,r.assert)(0===this._topmostCustomSources.length),(0,r.assert)(0===this._fgCustomSources.length),(0, r.assert)(0===this._bgCustomSources.length),(0,r.assert)(0===this._allCustomSources.length),(0,r.assert)(0===this._customSourcesMap.size),null!==this._esdWatcher&&(this._esdWatcher.destroy(),this._esdWatcher=null),null!==this._alertsWatcher&&(this._alertsWatcher.destroy(),this._alertsWatcher=null),this._properties.childs().paneProperties.childs().background.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundType.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.unsubscribeAll(this),this._watchedThemeSpawn.destroy(),this._lastHoveredHittestData=null,this._lastSelectedHittestData=null,this._destroyed=!0}undoModel(){return this._undoModel}addStrategySource(e,t){1!==t&&-1===this._strategySources.indexOf(e)&&(this._strategySources.push(e),this._strategySourcesChange.fire(t),this.setActiveStrategySource(e))}removeStrategySource(e,t){if(1===t)return;const i=this._strategySources.indexOf(e);if(-1!==i){if(this._strategySources.splice(i,1)[0]===this._activeStrategySource.value()&&this.unsetActiveStrategySource(),this._strategySources.length>0){const e=this._strategySources[this._strategySources.length-1];this.setActiveStrategySource(e)}this._strategySourcesChange.fire(t)}}setActiveStrategySource(e){-1!==this._strategySources.indexOf(e)&&this._activeStrategySource.setValue(e)}unsetActiveStrategySource(){this._activeStrategySource.setValue(null)}activeStrategySource(){return this._activeStrategySource}strategySources(){return this._strategySources}strategySourcesChange(){return this._strategySourcesChange}setScrollEnabled(e){this._scrollEnabled=e}scrollEnabled(){return this._scrollEnabled}setZoomEnabled(e){this._zoomEnabled=e}zoomEnabled(){return this._zoomEnabled}zoomToViewport(e,t,i,s,r){this.setTimeViewport(e,t);let n=Math.min(i,s),o=Math.max(i,s);const a=r.defaultPriceScale();a.isPercentage()||a.setMode({autoScale:!1}),a.isLog()&&(n=a.priceToLogical(n),o=a.priceToLogical(o)),a.setPriceRange(new Ee.PriceRange(n,o)),this.recalculateAllPanes(),this.invalidate(this._paneInvalidationMask(r,z.InvalidationLevel.Light)),this._setScalesResetAvailable(!0)}setTimeViewport(e,t){this.timeScale().zoomToBarsRange(e,t),this.recalculateAllPanes(),this.recalcVisibleRangeStudies(),this.lightUpdate()}onTagsChanged(){return this._tagsChanged}canZoomIn(){return this._timeScale.canZoomIn()&&this._zoomEnabled}canZoomOut(){return this._timeScale.canZoomOut()&&this._zoomEnabled}onPaneTagsChanged(){this._tagsChanged.fire()}panesCollectionChanged(){return this._panesCollectionChanged}dataSourceCollectionChanged(){return this._dataSourceCollectionChanged}symbolSourceCollectionChanged(){return this._symbolSourceCollectionChanged}symbolSourceResolved(){return this._symbolSourceResolved}symbolSourceResolvingActive(){return this._symbolSourceResolvingActive}adjustForDividendsAvailability(){return this._adjustForDividendsAvailability}adjustForDividendsEnabled(){ return this._adjustForDividendsEnabled}sourcePropertiesChanged(){return this._sourceProperitesChanged}sourceZOrderChanged(){return this._sourceZOrderChanged}updateCrosshairPositionByOriginCoords(){const e=this.crossHairSource(),t=e.pane;let i=e.originX(),s=e.originY();if(Number.isFinite(i)||(i=e.x,s=e.y),null!==t&&Number.isFinite(i)&&Number.isFinite(s)){const e=this._timeScale.coordinateToVisibleIndex(i);let n=NaN;const o=t.defaultPriceScale();if(!o.isEmpty()){const e=(0,r.ensureNotNull)(t.mainDataSource()).firstValue();null!==e&&(n=o.coordinateToPrice(s,(0,r.ensureNotNull)(e)))}this.crossHairSource().setPosition(e,n,t)&&this._undoModel.chartWidget().isActive()&&this._syncCrosshair()}}zoomTime(e,t,i){if(!this._zoomEnabled)return;const s=this.timeScale();if(s.isEmpty()||0===t)return;const r=s.width();e=Math.max(1,Math.min(e,r-2)),s.zoom(e,t,i),this.recalculateAllPanes(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._setScalesResetAvailable(!0)}linePointBeingEdited(){return this._linePointBeingEdited}activeItemBeingMoved(){return this._activeItemBeingMoved}linePointBeingChanged(){return this._linePointBeingChanged}updateAllPaneViews(){for(const e of this._panes)e.updateAllViews();for(const e of this.barsMarksSources())e.updateAllViews()}dataSources(){const e=[this.crossHairSource()];for(const t of this._panes)for(const i of t.dataSources())e.push(i);return e}priceDataSources(){const e=[];for(const t of this._panes)for(const i of t.priceDataSources())e.push(i);return e}symbolSources(){const e=[];for(const t of this._panes)for(const i of t.symbolSources())e.push(i);return e}selection(){return this._selection}selectionMacro(e){const t=this.selection().allSources();e({removeSourceFromSelection:this._removeSourceFromSelection,addSourceToSelection:this._addSourceToSelection,clearSelection:this._clearSelection,selection:this.selection.bind(this)});const i=(0,_.subtract)(t,this.selection().allSources()),s=(0,_.subtract)(this.selection().allSources(),t);s.concat(t).forEach(e=>e.updateAllViews()),i.forEach(e=>{const t=(0,m.isLineTool)(e)&&e.hasAlert.value()&&e.getAlertSync();t&&t.set("selected",!1)}),s.forEach(e=>{const t=(0,m.isLineTool)(e)&&e.hasAlert&&e.hasAlert.value()&&e.getAlertSync();t&&t.set("selected",!0)}),this.lightUpdate(),(i.length>0||s.length>0)&&this._selectedSourceChanged.fire()}onSelectedSourceChanged(){return this._selectedSourceChanged}checkLineToolSelection(){this._selection.checkLineToolSelection()}lineToolsGroupModel(){return this._lineToolsGroupModel}restoreLineToolsGroups(e){this._lineToolsGroupModel=fe.LineToolsGroupModel.fromState(this,e)}realignLineTools(){for(const e of this._panes)e.realignLineTools()&&this._dataSourceCollectionChanged.fire(e)}isSnapshot(){return this._isSnapshot}onWidget(){return this._options.onWidget}hideIdeas(){return this._options.hideIdeas}updateSource(e){const t=this._invalidationMaskForSource(e);null!==t&&this.invalidate(t)}updateSourcePriceScale(e){const t=this._invalidationMaskForSourcePriceScale(e);null!==t&&this.invalidate(t)}updatePane(e){ this.invalidate(this._paneInvalidationMask(e))}replaceStudyStub(e,t){const i=this.paneForSource(e);if(null===i)return!1;const s=e.priceScale(),r=e.zorder(),n=e.ownerSource();return this.paneForSource(e)===i?i.replaceSource(e,t,s):(i.insertDataSource(t,s,r),this.removeSource(e)),t.setOwnerSource(n),this.dataSources().forEach(i=>{i.ownerSource()===e&&i.setOwnerSource(t)}),t.start(),this.recalculatePane(i),this.fullUpdate(),!0}insertStudyStub(e){const t=this.mainSeries(),i=(0,r.ensureNotNull)(this.paneForSource(t)),s=new S.StudyStub(this,null,e),n=i.createPriceScaleAtPosition("overlay");return i.addDataSource(s,n,!1),this.recalculatePane(i),this.fullUpdate(),s}removeStudyStub(e){const t=this.dataSourceForId(e);return null===t?(Ft.logNormal("StudyStub id="+e+" is not found in chart model"),!1):(this.removeSource(t),!0)}setHoveredSource(e,t=null){const i=this._hoveredSource!==e;if(!i&&this._lastHoveredHittestData===t)return;this._lastHoveredHittestData=t;let s=null;if(this._hoveredSource){this._hoveredSource.updateAllViews(),s=new z.InvalidationMask(z.InvalidationLevel.Cursor);const e=this._invalidationMaskForSource(this._hoveredSource,z.InvalidationLevel.Light);null!==e&&s.merge(e)}if(this._hoveredSource=e,e){e.updateAllViews(),s||(s=new z.InvalidationMask(z.InvalidationLevel.Cursor));const t=this._invalidationMaskForSource(e,z.InvalidationLevel.Light);null!==t&&s.merge(t)}s&&this.invalidate(s),i&&this._hoveredSourceChanged.fire(e)}properties(){return this._properties}disconnect(){this.sessions().stop();for(const e of this.dataSources())e.disconnect&&e.disconnect();this._timeScale.disconnect()}gridSource(){return this._gridSource}hoveredSource(){return this._hoveredSource}hoveredSourceChanged(){return this._hoveredSourceChanged}lastHittestData(){return this._lastHoveredHittestData}lastSelectedHittestData(){return this._lastSelectedHittestData}syncTimeWithModel(e,t){const i=this.mainSeries().syncModel();if(null===i)return;const s=1e3*this.createSyncPoint((0,r.ensureNotNull)(e.mainSeries().syncModel()),i).sourceTimeToTargetTime(t/1e3),n=(0,De.get_timezone)(this.timezone());let o=(0,De.utc_to_cal)(n,s);this.mainSeries().isDWM()&&(o=i.getSession().spec.correctTradingDay(o),(0,De.set_hms)(o,0,0,0,0,(0,De.get_timezone)("Etc/UTC"))),this._gotoTimeImpl(o.getTime(),{centerIfVisible:!1})}gotoTime(e){return this._gotoTimeImpl(e,{centerIfVisible:!0})}paneForSource(e){if(!(0,p.isDataSource)(e))return Array.from(this._customSourcesMap.values()).includes(e)?this.paneForSource(this.mainSeries()):null;for(let t=this._panes.length-1;t>=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof be.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}removeSource(e,t){this.selectionMacro(t=>t.removeSourceFromSelection(e)),this._hoveredSource===e&&(this._hoveredSource=null,this._lastHoveredHittestData=null),this._sourcesBeingMoved.includes(e)&&(this._sourcesBeingMoved=this._sourcesBeingMoved.filter(t=>t!==e),this._sourcesBeingMoved.length||(this._activeItemBeingMoved=null)), e===this._lineBeingEdited&&(this._lineBeingEdited=null,ve.isToolEditingNow.setValue(!1)),e===this._lineBeingCreated&&(this._lineBeingCreated=null,ve.isToolCreatingNow.setValue(!1)),e.stop&&e.stop();const i=this.detachSource(e),s=this.mainSeries().priceScale();return(0,R.isStudy)(e)&&(0,Be.isSymbolSource)(e)&&e.priceScale()===s&&s.isPercentage()&&1===s.seriesLikeSources().length&&s.setMode({percentage:!1}),this.fullUpdate(),this._invalidateBarColorerCaches(),(0,R.isStudy)(e)&&((0,d.emit)("study_event",e.id(),"remove"),e.isChildStudy()&&e.parentSource().unsetChild(e),e.maxOffset().unsubscribe(this._boundUpdateStudiesMaxOffset)),e.destroy&&e.destroy(),(0,m.isLineTool)(e)&&(e.removeAlert(),(0,d.emit)("drawing_event",e.id(),"remove")),i}allStudies(e){const t=e?e=>(0,R.isStudy)(e)&&!(0,R.isESDStudy)(e):R.isStudy;return this._getAllSources(t)}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const t of i){const i=t.dataSources().find(i=>(0,R.isStudy)(i)&&i.metaInfo().groupingKey===e&&!t.isOverlay(i));if(void 0!==i)return{pane:t,study:i}}return null}movePaneUp(e){this.movePane(e,e-1)}movePaneDown(e){this.movePane(e,e+1)}movePane(e,t){const i=this._panes[e];this._panes.splice(e,1),this._panes.splice(t,0,i),this._panesCollectionChanged.fire(this._panes),this._onRearrangePanes.fire(),this.invalidate(z.InvalidationMask.panesOrder())}backgroundColor(){return this._backgroundColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(e){const t=this.backgroundColor().value(),i=this.backgroundTopColor().value();if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==i||this._gradientColorsCache.bottomColor!==t)this._gradientColorsCache={topColor:i,bottomColor:t,colors:new Map};else{const t=this._gradientColorsCache.colors.get(e);if(void 0!==t)return t}const s=(0,ye.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}backgroundCounterColor(){const e=this.backgroundColor().value();if(void 0===this._lastBackgroundColor||void 0===this._lastOriginalColor||e!==this._lastBackgroundColor){const t=(0,o.rgbToBlackWhiteString)((0,o.parseRgb)(e),150);this._lastBackgroundColor=e,this._lastOriginalColor="black"===t?"white":"black"}return this._lastOriginalColor}isDark(){return"white"===this.backgroundCounterColor()}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new Ce(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new Te(e)),this._availableUnits}unitConversionEnabled(){return this._options.unitConversionEnabled}studyTemplate(e,t,i){const s={panes:[],version:this.version()};for(const e of this.panes())s.panes.push(e.state(!0,!1,!0)) ;const r=this.mainSeries();return e&&(s.symbol=r.symbol(),i&&(s.currency=r.currency()),i&&(s.unit=r.unit())),t&&(s.interval=r.interval()),s}restoreLineToolState(e,t){e.restorePoints(t.points,t.indexes||[]),e.properties().merge(t.state),e.restoreData&&e.restoreData(t),e.linkKey().setValue(t.linkKey||null),e.createServerPoints(),this.fullUpdate();const i=e.linkKey().value();null!==i&&(0,ve.restoreLineToolState)({model:this,linkKey:i,state:t})}updateLineTools(){for(const e of this.dataSources())(0,m.isLineTool)(e)&&(e.tryCreateServerPoints(),e.checkAlert&&e.checkAlert())}onResetScales(){return this._resetScales}startMovingSources(e,t,i,s,n,o){this._sourcesBeingMoved=e,this._activeItemBeingMoved=i;let a=!1;if(this._sourcesBeingMoved.forEach(e=>{!a&&(0,R.isStudy)(e)&&(a=!0);const l=(0,r.ensureNotNull)(this.paneForSource(e)),c=(0,m.isLineTool)(e),h=c&&e.linkKey().value();if(!1!==h&&null!==h&&s.has(h)&&c&&e.isFixed()){const t=(0,r.ensureDefined)(s.get(h)),a={screen:this._percentPositionToPoint(t,l)};e.startMoving(a,i,n,o)}else e.startMoving(t,i,n,o);const d=this._paneInvalidationMask(l,z.InvalidationLevel.Light);this.invalidate(d)}),!o){const s=e.filter(m.isLineTool).filter(e=>e.linkKey().value()&&e.isSynchronizable()).map(e=>e.linkKey().value());if(s.length&&t.logical){const o=this.externalTimeStamp(t.logical.index),a={linkKeys:s,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:o},activeItem:null!==i?i:void 0,envState:n,pointPositionPercents:new Map};e.forEach(e=>{if((0,m.isLineTool)(e)){const i=e.linkKey().value();if(i&&e.isSynchronizable()&&e.isFixed()){const s=(0,r.ensureNotNull)(this.paneForSource(e));a.pointPositionPercents.set(i,this._pointToPercentPosition((0,r.ensureDefined)(t.screen),s))}}}),(0,ve.startMovingLineTool)(a)}}ve.isToolMovingNow.setValue(!0),a&&ve.isStudyEditingNow.setValue(!0)}moveSources(e,t,i,s){if(this._sourcesBeingMoved.filter(e=>!e.isLocked||!e.isLocked()).forEach(n=>{const o=(0,m.isLineTool)(n)?n.linkKey().value():null;if(null!==o&&t.has(o)){const e=(0,r.ensureNotNull)(this.paneForSource(n)),a=(0,r.ensureDefined)(t.get(o)),l={screen:this._percentPositionToPoint(a,e)};n.move(l,this._activeItemBeingMoved,i,s)}else n.move(e,this._activeItemBeingMoved,i,s)}),this.lightUpdate(),!s&&e.logical){const t=this._sourcesBeingMoved.filter(m.isLineTool).filter(e=>e.isSynchronizable()&&!!e.linkKey().value()).map(e=>e.linkKey().value()),s=this.externalTimeStamp(e.logical.index),n={linkKeys:t,model:this,point:{price:e.logical.price,timeStamp:s},envState:i,pointPositionPercents:new Map};this._sourcesBeingMoved.filter(m.isLineTool).forEach(t=>{if(t.linkKey().value()&&t.isSynchronizable()&&t.isFixed()){const i=(0,r.ensureNotNull)(this.paneForSource(t));n.pointPositionPercents.set(t.linkKey().value(),this._pointToPercentPosition((0,r.ensureDefined)(e.screen),i))}}),(0,ve.moveLineTool)(n)}}endMovingSources(e,t,i){const s=this._sourcesBeingMoved.map(s=>{const n=(0,r.ensureNotNull)(this.paneForSource(s)),o=s.endMoving(e,t,i),a=this._paneInvalidationMask(n,z.InvalidationLevel.Light) ;return a.invalidateAll(z.InvalidationLevel.Light),this.invalidate(a),o}),n=this._sourcesBeingMoved.filter(m.isLineTool).filter(e=>e.isSynchronizable()&&!!e.linkKey().value()).map(e=>e.linkKey().value()),o=this._sourcesBeingMoved.filter(m.isLineTool).filter(e=>e.isSynchronizable()&&!!e.linkKey).map(e=>{const t={points:e.normalizedPoints(),interval:this.mainSeries().interval()};return e.isFixed()&&(t.pointPositionPercents=e.calcPositionPercents()),t});n.length&&(0,ve.finishMovingLineTool)({linkKeys:n,model:this,finalStates:o,changes:s}),this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,ve.isToolMovingNow.setValue(!1),ve.isStudyEditingNow.setValue(!1)}sourcesBeingMoved(){return this._sourcesBeingMoved}setMovingCustomSource(e,t){this._customSourceBeingMoved=e,this._customSourceBeingMovedHitTestData=null!==t?{beingMoved:!1,...t}:null}processingCustomSourceMove(){null!==this._customSourceBeingMovedHitTestData&&(this._customSourceBeingMovedHitTestData.beingMoved=!0)}customSourceMovingHitTestData(){return this._customSourceBeingMovedHitTestData}customSourceBeingMoved(){return null!==this._customSourceBeingMovedHitTestData&&this._customSourceBeingMovedHitTestData.beingMoved?this._customSourceBeingMoved:null}width(){return this._width}setWidth(e,t){this._width=e,this._timeScale.setWidth(e,t);for(const t of this._panes)t.setWidth(e);this.recalculateAllPanes(),this.recalcVisibleRangeStudies()}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes(),this.lightUpdate()}isScalesResetAvailableChanged(){return this._isScalesResetAvailableChanged}isScalesResetAvailable(){return this._isScalesResetAvailable}panes(){return this._panes}paneForId(e){return this._panes.find(t=>t.id()===e)||null}createPane(e,t,i){const s=this._undoModel.chartWidget();s.isMaximizedPane()&&s.toggleMaximizePane();const r=this._properties.childs().paneProperties;t&&r.merge(t);const n=new U.Pane(this._timeScale,r,this,i);return void 0!==e?this._panes.splice(e,0,n):this._panes.push(n),n.onTagsChanged().subscribe(this,Ut.prototype.onPaneTagsChanged),n.dataSourcesCollectionChanged().subscribe(this,()=>this._dataSourceCollectionChanged.fire(n)),n.symbolSourceCollectionChanged().subscribe(this,()=>this._onSymbolSourceCollectionChanged(n)),n.sourcePropertiesChanged().subscribe(this,e=>this._sourceProperitesChanged.fire(n,e)),n.sourceZOrderChanged().subscribe(this,e=>this._sourceZOrderChanged.fire(n,e)),n.symbolSourceResolved().subscribe(this,e=>this._symbolSourceResolved.fire(n,e)),n.symbolSourceResolvingActive().subscribe(this._recalcSymbolResolvingActive),this._panesCollectionChanged.fire(this._panes),this.invalidate(z.InvalidationMask.panesOrder()),n}removePane(e){const t=this._undoModel.chartWidget();t.isMaximizedPane()&&t.toggleMaximizePane();const i=e;i.destroy();const s=this._panes.indexOf(i);-1!==s&&(this._panes.splice(s,1),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.symbolSourceCollectionChanged().unsubscribeAll(this),e.sourcePropertiesChanged().unsubscribeAll(this),e.onTagsChanged().unsubscribeAll(this), e.symbolSourceResolved().unsubscribeAll(this),i.symbolSourceResolvingActive().unsubscribe(this._recalcSymbolResolvingActive));this.crossHairSource().pane===e&&this.clearCurrentPosition(),this._panesCollectionChanged.fire(this._panes),this.invalidate(z.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;(0,r.assert)(e>=0&&ee+t.stretchFactor(),0),n=this._panes.reduce((e,t)=>e+t.height(),0),o=n-30*(this._panes.length-1);t=Math.min(o,Math.max(30,t));const a=s/n,l=i.height();i.setStretchFactor(t*a);let c=t-l,h=this._panes.length-1;for(const e of this._panes)if(e!==i){const t=Math.min(o,Math.max(30,e.height()-c/h));c-=e.height()-t,h-=1;const i=t*a;e.setStretchFactor(i)}this.fullUpdate()}clearCurrentPosition(){const e=this.crossHairSource();e.clearPosition(),(0,r.ensureNotNull)(e.dataWindowView()).update(),Ht(this._panes),this.invalidate(z.InvalidationMask.cursor());const t=this._undoModel.chartWidget();t.chartWidgetCollection().syncCrosshair(null,t),this._phantomSourceContainer.onCursorPositionUpdated()}setAndSaveCurrentPosition(e,t,i,s){this.crossHairSource().saveOriginCoords(e,t),this.setCurrentPosition(e,t,i,s)}setCurrentPosition(e,t,i,s){let n=NaN;const o=this._timeScale.coordinateToVisibleIndex(e),a=i.defaultPriceScale();let l=null;!a.isEmpty()&&Number.isFinite(t)&&(l=(0,r.ensureNotNull)(i.mainDataSource()).firstValue(),null!==l&&(n=a.coordinateToPrice(t,l)));const c=this.crossHairSource(),h=c.selectPointMode().value(),d=this.currentTool(),u=this.mainSeries(),p=h||ve.isStudyEditingNow.value(),_=this._lineBeingCreated||this._lineBeingEdited||(0,m.isLineToolName)(d)||(0,ve.toolIsMeasure)(d)||p;!this._isSettingsExternalPosition&&_&&(n=this._magnet.align(n,o,i),null!==l&&c.saveOriginCoords(c.originX(),a.priceToCoordinate(n,l)));let g=null;if(isNaN(n)||(g=i),this._isTimeScrolling){if(!this._isSettingsExternalPosition&&h){const e=u.bars().firstIndex(),t=u.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(o,e),t);s!==o&&this._setCorrectedPositionToCrosshair(s,n,l,i)}}else c.setPosition(c.index,n,g);return}c.setOnHoveredChartWidget(!0),c.setPosition(o,n,g),(0,r.ensureNotNull)(c.dataWindowView()).update(),Ht(this._panes);const f=u.syncModel();if(this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(z.InvalidationMask.cursor()),this._lineBeingCreated){const e=this._lineBeingCreated.linkKey().value();if(!this._isSettingsExternalPosition){const t=this._lineBeingCreated.setLastPoint({index:o,price:n},s);if(this._lineBeingCreated.updateAllViews(),t.price===n&&t.index===o||this._setCorrectedPositionToCrosshair(t.index,t.price,l,i),f&&e){const i=this._timeScale.points().roughTime(t.index,f.projectTime.bind(f));(0,ve.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:(0,r.ensureNotNull)(i),price:t.price}})}}}if(!this._isSettingsExternalPosition&&null!==this._lineBeingEdited&&null!==this._linePointBeingEdited){const e={index:o,price:n} ;this.changeLinePoint(e,s);const t=this._lineBeingEdited.alignCrossHairToAnchor(this._linePointBeingEdited)?this._lineBeingEdited.getPoint(this._linePointBeingEdited):e;null!==t&&this._setCorrectedPositionToCrosshair(t.index,t.price,l,i)}if(!this._isSettingsExternalPosition&&p){const e=u.bars().firstIndex(),t=u.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(o,e),t);s!==o&&this._setCorrectedPositionToCrosshair(s,n,l,i)}}this._syncCrosshair(s)}setExternalPosition(e,t){let i;const s=this.crossHairSource();if(s.setOnHoveredChartWidget(!1),null!==e&&(0,$.isNumber)(e.timeStamp)){const t=this.mainSeries().syncModel();if(t){const s=this.createSyncPoint(e.syncModel,t).sourceTimeToTargetTime(e.timeStamp);i=this._timeScale.points().roughIndex(s,t.distance.bind(t))}}if(null!==e&&null!=i&&Number.isFinite(i)){this._isSettingsExternalPosition=!0;const n=(0,r.ensureNotNull)(this.paneForSource(this.mainSeries())),o=this._timeScale.indexToCoordinate(i),a=(0,r.ensureNotNull)(n.mainDataSource()).firstValue();if(null!==a){let i=NaN;void 0!==e.price&&Number.isFinite(e.price)&&(i=this.mainSeries().priceScale().priceToCoordinate(e.price,a)),s.clearOriginCoords(),this.setCurrentPosition(o,i,n,t)}return s.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}s.clearPosition(),(0,r.ensureNotNull)(s.dataWindowView()).update(),Ht(this._panes),this.invalidate(z.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes(),this.lightUpdate(),this._setScalesResetAvailable(!0)}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies()}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes(),this.recalcVisibleRangeStudies(),this.lightUpdate(),this._resetScales.fire(),this._setScalesResetAvailable(!1)}startScalePrice(e,t,i){e.startScalePrice(t,i)}scalePriceTo(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.lightUpdate():this.invalidate(this._paneInvalidationMask(e,z.InvalidationLevel.Light)),this._setScalesResetAvailable(!0)}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,z.InvalidationLevel.Light))}startTwoPointsScalePrice(e,t,i,s){t.startTwoPointsScale(i,s)}twoPointsScalePriceTo(e,t,i,s){t.twoPointsScale(i,s),this.invalidate(this._paneInvalidationMask(e)),this._setScalesResetAvailable(!0)}endTwoPointsScalePrice(e,t){t.endTwoPointsScale(),this.invalidate(this._paneInvalidationMask(e))}resetPriceScale(e,t){this._setScalesResetAvailable(!1),e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,z.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,z.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&((0,m.isLineToolName)(e)&&this.selectionMacro(e=>{e.clearSelection()}),this._currentTool=e,this._phantomSourceContainer.onToolChanged())}detachSource(e){ const t=this.paneForSource(e);return!!t&&(t.removeDataSource(e),t.isEmpty()?(this._lineBeingCreated&&t===this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(t),!0):(this.fullUpdate(),!1))}onRearrangePanes(){return this._onRearrangePanes}finishLineTool(e){const t=e.linkKey().value();(0,ve.drawOnAllCharts)().value()&&null!==t&&e.isSynchronizable()&&(0,ve.finishLineTool)({linkKey:t,model:this})}startChangingLinetool(e,t,i,s,n){this._lineBeingEdited=e,this._linePointBeingChanged=t||null,this._linePointBeingEdited=void 0===i?null:i,this._lineBeingEdited.startChanging(i,t,n),ve.isToolEditingNow.setValue(!0);const o=(0,r.ensureNotNull)(this.paneForSource(e));this._lineBeingEdited.startDragPoint&&void 0!==i&&void 0!==t&&this._lineBeingEdited.startDragPoint(i,t),n||void 0===i||void 0===t||this._lineBeingEdited.setPoint(i,t,s,n),this._lineBeingEdited.updateAllViews();const a=this._paneInvalidationMask(o,z.InvalidationLevel.Light);this.invalidate(a);const l=e.linkKey().value();if(l&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const e=(0,r.ensureNotNull)(this.externalTimeStamp(t.index));(0,ve.startChangingLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},pointIndex:i,envState:s||null})}}createLineTool(e,t,i,s,o,a){if((0,r.assert)((0,m.isLineToolName)(i),"Cannot create unknown line tool: "+i),"LineToolExecution"!==i&&(0,c.trackEvent)("drawings","Study_Drawing_"+i),s){const e=s.state();s=(0,m.createLineToolProperties)(i,e,this)}const l=(0,m.createLineTool)(i,this,s,null),h=!l.linkKey().value()&&!o;a=(0,r.ensureDefined)(a||(0,r.ensureNotNull)(e.mainDataSource())),s||(0,m.prepareLineToolPropertiesByOwnerSource)(l.properties(),a),l.setOwnerSource(a);const d=a.priceScale();if(e.addDataSource(l,d,!1),(0,ve.drawOnAllCharts)().value()){const e=l.isSynchronizable()?o||(0,Se.randomHash)():null;l.linkKey().setValue(e)}else l.linkKey().setValue(o);let u;if(l.isFixed()){const i=(0,r.ensureNotNull)((0,r.ensureNotNull)(e.mainDataSource()).firstValue()),s=this._timeScale.indexToCoordinate(t.index),o=(0,r.ensureNotNull)(d).priceToCoordinate(t.price,i);u=l.addFixedPoint(new n.Point(s,o))}else u=l.addPoint(t);return u||(this._lineBeingCreated=l,this._paneBeingCreatedLineOn=e,ve.isToolCreatingNow.setValue(!0)),h&&l.enableCurrentIntervalVisibility(),this.fullUpdate(),l}endChangingLinetool(e,t){const i=(0,r.ensureNotNull)(this._lineBeingEdited),s=i.endChanging(!1,e,t);this._lineBeingEdited=null,ve.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const n={points:i.normalizedPoints(),interval:this.mainSeries().interval()},o=i.linkKey().value();null!==o&&i.isSynchronizable()&&!t&&(0,ve.finishChangingLineTool)({model:this,linkKey:o,symbol:this.mainSeries().symbol(),finalState:n,changes:s})}continueCreatingLine(e,t,i,s){const n=(0,r.ensureNotNull)(this._lineBeingCreated),o=n.addPoint(e,t,i);n.updateAllViews();const a=new z.InvalidationMask(z.InvalidationLevel.Light);return o&&(this._paneBeingCreatedLineOn=null, this._lineBeingCreated=null,ve.isToolCreatingNow.setValue(!1)),this.invalidate(a),o}cancelCreatingLine(){if(!this._lineBeingCreated)return;const e=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),ve.isToolCreatingNow.setValue(!1),(0,ve.drawOnAllCharts)().value()&&e.isSynchronizable()&&(0,ve.cancelLineTool)({model:this})}lineBeingCreated(){return this._lineBeingCreated}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){const s=(0,r.ensureNotNull)(this._lineBeingEdited),n=(0,r.ensureNotNull)(this._linePointBeingEdited);let o=e.price,a=e.index;if(s.setPoint(n,e,t,i),!i){const t=s.alignCrossHairToAnchor(n)?s.getPoint(n):e;null!==t&&(a=t.index,o=t.price)}s.updateAllViews(),this.lightUpdate();const l=s.linkKey().value();if(!i&&null!==l&&s.isSynchronizable()){const e=(0,r.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:o!==e.price},c=s.getChangePointForSync(n);if(null!==c){const e=this.externalTimeStamp(a);null!==e&&(o=c.price,(0,ve.changeLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:o,timeStamp:e},envState:t,changes:i}))}}}changeLinePoints(e,t,i){const s=e.points(),n=e.linkKey().value();!i&&n&&e.isSynchronizable()&&t.forEach((t,i)=>{const o=s[i],a=o.price!==t.price,l=o.index!==t.index;if(e.getChangePointForSync(i)){const e=(0,r.ensureNotNull)(this.externalTimeStamp(t.index));(0,ve.changeLineTool)({linkKey:n,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},changes:{pricesChanged:a,indexesChanged:l}})}}),e.setPoints(t),e.updateAllViews(),this.lightUpdate()}addCustomSource(e,t,i=u.CustomSourceLayer.Foreground){this._customSourcesMap.has(e)&&Ft.logWarn(`Attempt to add the same custom source multiple time "${e}"`),Ft.logNormal(`Adding custom source "${e}"`);const s=t(e,this);switch(i){case u.CustomSourceLayer.Background:this._bgCustomSources.push(s);break;case u.CustomSourceLayer.Foreground:this._fgCustomSources.push(s);break;case u.CustomSourceLayer.Topmost:this._topmostCustomSources.push(s);break;default:throw new Error("Unknown custom sources layer "+i)}this._allCustomSources.push(s),this._customSourcesMap.set(e,s),this.lightUpdate()}removeCustomSource(e){this._removeCustomSource(e),this.lightUpdate()}hasCustomSource(e){return this._customSourcesMap.has(e)}customSourceForName(e){return this._customSourcesMap.get(e)||null}customSourceName(e){let t=null;return this._customSourcesMap.forEach((i,s)=>{i===e&&(t=s)}),t}customSources(e){switch(e){case u.CustomSourceLayer.Background:return this._bgCustomSources;case u.CustomSourceLayer.Foreground:return this._fgCustomSources;case u.CustomSourceLayer.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this.lightUpdate()}removeMultiPaneSource(e){const t=this._multiPaneSources.indexOf(e) ;-1===t?Ft.logWarn("Attempt to remove multi-pane source which does not exist in the model"):this._multiPaneSources.splice(t,1),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter(t=>!e.hasDataSource(t))}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}sessions(){return(0,r.ensureNotNull)(this._sessions)}createSessions(e){(0,r.assert)(null===this._sessions,"Sessions are already created"),this.addCustomSource("sessions",(t,i)=>(this._sessions=new N(t,i,e),this._sessions.start(),this._sessions),u.CustomSourceLayer.Background)}createPrePostMarket(e){this.addCustomSource("prePostMarket",(t,i)=>new PrePostMarket(t,i,e))}theme(){const e=this.properties().childs().paneProperties.state();delete e.topMargin,delete e.bottomMargin;const t=this.mainSeries().state().state;t&&(delete t.symbol,delete t.interval,delete t.currencyId,delete t.unitId);const i={mainSourceProperties:t,sessions:this.sessions().properties().state(),chartProperties:{paneProperties:e,scalesProperties:this.properties().childs().scalesProperties.state()}};return i.version=this.version(),i}onChartThemeLoaded(){return this._chartThemeLoaded}chartThemeLoaded(){this._chartThemeLoaded.fire()}shouldBeSavedEvenIfHidden(){return this._shouldBeSavedEvenIfHidden}setShouldBeSavedEvenIfHidden(e){this._shouldBeSavedEvenIfHidden=e}externalTimeStamp(e){const t=this.mainSeries().syncModel();return this.timeScale().points().roughTime(e,t&&t.projectTime.bind(t))}syncESD(){null!==this._esdWatcher&&this._esdWatcher.syncESDStudies()}recalcVisibleRangeStudies(e){this._recalcVRStudiesParams.force=this._recalcVRStudiesParams.force||Boolean(e),this._recalcVisibleRangeStudiesImplDebounced()}recalcColorStudies(e){this._recalcColorStudiesParams.force=this._recalcColorStudiesParams.force||Boolean(e),this._recalcColorStudiesImplDebounced()}alertsWatcher(){return this._alertsWatcher}showLegend(){return this._showLegendProperty}id(){return this._id}recalculatePriceRangeOnce(){const e=this.mainSeries();for(const t of this._panes)for(const i of t.priceDataSources())i.symbolSource()===e&&i.disablePriceRangeReady()}invalidate(e){var t;null===(t=this._invalidateHandler)||void 0===t||t.call(this,e)}appliedTimeFrame(){return this._appliedTimeFrame.appliedTimeFrame()}barsMarksSources(){return this._barsMarksSources}barMarksSourceForId(e){for(const t of this._barsMarksSources)if(t.id()===e)return t;return null}isAutoSaveEnabled(){return this._isAutoSaveEnabled}studyAwareDefaultRightOffset(){return Math.max(this._timeScale.defaultRightOffset().value(),this._cachedStudiesMaxOffset)}_updateStudiesMaxOffset(){const e=Math.max(...this.allStudies().map(e=>e.maxOffset().value()));this._cachedStudiesMaxOffset=e;const t=this._timeScale.rightOffset();t<0||this._timeScale.setRightOffset(Math.max(t,e))}_updateBaseIndex(e,t){const i=this._timeScale,s=i.baseIndex(),r=i.visibleBarsStrictRange(),n=i.logicalRange();if(null!==n&&t){const t=n.contains(s),o=e-s;let a=t?null:i.rightOffset()-o ;if(!this._options.shiftVisibleRangeOnNewBar&&t){const e=i.indexToCoordinate(s)+i.barSpacing()/2+1,t=s-n.left()+o,l=e/t;if(l>=i.minBarSpacing()){i.setBarSpacing(l);a=i.width()/l-t}else(null==r?void 0:r.lastBar())!==s&&(a=i.rightOffset()-o)}null!==a&&i.setRightOffset(a)}i.setBaseIndex(e)}_createESDWatcher(){}_updateDateTimeFormatter(){const e=me.dateFormatProperty.value(),t=new _e.DateFormatter(e);if(this._dateFormatter=t,this.mainSeries().isDWM())this._dateTimeFormatter=t,this._timeFormatter=new ge.TimeFormatter("%h:%m");else{const t=y.Interval.parse(this.mainSeries().interval()),i=t.isSeconds()||t.isTicks()?"%h:%m:%s":"%h:%m";this._dateTimeFormatter=new pe.DateTimeFormatter({dateFormat:e,timeFormat:i,dateTimeSeparator:" "}),this._timeFormatter=new ge.TimeFormatter(i)}}_setScalesResetAvailable(e){this._isScalesResetAvailable!==e&&(this._isScalesResetAvailable=e,this._isScalesResetAvailableChanged.fire())}_invalidationMaskForSource(e,t=z.InvalidationLevel.Light){if(e===this.crossHairSource())return z.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask((0,r.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new z.InvalidationMask;return e.invalidateAll(t),e}if(!(0,p.isDataSource)(e))return null;if(e.isMultiPaneEnabled())return new z.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=z.InvalidationLevel.Light){const i=new z.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=z.InvalidationLevel.Light){if(!(0,p.isDataSource)(e))return new z.InvalidationMask(t);const i=this.paneForSource(e);if(null===i)return null;let s=e.priceScale();if(null===s)return null;const r=this._panes.indexOf(i);let n=i.priceScalePosition(s);if("overlay"===n){const e=this._panes[r].defaultPriceScale();s=e,n=i.priceScalePosition(e)}const o=i.priceScaleIndex(s,n);if(void 0===o)return null;const a=new z.InvalidationMask;return a.invalidatePriceScale(r,n,o,t),a}_removeCustomSource(e){const t=this._customSourcesMap.get(e);if(void 0===t)return void Ft.logWarn(`Attempt to remove custom source which does not exist in the model - "${e}"`);Ft.logNormal(`Removing custom source "${e}"`),this.selectionMacro(e=>{e.removeSourceFromSelection(t)}),this._hoveredSource===t&&this.setHoveredSource(null),this._customSourceBeingMoved===t&&this.setMovingCustomSource(null,null);const i=Wt(this._bgCustomSources,t),s=Wt(this._fgCustomSources,t),n=Wt(this._topmostCustomSources,t),o=Wt(this._allCustomSources,t);(0,r.assert)(i||s||n,"Source should be presented in one of the layers"),(0,r.assert)(o,"Source should be presented in the array"),this._customSourcesMap.delete(e),t.destroy()}_updateShowLegendProperty(){const e=this._properties.childs().paneProperties.childs().legendProperties.childs().showLegend,t=this._showLegendProperty;if(e.value())t.setValue(!0);else{for(const e of this._panes){let i=0 ;for(const s of e.priceDataSources())if(s!==this.mainSeries()&&null!==s.statusView()&&(i++,i>1))return void t.setValue(!1)}t.setValue(!0)}}_pointToPercentPosition(e,t){return{x:e.x/this._timeScale.width(),y:e.y/(0,r.ensureNotNull)((0,r.ensureNotNull)(t.mainDataSource()).priceScale()).height()}}_percentPositionToPoint(e,t){const i=e.x*this._timeScale.width(),s=e.y*(0,r.ensureNotNull)((0,r.ensureNotNull)(t.mainDataSource()).priceScale()).height();return new n.Point(i,s)}_recalcVisibleRangeStudiesImpl(e){var t;if(e.timerId=null,this.timeScale().isEmpty())return;const i=this.timeScale().visibleBarsStrictRange();if(null===i)return;const s=this.mainSeries().nearestData(i.firstBar(),Me.PlotRowSearchMode.NearestRight),r=this.mainSeries().nearestData(i.lastBar(),Me.PlotRowSearchMode.NearestLeft),n=this.mainSeries().bars().lastIndex(),o=s?s.index:void 0,a=r?r.index:void 0,l=o===e.oldStartVisibleIndex,c=a===e.oldEndVisibleIndex;if(l&&c&&!e.force)return;e.force=!1,e.oldStartVisibleIndex=void 0!==o?o:NaN,e.oldEndVisibleIndex=void 0!==a?a:NaN;const h={first_visible_bar_time:1e3*Math.floor(s&&s.value?s.value[0]:0),last_visible_bar_time:1e3*Math.floor(r&&r.value?r.value[0]:0),subscribeRealtime:r&&r.index===n},d=null!==(t=e.studies)&&void 0!==t?t:this.priceDataSources();e.studies=void 0;for(const e of d)if((0,R.isStudy)(e)){const t=e.metaInfo().inputs,i=[];for(const e of t)h.hasOwnProperty(e.id)&&i.push(e.id);const s=e.properties().inputs;for(const e of i)s[e].setValueSilently(h[e]);i.length>0&&s.listeners().fire(s)}}_recalcColorStudiesImpl(e){var t;e.timerId=null;const i=this.backgroundColorAtYPercentFromTop(.5),s=this.isDark()?a.colorsPalette["color-cold-gray-200"]:a.colorsPalette["color-cold-gray-900"],r=i===e.oldBgColor,n=s===e.oldFgColor;if(r&&n&&!e.force)return;e.force=!1,e.oldBgColor=i,e.oldFgColor=s;const o={__chart_bgcolor:i,__chart_fgcolor:s},l=null!==(t=e.studies)&&void 0!==t?t:this.priceDataSources();e.studies=void 0;for(const e of l)if((0,R.isStudy)(e)){const t=e.metaInfo().inputs,i=[];for(const e of t)o.hasOwnProperty(e.id)&&i.push(e.id);const s=e.properties().inputs;for(const e of i)s[e].setValueSilently(o[e]);i.length>0&&s.listeners().fire(s)}}_getAllSources(e){const t=[];for(const i of this._panes){const s=i.sourcesByGroup().all();for(const i of s)e(i)&&t.push(i)}return t}_invalidateBarColorerCaches(){this.mainSeries().invalidateBarColorerCache()}_getAvailableCurrencies(){return this._options.currencyConversionEnabled?(0,$.isArray)(this._availableCurrenciesList)?this._availableCurrenciesList:(null!==this._availableCurrenciesList||(this._availableCurrenciesList=this.chartApi().availableCurrencies(),this._availableCurrenciesList.then(e=>{this._destroyed||(this._availableCurrenciesList=e,this.fullUpdate())}).catch(e=>{Ft.logWarn("An error occurred while getting currencies config: "+e)})),[]):[]}_getAvailableUnits(){ return this._options.unitConversionEnabled?this._availableUnitsObject instanceof Promise||null===this._availableUnitsObject?(null!==this._availableUnitsObject||(this._availableUnitsObject=this.chartApi().availableUnits(),this._availableUnitsObject.then(e=>{this._destroyed||(this._availableUnitsObject=e,this.fullUpdate())}).catch(e=>{Ft.logWarn("An error occurred while getting units config: "+e)})),{}):this._availableUnitsObject:{}}_getBackgroundColor(e){const t=this._properties.childs().paneProperties.childs();if(t.backgroundType.value()===we.ColorType.Gradient){const i=t.backgroundGradientStartColor.value(),s=t.backgroundGradientEndColor.value();return e?i:s}return t.background.value()}_updateBackgroundColor(){this._backgroundColor.setValue(this._getBackgroundColor()),this._backgroundTopColor.setValue(this._getBackgroundColor(!0))}_syncCrosshair(e){if(!this._isSettingsExternalPosition){const t=this._undoModel.chartWidget(),i=this._undoModel.mainSeries(),s=i.syncModel(),r=this._undoModel.crossHairSource(),n=r.pane;if(null!==s&&null!==n){const o={timeStamp:this._timeScale.points().roughTime(r.index,s.projectTime.bind(s)),syncModel:s};n.mainDataSource()===i&&(o.price=r.price,o.symbol=i.symbol()),o.syncModel=s;let a=this._lineBeingCreated||null!==this._linePointBeingEdited||Boolean(this._sourcesBeingMoved.length);a=a&&(0,ve.drawOnAllCharts)().value(),t.chartWidgetCollection().syncCrosshair(o,t,a,e)}this._phantomSourceContainer.onCursorPositionUpdated()}}_gotoTimeImpl(e,t){const i=this.timeScale(),s=this.mainSeries();let n;if(void 0!==e){if(this._scrollingState&&this._scrollingState.deferred.reject(),n=(0,h.createDeferredPromise)(),!s.isDWM()){const t=s.symbolInfo();if(null!==t){let i=this.properties().childs().timezone.value();"exchange"===i&&(i=t.timezone);const r=(0,De.cal_to_utc)((0,De.get_timezone)(i),new Date(e)),n=(0,Ve.createTimeToBarTimeAligner)(s.interval(),t)(r);e=(0,De.utc_to_cal)((0,De.get_timezone)(i),n).getTime()}}this._scrollingState={targetDate:e,deferred:n,centerIfVisible:t.centerIfVisible}}else{if(!this._scrollingState)return Ft.logError("scrollTo called without an argument"),Promise.reject();e=this._scrollingState.targetDate,n=this._scrollingState.deferred}if(void 0===i.tickMarks().minIndex)return n.resolve(void 0),n.promise;let o=((e,t)=>{if((e=>(0,r.ensureNotNull)(i.tickMarks().indexToTime((0,r.ensureDefined)(i.tickMarks().minIndex))).valueOf()-e)(t)<0){let n=i.tickMarks().nearestIndex(t);const o=s.bars().lastIndex();if(null===o)return null;n=Math.min(n,o);let a=(0,r.ensureNotNull)(i.tickMarks().indexToTime(n)).valueOf();for(;a{"use strict";i.d(t,{japaneseChartStyles:()=>r,commonChartStyles:()=>n,allChartStyles:()=>o});var s=i(27490);function r(){return s.enabled("japanese_chart_styles"),[8]}function n(){const e=[0,1,9,2,3,10];return s.enabled("chart_style_hilo")&&e.push(12),e}function o(){return n().concat(r())}},34854:(e,t,i)=>{"use strict";i.d(t,{ChartUndoModelBase:()=>ui});var s=i(94795),r=i.n(s),n=i(55663),o=i(16282),a=i(72927),l=i(79881),c=i(90963),h=i(83939),d=i(97102),u=i(85062),p=i.n(u),_=i(65447);const m=new c.TranslatedString("move all scales to left",(0,l.t)("move all scales to left")),g=new c.TranslatedString("move all scales to right",(0,l.t)("move all scales to right")),f=(0,_.getLogger)("Chart.MergeAllScales");var v=i(27850),S=i(5980);class y extends S.UndoCommand{constructor(e,t,i,s,r,n){super(n),this._model=e,this._paneIndex=e.panes().indexOf(t),this._targetPosition=s,this._targetIndex=r,this._scaleId=i.id(),this._sourcePosition=t.priceScalePosition(i),"overlay"!==this._sourcePosition&&(this._sourceIndex=t.priceScaleIndex(i,this._sourcePosition))}redo(){const e=this._model.panes()[this._paneIndex],t=(0,o.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._targetPosition,this._targetIndex),this._model.fullUpdate()}undo(){const e=this._model.panes()[this._paneIndex],t=(0,o.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._sourcePosition,this._sourceIndex),this._model.fullUpdate()}}var b=i(67945);class w extends S.UndoCommand{constructor(e,t,i,s){super(s),this._createdIds=[],this._model=e,this._withoutShift=i,this._origStates=t.map(e=>e.state(!0));const r=e.lineToolsGroupModel();this._origGroups=t.map(e=>{const t=r.groupForLineTool(e);return t&&t.id})}redo(){const e=this._model.lineToolsGroupModel(),t=this._origStates.map((t,i)=>{const s=(0,o.ensureNotNull)(this._model.dataSourceForId(t.id)),r=0===this._createdIds.length?void 0:(0,o.ensureDefined)(this._createdIds[i]),n=(0,b.cloneLineTool)(this._model,s,!this._withoutShift,r),a=(0,o.ensureNotNull)(s.priceScale());(0,o.ensureNotNull)(this._model.paneForSource(s)).addDataSource(n,a,!1);const l=this._origGroups[i];if(null!==l){const t=e.groupForId(l);t&&t.addLineTools([n])}return this._model.updateSource(n),n});0===this._createdIds.length&&(this._createdIds=t.map(e=>e.id())),this._model.selectionMacro(e=>{ e.clearSelection(),t.forEach(t=>{e.addSourceToSelection(t)})}),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=this._model.lineToolsGroupModel();this._createdIds.forEach(t=>{const i=(0,o.ensureNotNull)(this._model.dataSourceForId(t)),s=e.groupForLineTool(i);null!==s&&s.excludeLineTool(i),this._model.removeSource(i)})}newIds(){return this._createdIds}}var P=i(40597),C=i(52201),T=i(47903),x=i(17e3);class I extends S.UndoCommand{constructor(e,t,i,s=!0){super(i,s),this._newStates=[],this._model=e,this._savedStates=t.map(e=>e.state(!1))}redo(){this._applyState(this._newStates)}undo(){0===this._newStates.length&&this.saveNewState(),this._applyState(this._savedStates)}saveNewState(){const e=this._savedStates.filter(T.notNull).map(e=>(0,o.ensureNotNull)(this._model.dataSourceForId(e.id)));this._newStates=e.map(e=>e.state(!1))}_applyState(e){for(const t of e)if(null!==t){const e=this._model.dataSourceForId(t.id);if(null!==e)if((0,x.isStudy)(e)){const i=t.state.inputs,s=e.properties().inputs;for(const e in i)s[e]&&s[e].setValue(i[e])}else this._model.restoreLineToolState(e,t)}}}var M=i(3062),L=i(31495),A=i(36512),k=i(58761);const E=new c.TranslatedString("create {tool}",(0,l.t)("create {tool}"));class D extends S.UndoCommand{constructor(e,t,i,s,r=!0){super(E.format({tool:new c.TranslatedString(i,k.lineToolsLocalizedNames[i])}),!1),this._lineId=null,this._lineState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._lineTool=i,this._ownerSourceId=s.id(),this._drawOnAllCharts=r}startCreatingLine(e,t,i){const s=this._model.panes()[this._paneIndex],r=this._model.dataSourceForId(this._ownerSourceId),n=this._model.createLineTool(s,e,this._lineTool,t,i,r);return this._lineId=n.id(),!this._model.lineBeingCreated()}continueCreatingLine(e,t,i,s){const r=this._model.continueCreatingLine(e,t,i,s);return r&&this._model.setShouldBeSavedEvenIfHidden(!0),r}line(){return null===this._lineId?null:this._model.dataSourceForId(this._lineId)}undo(){const e=this.line();null!==e&&(this._lineState=e.state(!1),this._model.removeSource(e),this._lineId=null)}redo(){if(null===this._lineState)return;const e=this._model.restoreSource(!1,this._paneIndex,null,(0,o.ensureNotNull)(this._lineState),null);null!==e&&(this._lineId=e.id(),this._lineState=null)}drawOnAllCharts(){return this._drawOnAllCharts}}var V=i(95316);const B=new c.TranslatedString("bring {title} to front",(0,l.t)("bring {title} to front")),N=new c.TranslatedString("send {title} to back",(0,l.t)("send {title} to back")),R=new c.TranslatedString("insert {title} after {targetTitle}",(0,l.t)("insert {title} after {targetTitle}")),O=new c.TranslatedString("insert {title} before {targetTitle}",(0,l.t)("insert {title} before {targetTitle}")),F=new c.TranslatedString("send {title} backward",(0,l.t)("send {title} backward")),W=new c.TranslatedString("bring {title} forward",(0,l.t)("bring {title} forward")),H=new c.TranslatedString("send group {title} backward",(0,l.t)("send group {title} backward")),z=new c.TranslatedString("bring group {title} forward",(0, l.t)("bring group {title} forward"));function U(e){return new c.TranslatedString(e.name(),e.title())}class j extends S.UndoCommand{constructor(e,t,i){super(i),this._sourcesByPanes=new Map,this._originalState=new Map,this._model=e,t.forEach(t=>{const i=(0,o.ensureNotNull)(e.paneForSource(t)),s=e.panes().indexOf(i),r=this._sourcesByPanes.get(s)||[];r.push(t.id()),this._sourcesByPanes.set(s,r)}),Array.from(this._sourcesByPanes.keys()).forEach(t=>{const i=e.panes()[t],s=new Map;i.sourcesByGroup().allIncludingHidden().forEach(e=>{s.set(e.id(),e.zorder())}),this._originalState.set(t,s)})}undo(){this._originalState.forEach((e,t)=>{const i=this._model.panes()[t],s=new Map;e.forEach((e,t)=>{const r=(0,o.ensureNotNull)(i.dataSourceForId(t));s.set(r,e)}),i.setZOrders(s)})}redo(){this._sourcesByPanes.forEach((e,t)=>{const i=this._model.panes()[t],s=e.map(e=>(0,o.ensureNotNull)(i.dataSourceForId(e)));this._paneOperation(i,s)})}}class G extends j{constructor(e,t){super(e,t,B.format({title:U(t[0])}))}_paneOperation(e,t){e.bringToFront(t)}}class q extends j{constructor(e,t){super(e,t,N.format({title:U(t[0])}))}_paneOperation(e,t){e.sendToBack(t)}}class Y extends j{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertAfter(t,this._targetSource)}}class $ extends Y{constructor(e,t,i){super(e,t,i,R.format({title:U(t[0]),targetTitle:U(i)}))}}class K extends j{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertBefore(t,this._targetSource)}}class X extends K{constructor(e,t,i){super(e,t,i,O.format({title:U(t[0]),targetTitle:U(i)}))}}function Z(e,t){const i=t[0],s=e.sourcesByGroup().all().filter(e=>e.zorder()e.zorder()>i.zorder());if(0===s.length)throw new Error("Cannot bring forward source that alreadt on back");let r=s[0];if((0,b.isLineTool)(r)){const t=e.model().lineToolsGroupModel().groupForLineTool(r);if(null!==t){const e=t.lineTools();r=e[e.length-1]}}return r}class ee extends Y{constructor(e,t,i){super(e,i,Q(t,i),W.format({title:U(i[0])}))}}function te(e,t){return(0,o.ensureNotNull)(e.paneForSource(t.lineTools()[0]))}class ie extends K{constructor(e,t){super(e,t.lineTools(),Z(te(e,t),t.lineTools()),H.format({title:t.name()}))}}class se extends Y{constructor(e,t){super(e,t.lineTools(),Q(te(e,t),t.lineTools()),z.format({title:t.name()}))}}const re=new c.TranslatedString("rearrange panes",(0,l.t)("rearrange panes"));class ne extends S.UndoCommand{constructor(e,t,i){super(re),this._chartModel=e,this._index=t,(0,T.isNumber)(i)?this._dstIndex=i:this._dstIndex="up"===i?t-1:t+1}redo(){this._checkIndices()&&this._chartModel.movePane(this._index,this._dstIndex)}undo(){ this._checkIndices()&&this._chartModel.movePane(this._dstIndex,this._index)}_checkIndices(){const e=this._chartModel.panes().length;return this._index>=0&&this._index=0&&this._dstIndexe.id())}redo(){const e=(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId));this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map(e=>this._model.dataSourceForId(e)),t=new ve.LineToolsGroup(e,this._groupName,this._groupId);this._model.lineToolsGroupModel().addGroup(t)}}const ye=new c.TranslatedString("create line tools group",(0,l.t)("create line tools group"));class be extends S.UndoCommand{constructor(e,t){super(ye),this._groupId=null,this._model=e,this._sourcesIds=t.map(e=>e.id())}redo(){const e=this._sourcesIds.map(e=>this._model.dataSourceForId(e)),t=null===this._groupId?void 0:this._groupId;this._groupId=this._model.lineToolsGroupModel().createGroup(e,this._title,t).id}undo(){const e=(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId((0,o.ensureNotNull)(this._groupId)));this._model.lineToolsGroupModel().removeGroup(e)}createdGroupId(){return this._groupId}}const we=new c.TranslatedString("add line tool(s) to group {group}",(0,l.t)("add line tool(s) to group {group}"));class Pe extends S.UndoCommand{constructor(e,t,i){super(we.format({group:t.name()})),this._model=e,this._groupId=t.id,this._lineToolsIds=i.map(e=>e.id())}redo(){const e=(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map(e=>this._model.dataSourceForId(e));e.addLineTools(t)}undo(){const e=this._lineToolsIds.map(e=>this._model.dataSourceForId(e));(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)).excludeLineTools(e)}}var Ce=i(85103);class Te extends S.UndoCommand{constructor(e,t,i,s,r){super(i),this._targetObj=e,this._newValue=t,this._oldValue=this._targetObj.value(),this._model=s,r&&this.setCustomFlag("doesnt_affect_save",!0)}redo(){(0,le.saveDefaultProperties)(!0),this._targetObj.setValue(this._newValue),(0,le.saveDefaultProperties)(!1),this._model.recalculateAllPanes(),this._model.lightUpdate()}undo(){(0,le.saveDefaultProperties)(!0),this._targetObj.setValue(this._oldValue),(0,le.saveDefaultProperties)(!1),this._model.recalculateAllPanes(),this._model.lightUpdate()}}class xe extends S.UndoCommand{constructor(e,t,i,s){super(s),this._chartModel=e,this._groupId=t.id,this._oldName=t.name(),this._newName=i}redo(){(0,o.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._newName)}undo(){(0,o.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._oldName)}}var Ie=i(15521);const Me=new c.TranslatedString("create line tools group from selection",(0,l.t)("create line tools group from selection")),Le=new c.TranslatedString("removing line tools group {name}",(0, l.t)("removing line tools group {name}")),Ae=new c.TranslatedString("add line tool {lineTool} to group {name}",(0,l.t)("add line tool {lineTool} to group {name}")),ke=new c.TranslatedString("make group {group} visible",(0,l.t)("make group {group} visible")),Ee=new c.TranslatedString("make group {group} invisible",(0,l.t)("make group {group} invisible")),De=new c.TranslatedString("lock group {group}",(0,l.t)("lock group {group}")),Ve=new c.TranslatedString("unlock group {group}",(0,l.t)("unlock group {group}")),Be=new c.TranslatedString("rename group {group} to {newName}",(0,l.t)("rename group {group} to {newName}"));class Ne{constructor(e){this._lineToolsAffectChartInvalidation=new Ce.FeatureToggleWatchedValue("do_not_invalidate_chart_on_changing_line_tools",!1),this._environment=e}createGroupFromSelection(){const e=this._environment.model();(0,o.assert)(!e.selection().isEmpty(),"Cannot create group from empty selection");const t=(0,A.sortSources)(e.selection().lineDataSources());(0,o.assert)(t.length===e.selection().allSources().length,"A group could contain line tools only");const i=t.length>1||null!==this._environment.model().lineToolsGroupModel().groupForLineTool(t[0]),s=t.reduce((e,t)=>e.zorder()>t.zorder()?e:t,t[0]);let r=s;const n=e.lineToolsGroupModel().groupForLineTool(s);if(null!==n){const e=n.lineTools();r=e[e.length-1]}this._environment.beginUndoMacro(Me,this._lineToolsAffectChartInvalidation.value());const a=new Map,l=new Set;t.forEach(t=>{const i=this._groupForLineTool(t);if(null===i)return;const s=a.get(i)||[];s.push(t),a.set(i,s);const r=(0,o.ensureNotNull)(e.paneForSource(t));l.add(r)}),(0,o.assert)(l.size<=1,"All selected sources should be on the same pane"),a.forEach((t,i)=>{const s=new C.ExcludeLineToolsFromGroupUndoCommand(e,i,t);this._environment.pushUndoCommand(s)});const c=new be(e,(0,A.sortSources)(t));if(this._environment.pushUndoCommand(c),i){const i=new $(e,t,r);this._environment.pushUndoCommand(i)}this._environment.endUndoMacro();const h=(0,o.ensureNotNull)(c.createdGroupId());return(0,o.ensureNotNull)(e.lineToolsGroupModel().groupForId(h))}removeGroup(e){const t=this._environment.model(),i=e.lineTools();this._environment.beginUndoMacro(Le.format({name:e.name()}),this._lineToolsAffectChartInvalidation.value());const s=new Se(t,e,null);this._environment.pushUndoCommand(s);const r=new P.RemoveSourcesCommand(t,i,null);this._environment.pushUndoCommand(r);const n=t.mainSeries().symbol();i.forEach(e=>{null!==e.linkKey().value()&&(0,Ie.removeLineTool)({withUndo:!0,model:t,symbol:n,sourceTitle:new c.TranslatedString(e.name(),e.title()),lineToolState:e.state(!1),linkKey:(0,o.ensureNotNull)(e.linkKey().value())})}),this._environment.endUndoMacro()}groups(){return this._environment.model().lineToolsGroupModel().groups()}excludeLineToolFromGroup(e,t){const i=this._environment.model(),s=new C.ExcludeLineToolsFromGroupUndoCommand(i,e,[t]);s.setCustomFlag("doesnt_affect_save",this._lineToolsAffectChartInvalidation.value()),this._environment.pushUndoCommand(s)}addLineToolToGroup(e,t){ const i=this._environment.model(),s=i.lineToolsGroupModel().groupForLineTool(t);if(s===e)return;const r=Ae.format({lineTool:new c.TranslatedString(t.name(),t.title()),name:e.name()});this._environment.beginUndoMacro(r,this._lineToolsAffectChartInvalidation.value()),null!==s&&this._environment.pushUndoCommand(new C.ExcludeLineToolsFromGroupUndoCommand(i,s,[t])),this._environment.pushUndoCommand(new Pe(i,e,[t])),this._environment.endUndoMacro()}bringToFront(e){const t=this._environment.model(),i=new G(t,e.lineTools());i.setCustomFlag("doesnt_affect_save",this._lineToolsAffectChartInvalidation.value()),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendToBack(e){const t=this._environment.model(),i=new q(t,e.lineTools());i.setCustomFlag("doesnt_affect_save",this._lineToolsAffectChartInvalidation.value()),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}bringForward(e){const t=this._environment.model(),i=new se(t,e);i.setCustomFlag("doesnt_affect_save",this._lineToolsAffectChartInvalidation.value()),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendBackward(e){const t=this._environment.model(),i=new ie(t,e);i.setCustomFlag("doesnt_affect_save",this._lineToolsAffectChartInvalidation.value()),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertAfter(e,t){const i=this._environment.model();let s;if(t instanceof ve.LineToolsGroup){const e=t.lineTools();s=e[e.length-1]}else s=t;const r=new $(i,e.lineTools(),s);this._environment.pushUndoCommand(r),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertBefore(e,t){const i=this._environment.model();let s;if(t instanceof ve.LineToolsGroup){s=t.lineTools()[0]}else s=t;const r=new X(i,e.lineTools(),s);this._environment.pushUndoCommand(r),this._environment.emitEvent("changeZOrder",[e.lineTools()])}availableZOrderOperations(e){const t=this._environment.model(),i=e.lineTools(),s=i[0],r=i[i.length-1],n=(0,o.ensureNotNull)(t.paneForSource(i[0])).sourcesByGroup().allExceptSpecialSources(),a=n[0],l=n[n.length-1];return{bringForwardEnabled:r!==l,bringToFrontEnabled:r!==l,sendBackwardEnabled:s!==a,sendToBackEnabled:s!==a}}setGroupVisibility(e,t){const i=(t?ke:Ee).format({group:e.name()}),s=this._environment.model();this._environment.beginUndoMacro(i,this._lineToolsAffectChartInvalidation.value()),e.lineTools().forEach(e=>{const i=e.properties().visible,r=new Te(i,t,null,s);this._environment.pushUndoCommand(r)}),this._environment.endUndoMacro()}setGroupLock(e,t){const i=(t?De:Ve).format({group:e.name()}),s=this._environment.model();this._environment.beginUndoMacro(i,this._lineToolsAffectChartInvalidation.value()),e.lineTools().forEach(e=>{const i=e.properties().frozen,r=new Te(i,t,null,s);this._environment.pushUndoCommand(r)}),this._environment.endUndoMacro()}setGroupName(e,t){const i=this._environment.model(),s=Be.format({group:e.name(),newName:t}),r=new xe(i,e,t,s) ;r.setCustomFlag("doesnt_affect_save",this._lineToolsAffectChartInvalidation.value()),this._environment.pushUndoCommand(r)}canBeGroupped(e){const t=this._environment.model();return new Set(e.map(e=>t.paneForSource(e))).size<=1}_groupForLineTool(e){return this._environment.model().lineToolsGroupModel().groups().find(t=>t.containsLineTool(e))||null}}var Re=i(72236),Oe=i(58921),Fe=i(40315);const We=new c.TranslatedString("apply study template {template}",(0,l.t)("apply study template {template}"));class He extends S.UndoCommand{constructor(e,t,i){super(We.format({template:i})),this._model=e,this._templateContent=t,this._initialState=e.studyTemplate(!0,!0,!0),this._initialGroupsState=e.lineToolsGroupModel().state()}redo(){const e=this._merge(this._templateContent).filter(b.isLineTool);this._model.lineToolsGroupModel().removeLineTools(e),this._model.mainSeries().onChartStyleChanged();const t=this._model.mainSeries().properties();(0,ce.preparePriceAxisProperties)(t),this._model.recalcVisibleRangeStudies(!0),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){this._merge(this._initialState),this._model.mainSeries().onChartStyleChanged()}_merge(e){const t=e.version||0,i=this._model,s=i.mainSeries(),r=s.id();s.priceScale().properties().childs().lockScale.setValue(!1);const n=s.properties().childs();if(this._initialState.symbol&&e.symbol&&(n.currencyId.setValue(e.currency||null),n.unitId.setValue(e.unit||null),n.symbol.setValue(e.symbol)),this._initialState.symbol&&e.interval){const t=(0,ce.getChartStyleByResolution)(e.interval,n.style.value());s.setChartStyleWithIntervalIfNeeded(t,e.interval)}const a=i.panes(),l=[];for(let e=a.length;e--;){const t=a[e],i=t.containsMainSeries(),s=t.dataSources();for(let e=s.length;e--;){const t=s[e];(!i||(0,x.isStudy)(t)&&t.isRemovedByStudyTemplates())&&l.push(t)}}i.resetDeferredStudies();const c=(0,Re.closeSourcesSet)(i,l);for(let e=0;ee.zorder-t.zorder);for(let e=0;e-1,o=n?a[e]:i.createPane(e);n&&t<3&&(0,Fe.reorderDataSourcesStateZOrder)(r.sources),o.restoreState(r,!1,t),null!==o.mainDataSource()||i.removePane(o)}return(0,o.ensureNotNull)(i.paneForSource(s)).changeSourceId(s,r),i.syncESD(),s.priceScale().setMode({autoScale:!0}),i.startNotStartedStudies(),i.recalculateAllPanes(),i.fullUpdate(),c}}var ze=i(45259),Ue=i(58007);const je=(0,_.getLogger)("Chart.ChartUndoModel"),Ge=new c.TranslatedString("paste drawing",(0,l.t)("paste drawing"));class qe extends S.UndoCommand{constructor(e,t,i,s,r){super(Ge),this._needCopyToOtherCharts=!1,this._sourceState=null,this._model=e,this._clipboardData=t,this._paneIndex=this._model.panes().indexOf(i||(0,o.ensureNotNull)(this._model.paneForSource(this._model.mainSeries()))),this._pasteWithData=!!s,this._keepZIndex=!!r}redo(){const e=this._model.panes()[this._paneIndex],t=(0, o.ensureNotNull)(e.clipboardLineToolOwnerSource(this._clipboardData.source.id));null===this._sourceState&&(this._sourceState=this._getSourceState(t));const i=e.restoreLineTool(this._sourceState,this._pasteWithData,this._keepZIndex);this._clipboardData.centeredOnChart&&i.centerPosition&&i.centerPosition();const s=(0,o.ensureNotNull)(t.priceScale());i.setOwnerSource(t),i.setPriceScale(s),s.addDataSource(i),i.restoreFixedPoints(),(0,b.prepareLineToolPropertiesByOwnerSource)(i.properties(),t),i.calcIsActualSymbol(),i.createServerPoints();const r=(0,Ue.isSymbolSource)(t)||t.metaInfo().is_price_study;this._needCopyToOtherCharts=Boolean(r&&((0,Ie.drawOnAllCharts)().value()||i.linkKey().value()&&i.isSynchronizable())),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){if(!this._sourceState)return void je.logError("This command was never executed - nothing to undo");const e=this.source();this._clipboardData.centeredOnChart&&(this._clipboardData.centeredOnChart=!1,this._sourceState.points=e.normalizedPoints()),this._model.removeSource(e)}source(){return(0,o.ensureNotNull)(this._model.dataSourceForId((0,o.ensureNotNull)(this._sourceState).id))}needCopyToOtherCharts(){return this._needCopyToOtherCharts}_getSourceState(e){const t=(0,T.clone)(this._clipboardData.source);delete t.state.symbol,null!=t.linkKey&&(t.linkKey=(0,ze.randomHash)());const i=(0,o.ensureNotNull)(e.priceScale()),s=this._model,{symbol:r,currencyId:n,unitId:l}=this._clipboardData.source.state,c=(0,o.ensureNotNull)(e.symbolSource());let h=!1;!c.symbolSameAsCurrent(r)||(null!==n?n!==(0,ce.symbolCurrency)(c.symbolInfo(),void 0,!0):c.isConvertedToOtherCurrency())||(null!==l?l!==(0,ce.symbolUnit)(c.symbolInfo()):c.isConvertedToOtherUnit())||((0,Ue.isSymbolSource)(e)?h=!0:(0,x.isStudy)(e)&&(h=Boolean(e.metaInfo().is_price_study)));const d=e=>{const t=e.x*s.timeScale().width(),r=e.y*i.height()-40;return new a.Point(t,r)},u=(0,o.ensureNotNull)(e.firstValue());if(this._model.id()===this._clipboardData.modelId||!h)for(let e=0;e(0,Je.trackEvent)("SOS","Apply SOS","Rebind SOS")),this._chartModel.setShouldBeSavedEvenIfHidden(!0),null!==this._paneState){(0,o.ensureNotNull)(this._chartModel.paneForSource(t)).restoreState(this._paneState,!1,this._chartModel.version()),this._paneState=null}}undo(){const e=(0,o.ensureNotNull)(this._chartModel.dataSourceForId((0,o.ensureNotNull)(this._studyId))),t=(0,o.ensureNotNull)(this._chartModel.paneForSource(e)).state();this._chartModel.removeSource(e)&&(this._paneState=t)}insertedStudy(){return this._chartModel.dataSourceForId((0,o.ensureNotNull)(this._studyId))}}var lt=i(18174),ct=i(16389),ht=i.n(ct),dt=i(42010),ut=i(36292),pt=i(27490);const _t=new c.TranslatedString("zoom",(0,l.t)("zoom"));class mt extends S.UndoCommand{constructor(e,t,i,s,r,n){super(_t),this._barSpacing=null,this._rightBarsOffset=null,this._leftBarsOffset=null,this._priceMode=null,this._model=e,this._startBar=t,this._endBar=i,this._startPrice=s,this._endPrice=r,this._pane=n}redo(){const e=(0,o.ensureNotNull)(this._model.timeScale().visibleBarsStrictRange());this._leftBarsOffset=e.firstBar()-this._startBar,this._rightBarsOffset=e.lastBar()-this._endBar,this._barSpacing=this._model.timeScale().barSpacing(),this._priceMode=this._pane.defaultPriceScale().mode(),this._model.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)}undo(){const e=this._model.timeScale(),t=this._pane.defaultPriceScale(),i=(0,o.ensureNotNull)(e.visibleBarsStrictRange());e.setBarSpacing((0,o.ensureNotNull)(this._barSpacing)),e.zoomToBarsRange(i.firstBar()+(0,o.ensureNotNull)(this._leftBarsOffset),i.lastBar()+(0,o.ensureNotNull)(this._rightBarsOffset)),t.setMode((0,o.ensureNotNull)(this._priceMode)),t.recalculatePriceRange((0,o.ensureNotNull)(e.visibleBarsStrictRange())),this._model.recalculateAllPanes(),this._model.lightUpdate()}}const gt=(0,_.getLogger)("Chart.ChartUndoModel"),ft=new c.TranslatedString("zoom",(0,l.t)("zoom"));class vt extends S.UndoCommand{constructor(e,t,i){super(ft),this._baseCmd=e,this._zoomStack=t,this._inOut=i}undo(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void gt.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}else this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)}redo(){if(this._inOut)this._baseCmd.redo(),this._zoomStack.push(this._baseCmd);else{if(this._baseCmd!==this._zoomStack.head())return void gt.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}}}const St=new c.TranslatedString("stop syncing drawing",(0,l.t)("stop syncing drawing"));class yt extends S.UndoCommand{constructor(e,t){super(St),this._model=e, this._sourceId=t.id(),this._linkKey=t.linkKey().value()}redo(){(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(null)}undo(){(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(this._linkKey)}}const bt=new c.TranslatedString("restore defaults",(0,l.t)("restore defaults"));class wt extends S.UndoCommand{constructor(e,t,i=bt){super(i),this._chartModel=e,this._defaultProperty=t,this._state=t.state()}redo(){this._chartModel.restoreFactoryDefaults(this._defaultProperty)}undo(){this._defaultProperty.mergeAndFire(this._state),this._chartModel.mainSeries().onChartStyleChanged()}}var Pt=i(25220);class Ct extends wt{redo(){this._defaultProperty.hasChild("intervalsVisibilities")&&this._defaultProperty.childs().intervalsVisibilities.mergeAndFire(Pt.intervalsVisibilitiesDefaults),super.redo()}}class Tt extends Ct{redo(){super.redo(),this._chartModel.recalcColorStudies(!0)}undo(){super.undo(),this._chartModel.recalcColorStudies(!0)}}var xt=i(89537);const It=new c.TranslatedString("send {title} backward",(0,l.t)("send {title} backward")),Mt=new c.TranslatedString("bring {title} forward",(0,l.t)("bring {title} forward")),Lt=new c.TranslatedString("insert {title} after {target}",(0,l.t)("insert {title} after {target}")),At=new c.TranslatedString("insert {title} before {target}",(0,l.t)("insert {title} before {target}")),kt=new c.TranslatedString("cut {title}",(0,l.t)("cut {title}")),Et=new c.TranslatedString("cut sources",(0,l.t)("cut sources")),Dt=new c.TranslatedString("remove {title}",(0,l.t)("remove {title}")),Vt=new c.TranslatedString("remove drawings group",(0,l.t)("remove drawings group")),Bt=new c.TranslatedString("move scale",(0,l.t)("move scale")),Nt=new c.TranslatedString("stop syncing line tool(s)",(0,l.t)("stop syncing line tool(s)")),Rt=new c.TranslatedString("zoom out",(0,l.t)("zoom out")),Ot=new c.TranslatedString("zoom in",(0,l.t)("zoom in")),Ft=new c.TranslatedString("move drawing(s)",(0,l.t)("move drawing(s)")),Wt=new c.TranslatedString("load default drawing template",(0,l.t)("load default drawing template")),Ht=new c.TranslatedString("change currency",(0,l.t)("change currency")),zt=new c.TranslatedString("change unit",(0,l.t)("change unit")),Ut=new c.TranslatedString("clone line tools",(0,l.t)("clone line tools")),jt=new c.TranslatedString("merge up",(0,l.t)("merge up")),Gt=new c.TranslatedString("merge down",(0,l.t)("merge down")),qt=new c.TranslatedString("merge to pane",(0,l.t)("merge to pane")),Yt=new c.TranslatedString("unmerge up",(0,l.t)("unmerge up")),$t=new c.TranslatedString("unmerge down",(0,l.t)("unmerge down")),Kt=new c.TranslatedString("unmerge to new bottom pane",(0,l.t)("unmerge to new bottom pane")),Xt=new c.TranslatedString("move {title} to new right scale",(0,l.t)("move {title} to new right scale")),Zt=new c.TranslatedString("move {title} to new left scale",(0,l.t)("move {title} to new left scale")),Jt=new c.TranslatedString("make {title} no scale (Full screen)",(0, l.t)("make {title} no scale (Full screen)")),Qt=new c.TranslatedString("scroll time",(0,l.t)("scroll time")),ei=new c.TranslatedString("scale time",(0,l.t)("scale time")),ti=new c.TranslatedString("reset time scale",(0,l.t)("reset time scale")),ii=new c.TranslatedString("reset scales",(0,l.t)("reset scales")),si=new c.TranslatedString("create {tool}",(0,l.t)("create {tool}")),ri=new c.TranslatedString("change {pointIndex} point",(0,l.t)("change {pointIndex} point")),ni=new c.TranslatedString("paste {title}",(0,l.t)("paste {title}")),oi=new c.TranslatedString("insert {title}",(0,l.t)("insert {title}")),ai=new c.TranslatedString("remove all studies",(0,l.t)("remove all studies")),li=new c.TranslatedString("remove drawings",(0,l.t)("remove drawings")),ci=new c.TranslatedString("remove all studies and drawing tools",(0,l.t)("remove all studies and drawing tools"));function hi(e,t){return{bringForwardEnabled:e.bringForwardEnabled||t.bringForwardEnabled,bringToFrontEnabled:e.bringToFrontEnabled||t.bringToFrontEnabled,sendBackwardEnabled:e.sendBackwardEnabled||t.sendBackwardEnabled,sendToBackEnabled:e.sendToBackEnabled||t.sendToBackEnabled}}function di(e){return new c.TranslatedString(e.name(),e.title())}class ui extends(r()){constructor(e,t,i,s,r,n,o,a,l,c,h){super(),this._createLineCommand=null,this._initialTimeScrollState=null,this._initialTimeScrollPos=null,this._scalePriceInfo=null,this._currentSourceMoveCommand=null,this._currentLineChangeCommand=null,this._currentCustomMoveCommand=null,this._zoomStack=new v.UndoStack,this._lineToolsDoNotAffectChartInvalidation=new Ce.FeatureToggleWatchedValue("do_not_invalidate_chart_on_changing_line_tools",!1),this._chartWidget=n,this.m_model=new(ht())(e,t,i,s,r,this,a,l,c,h),this._undoHistory=o,this._lineToolsGroupController=new Ne({model:this._model.bind(this),pushUndoCommand:this._pushUndoCommand.bind(this),beginUndoMacro:(e,t)=>{this._undoHistory.beginUndoMacro(e).setCustomFlag("doesnt_affect_save",!!t)},endUndoMacro:this._undoHistory.endUndoMacro.bind(this._undoHistory),emitEvent:this.emitEvent.bind(this)})}undoHistory(){return this._undoHistory}setWatchedValue(e,t,i){this._undoHistory.setWatchedValue(e,t,i)}lineToolsGroupController(){return this._lineToolsGroupController}mergeAllScales(e){!function(e,t){e.beginUndoMacro("left"===t?m:g),e.model().panes().forEach(i=>{const s="left"===t?i.rightPriceScales():i.leftPriceScales(),r=("left"===t?i.leftPriceScales():i.rightPriceScales()).concat(s),n="overlay"===i.priceScalePosition(i.defaultPriceScale())?r[0]:i.defaultPriceScale();e.movePriceScale(i,n,t,0),r.forEach(t=>{if(t===n)return;let s=t.mainSource();for(;null!==s;){e.moveToScale(s,i,n,null,!0);const r=t.mainSource();if(r===s){f.logError("Loop detected while trying to merge scales");break}s=r}})}),e.endUndoMacro(),e.model().fullUpdate()}(this,e)}movePriceScale(e,t,i,s){const r=new y(this._model(),e,t,i,s,Bt);this._pushUndoCommand(r)}createLineTool(e,t,i,s,r,n,a){if(("LineToolRegressionTrend"===i||"LineToolAnchoredVWAP"===i)&&!this.canCreateStudy())return(0, d.showTooManyStudiesNotice)(),null;const l=si.format({tool:new c.TranslatedString(i,k.lineToolsLocalizedNames[i])});this.beginUndoMacro(l,this._lineToolsDoNotAffectChartInvalidation.value());const h=!a;this._createLineCommand=new D(this._model(),e,i,n||(0,o.ensureNotNull)(e.mainDataSource()),(0,Ie.drawOnAllCharts)().value());const u=this._createLineCommand.startCreatingLine(t,s,r||null),p=(0,o.ensureNotNull)(this._createLineCommand.line());let _=null;if(u&&(h&&this.finishLineTool(p),this._pushUndoCommand(this._createLineCommand),this._createLineCommand=null,_={points:p.normalizedPoints(),interval:this.mainSeries().interval()}),h&&void 0===r&&(0,Ie.drawOnAllCharts)().value()&&p.isSynchronizable()){const e=(0,o.ensureNotNull)(this.model().externalTimeStamp(t.index)),s={point:{price:t.price,timeStamp:e},linetool:i,properties:p.properties(),symbol:this.mainSeries().symbol(),model:this.model(),linkKey:(0,o.ensureNotNull)(p.linkKey().value()),finalState:_};p.isFixed()&&(s.pointPositionPercents=p.calcPositionPercents()[0]),(0,Ie.createLineTool)(s)}return this.endUndoMacro(),p}continueCreatingLine(e,t,i,s){const r=(0,o.ensureNotNull)(this._createLineCommand);this.beginUndoMacro(r.text(),this._lineToolsDoNotAffectChartInvalidation.value());const n=(0,o.ensureNotNull)(this._model().lineBeingCreated()),a=r.continueCreatingLine(e,t,i,s);let l=null;if(a&&(this.finishLineTool(n),this._pushUndoCommand(r),this._createLineCommand=null,l={points:n.normalizedPoints(),interval:this.mainSeries().interval()}),r.drawOnAllCharts()&&n.isSynchronizable()){const i=(0,o.ensureNotNull)(this._model().externalTimeStamp(e.index));(0,Ie.continueLineTool)({point:{price:e.price,timeStamp:i},envState:t,finalState:l,model:this._model()})}return this.endUndoMacro(),a}continueExternalLine(e,t,i){const s=(0,o.ensureNotNull)(this._createLineCommand),r=s.continueCreatingLine(e,t,i);return r&&(this._pushUndoCommand(s),this._createLineCommand=null),r}finishLineTool(e){this._model().finishLineTool(e)}pasteImageAsLineTool(e,t,i){return null}loadRange(e){this._pushUndoCommand(new ge(this._model(),e))}unlinkLines(e){const t=this.model();this.beginUndoMacro(Nt,this._lineToolsDoNotAffectChartInvalidation.value());for(const i of e)null!==i.linkKey().value()&&(0,Ie.removeLineTool)({withUndo:!0,model:this.model(),symbol:i.symbol(),linkKey:(0,o.ensureNotNull)(i.linkKey().value()),sourceTitle:di(i),lineToolState:i.state(!1),unlink:!0}),this._pushUndoCommand(new yt(t,i));this.endUndoMacro()}zoomFromViewport(){const e=new vt((0,o.ensureDefined)(this._zoomStack.head()),this._zoomStack,!1);this._pushUndoCommand(e)}zoomToViewport(e,t,i,s,r){const n=new mt(this.m_model,e,t,i,s,r),o=new vt(n,this._zoomStack,!0);this._pushUndoCommand(o)}zoomStack(){return this._zoomStack}hoveredSource(){return this.m_model.hoveredSource()}setProperty(e,t,i,s){if(e&&e.value()!==t){const r=new Te(e,t,i,this.m_model,s);this._pushUndoCommand(r),this.emitEvent("setProperty")}}withMacro(e,t,i){const s=this.beginUndoMacro(e,i);try{t()}finally{this.endUndoMacro()}return s}barsMarksSources(){ return this.m_model.barsMarksSources()}barMarksSourceForId(e){return this.m_model.barMarksSourceForId(e)}removeAllDrawingTools(){this.beginUndoMacro(li,!0),this._removeAllDrawingToolsImpl(),this.endUndoMacro()}removeAllStudiesAndDrawingTools(){this.beginUndoMacro(ci),this._removeAllDrawingToolsImpl(),this._removeAllStudiesImpl(),this.endUndoMacro()}removeAllStudies(){this.beginUndoMacro(ai),this._removeAllStudiesImpl(),this.endUndoMacro()}canZoomIn(){return this.model().canZoomIn()}canZoomOut(){return this.model().canZoomOut()}zoomOut(){const e=this.timeScale().width();if(this.canZoomOut()){try{this.beginUndoMacro(Rt)}catch(e){return}(0,fe.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(0),this.scaleTimeTo(e),this.endScaleTime()},onComplete:()=>this.endUndoMacro()})}}zoomIn(){const e=this.timeScale().width();if(this.canZoomIn()){try{this.beginUndoMacro(Ot)}catch(e){return}(0,fe.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(e),this.scaleTimeTo(0),this.endScaleTime()},onComplete:()=>this.endUndoMacro()})}}startMovingSources(e,t,i,s){e.filter(e=>e.doesMovingAffectsUndo()).length&&(this._currentSourceMoveCommand=new I(this.model(),e,Ft,!1),e.every(b.isLineTool)&&this._currentSourceMoveCommand.setCustomFlag("doesnt_affect_save",this._lineToolsDoNotAffectChartInvalidation.value())),this.model().startMovingSources(e,t,i,new Map,s)}moveSources(e,t){this.model().moveSources(e,new Map,t)}endMovingSource(e,t){this.model().endMovingSources(e,void 0,t),null!==this._currentSourceMoveCommand&&(this._currentSourceMoveCommand.saveNewState(),this._pushUndoCommand(this._currentSourceMoveCommand)),this._currentSourceMoveCommand=null}startChangingLinetool(e,t,i,s,r){this._currentLineChangeCommand=new I(this.model(),[e],ri.format({pointIndex:i}),!1),this._currentLineChangeCommand.setCustomFlag("doesnt_affect_save",this._lineToolsDoNotAffectChartInvalidation.value()),this.model().startChangingLinetool(e,t,i,s,r)}changeLinePoint(e,t){this.model().changeLinePoint(e,t)}endChangingLinetool(e){this.model().endChangingLinetool(e),null!==this._currentLineChangeCommand&&(this._currentLineChangeCommand.saveNewState(),this._pushUndoCommand(this._currentLineChangeCommand)),this._currentLineChangeCommand=null}setChartStyleProperty(e,t,i){if(e.value()!==t){const s=new ue(e,t,this.mainSeries(),i,this.model(),this.chartWidget());this._pushUndoCommand(s),this.emitEvent("setChartStyleProperty"),(0,ae.trackChartStyleChanged)(e.value())}}restorePropertiesForSource(e){(0,b.isLineTool)(e)?this._restoreLineToolFactoryDefaults(e):this._restoreStudyFactoryDefaults(e)}restoreState(e,t,i){return this.m_model.restoreState(e,t,i)}async clipboardCopy(e,t=this.selection().dataSources()){if(!(0,pt.enabled)("datasource_copypaste"))return;const i=t.filter(e=>e.copiable());if(0===i.length)return;for(const e of i)if((0,x.isStudy)(e)&&e.isChildStudy())throw new Error("Can not copy child study");const s=(0,V.clipboardDataForSources)(this._model().id(),i);return null!==s?e.write({app:JSON.stringify(s),text:s.title}):void 0} async clipboardCut(e,t=this.selection().dataSources()){if(!(0,pt.enabled)("datasource_copypaste"))return;const i=t.filter(e=>e.copiable());if(0===i.length)return;await this.clipboardCopy(e,i);const s=i.filter(e=>e.isUserDeletable());if(0===s.length)return;const r=(1===s.length?kt:Et).format({title:di(s[0])});this.beginUndoMacro(r),this.m_model.selectionMacro(()=>{this.removeSources(s,!1,r)}),this.endUndoMacro()}async clipboardPaste(e,t){let i=null;if((0,pt.enabled)("datasource_copypaste")&&(i=i||await e.read(),i.app)){const e=JSON.parse(i.app);if(null!==this.pasteSourceFromClip(t,e))return}await this._processSpecialLineToolsContents(e,i,t)}applyStudyTemplate(e,t){const i=new He(this._model(),e,t);this._pushUndoCommand(i)}startCustomMoving(e,t,i){this._currentCustomMoveCommand=new ot(this.model(),e,t,i)}customMoveBeingProcessed(){return null!==this._currentCustomMoveCommand}processCustomMove(e){(0,o.ensureNotNull)(this._currentCustomMoveCommand).move(e)}endCustomMoving(){null!==this._currentCustomMoveCommand&&this._currentCustomMoveCommand.hasChanges()&&(this._pushUndoCommand(this._currentCustomMoveCommand),this._currentCustomMoveCommand=null)}cloneLineTools(e,t){for(let t=0;t(0,o.ensureNotNull)(this.model().dataSourceForId(e)));this.copyToOtherCharts(e)}return this.endUndoMacro(),this.emitEvent("cloneLineTools"),i.newIds()}removeSource(e,t,i){this.lineBeingCreated()!==e?this.removeSources([e],t,Dt.format({title:di(e)}),i):this.cancelCreatingLine()}removeSelectedSources(){const e=this._model().selection().dataSources();if(!e.length)return;const t=(e.length>1?Vt:Dt).format({title:di(e[0])});this.removeSources(e,!1,t)}removeSources(e,t,i,s){s||(e=e.filter(e=>e.isUserDeletable()));const r=this._model(),n=r.lineToolsGroupModel(),a=e.every(b.isLineTool)&&this._lineToolsDoNotAffectChartInvalidation.value();this.beginUndoMacro(i,a),r.selectionMacro(s=>{const a=new Map;e.forEach(e=>{if((0,b.isLineTool)(e)){const t=n.groupForLineTool(e);if(null!==t){const i=a.get(t)||[];i.push(e),a.set(t,i)}null!==e.linkKey().value()&&(0,Ie.removeLineTool)({withUndo:!0,model:this.model(),linkKey:(0,o.ensureNotNull)(e.linkKey().value()),symbol:this.model().mainSeries().symbol(),lineToolState:e.state(!1),sourceTitle:di(e)})}}),a.forEach((e,t)=>{const i=new C.ExcludeLineToolsFromGroupUndoCommand(r,t,e);this._pushUndoCommand(i)});const l=new P.RemoveSourcesCommand(r,e,i),c=l.removedIds();this._pushUndoCommand(l),!t&&c.length>0&&(1===c.length?this.emitEvent("removeSource",[c[0]]):this.emitEvent("removeSources",[c]))}),this.endUndoMacro()}removeUnloadedLineTool({lineToolsSynchronizer:e,sourceTitle:t,linkKey:i,symbol:s,state:r,withUndo:n,unlink:o}){}async scrollToLineTool(e){const t=this.timeScale().logicalRange();if(null===t)return;const i=this.timeScale().barSpacing();let s=t.left() ;const r=e.points().map(e=>e.index);let n=this.timeScale().points().firstIndex();const a=this.timeScale().points().lastIndex();if(null===n||null===a)return;const l=t.length()/2;if(0===r.length||r.some(e=>t.contains(e)))return;const c=()=>{const t=e.points().map(e=>e.index),i=t.filter(e=>e<=a).reduce((e,t)=>null===e?t:Math.max(e,t),null);return null!==i?i:t.reduce((e,t)=>Math.min(e,t))};let d,u=c();if(n-l>u){const t=e.points().map(e=>e.time).filter(T.notUndefined).map(e=>e.valueOf()/1e3);if(0===t.length)return;const i=t.reduce((e,t)=>Math.min(e,t),t[0]);await this.model().gotoTime(i),u=c();s=(0,o.ensureNotNull)(this.timeScale().logicalRange()).left(),n=(0,o.ensureNotNull)(this.timeScale().points().firstIndex())}n-l>u?(d=(s-n+l)*i,this.mainSeries().setGotoDateResult({timestamp:(0,o.ensureNotNull)(this.timeScale().points().valueAt(n)),eod:!0})):d=(s-u+1+l)*i,this.startScrollTime(0),(0,fe.doAnimate)({onStep:(e,t)=>this.scrollTimeTo(t),from:0,to:Math.round(d),easing:h.easingFunc.easeInOutCubic,duration:h.dur,onComplete:()=>this.endScrollTime()})}mergeSourceUp(e){const t=new L.MergeUpUndoCommand(this._model(),e,jt);this._mergeUnmergeSource(e,t)}mergeSourceDown(e){const t=new L.MergeDownUndoCommand(this._model(),e,Gt);this._mergeUnmergeSource(e,t)}mergeToPane(e,t){const i=this._model().panes().indexOf(t),s=new L.MergeToTargetPane(this._model(),e,i,qt);this._mergeUnmergeSource(e,s)}unmergeSourceUp(e){const t=new M.UnmergeUpUndoCommand(this._model(),e,Yt);this._mergeUnmergeSource(e,t)}unmergeSourceDown(e){const t=new M.UnmergeDownUndoCommand(this._model(),e,$t);this._mergeUnmergeSource(e,t)}unmergeToNewBottomPane(e){const t=new M.UnmergeToNewBottomPane(this._model(),e,Kt);this._mergeUnmergeSource(e,t)}availableZOrderOperations(e){const t=this._model().lineToolsGroupModel(),i=e.filter(b.isLineTool),s=i.map(e=>t.groupForLineTool(e));(0,o.assert)(new Set(s).size<=1,"Cannot move line tools from different group");const r=0===s.length?null:s[0];let n={bringForwardEnabled:!1,bringToFrontEnabled:!1,sendBackwardEnabled:!1,sendToBackEnabled:!1};const a=new Set(i);for(const t of(0,A.sortSources)(e)){if((0,b.isLineTool)(t)&&null!==r){const e=(0,A.sortSources)(r.lineTools().filter(e=>!a.has(e)||e===t));n=hi(n,{bringForwardEnabled:t!==e[e.length-1],bringToFrontEnabled:t!==e[e.length-1],sendBackwardEnabled:t!==e[0],sendToBackEnabled:t!==e[0]});continue}const e=(0,o.ensureNotNull)(this._model().paneForSource(t)).sourcesByGroup().allExceptSpecialSources();if(0===e.length)continue;const i=t.zorder(),s=e[0].zorder(),l=e[e.length-1].zorder();n=hi(n,{bringForwardEnabled:i!==l,bringToFrontEnabled:i!==l,sendBackwardEnabled:i!==s,sendToBackEnabled:i!==s})}return n}sendToBack(e){if(!this.availableZOrderOperations(e).sendToBackEnabled)throw new Error("Send to back operation is unavailable");let t=null;const i=e[0];if((0,b.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new X(this.model(),(0,A.sortSources)(e),i[0])}}null===t&&(t=new q(this.model(),(0,A.sortSources)(e))), this._pushUndoCommand(t),this.emitEvent("changeZOrder",[e])}bringToFront(e){if(!this.availableZOrderOperations(e).bringToFrontEnabled)throw new Error("Bring to front operation is unavailable");let t=null;const i=e[0];if((0,b.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new $(this.model(),(0,A.sortSources)(e),i[i.length-1])}}null===t&&(t=new G(this.model(),(0,A.sortSources)(e))),this._pushUndoCommand(t),this.emitEvent("changeZOrder",[e])}sendBackward(e){if(!this.availableZOrderOperations(e).sendBackwardEnabled)throw new Error("Send backward operation is unavailable");const t=It.format({title:di(e[0])});this._sendBackOrBringForward(t,(0,A.sortSources)(e),(e,t)=>new J(this.model(),e,t))}bringForward(e){if(!this.availableZOrderOperations(e).bringForwardEnabled)throw new Error("Bring forward operation is unavailable");const t=Mt.format({title:di(e[0])});this._sendBackOrBringForward(t,(0,A.sortSources)(e),(e,t)=>new ee(this.model(),e,t))}insertAfter(e,t){e=(0,A.sortSources)(e);const i=Lt.format({title:di(e[0]),target:di(t)});this._insertAfterOrBefore(i,e,t,()=>new $(this.model(),e,t))}insertBefore(e,t){e=(0,A.sortSources)(e);const i=At.format({title:di(e[0]),target:di(t)});this._insertAfterOrBefore(i,e,t,()=>new X(this.model(),e,t))}detachToRight(e,t){(0,Je.trackEvent)("Chart","Move to new right scale");const i=Xt.format({title:di(e)}),s=new Ke.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"right",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachToLeft(e,t){(0,Je.trackEvent)("Chart","Move to new left scale");const i=Zt.format({title:di(e)}),s=new Ke.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"left",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachNoScale(e,t){(0,Je.trackEvent)("Chart","Make source no scale");const i=Jt.format({title:di(e)}),s=new Ke.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"overlay",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}moveToScale(e,t,i,s,r){(0,Je.trackEvent)("Chart","Move source to target scale"),this.beginUndoMacro(s);const n=new Ke.MoveToExistingPriceScaleUndoCommand(this.model(),e,t,i,s),o=r?null:(0,Qe.sourceNewCurrencyOnPinningToPriceScale)(e,i,this._model()),a=r?null:(0,dt.sourceNewUnitOnPinningToPriceScale)(e,i,this._model());this._pushUndoCommand(n),null!==o&&this.setPriceScaleCurrency(i,o),null!==a&&this.setPriceScaleUnit(i,a),this.endUndoMacro(),this.emitEvent("moveSource",[e])}startScrollTime(e){const t=this.timeScale();this._initialTimeScrollState={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()},this._initialTimeScrollPos=e,this.model().startScrollTime(e)}scrollTimeTo(e){let t=!1;return null!==this._initialTimeScrollPos&&null!==this._initialTimeScrollState&&Math.abs(e-this._initialTimeScrollPos)>20&&(this._pushUndoCommand(new oe.TimeScaleChangeUndoCommand(this.model(),this._initialTimeScrollState,Qt)),this._initialTimeScrollPos=null,this._initialTimeScrollState=null,t=!0),this.model().scrollTimeTo(e),t}endScrollTime(){ this.model().endScrollTime(),this._initialTimeScrollPos=null,this._initialTimeScrollState=null}startScaleTime(e){const t=this.timeScale(),i={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()};this._pushUndoCommand(new oe.TimeScaleChangeUndoCommand(this.model(),i,ei)),this.model().startScaleTime(e)}scaleTimeTo(e){this.model().scaleTimeTo(e)}endScaleTime(){this.model().endScaleTime()}resetTimeScale(){const e=this.timeScale(),t={rightOffset:e.rightOffset(),barSpacing:e.barSpacing()};this._pushUndoCommand(new oe.TimeScaleChangeUndoCommand(this.model(),t,ti)),this.model().resetTimeScale()}startScalePrice(e,t,i,s){this._scalePriceInfo={priceScaleState:t.state(),tryMergeConsecutiveScales:s},this.model().startScalePrice(e,t,i)}scalePriceTo(e,t,i){this.model().scalePriceTo(e,t,i)}endScalePrice(e,t){this.model().endScalePrice(e,t);const i=(0,o.ensureNotNull)(this._scalePriceInfo);(0,n.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new ut.PriceScaleChangeUndoCommand(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}startTwoPointsScalePrice(e,t,i,s,r){this._scalePriceInfo={priceScaleState:t.state(),tryMergeConsecutiveScales:r},this.model().startTwoPointsScalePrice(e,t,i,s)}twoPointsScalePriceTo(e,t,i,s){this.model().twoPointsScalePriceTo(e,t,i,s)}endTwoPointsScalePrice(e,t){this.model().endTwoPointsScalePrice(e,t);const i=(0,o.ensureNotNull)(this._scalePriceInfo);(0,n.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new ut.PriceScaleChangeUndoCommand(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}resetPriceScale(e,t){const i=t.state();this.model().resetPriceScale(e,t),(0,n.default)(i,t.state())||this._pushUndoCommand(new ut.PriceScaleChangeUndoCommand(this.m_model,e,t,i))}rearrangePanes(e,t){const i=new ne(this._model(),e,t);this._pushUndoCommand(i)}movePane(e,t){const i=new ne(this._model(),e,t);this._pushUndoCommand(i)}pasteSourceFromClip(e,t,i){const s=t;if(!s||0===s.sources.length)return null;const r=e||(0,o.ensureNotNull)(this.model().paneForSource(this.mainSeries()));if(!s.sources.some(e=>"drawing"!==e.type||null!==r.clipboardLineToolOwnerSource(e.source.id)))return null;this.beginUndoMacro(ni.format({title:s.title}));let n=0;const a=[],l=[];for(const t of s.sources)if("drawing"===t.type&&null!==r.clipboardLineToolOwnerSource(t.source.id)){const e=this.pasteLineTool(r,t);n<5&&((0,ae.trackDrawingPasted)(e),n+=1),l.push(e),a.push(e)}else"study"===t.type&&t.source&&t.source.metaInfo&&this.checkIfFeatureAvailable(new(p())(t.source.metaInfo))&&a.push(this.pasteStudy(t,i?e:void 0));return l.length&&this.selectionMacro(e=>{e.clearSelection(),l.forEach(t=>{e.addSourceToSelection(t,null)})}),this.endUndoMacro(),a}pasteLineTool(e,t,i,s){t.source.state.intervalsVisibilities=(0,xt.mergeIntervalVisibilitiesDefaults)(t.source.state.intervalsVisibilities),(0,xt.makeIntervalsVisibilitiesVisibleAtInterval)(t.source.state.intervalsVisibilities,_e.Interval.parse(this.model().mainSeries().interval())) ;const r=new qe(this.model(),t,e,i,s);this._pushUndoCommand(r);const n=r.source();return r.needCopyToOtherCharts()&&this.copyToOtherCharts([n]),this.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(n,null)}),n}pasteStudy(e,t){const i=new it(this.model(),e,null==t?void 0:t.id());this._pushUndoCommand(i);const s=(0,o.ensureNotNull)(i.state()).id;return(0,o.ensureNotNull)(this._model().dataSourceForId(s))}setPriceScaleCurrency(e,t){const i=new Ye.SetPriceScaleCurrencyUndoCommand(e,t,this.chartWidget(),Ht);this._pushUndoCommand(i)}setPriceScaleUnit(e,t){const i=new $e.SetPriceScaleUnitUndoCommand(e,t,this.chartWidget(),zt);this._pushUndoCommand(i)}setSymbol(e,t){e.symbol()!==t&&this._pushUndoCommand(new Ze(e,t,this.chartWidget()))}copyToOtherCharts(e){const t=this.mainSeries(),i=t.syncModel(),s=this.timeScale();if(i)for(const r of e){if(!r.isSynchronizable())continue;const e=r.linkKey().value()||(0,ze.randomHash)();r.linkKey().setValue(e);const n=r.state(!1),a=r.normalizedPoints(),l=r.properties().interval.value(),c=t.interval();let h;if(_e.Interval.isEqual(l,c))h=a.map(e=>{const t=(0,o.ensureNotNull)(s.timePointToIndex(e.time_t))+e.offset;return{price:e.price,timeStamp:(0,o.ensureNotNull)(this.model().externalTimeStamp(t))}});else{const e=i.createNewModelWithResolution(l);h=a.map(t=>({price:t.price,timeStamp:0===t.offset?t.time_t:e.projectTime(t.time_t,t.offset)}))}const d={...n,linkKey:e,points:h,linetool:r.toolname,model:this.model(),symbol:t.symbol(),finalState:{points:a,interval:l}};r.isFixed()&&(d.pointPositionPercents=r.calcPositionPercents()),(0,Ie.copyLineTool)(d)}}addPaneStretchFactorUndoCommand(e,t,i,s){const r=new st(this.model(),e,t,i,s);this._pushUndoCommand(r)}paneForSource(e){return this.m_model.paneForSource(e)}destroy(){this._lineToolsDoNotAffectChartInvalidation.destroy(),this.m_model.destroy()}moveSelectedToolsLeft(){return this._moveSelectedTools(2)}moveSelectedToolsUp(){return this._moveSelectedTools(0)}moveSelectedToolsRight(){return this._moveSelectedTools(3)}moveSelectedToolsDown(){return this._moveSelectedTools(1)}insertStudyWithoutCheck(e,t){return this._insertStudy(e,t,{},!1,void 0,void 0,void 0,void 0,void 0,null,void 0)}saveLineToolState(e,t){this._pushUndoCommand(new I(this.m_model,[e],t))}resetScales(){this.beginUndoMacro(ii),this.resetTimeScale();for(const e of this.m_model.panes()){for(const t of e.leftPriceScales())this.resetPriceScale(e,t);for(const t of e.rightPriceScales())this.resetPriceScale(e,t)}this.endUndoMacro(),this.m_model.recalculateAllPanes()}_mergeUnmergeSource(e,t){this.beginUndoMacro(t.text());const i=(0,o.ensureNotNull)(this._model().paneForSource(e)),s=new Set(i.sourcesByGroup().lineSources().filter(t=>t.ownerSource()===e));this._model().lineToolsGroupModel().groups().filter(e=>{const t=e.lineTools().some(e=>s.has(e)),i=e.lineTools().some(e=>!s.has(e));return t&&i}).forEach(e=>{this._pushUndoCommand(new C.ExcludeLineToolsFromGroupUndoCommand(this._model(),e,e.lineTools()))}),this._pushUndoCommand(t),this.endUndoMacro()}_insertStudy(e,t,i,s,r,n,a,l,c,h,d){ const u=oi.format({title:e.description});this.beginUndoMacro(u);const p=new at(this.model(),e,t,i,s,r,n,a,l,c,h||null,u);this._pushUndoCommand(p);const _=p.insertedStudy();if(void 0!==d){const e=new lt.SetPriceScaleModeCommand(d,(0,o.ensureNotNull)(_.priceScale()),null,this.model());this._pushUndoCommand(e)}return this.endUndoMacro(),_}async _processSpecialLineToolsContents(e,t,i){0}_insertAfterOrBefore(e,t,i,s){const r=(0,o.ensureNotNull)(this._model().paneForSource(i));if(t.some(e=>(0,b.isLineTool)(e)&&this._model().paneForSource(e)!==r))throw new Error("Cannot insert line tool after target on another pane");this.beginUndoMacro(e),t.forEach(e=>{(0,o.ensureNotNull)(this.model().paneForSource(e))!==r&&this.mergeToPane(e,r)});const n=s();this._pushUndoCommand(n),this.emitEvent("changeZOrder",[t]),this.endUndoMacro()}_sendBackOrBringForward(e,t,i){const s=new Map;t.forEach(e=>{const t=(0,o.ensureNotNull)(this._model().paneForSource(e)),i=s.get(t)||[];i.push(e),s.set(t,i)}),this.beginUndoMacro(e),s.forEach((e,t)=>{this._pushUndoCommand(i(t,e))}),this.endUndoMacro(),this.emitEvent("changeZOrder",[t])}_moveSelectedTools(e){const t=this.model().selection().lineDataSources();if(0===t.length)return!1;if((0,Ie.lockDrawings)().value())return!0;const i=this.timeScale().visibleBarsStrictRange();if(null===i)return!1;const s=function(e){const t=new Map;for(const i of e){const e=i.ownerSource();if(null===e)continue;let s=t.get(e);if(void 0===s){const r=e.priceScale(),n=e.priceStep(),o=e.firstValue();if(null===r||null===n||null===o)continue;if(null===r.priceRange())continue;s={sources:[],priceScale:r,priceStep:n,startPrice:i.points()[0].price,firstValue:o},t.set(e,s)}s.sources.push(i)}return t}(t);if(0===s.size)return!1;this.beginUndoMacro(Ft,this._lineToolsDoNotAffectChartInvalidation.value());const r=i.firstBar(),n=this.timeScale().indexToCoordinate(r),o=r+(3===e?1:2===e?-1:0),l=this.timeScale().indexToCoordinate(o);return Ie.isDirectionalMovementActive.setValue(!0),s.forEach(t=>{const{startPrice:i,priceStep:s,priceScale:c,firstValue:h}=t,d=i+(0===e?s:1===e?-s:0),u=c.priceToCoordinate(i,h),p=c.priceToCoordinate(d,h),_={logical:{index:r,price:i},screen:new a.Point(n,u)},m={logical:{index:o,price:d},screen:new a.Point(l,p)};this.startMovingSources(t.sources,_,null),this.moveSources(m),this.endMovingSource(!1,!0)}),Ie.isDirectionalMovementActive.setValue(!1),this.endUndoMacro(),!0}_restoreStudyFactoryDefaults(e){const t=new Tt(this.m_model,e.properties());this._pushUndoCommand(t)}_restoreLineToolFactoryDefaults(e){this.beginUndoMacro(Wt,this._lineToolsDoNotAffectChartInvalidation.value()),this.saveLineToolState(e,Wt);const t=new Ct(this.m_model,e.properties(),Wt);this._pushUndoCommand(t),this.saveLineToolState(e,Wt),this.endUndoMacro(),this.model().updateSource(e)}_removeAllDrawingToolsImpl(e){this.selectionMacro(()=>{this.lineBeingCreated()&&this.cancelCreatingLine();this.dataSources().filter(b.isLineTool).filter(e=>e.isActualSymbol()&&e.isUserDeletable()).filter(t=>!e||e===t.toolname).forEach(e=>this.removeSource(e,!1))})} _removeAllStudiesImpl(){const e=this.dataSources(),t=e.filter(x.isStudy).filter(e=>!e.isChildStudy()&&e.removeByRemoveAllStudies()),i=e.filter(x.isStudyStub);t.concat(i).forEach(e=>this.removeSource(e,!1))}}},16389:(e,t,i)=>{"use strict";var s=i(5729),r=i(16282).ensureNotNull,n=i(64222),o=i(31707).ChartModelBase,a=i(67945),l=a.isLineTool,c=a.isStudyLineTool,h=i(75066).Watermark,d=i(43367).CheckMobile,u=i(47329).InvalidationMask,p=i(47329).InvalidationLevel,_=i(39951),m=_.Study,g=i(58891).NonSeriesStudy,f=i(17e3),v=f.createStudy,S=f.isStudy,y=f.isFundamentalStudy,b=_.prepareStudyProperties,w=i(15521),P=i(11092).saveDefaultProperties,C=i(71090).TimeSynchronizer,T=i(65447).getLogger("Chart.ChartModel"),x=i(27089).MainSeriesScaleRatioProperty,I=i(2397).scaleRatio,M=i(62311).StudyInserter,L=i(23930).dateFormatProperty,A=i(58007).isSymbolSource,k=i(32158).sourceNewCurrencyOnPinningToPriceScale,E=i(42010).sourceNewUnitOnPinningToPriceScale,D=i(18437),V=i(20984).StudyColorRotatorFactory,B=i(27490),N=i(63103).AppliedTimeFrame,R=B.enabled("auto_enable_symbol_labels");B.enabled("fix_left_edge");class O extends o{constructor(e,t,i,r,n,o,a,l,c,d){super(e,t,i,r,n,o,a,l,c,d);var u=this,p=this.m_mainSeries.properties(),_=this._panes[0];_.setStretchFactor(2*_.stretchFactor()),this._properties.listeners().subscribe(this,O.prototype.propertyChangeHandler),this._properties.timezone.listeners().subscribe(null,(function(){u._chartApi&&u._chartApi.isConnected().value()&&u._chartApi.switchTimezone(u.timezone())})),_.addDataSource(this.m_mainSeries,this._panes[0].findSuitableScale(this.m_mainSeries)),this._mainSeriesScaleRatioProperty=new x(this),this.m_mainSeries.dataEvents().completed().subscribe(this,function(){this._scrollingState&&this.gotoTime()}.bind(this)),this.m_mainSeries.onIntervalChanged().subscribe(this,(function(){this._recalcVRStudiesParams.oldStartVisibleIndex=NaN,this._recalcVRStudiesParams.oldEndVisibleIndex=NaN})),this._readOnly||(p.addChild("priceAxisProperties",this.m_mainSeries.m_priceScale.properties()),this._properties.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,(function(e){e.value()||u._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)}))),this._barsMarksSources=a(this);for(var m=0;m0),n?{left:0,right:1,totallySlots:i}:{left:1,right:0,totallySlots:i}}return{left:e,right:t,totallySlots:e+t}}startScrollPrice(e,t,i){ e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,p.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,p.Light))}setPriceAutoScale(e,t,i){e.setPriceAutoScale(t,i),this.invalidate(this._paneInvalidationMask(e,p.Light))}updateScales(e,t){this._undoModel._chartWidget._updateScalesActions()}mainSeriesScaleRatioProperty(){return this._mainSeriesScaleRatioProperty}mainSeriesScaleRatioPropertyOnChanged(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)}mainSeriesScaleRatio(){return I(this._timeScale,this.m_mainSeries.priceScale())}setMainSeriesScaleRatio(e){this.paneForSource(this.m_mainSeries).applyPriceScaleRatio(this.m_mainSeries.priceScale(),e)}startScrollTime(e){this._timeScale.startScroll(e),this._isTimeScrolling=!0}scrollTimeTo(e){this._timeScale.scrollTo(e),this.recalculateAllPanes(),this.lightUpdate(),this._setScalesResetAvailable(!0)}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._isTimeScrolling=!1}recalcStudyBasedLineTools(){this.dataSources().forEach((function(e){c(e)&&e.recalcStudyIfNeeded&&e.recalcStudyIfNeeded()}))}restoreTimeScaleState(e){this._timeScale.restoreState(e),this.recalculateAllPanes(),this.lightUpdate(),this._setScalesResetAvailable(!0)}restoreFactoryDefaults(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudies(!0)}orderedDataSources(e){var t=[];t.push(this.m_crossHairSource);for(var i=0;i0)for(a=this.dataSources(),l=0;lc;this._updateBaseIndex(r,t)}T.logDebug(h),this.recalculateAllPanes(),this.lightUpdate()}updateTimeScaleBaseIndex(e){var t=this.mainSeries().bars();t.isEmpty()||this._updateBaseIndex(r(t.lastIndex()),e&&e.index>0)}_updateBaseIndex(e,t){var i=this.timeScale(),s=i.baseIndex(),r=i.visibleBarsStrictRange(),n=i.logicalRange();if(null!==n&&t){var o=n.contains(s),a=e-s,l=o?null:i.rightOffset()-a;if(!this._options.shiftVisibleRangeOnNewBar&&o){var c=i.indexToCoordinate(s)+i.barSpacing()/2+1,h=s-n.left()+a,d=c/h;if(d>=i.minBarSpacing())i.setBarSpacing(d),l=i.width()/d-h;else r.lastBar()!==s&&(l=i.rightOffset()-a)}null!==l&&i.setRightOffset(l)}i.setBaseIndex(e)}recalculatePane(e){e&&e.recalculate()}recalculateAllPanes(){for(var e=0;e1}lineBeingEdited(){return this._lineBeingEdited}linePointBeingEdited(){return this._linePointBeingEdited}calculateDefaultTags(){for(var e=[],t=this.dataSources(),i=0;i-1&&this._modelIntervals.splice(t,1)}clearIntervals(){for(var e=0;e{"use strict";var s=i(73395).makeFont,r=i(73395).parseFont,n=(0,i(65447).getLogger)("Model.ChartTradingUtils"),o={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])return this._parsedColorCache[e];var t=document.createElement("div");t.style.color=e;var i=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/i),s={r:i[1],g:i[2],b:i[3],a:i[4]||"1"};return this._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){var i=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){var s=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");var r=100*(1-s.a);i.setValue(Math.max(0,Math.min(r,100)))},getFontFromProperties:function(e,t,i,r){return s(t.value(),e.value(),r.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,o){var a=r(e);null!==a?(a.family.length>0&&t.setValue(a.family),i.setValue(a.size),s.setValue(a.bold),o.setValue(a.italic)):n.logError("Invalid font: "+e)},fontHeight:function(e){if(!this._fontHeightCache[e]){var t=document.createElement("span");t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;";var i=t.offsetHeight;document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)}return this._fontHeightCache[e]},drawPolyHoverOrPress:function(e,t,i,s){s?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",CanvasEx.drawPoly(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",CanvasEx.drawPoly(e,t,!0),e.restore())},repaint:function(e){e.lightUpdate()},roundToMinTick:function(e,t){var i=1/e.mainSource().base();return i*Math.round(t/i)}};e.exports=o},2073:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(99432).doAnimate,o=i(34854).ChartUndoModelBase,a=(i(11092).saveDefaultProperties,i(39951).Study),l=i(97102).showTooManyStudiesNotice,c=(i(5980).UndoCommand, i(64934).ApplyLineToolTemplateUndoCommand),h=i(81241).SetResolutionUndoCommand,d=i(86277).SetPriceScaleSelectionStrategyCommand,u=i(7346).SetScaleRatioPropertiesCommand,p=i(62311).StudyInserter,_=i(87438).trackEvent,m=i(65447).getLogger("Chart.ChartUndoModel"),g=i(56456).RestoreDefaultsPreferencesUndoCommand,f=i(18174).SetPriceScaleModeCommand,v=i(36292).PriceScaleChangeUndoCommand,S=i(35001).Interval,y=i(65105).ChartLoadThemeUndoCommand,b=new r("move left",s("move left")),w=new r("move right",s("move right")),P=new r("toggle auto scale",s("toggle auto scale")),C=new r("toggle lock scale",s("toggle lock scale")),T=new r("toggle regular scale",s("toggle regular scale")),x=new r("toggle indexed to 100 scale",s("toggle indexed to 100 scale")),I=new r("toggle percentage scale",s("toggle percentage scale")),M=new r("toggle log scale",s("toggle log scale")),L=new r("invert scale",s("invert scale")),A=new r("remove pane",s("remove pane")),k=(new r("apply all chart properties",s("apply all chart properties")),new r("set price scale selection strategy to {title}",s("set price scale selection strategy to {title}")));s("Cheers");t.ChartUndoModel=class extends o{constructor(e,t,i,s,r,n,o,a,l,c,h){super(e,t,i,s,r,n,o,a,l,c,h),this.beginUndoMacro=(e,t)=>{var i=o.beginUndoMacro(e);return i.setCustomFlag("doesnt_affect_save",t),i},this.endUndoMacro=o.endUndoMacro.bind(o),this.createUndoCheckpoint=o.createUndoCheckpoint.bind(o),this.undoToCheckpoint=o.undoToCheckpoint.bind(o)}version(){return this.m_model.version()}onData(e){switch(e.method){case"timescale_update":var t=e.params;this.m_model.updateTimeScale(t.index,t.zoffset,t.changes,t.index_diff,t.baseIndex,t.marks,t.clear);break;case"timescale_completed":var i=e.params[0];this.m_model.timeScale().onTimeScaleCompleted(i)}}createPane(e){return this.m_model.createPane(e)}readOnly(){return this.m_model.readOnly()}restart(){this.m_model.restart()}disconnect(){this.m_model.disconnect()}studiesMetaData(){return this.m_model.studiesMetaData()}studyVersioning(){return this.m_model.studyVersioning()}chartModel(){return this._model()}_model(){return this.m_model}pushUndoCommand(e){this._pushUndoCommand(e)}_pushUndoCommand(e){this._undoHistory.pushUndoCommand(e)}startScrollPrice(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(e,t,i))}scrollPriceTo(e,t,i){t.isAutoScale()||(this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this.pushUndoCommand(new v(this.m_model,e,t,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(e,t,i))}endScrollPrice(e,t){t.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(e,t))}setPriceAutoScale(e,t,i){this.pushUndoCommand(new v(this.m_model,e,t,t.state())),this.chartModel().setPriceAutoScale(e,t,i)}setWidth(e){this.m_model.setWidth(e)}setPaneHeight(e,t){this.m_model.setPaneHeight(e,t)}gridSource(){ return this.m_model.gridSource()}watermarkSource(){return this.m_model.watermarkSource()}addAlertsSource(e){return this.m_model.addAlertsSource(e)}alertsSources(){return this.m_model.alertsSources()}publishedChartsTimelineSource(){return this.m_model.publishedChartsTimelineSource()}crossHairSource(){return this.m_model.crossHairSource()}model(){return this.m_model}chartWidget(){return this._chartWidget}mainSeries(){return this.m_model.m_mainSeries}mainSeriesScaleRatioProperty(){return this.m_model.mainSeriesScaleRatioProperty()}panes(){return this.m_model.panes()}timeScale(){return this.m_model.timeScale()}selectionMacro(e){return this.m_model.selectionMacro(e)}setHoveredSource(e,t){this.m_model.setHoveredSource(e,t)}selection(){return this.m_model.selection()}onSelectedSourceChanged(){return this.m_model.onSelectedSourceChanged()}activeStrategySource(){return this.m_model.activeStrategySource()}invalidate(e){this.m_model.invalidate(e)}setCurrentPosition(e,t,i,s){this.m_model.setCurrentPosition(e,t,i,s)}setAndSaveCurrentPosition(e,t,i,s){this.m_model.setAndSaveCurrentPosition(e,t,i,s)}canCreateStudy(e){return this.model().chartApi().chartApi().isCanCreateStudy(e)}_isCountedStudy(e){throw new Error("Not implemented")}checkIfFeatureAvailable(e,t){var i=this.canCreateStudy(),s=t&&t instanceof a;return!this.readOnly()&&s&&(i=this.canCreateStudy(!0)),!!i||(s||l(),!1)}createStudyInserter(e,t,i){var s=this,r=null,n={createStudy:function(e,t,i,n,o,a,l,c,h,d,u){return s.checkIfFeatureAvailable(e,a)?(_("studies","Study_"+e.id),"Compare@tv-basicstudies"===e.id&&_("compare","symbol:"+t.symbol),s._insertStudy(e,t,n,o,a,l,c,h,d,r,u)):(m.logNormal("Cannot insert study "+e.id),null)}};void 0!==i&&(n.createStub=function(){var e=s.m_model.insertStudyStub(i);return r={targetPaneId:s.m_model.paneForSource(e).id(),targetZOrder:e.zorder()},e.id()},n.removeStub=function(e){return s.m_model.removeStudyStub(e)});var o=new p(e,this.m_model._studiesMetaInfoRepository,n);return o.setParentSource(t),o}setProperties(e,t,i){var s=this;this.beginUndoMacro(i),this.m_model.selectionMacro((function(){for(var r=0;r{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},32158:(e,t,i)=>{"use strict";i.d(t,{sourceNewCurrencyOnPinningToPriceScale:()=>r});var s=i(58007);function r(e,t,i,r){let n=null;if(i.currencyConversionEnabled()&&(0,s.isSymbolSource)(e)){ const s=i.availableCurrencies(),o=t.currency(s),a=e.currency();null!==o&&null!==o.selectedCurrency&&!o.allCurrenciesAreOriginal&&o.selectedCurrency!==a&&(r&&null===a||null!==a&&s.convertible(a))&&(n=o.selectedCurrency)}return n}},73853:(e,t,i)=>{"use strict";i.d(t,{CustomSourceBase:()=>s});class s{constructor(e,t){this._id=e,this._model=t}id(){return this._id}isHoveredEnabled(){return!0}isSelectionEnabled(){return!1}priceScale(){return null}paneViews(e){return[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateViewsForPane(e){e.containsMainSeries()&&this.updateAllViews()}}},58921:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMainSeriesState:()=>r,isStudyState:()=>n,isLineToolState:()=>o,isZOrderedSourceState:()=>a});var s=i(67945);function r(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function o(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return r(e)||n(e)||o(e)}},46015:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>l});i(27490);var s=i(32856),r=i.n(s),n=i(45259),o=i(5729),a=i.n(o);class l{constructor(){this.hasAlert=new(r())(!1),this._zorder=0,this.m_priceScale=null,this._id=(0,n.randomHashN)(6),this._ownerSource=null,this._userEditEnabled=!0,this._onPriceScaleChanged=new(a()),this._isSelectionEnabled=!0,this._instanceId=(0,n.randomHashN)(6),this._ownerSourceChanged=new(a()),this._zOrderChanged=new(a())}id(){return this._id}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id=e}zorder(){return this._zorder}setZorder(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e,this._zOrderChanged.fire(e))}isSpeciallyZOrderedSource(){return!1}title(){throw new Error("Implement this fun in a subclass")}name(){throw new Error("Implement this fun in a subclass")}priceScale(){return this.m_priceScale}setPriceScale(e){this.m_priceScale=e,this._onPriceScaleChanged.fire()}ownerSource(){return this._ownerSource}setOwnerSource(e){this._ownerSource=e,this._ownerSourceChanged.fire()}ownerSourceChanged(){return this._ownerSourceChanged}zOrderChanged(){return this._zOrderChanged}isSavedInChart(e){return!0}isSavedInStudyTemplates(){return!0}isRemovedByStudyTemplates(){return!0}hasContextMenu(){return!0}showInObjectTree(){return!0}setUserEditEnabled(e){this._userEditEnabled=e}userEditEnabled(){return this._userEditEnabled}canBeHidden(){return this.userEditEnabled()}isUserDeletable(){return this.userEditEnabled()}properties(){throw new Error("Implement this fun in a subclass")}isVisible(){return this.properties().visible.value()}dataWindowView(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(){}paneViews(e){return null}labelPaneViews(){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(){}getSourceIcon(){return null}state(e){throw new Error("Implement this fun in a subclass")}onPriceScaleChanged(){return this._onPriceScaleChanged}doesMovingAffectsUndo(){return!0} isMultiPaneAvailable(){return!1}isMultiPaneEnabled(){return!1}copiable(){return!1}cloneable(){return!1}movable(){return!1}isIncludedInAutoScale(){return!1}isHoveredEnabled(){return this.isSelectionEnabled()}isSelectionEnabled(){return this._isSelectionEnabled}setSelectionEnabled(e){this._isSelectionEnabled=e}firstValue(){return null}priceRange(e,t){return null}autoScaleInfo(e,t){return{range:this.priceRange(e,t)}}stateForAlert(){return null}canHasAlert(){return!1}alertCreationAvailable(){return this.hasStateForAlert()}hasStateForAlert(){return!1}idForAlert(){return this._id}}},62043:(e,t,i)=>{"use strict";i.d(t,{DataWindowItem:()=>s,DataWindowView:()=>r});class s{constructor(e,t){this._visible=!0,this._title=e,this._value=t}title(){return this._title}setTitle(e){this._title=e}text(){return this._value}value(){return this._value}setValue(e){this._value=e}visible(){return this._visible}setVisible(e){this._visible=e}color(){return this._color}setColor(e){this._color=e}}class r{constructor(){this._items=[],this._header="",this._title=""}header(){return this._header}title(){return this._title}items(){return this._items}update(){}}},23930:(e,t,i)=>{"use strict";i.d(t,{dateFormatProperty:()=>a,restoreDateFormatSettingsValue:()=>l});var s=i(64222),r=i(68137),n=i(96284);function o(){return s.getValue("date_format",(0,n.defaultDateFormat)())}const a=(0,r.createPrimitiveProperty)(o());function l(){a.setValue((0,n.defaultDateFormat)()),s.remove("date_format")}s.onSync.subscribe(null,()=>a.setValue(o())),a.listeners().subscribe(null,()=>s.setValue("date_format",a.value()))},11092:(e,t,i)=>{"use strict";var s=i(5729),r=i(76190).default,n=i(18130),o=i(674);function a(e,t,i,s){var r=e?n.defaults:n.factoryDefaults,o=t.startsWith("study_")?TradingView.clone(r("study")):{},a=TradingView.clone(r(t,s));return t.startsWith("study_")&&a.inputs&&delete a.inputs.symbol,"linetoolicon"===t&&e&&(a.icon=n.defaults(t).icon),a=l(a,i),TradingView.merge(o,a),o}function l(e,t){const i=TradingView.clone(e);return t.forEach(e=>r(i,e.split("."))),i}function c(e,t,i,r){var n;void 0===r&&(r=!0),this._defaultName=e,i?n=t:(n=a(r,e,[],null),t&&TradingView.merge(n,t)),o.call(this,n),this._defaultName=e,this._useUserPreferences=r,this.listeners().subscribe(this,c.prototype.onPropertyChanged),this._exclusions=[],this._restoreFactoryDefaultsEvent=new s}inherit(c,o),c._saveDefaults=!1,c.prototype.preferences=function(){return this.state(this._exclusions)},c.prototype.mergePreferences=function(e){this.mergeAndFire(l(e,this._exclusions))},c.prototype.addExclusion=function(e){this._exclusions.indexOf(e)<0&&this._exclusions.push(e)},c.prototype.restoreFactoryDefaults=function(){var e=a(!1,this._defaultName,this._exclusions,null);this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this.saveDefaults(),this._restoreFactoryDefaultsEvent.fire()},c.prototype.onRestoreFactoryDefaults=function(){return this._restoreFactoryDefaultsEvent},c.prototype.onPropertyChanged=function(){ !c._saveDefaults||this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this.saveDefaults()},c.prototype.saveDefaults=function(){this._useUserPreferences&&n.saveDefaults(this._defaultName,this.preferences())},c.prototype.clone=function(e){for(var t=new c(this._defaultName,this.state(),e&&e.replaceByState,this._useUserPreferences),i=0;i{"use strict";var s=i(23221).PositionPLDisplay;const{getHexColorByName:r}=i(53312),{generateColor:n}=i(50968);var o=i(23221).TradingSourcesHorizontalAlignment,a=i(74645),l=i(13953).LineToolPitchforkStyle,c=i(83641).LineToolBarsPatternMode,h=i(77455).LineStudyPlotStyle,d=i(58252),u=i(84995).PriceAxisLastValueMode,p=i(79739).StoriesTimeLineItemType,_=i(38536).MagnetMode,m=i(71172).LineEnd,g=i(26254).ColorType,f=i(98678).StatsPosition,v=i(18742).sessionsPreferencesDefault,S=i(28417).axisLabelBackgroundColor,y=i(65447).getLogger("Chart.Defaults");const b=r("color-tv-blue-500"),w=r("color-tv-blue-600"),P=r("color-ripe-red-200"),C=r("color-ripe-red-300"),T=r("color-ripe-red-400"),x=r("color-ripe-red-500"),I=r("color-ripe-red-600"),M=r("color-minty-green-100"),L=r("color-minty-green-400"),A=r("color-minty-green-500"),k=r("color-tan-orange-500"),E=n(r("color-tv-blue-500"),75);var D=function(e){var t=function(e,t){return{color:e,visible:t}},i=function(e,t,i){return{coeff:e,color:t,visible:i}},r=function(e,t,i,s,r){return{coeff:e,color:t,visible:i,linestyle:void 0===s?CanvasEx.LINESTYLE_SOLID:s,linewidth:void 0===r?1:r}},y=function(e,t,i){return{color:e,width:i,visible:t}},D=function(e,t,i,s,r){return{color:e,visible:t,width:i,x:s,y:r}},V=function(e,t,i,s,r,n){return{coeff1:e,coeff2:t,color:i,visible:s,linestyle:void 0===r?CanvasEx.LINESTYLE_SOLID:r,linewidth:void 0===n?1:n}};if(void 0===TradingView.defaultProperties){var N;switch(window.locale){case"ar_AE":N="Asia/Dubai";break;case"au":N="Australia/Sydney";break;case"br":N="America/Sao_Paulo";break;case"ca":N="America/Toronto";break;case"de_DE":case"it":N="Europe/Berlin";break;case"es":N="Europe/Madrid";break;case"fa_IR":N="Asia/Tehran";break;case"fr":case"sv_SE":N="Europe/Paris";break;case"he_IL":case"tr":N="Europe/Athens";break;case"hu_HU":case"pl":N="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":N="Asia/Bangkok";break;case"in":N="Asia/Kolkata";break;case"ja":case"kr":N="Asia/Tokyo";break;case"ms_MY":N="Asia/Singapore";break;case"ru":N="Europe/Moscow";break;case"uk":N="Europe/London";break;case"zh_CN":case"zh_TW":N="Asia/Shanghai";break;default:N="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:N,priceScaleSelectionStrategyName:"auto",dataWindowProperties:{background:"rgba( 255, 254, 206, 0.2)",border:"rgba( 96, 96, 144, 1)",font:"Verdana",fontBold:!1,fontItalic:!1,fontSize:10,transparency:80,visible:!0},paneProperties:{backgroundType:g.Solid,background:"#ffffff", backgroundGradientStartColor:"#ffffff",backgroundGradientEndColor:"#ffffff",vertGridProperties:{color:"rgba(42, 46, 57, 0.06)",style:CanvasEx.LINESTYLE_SOLID},horzGridProperties:{color:"rgba(42, 46, 57, 0.06)",style:CanvasEx.LINESTYLE_SOLID},crossHairProperties:{color:"#9598A1",style:CanvasEx.LINESTYLE_DASHED,transparency:0,width:1},topMargin:10,bottomMargin:8,axisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,alignLabels:!0,isInverted:!1},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0,showBarChange:!0,showVolume:!1,showBackground:!0,backgroundTransparency:50}},scalesProperties:{backgroundColor:"#ffffff",lineColor:"rgba(42, 46, 57, 0.14)",textColor:"#131722",fontSize:12,scaleSeriesOnly:!1,showSeriesLastValue:!0,seriesLastValueMode:u.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!0,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalNameLabel:!1,showFundamentalLastValue:!0,barSpacing:d.DEFAULT_BAR_SPACING,showCurrency:!0,showUnit:!0,axisHighlightColor:E,axisLineToolLabelBackgroundColorCommon:S.common,axisLineToolLabelBackgroundColorActive:S.active,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0},mainSeriesProperties:{style:a.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdFlagSize:2,showCountdown:!0,bidAsk:{visible:!1,lineStyle:CanvasEx.LINESTYLE_DOTTED,lineWidth:1,bidLineColor:b,askLineColor:T},prePostMarket:{visible:!0,lineStyle:CanvasEx.LINESTYLE_DOTTED,lineWidth:1,preMarketColor:"#fb8c00",postMarketColor:b},highLowAvgPrice:{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLineVisible:!1,averageClosePriceLabelVisible:!1},showInDataWindow:!0,visible:!0,showPriceLine:!0,priceLineWidth:1,priceLineColor:"",baseLineColor:"#B2B5BE",showPrevClosePriceLine:!1,prevClosePriceLineWidth:1,prevClosePriceLineColor:"rgba( 85, 85, 85, 1)",minTick:"default",dividendsAdjustment:void 0,backAdjustment:!1,settlementAsClose:!0,sessionId:"regular",sessVis:!1,statusViewStyle:{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"},candleStyle:{upColor:L,downColor:T,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:L,borderDownColor:T,wickColor:"#737375",wickUpColor:L,wickDownColor:T,barColorsOnPrevClose:!1,drawBody:!0},hollowCandleStyle:{upColor:L,downColor:T,drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:L,borderDownColor:T,wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:L,wickDownColor:T,drawBody:!0},haStyle:{upColor:L,downColor:T,drawWick:!0,drawBorder:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:L,borderDownColor:T,wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:L,wickDownColor:T,showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{},inputInfo:{},drawBody:!0},barStyle:{upColor:L,downColor:T,barColorsOnPrevClose:!1,dontDrawOpen:!1, thinBars:!0},hiloStyle:{color:b,showBorders:!0,borderColor:b,showLabels:!0,labelColor:b,fontSize:7,drawBody:!0},lineStyle:{color:b,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,priceSource:"close",styleType:a.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:n(b,72),color2:b,linecolor:b,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,priceSource:"close",transparency:100},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,isInverted:!1,alignLabels:!0},renkoStyle:{upColor:L,downColor:T,borderUpColor:L,borderDownColor:T,upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",borderUpColorProjection:"rgba( 169, 220, 195, 1)",borderDownColorProjection:"rgba( 245, 166, 174, 1)",wickUpColor:L,wickDownColor:T,inputs:{source:"close",sources:"Close",boxSize:3,style:"ATR",atrLength:14,wicks:!0},inputInfo:{source:{name:"Source"},sources:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR length"},wicks:{name:"Wicks"}}},pbStyle:{upColor:L,downColor:T,borderUpColor:L,borderDownColor:T,upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",borderUpColorProjection:"rgba( 169, 220, 195, 1)",borderDownColorProjection:"rgba( 245, 166, 174, 1)",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:L,downColor:T,upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",inputs:{source:"close",style:"ATR",atrLength:14,reversalAmount:1},inputInfo:{source:{name:"Source"},style:{name:"Style"},atrLength:{name:"ATR length"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:L,downColor:T,upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",inputs:{sources:"Close",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14,oneStepBackBuilding:!1},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR length"},oneStepBackBuilding:{name:"One step back building"}}},baselineStyle:{baselineColor:"rgba( 117, 134, 150, 1)",topFillColor1:n(L,72),topFillColor2:n(L,95),bottomFillColor1:n(T,95),bottomFillColor2:n(T,72),topLineColor:L,bottomLineColor:T,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},rangeStyle:{upColor:L,downColor:T,thinBars:!0,upColorProjection:"rgba( 169, 220, 195, 1)",downColorProjection:"rgba( 245, 166, 174, 1)",inputs:{range:10,phantomBars:!1},inputInfo:{range:{name:"Range"},phantomBars:{name:"Phantom bars"}}}},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"rgba(85, 85, 85, 1)",visible:!1,style:CanvasEx.LINESTYLE_DASHED,width:1}},tradingProperties:{showPositions:!0,positionPL:{visibility:!0,display:s.Money},showOrders:!0,showExecutions:!0,showReverse:!0,horizontalAlignment:o.Right,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:CanvasEx.LINESTYLE_SOLID}, editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},sessions:v,drawings:{magnet:!1,magnetMode:_.WeakMagnet,stayInDrawingMode:!1,drawOnAllCharts:!0},linetoolorder:{extendLeft:"inherit",lineLength:"inherit",lineColor:"rgba( 255, 0, 0, 1)",lineActiveBuyColor:"rgb(64,148,232)",lineInactiveBuyColor:"rgba(64,148,232,.5)",lineActiveSellColor:"rgb(231,86,86)",lineInactiveSellColor:"rgba(231,86,86,.5)",lineStyle:"inherit",lineWidth:"inherit",bodyBorderActiveBuyColor:"rgb(64,148,232)",bodyBorderInactiveBuyColor:"rgba(64,148,232,.5)",bodyBorderActiveSellColor:"rgb(231,86,86)",bodyBorderInactiveSellColor:"rgba(231,86,86,.5)",bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextInactiveLimitColor:"rgba(38,140,2,.5)",bodyTextActiveLimitColor:"rgb(38,140,2)",bodyTextInactiveStopColor:"rgba(231,86,86,.5)",bodyTextActiveStopColor:"rgb(231,86,86)",bodyTextInactiveBuyColor:"rgba(64,148,232,.5)",bodyTextActiveBuyColor:"rgb(64,148,232)",bodyTextInactiveSellColor:"rgba(231,86,86,.5)",bodyTextActiveSellColor:"rgb(231,86,86)",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderActiveBuyColor:"rgb(64,148,232)",quantityBorderInactiveBuyColor:"rgba(64,148,232,.5)",quantityBorderActiveSellColor:"rgb(231,86,86)",quantityBorderInactiveSellColor:"rgba(231,86,86,.5)",quantityBackgroundInactiveBuyColor:"rgba(64,148,232,.5)",quantityBackgroundActiveBuyColor:"rgb(64,148,232)",quantityBackgroundInactiveSellColor:"rgba(231,86,86,.5)",quantityBackgroundActiveSellColor:"rgb(231,86,86)",quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderActiveBuyColor:"rgb(64,148,232)",cancelButtonBorderInactiveBuyColor:"rgba(64,148,232,.5)",cancelButtonBorderActiveSellColor:"rgb(231,86,86)",cancelButtonBorderInactiveSellColor:"rgba(231,86,86,.5)",cancelButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",cancelButtonBackgroundTransparency:25,cancelButtonIconActiveBuyColor:"rgb(64,148,232)",cancelButtonIconInactiveBuyColor:"rgba(64,148,232,.5)",cancelButtonIconActiveSellColor:"rgb(231,86,86)",cancelButtonIconInactiveSellColor:"rgba(231,86,86,.5)",tooltip:"",modifyTooltip:"",cancelTooltip:""},linetoolposition:{extendLeft:"inherit",lineLength:"inherit",lineBuyColor:"rgb(64,148,232)",lineSellColor:"rgb(231,86,86)",lineStyle:"inherit",lineWidth:"inherit",bodyBorderBuyColor:"rgb(64,148,232)",bodyBorderSellColor:"rgb(231,86,86)",bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextPositiveColor:"rgb(38,140,2)",bodyTextNeutralColor:"rgb(100,100,100)",bodyTextNegativeColor:"rgb(231,86,86)",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderBuyColor:"rgb(64,148,232)",quantityBorderSellColor:"rgb(231,86,86)",quantityBackgroundBuyColor:"rgb(64,148,232)",quantityBackgroundSellColor:"rgb(231,86,86)",quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0, quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderBuyColor:"rgb(64,148,232)",reverseButtonBorderSellColor:"rgb(231,86,86)",reverseButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",reverseButtonBackgroundTransparency:25,reverseButtonIconBuyColor:"rgb(64,148,232)",reverseButtonIconSellColor:"rgb(231,86,86)",closeButtonBorderBuyColor:"rgb(64,148,232)",closeButtonBorderSellColor:"rgb(231,86,86)",closeButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",closeButtonBackgroundTransparency:25,closeButtonIconBuyColor:"rgb(64,148,232)",closeButtonIconSellColor:"rgb(231,86,86)",tooltip:"",protectTooltip:"",closeTooltip:"",reverseTooltip:""},linetoolexecution:{direction:"buy",arrowHeight:8,arrowSpacing:1,arrowBuyColor:"#4094e8",arrowSellColor:"#e75656",text:"",textColor:"rgba( 0, 0, 0, 1)",textTransparency:0,fontFamily:"Verdana",fontSize:10,fontBold:!1,fontItalic:!1,tooltip:""},linetoolicon:{color:b,size:40,icon:61720,angle:.5*Math.PI,scale:1},linetoolimage:{transparency:0,cssWidth:0,cssHeight:0,angle:0},linetoolbezierquadro:{linecolor:b,linewidth:1,fillBackground:!1,backgroundColor:n(b,80),transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Normal},linetoolbeziercubic:{linecolor:"#00bcd4",linewidth:1,fillBackground:!1,backgroundColor:"rgba(0, 188, 212, 0.2)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Normal},linetooltrendline:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:b,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:f.Right},linetoolinfoline:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:b,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!0,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!0,showBarsRange:!0,showDateTimeRange:!0,showDistance:!0,showAngle:!0,statsPosition:f.Center},linetooltimecycles:{linecolor:"rgba(21, 153, 128, 1)",linewidth:1,fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID},linetoolsineline:{linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetooltrendangle:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,textcolor:b,fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1,statsPosition:f.Right},linetooldisjointangle:{linecolor:A,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:n(A,80),transparency:20,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Normal, textcolor:A,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolflatbottom:{linecolor:"rgba(171, 71, 188, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba(171, 71, 188, 0.2)",transparency:20,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Normal,textcolor:"rgba(171, 71, 188, 1)",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolfibspiral:{counterclockwise:!1,linecolor:A,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetooldaterange:{linecolor:b,linewidth:1,textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:n(b,10),fillBackground:!0,backgroundColor:n(b,80),backgroundTransparency:60,drawBorder:!1,borderColor:n(b,10),extendTop:!1,extendBottom:!1,showLabel:!0},linetoolpricerange:{linecolor:b,linewidth:1,textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:n(b,10),fillBackground:!0,backgroundColor:n(b,80),backgroundTransparency:60,drawBorder:!1,borderColor:n(b,10),extendLeft:!1,extendRight:!1,showLabel:!0},linetooldateandpricerange:{linecolor:b,linewidth:1,textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:n(b,10),fillBackground:!0,backgroundColor:n(b,80),backgroundTransparency:60,borderWidth:1,drawBorder:!1,borderColor:b,showLabel:!0},linetoolriskrewardshort:{linecolor:"rgba(120, 123, 134, 1)",linewidth:1,textcolor:"rgba(255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 88, 88, 88, 1)",fillBackground:!0,stopBackground:n(x,80),profitBackground:n(A,80),stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolriskrewardlong:{linecolor:"rgba(120, 123, 134, 1)",linewidth:1,textcolor:"rgba(255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 88, 88, 88, 1)",fillBackground:!0,stopBackground:n(x,80),profitBackground:n(A,80),stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolarrow:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:m.Normal,rightEnd:m.Arrow,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:b,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:f.Right},linetoolray:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!0,leftEnd:m.Normal,rightEnd:m.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:b,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1, showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:f.Right},linetoolextended:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!0,extendRight:!0,leftEnd:m.Normal,rightEnd:m.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:b,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:f.Right},linetoolhorzline:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,textcolor:b,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolhorzray:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,textcolor:b,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLine:!0,showTime:!0,showLabel:!1,horzLabelsAlign:"right",vertLabelsAlign:"top",textcolor:b,textOrientation:"vertical",fontsize:14,bold:!1,italic:!1},linetoolcrossline:{linecolor:b,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showTime:!0},linetoolcirclelines:{trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",baselinecolor:"rgba( 128, 128, 128, 1)",linecolor:"rgba( 0, 85, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showLabels:!0,fillBackground:!1,transparency:80,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:r(0,"rgba(120, 123, 134, 1)",!0),level2:r(1,b,!0),level3:r(2,b,!0),level4:r(3,b,!0),level5:r(5,b,!0),level6:r(8,b,!0),level7:r(13,b,!0),level8:r(21,b,!0),level9:r(34,b,!0),level10:r(55,b,!0),level11:r(89,b,!0)},linetooltext:{color:b,fontsize:14,fillBackground:!1,backgroundColor:"rgba( 91, 133, 191, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",bold:!1,italic:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:200},linetooltextabsolute:{color:b,fontsize:14,fillBackground:!1,backgroundColor:"rgba( 155, 190, 213, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",bold:!1,italic:!1,fixedSize:!1,wordWrap:!1,wordWrapWidth:200},linetoolballoon:{color:"#ffffff",backgroundColor:"rgba(156, 39, 176, 0.7)",borderColor:"rgba(156, 39, 176, 0.0)",fontsize:14,transparency:30},linetoolbrush:{linecolor:"#00bcd4",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,smooth:5,fillBackground:!1,backgroundColor:"rgba(0, 188, 212, 0.5)",transparency:50,leftEnd:m.Normal,rightEnd:m.Normal},linetoolhighlighter:{linecolor:"rgba(236, 64, 122, 0.15)",smooth:5,transparency:85},linetoolpolyline:{linecolor:"#7e57c2",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0, backgroundColor:"rgba(126, 87, 194, 0.2)",transparency:50,filled:!1},linetoolsignpost:{itemType:p.Emoji,emoji:"🙂",showImage:!1,plateColor:b,fontSize:12,bold:!1,italic:!1},linetoolpath:{lineColor:b,lineWidth:2,lineStyle:CanvasEx.LINESTYLE_SOLID,leftEnd:m.Normal,rightEnd:m.Arrow},linetoolarrowmarkleft:{color:b,arrowColor:b,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkup:{color:A,arrowColor:A,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkright:{color:b,arrowColor:b,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkdown:{color:I,arrowColor:I,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolflagmark:{flagColor:b},linetoolnote:{markerColor:b,textColor:"#ffffff",backgroundColor:n(b,30),backgroundTransparency:0,borderColor:b,fontSize:14,bold:!1,italic:!1,fixedSize:!0},linetoolnoteabsolute:{markerColor:b,textColor:"#ffffff",backgroundColor:n(b,30),backgroundTransparency:0,borderColor:b,fontSize:14,bold:!1,italic:!1,fixedSize:!0},linetoolpricelabel:{color:"#ffffff",backgroundColor:b,borderColor:b,fontWeight:"bold",fontsize:14,transparency:0},linetoolpricenote:{showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textColor:b,fontSize:14,bold:!1,italic:!1,lineColor:b,priceLabelBackgroundColor:b,priceLabelBorderColor:b,priceLabelTextColor:"#ffffff",priceLabelFontSize:12,priceLabelBold:!1,priceLabelItalic:!1},linetoolarrowmarker:{backgroundColor:w,textColor:w,bold:!0,italic:!1,fontsize:16,showLabel:!0},linetoolrectangle:{color:"#9c27b0",fillBackground:!0,backgroundColor:"rgba(156, 39, 176, 0.2)",linewidth:1,transparency:50,showLabel:!1,horzLabelsAlign:"left",vertLabelsAlign:"bottom",textColor:"#9c27b0",fontSize:14,bold:!1,italic:!1,extendLeft:!1,extendRight:!1},linetoolrotatedrectangle:{color:"#4caf50",fillBackground:!0,backgroundColor:"rgba(76, 175, 80, 0.2)",transparency:50,linewidth:1},linetoolcircle:{color:k,backgroundColor:n(k,80),fillBackground:!0,linewidth:1},linetoolellipse:{color:"#e91e63",fillBackground:!0,backgroundColor:"rgba(233, 30, 99, 0.2)",transparency:50,linewidth:1},linetoolarc:{color:"#ab47bc",fillBackground:!0,backgroundColor:"rgba(171, 71, 188, 0.2)",transparency:50,linewidth:1},linetoolprediction:{linecolor:b,linewidth:1,sourceBackColor:b,sourceTextColor:"rgba(255, 255, 255, 1)",sourceStrokeColor:b,targetStrokeColor:b,targetBackColor:b,targetTextColor:"rgba(255, 255, 255, 1)",successBackground:"rgba(76, 175, 80, 1)",successTextColor:"rgba(255, 255, 255, 1)",failureBackground:x,failureTextColor:"rgba(255, 255, 255, 1)",intermediateBackColor:"rgba(234, 210, 137, 1)",intermediateTextColor:"rgba(109, 77, 34, 1)",transparency:10,centersColor:"rgba( 32, 32, 32, 1)"},linetooltriangle:{color:"#f57c00",fillBackground:!0,backgroundColor:"rgba(245, 124, 0, 0.2)",transparency:50,linewidth:1},linetoolcallout:{color:"#ffffff",backgroundColor:"rgba(0, 151, 167, 0.7)",transparency:50,linewidth:1,fontsize:14,bordercolor:"rgba(0, 151, 167, 1)",bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:200},linetoolparallelchannel:{linecolor:b,linewidth:1, linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:n(b,80),transparency:20,showMidline:!0,midlinecolor:b,midlinewidth:1,midlinestyle:CanvasEx.LINESTYLE_DASHED},linetoolelliottimpulse:{degree:7,showWave:!0,color:"rgba( 61, 133, 198, 1)",linewidth:1},linetoolelliotttriangle:{degree:7,showWave:!0,color:"rgba( 255, 152, 0, 1)",linewidth:1},linetoolelliotttriplecombo:{degree:7,showWave:!0,color:"rgba( 106, 168, 79, 1)",linewidth:1},linetoolelliottcorrection:{degree:7,showWave:!0,color:"rgba( 61, 133, 198, 1)",linewidth:1},linetoolelliottdoublecombo:{degree:7,showWave:!0,color:"rgba( 106, 168, 79, 1)",linewidth:1},linetoolbarspattern:{color:b,mode:c.Bars,mirrored:!1,flipped:!1},linetoolghostfeed:{averageHL:20,variance:50,candleStyle:{upColor:M,downColor:P,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:A,borderDownColor:x,wickColor:"rgba(120, 123, 134, 1)"},transparency:50},study:{inputs:{},styles:{},palettes:{},bands:{},area:{},graphics:{},showInDataWindow:!0,visible:!0,showLegendValues:!0,showLabelsOnPriceScale:!0,precision:"default"},linetoolpitchfork:{fillBackground:!0,transparency:80,style:l.Original,median:{visible:!0,color:x,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},extendLines:!1,level0:r(.25,"rgba(255, 183, 77, 1)",!1),level1:r(.382,"rgba(129, 199, 132, 1)",!1),level2:r(.5,"rgba(76, 175, 80, 1)",!0),level3:r(.618,A,!1),level4:r(.75,"rgba(100, 181, 246, 1)",!1),level5:r(1,b,!0),level6:r(1.5,"rgba(156, 39, 176, 1)",!1),level7:r(1.75,"rgba(233, 30, 99, 1)",!1),level8:r(2,C,!1)},linetoolpitchfan:{fillBackground:!0,transparency:80,median:{visible:!0,color:x,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:r(.25,"rgba(255, 183, 77, 1)",!1),level1:r(.382,"rgba(129, 199, 132, 1)",!1),level2:r(.5,"rgba(76, 175, 80, 1)",!0),level3:r(.618,A,!1),level4:r(.75,"rgba(100, 181, 246, 1)",!1),level5:r(1,b,!0),level6:r(1.5,"rgba(156, 39, 176, 1)",!1),level7:r(1.75,"rgba(233, 30, 99, 1)",!1),level8:r(2,C,!1)},linetoolgannfan:{showLabels:!0,fillBackground:!0,transparency:80,level1:V(1,8,"rgba(255, 183, 77, 1)",!0),level2:V(1,4,"rgba(129, 199, 132, 1)",!0),level3:V(1,3,"rgba(76, 175, 80, 1)",!0),level4:V(1,2,A,!0),level5:V(1,1,"rgba(100, 181, 246, 1)",!0),level6:V(2,1,b,!0),level7:V(3,1,"rgba(156, 39, 176, 1)",!0),level8:V(4,1,"rgba(233, 30, 99, 1)",!0),level9:V(8,1,C,!0)},linetoolganncomplex:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,scaleRatio:"",showLabels:!0,labelsStyle:{fontSize:12,bold:!1,italic:!1},levels:[y("rgba(120, 123, 134, 1)",!0,1),y("rgba(255, 152, 0, 1)",!0,1),y("rgba(129, 199, 132, 1)",!0,1),y("rgba(76, 175, 80, 1)",!0,1),y(A,!0,1),y("rgba(120, 123, 134, 1)",!0,1)],fanlines:[D("rgba(179, 157, 219, 1)",!1,1,8,1),D(x,!1,1,5,1),D("rgba(120, 123, 134, 1)",!1,1,4,1),D("rgba(255, 152, 0, 1)",!1,1,3,1),D("rgba(129, 199, 132, 1)",!0,1,2,1),D("rgba(76, 175, 80, 1)",!0,1,1,1),D(A,!0,1,1,2),D(A,!1,1,1,3),D(b,!1,1,1,4),D("rgba(149, 117, 205, 1)",!1,1,1,5),D("rgba(179, 157, 219, 1)",!1,1,1,8)], arcs:[D("rgba(255, 152, 0, 1)",!0,1,1,0),D("rgba(255, 152, 0, 1)",!0,1,1,1),D("rgba(255, 152, 0, 1)",!0,1,1.5,0),D("rgba(129, 199, 132, 1)",!0,1,2,0),D("rgba(129, 199, 132, 1)",!0,1,2,1),D("rgba(76, 175, 80, 1)",!0,1,3,0),D("rgba(76, 175, 80, 1)",!0,1,3,1),D(A,!0,1,4,0),D(A,!0,1,4,1),D(b,!0,1,5,0),D(b,!0,1,5,1)]},linetoolgannfixed:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,levels:[y("rgba(120, 123, 134, 1)",!0,1),y("rgba(255, 152, 0, 1)",!0,1),y("rgba(129, 199, 132, 1)",!0,1),y("rgba(76, 175, 80, 1)",!0,1),y(A,!0,1),y("rgba(120, 123, 134, 1)",!0,1)],fanlines:[D("rgba(179, 157, 219, 1)",!1,1,8,1),D(x,!1,1,5,1),D("rgba(120, 123, 134, 1)",!1,1,4,1),D("rgba(255, 152, 0, 1)",!1,1,3,1),D("rgba(129, 199, 132, 1)",!0,1,2,1),D("rgba(76, 175, 80, 1)",!0,1,1,1),D(A,!0,1,1,2),D(A,!1,1,1,3),D(b,!1,1,1,4),D("rgba(149, 117, 205, 1)",!1,1,1,5),D("rgba(179, 157, 219, 1)",!1,1,1,8)],arcs:[D("rgba(255, 152, 0, 1)",!0,1,1,0),D("rgba(255, 152, 0, 1)",!0,1,1,1),D("rgba(255, 152, 0, 1)",!0,1,1.5,0),D("rgba(129, 199, 132, 1)",!0,1,2,0),D("rgba(129, 199, 132, 1)",!0,1,2,1),D("rgba(76, 175, 80, 1)",!0,1,3,0),D("rgba(76, 175, 80, 1)",!0,1,3,1),D(A,!0,1,4,0),D(A,!0,1,4,1),D(b,!0,1,5,0),D(b,!0,1,5,1)]},linetoolgannsquare:{color:"rgba( 21, 56, 153, 0.8)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,reverse:!1,fans:t("rgba(149, 152, 161, 1)",!1),hlevel1:i(0,"rgba(120, 123, 134, 1)",!0),hlevel2:i(.25,"rgba(245, 124, 0, 1)",!0),hlevel3:i(.382,"rgba(129, 199, 132, 1)",!0),hlevel4:i(.5,"rgba(76, 175, 80, 1)",!0),hlevel5:i(.618,A,!0),hlevel6:i(.75,b,!0),hlevel7:i(1,"rgba(120, 123, 134, 1)",!0),vlevel1:i(0,"rgba(120, 123, 134, 1)",!0),vlevel2:i(.25,"rgba(245, 124, 0, 1)",!0),vlevel3:i(.382,"rgba(129, 199, 132, 1)",!0),vlevel4:i(.5,"rgba(76, 175, 80, 1)",!0),vlevel5:i(.618,A,!0),vlevel6:i(.75,b,!0),vlevel7:i(1,"rgba(120, 123, 134, 1)",!0)},linetoolfibspeedresistancefan:{fillBackground:!0,transparency:80,grid:{color:"rgba( 21, 56, 153, 0.8)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,visible:!0},linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,reverse:!1,hlevel1:i(0,"rgba(120, 123, 134, 1)",!0),hlevel2:i(.25,"rgba(245, 124, 0, 1)",!0),hlevel3:i(.382,"rgba(129, 199, 132, 1)",!0),hlevel4:i(.5,"rgba(76, 175, 80, 1)",!0),hlevel5:i(.618,A,!0),hlevel6:i(.75,b,!0),hlevel7:i(1,"rgba(120, 123, 134, 1)",!0),vlevel1:i(0,"rgba(120, 123, 134, 1)",!0),vlevel2:i(.25,"rgba(245, 124, 0, 1)",!0),vlevel3:i(.382,"rgba(129, 199, 132, 1)",!0),vlevel4:i(.5,"rgba(76, 175, 80, 1)",!0),vlevel5:i(.618,A,!0),vlevel6:i(.75,b,!0),vlevel7:i(1,"rgba(120, 123, 134, 1)",!0)},linetoolfibretracement:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"bottom",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,trendline:{visible:!0, color:"rgba(120, 123, 134, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:i(0,"rgba(120, 123, 134, 1)",!0),level2:i(.236,x,!0),level3:i(.382,"rgba(129, 199, 132, 1)",!0),level4:i(.5,"rgba(76, 175, 80, 1)",!0),level5:i(.618,A,!0),level6:i(.786,"rgba(100, 181, 246, 1)",!0),level7:i(1,"rgba(120, 123, 134, 1)",!0),level8:i(1.618,b,!0),level9:i(2.618,x,!0),level10:i(3.618,"rgba(156, 39, 176, 1)",!0),level11:i(4.236,"rgba(233, 30, 99, 1)",!0),level12:i(1.272,"rgba(129, 199, 132, 1)",!1),level13:i(1.414,x,!1),level16:i(2,A,!1),level14:i(2.272,"rgba(129, 199, 132, 1)",!1),level15:i(2.414,"rgba(76, 175, 80, 1)",!1),level17:i(3,"rgba(100, 181, 246, 1)",!1),level18:i(3.272,"rgba(120, 123, 134, 1)",!1),level19:i(3.414,b,!1),level20:i(4,"rgba( 204, 40, 40, 1)",!1),level21:i(4.272,"rgba(156, 39, 176, 1)",!1),level22:i(4.414,"rgba(233, 30, 99, 1)",!1),level23:i(4.618,"rgba(129, 199, 132, 1)",!1),level24:i(4.764,A,!1)},linetoolfibchannel:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:i(0,"rgba(120, 123, 134, 1)",!0),level2:i(.236,x,!0),level3:i(.382,"rgba(129, 199, 132, 1)",!0),level4:i(.5,"rgba(76, 175, 80, 1)",!0),level5:i(.618,A,!0),level6:i(.786,"rgba(100, 181, 246, 1)",!0),level7:i(1,"rgba(120, 123, 134, 1)",!0),level8:i(1.618,b,!0),level9:i(2.618,x,!0),level10:i(3.618,"rgba(156, 39, 176, 1)",!0),level11:i(4.236,"rgba(233, 30, 99, 1)",!0),level12:i(1.272,"rgba(129, 199, 132, 1)",!1),level13:i(1.414,x,!1),level16:i(2,A,!1),level14:i(2.272,"rgba(129, 199, 132, 1)",!1),level15:i(2.414,"rgba(76, 175, 80, 1)",!1),level17:i(3,"rgba(100, 181, 246, 1)",!1),level18:i(3.272,"rgba(120, 123, 134, 1)",!1),level19:i(3.414,b,!1),level20:i(4,"rgba( 204, 40, 40, 1)",!1),level21:i(4.272,"rgba(156, 39, 176, 1)",!1),level22:i(4.414,"rgba(233, 30, 99, 1)",!1),level23:i(4.618,"rgba(129, 199, 132, 1)",!1),level24:i(4.764,A,!1)},linetoolprojection:{showCoeffs:!0,fillBackground:!0,transparency:80,color1:n(b,80),color2:"rgba(156, 39, 176, 0.2)",linewidth:1,trendline:{visible:!0,color:"rgba(149, 152, 161, 1)",linestyle:CanvasEx.LINESTYLE_SOLID},level1:r(1,"rgba( 128, 128, 128, 1)",!0)},linetool5pointspattern:{color:b,textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:b,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:1},linetoolcypherpattern:{color:b,textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:b,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:1},linetooltrianglepattern:{color:"#673AB7",textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:"#673AB7",fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:1},linetoolabcd:{color:A,textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,bold:!1,italic:!1,linewidth:1},linetoolthreedrivers:{color:"#673AB7",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 149, 40, 204, 0.5)",fontsize:12,bold:!1, italic:!1,transparency:50,linewidth:1},linetoolheadandshoulders:{color:A,textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:A,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:1},linetoolfibwedge:{showCoeffs:!0,fillBackground:!0,transparency:80,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:r(.236,x,!0),level2:r(.382,"rgba(129, 199, 132, 1)",!0),level3:r(.5,"rgba(76, 175, 80, 1)",!0),level4:r(.618,A,!0),level5:r(.786,"rgba(100, 181, 246, 1)",!0),level6:r(1,"rgba(120, 123, 134, 1)",!0),level7:r(1.618,b,!1),level8:r(2.618,x,!1),level9:r(3.618,"rgba(103, 58, 183, 1)",!1),level10:r(4.236,"rgba(233, 30, 99, 1)",!1),level11:r(4.618,"rgba(233, 30, 99, 1)",!1)},linetoolfibcircles:{showCoeffs:!0,fillBackground:!0,transparency:80,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba(120, 123, 134, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:r(.236,x,!0),level2:r(.382,"rgba(129, 199, 132, 1)",!0),level3:r(.5,"rgba(76, 175, 80, 1)",!0),level4:r(.618,A,!0),level5:r(.786,"rgba(100, 181, 246, 1)",!0),level6:r(1,"rgba(120, 123, 134, 1)",!0),level7:r(1.618,b,!0),level8:r(2.618,x,!0),level9:r(3.618,"rgba(103, 58, 183, 1)",!0),level10:r(4.236,"rgba(233, 30, 99, 1)",!0),level11:r(4.618,"rgba(233, 30, 99, 1)",!0)},linetoolfibspeedresistancearcs:{showCoeffs:!0,fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:"rgba(120, 123, 134, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:r(.236,x,!0),level2:r(.382,"rgba(129, 199, 132, 1)",!0),level3:r(.5,"rgba(76, 175, 80, 1)",!0),level4:r(.618,A,!0),level5:r(.786,"rgba(100, 181, 246, 1)",!0),level6:r(1,"rgba(120, 123, 134, 1)",!0),level7:r(1.618,b,!0),level8:r(2.618,x,!0),level9:r(3.618,"rgba(103, 58, 183, 1)",!0),level10:r(4.236,"rgba(233, 30, 99, 1)",!0),level11:r(4.618,"rgba(233, 30, 99, 1)",!0)},linetooltrendbasedfibextension:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"bottom",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,trendline:{visible:!0,color:"rgba(120, 123, 134, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:i(0,"rgba(120, 123, 134, 1)",!0),level2:i(.236,x,!0),level3:i(.382,"rgba(129, 199, 132, 1)",!0),level4:i(.5,"rgba(76, 175, 80, 1)",!0),level5:i(.618,A,!0),level6:i(.786,"rgba(100, 181, 246, 1)",!0),level7:i(1,"rgba(120, 123, 134, 1)",!0),level8:i(1.618,b,!0),level9:i(2.618,x,!0),level10:i(3.618,"rgba(156, 39, 176, 1)",!0),level11:i(4.236,"rgba(233, 30, 99, 1)",!0),level12:i(1.272,"rgba(129, 199, 132, 1)",!1),level13:i(1.414,x,!1),level16:i(2,A,!1),level14:i(2.272,"rgba(129, 199, 132, 1)",!1),level15:i(2.414,"rgba(76, 175, 80, 1)",!1),level17:i(3,"rgba(100, 181, 246, 1)",!1),level18:i(3.272,"rgba(120, 123, 134, 1)",!1),level19:i(3.414,b,!1),level20:i(4,"rgba( 204, 40, 40, 1)",!1),level21:i(4.272,"rgba(156, 39, 176, 1)",!1),level22:i(4.414,"rgba(233, 30, 99, 1)",!1), level23:i(4.618,"rgba(129, 199, 132, 1)",!1),level24:i(4.764,A,!1)},linetooltrendbasedfibtime:{showCoeffs:!0,fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:"rgba(120, 123, 134, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:r(0,"rgba(120, 123, 134, 1)",!0),level2:r(.382,x,!0),level3:r(.5,"rgba(129, 199, 132, 1)",!1),level4:r(.618,"rgba(76, 175, 80, 1)",!0),level5:r(1,A,!0),level6:r(1.382,"rgba(100, 181, 246, 1)",!0),level7:r(1.618,"rgba(120, 123, 134, 1)",!0),level8:r(2,b,!0),level9:r(2.382,x,!0),level10:r(2.618,"rgba(156, 39, 176, 1)",!0),level11:r(3,"rgba(233, 30, 99, 1)",!0)},linetoolschiffpitchfork:{fillBackground:!0,transparency:80,style:l.Schiff,median:{visible:!0,color:x,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},extendLines:!1,level0:r(.25,"rgba(255, 183, 77, 1)",!1),level1:r(.382,"rgba(129, 199, 132, 1)",!1),level2:r(.5,"rgba(76, 175, 80, 1)",!0),level3:r(.618,A,!1),level4:r(.75,"rgba(100, 181, 246, 1)",!1),level5:r(1,b,!0),level6:r(1.5,"rgba(156, 39, 176, 1)",!1),level7:r(1.75,"rgba(233, 30, 99, 1)",!1),level8:r(2,C,!1)},linetoolschiffpitchfork2:{fillBackground:!0,transparency:80,style:l.Schiff2,median:{visible:!0,color:x,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},extendLines:!1,level0:r(.25,"rgba(255, 183, 77, 1)",!1),level1:r(.382,"rgba(129, 199, 132, 1)",!1),level2:r(.5,"rgba(76, 175, 80, 1)",!0),level3:r(.618,A,!1),level4:r(.75,"rgba(100, 181, 246, 1)",!1),level5:r(1,b,!0),level6:r(1.5,"rgba(156, 39, 176, 1)",!1),level7:r(1.75,"rgba(233, 30, 99, 1)",!1),level8:r(2,C,!1)},linetoolinsidepitchfork:{fillBackground:!0,transparency:80,style:l.Inside,median:{visible:!0,color:x,linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},extendLines:!1,level0:r(.25,"rgba(255, 183, 77, 1)",!1),level1:r(.382,"rgba(129, 199, 132, 1)",!1),level2:r(.5,"rgba(76, 175, 80, 1)",!0),level3:r(.618,A,!1),level4:r(.75,"rgba(100, 181, 246, 1)",!1),level5:r(1,b,!0),level6:r(1.5,"rgba(156, 39, 176, 1)",!1),level7:r(1.75,"rgba(233, 30, 99, 1)",!1),level8:r(2,C,!1)},linetoolregressiontrend:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,styles:{upLine:{visible:!0,color:n(b,70),linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:n(b,70),linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:n(x,70),linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},B(TradingView.defaultProperties.chartproperties),R()}if(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{visible:!0,color:b,linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:b,backColor:"#E3EFFD",textColor:"#131722"}), void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:!0,"S1/R1":!0,"S2/R2":!0,"S3/R3":!0,"S4/R4":!0,"S5/R5":!0},colors:{P:"#FB8C00","S1/R1":"#FB8C00","S2/R2":"#FB8C00","S3/R3":"#FB8C00","S4/R4":"#FB8C00","S5/R5":"#FB8C00"},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}}}if(void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:b,linewidth:2}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t("rgba( 255, 0, 0, 1)",!1),level1:t("rgba( 0, 128, 0, 1)",!1),level2:t("rgba( 0, 0, 255, 1)",!1),level3:t("rgba( 255, 0, 255, 1)",!1),level4:t("rgba( 0, 128, 255, 1)",!0),level5:t("rgba( 255, 0, 0, 1)",!0),level6:t("rgba( 0, 128, 0, 1)",!0),level7:t("rgba( 0, 0, 255, 1)",!0),level8:t("rgba( 255, 0, 255, 1)",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{visible:!0,color:n(b,70),linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:n(b,70),linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:n(x,70),linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba( 153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]){TradingView.defaultProperties["study_Overlay@tv-basicstudies"]={style:a.STYLE_LINE,allowExtendTimeScale:!1,showPriceLine:!1,minTick:"default",candleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"rgba( 55, 134, 88, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",wickColor:"rgba( 115, 115, 117, 1)",wickUpColor:"rgba( 115, 115, 117, 1)",wickDownColor:"rgba( 115, 115, 117, 1)",barColorsOnPrevClose:!1},barStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},lineStyle:{color:"#FF6D00",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,priceSource:"close",styleType:a.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:b,color2:b,linecolor:b, linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:"rgba( 117, 134, 150, 1)",topFillColor1:"rgba( 83, 185, 135, 0.05)",topFillColor2:"rgba( 83, 185, 135, 0.05)",bottomFillColor1:"rgba( 235, 77, 92, 0.05)",bottomFillColor2:"rgba( 235, 77, 92, 0.05)",topLineColor:"rgba( 83, 185, 135, 1)",bottomLineColor:"rgba( 235, 77, 92, 1)",topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},styles:{open:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0},high:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0},low:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0},close:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:h.Line,histogramBase:0}}}}for(var O=e.split("."),F=TradingView.defaultProperties,W=0;W1?h(e[r],t.slice(1),i):(e[r]&&e[r].setValue?e[r].setValue(i):e[r]=i,!0))}function d(e){i||y.logWarn("Path `"+e+"` does not exist.")}}function B(e,t,i,s){window.__defaultsOverrides&&V(e,t,i,window.__defaultsOverrides,s)}function N(e,t){window.__settingsOverrides&&V(e,null,!1,window.__settingsOverrides,t)}function R(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&B(TradingView.defaultProperties[t],null,!1,t)}))}function O(e,t){return t?function(e,t){var i=D(e);if(!window._UNIT_TESTS){var s=TradingView.clone(TVSettings.getJSON(e,null));if(function(e){var t=new Set(["linetoolregressiontrend"]);return e.startsWith("study_")||t.has(e)}(e)&&s&&function(e){if(!e)return!1;e=e.toString();var t=new RegExp("\\d+").exec(e);return null!==t&&t[0]===e}(s.version)){var r=s.inputs,n=t.updateStudyInputs(s.id,s.version,"last",r,null);s.inputs=n;var o=t.updateStudyState(s,s);s=o}TradingView.merge(i,s),N(i,e)}return i}(e,t):function(e){var t=D(e);if(!window._UNIT_TESTS){var i=TradingView.clone(TVSettings.getJSON(e,null));if(i){TradingView.merge(t,i);const s=e.split(".");N(t,void 0===s[1]?e:s[1])}}return t}(e)}O.create=function(e,t){if(t){var i=D(e);TradingView.defaultProperties[e]=Object.assign(t,i)}},O.remove=function(e){TradingView.defaultProperties[e]=void 0},TradingView.saveDefaults=function(e,t){TVSettings.setJSON(e,t)},TradingView.factoryDefaults=D,window.applyDefaultOverridesToLinetools=R,window.applyDefaultsOverrides=B,window.applyPropertiesOverrides=V,window.defaults=O,t.applyDefaultOverridesToLinetools=R,t.applyDefaultsOverrides=B,t.applyPropertiesOverrides=V,t.defaults=O, t.factoryDefaults=D,t.saveDefaults=TradingView.saveDefaults},15521:(e,t,i)=>{"use strict";i.r(t),i.d(t,{toolIsCursor:()=>u,toolIsMeasure:()=>p,resetToCursor:()=>_,lockTimeAxisTime:()=>b,tool:()=>w,iconTool:()=>P,cursorTool:()=>C,isToolCreatingNow:()=>T,isToolEditingNow:()=>x,isToolMovingNow:()=>I,isDirectionalMovementActive:()=>M,createdLineTool:()=>L,continuedLineTool:()=>A,cancelledLineTool:()=>k,beenSetLineToolLastPoint:()=>E,startedMovingLineTool:()=>D,movedLineTool:()=>V,finishedMovingLineTool:()=>B,startedChangingLineTool:()=>N,changedLineTool:()=>R,finishedChangingLineTool:()=>O,removedLineTool:()=>F,finishedLineTool:()=>W,changedLineStyle:()=>H,copiedLineTool:()=>z,restoredLineTool:()=>U,restoredLineToolState:()=>j,isPointSelectedNow:()=>G,isStudyEditingNow:()=>q,createLineTool:()=>K,continueLineTool:()=>X,cancelLineTool:()=>Z,setLineToolLastPoint:()=>J,startMovingLineTool:()=>Q,moveLineTool:()=>ee,finishMovingLineTool:()=>te,startChangingLineTool:()=>ie,changeLineTool:()=>se,finishChangingLineTool:()=>re,removeLineTool:()=>ne,finishLineTool:()=>oe,changeLineStyle:()=>ae,copyLineTool:()=>le,restoreLineTool:()=>ce,restoreLineToolState:()=>he,init:()=>pe,runOnDrawingStateReady:()=>_e,properties:()=>me,hideAllDrawings:()=>ge,hideAllIndicators:()=>fe,lockDrawings:()=>ve,hideMarksOnBars:()=>Se,drawOnAllCharts:()=>ye,lockTimeAxis:()=>be});var s=i(16282),r=i(68137),n=i(11092),o=i(32856),a=i.n(o),l=i(5729),c=i.n(l),h=i(64222),d=i(18437);function u(e){return"cursor"===e||"arrow"===e||"dot"===e}function p(e){return"measure"===e}function _(e=!1){if(!e&&m){if(m.childs().stayInDrawingMode.value())return}w.setValue(C.value())}let m=null,g=null,f=null,v=null,S=null,y=null;const b=new(a()),w=new(a()),P=new(a()),C=new(a()),T=new(a())(!1),x=new(a())(!1),I=new(a())(!1),M=new(a())(!1),L=new(c()),A=new(c()),k=new(c()),E=new(c()),D=new(c()),V=new(c()),B=new(c()),N=new(c()),R=new(c()),O=new(c()),F=new(c()),W=new(c()),H=new(c()),z=new(c()),U=new(c()),j=new(c()),G=new(a())(!1),q=new(a())(!1);function Y(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const $={value:!1},K=Y(L,$),X=Y(A,$),Z=Y(k,$),J=Y(E,$),Q=Y(D),ee=Y(V),te=Y(B),ie=Y(N),se=Y(R),re=Y(O),ne=Y(F),oe=Y(W),ae=Y(H,$),le=Y(z,$),ce=Y(U),he=Y(j);let de=!1,ue=[];function pe(){de||(w.setValue(h.getValue("chart.cursorPreference","cursor")),w.subscribe(e=>u(e)&&C.setValue(e),{callWithLast:!0}),C.subscribe(e=>{e&&h.setValue("chart.cursorPreference",e)}),m=new n.DefaultProperty("drawings"),g=(0,r.createPrimitiveProperty)(),f=(0,r.createPrimitiveProperty)(),v=(0,r.createPrimitiveProperty)(),S=(0,r.createPrimitiveProperty)(),y=(0,r.createPrimitiveProperty)(),g.setValue(!1),f.setValue(!1),v.setValue(!1),S.setValue(!1),y.setValue(!1),w.subscribe(()=>{(0,d.emit)("onSelectedLineToolChanged")}),de=!0,ue.forEach(e=>e()),ue=[])}function _e(e){de?e():ue.push(e)}function me(){return(0,s.ensureNotNull)(m)}function ge(){return(0,s.ensureNotNull)(g)}function fe(){return(0,s.ensureNotNull)(f)}function ve(){return(0,s.ensureNotNull)(v)}function Se(){return(0, s.ensureNotNull)(S)}function ye(){return me().childs().drawOnAllCharts}function be(){return(0,s.ensureNotNull)(y)}},57296:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>r});var s=i(43367);class r{constructor(e){this._shift=!1,this._control=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._control=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey))}shift(){return this._shift}control(){return this._control}alt(){return this._alt}shiftOnly(){return this._shift&&!this._control&&!this._alt}controlOnly(){return this._control&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._control}controlShift(){return this._shift&&this._control&&!this._alt}static create(e=!1,t=!1,i=!1){return new r({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},89164:(e,t,i)=>{"use strict";function s(e){return function(e){return"="+JSON.stringify(e)}(e)}function r(e){return"="===e[0]}function n(e){if(!r(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function o(e){return"string"==typeof e?e:o(e.symbol)}i.r(t),i.d(t,{encodeExtendedSymbolOrGetSimpleSymbolString:()=>s,isEncodedExtendedSymbol:()=>r,decodeExtendedSymbol:()=>n,unwrapSimpleSymbol:()=>o})},62737:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null}},96284:(e,t,i)=>{"use strict";i.d(t,{dateFormatFunctions:()=>p,availableDateFormats:()=>_,defaultDateFormat:()=>m});var s=i(79881),r=i(59104);const n={1:()=>(0,s.t)("Jan"),2:()=>(0,s.t)("Feb"),3:()=>(0,s.t)("Mar"),4:()=>(0,s.t)("Apr"),5:()=>(0,s.t)("May",{context:"short"}),6:()=>(0,s.t)("Jun"),7:()=>(0,s.t)("Jul"),8:()=>(0,s.t)("Aug"),9:()=>(0,s.t)("Sep"),10:()=>(0,s.t)("Oct"),11:()=>(0,s.t)("Nov"),12:()=>(0,s.t)("Dec")},o=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,a=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),l=(e,t)=>(0,r.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),c=(e,t)=>n[o(e,t)](),h=(e,t)=>(0,r.numberToStringWithLeadingZero)(o(e,t),2),d=(e,t)=>(0,r.numberToStringWithLeadingZero)(a(e,t)%100,2),u=(e,t)=>(0,r.numberToStringWithLeadingZero)(a(e,t),4),p={"dd MMM 'yy":(e,t)=>`${l(e,t)} ${c(e,t)} '${d(e,t)}`,"MMM dd, yyyy":(e,t)=>`${c(e,t)} ${l(e,t)}, ${u(e,t)}`,"MMM dd":(e,t)=>`${c(e,t)} ${l(e,t)}`,"yyyy-MM-dd":(e,t)=>`${u(e,t)}-${h(e,t)}-${l(e,t)}`,"yy-MM-dd":(e,t)=>`${d(e,t)}-${h(e,t)}-${l(e,t)}`,"yy/MM/dd":(e,t)=>`${d(e,t)}/${h(e,t)}/${l(e,t)}`,"yyyy/MM/dd":(e,t)=>`${u(e,t)}/${h(e,t)}/${l(e,t)}`,"dd-MM-yyyy":(e,t)=>`${l(e,t)}-${h(e,t)}-${u(e,t)}`,"dd-MM-yy":(e,t)=>`${l(e,t)}-${h(e,t)}-${d(e,t)}`,"dd/MM/yy":(e,t)=>`${l(e,t)}/${h(e,t)}/${d(e,t)}`,"dd/MM/yyyy":(e,t)=>`${l(e,t)}/${h(e,t)}/${u(e,t)}`,"MM/dd/yy":(e,t)=>`${h(e,t)}/${l(e,t)}/${d(e,t)}`,"MM/dd/yyyy":(e,t)=>`${h(e,t)}/${l(e,t)}/${u(e,t)}`},_=Object.keys(p),m=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},54041:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(62737),r=i(96284);class n{constructor(e="yyyy-MM-dd"){ this._dateFormatFunc=r.dateFormatFunctions[e]}format(e){return s.customFormatters&&s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!1)}formatLocal(e){return s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.formatLocal?s.customFormatters.dateFormatter.formatLocal(e):s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!0)}}},74796:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>o});var s=i(18675),r=i(54041);const n={dateFormat:"yyyy-MM-dd",timeFormat:"%h:%m:%s",dateTimeSeparator:" "};class o{constructor(e={}){const t=Object.assign({},n,e);this._dateFormatter=new r.DateFormatter(t.dateFormat),this._timeFormatter=new s.TimeFormatter(t.timeFormat),this._separator=t.dateTimeSeparator}format(e){return`${this._dateFormatter.format(e)}${this._separator}${this._timeFormatter.format(e)}`}formatLocal(e){return`${this._dateFormatter.formatLocal(e)}${this._separator}${this._timeFormatter.formatLocal(e)}`}}},43434:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>r});var s=i(47903);class r{constructor(e=1){this._precision=e}format(e){(0,s.isNumber)(e)||(e=parseFloat(e));const t=e.toFixed(this._precision),i=Math.pow(10,-this._precision);return Math.max(parseFloat(t),i)+""}parse(e){const t=parseFloat(e);return isNaN(t)?{res:!1}:{res:!0,value:t,suggest:this.format(t)}}}},57649:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(59104),r=i(93302);class n{constructor(e){this._precision=e}format(e){return(void 0!==this._precision?e.toFixed(this._precision):n.formatNoE(e)).replace(".",s.formatterOptions.decimalSign)}parse(e){const t=e.replace(s.formatterOptions.decimalSign,".");let i=parseFloat(t);return this._precision&&(i=+i.toFixed(this._precision)),i}static formatNoE(e){if(!Number.isFinite(e))return String(e);const t=new r.Big(e);return t.lt(1)?t.toFixed():t.toString()}}},62159:(e,t,i)=>{"use strict";i.d(t,{PercentageFormatter:()=>n});var s=i(59104),r=i(76553);class n extends s.PriceFormatter{constructor(e){super(e),this.type="percentage"}state(){const e=s.PriceFormatter.prototype.state.call(this);return e.percent=!0,e}parse(e){return e=e.replace("%",""),super.parse(e)}format(e,t,i,s,n=!0){const o=super.format(e,t,i,s,!1)+"%";return n?(0,r.forceLTRStr)(o):o}static serialize(e){return e.state()}static deserialize(e){return new n(e.priceScale)}}},85421:(e,t,i)=>{"use strict";i.d(t,{PipFormatter:()=>r});var s=i(59104);class r extends s.PriceFormatter{constructor(e,t,i,s){t||(t=1),"forex"!==i&&"cfd"!==i||!s?(super(1),this._isForex=!1):(super(s),this._isForex=!0),this._pipPriceScale=e,this._pipMinMove=t,this._pipMinMove2=s}format(e,t,i){let s=this._isForex?this._pipMinMove2:this._pipMinMove;return void 0===s&&(s=NaN),super.format(e*this._pipPriceScale/s,t,i)}}},59104:(e,t,i)=>{"use strict";i.r(t),i.d(t,{formatterOptions:()=>l,numberToStringWithLeadingZero:()=>c,isFormatterHasForexAdditionalPrecision:()=>h,PriceFormatter:()=>d});var s=i(79881),r=i(47903),n=i(76553);const o=(0, i(65447).getLogger)("Chart.PriceFormatter"),a=new RegExp(/^(-?)[0-9]+$/),l={decimalSign:".",decimalSignFractional:"'"};function c(e,t){if(!(0,r.isNumber)(e))return"n/a";if(!(0,r.isInteger)(t))throw new TypeError("invalid length");if(t<0||t>16)throw new TypeError("invalid length");if(0===t)return e.toString();return("0000000000000000"+e.toString()).slice(-t)}function h(e){return"hasForexAdditionalPrecision"in e}class d{constructor(e,t,i,n){if(this.type="price",this._formatterErrors={custom:(0,s.t)("Price format is invalid."),fraction:(0,s.t)("Fraction part is invalid."),secondFraction:(0,s.t)("Second fraction part is invalid.")},t||(t=1),(0,r.isNumber)(e)&&(0,r.isInteger)(e)||(e=100),e<0)throw new TypeError("invalid base");this._priceScale=e,this._minMove=t,this._minMove2=n,i&&void 0!==n&&n>0&&2!==n&&4!==n&&8!==n?o.logDebug("invalid minmove2"):(this._fractional=i,this.calculateDecimal())}isFractional(){return!!this._fractional}state(){return{fractional:this._fractional,fractionalLength:this._fractionalLength,minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale}}calculateDecimal(){if(this._fractionalLength=0,this._priceScale>0&&this._minMove>0){let e=this._priceScale;for(this._fractional&&this._minMove2&&(e/=this._minMove2);e>1;)e/=10,this._fractionalLength++}}format(e,t,i,s=!0,r=!0){let o,a="";return e<0?(a=!1===s?"":"−",e=-e):e&&!0===t&&(a="+"),o=this._fractional?a+this._formatAsFractional(e,i):a+this._formatAsDecimal(e,i),r?(0,n.forceLTRStr)(o):o}parse(e){return e=(e=(0,n.stripLTRMarks)(e)).replace("−","-"),this._fractional?this._minMove2?this._parseAsDoubleFractional(e):this._parseAsSingleFractional(e):this._parseAsDecimal(e)}hasForexAdditionalPrecision(){return!this._fractional&&10===this._minMove2}static serialize(e){return e.state()}static deserialize(e){return new d(e.priceScale,e.minMove,e.fractional,e.minMove2)}_formatAsDecimal(e,t){let i;t=t||0,i=this._fractional?Math.pow(10,this._fractionalLength||0):Math.pow(10,t)*this._priceScale/this._minMove;const s=1/i;let r;if(i>1)r=Math.floor(e);else{const t=Math.floor(Math.round(e/s)*s);r=0===Math.round((e-t)/s)?t:t+s}let n="";if(i>1){let s=parseFloat((Math.round(e*i)-r*i).toFixed(this._fractionalLength));s>=i&&(s-=i,r+=1);const o=void 0!==this._fractionalLength?this._fractionalLength:NaN;n=l.decimalSign+c(parseFloat(s.toFixed(this._fractionalLength))*this._minMove,o+t),n=this._removeEndingZeros(n,t)}return r.toString()+n}_getFractPart(e,t){const i=[0,5],s=[0,2,5,7];return 2===t?void 0===i[e]?-1:i[e]:4===t?void 0===s[e]?-1:s[e]:e}_formatAsFractional(e,t){const i=this._priceScale/this._minMove;let s=Math.floor(e),r=t?Math.floor(e*i)-s*i:Math.round(e*i)-s*i;r===i&&(r=0,s+=1);let n="";if(t){let o=(e-s-r/i)*i;o=Math.round(o*Math.pow(10,t)),n=c(o,t),n=this._removeEndingZeros(n,t)}if(!this._fractionalLength)throw new Error("_fractionalLength is not calculated");let o="";if(this._minMove2){const e=r%this._minMove2;r=(r-e)/this._minMove2;const t=c(r,this._fractionalLength),i=this._getFractPart(e,this._minMove2);o=t+l.decimalSignFractional+i }else r=this._getFractPart(r,this._priceScale),o=c(r*this._minMove,this._fractionalLength);return s.toString()+l.decimalSignFractional+o+n}_removeEndingZeros(e,t){for(let i=0;i=s||r<0)return{error:this._formatterErrors.fraction,res:!1};let n=i+r/s;return e&&(n=-n),{value:n,res:!0,suggest:this.format(n)}}return{error:this._formatterErrors.custom,res:!1}}_parseAsDoubleFractional(e){let t=a.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.format(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+l.decimalSignFractional+"([0-9]+)\\"+l.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2?this._minMove2:NaN,r=this._priceScale/s,n=this._minMove2,o=this._patchFractPart(parseInt(t[3]),r),a=this._patchFractPart(parseInt(t[4]),n);if(o>=r||o<0)return{error:this._formatterErrors.fraction,res:!1};if(void 0!==n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1};let l=void 0!==n?i+o/r+a/(r*n):NaN;return e&&(l=-l),{value:l,res:!0,suggest:this.format(l)}}return{error:this._formatterErrors.custom,res:!1}}}},18675:(e,t,i)=>{"use strict";i.d(t,{TimeFormatter:()=>n});var s=i(62737),r=i(59104);class n{constructor(e){this._formatStr=e||"%h:%m:%s"}format(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.format(e):this._formatStr.replace("%h",(0,r.numberToStringWithLeadingZero)(e.getUTCHours(),2)).replace("%m",(0,r.numberToStringWithLeadingZero)(e.getUTCMinutes(),2)).replace("%s",(0,r.numberToStringWithLeadingZero)(e.getUTCSeconds(),2))}formatLocal(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.formatLocal?s.customFormatters.timeFormatter.formatLocal(e):s.customFormatters.timeFormatter.format(e):this._formatStr.replace("%h",(0,r.numberToStringWithLeadingZero)(e.getHours(),2)).replace("%m",(0,r.numberToStringWithLeadingZero)(e.getMinutes(),2)).replace("%s",(0,r.numberToStringWithLeadingZero)(e.getSeconds(),2))}}},1953:(e,t,i)=>{"use strict";i.d(t,{TimeSpanFormatter:()=>r});var s=i(79881);class r{format(e){const t=e<0;e=Math.abs(e);const i=Math.floor(e/86400);e-=86400*i;const r=Math.floor(e/3600);e-=3600*r;const n=Math.floor(e/60);e-=60*n;let o="";return i&&(o+=i+(0,s.t)("d",{context:"dates"})+" "),r&&(o+=r+(0,s.t)("h",{ context:"dates"})+" "),n&&(o+=n+(0,s.t)("m",{context:"dates"})+" "),e&&(o+=e+(0,s.t)("s",{context:"dates"})+" "),t&&(o="-"+o),o.trim()}}},76559:(e,t,i)=>{"use strict";i.d(t,{VolumeFormatter:()=>a});var s=i(79881),r=i(57649),n=i(47903),o=i(75496);class a{constructor(e){this.type="volume",this._numericFormatter=new r.NumericFormatter,this._fractionalValues=void 0!==e&&e>0,this._precision=e}state(){return{precision:this._precision}}format(e,t){if(!(0,n.isNumber)(e))return"---";let i="";return e<0?(i="−",e=-e):e>0&&t&&(i="+"),e>=1e100?(0,s.t)("N/A"):(!this._fractionalValues||e>=995?e=Math.round(e):this._fractionalValues&&(e=+e.toFixed(this._precision)),e<995?i+this._formatNumber(e):e<999995?i+this._formatNumber(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),i+this._formatNumber(e/1e6)+"M"):e<999999999995?(e=1e6*Math.round(e/1e6),i+this._formatNumber(e/1e9)+"B"):(e=1e9*Math.round(e/1e9),i+this._formatNumber(e/1e12)+"T"))}parse(e){if("---"===e)return{error:"not a number",res:!1,value:NaN};const t={K:1e3,M:1e6,B:1e9},i=e.slice(-1);if(t.hasOwnProperty(i)){const s=this._numericFormatter.parse(e.slice(0,-1));return(0,n.isNumber)(s)?{res:!0,value:s*t[i]}:{error:"not a number",res:!1,value:NaN}}{const t=this._numericFormatter.parse(e);return(0,n.isNumber)(t)?{res:!0,value:t}:{error:"not a number",res:!1,value:NaN}}}static serialize(e){return e.state()}static deserialize(e){return new a(e.precision)}_formatNumber(e){return this._fractionalValues&&(e=(0,o.fixComputationError)(e)),this._numericFormatter.format(e).replace(/(\.[1-9]*)0+$/,(e,t)=>t)}}},7518:(e,t,i)=>{"use strict";i.d(t,{shouldBeFormattedAsPercent:()=>n,getPriceValueFormatterForSource:()=>o});var s=i(25436),r=i(58007);function n(e){const t=e.priceScale();return!(null===t||!t.isPercentage())&&(!(0,r.isSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function o(e){const t=e.priceScale();if(n(e)&&null!==t)return i=>{var s;return t.formatPricePercentage(i,null!==(s=e.firstValue())&&void 0!==s?s:100)};const i=e.formatter();return i.format.bind(i)}},10288:(e,t,i)=>{"use strict";function s(e,t,i){if(e.isTouch){if(void 0!==i)return i(e),!0}else if(void 0!==t)return t(e),!0;return!1}function r(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}var n;i.d(t,{tryCallHandler:()=>s,shouldDefaultActionBeExecuted:()=>r,AreaName:()=>n,HitTestResult:()=>o}),function(e){e.Style="Style",e.Text="Text",e.SourceItemMove="SourceItemMove"}(n||(n={}));class o{constructor(e,t,i){this._result=e,this._data=t||null,this._eraseMarker=i}result(){return this._result}data(){return this._data}hasPressedMoveHandler(e){return null!==this._data&&function(e,t,i){if(e.isTouch){if(void 0!==i)return!0}else if(void 0!==t)return!0;return!1}(e,this._data.pressedMouseMoveHandler,this._data.touchMoveHandler)}tryCallMouseDownOrTouchStartHandler(e){return null!==this._data&&s(e,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e){ return null!==this._data&&s(e,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e){return null!==this._data&&s(e,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e){return null!==this._data&&s(e,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e){return null!==this._data&&s(e,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e){return null!==this._data&&s(e,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e){return null!==this._data&&s(e,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e){return null!==this._data&&s(e,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}o.MOVEPOINT_BACKGROUND=1,o.REGULAR=2,o.MOVEPOINT=3,o.CHANGEPOINT=4,o.CUSTOM=5},42225:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(29982),r=i(33420);class n{constructor(){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",linewidth:1,linestyle:r.LINESTYLE_SOLID,visible:!1},this._lineRenderer=new s.HorizontalLineRenderer,this._invalidated=!0,this._lineRenderer.setData(this._lineRendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._lineRenderer}}},23221:(e,t,i)=>{"use strict";var s,r;i.d(t,{PositionPLDisplay:()=>s,TradingSourcesHorizontalAlignment:()=>r,tradingPreferencesDefault:()=>n,CustomSourceLayer:()=>o}),function(e){e[e.Money=0]="Money",e[e.Pips=1]="Pips",e[e.Percentage=2]="Percentage"}(s||(s={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(r||(r={}));const n={showPositions:!1,positionPL:{visibility:!1,display:s.Money},showOrders:!1,showExecutions:!1,showReverse:!1,extendLeft:!1,lineLength:0,horizontalAlignment:r.Right,lineWidth:0,lineStyle:0};var o;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(o||(o={}))},35001:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ResolutionKind:()=>n,SpecialResolutionKind:()=>o,Interval:()=>h,isHour:()=>u});const s=/^(\d*)([TSHDWMR])$/,r=/^(\d+)$/;var n,o;!function(e){e.Ticks="ticks",e.Seconds="seconds",e.Minutes="minutes",e.Days="days",e.Weeks="weeks",e.Months="months",e.Range="range",e.Invalid="invalid"}(n||(n={})),function(e){e.Hours="hours"}(o||(o={}));const a={};a[n.Ticks]=1e3,a[n.Seconds]=1e3,a[n.Minutes]=60*a[n.Seconds],a[n.Days]=1440*a[n.Minutes],a[n.Weeks]=7*a[n.Days];const l={T:n.Ticks,S:n.Seconds,D:n.Days,W:n.Weeks,M:n.Months,R:n.Range},c=new Set([n.Ticks,n.Seconds,n.Minutes]);class h{constructor(e,t){this._kind=n.Invalid,this._multiplier=0,e!==n.Invalid&&t>0&&(this._kind=e,this._multiplier=t)}kind(){return this._kind}multiplier(){return this._multiplier}isValid(){return this.kind()!==n.Invalid&&this.multiplier()>0}isDWM(){return this.isValid()&&!this.isRange()&&!this.isIntraday()&&!this.isTicks()}isIntraday(){const e=c.has(this.kind());return this.isValid()&&e}isSeconds(){return this.kind()===n.Seconds}isMinutes(){return this.kind()===n.Minutes}isMinuteHours(){ return this.kind()===n.Minutes&&u(this.multiplier())}isDays(){return this.kind()===n.Days}isWeeks(){return this.kind()===n.Weeks}isMonths(){return this.kind()===n.Months}isRange(){return this.kind()===n.Range}isTicks(){return this.kind()===n.Ticks}isTimeBased(){return!this.isRange()}letter(){return this.isValid()&&this.kind()!==n.Minutes?this.kind()[0].toUpperCase():""}value(){return this.isValid()?this.kind()===n.Minutes?this.multiplier()+"":this.multiplier()+this.letter():""}isEqualTo(e){if(!(e instanceof h))throw new Error("Argument is not an Interval");return!(!this.isValid()||!e.isValid())&&(this.kind()===e.kind()&&this.multiplier()===e.multiplier())}inMilliseconds(e=Date.now()){if(!this.isValid()||this.isRange())return NaN;if(this.isMonths()){const t=new Date(e);t.setUTCMonth(t.getUTCMonth()+(this.multiplier()||1));return+t-e}const t=this.multiplier();return a[this.kind()]*t}static isEqual(e,t){return e===t||h.parse(e).isEqualTo(h.parse(t))}static parseExt(e){e=(e+"").toUpperCase().split(",")[0];let t=s.exec(e);return null!==t?"H"===t[2]?{interval:new h(n.Minutes,60*d(t[1])),guiResolutionKind:o.Hours}:{interval:new h(l[t[2]],d(t[1])),guiResolutionKind:l[t[2]]}:(t=r.exec(e),null!==t?{interval:new h(n.Minutes,d(t[1])),guiResolutionKind:n.Minutes}:{interval:new h(n.Invalid,0),guiResolutionKind:n.Invalid})}static parse(e){return h.parseExt(e).interval}static kind(e){return h.parse(e).kind()}static isValid(e){return h.parse(e).isValid()}static isDWM(e){return h.parse(e).isDWM()}static isIntraday(e){return h.parse(e).isIntraday()}static isSeconds(e){return h.parse(e).isSeconds()}static isMinutes(e){return h.parse(e).isMinutes()}static isMinuteHours(e){return h.parse(e).isMinuteHours()}static isDays(e){return h.parse(e).isDays()}static isWeeks(e){return h.parse(e).isWeeks()}static isMonths(e){return h.parse(e).isMonths()}static isRange(e){return h.parse(e).isRange()}static isTicks(e){return h.parse(e).isTicks()}static isTimeBased(e){return h.parse(e).isTimeBased()}static normalize(e){const t=h.parse(e);return t.isValid()?t.value():null}}function d(e){return 0===e.length?1:parseInt(e,10)}function u(e){return e>=60&&!(e%60)}},25220:(e,t,i)=>{"use strict";i.d(t,{intervalsVisibilitiesDefaults:()=>s});const s={ticks:!0,seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1,minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,weeksFrom:1,weeksTo:52,months:!0,monthsFrom:1,monthsTo:12,ranges:!0}},81694:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>n});var s=i(674),r=i.n(s);i(89537);class n extends(r()){state(e){return super.state(e)}storeStateIfUndefined(){return!1}}},89537:(e,t,i)=>{"use strict";i.d(t,{makeIntervalsVisibilitiesVisibleAtInterval:()=>a,isActualInterval:()=>c,nonDefaultIntervalsVisibilities:()=>h,mergeIntervalVisibilitiesDefaults:()=>d});var s=i(16282),r=i(35001),n=i(25220),o=i(47903);function a(e,t){let i=t.multiplier();if(t.isTicks()&&(e.ticks=!0),t.isSeconds()&&(i<60?(e.seconds=!0,e.secondsFrom=Math.min(e.secondsFrom,i), e.secondsTo=Math.max(e.secondsTo,i)):(i/=60,t=new r.Interval(r.ResolutionKind.Minutes,i))),t.isMinutes())if(i<60)e.minutes=!0,e.minutesFrom=Math.min(e.minutesFrom,i),e.minutesTo=Math.max(e.minutesTo,i);else{const t=Math.floor(i/60);e.hours=!0,e.hoursFrom=Math.min(e.hoursFrom,t),e.hoursTo=Math.max(e.hoursTo,t)}t.isDays()&&(e.days=!0,e.daysFrom=Math.min(e.daysFrom,i),e.daysTo=Math.max(e.daysTo,i)),t.isWeeks()&&(e.weeks=!0,e.weeksFrom=Math.min(e.weeksFrom,i),e.weeksTo=Math.max(e.weeksTo,i)),t.isMonths()&&(e.months=!0,e.monthsFrom=Math.min(e.monthsFrom,i),e.monthsTo=Math.max(e.monthsTo,i)),t.isRange()&&(e.ranges=!0)}function l(e,t,i,s){return e&&s>=t&&s<=i}function c(e,t){const i=t.childs();switch(e.kind()){case r.ResolutionKind.Ticks:return i.ticks.value();case r.ResolutionKind.Seconds:if(e.multiplier()<60)return l(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return l(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case r.ResolutionKind.Minutes:if(e.multiplier()<60)return l(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return l(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)}case r.ResolutionKind.Days:return l(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case r.ResolutionKind.Weeks:return l(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case r.ResolutionKind.Months:return l(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case r.ResolutionKind.Range:return i.ranges.value()}return(0,s.assert)(!1,"Unsupported resolution: "+e.value()),!1}function h(e){const t=Object.keys(e).filter(t=>n.intervalsVisibilitiesDefaults[t]!==e[t]);return 0===t.length?null:t.reduce((t,i)=>(t[i]=e[i],t),{})}function d(e){return(0,o.merge)((0,o.clone)(n.intervalsVisibilitiesDefaults),null!=e?e:{})}},21698:(e,t,i)=>{"use strict";function s(e){return Boolean(e.showInObjectTree)}i.d(t,{isDataSource:()=>s})},60183:(e,t,i)=>{"use strict";var s;i.d(t,{SymbolErrorPermissionDeniedReason:()=>s,permissionDenied:()=>r}),function(e){e.Symbol="symbol",e.GroupPermission="group"}(s||(s={}));const r="permission denied"},58007:(e,t,i)=>{"use strict";function s(e){return e.symbolSource&&e.symbolSource()===e}i.d(t,{isSymbolSource:()=>s})},81773:(e,t,i)=>{"use strict";var s=i(674),r=i(47903).isSameType,n=i(11092).DefaultProperty;function o(e,t,i,s){this._map=Object.assign({},this._map,s),t&&(t=this.unpackLevels(t)),n.call(this,e,t,i)}inherit(o,n),o.prototype.state=function(e,t){e=e||[];var i=s.prototype.state.call(this,e);return t?i:this.packLevels(i)},o.prototype.clone=function(){for(var e=this.state(),t=new o(this._defaultName,e),i=0;i{"use strict";i.d(t,{LineToolsGroupModel:()=>o});var s=i(5729),r=i.n(s),n=i(85285);class o{constructor(e){this._onChanged=new(r()),this._groups=[],this._groups=e||[],this._groups.forEach(e=>{e.onChanged().subscribe(null,t=>this._onChanged.fire(e.id,t))})}groups(){return this._groups.filter(e=>e.isActualSymbol())}groupsForAllSymbols(){return this._groups}createGroup(e,t,i){t=t||this._generateNextName();const s=new n.LineToolsGroup(e,t,i);this._groups.push(s),s.onChanged().subscribe(null,e=>this._onChanged.fire(s.id,e));const r={visibilityChanged:!1,lockedChanged:!1,titleChanged:!1,isActualIntervalChanged:!1,affectedLineTools:e.map(e=>e.id())};return this._onChanged.fire(s.id,r),s}addGroup(e){this._groups.push(e),e.onChanged().subscribe(null,t=>this._onChanged.fire(e.id,t)),this._onChanged.fire(e.id)}removeGroup(e){const t=this._groups.findIndex(t=>t.id===e.id);this._groups.splice(t,1),this._onChanged.fire(e.id)}groupForId(e){return this._groups.find(t=>t.id===e)||null}groupForLineTool(e){return this._groups.find(t=>t.containsLineTool(e))||null}removeLineTools(e){this._groups.forEach(t=>{const i=e.filter(t.containsLineTool.bind(t));i.length&&t.excludeLineTools(i)});this._groups.filter(e=>0===e.lineTools().length).forEach(e=>this.removeGroup(e))}state(e){return{groups:(e?this._groups.filter(e=>e.isActualSymbol()):this._groups).map(e=>e.state())}}onChanged(){return this._onChanged}fireChangedAll(){this._groups.forEach(e=>{this._onChanged.fire(e.id)})}static fromState(e,t){const i=[];for(const s of t.groups){const t=n.LineToolsGroup.fromState(e,s);null!==t&&i.push(t)}return new o(i)}_generateNextName(){const e=new Set(this.groups().map(e=>e.name()));for(let t=1;;t++){const i="Group "+t,s="Group_"+t;if(!e.has(i)&&!e.has(s))return i}}}},85285:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroup:()=>l});var s=i(5729),r=i.n(s),n=i(45259);function o(e){return e.properties().visible.value()}function a(e){return!o(e)}class l{constructor(e,t,i){this._instanceId=(0,n.randomHashN)(6),this._onChanged=new(r()),this._lineToolsSet=new Set,this._lineTools=[...e], this._lineToolsSet=new Set(this._lineTools),this._name=t,this.id=i||(0,n.randomHashN)(6)}instanceId(){return this._instanceId}lineTools(){return this._lineTools}name(){return this._name}setName(e){this._doAndFireOnChange(()=>{this._name=e})}isActualSymbol(){return this._lineTools.length>0&&this._lineTools[0].isActualSymbol()&&this._lineTools[0].isActualCurrency()&&this._lineTools[0].isActualUnit()}symbol(){return this._lineTools[0].symbol()}currencyId(){var e;return null!==(e=this._lineTools[0].properties().childs().currencyId.value())&&void 0!==e?e:null}unitId(){var e;return null!==(e=this._lineTools[0].properties().childs().unitId.value())&&void 0!==e?e:null}sharingMode(){return this._lineTools[0].sharingMode()}share(e){this._lineTools.forEach(t=>t.share(e))}containsLineTool(e){return this._lineToolsSet.has(e)}addLineTools(e){this._doAndFireOnChange(t=>{e.forEach(e=>this._lineToolsSet.add(e)),this._lineTools.push(...e),t.push(...e.map(e=>e.id()))})}excludeLineTool(e){this._doAndFireOnChange(t=>{this._lineToolsSet.delete(e);const i=this._lineTools.indexOf(e);this._lineTools.splice(i,1),t.push(e.id())})}excludeLineTools(e){this._doAndFireOnChange(t=>{const i=new Set(e);e.forEach(e=>this._lineToolsSet.delete(e)),this._lineTools=this._lineTools.filter(e=>!i.has(e)),t.push(...e.map(e=>e.id()))})}state(){return{id:this.id,name:this._name,tools:this._lineTools.map(e=>e.id())}}visibility(){const e=this._lineTools.some(o),t=this._lineTools.some(a);return e&&!t?"Visible":t&&!e?"Invisible":"Partial"}locked(){const e=this._lineTools.some(e=>e.properties().frozen.value()),t=this._lineTools.some(e=>!e.properties().frozen.value());return e&&!t?"Locked":t&&!e?"Unlocked":"Partial"}isActualInterval(){const e=this._lineTools.some(e=>e.isActualInterval()),t=this._lineTools.some(e=>!e.isActualInterval());return e&&!t?"IsActualInterval":t&&!e?"IsNotActualInterval":"Partial"}onChanged(){return this._onChanged}static fromState(e,t){const i=[];for(const s of t.tools){const t=e.dataSourceForId(s);null!==t&&i.push(t)}return i.length>0?new l(i,t.name,t.id):null}_doAndFireOnChange(e){const t=[],i=this.visibility(),s=this.locked(),r=this.name(),n=this.isActualInterval();e(t),this._onChanged.fire({affectedLineTools:t,visibilityChanged:i!==this.visibility(),lockedChanged:s!==this.locked(),titleChanged:r!==this.name(),isActualIntervalChanged:n!==this.isActualInterval()})}}},98127:(e,t,i)=>{"use strict";i.d(t,{LineTool5PointsPattern:()=>a});var s=i(16282),r=i(11092),n=i(76117),o=i(39096);class a extends n.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),this._loadPaneViews(e)}pointsCount(){return 5}name(){return"XABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty("linetool5pointspattern",e);return a._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,84377)).then(e=>e.PatternWithBackgroundDefinitionViewModel)}_loadPaneViews(e){i.e(1583).then(i.bind(i,55913)).then(t=>{this._setPaneViews([new t.Pattern5pointsPaneView(this,e)])})} static _configureProperties(e){n.LineDataSource._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("color"))])),e.addChild("textsColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}},95026:(e,t,i)=>{"use strict";i.d(t,{LineToolABCD:()=>a});var s=i(16282),r=i(11092),n=i(76117),o=i(39096);class a extends n.LineDataSource{constructor(e,t){const s=t||a.createProperties();super(e,s),i.e(1583).then(i.bind(i,31017)).then(t=>{this._setPaneViews([new t.ABCDPaneView(this,e)])})}pointsCount(){return 4}name(){return"ABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty("linetoolabcd",e);return a._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,39942)).then(e=>e.PatternWithoutBackgroundDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("color"))])),e.addChild("textsColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}},93750:(e,t,i)=>{"use strict";i.d(t,{LineToolArc:()=>h});var s=i(16282),r=i(89684),n=i(72927),o=i(51102),a=i(11092),l=i(76117),c=i(39096);class h extends l.LineDataSource{constructor(e,t){const s=t||h.createProperties();super(e,s),this.version=2,this._dist=null,i.e(1583).then(i.bind(i,35049)).then(({ArcPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,r.distanceToLine)(e,t,i).distance;const o=t.subtract(e),a=new n.Point(-o.y,o.x),l=e.add(t).scaled(.5);i.subtract(l).dotProduct(a)<0&&(this._dist=-this._dist)}}endChanging(e,t){return this._dist=null,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Arc"}hasEditableCoordinates(){return!1}setPoint(e,t){const i={...t},a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));switch(e){case 0:{const e=(0,s.ensureNotNull)(this._dist),t=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),r=l.subtract(t),o=t.add(l).scaled(.5);let a=new n.Point(-r.y,r.x);a=a.normalized();const c=o.add(a.scaled(e));this._points[0]=i,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(c));break}case 1:{const e=(0,s.ensureNotNull)(this._dist),t=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),r=t.subtract(a),o=a.add(t).scaled(.5),l=new n.Point(-r.y,r.x).normalized(),c=o.add(l.scaled(e));this._points[1]=i,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(c));break}case 2:{let e=(0,s.ensureNotNull)(this.pointToScreenPoint(i));const t=(0, r.distanceToLine)(a,l,e).distance,c=l.subtract(a),h=a.add(l).scaled(.5),d=new n.Point(-c.y,c.x).normalized(),u=h.add(d.scaled(t)),p=h.add(d.scaled(-t)),_=c.length(),m=c.x/_,g=c.y/_;let f=Math.acos(m);g<0&&(f=-f);let v=(0,o.translationMatrix)(-h.x,-h.y);e=(0,o.transformPoint)(v,e);let S=(0,o.transformPoint)(v,u);v=(0,o.rotationMatrix)(-f),e=(0,o.transformPoint)(v,e),S=(0,o.transformPoint)(v,S),v=(0,o.scalingMatrix)(1,_/(2*t)),e=(0,o.transformPoint)(v,e),S=(0,o.transformPoint)(v,S);const y=e.y*S.y>=0?new n.Point(u.x,u.y):new n.Point(p.x,p.y);this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(y));break}}this.normalizePoints()}migrateVersion(e,t,i){if(1===e&&2===this._points.length){const e=(2*this._points[0].price+3*this._points[1].price)/5;this._points.push({price:e,index:this._points[1].index})}if(1===e&&2===this._timePoint.length){const e={price:(2*this._timePoint[0].price+3*this._timePoint[1].price)/5,offset:this._timePoint[1].offset,time_t:this._timePoint[1].time_t};this._timePoint.push(e)}}static createProperties(e){const t=new a.DefaultProperty("linetoolarc",e);return h._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,32454))).GeneralFiguresDefinitionsViewModelBase}static _configureProperties(e){l.LineDataSource._configureProperties(e),e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().color]))}}},35320:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMark:()=>l,LineToolArrowMarkLeft:()=>c,LineToolArrowMarkUp:()=>h,LineToolArrowMarkRight:()=>d,LineToolArrowMarkDown:()=>u});var s=i(11092),r=i(76117),n=i(674),o=i.n(n),a=i(39096);class l extends r.LineDataSource{constructor(e,t,s){const r=t||l.createProperties(null,s);super(e,r),this._textPaneView=null,i.e(1583).then(i.bind(i,92713)).then(({ArrowMarkPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}paneViews(e){const t=super.paneViews();return null!==t&&this._textPaneView&&t.push(this._textPaneView),t}pointsCount(){return 1}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new s.DefaultProperty(t,e);return l._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,68854)).then(e=>e.ArrowMarkDefinitionsViewModel)}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().arrowColor])),e.addChild("textsColors",new a.LineToolColorsProperty([e.childs().color])),e.hasChild("text")||e.addChild("text",new(o())("")),e.addExclusion("text")}}l.version=2;class c extends l{constructor(e,t){super(e,t,"linetoolarrowmarkleft")}direction(){return"left"}name(){return"Arrow Mark Left"}textAlignParams(){return{horzAlign:"left",vertAlign:"middle",offsetX:22,offsetY:3}}static createProperties(e){ return l.createProperties(e,"linetoolarrowmarkleft")}}class h extends l{constructor(e,t){super(e,t,"linetoolarrowmarkup")}direction(){return"up"}name(){return"Arrow Mark Up"}textAlignParams(){return{horzAlign:"center",vertAlign:"top",offsetX:0,offsetY:20}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkup")}}class d extends l{constructor(e,t){super(e,t,"linetoolarrowmarkright")}direction(){return"right"}name(){return"Arrow Mark Right"}textAlignParams(){return{horzAlign:"right",vertAlign:"middle",offsetX:22,offsetY:3,forceTextAlign:!0}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkright")}}class u extends l{constructor(e,t){super(e,t,"linetoolarrowmarkdown")}direction(){return"down"}name(){return"Arrow Mark Down"}textAlignParams(){return{horzAlign:"center",vertAlign:"bottom",offsetX:0,offsetY:20}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkdown")}}},76292:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMarker:()=>a});var s=i(76117),r=i(11092),n=i(674),o=i.n(n);class a extends s.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),i.e(1583).then(i.bind(i,3305)).then(({ArrowMarkerPaneView:e})=>{this._setPaneViews([new e(this,this.model())])})}pointsCount(){return 2}name(){return"Trend Line"}static createProperties(e){const t=new r.DefaultProperty("linetoolarrowmarker",e);return a._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,60810)).then(e=>e.ArrowMarkerDefinitionsViewModel)}static _configureProperties(e){s.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(o())("")),e.addExclusion("text")}}},26478:(e,t,i)=>{"use strict";var s=i(12565).LineToolTrendLine,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties())}name(){return"Arrow"}static createProperties(e){var t=new r("linetoolarrow",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolArrow=n},25830:(e,t,i)=>{"use strict";i.d(t,{LineToolBalloon:()=>h});var s=i(79881),r=i(11092),n=i(76117),o=i(674),a=i.n(o),l=i(39096);const c=(0,s.t)("Comment");class h extends n.LineDataSource{constructor(e,t){const s=t||h.createProperties();super(e,s),i.e(1583).then(i.bind(i,73955)).then(t=>{this._setPaneViews([new t.BalloonPaneView(this,e)])})}pointsCount(){return 1}name(){return"Balloon"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetoolballoon",e);return h._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,27340)).then(e=>e.BalloonDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(a())(c)),e.addExclusion("text"), e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().color]))}}},43492:(e,t,i)=>{"use strict";i.d(t,{BarsMarksContainer:()=>T});var s=i(16282),r=i(65447),n=i(64222),o=i.n(n),a=i(27490),l=i(76117),c=i(5729),h=i.n(c),d=i(35001),u=i(47903),p=i(25436);class _{constructor(e,t){this.source=e,this._rendererFactory=t}update(){}renderer(e,t){return this._rendererFactory(this.source)}}var m=i(58729),g=i(54837),f=i(72927),v=i(10288),S=i(71044);const y={green:{border:"#78C143",background:"#8DDD54"},red:{border:"#CC4545",background:"#ED5A5A"},neutral:{border:"#EAC300",background:"#FFD400"},yellow:{border:"#EAC300",background:"#FFD400"},blue:{border:"#047ACE",background:"#0496FF"}};class b extends m.ScaledPaneRenderer{constructor(e,t){super(),this._highlightByAuthor=!1,this._barWidth=e.barWidth,this._plates=e.plates,this._tooltip=e.tooltip,this._model=t}hitTest(e){for(let t=this._plates.length-1;t>=0;--t){const i=this._hitTestDot(this._plates[t],e);if(i)return i}return null}_drawImpl(e){var t,i;e.save();for(let e=0;ethis._plateTransform(e));null===(t=this._tooltip)||void 0===t||t.draw(s,e),null===(i=this._tooltip)||void 0===i||i.endDraw(),e.restore()}_drawItem(e,t){e.save(),this._highlightByAuthor&&!t.highlightByAuthor&&(e.globalAlpha=.4);const i=this._dotTransform(t);i.mine?this._drawTriangle(e,i):this._drawDot(e,i),e.restore()}_commonTransform(e){const t=Math.max(1.4*e.minSize,this._barWidth+4),i={up:-1,down:1}[e.direction]*(e.yInverted?-1:1)*(t*(e.order+.6)+.25*t),s=e.y+i,r=(0,u.clone)(e.overridedTheme||y[e.theme]);return r.dotBorderWidth=e.hovered||e.highlightByAuthor?4:2,{id:e.id,theme:r,themeName:e.theme,x:Math.round(e.x+1),y:Math.round(s),yInverted:e.yInverted,pinned:Boolean(e.pinned),hovered:Boolean(e.hovered)}}_dotTransform(e){const t=Math.max(e.minSize/2,.4*this._barWidth),i={...this._commonTransform(e),radius:t,label:e.label,labelFontColor:e.labelFontColor,labelFontSize:Math.ceil(Math.max(10,Math.min(t,20)))};return this._model.updateDotData(e,i)}_plateTransform(e){const t=this._commonTransform(e);return this._model.updatePlateData(e,t)}_drawTriangle(e,t){e.strokeStyle=t.theme.border,e.fillStyle=t.theme.background,e.lineWidth=t.theme.dotBorderWidth||2;const i=t,s=t.radius,r=Math.cos(Math.PI/6)*s,n=Math.sin(Math.PI/6)*s;e.translate(i.x,i.y);"up"===t.direction!==t.yInverted&&e.rotate(Math.PI),t.public||(e.lineWidth/=2),e.beginPath(),e.moveTo(0,-s),e.lineTo(r,n),e.lineTo(-r,n),e.lineTo(0,-s),e.closePath(),e.stroke(),t.public&&e.fill()}_drawDot(e,t){e.strokeStyle=t.theme.border,e.fillStyle=t.theme.background,e.lineWidth=t.theme.dotBorderWidth||2,e.beginPath(),e.arc(t.x,t.y,t.radius,0,2*Math.PI,!0),e.closePath(),e.stroke(),e.fill(),t.label&&t.radius>=7&&(e.textAlign="center",e.textBaseline="middle",e.font="bold "+t.labelFontSize+"px "+g.CHART_FONT_FAMILY, e.fillStyle=t.labelFontColor,e.fillText(t.label,t.x,t.y))}_hitTestDot(e,t){const i=this._dotTransform(e),s=new f.Point(i.x,i.y);return(0,S.pointInCircle)(t,s,Math.max(i.radius,8))?new v.HitTestResult(v.HitTestResult.REGULAR,{activeItem:e}):null}}var w=i(11092);const P=(0,r.getLogger)("Chart.BarsMarksContainer"),C=Math.round(new Date(2037,0,1).getTime()/1e3);class T extends l.LineDataSource{constructor(e,t){const i=e.onWidget();let r;if(r=i?!e.hideIdeas():!!a.enabled("bars_marks")&&o().getBool("BarsMarksContainer.visibile",!1),t)t.merge({visible:r,frozen:!1});else{t=new w.DefaultProperty("barmarks",{visible:r,frozen:!1})}t.childs().visible.listeners().subscribe(null,t=>{i||e.isSnapshot()||!a.enabled("bars_marks")||o().setValue("BarsMarksContainer.visibile",!!t.value()),this._tooltip&&this._tooltip.removeAll()}),l.LineDataSource._configureProperties(t),super(e,t),this.onNeedRepaint=new(h()),this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._lastRange=null,this._model.mainSeries().onSymbolIntervalChanged().subscribe(this,this.clearMarks),this._model.mainSeries().dataEvents().symbolResolved().subscribe(this,this.clearMarks),this._model.mainSeries().dataEvents().completed().subscribe(this,()=>{var e,t;const i=this._model.mainSeries().data();if(0===i.size())return;const r=(0,s.ensureNotNull)(i.first()).index,n=(0,s.ensureNotNull)(i.last()).index,o=this.timeScale();this.getData({start:null!==(e=o.indexToTimePoint(r))&&void 0!==e?e:1/0,end:null!==(t=o.indexToTimePoint(n))&&void 0!==t?t:-1/0})}),this._initialize(),this._pinnedTooltips={},this._tooltip=this._createTooltipRenderer()}marks(){return this._marks}updateDotData(e,t){return t}isAvailableInFloatingWidget(){return!1}pinTooltip(e,t){this._pinnedTooltips[e]=t}timeScale(){return this._model.timeScale()}getIntervalInTicks(){const e=this._model.mainSeries().properties().childs().interval.value(),t=d.Interval.parse(e);if(!t.isValid())throw new TypeError("Unexpected interval");return t.isRange()?60:t.inMilliseconds()/1e3}getVisibleTickMarksRange(){var e,t;if(this.timeScale().isEmpty())return{start:0,end:0};const i=(0,s.ensureNotNull)(this.timeScale().visibleBarsStrictRange()),r=(0,s.ensureNotNull)(this.timeScale().points().firstIndex()),n=(0,s.ensureNotNull)(this.timeScale().points().lastIndex());if(!(i.lastBar()>r&&i.firstBar(){var r,n;const o=this._marks[s],a=o.tickmark;a>=(null!==(r=t.start)&&void 0!==r?r:1/0)&&a<=(null!==(n=t.end)&&void 0!==n?n:-1/0)+i&&e.push(o)}),e}getPublishedPlates(){const e={};return window.is_authenticated?(this.getVisibleRangePlates().forEach(t=>{ t.is_public&&(this._pinnedTooltips[t.id]||t.user__id===window.user.id)&&(e[t.id]=t)}),e):e}filterDisplayedPlates(e){const t=e.reduce((e,t)=>{const i=this._getIndex(t.tickmark);return null!==i&&(e[i]=e[i]||[],e[i].push(t)),e},{});return Object.keys(t).reduce((e,i)=>{let s=t[i];return s=s.sort((e,t)=>t.views_count-e.views_count),s=s.slice(0,10),e.concat(s)},[])}getViewData(){return{barWidth:this.barWidth(),plates:this.getPlatesViewData(),tooltip:this._tooltip}}barWidth(){return this.timeScale().barSpacing()}getPlatesViewData(){var e,t,i;const r=this._model.mainSeries();if(r.data().isEmpty())return[];const n=(0,p.isPriceSourceStyle)(r.style())?r.barFunction():null,o=this.filterDisplayedPlates(this.getVisibleRangePlates()),a={},l=null!==(e=this._model.lastHittestData())&&void 0!==e?e:this._model.lastSelectedHittestData(),c=[];for(const e of o){const i=(0,s.ensureNotNull)(this._getIndex(e.tickmark)),r=this._getBar(i);if(null===r)continue;const o=this._layout(e.direction),h=this._theme(e.direction);let d=null;null!==l&&this._model.hoveredSource()===this&&(d=null!==(t=l.activeItem)&&void 0!==t?t:null);const p=null!==d&&d.id===e.id,_=this.timeScale().indexToCoordinate(i),m=this._offset(o,r,n),g=(0,s.ensureNotNull)(this.priceScale()).isInverted();let f=0;i in a||(a[i]={up:0,down:0}),f=a[i][o]++,c.push((0,u.merge)({id:e.id,x:_,y:m,yInverted:g,order:f,direction:o,theme:h,hovered:p,pinned:!0===this._pinnedTooltips[e.id],user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||5},this._plateViewData(e)))}const h=c.filter(e=>!0===e.hovered);for(let e=0;ee.hovered&&!t.hovered?1:0),c}paneViews(){return this._properties.childs().visible.value()?[new _(this,e=>new b(e.getViewData(),this))]:[]}priceAxisViews(){return null}updateAllViews(){}pointsCount(){return 0}roundRange(e){return{start:Math.round(e.start),end:Math.round(e.end)}}refreshData(){null!==this._lastRange&&this.getData(this._lastRange)}getData(e){(0,u.isNumber)(e.start)&&(0,u.isNumber)(e.end)?(this._lastRange=e,e.end=C,this._pushGetDataStack(Object.assign({},e))):P.logError("Wrong range")}clearMarks(){this._abortAllRequests(),this._marks={},this._loadedRange=null}isUserDeletable(){return!1}_plateViewData(e){return{}}_layout(e){switch(e){default:case 0:return"up";case 1:return"down";case 2:return"up";case 3:case 4:case 5:case 6:return"up"}}_theme(e){switch(e){default:case 0:return"neutral";case 1:return"green";case 2:return"red";case 3:return"yellow";case 4:return"blue";case 5:return"green";case 6:return"red"}}_offset(e,t,i){let r;switch(e){default:case"up":r=null===i?t[2]:i(t);break;case"down":r=null===i?t[3]:i(t)}return(0,s.ensureNotNull)(this.priceScale()).priceToCoordinate(r,(0,s.ensureNotNull)((0,s.ensureNotNull)(this.ownerSource()).firstValue()))}_getIndex(e){return this.timeScale().timePointToIndex(e)}_getBar(e){return this._model.mainSeries().data().valueAt(e)}_rangeDifference(e){return e=Object.assign({ start:1/0,end:-1/0},e),this._loadedRange&&(e.startthis._loadedRange.end&&(e.start=this._loadedRange.end)),e}_rangeUnion(e,t){return e=Object.assign({start:1/0,end:-1/0},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e}_pushGetDataStack(e){(0,u.isNumber)(e.start)&&(0,u.isNumber)(e.end)?(this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout(()=>{this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null},300)):P.logError("Wrong tickmark range")}_abortAllRequests(){this._requests.forEach(e=>{e.cancel()}),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null}}},83641:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolBarsPatternMode:()=>s}),function(e){e[e.Bars=0]="Bars",e[e.Line=1]="Line",e[e.OpenClose=2]="OpenClose",e[e.LineOpen=3]="LineOpen",e[e.LineHigh=4]="LineHigh",e[e.LineLow=5]="LineLow",e[e.LineHL2=6]="LineHL2"}(s||(s={}))},21827:(e,t,i)=>{"use strict";i.d(t,{LineToolBarsPattern:()=>v});var s=i(16282),r=i(79881),n=i(90963),o=i(47903),a=i(46374),l=i(11092),c=i(61627),h=i(76117),d=i(83641);const u=new n.TranslatedString("mirror bars pattern",(0,r.t)("mirror bars pattern")),p=new n.TranslatedString("flip bars pattern",(0,r.t)("flip bars pattern")),_=(0,r.t)("Mirrored"),m=(0,r.t)("Flipped"),g={0:2,1:4,2:1,3:1,4:2,5:3,6:-1},f={0:3,1:4,2:4,3:1,4:2,5:3,6:-1};class v extends h.LineDataSource{constructor(e,t=v.createProperties()){super(e,t),this._pattern=[],this._lastPriceCoeff=1;const s=t.childs().mode.value();(0,o.isString)(s)&&t.childs().mode.setValue(parseInt(s)),t.childs().mirrored.listeners().subscribe(this,this._mirror),t.childs().flipped.listeners().subscribe(this,this._flip),t.childs().mode.subscribe(this,this._updatePoints),this.version=2,i.e(1583).then(i.bind(i,25009)).then(t=>{this._setPaneViews([new t.BarsPatternPaneView(this,e)])})}pattern(){return this._pattern}isSynchronizable(){return!1}additionalActions(e){return[new a.Action({actionId:"Chart.LineTool.BarsPattern.ToggleMirrored",checked:this.properties().childs().mirrored.value(),checkable:!0,label:_,onExecute:()=>{e.setProperty(this.properties().childs().mirrored,!this.properties().childs().mirrored.value(),u),this.updateAllViews(),this._model.updateSource(this)}}),new a.Action({actionId:"Chart.LineTool.BarsPattern.ToggleFlipped",checked:this.properties().childs().flipped.value(),checkable:!0,label:m,onExecute:()=>{e.setProperty(this.properties().childs().flipped,!this.properties().childs().flipped.value(),p),this.updateAllViews(),this._model.updateSource(this)}})]}pointsCount(){return 2}state(e){return{...super.state(e),pattern:this._pattern}}restoreData(e){e.pattern&&(this._pattern=e.pattern)}name(){return"Bars Pattern"}hasEditableCoordinates(){return!1}cloneData(e){this._pattern=(0,o.clone)(e._pattern)}firstPatternPrice(){ const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[0];return e.value()===d.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[f[e.value()]]:i[g[e.value()]]}lastPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[this._pattern.length-1];return e.value()===d.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[g[e.value()]]:i[f[e.value()]]}addPoint(e,t,i){const r=super.addPoint(e,t,!0);if(r){const e=this._model.mainSeries(),[{index:t},{index:i}]=this.points(),r=(0,s.ensureDefined)(e.nearestIndex(Math.min(t,i),c.PlotRowSearchMode.NearestRight)),n=(0,s.ensureDefined)(e.nearestIndex(Math.max(t,i),c.PlotRowSearchMode.NearestLeft));this._pattern=this._createPattern(r,n),this._pattern.length>0&&(t>i&&this._points.reverse(),this._points[1].price=this._points[0].price+this._patternPriceDiff(),this._points[1].index=this._points[0].index+(n-r),this.normalizePoints(),this.createServerPoints())}return r}setPoint(e,t,i,s){1===e&&t.index<=this._points[0].index&&(t.index=this._points[0].index+1),0===e&&t.index>=this._points[1].index&&(t.index=this._points[1].index-1),super.setPoint(e,t,i)}migrateVersion(e,t,i){if(1===e&&this._pattern.length>0){const e=this._patternPriceDiff();2===this._timePoint.length&&(this._timePoint[1].price=this._timePoint[0].price+e),2===this._points.length&&(this._points[1].price=this._points[0].price+e)}}getPressCoeff(){return this._lastPriceCoeff=this._caclPressCoeff()}static createProperties(e){const t=new l.DefaultProperty("linetoolbarspattern",e);return v._configureProperties(t),t}_preparePoint(e,t){var i;const r=this._alignPointToRangeOfActualData(e),n=this._model.mainSeries(),o=(0,s.ensureNotNull)(n.bars().valueAt(r.index));this.properties().childs().mode.value()===d.LineToolBarsPatternMode.Bars?r.price=(0,s.ensure)(o[2]):r.price=(0,s.ensure)(o[4]);const a=(0,s.ensureNotNull)(this.priceScale()),l=(0,s.ensure)(null===(i=this.ownerSource())||void 0===i?void 0:i.firstValue()),c=.05*a.height(),h=a.priceToCoordinate(r.price,l)-c;return r.price=a.coordinateToPrice(h,l),super._preparePoint(r,t)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,23478))).BarsPatternDefinitionsViewModel}static _configureProperties(e){h.LineDataSource._configureProperties(e),e.addExclusion("mirrored"),e.addExclusion("flipped")}_createPattern(e,t){const i=this._model.mainSeries().data(),r=[];for(let n=e;n<=t;n++)r.push((0,o.clone)((0,s.ensureNotNull)(i.valueAt(n))));return r}_switchPointsPrice(){const e=this._points[0].price;this._timePoint[0].price=this._points[0].price=this._points[1].price,this._timePoint[1].price=this._points[1].price=e}_mirror(){const e=this._pattern;let t=Math.min(e[0][3],e[0][2]),i=Math.max(e[0][3],e[0][2]);for(let s=1;ss-(e-s);for(let t=0;ts.priceToCoordinate(e,r))}_priceCoordinateDiff(e){const t=this._pricesToCoordinates(e);if(t)return t[1]-t[0]}_caclPressCoeff(){if(2===this._points.length){const[{price:e},{price:t}]=this.points(),i=this._priceCoordinateDiff([this.firstPatternPrice(),this.lastPatternPrice()]),s=this._priceCoordinateDiff([e,t]);if(i&&void 0!==s)return s/i}return 1}_updatePoints(){var e,t;if(this._points.length<2)return;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===s||null===i||i.isEmpty())return;const r=this._priceCoordinateDiff([this.firstPatternPrice(),this.lastPatternPrice()]),n=this._pricesToCoordinates([this.points()[0].price]);void 0!==r&&n&&(this._timePoint[1].price=this._points[1].price=i.coordinateToPrice(this._lastPriceCoeff*r+n[0],s))}}},59376:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierCubic:()=>o});var s=i(16282),r=i(11092),n=i(76117);class o extends n.LineDataSource{constructor(e,t){const s=t||o.createProperties();super(e,s),this._controlPoints=null,i.e(1583).then(i.bind(i,56095)).then(t=>{this._setPaneViews([new t.BezierCubicPaneView(this,e)])})}pointsCount(){return 2}name(){return"Double Curve"}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoints=this._calculateControlPoints(),i}addPoint(e,t,i){const s=super.addPoint(e,t,i);if(s){const e=this._calculateControlPoints();this._controlPoints=null,this._points.push(e[0]),this._points.push(e[1]),i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2),this._createPointProperty(3)}return s}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2),this._createPointProperty(3)}controlPoints(){return this._controlPoints}static createProperties(e){const t=new r.DefaultProperty("linetoolbeziercubic",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,28415)).then(e=>e.GeneralBezierDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e)}_calculateControlPoints(){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.33),n=e.add(t).scaled(.67),o=r.add(i),a=n.subtract(i);return[(0,s.ensureNotNull)(this.screenPointToPoint(o)),(0,s.ensureNotNull)(this.screenPointToPoint(a))]}}},6016:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierQuadro:()=>o});var s=i(16282),r=i(11092),n=i(76117);class o extends n.LineDataSource{constructor(e,t){ const s=t||o.createProperties();super(e,s),this._controlPoint=null,i.e(1583).then(i.bind(i,60809)).then(t=>{this._setPaneViews([new t.BezierQuadroPaneView(this,e)])})}pointsCount(){return 2}name(){return"Curve"}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoint=this._calculateControlPoint(),i}addPoint(e,t,i){const s=super.addPoint(e,t,i);if(s){const e=this._calculateControlPoint();this._points.push(e),this._controlPoint=null,i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2)}return s}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2)}controlPoint(){return this._controlPoint}static createProperties(e){const t=new r.DefaultProperty("linetoolbezierquadro",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,28415)).then(e=>e.GeneralBezierDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e)}_calculateControlPoint(){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.5).add(i);return(0,s.ensureNotNull)(this.screenPointToPoint(r))}}},47324:(e,t,i)=>{"use strict";i.d(t,{LineToolBrushBase:()=>n});var s=i(16282),r=i(76117);class n extends r.LineDataSource{constructor(){super(...arguments),this._finished=!1}pointsCount(){return-1}finished(){return this._finished}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}hasEditableCoordinates(){return!1}addPoint(e,t,i){if(this._finished)return!0;if(this._lastPoint=null,this._points.length>0){const t=this._points[this._points.length-1],i=(0,s.ensureNotNull)(this.pointToScreenPoint(t));if((0,s.ensureNotNull)(this.pointToScreenPoint(e)).subtract(i).length()<2)return this._finished}return super.addPoint(e),this._finished}restorePoints(e,t,i){super.restorePoints(e,t,i),this._finished=!0}}},66842:(e,t,i)=>{"use strict";i.d(t,{LineToolBrush:()=>o});var s=i(11092),r=i(47324),n=i(39096);class o extends r.LineToolBrushBase{constructor(e,t){super(e,t||o.createProperties()),this._loadPaneViews(e)}smooth(){return this.properties().childs().smooth.value()}name(){return"Brush"}hasEditableCoordinates(){return!1}static createProperties(e){const t=new s.DefaultProperty("linetoolbrush",e);return o._configureProperties(t),t}_loadPaneViews(e){i.e(1583).then(i.bind(i,54414)).then(t=>{this._setPaneViews([new t.BrushPaneView(this,e)])})}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,72862)).then(e=>e.BrushDefinitionsViewModel)}static _configureProperties(e){r.LineToolBrushBase._configureProperties(e),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor],e.childs().fillBackground))}}},33682:(e,t,i)=>{"use strict";var s;i.d(t,{CalloutConsts:()=>s}),function(e){e[e.RoundRadius=8]="RoundRadius", e[e.TextMargins=2]="TextMargins",e[e.MinWidth=100]="MinWidth"}(s||(s={}))},20766:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(76117).LineDataSource,n=i(46015).DataSource,o=i(674),a=i(11092).DefaultProperty,l=i(33682).CalloutConsts,c=i(39096).LineToolColorsProperty;class h extends r{constructor(e,t){super(e,t||h.createProperties()),this._barOffset=0,this._timeScale=e.timeScale(),i.e(1583).then(i.t.bind(i,58535,19)).then(({CalloutPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Callout"}_correctPoints(e,t){var i=this._currentMovingPoint.logical.index-this._startMovingPoint.logical.index,s=this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price,r=e[1];r.index+=i,r.price+=s,e[1]=r}addPoint(e){var t=r.prototype.addPoint.call(this,e);return t&&this._calculateBarOffset(),t}_calculateBarOffset(){this.points().length>1&&(this._barOffset=this.points()[1].index-this.points()[0].index)}setLastPoint(e){var t=super.setLastPoint(e);return 2===this.points().length&&this._calculateBarOffset(),t}setPoint(e,t){switch(e){case 0:super.setPoint(e,t),this._calculateBarOffset();break;case 1:var i=this.properties();if(!i.wordWrapWidth)return;var s=this._points,r=this._dragStartLeftEdgeIndex,n=Math.round((t.index-r)/2);if(isFinite(r)&&isFinite(n)){s[1]={index:r+n,price:s[1].price},this._calculateBarOffset(),this.normalizePoints();var o=this._timeScale.indexToCoordinate(r+2*n)-this._timeScale.indexToCoordinate(r)-l.RoundRadius-l.TextMargins;if(!isFinite(o))return;i.wordWrapWidth.setValue(Math.max(l.MinWidth,o));break}s[1]=t,this._calculateBarOffset(),this.normalizePoints()}}setPoints(e){super.setPoints(e);var t=this.properties();if(t.wordWrapWidth){var i=this._dragStartLeftEdgeIndex,s=Math.round((e[1].index-i)/2);if(this._calculateBarOffset(),this.normalizePoints(),isFinite(i)&&isFinite(s)){var r=this._timeScale.indexToCoordinate(i+2*s)-this._timeScale.indexToCoordinate(i)-l.RoundRadius-l.TextMargins;if(!isFinite(r))return;t.wordWrapWidth.setValue(Math.max(l.MinWidth,r))}}}_onPointsetUpdated(e){super._onPointsetUpdated(e),0!==e.length&&(this._dragStartLeftEdgeIndex=this.points()[1].index)}move(e,t,i){super.move(e,t,i),this._calculateBarOffset()}state(e){var t=r.prototype.state.call(this,e);return t.barOffset=this._barOffset,t}restoreData(e){e.barOffset?this._barOffset=e.barOffset:this._calculateBarOffset(),this._calculatePoint2()}setPriceScale(e){n.prototype.setPriceScale.call(this,e),e&&e.priceRange()&&this._calculatePoint2()}template(){var e=r.prototype.template.call(this);return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_calculatePoint2(){if(!(this._model.lineBeingEdited()===this||this._model.sourcesBeingMoved().includes(this)||this._points.length<2)){var e=this.points()[0],t=this.points()[1];this._points[1]={price:t.price,index:e.index+this._barOffset}}}async _getPropertyDefinitionsViewModelClass(){ return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,58023))).CalloutDefinitionsViewModel}static createProperties(e){var t=new a("linetoolcallout",e);return h._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e),e.hasChild("text")||e.addChild("text",new o(s("Text"))),e.addExclusion("text"),e.addChild("textsColors",new c([e.childs().color]))}}t.LineToolCallout=h},96007:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e(1583).then(i.t.bind(i,95636,19)).then(({LineToolCircleLinesPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Cyclic Lines"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,60468))).CyclicAndSineLinesPatternDefinitionsViewModel}static createProperties(e){var t=new r("linetoolcirclelines",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolCircleLines=n},77198:(e,t,i)=>{"use strict";i.d(t,{LineToolCircle:()=>o});var s=i(11092),r=i(76117),n=i(39096);class o extends r.LineDataSource{constructor(e,t){const s=t||o.createProperties();super(e,s),i.e(1583).then(i.bind(i,18004)).then(({CirclePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}pointsCount(){return 2}name(){return"Circle"}static createProperties(e){const t=new s.DefaultProperty("linetoolcircle",e);return o._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,32454))).GeneralFiguresDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor])),e.addExclusion("linesColors"),e.addExclusion("linesWidths"),e.addExclusion("backgroundsColors")}}},56702:(e,t,i)=>{"use strict";i.d(t,{LineToolCrossLine:()=>a});var s=i(11092),r=i(58292),n=i(22086),o=i(76117);class a extends o.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),this._priceAxisView=new r.LineToolHorzLinePriceAxisView(this),this._timeAxisView=new n.LineToolVertLineTimeAxisView(this),i.e(1583).then(i.bind(i,78866)).then(({CrossLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 1}name(){return"Cross Line"}priceAxisViews(e,t){return this.isSourceHidden()?null:t===this.priceScale()&&this.properties().childs().showPrice.value()&&this._model.paneForSource(this)===e?[this._priceAxisView]:null}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(){super.updateAllViews(),this._priceAxisView.update(),this._timeAxisView.update()}canHasAlert(){return!1} lineColor(){return this.properties().childs().linecolor.value()}lineWidth(){return this.properties().childs().linewidth.value()}lineStyle(){return this.properties().childs().linestyle.value()}static createProperties(e){const t=new s.DefaultProperty("linetoolcrossline",e);return a._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,82781)).then(e=>e.CrossLineDefinitionsViewModel)}static _configureProperties(e){o.LineDataSource._configureProperties(e)}}},3913:(e,t,i)=>{"use strict";i.d(t,{LineToolCypherPattern:()=>n});var s=i(98127),r=i(11092);class n extends s.LineTool5PointsPattern{constructor(e,t){super(e,t||n.createProperties())}name(){return"Cypher Pattern"}static createProperties(e){const t=new r.DefaultProperty("linetoolcypherpattern",e);return n._configureProperties(t),t}_loadPaneViews(e){i.e(1583).then(i.bind(i,41308)).then(t=>{this._setPaneViews([new t.CypherPaneView(this,e)])})}static _configureProperties(e){s.LineTool5PointsPattern._configureProperties(e)}}},97867:(e,t,i)=>{"use strict";i.d(t,{LineToolDateAndPriceRange:()=>a});var s=i(16282),r=i(11092),n=i(76117),o=i(96370);class a extends n.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),this._volumeCalculator=null,i.e(1583).then(i.bind(i,99178)).then(e=>{this._setPaneViews([new e.DateAndPriceRangePaneView(this,this._model)])})}destroy(){super.destroy(),null!==this._volumeCalculator&&this._volumeCalculator.destroy()}pointsCount(){return 2}name(){return"Date and Price Range"}volume(){if(null===this._volumeCalculator)return NaN;const e=this.points();return this._volumeCalculator.volume(e[0].index,e[1].index)}setOwnerSource(e){e===this._model.mainSeries()&&((0,s.assert)(null===this._volumeCalculator),this._volumeCalculator=new o.SeriesTimeRangeVolumeCalculator(this._model.mainSeries())),super.setOwnerSource(e)}static createProperties(e){const t=new r.DefaultProperty("linetooldateandpricerange",e);return a._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,44558))).GeneralDatePriceRangeDefinitionsViewModel}static _configureProperties(e){n.LineDataSource._configureProperties(e)}}},65833:(e,t,i)=>{"use strict";i.d(t,{LineToolDateRange:()=>a});var s=i(16282),r=i(11092),n=i(76117),o=i(96370);class a extends n.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),this._volumeCalculator=null,i.e(1583).then(i.bind(i,34286)).then(e=>{this._setPaneViews([new e.DateRangePaneView(this,this._model)])})}destroy(){super.destroy(),null!==this._volumeCalculator&&this._volumeCalculator.destroy()}pointsCount(){return 2}name(){return"Date Range"}volume(){if(null===this._volumeCalculator)return NaN;const e=this.points();return this._volumeCalculator.volume(e[0].index,e[1].index)}setOwnerSource(e){e===this._model.mainSeries()&&((0,s.assert)(null===this._volumeCalculator),this._volumeCalculator=new o.SeriesTimeRangeVolumeCalculator(this._model.mainSeries())),super.setOwnerSource(e)} static createProperties(e){const t=new r.DefaultProperty("linetooldaterange",e);return a._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,44558))).GeneralDatePriceRangeDefinitionsViewModel}static _configureProperties(e){n.LineDataSource._configureProperties(e)}}},2683:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),this.version=n.version,i.e(1583).then(i.t.bind(i,41065,19)).then(({DisjointChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 3}name(){return"Disjoint Channel"}hasEditableCoordinates(){return!1}addPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),s.prototype.addPoint.call(this,e)}setLastPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),s.prototype.setLastPoint.call(this,e)}setPoint(e,t,i){var s=.5*(this._points[1].price+this._points[2].price);if(i&&i.shift()&&1===e){this._snapPoint45Degree(t,this.points()[0])}if(e<3&&super.setPoint(e,t),0!==e&&2!==e){if(1===e){var r=this._points[1].price-s;this._points[2].price=this._points[1].price-2*r}else if(3===e){r=t.price-this._points[2].price;this._points[0].price=this._points[1].price-r,this._points[0].index=t.index}this.normalizePoints()}}getPoint(e){if(e<3)return s.prototype.getPoint.call(this,e);var t=this._points[0].price-this._points[2].price;return{index:this._points[0].index,price:this._points[1].price-t}}canHasAlert(){return!0}_getAlertPlots(){var e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));var s=this._points[2];s.time=t.time,s.index=t.index;var r,n,o,a,l={price:s.price+(t.price-e.price),time:e.time,index:e.index},c=[];s.index<=l.index?(c.push(s),c.push(l)):(c.push(l),c.push(s)),i[0].price>c[0].price?(r=i,n=c):c[0].price>i[0].price||c[1].price>i[1].price?(r=c,n=i):(r=i,n=c);var h=this.properties().extendLeft.value(),d=this.properties().extendRight.value();return e.index<=t.index?(o=h,a=d):(o=d,a=h),[this._linePointsToAlertPlot(r,"Upper",o,a),this._linePointsToAlertPlot(n,"Lower",o,a)]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,44150))).GeneralTrendFiguresDefinitionsViewModel}static createProperties(e){var t=new r("linetooldisjointangle",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}n.version=1,t.LineToolDisjointChannel=n},74168:(e,t,i)=>{"use strict";i.d(t,{LineToolElliott:()=>u,LineToolElliottImpulse:()=>m,LineToolElliottTriangle:()=>f,LineToolElliottTripleCombo:()=>S,LineToolElliottCorrection:()=>w,LineToolElliottDoubleCombo:()=>C});var s=i(79881),r=i(90963),n=i(76117),o=i(46374),a=i(11092),l=i(39096);const c=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],h=new r.TranslatedString("change Elliott degree",(0, s.t)("change Elliott degree")),d=[{value:0,title:(0,s.t)("Supermillennium")},{value:1,title:(0,s.t)("Millennium")},{value:2,title:(0,s.t)("Submillennium")},{value:3,title:(0,s.t)("Grand supercycle")},{value:4,title:(0,s.t)("Supercycle")},{value:5,title:(0,s.t)("Cycle")},{value:6,title:(0,s.t)("Primary")},{value:7,title:(0,s.t)("Intermediate")},{value:8,title:(0,s.t)("Minor",{context:"wave"})},{value:9,title:(0,s.t)("Minute",{context:"wave"})},{value:10,title:(0,s.t)("Minuette")},{value:11,title:(0,s.t)("Subminuette")},{value:12,title:(0,s.t)("Micro")},{value:13,title:(0,s.t)("Submicro")},{value:14,title:(0,s.t)("Minuscule")}];class u extends n.LineDataSource{constructor(e,t){super(e,null!=t?t:u.createProperties()),this.version=4,i.e(1583).then(i.bind(i,81277)).then(e=>{this._setPaneViews([new e.ElliottLabelsPaneView(this,this._model)])})}migrateVersion(e,t,i){if(i.properties.hasChild("background")&&i.properties.removeProperty("background"),i.properties.hasChild("backgroundColor")&&i.properties.removeProperty("backgroundColor"),i.properties.hasChild("showBackground")&&i.properties.removeProperty("showBackground"),1===e){const e=Object.assign({},this._timePoint[0]);if(this._timePoint.unshift(e),this._points.length>0){const e=Object.assign({},this._points[0]);this._points.unshift(e)}}}applyTemplate(e){const t=e;delete t.background,delete t.backgroundColor,delete t.showBackground,super.applyTemplate(e)}name(){return"Elliott Labels"}additionalActions(e){return[new o.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",label:(0,s.t)("Degree"),subItems:c.map(t=>{const i=d.filter(e=>e.value===t)[0];return new o.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",label:i.title,checkable:!0,checked:this.properties().childs().degree.value()===t,onExecute:()=>{e.setProperty(this.properties().childs().degree,t,h)}})})})]}label(e){const t=c.length-this.properties().childs().degree.value()-1,i=Math.floor(t/3);return{group:i,bold:!!(i%2),decoration:["","brackets","circle"][t%3],label:this.labelsGroup()[i][e]}}availableDegreesValues(){return d}static createProperties(e){const t=new a.DefaultProperty("linetoolelliott",e);return u._configureProperties(t),t}static migrateState(e){const t={0:11,1:10,2:9,3:8,4:7,5:6,6:5,7:4,8:3},i={0:11,1:8};"LineToolElliottSubminuette"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinor"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottCircle"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize]),"LineToolElliottMajorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize])}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,60312))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){n.LineDataSource._configureProperties(e), e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().color])),e.addExclusion("linesColors")}}class p extends u{pointsCount(){return 6}static _configureProperties(e){u._configureProperties(e)}}const _=[["0","1","2","3","4","5"],["0","i","ii","iii","iv","v"],["0","1","2","3","4","5"],["0","I","II","III","IV","V"],["0","1","2","3","4","5"]];class m extends p{constructor(e,t){super(e,t||m.createProperties())}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){return _}static createProperties(e){const t=new a.DefaultProperty("linetoolelliottimpulse",e);return m._configureProperties(t),t}static _configureProperties(e){p._configureProperties(e)}}const g=[["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"]];class f extends p{constructor(e,t){super(e,t||f.createProperties())}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return g}static createProperties(e){const t=new a.DefaultProperty("linetoolelliotttriangle",e);return f._configureProperties(t),t}static _configureProperties(e){p._configureProperties(e)}}const v=[["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"]];class S extends p{constructor(e,t){super(e,null!=t?t:S.createProperties())}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return v}static createProperties(e){const t=new a.DefaultProperty("linetoolelliotttriplecombo",e);return S._configureProperties(t),t}static _configureProperties(e){p._configureProperties(e)}}class y extends u{pointsCount(){return 4}static _configureProperties(e){u._configureProperties(e)}}const b=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class w extends y{constructor(e,t){super(e,null!=t?t:w.createProperties())}name(){return"Elliott Correction Wave (ABC)"}labelsGroup(){return b}static createProperties(e){const t=new a.DefaultProperty("linetoolelliottcorrection",e);return w._configureProperties(t),t}static _configureProperties(e){y._configureProperties(e)}}const P=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class C extends y{constructor(e,t){super(e,null!=t?t:C.createProperties())}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return P}static createProperties(e){const t=new a.DefaultProperty("linetoolelliottdoublecombo",e);return C._configureProperties(t),t}static _configureProperties(e){y._configureProperties(e)}}},56686:(e,t,i)=>{"use strict";i.d(t,{LineToolEllipse:()=>c});var s=i(16282),r=i(89684),n=i(72927),o=i(76117),a=i(11092),l=i(39096);class c extends o.LineDataSource{constructor(e,t){super(e,t||c.createProperties()),this.version=2,this._dist=null,this._fakePointAdded=!1,i.e(1583).then(i.bind(i,72133)).then(({EllipsePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0, s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,r.distanceToLine)(e,t,i).distance||0}}addPoint(e,t,i){const s=o.LineDataSource.prototype.addPoint.call(this,e,t,i);return s&&(this._fakePointAdded=!1),s}setPoint(e,t,i,o){const a={...t};let l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),h=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));switch(e){case 0:{if(i&&i.shift()){this._snapPoint45Degree(a,this._points[1]),this._points[0]=a,this._points[2]=this._preparePointInternal(this._points[2],i,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[0],this._points[1],this._points[2]);break}l=(0,s.ensureNotNull)(this.pointToScreenPoint(a));const e=c.subtract(l),t=l.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();h=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[0]=a,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 1:{if(i&&i.shift()){this._snapPoint45Degree(a,this._points[0]),this._points[1]=a,this._points[2]=this._preparePointInternal(this._points[2],i,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],this._points[2]);break}c=(0,s.ensureNotNull)(this.pointToScreenPoint(a));const e=c.subtract(l),t=l.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();h=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[1]=a,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 2:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(a)),t=(0,r.distanceToLine)(l,c,e).distance,i=c.subtract(l),o=l.add(c).scaled(.5),d=new n.Point(-i.y,i.x).normalized();h=o.add(d.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 3:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(a)),t=(0,r.distanceToLine)(l,c,e).distance,i=c.subtract(l),o=l.add(c).scaled(.5),d=new n.Point(-i.y,i.x).normalized();h=o.add(d.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}}this.normalizePoints()}pointsCount(){return 3}name(){return"Ellipse"}hasEditableCoordinates(){return!1}migrateVersion(e,t,i){if(1===e&&2===this._points.length){const e=this._points[0].price,t=.5*(this._points[0].price+this._points[1].price);this._points[0]={price:t,index:this._points[0].index},this._points[1]={price:t,index:this._points[1].index},this._points.push({price:e,index:this._points[0].index})}if(1===e&&2===this._timePoint.length){const e=this._timePoint[0].price,t=.5*(this._timePoint[0].price+this._timePoint[1].price);this._timePoint[0].price=t,this._timePoint[1].price=t;const i={price:e,offset:this._timePoint[0].offset,time_t:this._timePoint[0].time_t};this._timePoint.push(i)}}static createProperties(e){const t=new a.DefaultProperty("linetoolellipse",e);return c._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){ return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,32454))).GeneralFiguresDefinitionsViewModelBase}_preparePoint(e,t){const i=this._preparePointInternal(e,t,!1);return t&&t.shift()&&this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],i),i}static _configureProperties(e){o.LineDataSource._configureProperties(e),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().color]))}_preparePointInternal(e,t,i){let r={...e};if(t&&t.shift()){const t=this.points().length;if(!this._fakePointAdded&&3===t&&!i)return r;if(this._fakePointAdded||2===t||i){this._snapPoint45Degree(e,this._points[0]),this._fakePointAdded?this._points[1]=e:i||(this._fakePointAdded=!0,super._addPointIntenal(e));const t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),a=o.x-t.x,l=o.y-t.y,c=Math.sqrt(a*a+l*l)/2,h=o.subtract(t),d=t.add(o).scaled(.5),u=new n.Point(-h.y,h.x).normalized(),p=d.add(u.scaled(c));r=(0,s.ensureNotNull)(this.screenPointToPoint(p)),(isNaN(r.price)||isNaN(r.index))&&(r=(0,s.ensureNotNull)(this.screenPointToPoint(d)))}}else this._fakePointAdded&&(this._points.splice(1,1),this._fakePointAdded=!1);return r}_fixVerticalDiameterPoints(e,t,i){const r=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),o=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),a=this._model.timeScale(),l=a.indexToCoordinate(e.index),c=a.indexToCoordinate(i.index);let h=2*Math.abs(l-c);h*=t.price>e.price?1:-1,e.price=(0,s.ensureNotNull)(this.screenPointToPoint(new n.Point(r.x,o.y+h))).price}}},22769:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(55752),n=i(11092).DefaultProperty,o=i(61627).PlotRowSearchMode;const a=i(27490);var l=i(36512).sortSourcesPreOrdered.LineToolExecution;class c{constructor(e,t){this._pane=e,this._timeScale=t}static recreateOrderedByBarsSourcesCache(e){c.clearOrderedByBarsSourcesCache();for(var t=c.prototype,i=e.sourcesByGroup().all(),s=0;s_.lastBar()||i<_.firstBar())return{x:-1,y:-1};for(var m=this._cachedByBarIndexOrderedExecutions[i]||this._pane.sourcesByGroup().all(),g=m.length-1;g>=0;--g){var f=m[g];if(f instanceof d&&f._adapter._index===i&&f._adapter.getDirection()===r){if(f===e._line)break;var v=f._adapter._height();s=n?s+v:s-v}}return{ x:t.indexToCoordinate(i),y:s}}}c.prototype._cachedByBarIndexOrderedExecutions={};class h{constructor(e){this._line=e}_height(){var e=this.getArrowHeight(),t=this.getArrowSpacing();this.getText()&&r.fontHeight(this.getFont());return e+t+0+10}getIndex(){return this._line._model.timeScale().baseIndex()-this._line.points()[0].index}setIndex(e){var t=this._line._model.timeScale().baseIndex()-Math.abs(e);this._line.startMoving({logical:this._line.points()[0]});var i=TradingView.merge({},this._line.points()[0]);return i.index=t,this._line.move({logical:i}),this._line.endMoving(),this}getTime(){return this._unixtime}setTime(e){return this._unixtime=e,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){return this._line.points().length>0&&(this._line.points()[0].price=e),this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._line.properties().text.value()}setText(e){return this._line.properties().text.setValue(e||""),this._line.updateAllViewsAndRedraw(),this}getArrowHeight(){return this._line.properties().arrowHeight.value()}setArrowHeight(e){return this._line.properties().arrowHeight.setValue(e||5),this}getArrowSpacing(){return this._line.properties().arrowSpacing.value()}setArrowSpacing(e){return this._line.properties().arrowSpacing.setValue(e||1),this}getDirection(){return this._line.properties().direction.value()}setDirection(e){return this._line.properties().direction.setValue(e||"buy"),this}getArrowColor(){var e=this._line.properties();return"buy"===this.getDirection()?e.arrowBuyColor.value():e.arrowSellColor.value()}setArrowColor(e){return"buy"===this.getDirection()?this.setArrowBuyColor(e):this.setArrowSellColor(e),this}setArrowBuyColor(e){return this._line.properties().arrowBuyColor.setValue(e),this}setArrowSellColor(e){return this._line.properties().arrowSellColor.setValue(e),this}getTextColor(){return r.getColorFromProperties(this._line.properties().textColor,this._line.properties().textTransparency)}setTextColor(e){return r.setColorToProperties(e,this._line.properties().textColor,this._line.properties().textTransparency),this}getFont(){return r.getFontFromProperties(this._line.properties().fontFamily,this._line.properties().fontSize,this._line.properties().fontBold,this._line.properties().fontItalic)}setFont(e){return r.setFontToProperties(e,this._line.properties().fontFamily,this._line.properties().fontSize,this._line.properties().fontBold,this._line.properties().fontItalic),this}setTooltip(e){return null==e?e="":e+="",this._line.properties().tooltip.setValue(e),this}getTooltip(){return this._line.properties().tooltip.value()}remove(){this._line._model.removeSource(this._line),delete this._line}getPoints(){return this._line.points()}}class d extends s{constructor(e,t){super(e,t||d.createProperties()),this._adapter=new h(this), this.customization.forcePriceAxisLabel=!1,this.customization.disableErasing=!0,this.customization.showInObjectTree=!1,this.setSelectionEnabled(!1),i.e(1583).then(i.t.bind(i,34810,19)).then(({ExecutionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}zorder(){return l}isSpeciallyZOrderedSource(){return!0}pointsCount(){return d.POINTS_COUNT}name(){return"Execution"}hasContextMenu(){return!1}state(){return null}updateAllViews(){return this._isVisible()?s.prototype.updateAllViews.call(this):null}priceAxisViews(e,t){return this._isVisible()?s.prototype.priceAxisViews.call(this,e,t):null}_isVisible(){return this._model.properties().tradingProperties.showExecutions.value()}paneViews(){return TradingView.printing&&!a.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showExecutions.value()?s.prototype.paneViews.call(this):null}userEditEnabled(){return!1}showInObjectTree(){return!1}cloneable(){return!1}copiable(){return!1}isSynchronizable(){return!1}static createProperties(e){var t=new n("linetoolexecution",e,!1,!1);return d._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}d.POINTS_COUNT=1,t.ExecutionsPositionController=c,t.LineToolExecution=d},66163:(e,t,i)=>{"use strict";var s=i(12565).LineToolTrendLine,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties())}name(){return"Extended Line"}static createProperties(e){var t=new r("linetoolextended",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolExtended=n},40861:(e,t,i)=>{"use strict";i.d(t,{LineToolFibChannel:()=>d});var s=i(16282),r=i(79881),n=i(90963),o=i(76117),a=i(81773),l=i.n(a),c=i(39096);const h=new n.TranslatedString("erase level line",(0,r.t)("erase level line"));class d extends o.LineDataSource{constructor(e,t){super(e,t||d.createProperties()),this.version=2,i.e(1583).then(i.bind(i,89436)).then(({FibChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return 24}migrateVersion(e,t,i){i.properties.removeProperty("reverse")}pointsCount(){return 3}name(){return"Fib Channel"}processErase(e,t){const i="level"+t,s=this.properties().child(i).childs().visible;e.setProperty(s,!1,h)}static createProperties(e){const t=new(l())("linetoolfibchannel",e,!1,{range:[1,24],names:["coeff","color","visible"]});return d._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,58481))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){o.LineDataSource._configureProperties(e);const t=[];for(let i=1;i<=24;i++){const r=(0,s.ensureDefined)(e.child("level"+i));t.push((0,s.ensureDefined)(r.child("color")))}e.addChild("linesColors",new c.LineToolColorsProperty(t))}}},90763:(e,t,i)=>{"use strict" ;var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),i.e(1583).then(i.t.bind(i,1509,19)).then(({FibCirclesPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 2}name(){return"Fib Circles"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}static createProperties(e){var t=new o("linetoolfibcircles",e,!1,{range:[1,11]});return d._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,40804))).FibCirclesDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){n._configureProperties(e);for(var t=[e.child("trendline").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=11,t.LineToolFibCircles=d},88376:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(81773),o=i(76117).LineDataSource,a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends o{constructor(e,t){super(e,t||d.createProperties()),this.version=d.version,this._properties._stateVersion=1,i.e(1583).then(i.t.bind(i,81247,19)).then(({FibRetracementPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 2}name(){return"Fib Retracement"}migrateVersion(e,t,i){1===e&&this.properties().extendLines.setValue(!0)}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,58481))).FibDrawingsWith24LevelsDefinitionsViewModel}static createProperties(e){var t=new n("linetoolfibretracement",e,!1,{range:[1,24],names:["coeff","color","visible"]});return d._configureProperties(t),t}static _configureProperties(e){o._configureProperties(e);for(var t=[e.child("trendline").child("linewidth"),e.child("levelsStyle").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=d.LevelsCount;s++)i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}fibLevelsBasedOnLogScale(){return this.properties().fibLevelsBasedOnLogScale.value()&&this.priceScale().isLog()}}d.version=2,d.LevelsCount=24,t.LineToolFibRetracement=d},77268:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){ super(e,t||d.createProperties()),i.e(1583).then(i.bind(i,43900)).then(({FibSpeedResistanceArcsPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 2}name(){return"Fib Speed Resistance Arcs"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}static createProperties(e){var t=new o("linetoolfibspeedresistancearcs",e,!1,{range:[1,11]});return d._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,8545))).FibSpeedResistanceArcsDefinitionsViewModel}static _configureProperties(e){n._configureProperties(e);for(var t=[e.child("trendline").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=11,t.LineToolFibSpeedResistanceArcs=d},19832:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096).LineToolColorsProperty,l=new r("erase level line",s("erase level line"));class c extends n{constructor(e,t){super(e,t||c.createProperties()),i.e(1583).then(i.bind(i,95292)).then(({FibSpeedResistanceFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}hLevelsCount(){return c.HLevelsCount}vLevelsCount(){return c.VLevelsCount}pointsCount(){return 2}name(){return"Fib Speed Resistance Fan"}processErase(e,t){var i="h"===t.type?"hlevel"+t.index:"vlevel"+t.index,s=this.properties()[i].visible;e.setProperty(s,!1,l)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,84061))).FibSpeedResistanceFanDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){void 0!==e&&void 0===e.reverse&&(e.reverse=!0);var t=new o("linetoolfibspeedresistancefan",e,!1,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]});return c._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e);var t=[e.child("grid").child("color")];for(let i=1;i<=c.HLevelsCount;i++)t.push(e.child("hlevel"+i).child("color"));for(let i=1;i<=c.VLevelsCount;i++)t.push(e.child("vlevel"+i).child("color"));e.addChild("linesColors",new a(t)),e.addExclusion("linesColors")}}c.HLevelsCount=7,c.VLevelsCount=7,t.LineToolFibSpeedResistanceFan=c},34067:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e(1583).then(i.bind(i,33732)).then(({FibSpiralPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Fib Spiral"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,73546))).FibSpiralDefinitionsViewModel}static createProperties(e){var t=new r("linetoolfibspiral",e);return n._configureProperties(t),t} static _configureProperties(e){s._configureProperties(e)}}t.LineToolFibSpiral=n},26452:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),this.version=d.version,i.e(1583).then(i.t.bind(i,62585,19)).then(({FibTimeZonePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}migrateVersion(e,t,i){if(1===e){i.properties.level1.color.setValue(i.properties.baselinecolor.value());for(var s=2;s<=11;s++)i.properties["level"+s].color.setValue(i.properties.linecolor.value());for(s=1;s<=11;s++)i.properties["level"+s].linewidth.setValue(i.properties.linewidth.value()),i.properties["level"+s].linestyle.setValue(i.properties.linestyle.value())}}pointsCount(){return 2}name(){return"Fib Time Zone"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,46446))).FibTimezoneDefinitionsViewModel}static createProperties(e){var t=new o("linetoolfibtimezone",e,!1,{range:[1,11]});return d._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e);for(var t=[],i=[],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));for(t=[],i=[],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.version=2,d.LevelsCount=11,t.LineToolFibTimeZone=d},55977:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedgeBase:()=>o});var s=i(16282),r=i(72927),n=i(76117);class o extends n.LineDataSource{pointsCount(){return 3}hasEditableCoordinates(){return!1}setPoint(e,t){if(super.setPoint(e,t),!this._recursiveGuard)try{if(this._recursiveGuard=!0,2===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0]));let t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));const i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2])).subtract(e).length();let n=t.subtract(e);n.length()<=0&&(n=new r.Point(1,0)),t=e.add(n.normalized().scaled(i));const o=(0,s.ensureNotNull)(this.screenPointToPoint(t)),a=this._pointsProperty.childs().points[1];a.childs().price.setValue(o.price),a.childs().bar.setValue(o.index)}else{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));const n=t.subtract(e).length();let o=i.subtract(e);o.length()<=0&&(o=new r.Point(1,0)),i=e.add(o.normalized().scaled(n));const a=(0,s.ensureNotNull)(this.screenPointToPoint(i)),l=this._pointsProperty.childs().points[2];l.childs().price.setValue(a.price),l.childs().bar.setValue(a.index)}}finally{this._recursiveGuard=!1} }addPoint(e){if(2===this._points.length){const t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let r=(0,s.ensureNotNull)(this.pointToScreenPoint(e));const n=i.subtract(t).length(),o=r.subtract(t).normalized();r=t.add(o.scaled(n));const a=(0,s.ensureNotNull)(this.ownerSource()),l=(0,s.ensureNotNull)(a.firstValue()),c=(0,s.ensureNotNull)(this.priceScale()).coordinateToPrice(r.y,l);e={index:Math.round(this._model.timeScale().coordinateToIndex(r.x)),price:c}}return n.LineDataSource.prototype.addPoint.call(this,e)}}},64794:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(55977).LineToolFibWedgeBase,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),i.e(1583).then(i.t.bind(i,19027,19)).then(({FibWedgePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}isSynchronizable(){return!1}levelsCount(){return d.LevelsCount}name(){return"Fib Wedge"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}static createProperties(e){var t=new o("linetoolfibwedge",e,!1,{range:[1,11]});return d._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,82731))).FibWedgeDefinitionsViewModel}static _configureProperties(e){n._configureProperties(e);for(var t=[e.child("trendline").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=11,t.LineToolFibWedge=d},59954:(e,t,i)=>{"use strict";i.d(t,{LineToolFlagMark:()=>a});var s=i(72927),r=i(76117),n=i(11092),o=i(39096);class a extends r.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),i.e(1583).then(i.bind(i,16399)).then(({FlagMarkPaneView:e})=>{const t=new e(this,this.model());t.setAnchors(new s.Point(0,0)),this._setPaneViews([t])})}pointsCount(){return 1}name(){return"Flag Mark"}static createProperties(e){e&&void 0===e.flagColor&&(e.flagColor="#318757");const t=new n.DefaultProperty("linetoolflagmark",e);return a._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,84017)).then(e=>e.FlagMarkDefinitionsViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().flagColor])),e.addExclusion("backgroundsColors")}}a.version=2},63343:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),this.version=n.version,i.e(1583).then(i.t.bind(i,88589,19)).then(({FlatBottomPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 3}name(){ return"Flat Bottom"}hasEditableCoordinates(){return!1}addPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),s.prototype.addPoint.call(this,e)}setLastPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),s.prototype.setLastPoint.call(this,e)}setPoint(e,t,i){if(i&&i.shift()&&1===e){this._snapPoint45Degree(t,this.points()[0])}if(2===e)this._points[1].index=t.index;else if(3===e)return this._points[0].index=t.index,this._points[2].price=t.price,void this.normalizePoints();super.setPoint(e,t)}getPoint(e){return e<3?s.prototype.getPoint.call(this,e):3===e?{index:this._points[0].index,price:this._points[2].price}:void 0}canHasAlert(){return!0}_getAlertPlots(){var e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));var s=this._points[2];s.time=t.time,s.index=t.index;var r,n,o,a,l={price:s.price,time:e.time,index:e.index},c=[];s.index<=l.index?(c.push(s),c.push(l)):(c.push(l),c.push(s)),i[0].price>c[0].price?(r=i,n=c):c[0].price>i[0].price||c[1].price>i[1].price?(r=c,n=i):(r=i,n=c);var h=this.properties().extendLeft.value(),d=this.properties().extendRight.value();return e.index<=t.index?(o=h,a=d):(o=d,a=h),[this._linePointsToAlertPlot(r,"Upper",o,a),this._linePointsToAlertPlot(n,"Lower",h,a)]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,44150))).GeneralTrendFiguresDefinitionsViewModel}static createProperties(e){var t=new r("linetoolflatbottom",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}n.version=1,t.LineToolFlatBottom=n},64166:(e,t,i)=>{"use strict";i.d(t,{createPropertiesObject:()=>a});var s=i(47903),r=i(81773),n=i.n(r);class o extends(n()){constructor(e,t){super(e,t,!1,{names:["width","color","visible"]})}_iterateLevels(e,t){for(const i in e.levels)if(e.levels[i]&&(0,s.isSameType)(e.levels[i],t.typecheck())){let s=t.tpl();for(const r in this._map.names)this._map.names.hasOwnProperty(r)&&(s=t.fill(r,this._map.names[r],e.levels[i],s));e.levels[i]=s}return e}}function a(e,t){return new o(e,t)}},75622:(e,t,i)=>{"use strict";function s(e){"LineToolGannComplex"!==e.type||void 0!==e.version&&1!==e.version||(e.type="LineToolGannFixed")}i.r(t),i.d(t,{migrateState:()=>s})},76112:(e,t,i)=>{"use strict";i.d(t,{LineToolGannComplex:()=>d});var s=i(72927),r=i(16282),n=i(43434),o=i(76117),a=i(2397),l=i(64166),c=i(39096),h=i(54837);class d extends o.LineDataSource{constructor(e,t){super(e,t||d.createProperties()),this.version=2,this._scaleRatioFormatter=new n.LimitedPrecisionNumericFormatter(7),this.version=2,i.e(1583).then(i.bind(i,2498)).then(({GannComplexPaneView:e})=>{this._setPaneViews([new e(this,this.model())])});const s=this.properties();this._adjustScaleRatio(s),s.subscribe(this,this._adjustScaleRatio),s.childs().scaleRatio.subscribe(this,this._correctFirstPoint),this._syncStateExclusions=["scaleRatio"], s.addExclusion("scaleRatio"),s.onRestoreFactoryDefaults().subscribe(this,this._handleRestoringFactoryDefaults),this._onTemplateApplying.subscribe(this,this._handleTemplateApplying),this._onTemplateApplied.subscribe(this,this._correctFirstPoint)}migrateVersion(e,t,i){1===e&&(this._points.length>=this.pointsCount()?setTimeout(()=>this._migratePoint()):this._timePoint.length>=this.pointsCount()&&this._pointAdded.subscribe(this,this._migratePoint))}destroy(){const e=this.properties();e.unsubscribe(this,this._adjustScaleRatio),e.childs().scaleRatio.unsubscribe(this,this._correctFirstPoint),e.onRestoreFactoryDefaults().unsubscribe(this,this._handleRestoringFactoryDefaults),this._onTemplateApplying.unsubscribe(this,this._handleTemplateApplying),this._onTemplateApplied.unsubscribe(this,this._correctFirstPoint),super.destroy()}pointsCount(){return 2}name(){return"Gann Square"}addPoint(e,t,i){this._points.length>1&&this._points.pop();const s=super.addPoint(e,t,i),n=this.priceScale();return!(0,r.ensureNotNull)(n).isLog()&&s&&this._correctFirstPoint(),s}setPoint(e,t,i){super.setPoint(e,t,i),void 0!==i&&i.shift()?this._correctPoint(e):this._correctScaleRatio()}setLastPoint(e,t){const i=this.priceScale();return(0,r.ensureNotNull)(i).isLog()||(this._points[1]=e,this._correctPoint(1)),super.setLastPoint(e,t)}isReversed(){return this.properties().childs().reverse.value()}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;se.GannComplexAndFixedDefinitionsViewModel)}static _configureProperties(e){o.LineDataSource._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0,o=s.index-r.index>0;let a=n&&!o||!n&&o?-1:1;0===e&&(a=-a),s.price=r.price+a*t*i,this._pointChanged.fire(e)}this.normalizePoints()}_correctFirstPoint(){this._correctPoint(this.isReversed()?0:1)}_handleRestoringFactoryDefaults(){this.properties().childs().scaleRatio.setValue(this._getAdjustedScaleRatio())}_handleTemplateApplying(e){""===e.scaleRatio&&(e.scaleRatio=this._getAdjustedScaleRatio())}_migratePoint(){if(this.points().length0){s=s.normalized();let e=Math.acos(s.x);return s.y>0&&(e=-e),e}return null}}},92803:(e,t,i)=>{"use strict" ;var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),i.e(1583).then(i.bind(i,69152)).then(({GannFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 2}name(){return"Gann Fan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,96634))).GannFanDefinitionsViewModel}static createProperties(e){var t=new o("linetoolgannfan",e,!1,{range:[1,9]});return d._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e);for(var t=[],i=[],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=9,t.LineToolGannFan=d},22674:(e,t,i)=>{"use strict";i.d(t,{LineToolGannFixed:()=>l});var s=i(72927),r=i(16282),n=i(76117),o=i(39096),a=i(64166);class l extends n.LineDataSource{constructor(e,t){super(e,t||l.createProperties()),this._constructor="LineToolGannFixed",i.e(1583).then(i.bind(i,47536)).then(({GannFixedPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}),this.properties().childs().reverse.subscribe(this,this._reversePoints)}pointsCount(){return 2}name(){return"Gann Square Fixed"}axisPoints(){const e=this.points(),t=this.getScreenPoints();return e.length<2||t.length<2?[]:[e[0],(0,r.ensureNotNull)(this.screenPointToPoint(t[1]))]}getScreenPoints(){const e=this.points();if(e.length<2)return[];const t=this._calcAngle();if(null===t)return[];const[i,n]=e,o=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),a=(0,r.ensureNotNull)(this.pointToScreenPoint(n)),l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2)),c=new s.Point(Math.cos(t),-Math.sin(t)),h=c.normalized(),d=h.x<0?-1:1,u=h.y<0?-1:1;return[o.addScaled(c,l),o.add(new s.Point(5*l*d,5*l*u))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;se.GannComplexAndFixedDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0&&(o=-o),o}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this.normalizePoints(),this.restart()}}},61004:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(81773),n=i(39096).LineToolColorsProperty,o=[4.5,9,11.25,18,22.5,36,45],a=function(){for(var e=[],t=o.length-1,i=1,s=0,r=0;r<1e10;)r=o[s]*i,e.push(Math.round(r)),e.push(Math.ceil(-r)),s===t-1&&(i*=10),s=(s+1)%t;return e.sort((function(e,t){return et?1:0})),e}();class l extends s{constructor(e,t){super(e,t||l.createProperties()),i.e(1583).then(i.t.bind(i,71600,19)).then(({GannSquarePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}hLevelsCount(){return l.HLevelsCount}vLevelsCount(){return l.VLevelsCount}pointsCount(){return 2}name(){return"Gann Box"}_alignPriceOnPattern(e,t){var i=Math.round(1e6*(e.price-t.price))/1e6;if(0===i)return t.price;for(var s=o[0],r=o[o.length-1],n=1,a=Math.abs(i);a=0&&!(o[c]*n=0?l:-l),e}_alignTimeOnPattern(e,t){var i=e.index-t.index;if(0===i)return 0;for(var s=a.length-2;s>=0&&!(a[s]0?1:0,e.index=t.index+a[s],e}_alignPointsFixedIncrement(e,t){return this._alignTimeOnPattern(e,t),this._alignPriceOnPattern(e,t),e}_preparePoint(e,t){return t&&t.shift()&&0!==this._points.length&&this._alignPointsFixedIncrement(e,this._points[0]),super._preparePoint(e,t)}getPoint(e){if(e<2)return super.getPoint(e);var t=null;switch(e){case 2:case 3:var i=this.points();if(i.length===this.pointsCount()){var s=i[0].index,r=i[1].price;3===e&&(s=i[1].index,r=i[0].price),t={index:s,price:r}}}return t}setPoint(e,t,i){ if(i&&i.shift()){var s=e%2==0?this._points[1]:this._points[0];this._alignPointsFixedIncrement(t,s)}switch(e){case 2:this._points[0].index=t.index,this._points[1].price=t.price;break;case 3:this._points[1].index=t.index,this._points[0].price=t.price;break;default:super.setPoint(e,t,i)}}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,12101))).GannSquareDefinitionsViewModel}static createProperties(e){var t=new r("linetoolgannsquare",e,!1,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]});return l._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e);for(var t=[e.child("color"),e.child("fans").child("color")],i=1;i<=l.HLevelsCount;i++)t.push(e.child("hlevel"+i).child("color"));for(i=1;i<=l.VLevelsCount;i++)t.push(e.child("vlevel"+i).child("color"));e.addChild("linesColors",new n(t)),e.addExclusion("linesColors")}}l.HLevelsCount=7,l.VLevelsCount=7,t.LineToolGannSquare=l},586:(e,t,i)=>{"use strict";i.d(t,{LineToolGhostFeed:()=>l});var s=i(11092),r=i(76117),n=i(16282),o=i(47903);class a{constructor(e,t,i){this._source=e,this._segmentIndex=t,this._bars=null!=i?i:[]}setBars(e){this._bars=e}clone(e){return new a(e,this._segmentIndex,(0,o.clone)(this._bars))}generate(){this._bars=[];const e=this._source.points(),t=e[this._segmentIndex],i=e[this._segmentIndex+1];if(!t||!i||t.index===i.index)return;const s=this._segmentIndex?t.index+1:t.index,r=Math.sign(i.index-t.index);for(let e=s;e!==i.index;e+=r)this._bars.push(this._createBar())}bars(){return this._bars}setSize(e){if(e{this._setPaneViews([new t.GhostFeedPaneView(this,e)])})}isSynchronizable(){return!1}destroy(){this.properties().onRestoreFactoryDefaults().unsubscribe(this,this._handleRestoringFactoryDefaults),super.destroy()}propertiesChanged(){super.propertiesChanged(), this._currentAverageHL===this.properties().childs().averageHL.value()&&this._currentVariance===this.properties().childs().variance.value()||this._regenerate()}pointsCount(){return-1}name(){return"Ghost Feed"}segmentBars(e){return this._segments[e].bars()}segments(){return this._segments}generateBars(e){this._segments.length<=e&&this._segments.push(new a(this,e)),this._segments[e].generate()}addPoint(e,t,i){if(this._points.length>0){if(this._points[this._points.length-1].index===e.index){this._lastPoint=null,this.normalizePoints(),this.createServerPoints();for(let e=0;e1&&this.generateBars(this._points.length-2),s||this._finished}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}setPoint(e,t,i,s){if(super.setPoint(e,t,i),e>0){const i=this.points()[e-1],s=t.index-i.index;this._segments[e-1].setSize(Math.abs(s))}if(e({bars:[...e.bars()]})),t}restoreData(e){e.segments&&(this._segments=e.segments.map((e,t)=>new a(this,t,e.bars))),this._currentAverageHL=this.properties().childs().averageHL.value(),this._currentVariance=this.properties().childs().variance.value()}onData(e){super.onData(e);if(!this.pointsProperty().childs().points.child("0"))for(let e=0;ee.clone(this))}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._preparePixelSegments()}move(e,t,i,s){super.move(e,t,i,s),this._restoreSegmentsFromPixels()}endMoving(e,t){return this._segmentsPixelsWhileMoving=null,super.endMoving(e,t)}static createProperties(e){const t=new s.DefaultProperty("linetoolghostfeed",e);return l._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,24708))).GhostFeedDefinitionsViewModel}_handleRestoringFactoryDefaults(){const e=Math.round(this._calculateATR());this.properties().childs().averageHL.setValue(e)}_regenerate(){this._currentAverageHL=this.properties().childs().averageHL.value(),this._currentVariance=this.properties().childs().variance.value(),this._segments.forEach(e=>e.generate()),this.updateAllViews(),this._model.updateSource(this)}_calculateATR(){const e=this._model.mainSeries(),t=[];e.bars().each((e,i)=>{const s=i[2],r=i[3];return null!=s&&null!=r&&t.push(s-r),!1});let i=0===t.length?0:t.reduce((e,t)=>e+t,0)/t.length;return i*=e.base(),i}_preparePixelSegments(){var e,t ;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===i||null===s||i.isEmpty()||!i.isLog())return;const r=this.points();this._segmentsPixelsWhileMoving=this._segments.map((e,t)=>{const n=r[t].price,o=r[t+1].price,a=i.priceToCoordinate(n,s),l=(i.priceToCoordinate(o,s)-a)/(e.bars().length-1);return{bars:e.bars().map((e,t)=>{const r=a+t*l,n=i.coordinateToPrice(r,s);return{open:i.priceToCoordinate(n+e.o,s)-r,high:i.priceToCoordinate(n+e.h,s)-r,low:i.priceToCoordinate(n+e.l,s)-r,close:i.priceToCoordinate(n+e.c,s)-r}})}})}_restoreSegmentsFromPixels(){var e,t;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===i||null===s||null===this._segmentsPixelsWhileMoving)return;const r=this.points();this._segmentsPixelsWhileMoving.forEach((e,t)=>{const n=this._segments[t],o=r[t].price,a=r[t+1].price,l=i.priceToCoordinate(o,s),c=(i.priceToCoordinate(a,s)-l)/(e.bars.length-1),h=n.bars().map((t,r)=>{const n=e.bars[r],o=l+r*c,a=i.coordinateToPrice(o,s);return{...t,o:i.coordinateToPrice(n.open+o,s)-a,h:i.coordinateToPrice(n.high+o,s)-a,l:i.coordinateToPrice(n.low+o,s)-a,c:i.coordinateToPrice(n.close+o,s)-a}});n.setBars(h)})}}},56136:(e,t,i)=>{"use strict";i.d(t,{LineToolHeadAndShoulders:()=>o});var s=i(11092),r=i(76117),n=i(39096);class o extends r.LineDataSource{constructor(e,t){const s=t||o.createProperties();super(e,s),i.e(1583).then(i.bind(i,95071)).then(t=>{this._setPaneViews([new t.LineToolHeadAndShouldersPaneView(this,e)])})}pointsCount(){return 7}name(){return"Head and Shoulders"}static createProperties(e){const t=new s.DefaultProperty("linetoolheadandshoulders",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,84377)).then(e=>e.PatternWithBackgroundDefinitionViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor]))}}},64696:(e,t,i)=>{"use strict";i.d(t,{LineToolHighlighter:()=>n});var s=i(11092),r=i(47324);class n extends r.LineToolBrushBase{constructor(e,t){super(e,t||n.createProperties()),this._loadPaneViews(e)}smooth(){return this.properties().childs().smooth.value()}name(){return"Highlighter"}static createProperties(e){const t=new s.DefaultProperty("linetoolhighlighter",e);return n._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,53856)).then(e=>e.HighlighterDefinitionsViewModel)}_loadPaneViews(e){i.e(1583).then(i.bind(i,68724)).then(t=>{this._setPaneViews([new t.HighlighterPaneView(this,e)])})}static _configureProperties(e){r.LineToolBrushBase._configureProperties(e)}}},58292:(e,t,i)=>{"use strict";i.d(t,{LineToolHorzLinePriceAxisView:()=>r});var s=i(95426);class r extends s.PriceAxisView{constructor(e){super(), this._source=e}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.points(),r=this._source.priceScale();if(0===s.length||null===r||r.isEmpty())return;const n=s[0];if(!isFinite(n.price))return;const o=this._source.ownerSource(),a=null!==o?o.firstValue():null;if(null===a)return;const l=this._source.properties().linecolor.value();i.background=l,i.textColor=this.generateTextColor(l),i.coordinate=r.priceToCoordinate(n.price,a),e.text=r.formatPrice(n.price,a),e.visible=!0}}},13193:(e,t,i)=>{"use strict";i.d(t,{LineToolHorzLine:()=>l});var s=i(674),r=i.n(s),n=i(11092),o=i(76117),a=i(58292);class l extends o.LineDataSource{constructor(e,t){super(e,t||l.createProperties()),this._priceAxisView=new a.LineToolHorzLinePriceAxisView(this),i.e(1583).then(i.bind(i,98827)).then(({HorzLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}state(e){const t=super.state(e);return t.points&&0!==t.points.length&&(t.points[0].offset=0),t}pointsCount(){return 1}name(){return"Horizontal Line"}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||!this._model.selection().isSelected(this)&&!this.properties().childs().showPrice.value()||e!==this._model.paneForSource(this)?null:[this._priceAxisView]}timeAxisViews(){return null}timeAxisPoints(){return[]}updateAllViews(){super.updateAllViews(),this._priceAxisView.update()}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}denormalizeTimePoints(){this._points=[],this._timePoint.length>0&&this._points.push({price:this._timePoint[0].price,index:0})}clearData(){const e=this._points;super.clearData(),this._points=e}static createProperties(e){const t=new n.DefaultProperty("linetoolhorzline",e);return l._configureProperties(t),t}_getAlertPlots(){return[this.points()[0].price]}_pointsForPointset(){return[]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,41847)).then(e=>e.HorizontalLineDefinitionsViewModel)}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){o.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(r())("")),e.addExclusion("text")}}},98416:(e,t,i)=>{"use strict";i.d(t,{LineToolHorzRay:()=>l});var s=i(11092),r=i(674),n=i.n(r),o=i(58292),a=i(76117);class l extends a.LineDataSource{constructor(e,t){super(e,null!=t?t:l.createProperties()),this._priceAxisView=new o.LineToolHorzLinePriceAxisView(this),i.e(1583).then(i.bind(i,71250)).then(({HorzRayPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 1}name(){return"Horizontal Ray"}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||!this._model.selection().isSelected(this)&&!this.properties().childs().showPrice.value()||e!==this._model.paneForSource(this)?null:[this._priceAxisView]}updateAllViews(){super.updateAllViews(),this._priceAxisView.update()}template(){const e=super.template() ;return e.text=this.properties().childs().text.value(),e}canHasAlert(){return!0}static createProperties(e){const t=new s.DefaultProperty("linetoolhorzray",e);return l._configureProperties(t),t}_getAlertPlots(){const e=this._points[0],t={index:e.index+1,price:e.price};return[this._linePointsToAlertPlot([e,t],null,!1,!0)]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,78564))).HorizontalRayDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(n())("")),e.addExclusion("text")}}},73023:(e,t,i)=>{"use strict";i.d(t,{LineToolIcon:()=>a});var s=i(16282),r=i(11092),n=i(76117),o=i(39096);class a extends n.LineDataSource{constructor(e,t){super(e,t||a.createProperties()),this._sizeScale=NaN,this.version=1,document.fonts&&document.fonts.check&&document.fonts.load&&!document.fonts.check("12px FontAwesome")&&document.fonts.load("12px FontAwesome","☺").then(()=>{this._isDestroyed||e.updateSource(this)}),i.e(1583).then(i.bind(i,63245)).then(t=>{this._setPaneViews([new t.IconPaneView(this,e)])})}pointsCount(){return 1}name(){return"Icon"}hasEditableCoordinates(){return!1}getAnchorLimit(){return 80}applyTemplate(e){delete e.icon,super.applyTemplate(e)}startChanging(e,t){super.startChanging(e,t);const i=this.properties().childs();i.size.value()<80?this._sizeScale=i.size.value()/80:this._sizeScale=1}getChangePointForSync(e){return null}setPoint(e,t,i){const r=Object.assign({},t),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),o=(0,s.ensureNotNull)(this.pointToScreenPoint(r)),a=this.properties().childs();if(0===e||1===e){const t=o.subtract(n).normalized(),i=-t.x;let s=Math.acos(i);Math.asin(t.y)>0&&(s=2*Math.PI-s),0===e&&(s+=Math.PI),a.angle.setValue(s)}else{let e=2*o.subtract(n).length();e*=this._sizeScale,a.size.setValue(e),a.scale.setValue(1)}}endChanging(e,t){const i=super.endChanging(e,t);return this._sizeScale=NaN,i}getSourceIcon(){return{type:"text",text:String.fromCharCode(this.properties().childs().icon.value())}}static createProperties(e){const t=new r.DefaultProperty("linetoolicon",e);return a._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,93619)).then(e=>e.IconsDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().color])),e.addExclusion("angle"),e.addExclusion("scale")}}},18716:(e,t,i)=>{"use strict";i.d(t,{LineToolInfoLine:()=>n});var s=i(11092),r=i(12565);class n extends r.LineToolTrendLine{constructor(e,t){super(e,t||n.createProperties())}pointsCount(){return 2}name(){return"Info Line"}static createProperties(e){const t=new s.DefaultProperty("linetoolinfoline",e);return n._configureProperties(t),t}static _configureProperties(e){ r.LineToolTrendLine._configureProperties(e)}}},18898:(e,t,i)=>{"use strict";var s=i(81773),r=i(70799).LineToolPitchfork;class n extends r{constructor(e,t){super(e,t||n.createProperties())}name(){return"Inside Pitchfork"}static createProperties(e){var t=new s("linetoolinsidepitchfork",e,!1,{range:[0,8]});return n._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e)}}t.LineToolInsidePitchfork=n},33033:(e,t,i)=>{"use strict";var s;i.d(t,{isStudyLineToolName:()=>n,isLineToolName:()=>o,isLineDrawnWithPressedButton:()=>a,isLineToolDrawWithoutPoints:()=>l,isTextToolName:()=>c});var r=i(8902);new Set([]);function n(e){return"LineToolRegressionTrend"===e||"LineToolVbPFixed"===e||"LineToolFixedRangeVolumeProfile"===e}function o(e){return e in(s||(s=i.t(r,2)))||n(e)}function a(e){return"LineToolBrush"===e||"LineToolHighlighter"===e}function l(e){return"LineToolTweet"===e||"LineToolIdea"===e}function c(e){switch(e){case"LineToolBalloon":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":case"LineToolSignpost":return!0}return!1}},17277:(e,t,i)=>{"use strict";i.d(t,{LineDataSourceBase:()=>k});var s=i(72927),r=i(16282),n=i(18437),o=i(65447),a=i(46015),l=i(15521),c=i(5729),h=i.n(c),d=i(674),u=i.n(d),p=i(39096);class _ extends(u()){constructor(e,t){super(),this._lineSource=e,this._pointIndex=t,e.pointAdded().subscribe(this,e=>{this._pointIndex===e&&this._listeners.fire(this)}),e.pointChanged().subscribe(this,e=>{this._pointIndex===e&&this._listeners.fire(this)})}value(){const e=this._lineSource.points()[this._pointIndex].price,t=(0,r.ensureNotNull)(this._lineSource.ownerSource()).formatter();if(t.parse){const i=t.format(e),s=t.parse(i);return s.res?s.value:e}return e}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(""+e),this._lineSource.startChanging(this._pointIndex,t),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this);const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)}}var m=i(54388),g=i(35001),f=i(85545),v=i(92898),S=i(25436),y=i(32856),b=i.n(y),w=i(47329),P=i(1467),C=i(89537),T=i(25220),x=i(81694),I=i(47903);const M=(0,o.getLogger)("Chart.LineDataSource");class L{constructor(){this._states=[]}start(e){this._states.push(e)}finish(e){const t=(0,r.ensureDefined)(this._states.pop());return s=t,(i=e).length!==s.length?{indexesChanged:!0,pricesChanged:!0}:i.reduce((e,t,i)=>{const r=s[i];return e.indexesChanged=e.indexesChanged||t.index!==r.index,e.pricesChanged=e.pricesChanged||t.price!==r.price,e},{indexesChanged:!1,pricesChanged:!1});var i,s}isEmpty(){return 0===this._states.length}}let A=0;class k extends a.DataSource{constructor(e,t){super(),this.version=1,this.customization={forcePriceAxisLabel:!1,disableErasing:!1,disableSave:!1,showInObjectsTree:!0},this._currentPointsetId=null,this._pointChanged=new(h()),this._pointAdded=new(h()),this._alertUndoMode=!1,this._priceAxisViews=[], this._timeAxisViews=[],this._timePoint=[],this._points=[],this._lastPoint=null,this._paneViews=new Map,this._normalizedPointsChanged=new(h()),this._fixedPointsChanged=new(h()),this._changeStatesStack=new L,this._startMovingPoint=null,this._currentMovingPoint=null,this._fixedPoints=[],this._isActualSymbol=!1,this._isActualInterval=!1,this._isActualCurrency=!1,this._isActualUnit=!1,this._sharingMode=new(b())("not-shared"),this._onTemplateApplying=new(h()),this._onTemplateApplied=new(h()),this._syncStateExclusions=[],this._syncLineStyleMuted=!1,this._onIsActualIntervalChange=new(h()),this._linkKey=new(b())(null),this._serverUpdateTime=null,this._model=e,this._properties=t,this._localAndServerAlertsMismatch=!1,e.mainSeries().symbolResolved().subscribe(this,this._onMainSeriesSymbolResolved)}destroy(){this._paneViews.forEach((e,t)=>this._destroyPanePaneViews(t)),this._model.mainSeries().symbolResolved().unsubscribeAll(this)}linkKey(){return this._linkKey}serverUpdateTime(){return this._serverUpdateTime}setServerUpdateTime(e){this._serverUpdateTime=e}boundToSymbol(){return!0}points(){const e=[];for(let t=0;t0&&(this._points=e)}restorePoints(e,t,i){const s=this._timePoint.length>0&&!(0,I.deepEquals)(this._timePoint,e)[0];this._timePoint=(0,f.deepCopy)(e),this._points=t,i||this.denormalizeTimePoints(),s&&this._normalizedPointsChanged.fire()}restorePositionPercents(e){this._positionPercents=e}calcIsActualSymbol(){if(this._model.mainSeries().hasDelayedSymbolIntervalChange())return;const e=this.ownerSource();if(null===e)this._isActualSymbol=!1;else{const t=(0,r.ensureNotNull)(e.symbolSource());this._migrateSymbolProperty();const i=this._properties.childs().symbol,s=i.value();if(this._isActualSymbol=t.symbolSameAsCurrent(s),this._isActualSymbol){const e=t.symbol();(0, v.areEqualSymbols)(s,e)||(M.logWarn('Possible drawing "migrating" detected from "'+s+'" to "'+e+'"'),M.logWarn("Series symbolInfo: "+JSON.stringify(t.symbolInfo())),M.logWarn(""+(new Error).stack)),i.setValue(e)}}this.calcIsActualInterval(),this.calcIsActualCurrency(),this.calcIsActualUnit(),this._onSourceHiddenMayChange()}calcIsActualCurrency(){const e=this.ownerSource();if(null===e)return void(this._isActualCurrency=!1);const t=this._properties.childs().currencyId.value();if(null!==t){const i=e.symbolSource();if(null===i)return;this._isActualCurrency=t===(0,S.symbolCurrency)(i.symbolInfo(),void 0,!0)}else{const t=(0,r.ensureNotNull)(e.symbolSource()).symbolInfo();this._isActualCurrency=null!==t&&(0,S.symbolCurrency)(t)===(0,S.symbolOriginalCurrency)(t)}this._onSourceHiddenMayChange()}calcIsActualUnit(){const e=this.ownerSource();if(null===e)return void(this._isActualUnit=!1);const t=this._properties.childs().unitId.value();if(null!==t)this._isActualUnit=t===(0,r.ensureNotNull)(e.symbolSource()).unit();else{const t=(0,r.ensureNotNull)(e.symbolSource()).symbolInfo();this._isActualUnit=null!==t&&(0,S.symbolUnit)(t)===(0,S.symbolOriginalUnit)(t)}this._onSourceHiddenMayChange()}calcIsActualInterval(){const e=this._isActualInterval,t=this._properties,i=this._model.mainSeries();this._isActualInterval=(0,C.isActualInterval)(g.Interval.parse(i.interval()),t.childs().intervalsVisibilities),!this._isActualInterval&&this._model.selection().isSelected(this)&&this._model.selectionMacro(e=>e.removeSourceFromSelection(this)),this._isActualInterval!==e&&this._onIsActualIntervalChange.fire(),this._onSourceHiddenMayChange()}paneViews(e){if(this.isSourceHidden())return null;const t=this._getPaneViews(this.isMultiPaneAvailable()?e:void 0);if(null===t)return null;if(1===t.length)return[t[0]];const i=[];for(let e=t.length-1;e>=0;--e)i.push(t[e]);return i}isSavedInChart(){return!this.customization.disableSave}setSavingInChartEnabled(e){this.customization.disableSave=!e}detachAlert(){const e=this.getAlertSync();if(e&&this._alertCallbacks){const t=this._alertCallbacks;e.off("destroy",t.remove),e.off("change:hovered",t.hovered),e.off("change:selected",t.selected)}this.hasAlert.setValue(!1),this._alertId=void 0}removeAlert(){this._alertId=void 0,this.hasAlert.setValue(!1)}deleteAlert(){0}areLocalAndServerAlertsMismatch(){return this._localAndServerAlertsMismatch}showInObjectTree(){return this.customization.showInObjectsTree}setShowInObjectsTreeEnabled(e){this.customization.showInObjectsTree=e}start(){this.createServerPoints()}onData(e){"pointset_error"!==e.method?e.params.customId===this._currentPointsetIdWithPrefix()&&this._onPointsetUpdated(e.params.plots):M.logError(`Error getting pointset: ${e.params[0]} ${e.params[1]}`)}isActualSymbol(){return this._isActualSymbol}isActualCurrency(){return this._isActualCurrency}isActualInterval(){return this._isActualInterval}isActualUnit(){return this._isActualUnit}onIsActualIntervalChange(){return this._onIsActualIntervalChange}setOwnerSource(e){ null!==this._ownerSource&&(this._ownerSource.currencyChanged().unsubscribeAll(this),this._ownerSource.unitChanged().unsubscribeAll(this)),super.setOwnerSource(e),e&&(this.setPriceScale(e.priceScale()),e.currencyChanged().subscribe(this,this.calcIsActualCurrency),e.unitChanged().subscribe(this,this.calcIsActualUnit),this.calcIsActualSymbol(),this._migrateZOrder())}dataAndViewsReady(){return this._paneViews.size>0}pointAdded(){return this._pointAdded}pointChanged(){return this._pointChanged}pointToScreenPoint(e){var t;const i=this._model.timeScale(),r=this.priceScale(),n=null===(t=this.ownerSource())||void 0===t?void 0:t.firstValue();if(!r||r.isEmpty()||i.isEmpty()||null==n)return null;const o=i.indexToCoordinate(e.index),a=r.priceToCoordinate(e.price,n);return new s.Point(o,a)}screenPointToPoint(e){var t;const i=this.priceScale(),s=null===(t=this.ownerSource())||void 0===t?void 0:t.firstValue();if(null==s||!isFinite(s)||null===i)return null;const r=this._model.timeScale().coordinateToIndex(e.x);return{price:i.coordinateToPrice(e.y,s),index:r}}addPoint(e,t,i){const s=this._preparePoint(e,t);return this._addPointIntenal(s,t,i)}propertiesChanged(e){this.calcIsActualInterval(),this.updateAllViewsAndRedraw(),e||this._syncLineStyleIfNeeded()}state(e){var t,i;const s={type:this.toolname,id:this.id(),state:this.properties().state(null!==(t=this._propertiesStateExclusions())&&void 0!==t?t:void 0),points:(0,f.deepCopy)(this._timePoint),zorder:this.zorder(),ownerSource:null===(i=this.ownerSource())||void 0===i?void 0:i.id()};return this.linkKey().value()&&(s.linkKey=this.linkKey().value()),delete s.state.points,e&&(s.indexes=this._points),this.isFixed()&&(s.positionPercents=this._positionPercents||this.calcPositionPercents()),"version"in this&&1!==this.version&&(s.version=this.version),this._saveAlertIdInState()&&this.hasAlert.value()&&void 0!==this._alertId&&(s.alertId=this._alertId.toString()),s}updateAllViewsAndRedraw(){this.updateAllViews(),this._model.updateSource(this)}properties(){return this._properties}restoreExternalPoints(e,t){if(this._timePoint=(0,f.deepCopy)(e.points),t.indexesChanged){if(this.properties().childs().interval.setValue(e.interval),!this.isActualSymbol())return this._clearServerPoints(),void this._normalizedPointsChanged.fire();this.createServerPoints()}else{const t=Math.min(this._points.length,e.points.length);for(let i=0;i0&&this.normalizePoints(),!this._readyToCreatePointset())return;const e=this._pointsForPointset();if(0===e.length)return;this._currentPointsetId=++A;const t=(0,r.ensureNotNull)(this._model.mainSeries().seriesSource().symbolInstanceId()),i=(0,P.getServerInterval)(this.properties().childs().interval.value());this._model.chartApi().createPointset(this._currentPointsetIdWithPrefix(),"turnaround",t,i,e,this.onData.bind(this))}finish(){}tryCreateServerPoints(){this.isFixed()||this.isSourceHidden()||null===this._currentPointsetId&&this.createServerPoints()}stop(){this._clearServerPoints()}restart(){this.isFixed()||(this._currentPointsetId=null,this.createServerPoints())}isStarted(){return null!==this._currentPointsetId}convertYCoordinateToPriceForMoving(e,t){var i;const s=(0,r.ensureNotNull)(this.priceScale());if(s.isEmpty())return null;const n=this.ownerSource(),o=(0,r.ensure)(null===(i=n||t)||void 0===i?void 0:i.firstValue());return s.coordinateToPrice(e,o)}syncMultichartState(e){const t={points:this._timePoint,interval:this._model.mainSeries().interval()},i=this.linkKey().value();if(null!==i&&this.isSynchronizable()){const s={model:this._model,linkKey:i,symbol:this._model.mainSeries().symbol(),finalState:t,changes:e};(0,l.finishChangingLineTool)(s)}}enableCurrentIntervalVisibility(){const e=this.properties().childs().intervalsVisibilities.state();void 0!==e&&((0,C.makeIntervalsVisibilitiesVisibleAtInterval)(e,g.Interval.parse(this._model.mainSeries().interval())),this.properties().childs().intervalsVisibilities.mergeAndFire(e))}clonePositionOffset(){return this.isFixed()?{barOffset:0,xCoordOffset:20,yCoordOffset:20}:{barOffset:0,xCoordOffset:0,yCoordOffset:-40}}sharingMode(){return this._sharingMode}share(e){this._sharingMode.setValue(e)}syncLineStyleState(){const e=this.properties().state(this._syncStateExclusions);return delete e.interval,e.intervalsVisibilities=(0,C.mergeIntervalVisibilitiesDefaults)(e.intervalsVisibilities),e}_correctLastPoint(e){return(0,I.clone)(e)}_pointsForPointset(){return this._timePoint.map(e=>[e.time_t,e.offset])}_snapPoint45Degree(e,t,i){const s=this._model.timeScale(),n=s.indexToCoordinate(t.index),o=s.indexToCoordinate(e.index)-n,a=(0,r.ensureNotNull)(this.priceScale()),l=t.price,c=e.price,h=(0,r.ensureNotNull)((0,r.ensureNotNull)(this.ownerSource()).firstValue()),d=a.priceToCoordinate(l,h),u=a.priceToCoordinate(c,h)-d,p=Math.round(Math.atan2(o,u)/Math.PI*4);if(2===Math.abs(p))i||(e.price=l);else if(0===Math.abs(p)||4===Math.abs(p))i||(e.index=t.index);else{const t=Math.sqrt(o*o+u*u),i=o<0?-1:1,r=u<0?-1:1;let l=Math.max(Math.abs(u),Math.abs(o));l/=l*Math.sqrt(2)/t;const c=Math.round(s.coordinateToIndex(n+l*i)),p=Math.abs(s.indexToCoordinate(c)-n),_=a.coordinateToPrice(d+p*r,h);e.index=c,e.price=_}}normalizePoint(e){return{...this._model.timeScale().normalizeBarIndex(e.index), price:e.price}}normalizePoints(){this._timePoint=[];for(let e=0;ethis._destroyPanePaneViews(t)),this._model.lightUpdate()}_getPaneViews(e){return this._paneViews.get(e)||null}_updateAllPaneViews(){this._paneViews.forEach(e=>{for(const t of e)t.update()})}_alignPointHorizontallyOrVertically(e){const t=(0,r.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,r.ensureDefined)((0,r.ensureNotNull)(this._startMovingPoint).logical),s=(0,r.ensureDefined)((0,r.ensureNotNull)(this._startMovingPoint).screen),n=Math.abs(s.x-t.x),o=Math.abs(s.y-t.y);if(n<10&&o<10)return e;return{index:n=1){for(let t=0;t=2&&this._snapTo45DegreesAvailable()&&this._snapPoint45Degree(i,this.points()[this.points().length-2]),i}_addPointIntenal(e,t,i){this._points.push(e);const s=this._points.length===this.pointsCount();return s?(this._lastPoint=null,i||(this.normalizePoints(),this.createServerPoints())):this._lastPoint=e,this._pointAdded.fire(this._points.length-1),s}_onSourceHiddenMayChange(){this._model.invalidate(w.InvalidationMask.validateAction(()=>{this._isDestroyed||this._processHibernate()}))}_processHibernate(){this.isSourceHidden()?this.isStarted()&&this.stop():this.isStarted()||this.start()}_saveAlertIdInState(){return!0}_onPointsetUpdated(e){if(0===e.length)return;for(let t=0;t0}_onAlertData(e){}_propertiesStateExclusions(){return null}_syncLineStyleIfNeeded(){const e=this.linkKey().value();!this._syncLineStyleMuted&&e&&(0,l.changeLineStyle)({linkKey:e,state:this.syncLineStyleState(),model:this._model})}_muteSyncLineStyle(){this._syncLineStyleMuted=!0}_unmuteSyncLineStyleWithoutApplyingChanges(){this.propertiesChanged(),this._syncLineStyleMuted=!1}_applyTemplateImpl(e){e.intervalsVisibilities=(0,C.mergeIntervalVisibilitiesDefaults)(e.intervalsVisibilities);const t=this.properties();t.mergePreferences(e),t.saveDefaults(),this.propertiesChanged()}static _configureProperties(e){if(k._addCollectedProperties(e),e.hasChild("symbolStateVersion")||e.addChild("symbolStateVersion",new(u())(k._initialSymbolStateVersion())),e.hasChild("zOrderVersion")||e.addChild("zOrderVersion",new(u())(k._initialZOrderVersion())),e.hasChild("visible")||e.addChild("visible",new(u())(!0)),e.hasChild("frozen")||e.addChild("frozen",new(u())(!1)),e.hasChild("symbol")||e.addChild("symbol",new(u())("")),e.hasChild("currencyId")||e.addChild("currencyId",new(u())(null)),e.hasChild("unitId")||e.addChild("unitId",new(u())(null)),e.addExclusion("symbolStateVersion"),e.addExclusion("zOrderVersion"),e.addExclusion("visible"),e.addExclusion("frozen"),e.addExclusion("symbol"),e.addExclusion("currencyId"),e.addExclusion("unitId"), e.hasChild("intervalsVisibilities")){const t=(0,I.merge)((0,I.clone)(T.intervalsVisibilitiesDefaults),e.childs().intervalsVisibilities.state());e.removeProperty("intervalsVisibilities"),e.addChild("intervalsVisibilities",new x.IntervalsVisibilitiesProperty(t))}else e.addChild("intervalsVisibilities",new x.IntervalsVisibilitiesProperty(T.intervalsVisibilitiesDefaults));e.hasChild("title")||e.addChild("title",new(u())("")),e.addExclusion("symbolInfo"),e.addExclusion("points"),e.addExclusion("interval"),e.addExclusion("title"),e.hasChild("singleChartOnly")&&e.removeProperty("singleChartOnly"),e.hasChild("font")&&e.removeProperty("font")}static _addCollectedProperties(e){e.hasChild("linewidth")&&e.addChild("linesWidths",new p.LineToolWidthsProperty([(0,r.ensureDefined)(e.child("linewidth"))])),e.hasChild("linecolor")&&e.addChild("linesColors",new p.LineToolColorsProperty([(0,r.ensureDefined)(e.child("linecolor"))])),e.hasChild("backgroundColor")&&e.addChild("backgroundsColors",new p.LineToolColorsProperty([(0,r.ensureDefined)(e.child("backgroundColor"))])),e.hasChild("textColor")&&e.addChild("textsColors",new p.LineToolColorsProperty([(0,r.ensureDefined)(e.child("textColor"))])),e.addExclusion("linesWidths"),e.addExclusion("linesColors"),e.addExclusion("backgroundsColors"),e.addExclusion("textsColors")}static _initialSymbolStateVersion(){return 1}static _initialZOrderVersion(){return 1}_destroyPanePaneViews(e){const t=this._paneViews.get(e);if(void 0!==t)for(const e of t)e.destroy&&e.destroy();void 0!==e&&e.onDestroyed().unsubscribeAll(this),this._paneViews.delete(e)}_copyPricesWithoutNormalization(){const e=Math.min(this._points.length,this._timePoint.length);for(let t=0;t{"use strict";i.d(t,{LineDataSourcePointIndexProperty:()=>n});var s=i(674),r=i.n(s);class n extends(r()){constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){return this._lineSource.points()[this._pointIndex].index}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.index=e,this._lineSource.startChanging(this._pointIndex,t),this._setPointImpl(t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this);const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)}_setPointImpl(e){this._lineSource.setPoint(this._pointIndex,e)}}},10100:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceAxisView:()=>n});var s=i(16282),r=i(95426);class n extends r.PriceAxisView{constructor(e,t){super(),this._active=!1,this._source=e,this._data=t,this._properties=e.model().properties().childs().scalesProperties}setActive(e){this._active=e}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.model();if(!s.timeScale()||s.timeScale().isEmpty())return;const r=this._source.priceScale();if(null===r||r.isEmpty())return;if(!s.selection().isSelected(this._source)&&!this._source.isForcedDrawPriceAxisLabel())return;if(null===s.timeScale().visibleBarsStrictRange())return;const n=this._source.priceAxisPoints(),o=this._data.pointIndex ;if(n.length<=o)return;const a=n[o];if(!isFinite(a.price))return;const l=this._source.ownerSource(),c=null!==l?l.firstValue():null;if(null===c)return;let h=this._data.backgroundPropertyGetter?this._data.backgroundPropertyGetter():null;null===h&&(h=this._getBgColor()),i.background=h,i.borderColor="#2E84A6",i.textColor=this.generateTextColor(h),i.coordinate=r.priceToCoordinate(a.price,c),e.text=this._formatPrice(a.price,c),e.visible=!0}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_formatPrice(e,t){return(0,s.ensureNotNull)(this._source.priceScale()).formatPrice(e,t)}}},68845:(e,t,i)=>{"use strict";i.d(t,{LineDataSourceTimeAxisView:()=>r});var s=i(87758);class r extends s.TimeAxisView{constructor(e,t){super(e.model()),this._active=!1,this._source=e,this._pointIndex=t,this._properties=e.model().properties().childs().scalesProperties}setActive(e){this._active=e}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_getIndex(){if(!this._model.selection().isSelected(this._source))return null;const e=this._source.timeAxisPoints();return e.length<=this._pointIndex?null:e[this._pointIndex].index}_isVisible(){return!0}}},76117:(e,t,i)=>{"use strict";var s=i(72927).Point,r=i(10100).LineToolPriceAxisView,n=i(68845).LineDataSourceTimeAxisView,o=i(15521),a=i(35001).Interval,l=i(65447).getLogger("Chart.LineDataSource"),c=i(18437),h=i(674),d=i(27490),u=i(58761).lineToolsLocalizedNames,p=d.enabled("datasource_copypaste"),_=i(17277).LineDataSourceBase;class m extends _{constructor(e,t){super(e,t),this._properties.hasChild("interval")||this._properties.addChild("interval",new h(e.mainSeries().interval())),this.calcIsActualSymbol(),this._properties.intervalsVisibilities.listeners().subscribe(this,m.prototype.calcIsActualSymbol);var i=this;if(this._properties.listeners().subscribe(this,(function(e){i.propertiesChanged()})),this._createPointsProperties(),this.pointsCount()>0)for(var s=0;s=i.multiplier()&&(t=e.key)})),t}priceScale(){return this._ownerSource?this._ownerSource.m_priceScale:null}symbol(){ return this._properties.symbol.value()}isSavedInStudyTemplates(){return!1}fixedPoints(){var e=[];if(this._positionPercents&&!this.priceScale().isEmpty())for(var t=0;t{"use strict";i.r(t),i.d(t,{LineToolMultiplePropertyBaseImpl:()=>l,LineToolCollectedProperty:()=>c,LineToolWidthsProperty:()=>h,LineToolColorsProperty:()=>d,MultipleLineWidthsProperty:()=>p,MultipleLineColorsProperty:()=>_});var s=i(65447),r=i(5729),n=i.n(r);const o=(0,s.getLogger)("Chart.LineToolCollectedProperty");class a{applyValue(e,t){e.setValue(t)}}class l{constructor(e,t){this._onChange=new(n()),this._properties=e,e.forEach(e=>e.subscribe(this,()=>{this._onChange.fire(this)})),this._showIfProperty=t}visible(){var e;return!this._showIfProperty||(null===(e=this._showIfProperty)||void 0===e?void 0:e.value())}value(){if(0===this._properties.length)return o.logError("Incorrect call, should not request value of 0 properties"),"mixed";const e=this._properties[0].value();return 1===this._properties.length||this._properties.every(t=>t.value()===e)?e:"mixed"}state(){}merge(){}destroy(){this._properties.forEach(e=>e.unsubscribeAll(this))}subscribe(e,t){this._onChange.subscribe(e,t)}unsubscribe(e,t){this._onChange.unsubscribe(e,t)}unsubscribeAll(e){this._onChange.unsubscribeAll(e)}storeStateIfUndefined(){return!0}}class c extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach(t=>s.applyValue(t,e))}}class h extends c{}class d extends c{firstColor(){return this._properties[0].value()}}class u extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach(t=>t.setValue(e,void 0,s))}}class p extends u{}class _ extends u{}},8902:(e,t,i)=>{"use strict";t.LineToolFibRetracement=i(88376).LineToolFibRetracement,t.LineToolFibChannel=i(40861).LineToolFibChannel,t.LineToolFibSpeedResistanceArcs=i(77268).LineToolFibSpeedResistanceArcs,t.LineToolProjection=i(79300).LineToolProjection,t.LineToolTrendBasedFibExtension=i(13768).LineToolTrendBasedFibExtension,t.LineToolElliott=i(74168).LineToolElliott,t.LineToolFibCircles=i(90763).LineToolFibCircles,t.LineToolVertLine=i(60880).LineToolVertLine,t.LineToolCrossLine=i(56702).LineToolCrossLine,t.LineToolBarsPattern=i(21827).LineToolBarsPattern,t.LineToolTrendBasedFibTime=i(97835).LineToolTrendBasedFibTime,t.LineToolFibTimeZone=i(26452).LineToolFibTimeZone,t.LineToolCircleLines=i(96007).LineToolCircleLines,t.LineToolDateRange=i(65833).LineToolDateRange, t.LineToolPriceRange=i(40630).LineToolPriceRange,t.LineToolDateAndPriceRange=i(97867).LineToolDateAndPriceRange,t.LineToolParallelChannel=i(16898).LineToolParallelChannel,t.LineToolTrendAngle=i(16039).LineToolTrendAngle,t.LineToolTrendLine=i(12565).LineToolTrendLine,t.LineToolInfoLine=i(18716).LineToolInfoLine,t.LineToolArrowMark=i(35320).LineToolArrowMark,t.LineToolExecution=i(22769).LineToolExecution,t.LineToolPitchfan=i(69316).LineToolPitchfan,t.LineToolGannSquare=i(61004).LineToolGannSquare,t.LineToolFibSpeedResistanceFan=i(19832).LineToolFibSpeedResistanceFan,t.LineToolGannComplex=i(76112).LineToolGannComplex,t.LineToolGannFixed=i(22674).LineToolGannFixed,t.LineToolGannFan=i(92803).LineToolGannFan,t.LineToolFibWedge=i(64794).LineToolFibWedge,t.LineToolPitchfork=i(70799).LineToolPitchfork,t.LineToolDisjointAngle=i(2683).LineToolDisjointChannel,t.LineToolFlatBottom=i(63343).LineToolFlatBottom,t.LineToolIcon=i(73023).LineToolIcon,t.LineToolRotatedRectangle=i(96312).LineToolRotatedRectangle,t.LineToolFibSpiral=i(34067).LineToolFibSpiral,t.LineToolHeadAndShoulders=i(56136).LineToolHeadAndShoulders,t.LineToolTriangle=i(48650).LineToolTriangle,t.LineToolTrianglePattern=i(89938).LineToolTrianglePattern,t.LineTool5PointsPattern=i(98127).LineTool5PointsPattern,t.LineToolThreeDrivers=i(69066).LineToolThreeDrivers,t.LineToolABCD=i(95026).LineToolABCD,t.LineToolPolyline=i(78218).LineToolPolyline,t.LineToolPath=i(92469).LineToolPath,t.LineToolPrediction=i(81290).LineToolPrediction,t.LineToolPriceLabel=i(67128).LineToolPriceLabel,t.LineToolArrowMarker=i(76292).LineToolArrowMarker,t.LineToolNote=i(71166).LineToolNote,t.LineToolNoteAbsolute=i(71166).LineToolNoteAbsolute,t.LineToolSignpost=i(6789).LineToolSignpost,t.LineToolBrush=i(66842).LineToolBrush,t.LineToolArc=i(93750).LineToolArc,t.LineToolCallout=i(20766).LineToolCallout,t.LineToolBalloon=i(25830).LineToolBalloon,t.LineToolText=i(60598).LineToolText,t.LineToolHorzLine=i(13193).LineToolHorzLine,t.LineToolHorzRay=i(98416).LineToolHorzRay,t.LineToolRectangle=i(46297).LineToolRectangle,t.LineToolCircle=i(77198).LineToolCircle,t.LineToolEllipse=i(56686).LineToolEllipse,t.LineToolTimeCycles=i(56290).LineToolTimeCycles,t.LineToolSineLine=i(39447).LineToolSineLine,t.LineToolGhostFeed=i(586).LineToolGhostFeed,t.LineToolBezierQuadro=i(6016).LineToolBezierQuadro,t.LineToolBezierCubic=i(59376).LineToolBezierCubic,t.LineToolArrow=i(26478).LineToolArrow,t.LineToolRay=i(98684).LineToolRay,t.LineToolExtended=i(66163).LineToolExtended,t.LineToolSchiffPitchfork=i(78124).LineToolSchiffPitchfork,t.LineToolSchiffPitchfork2=i(14444).LineToolSchiffPitchfork2,t.LineToolInsidePitchfork=i(18898).LineToolInsidePitchfork,t.LineToolTextAbsolute=i(60598).LineToolTextAbsolute,t.LineToolArrowMarkLeft=i(35320).LineToolArrowMarkLeft,t.LineToolArrowMarkRight=i(35320).LineToolArrowMarkRight,t.LineToolArrowMarkUp=i(35320).LineToolArrowMarkUp,t.LineToolArrowMarkDown=i(35320).LineToolArrowMarkDown,t.LineToolFlagMark=i(59954).LineToolFlagMark,t.LineToolCypherPattern=i(3913).LineToolCypherPattern, t.LineToolElliottImpulse=i(74168).LineToolElliottImpulse,t.LineToolElliottTriangle=i(74168).LineToolElliottTriangle,t.LineToolElliottTripleCombo=i(74168).LineToolElliottTripleCombo,t.LineToolElliottCorrection=i(74168).LineToolElliottCorrection,t.LineToolElliottDoubleCombo=i(74168).LineToolElliottDoubleCombo,t.LineToolRiskRewardLong=i(74021).LineToolRiskRewardLong,t.LineToolRiskRewardShort=i(74021).LineToolRiskRewardShort,t.LineToolPosition=i(97496).LineToolPosition,t.LineToolOrder=i(3873).LineToolOrder,t.LineToolHighlighter=i(64696).LineToolHighlighter,t.LineToolPriceNote=i(80363).LineToolPriceNote},58761:(e,t,i)=>{"use strict";i.d(t,{lineToolsLocalizedNames:()=>n});var s=i(79881),r=i(67869);const n={LineTool5PointsPattern:(0,s.t)("XABCD Pattern"),LineToolABCD:(0,s.t)("ABCD Pattern"),LineToolArc:(0,s.t)("Arc"),LineToolArrow:(0,s.t)("Arrow"),LineToolArrowMarkDown:(0,s.t)("Arrow Mark Down"),LineToolArrowMarkLeft:(0,s.t)("Arrow Mark Left"),LineToolArrowMarkRight:(0,s.t)("Arrow Mark Right"),LineToolArrowMarkUp:(0,s.t)("Arrow Mark Up"),LineToolBalloon:(0,s.t)("Balloon"),LineToolBarsPattern:(0,s.t)("Bars Pattern"),LineToolBezierCubic:(0,s.t)("Double Curve"),LineToolBezierQuadro:(0,s.t)("Curve"),LineToolBrush:(0,s.t)("Brush"),LineToolCallout:(0,s.t)("Callout"),LineToolCircleLines:(0,s.t)("Cyclic Lines"),LineToolCypherPattern:(0,s.t)("Cypher Pattern"),LineToolDateAndPriceRange:(0,s.t)("Date and Price Range"),LineToolDateRange:(0,s.t)("Date Range"),LineToolDisjointAngle:(0,s.t)("Disjoint Channel"),LineToolElliottCorrection:(0,s.t)("Elliott Correction Wave (ABC)"),LineToolElliottDoubleCombo:(0,s.t)("Elliott Double Combo Wave (WXY)"),LineToolElliottImpulse:(0,s.t)("Elliott Impulse Wave (12345)"),LineToolElliottTriangle:(0,s.t)("Elliott Triangle Wave (ABCDE)"),LineToolElliottTripleCombo:(0,s.t)("Elliott Triple Combo Wave (WXYXZ)"),LineToolEllipse:(0,s.t)("Ellipse"),LineToolExtended:(0,s.t)("Extended Line"),LineToolFibChannel:(0,s.t)("Fib Channel"),LineToolFibCircles:(0,s.t)("Fib Circles"),LineToolFibRetracement:(0,s.t)("Fib Retracement"),LineToolFibSpeedResistanceArcs:(0,s.t)("Fib Speed Resistance Arcs"),LineToolFibSpeedResistanceFan:(0,s.t)("Fib Speed Resistance Fan"),LineToolFibSpiral:(0,s.t)("Fib Spiral"),LineToolFibTimeZone:(0,s.t)("Fib Time Zone"),LineToolFibWedge:(0,s.t)("Fib Wedge"),LineToolFlagMark:(0,s.t)("Flag Mark"),LineToolImage:(0,s.t)("Image"),LineToolFlatBottom:(0,s.t)("Flat Top/Bottom"),LineToolAnchoredVWAP:(0,s.t)("Anchored VWAP"),LineToolGannComplex:(0,s.t)("Gann Square"),LineToolGannFixed:(0,s.t)("Gann Square Fixed"),LineToolGannFan:(0,s.t)("Gann Fan"),LineToolGannSquare:(0,s.t)("Gann Box"),LineToolHeadAndShoulders:(0,s.t)("Head and Shoulders"),LineToolHorzLine:(0,s.t)("Horizontal Line"),LineToolHorzRay:(0,s.t)("Horizontal Ray"),LineToolIcon:(0,s.t)("Icon"),LineToolInsidePitchfork:(0,s.t)("Inside Pitchfork"),LineToolNote:(0,s.t)("Note"),LineToolNoteAbsolute:(0,s.t)("Anchored Note"),LineToolSignpost:(0,s.t)("Signpost"),LineToolParallelChannel:(0,s.t)("Parallel Channel"),LineToolPitchfan:(0,s.t)("Pitchfan"), LineToolPitchfork:(0,s.t)("Pitchfork"),LineToolPolyline:(0,s.t)("Polyline"),LineToolPath:(0,s.t)("Path"),LineToolPrediction:(0,s.t)("Forecast"),LineToolPriceLabel:(0,s.t)("Price Label"),LineToolArrowMarker:(0,s.t)("Arrow Marker"),LineToolPriceRange:(0,s.t)("Price Range"),LineToolProjection:(0,s.t)("Projection"),LineToolRay:(0,s.t)("Ray"),LineToolRectangle:(0,s.t)("Rectangle"),LineToolCircle:(0,s.t)("Circle"),LineToolRegressionTrend:(0,s.t)("Regression Trend"),LineToolRiskRewardLong:(0,s.t)("Long Position"),LineToolRiskRewardShort:(0,s.t)("Short Position"),LineToolFixedRangeVolumeProfile:(0,s.t)("Fixed Range Volume Profile"),LineToolRotatedRectangle:(0,s.t)("Rotated Rectangle"),LineToolSchiffPitchfork:(0,s.t)("Modified Schiff Pitchfork"),LineToolSchiffPitchfork2:(0,s.t)("Schiff Pitchfork"),LineToolSineLine:(0,s.t)("Sine Line"),LineToolText:(0,s.t)("Text",{context:"tool"}),LineToolTextAbsolute:(0,s.t)("Anchored Text"),LineToolThreeDrivers:(0,s.t)("Three Drives Pattern"),LineToolTimeCycles:(0,s.t)("Time Cycles"),LineToolTrendAngle:(0,s.t)("Trend Angle"),LineToolTrendBasedFibExtension:(0,s.t)("Trend-Based Fib Extension"),LineToolTrendBasedFibTime:(0,s.t)("Trend-Based Fib Time"),LineToolTrendLine:(0,s.t)("Trend Line"),LineToolInfoLine:(0,s.t)("Info Line"),LineToolTriangle:(0,s.t)("Triangle"),LineToolTrianglePattern:(0,s.t)("Triangle Pattern"),LineToolVertLine:(0,s.t)("Vertical Line"),LineToolCrossLine:(0,s.t)("Cross Line"),LineToolHighlighter:(0,s.t)("Highlighter"),LineToolPriceNote:(0,s.t)("Price Note"),LineToolVbPFixed:(0,s.t)("Volume Profile Fixed Range")};(0,r.isFeatureEnabled)("remove-line-tool-ghost-feed")||(n.LineToolGhostFeed=(0,s.t)("Ghost Feed"))},67945:(e,t,i)=>{"use strict";i.r(t),i.d(t,{cloneLineTool:()=>L,createLineTool:()=>y,createLineToolProperties:()=>w,createStudyLineToolProperties:()=>P,getNewToolProperties:()=>S,isLineDrawnWithPressedButton:()=>p.isLineDrawnWithPressedButton,isLineTool:()=>T,isLineToolName:()=>p.isLineToolName,isStudyLineTool:()=>x,isStudyLineToolName:()=>p.isStudyLineToolName,isTrading:()=>I,lineToolByLinkKey:()=>A,prepareLineToolPropertiesByOwnerSource:()=>b,setNewToolProperties:()=>f,supportsPhantomMode:()=>C,tryFindStudyLineToolNameByStudyId:()=>M,unsetNewToolProperties:()=>v});var s=i(16282),r=i(72927),n=i(17175),o=i(76117),a=i(8902),l=i.t(a,2),c=i(47954),h=i(65528);const d=(0,i(345).studyIdString)("VbPFixed","tv-basicstudies");class u extends h.LineToolVbPFixed{constructor(e,t,i,s){const r=i||e.studyMetaInfoRepository().findByIdSync({type:"java",studyId:d});super(e,t,r,s)}calcIsActualSymbol(){n.StudyLineDataSource.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return d}static createProperties(e){const t=super._createPropertiesFromStudyIdAndState(d,e);return h.LineToolVbPFixed._configureProperties(t),t}}var p=i(33033),_=i(61834);function m(e){for(const t of Object.keys(e))TradingView[t]=e[t]}m(l),m({LineToolRegressionTrend:c.LineToolRegressionTrend, LineToolVbPFixed:h.LineToolVbPFixed,LineToolFixedRangeVolumeProfile:u});let g=null;function f(e,t,i){return null!==g&&g.tool===e&&g.toolData===t||(g={properties:w(e,void 0,i),tool:e,toolData:t}),g.properties}function v(){g=null}function S(e){return null!==g&&g.tool===e?g.properties:null}function y(e,t,i,r,n){let o;if((0,s.assert)((0,p.isLineToolName)(e),"Unknown line tool: "+e),n||i||(i=S(e)||void 0),"LineToolVbPFixed"===e)o=new h.LineToolVbPFixed(t,i,(0,s.ensureDefined)(r),t.mainSeries());else if("LineToolFixedRangeVolumeProfile"===e)o=new u(t,i,(0,s.ensureDefined)(r),t.mainSeries());else if("LineToolRegressionTrend"===e)o=new c.LineToolRegressionTrend(t,i,(0,s.ensureDefined)(r));else{o=new((0,s.ensureDefined)(l[e]))(t,i,n)}return o.toolname=e,v(),o}function b(e,t){const i=(0,s.ensureNotNull)(t.symbolSource());e.childs().symbol.setValue(i.symbol()),e.childs().currencyId.setValue(i.currency()),e.childs().unitId.setValue(i.unit()),e.childs().symbolStateVersion.setValue(2),e.childs().zOrderVersion.setValue(2)}function w(e,t,i){if((0,s.assert)((0,p.isLineToolName)(e),e+" should be name of the line tool"),"LineToolVbPFixed"===e)return h.LineToolVbPFixed.createProperties(t);if("LineToolFixedRangeVolumeProfile"===e)return u.createProperties(t);if("LineToolRegressionTrend"===e)return c.LineToolRegressionTrend.createProperties(t);return(0,s.ensureDefined)(l[e]).createProperties(t)}function P(e,t,i,r,n){if((0,s.assert)((0,p.isStudyLineToolName)(e),e+" should be name of the study line tool"),"LineToolVbPFixed"===e)return h.LineToolVbPFixed.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolFixedRangeVolumeProfile"===e)return u.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolRegressionTrend"===e)return c.LineToolRegressionTrend.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);throw new Error("Property creation is not implemented for study line tool "+e)}function C(e){(0,s.assert)((0,p.isLineToolName)(e),e+" should be name of the line tool");const t=l[e];return void 0!==t&&Boolean(t.supportPhantomMode)}function T(e){return e instanceof o.LineDataSource}function x(e){return e instanceof n.StudyLineDataSource}function I(e){return e instanceof _.LineToolTrading}function M(e){let t=null;return e===c.LineToolRegressionTrend.studyId()?t="LineToolRegressionTrend":e===h.LineToolVbPFixed.studyId()?t="LineToolVbPFixed":e===u.studyId()&&(t="LineToolFixedRangeVolumeProfile"),t}function L(e,t,i,n){const o=t.toolname,a=w(t.toolname,t.properties().state());a.childs().visible.setValue(!0);const l=(0,s.ensureNotNull)(t.ownerSource()),c=y(o,e,a);void 0!==n&&c.setId(n),c.setOwnerSource(l),c.toolname=o;const h=c.clonePositionOffset(),d=t.fixedPoints();(i?d.map(e=>e.add(new r.Point(h.xCoordOffset,h.yCoordOffset))):d).forEach(e=>c.addFixedPoint(e));const u=t.normalizedPoints(),p=i?function(e,t,i){const r=(0,s.ensureNotNull)(t.priceScale()),n=(0,s.ensureNotNull)(t.firstValue());return e.map(e=>{const t=e.price,s=r.priceToCoordinate(t,n)+i.yCoordOffset,o=r.coordinateToPrice(s,n);return{time_t:e.time_t,price:o, offset:e.offset+i.barOffset}})}(u,l,h):u,_=t.points();return c.restorePoints(p,_),c.cloneData&&c.cloneData(t),c.checkAlert&&c.checkAlert(),c}function A(e,t){return e.dataSources().find(e=>T(e)&&e.linkKey().value()===t)||null}},71166:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(76117).LineDataSource,n=i(674),o=i(11092).DefaultProperty;class a extends r{constructor(e,t){super(e,t||a.createProperties()),this.version=a.version,i.e(1583).then(i.bind(i,50093)).then(({NotePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 1}name(){return"Note"}getTooltipWidth(){return a.TOOLTIP_WIDTH}getTooltipPadding(){return a.TOOLTIP_PADDING}getTooltipLineSpacing(){return a.TOOLTIP_LINESPACING}template(){var e=r.prototype.template.call(this);return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static createProperties(e){void 0!==e&&void 0!==e.markerColor&&void 0===e.borderColor&&(e.borderColor=e.markerColor);var t=new o("linetoolnote",e);return a._configureProperties(t),t}state(e){var t=r.prototype.state.call(this,e);return e&&(t.state.fixedSize=!1),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,94222))).NoteDefinitionsViewModel}static _configureProperties(e){r._configureProperties(e),e.hasChild("text")||e.addChild("text",new n(s("Text"))),e.addExclusion("text")}}a.TOOLTIP_WIDTH=300,a.TOOLTIP_PADDING=10,a.TOOLTIP_LINESPACING=5,a.version=1;class l extends a{constructor(e,t){super(e,t||l.createProperties())}title(){return s("Anchored Note")}name(){return"Anchored Note"}isFixed(){return!0}hasEditableCoordinates(){return!1}static createProperties(e){var t=new o("linetoolnoteabsolute",e);return l._configureProperties(t),t}static _configureProperties(e){a._configureProperties(e)}}t.LineToolNote=a,t.LineToolNoteAbsolute=l},3873:(e,t,i)=>{"use strict";var s=i(61834).LineToolTrading,r=i(10100).LineToolPriceAxisView,n=i(55752),o=i(76117).LineDataSource,a=i(11092).DefaultProperty;const l=i(27490);var c=i(36512).sortSourcesPreOrdered.LineToolOrder;function h(e){return null==e?e="":e+="",e}class d{constructor(e){this._line=e,this._data={bodyText:"order",quantityText:"0"},this._editable=!0,this._cancellable=!0,this._mode="",this._direction="buy",this._active=!0}setMode(e){return this._mode=e,this._line.updateAllViewsAndRedraw(),this}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setActive(e){return this._active=e,this._line.updateAllViewsAndRedraw(),this}setEditable(e){return this._editable=e,this._line.updateAllViewsAndRedraw(),this}getEditable(){return this._editable}setCancellable(e){return this._cancellable=e,this._line.updateAllViewsAndRedraw(),this}getCancellable(){return this._cancellable}hasMoveCallback(){return this.isFunction(this._onMoveCallback)}hasModifyCallback(){return this.isFunction(this._onModifyCallback)}getPrice(){ return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(h(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setModifyTooltip(e){return this._line.properties().modifyTooltip.setValue(h(e)),this}getModifyTooltip(){return this._line.properties().modifyTooltip.value()}setCancelTooltip(e){return this._line.properties().cancelTooltip.setValue(h(e)),this}getCancelTooltip(){return this._line.properties().cancelTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}setLineLength(e){return this._line.properties().lineLength.setValue(Math.max(0,Math.min(e,100))),this}getLineColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.lineActiveBuyColor.value():e.lineInactiveBuyColor.value():this._active?e.lineActiveSellColor.value():e.lineInactiveSellColor.value()}setLineColor(e){return"buy"===this._direction?this._active?this.setLineActiveBuyColor(e):this.setLineInactiveBuyColor(e):this._active?this.setLineActiveSellColor(e):this.setLineInactiveSellColor(e),this}setLineActiveBuyColor(e){return this._line.properties().lineActiveBuyColor.setValue(e),this}setLineInactiveBuyColor(e){return this._line.properties().lineInactiveBuyColor.setValue(e),this}setLineActiveSellColor(e){return this._line.properties().lineActiveSellColor.setValue(e),this}setLineInactiveSellColor(e){return this._line.properties().lineInactiveSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties() ;return"buy"===this._direction?this._active?e.bodyBorderActiveBuyColor.value():e.bodyBorderInactiveBuyColor.value():this._active?e.bodyBorderActiveSellColor.value():e.bodyBorderInactiveSellColor.value()}setBodyBorderColor(e){return"buy"===this._direction?this._active?this.setBodyBorderActiveBuyColor(e):this.setBodyBorderInactiveBuyColor(e):this._active?this.setBodyBorderActiveSellColor(e):this.setBodyBorderInactiveSellColor(e),this}setBodyBorderActiveBuyColor(e){return this._line.properties().bodyBorderActiveBuyColor.setValue(e),this}setBodyBorderInactiveBuyColor(e){return this._line.properties().bodyBorderInactiveBuyColor.setValue(e),this}setBodyBorderActiveSellColor(e){return this._line.properties().bodyBorderActiveSellColor.setValue(e),this}setBodyBorderInactiveSellColor(e){return this._line.properties().bodyBorderInactiveSellColor.setValue(e),this}getBodyBackgroundColor(){return n.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return"limit"===this._mode?this._active?e.bodyTextActiveLimitColor.value():e.bodyTextInactiveLimitColor.value():"stop"===this._mode?this._active?e.bodyTextActiveStopColor.value():e.bodyTextInactiveStopColor.value():"buy"===this._direction?this._active?e.bodyTextActiveBuyColor.value():e.bodyTextInactiveBuyColor.value():this._active?e.bodyTextActiveSellColor.value():e.bodyTextInactiveSellColor.value()}setBodyTextColor(e){return"limit"===this._mode?this._active?this.setBodyTextActiveLimitColor(e):this.setBodyTextInactiveLimitColor(e):"stop"===this._mode?this._active?this.setBodyTextActiveStopColor(e):this.setBodyTextInactiveStopColor(e):"buy"===this._direction?this._active?this.setBodyTextActiveBuyColor(e):this.setBodyTextInactiveBuyColor(e):this._active?this.setBodyTextActiveSellColor(e):this.setBodyTextInactiveSellColor(e),this}setBodyTextInactiveLimitColor(e){return this._line.properties().bodyTextInactiveLimitColor.setValue(e),this}setBodyTextActiveLimitColor(e){return this._line.properties().bodyTextActiveLimitColor.setValue(e),this}setBodyTextInactiveStopColor(e){return this._line.properties().bodyTextInactiveStopColor.setValue(e),this}setBodyTextActiveStopColor(e){return this._line.properties().bodyTextActiveStopColor.setValue(e),this}setBodyTextInactiveBuyColor(e){return this._line.properties().bodyTextInactiveBuyColor.setValue(e),this}setBodyTextActiveBuyColor(e){return this._line.properties().bodyTextActiveBuyColor.setValue(e),this}setBodyTextInactiveSellColor(e){return this._line.properties().bodyTextInactiveSellColor.setValue(e),this}setBodyTextActiveSellColor(e){return this._line.properties().bodyTextActiveSellColor.setValue(e),this}getBodyFont(){ return n.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return n.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBorderActiveBuyColor.value():e.quantityBorderInactiveBuyColor.value():this._active?e.quantityBorderActiveSellColor.value():e.quantityBorderInactiveSellColor.value()}setQuantityBorderColor(e){return"buy"===this._direction?this._active?this.setQuantityBorderActiveBuyColor(e):this.setQuantityBorderInactiveBuyColor(e):this._active?this.setQuantityBorderActiveSellColor(e):this.setQuantityBorderInactiveSellColor(e),this}setQuantityBorderActiveBuyColor(e){return this._line.properties().quantityBorderActiveBuyColor.setValue(e),this}setQuantityBorderInactiveBuyColor(e){return this._line.properties().quantityBorderInactiveBuyColor.setValue(e),this}setQuantityBorderActiveSellColor(e){return this._line.properties().quantityBorderActiveSellColor.setValue(e),this}setQuantityBorderInactiveSellColor(e){return this._line.properties().quantityBorderInactiveSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBackgroundActiveBuyColor.value():e.quantityBackgroundInactiveBuyColor.value():this._active?e.quantityBackgroundActiveSellColor.value():e.quantityBackgroundInactiveSellColor.value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this._active?this.setQuantityBackgroundActiveBuyColor(e):this.setQuantityBackgroundInactiveBuyColor(e):this._active?this.setQuantityBackgroundActiveSellColor(e):this.setQuantityBackgroundInactiveSellColor(e),this}setQuantityBackgroundActiveBuyColor(e){return this._line.properties().quantityBackgroundActiveBuyColor.setValue(e),this}setQuantityBackgroundInactiveBuyColor(e){return this._line.properties().quantityBackgroundInactiveBuyColor.setValue(e),this}setQuantityBackgroundActiveSellColor(e){return this._line.properties().quantityBackgroundActiveSellColor.setValue(e),this}setQuantityBackgroundInactiveSellColor(e){return this._line.properties().quantityBackgroundInactiveSellColor.setValue(e),this}getQuantityTextColor(){return n.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return n.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return n.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){ return n.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getCancelButtonBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonBorderActiveBuyColor.value():e.cancelButtonBorderInactiveBuyColor.value():this._active?e.cancelButtonBorderActiveSellColor.value():e.cancelButtonBorderInactiveSellColor.value()}setCancelButtonBorderColor(e){return"buy"===this._direction?this._active?this.setCancelButtonBorderActiveBuyColor(e):this.setCancelButtonBorderInactiveBuyColor(e):this._active?this.setCancelButtonBorderActiveSellColor(e):this.setCancelButtonBorderInactiveSellColor(e),this}setCancelButtonBorderActiveBuyColor(e){return this._line.properties().cancelButtonBorderActiveBuyColor.setValue(e),this}setCancelButtonBorderInactiveBuyColor(e){return this._line.properties().cancelButtonBorderInactiveBuyColor.setValue(e),this}setCancelButtonBorderActiveSellColor(e){return this._line.properties().cancelButtonBorderActiveSellColor.setValue(e),this}setCancelButtonBorderInactiveSellColor(e){return this._line.properties().cancelButtonBorderInactiveSellColor.setValue(e),this}getCancelButtonBackgroundColor(){return n.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)}setCancelButtonBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this}getCancelButtonIconColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonIconActiveBuyColor.value():e.cancelButtonIconInactiveBuyColor.value():this._active?e.cancelButtonIconActiveSellColor.value():e.cancelButtonIconInactiveSellColor.value()}setCancelButtonIconColor(e){return"buy"===this._direction?this._active?this.setCancelButtonIconActiveBuyColor(e):this.setCancelButtonIconInactiveBuyColor(e):this._active?this.setCancelButtonIconActiveSellColor(e):this.setCancelButtonIconInactiveSellColor(e),this}setCancelButtonIconActiveBuyColor(e){return this._line.properties().cancelButtonIconActiveBuyColor.setValue(e),this}setCancelButtonIconInactiveBuyColor(e){return this._line.properties().cancelButtonIconInactiveBuyColor.setValue(e),this}setCancelButtonIconActiveSellColor(e){return this._line.properties().cancelButtonIconActiveSellColor.setValue(e),this}setCancelButtonIconInactiveSellColor(e){return this._line.properties().cancelButtonIconInactiveSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}getBlocked(){return this._blocked}isFunction(e){return"function"==typeof e}onCancel(e,t){return t?this.isFunction(t)&&(this._onCancelData=e,this._onCancelCallback=t):this.isFunction(e)&&(this._onCancelCallback=e),this}callOnCancel(){ this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)}isOnCancelCallbackPresent(){return this.isFunction(this._onCancelCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onMove(e,t){return t?this.isFunction(t)&&(this._onMoveData=e,this._onMoveCallback=t):this.isFunction(e)&&(this._onMoveCallback=e),this}callOnMove(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class u extends s{constructor(e,t){super(e,t||u.createProperties()),this._adapter=new d(this),this.setSelectionEnabled(!0),i.e(1583).then(i.bind(i,76322)).then(({OrderPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t,i){this._points[e]=t,this.normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}name(){return"Order"}endMoving(e){var t=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.endMoving(),!e&&t&&this._adapter.callOnMove()}createPriceAxisView(e){var t={pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()};return this._priceAxisView=new r(this,t),this._priceAxisView}paneViews(){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.priceAxisViews.call(this,e,t):null}adapter(){return this._adapter}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}movable(){return Boolean(this._adapter._onMoveCallback)}static createProperties(e){var t=new a("linetoolorder",e,!1,!1);return u._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolOrder=u},16898:(e,t,i)=>{"use strict";i.d(t,{LineToolParallelChannel:()=>c});var s=i(16282),r=i(72927),n=i(11092),o=i(15521),a=i(76117),l=i(47903);class c extends a.LineDataSource{constructor(e,t){super(e,t||c.createProperties()),this._priceAxisViews.push(this.createPriceAxisView(3)),this._coordOffsetWhileMovingOrChanging=null,this._pendingPriceOffset=null, i.e(1583).then(i.bind(i,98906)).then(({ParallelChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}paneViews(e){return null!==this._pendingPriceOffset&&this._applyPendingPriceOffset(),super.paneViews(e)}setLastPoint(e,t){t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[0]);const i=(0,l.clone)(e);return super.setLastPoint(e),i}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endMoving(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endMoving(e,t,i)}startChanging(e,t){super.startChanging(e,t),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endChanging(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endChanging(e,t)}restoreExternalPoints(e,t,i){const s=i?e.points:this._timePoint.map((t,i)=>({price:t.price,offset:e.points[i].offset,time_t:e.points[i].time_t}));if(super.restoreExternalPoints({...e,points:s},t),t.pricesChanged&&this._points.length===s.length)for(let e=0;e=4)return;this._snapPointBeforeChange(e,t,i);const a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),h=(0,s.ensureNotNull)(this._coordOffsetWhileMovingOrChanging),d=(0,s.ensureNotNull)(this.priceScale()),u=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue());switch(e){case 0:super.setPoint(e,t,i),this._points[2].price=d.coordinateToPrice(c.y+h,u);break;case 1:super.setPoint(e,t,i);break;case 2:super.setPoint(e,t,i),this._points[0].price=d.coordinateToPrice(c.y-h,u),this._points[0].index=t.index;break;case 3:this._points[1].price=d.coordinateToPrice(c.y-h,u),this._points[1].index=t.index;break;case 4:{const e=l.subtract(a),t=(c.x-a.x)/e.x,i=a.addScaled(e,t),s=c.y-i.y;this._points[2].price=d.coordinateToPrice(a.y+s,u);break}case 5:{const e=l.subtract(a),t=(c.x-a.x)/e.x,i=a.addScaled(e,t),s=c.y-i.y;this._points[0].price=d.coordinateToPrice(a.y+s,u),this._points[1].price=d.coordinateToPrice(l.y+s,u);break}}const p=this.linkKey().value();if(p&&!r&&e<4){const e=this._points.map(e=>e.price);(0,o.changeLineStyle)({model:this._model,linkKey:p,state:{prices:e}})}}state(e){const t=a.LineDataSource.prototype.state.call(this,e);return this._pendingPriceOffset&&(t.priceOffset=this._pendingPriceOffset),t}restoreExternalState(e){const t={...e};if(t.prices&&this.isActualSymbol())for(let e=0;ee.index<=t.index?[e,t]:[t,e],s=i(t[0],t[1]),r=i(t[2],t[3]);let n,o,a,l;t[2].price{"use strict";i.d(t,{LineToolPath:()=>c});var s=i(16282),r=i(72927),n=i(11092),o=i(21344),a=i(76117),l=i(39096);class c extends a.LineDataSource{constructor(e,t){const s=t||c.createProperties();super(e,s),i.e(1583).then(i.bind(i,71544)).then(t=>{this._setPaneViews([new t.PathPaneView(this,e)])})}pointsCount(){return-1}name(){return"Path"}hasEditableCoordinates(){return!1}addPoint(e,t,i){var n;const a=(0,s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),d=a.priceToCoordinate(c,h);if(this._points.length>0){const e=this._points[this._points.length-1],t=this._model.timeScale().indexToCoordinate(e.index),i=e.price,s=a.priceToCoordinate(i,h);if(new r.Point(l,d).subtract(new r.Point(t,s)).length()<(0,o.interactionTolerance)().minDistanceBetweenPoints)return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}static createProperties(e){const t=new n.DefaultProperty("linetoolpath",e);return c._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,49431)).then(e=>e.PathDefinitionsViewModel)}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.addChild("linesWidths",new l.LineToolWidthsProperty([(0,s.ensureDefined)(e.child("lineWidth"))])),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().lineColor]))}}},69316:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),i.e(1583).then(i.bind(i,24425)).then(({PitchfanLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 3}name(){return"Pitchfan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,19530))).PitchBaseDefinitionsViewModel}static createProperties(e){var t=new o("linetoolpitchfan",e,!1,{ range:[0,8]});return d._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=8,t.LineToolPitchfan=d},13953:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolPitchforkStyle:()=>s}),function(e){e[e.Original=0]="Original",e[e.Schiff=1]="Schiff",e[e.Inside=2]="Inside",e[e.Schiff2=3]="Schiff2"}(s||(s={}))},70799:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(46374).Action,l=i(34449).ACTION_ID,c=i(13953).LineToolPitchforkStyle,h=null,d=i(39096),u=d.LineToolWidthsProperty,p=d.LineToolColorsProperty,_=new r("erase level line",s("erase level line")),m=new r("change {title} style",s("change {title} style"));class g extends n{constructor(e,t){super(e,t||g.createProperties()),this._properties.style.listeners().subscribe(this,g.prototype._recreatePaneView),this._recreatePaneView()}levelsCount(){return g.LevelsCount}additionalActions(e){for(var t=[],i=[{title:s("Original"),actionId:l.ChartLineToolPitchforkChangeTypeToOriginal},{title:s("Modified Schiff"),actionId:l.ChartLineToolPitchforkChangeTypeToModifiedSchiff},{title:s("Inside"),actionId:l.ChartLineToolPitchforkChangeTypeToInside},{title:s("Schiff"),actionId:l.ChartLineToolPitchforkChangeTypeToSchiff}],n=0;n<4;n++){var o=new a({actionId:i[n].actionId,checked:this.properties().style.value()===n,checkable:!0,label:i[n].title,payload:{target:this,value:n},onExecute:function(t){var i=t.getPayload(),s=i.target;e.setProperty(s.properties().style,i.value,m.format({title:new r(s.name(),s.title())})),s.updateAllViews(),s._model.updateSource(s)}});t.push(o)}return[t[0],t[3],t[1],t[2]]}_recreatePaneView(){if(null!==h){var e=[];this._properties.style.value()===c.Original?e=[new h.PitchforkLinePaneView(this,this._model)]:this._properties.style.value()===c.Schiff?e=[new h.SchiffPitchforkLinePaneView(this,this._model)]:this._properties.style.value()===c.Schiff2?e=[new h.SchiffPitchfork2LinePaneView(this,this._model)]:this._properties.style.value()===c.Inside&&(e=[new h.InsidePitchforkLinePaneView(this,this._model)]),this._setPaneViews(e)}else i.e(1583).then(i.bind(i,71161)).then(e=>{null===h&&(h=e),this._recreatePaneView()})}pointsCount(){return 3}name(){return"Pitchfork"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,_)}static createProperties(e){var t=new o("linetoolpitchfork",e,!1,{range:[0,8]});return g._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,18775))).PitchForkDefinitionsViewModel}static _configureProperties(e){n._configureProperties(e) ;for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=g.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new p(i)),e.addChild("linesWidths",new u(t))}}g.LevelsCount=8,t.LineToolPitchfork=g},78218:(e,t,i)=>{"use strict";i.d(t,{LineToolPolyline:()=>l});var s=i(16282),r=i(72927),n=i(11092),o=i(21344),a=i(76117);class l extends a.LineDataSource{constructor(e,t){const s=t||l.createProperties();super(e,s),i.e(1583).then(i.bind(i,177)).then(t=>{this._setPaneViews([new t.PolylinePaneView(this,e)])})}pointsCount(){return-1}name(){return"Polyline"}hasEditableCoordinates(){return!1}addPoint(e,t,i){var n;const a=(0,s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),d=a.priceToCoordinate(c,h),u=(0,o.interactionTolerance)().minDistanceBetweenPoints;if(this._points.length>0){const e=this._points[this._points.length-1],t=this._model.timeScale().indexToCoordinate(e.index),i=e.price,s=a.priceToCoordinate(i,h);if(new r.Point(l,d).subtract(new r.Point(t,s)).length()e.PolylinesDefinitionsViewModel)}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.addExclusion("filled")}}},18008:(e,t,i)=>{"use strict";i.d(t,{PositionAveragePriceAxisView:()=>r});var s=i(10100);class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},97496:(e,t,i)=>{"use strict";var s=i(61834).LineToolTrading,r=i(76117).LineDataSource,n=i(18008).PositionAveragePriceAxisView,o=i(55752),a=i(11092).DefaultProperty,l=i(59104).PriceFormatter;const c=i(27490) ;var h=i(36512).sortSourcesPreOrdered.LineToolPosition;function d(e){return null==e?e="":e+="",e}class u{constructor(e){this._line=e,this._data={bodyText:"position",quantityText:"0"},this._closeEnabled=!0,this._direction="buy",this._profitState="neutral"}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setProfitState(e){return this._profitState=e,this._line.updateAllViewsAndRedraw(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(d(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setProtectTooltip(e){return this._line.properties().protectTooltip.setValue(d(e)),this}getProtectTooltip(){return this._line.properties().protectTooltip.value()}setCloseTooltip(e){return this._line.properties().closeTooltip.setValue(d(e)),this}getCloseTooltip(){return this._line.properties().closeTooltip.value()}setReverseTooltip(e){return this._line.properties().reverseTooltip.setValue(d(e)),this}getReverseTooltip(){return this._line.properties().reverseTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}setLineLength(e){return this._line.properties().lineLength.setValue(Math.max(0,Math.min(e,100))),this}getLineColor(){var e=this._line.properties();return("buy"===this._direction?e.lineBuyColor:e.lineSellColor).value()}setLineColor(e){return"buy"===this._direction?this.setLineBuyColor(e):this.setLineSellColor(e),this}setLineBuyColor(e){return this._line.properties().lineBuyColor.setValue(e),this}setLineSellColor(e){return this._line.properties().lineSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties() ;return("buy"===this._direction?e.bodyBorderBuyColor:e.bodyBorderSellColor).value()}setBodyBorderColor(e){return"buy"===this._direction?this.setBodyBorderBuyColor(e):this.setBodyBorderSellColor(e),this}setBodyBorderBuyColor(e){return this._line.properties().bodyBorderBuyColor.setValue(e),this}setBodyBorderSellColor(e){return this._line.properties().bodyBorderSellColor.setValue(e),this}getBodyBackgroundColor(){return o.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return("positive"===this._profitState?e.bodyTextPositiveColor:"negative"===this._profitState?e.bodyTextNegativeColor:e.bodyTextNeutralColor).value()}setBodyTextColor(e){return"positive"===this._profitState?this.setBodyTextPositiveColor(e):"negative"===this._profitState?this.setBodyTextNegativeColor(e):this.setBodyTextNeutralColor(e),this}setBodyTextPositiveColor(e){return this._line.properties().bodyTextPositiveColor.setValue(e),this}setBodyTextNegativeColor(e){return this._line.properties().bodyTextNegativeColor.setValue(e),this}setBodyTextNeutralColor(e){return this._line.properties().bodyTextNeutralColor.setValue(e),this}getBodyFont(){return o.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return o.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBorderBuyColor:e.quantityBorderSellColor).value()}setQuantityBorderColor(e){return"buy"===this._direction?this.setQuantityBorderBuyColor(e):this.setQuantityBorderSellColor(e),this}setQuantityBorderBuyColor(e){return this._line.properties().quantityBorderBuyColor.setValue(e),this}setQuantityBorderSellColor(e){return this._line.properties().quantityBorderSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBackgroundBuyColor:e.quantityBackgroundSellColor).value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this.setQuantityBackgroundBuyColor(e):this.setQuantityBackgroundSellColor(e),this}setQuantityBackgroundBuyColor(e){return this._line.properties().quantityBackgroundBuyColor.setValue(e),this}setQuantityBackgroundSellColor(e){return this._line.properties().quantityBackgroundSellColor.setValue(e),this}getQuantityTextColor(){return o.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){ return o.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return o.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return o.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getReverseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonBorderBuyColor:e.reverseButtonBorderSellColor).value()}setReverseButtonBorderColor(e){return"buy"===this._direction?this.setReverseButtonBorderBuyColor(e):this.setReverseButtonBorderSellColor(e),this}setReverseButtonBorderBuyColor(e){return this._line.properties().reverseButtonBorderBuyColor.setValue(e),this}setReverseButtonBorderSellColor(e){return this._line.properties().reverseButtonBorderSellColor.setValue(e),this}getReverseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)}setReverseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this}getReverseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonIconBuyColor:e.reverseButtonIconSellColor).value()}setReverseButtonIconColor(e){return"buy"===this._direction?this.setReverseButtonIconBuyColor(e):this.setReverseButtonIconSellColor(e),this}setReverseButtonIconBuyColor(e){return this._line.properties().reverseButtonIconBuyColor.setValue(e),this}setReverseButtonIconSellColor(e){return this._line.properties().reverseButtonIconSellColor.setValue(e),this}getCloseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonBorderBuyColor:e.closeButtonBorderSellColor).value()}setCloseButtonBorderColor(e){return"buy"===this._direction?this.setCloseButtonBorderBuyColor(e):this.setCloseButtonBorderSellColor(e),this}setCloseButtonBorderBuyColor(e){return this._line.properties().closeButtonBorderBuyColor.setValue(e),this}setCloseButtonBorderSellColor(e){return this._line.properties().closeButtonBorderSellColor.setValue(e),this}getCloseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)}setCloseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this}getCloseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonIconBuyColor:e.closeButtonIconSellColor).value()}setCloseButtonIconColor(e){ return"buy"===this._direction?this.setCloseButtonIconBuyColor(e):this.setCloseButtonIconSellColor(e),this}setCloseButtonIconBuyColor(e){return this._line.properties().closeButtonIconBuyColor.setValue(e),this}setCloseButtonIconSellColor(e){return this._line.properties().closeButtonIconSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}isFunction(e){return"function"==typeof e}onReverse(e,t){return t?this.isFunction(t)&&(this._onReverseData=e,this._onReverseCallback=t):this.isFunction(e)&&(this._onReverseCallback=e),this}callOnReverse(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)}isOnReverseCallbackPresent(){return this.isFunction(this._onReverseCallback)}onClose(e,t){return t?this.isFunction(t)&&(this._onCloseData=e,this._onCloseCallback=t):this.isFunction(e)&&(this._onCloseCallback=e),this}setCloseEnabled(e){return this._closeEnabled===e||(this._closeEnabled=e,this._onCloseCallback&&this._line.updateAllViewsAndRedraw()),this}isCloseEnabled(){return this._closeEnabled}callOnClose(){this.isFunction(this._onCloseCallback)&&this._closeEnabled&&this._onCloseCallback.call(this,this._onCloseData)}isOnCloseCallbackPresent(){return this._closeEnabled&&this.isFunction(this._onCloseCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class p extends s{constructor(e,t){super(e,t||p.createProperties()),this._adapter=new u(this),i.e(1583).then(i.t.bind(i,44622,19)).then(({PositionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])});var s=e.mainSeries().symbolInfo(),r=null!==s?s.pricescale:100,n=null!==s&&s.fractional?s.minmov:1,o=null!==s&&s.fractional,a=null!==s?s.minmove2:void 0;this._formatter=new l(r,n,o,a)}zorder(){return h}isSpeciallyZOrderedSource(){return!0}setPoint(e,t,i){this._points[e]=t,this.normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}name(){return"Position"}createPriceAxisView(e){return this._priceAxisView=new n(this,{pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()}),this._priceAxisView}paneViews(){return TradingView.printing&&!c.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.paneViews.call(this):null}priceAxisViews(e,t){ return TradingView.printing&&!c.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.priceAxisViews.call(this,e,t):null}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}formatter(){return this._formatter}static createProperties(e){var t=new a("linetoolposition",e,!1,!1);return p._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolPosition=p},84888:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{AlertStatus:()=>s,Direction:()=>r}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(s||(s={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(r||(r={}))},81290:(e,t,i)=>{"use strict";var s=i(16282).ensureNotNull,r=i(76117).LineDataSource,n=i(11092).DefaultProperty,o=i(84888);class a extends r{constructor(e,t){super(e,t||a.createProperties()),this._predictionPaneView=null,this._model.mainSeries().properties().interval.subscribe(this,()=>{this.setStatus(o.AlertStatus.Waiting)}),i.e(1583).then(i.t.bind(i,94562,19)).then(({PredictionPaneView:e})=>{this._predictionPaneView=new e(this,this._model),this._setPaneViews([this._predictionPaneView])})}destroy(){super.destroy(),this._model.mainSeries().properties().interval.unsubscribeAll(this)}dataAndViewsReady(){return r.prototype.dataAndViewsReady.call(this)&&this._predictionPaneView&&this._predictionPaneView.iconsReady()}isSynchronizable(){return!1}status(){return this._properties.status.value()}setStatus(e){return this._properties.status.setValue(e)}pointsCount(){return 2}name(){return"Forecast"}restorePoints(e,t,i){super.restorePoints(e,t,i),this.checkAlert()}checkAlert(){if(!(this._points.length<2||this._model.mainSeries().bars().isEmpty())){var e=this._points[1];if(this.status())e.index>this._model.timeScale().baseIndex()&&this.setStatus(o.AlertStatus.Waiting);else{var t=this._model.mainSeries().bars().valueAt(e.index);if(null!==t){var i=this.direction();if(i===o.Direction.Up&&t[TradingView.HIGH_PLOT]>=e.price)this.setStatus(o.AlertStatus.Success);else if(i===o.Direction.Down&&t[TradingView.LOW_PLOT]<=e.price)this.setStatus(o.AlertStatus.Success);else{var r=s(this._model.mainSeries().bars().lastIndex());e.index!==r&&this.setStatus(o.AlertStatus.Failure)}}}}}addPoint(e){var t=r.prototype.addPoint.call(this,e);return t&&this.checkAlert(),t}endChanging(){super.endChanging(),this.setStatus(o.AlertStatus.Waiting),this.checkAlert()}onData(e){super.onData(e),this.checkAlert()}endMoving(e,t,i){super.endMoving(e,t,i),this.setStatus(o.AlertStatus.Waiting),this.checkAlert()}direction(){if(this.points().length<2)return o.Direction.Up;var e=this.points()[0];return this.points()[1].price>e.price?o.Direction.Up:o.Direction.Down}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,93786))).PredictionDefinitionsViewModel}cloneable(){return!1}static createProperties(e){var t=new n("linetoolprediction",e) ;return a._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e),e.merge({status:o.AlertStatus.Waiting})}}t.LineToolPrediction=a},67128:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty,n=i(39096).LineToolColorsProperty;class o extends s{constructor(e,t){super(e,t||o.createProperties()),i.e(1583).then(i.t.bind(i,12396,19)).then(({PriceLabelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 1}name(){return"Price Label"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,45816))).PriceLabelDefinitionsViewModel}static createProperties(e){var t=new r("linetoolpricelabel",e);return o._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e),e.addChild("linesColors",new n([e.childs().borderColor])),e.addChild("textsColors",new n([e.childs().color]))}}t.LineToolPriceLabel=o},80363:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceNote:()=>l});var s=i(16282),r=i(11092),n=i(674),o=i.n(n),a=i(76117);class l extends a.LineDataSource{constructor(e,t){super(e,t||l.createProperties()),this._labelMovingDelta=null,i.e(1583).then(i.bind(i,78240)).then(t=>{this._setPaneViews([new t.PriceNotePaneView(this,e)])})}pointsCount(){return 2}name(){return"Price Note"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}startMoving(e,t,i){if(1===t){if(this.isSourceHidden())return;const i=(0,s.ensureDefined)(e.logical),r=this.points()[1];this._labelMovingDelta={index:r.index-i.index,price:r.price-i.price},this.startChanging(t,i)}else this._labelMovingDelta=null,super.startMoving(e,t,i)}move(e,t,i){if(null!==this._labelMovingDelta){const t=(0,s.ensureDefined)(e.logical),r={index:t.index+this._labelMovingDelta.index,price:t.price+this._labelMovingDelta.price};this.setPoint(1,r,i),this.updateAllViews()}else super.move(e,t,i)}endMoving(e,t,i){return null!==this._labelMovingDelta?(this._labelMovingDelta=null,this.endChanging(!1,e)):super.endMoving(e,t,i)}static createProperties(e){const t=new r.DefaultProperty("linetoolpricenote",e);return l._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,75256)).then(e=>e.PriceNoteDefinitionsViewModel)}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(o())("")),e.addExclusion("text"),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors"),e.hasChild("textsColors")&&e.removeProperty("textsColors")}}},40630:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceRange:()=>n});var s=i(11092),r=i(76117);class n extends r.LineDataSource{constructor(e,t){super(e,t||n.createProperties()),i.e(1583).then(i.bind(i,6704)).then(e=>{this._setPaneViews([new e.PriceRangePaneView(this,this._model)])})}pointsCount(){return 2}name(){ return"Price Range"}static createProperties(e){const t=new s.DefaultProperty("linetoolpricerange",e);return n._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,44558))).GeneralDatePriceRangeDefinitionsViewModel}static _configureProperties(e){r.LineDataSource._configureProperties(e)}}},79300:(e,t,i)=>{"use strict";var s=i(81773),r=i(55977).LineToolFibWedgeBase,n=i(39096).LineToolColorsProperty;class o extends r{constructor(e,t){super(e,t||o.createProperties()),i.e(1583).then(i.t.bind(i,46474,19)).then(({ProjectionLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return 1}name(){return"Projection"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,92557))).ProjectionDefinitionsViewModel}static createProperties(e){var t=new s("linetoolprojection",e,!1,{range:[1,1]});return o._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e),e.addChild("linesColors",new n([e.trendline.color]))}}t.LineToolProjection=o},98684:(e,t,i)=>{"use strict";var s=i(12565).LineToolTrendLine,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties())}name(){return"Ray"}static createProperties(e){var t=new r("linetoolray",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolRay=n},46297:(e,t,i)=>{"use strict";i.d(t,{LineToolRectangle:()=>h});var s=i(72927),r=i(11092),n=i(674),o=i.n(n),a=i(76117),l=i(39096),c=i(16282);class h extends a.LineDataSource{constructor(e,t){const s=t||h.createProperties();super(e,s),i.e(1583).then(i.bind(i,75196)).then(({RectanglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}pointsCount(){return 2}textColorsProperty(){return this.properties().childs().showLabel.value()?super.textColorsProperty():null}name(){return"Rectangle"}setPoint(e,t,i){if(e<2&&super.setPoint(e,t,i),i&&i.shift()){const i=this._getAnchorPointForIndex(e);if(e>=4)return this._correctMiddlePoints(e,t,i),void this.normalizePoints();this._snapPoint45Degree(t,i)}switch(e){case 2:this._points[1].price=t.price,this._points[0].index=t.index;break;case 3:this._points[0].price=t.price,this._points[1].index=t.index;break;case 4:this._points[0].index=t.index;break;case 5:this._points[1].index=t.index;break;case 6:this._points[0].price=t.price;break;case 7:this._points[1].price=t.price}this.normalizePoints()}getPoint(e){return e<2?super.getPoint(e):this._getAnchorPointForIndex(e)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetoolrectangle",e);return h._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,29286)).then(e=>e.RectangleDefinitionsViewModel)}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)} _snapPoint45Degree(e,t,i){const s=this.m_priceScale,r=this.ownerSource();if(null===s||null===r)return;const n=r.firstValue();if(null===n)return;const o=this._model.timeScale(),a=(0,c.ensureNotNull)(this.pointToScreenPoint(e)),l=(0,c.ensureNotNull)(this.pointToScreenPoint(t)),h=a.x-l.x,d=a.y-l.y,u=h<0?-1:1,p=d<0?-1:1,_=Math.max(Math.abs(h),Math.abs(d)),m=Math.round(o.coordinateToIndex(l.x+_*u)),g=Math.abs(o.indexToCoordinate(m)-l.x),f=s.coordinateToPrice(l.y+g*p,n);e.index=m,e.price=f}_correctMiddlePoints(e,t,i){e<6?this._correctRightLeftMiddlePoint(e,t,i):this._correctTopBottomMiddlePoint(e,t,i)}_correctRightLeftMiddlePoint(e,t,i){const r=(0,c.ensureNotNull)(this.pointToScreenPoint(t)),n=(0,c.ensureNotNull)(this.pointToScreenPoint(i)),o=(0,c.ensureNotNull)(this.pointToScreenPoint(this._points[0])),a=(0,c.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let l=r.x-n.x;if(0===l)return;const h=o.x{"use strict";var s=i(16282).assert,r=s.ensureNotNull,n=i(47903),o=n.merge,a=n.clone,l=i(11092),c=i(17175).StudyLineDataSource,h=i(67620).INVALID_TIME_POINT_INDEX,d=i(39096).LineToolWidthsProperty,u=i(85062);const p=i(67945).createStudyLineToolProperties,_=i(39951),m="RegressionTrend@tv-basicstudies";function g(e){return void 0!==e.startPrice&&void 0!==e.endPrice}class f extends c{constructor(e,t,s){s=s||e.studyMetaInfoRepository().findByIdSync({type:"java",studyId:m});var r=t||f._createPropertiesFromStudyMetaInfo(s,e.studyVersioning());super(e,s,"linreg_",r),this.version=2,this._trendData=null,i.e(1583).then(i.bind(i,56145)).then(({RegressionTrendPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}formatter(){s(!1,"This method should never be called")}pointsCount(){return 2}clearData(){this._trendData=null,super.clearData()}state(e){var t=c.prototype.state.call(this,e);return e?Object.assign({},t,{nonseriesdata:this._trendData}):t}restoreData(e){super.restoreData(e),e.nonseriesdata&&(this._trendData=e.nonseriesdata)}startIndex(){if(null===this._trendData||null===this._indexes)return null;var e=this._indexes[this._trendData.startIndex];return e!==h?e:null}endIndex(){if(null===this._trendData||null===this._indexes)return null;var e=this._indexes[this._trendData.endIndex];return e!==h?e:null}baseLine(){return null===this._trendData?null:this._trendData.baseLine}downLine(){return null===this._trendData?null:this._trendData.downLine}upLine(){return null===this._trendData?null:this._trendData.upLine}pearsons(){return null===this._trendData?null:this._trendData.pearsons}recalcStudyIfNeeded(){this._onStudyInputsMayChange()}static createProperties(e,t){const i=u.getStudyPropertyRootNameById(m),s=r(e.studyMetaInfoRepository().findByIdSync({type:"java",studyId:m})),n=l(!0,i,[],e.studyVersioning());return p("LineToolRegressionTrend",s,s,o(a(n),t||{}),e.studyVersioning())}static studyId(){return m}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=_.prepareStudyPropertiesForLoadChart(e,t,i,null,s);return f._configureProperties(r),r}_studyInputs(e){s(2===e.length,"all the line tool points should be defined");var t=e[0],i=e[1];if(t.index===i.index)return null;const r=this._getPointTime(t.index<=i.index?t:i,!0),n=this._getPointTime(i.index>=t.index?i:t,!0);if(null===r||null===n)return this._subscribeApplyInputsOnSeriesCompleted(),null;var o=1e3*r,a=1e3*n;return{ "upper diviation":this.properties().inputs["upper diviation"].value(),"lower diviation":this.properties().inputs["lower diviation"].value(),"use upper diviation":this.properties().inputs["use upper diviation"].value(),"use lower diviation":this.properties().inputs["use lower diviation"].value(),"first bar time":o,"last bar time":a,source:this.properties().inputs.source.value()}}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace||(this._trendData=t.data),this._indexes=i,super._onDataUpdated(e,t,i))}_updateAnchorsPrice(){if(!this._trendData||TradingView.isNaN(this._trendData.baseLine.startPrice)||TradingView.isNaN(this._trendData.baseLine.endPrice))return;const{startPrice:e,endPrice:t}=this._trendData.baseLine;2===this._points.length&&(this._points[0].price=e,this._points[1].price=t,this._timePoint[0].price=e,this._timePoint[1].price=t)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(5019),i.e(607)]).then(i.bind(i,30042))).RegressionTrendDefinitionsViewModel}_isReady(){return this._trendData&&void 0!==this._trendData.startIndex&&void 0!==this._trendData.endIndex&&g(this._trendData.upLine)&&g(this._trendData.baseLine)&&g(this._trendData.downLine)}static createProperties(e){const t=c._createPropertiesFromStudyIdAndState(m,e);return f._configureProperties(t),t}static _createPropertiesFromStudyMetaInfo(e,t){const i=_.prepareStudyProperties(e,null,null,t);return f._configureProperties(i),i}static studyId(){return m}cloneable(){return!1}static _configureProperties(e){c._configureProperties(e);const t=e.child("styles");var i=[t.child("upLine").child("linewidth"),t.child("downLine").child("linewidth"),t.child("baseLine").child("linewidth")];e.addChild("linesWidths",new d(i))}}t.LineToolRegressionTrend=f},43662:(e,t,i)=>{"use strict";i.d(t,{LineToolRiskRewardBase:()=>f});var s=i(16282),r=i(57649),n=i(25303),o=i(76117),a=i(53785),l=i(67033),c=i(95426);class h extends c.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){if(e.visible=!1,!this._showAxisLabel())return;const s=this._source.priceScale();if(0===this._source.points().length||null===s||s.isEmpty())return;const r=this._source.ownerSource(),n=null!==r?r.firstValue():null;if(null===n)return;const o=this._data.priceProperty.value(),a=this._data.colorProperty.value();i.background=a,i.textColor=this.generateTextColor(a),i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0}_showAxisLabel(){return this._source.properties().childs().showPriceLabels.value()}}var d=i(674),u=i.n(d);class p extends(u()){constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){const e=this._lineSource.points()[this._pointIndex].price;return this._formatAndParsePrice(e)}state(){return this.value()}merge(e,t){return this.setValue(e),t?[]:null}_formatAndParsePrice(e){const t=(0,s.ensureNotNull)(this._lineSource.ownerSource()).formatter();if(t.parse){const i=t.format(e),s=t.parse(i);return s.res?s.value:e}return e}}class _ extends p{constructor(e){super(e,0)}setValue(e){ const t=this._lineSource.points()[this._pointIndex];this._lineSource.startChanging(this._pointIndex,t),t.price=parseFloat(""+e),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.recalculate(),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!1,!1),this._lineSource.syncPriceLevels()}}class m extends p{constructor(e){super(e,1)}value(){const e=this._lineSource.stopPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.model().mainSeries().base());this._lineSource.properties().childs().stopLevel.setValue(t),this._lineSource.syncPriceLevels()}}class g extends p{constructor(e){super(e,2)}value(){const e=this._lineSource.profitPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.model().mainSeries().base());this._lineSource.properties().childs().profitLevel.setValue(t),this._lineSource.syncPriceLevels()}}class f extends o.LineDataSource{constructor(e,t,o){if(super(e,t),this._syncStateExclusions=["points","entryPrice","stopPrice","targetPrice","stopLevel","profitLevel","riskSize","qty","amountTarget","amountStop"],!t.hasChild("stopLevel")&&!t.hasChild("profitLevel")){const i=(0,s.ensureNotNull)(e.timeScale().visibleBarsStrictRange()),r=i.firstBar(),o=i.lastBar();let a=(0,s.ensureNotNull)(e.mainSeries().priceRange(r,o));const l=e.mainSeries().priceScale();if(l.isLog()){const e=l.logicalToPrice(a.minValue()),t=l.logicalToPrice(a.maxValue());a=new n.PriceRange(e,t)}if(a&&!a.isEmpty()){const i=Math.round(.2*a.length()*e.mainSeries().base());t.merge({stopLevel:i,profitLevel:i})}}t.childs().stopLevel.listeners().subscribe(this,this.recalculate),t.childs().stopLevel.listeners().subscribe(null,()=>{this.properties().childs().stopPrice.childChanged("",0)}),t.childs().profitLevel.listeners().subscribe(this,this.recalculate),t.childs().profitLevel.listeners().subscribe(null,()=>{this.properties().childs().targetPrice.childChanged("",0)}),t.addChild("entryPrice",new _(this)),t.addChild("stopPrice",new m(this)),t.addChild("targetPrice",new g(this)),t.hasChild("riskSize")||t.addProperty("riskSize",0),t.hasChild("qty")||t.addProperty("qty",0),t.hasChild("amountTarget")||t.addProperty("amountTarget",t.childs().accountSize.value()),t.hasChild("amountStop")||t.addProperty("amountStop",t.childs().accountSize.value()),t.addExclusion("riskSize"),t.addExclusion("qty"),t.addExclusion("amountTarget"),t.addExclusion("amountStop"),this._riskInPercentsFormatter=new r.NumericFormatter(2),this._riskInMoneyFormatter=new r.NumericFormatter,t.childs().risk.subscribe(this,this._recalculateRiskSize),t.childs().accountSize.subscribe(this,this._recalculateRiskSize),t.childs().riskDisplayMode.subscribe(this,this._recalculateRisk),t.childs().riskDisplayMode.subscribe(this,this._recalculateRiskSize),t.childs().entryPrice.subscribe(this,this._recalculateRiskSize),t.childs().stopPrice.subscribe(this,this._recalculateRiskSize), t.childs().profitLevel.subscribe(this,this._recalculateRiskSize),t.childs().profitLevel.subscribe(this,this.syncPriceLevels.bind(this)),t.childs().stopLevel.subscribe(this,this._recalculateRiskSize),t.childs().stopLevel.subscribe(this,this.syncPriceLevels.bind(this)),t.childs().qty.subscribe(this,this._recalculateRiskSize),this.pointAdded().subscribe(this,e=>{switch(e){case l.RiskRewardPointIndex.Entry:case l.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}}),this.pointChanged().subscribe(this,e=>{switch(e){case l.RiskRewardPointIndex.Entry:case l.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}}),t.childs().riskDisplayMode.value()===a.RiskDisplayMode.Percentage&&t.childs().risk.value()>100&&t.childs().riskDisplayMode.setValueSilently(a.RiskDisplayMode.Money),this.version=2,this._entryPriceAxisView=new h(this,{colorProperty:t.childs().linecolor,priceProperty:t.childs().entryPrice}),this._stopPriceAxisView=new h(this,{colorProperty:t.childs().stopBackground,priceProperty:t.childs().stopPrice}),this._profitPriceAxisView=new h(this,{colorProperty:t.childs().profitBackground,priceProperty:t.childs().targetPrice}),i.e(1583).then(i.t.bind(i,18452,19)).then(({RiskRewardPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}}},53785:(e,t,i)=>{"use strict";var s;i.d(t,{RiskDisplayMode:()=>s}),function(e){e.Percentage="percents",e.Money="money"}(s||(s={}))},67033:(e,t,i)=>{"use strict";var s;i.d(t,{RiskRewardPointIndex:()=>s}),function(e){e[e.Entry=0]="Entry",e[e.Close=1]="Close",e[e.ActualEntry=2]="ActualEntry",e[e.ActualClose=3]="ActualClose"}(s||(s={}))},74021:(e,t,i)=>{"use strict";var s=i(16282).ensureNotNull,r=i(76117).LineDataSource,n=i(15521),o=i(11092).DefaultProperty,a=i(67033).RiskRewardPointIndex,l=i(53785).RiskDisplayMode,c=i(43662).LineToolRiskRewardBase,h=i(47903).isNumber,d=i(61627).PlotRowSearchMode;class u extends c{riskFormatter(e){return e===l.Percentage?this._riskInPercentsFormatter:this._riskInMoneyFormatter}getRiskStep(e){return e===l.Percentage?.01:1}_roundValue(e){return parseFloat(e.toFixed(2))}hasEditableCoordinates(){return!1}_recalculateRisk(){var e=this.properties(),t=e.riskDisplayMode.value(),i=e.riskSize.value(),s=e.accountSize.value(),r=e.risk.value();r=t===l.Percentage?this._roundValue(i/s*100):this._roundValue(s/100*r),this._riskInChange=!0,e.risk.setValue(this.riskFormatter(t).format(r)),this._riskInChange=!1}_recalculateRiskSize(){if(!this._riskInChange){var e=this.properties(),t=e.risk.value(),i=e.riskDisplayMode.value(),s=e.accountSize.value();i===l.Percentage?e.riskSize.setValue(t/100*s):t>s?(e.risk.setValue(s),e.riskSize.setValue(s)):e.riskSize.setValue(t)}}lastBarData(){var e=this._model.mainSeries().bars().firstIndex(),t=this._model.mainSeries().bars().lastIndex();if(null===e||null===t||isNaN(e)||isNaN(t))return null;var i=this.points();if(4===i.length){var s=i[a.ActualClose];return s.index=1){var s=[];if(s.push(this._points[0]),n={price:(n=this._points[0]).price,index:this._getClosePointIndex(n.index)},s.push(n),this._points[1]&&s.push(this._points[1]),this._points[2]&&s.push(this._points[2]),this._points=s,this._timePoint.length>=1){var r=[],n=this._timePoint[0];r.push(n);var o={price:n.price,time_t:n.time_t,offset:this._getClosePointIndex(n.offset)};r.push(o),this._timePoint[1]&&s.push(this._points[1]),this._timePoint[2]&&s.push(this._points[2]),this._timePoint=r}}}checkAlert(){this.recalculate()}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||this._model.paneForSource(this)!==e?null:[this._entryPriceAxisView,this._stopPriceAxisView,this._profitPriceAxisView]}updateAllViews(){this.isActualSymbol()&&this._properties.visible.value()&&(n.hideAllDrawings().value()&&this.userEditEnabled()||(super.updateAllViews(),this._entryPriceAxisView.update(),this._stopPriceAxisView.update(),this._profitPriceAxisView.update()))}restoreExternalState(e){if(h(e.entryPrice)){if(e=Object.assign({},e),!this.isActualSymbol())this._timePoint[0].price=e.entryPrice,delete e.entryPrice;this.properties().merge(e)}else super.restoreExternalState(e)}_changeEntryPoint(e){var t=this.properties().stopPrice.value(),i=this.properties().targetPrice.value(),s=1/this._model.mainSeries().base(),r=Math.min(t,i)+s,n=Math.max(t,i)-s;e.price=Math.max(r,Math.min(n,this._roundPrice(e.price))),super.setPoint(0,e),this.properties().stopPrice.setValue(t),this.properties().targetPrice.setValue(i)}setPoint(e,t,i){if(this.isActualSymbol()){switch(this._muteSyncLineStyle(),e){case 0:this._changeEntryPoint(t);break;case 2:this.properties().stopPrice.setValue(this.preparseStopPrice(t.price));break;case 3:this.properties().targetPrice.setValue(this.preparseProfitPrice(t.price));break;case 1:t.price=this._roundPrice(t.price),super.setPoint(1,t),this.recalculate()}this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}}getPoint(e){switch(e){case 0:return this._points[0];case 1:return{index:this._points[1].index,price:this._points[0].price};case 2:return{index:this._points[0].index,price:this.stopPrice()};case 3:return{index:this._points[0].index,price:this.profitPrice()}}return null}setPoints(e){this._muteSyncLineStyle(),super.setPoints(e),this.recalculate(),this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}syncPriceLevels(){if(this.linkKey().value()){var e=this.properties(),t={entryPrice:e.entryPrice.value(),stopLevel:e.stopLevel.value(),profitLevel:e.profitLevel.value()};n.changeLineStyle({linkKey:this.linkKey().value(),state:t,model:this._model})}}pointsCount(){return 1}name(){return"Risk/Reward"}addPoint(e){e.price=this._roundPrice(e.price),super.addPoint(e,null,!0);var t={price:e.price,index:this._getClosePointIndex(e.index)};super._addPointIntenal(t,null,!0) ;var i=this.calculateActualEntry(e,t);i&&(super._addPointIntenal(i,null,!0),(t=this.findClosePoint(i,t))&&super._addPointIntenal(t,null,!0));return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}setOwnerSource(e){super.setOwnerSource(e),this._model.mainSeries().symbolInfo()&&(this._recalculateAmount(),this._recalculateRiskSize(),this._recalculateQty())}_roundPrice(e){var t=this._model.mainSeries().base();return Math.round(e*t)/t}recalculate(){if(0!==this.points().length){var e=this.properties().targetPrice.value(),t=this.properties().stopPrice.value(),i=[this._points[0],this._points[1]],s=this.calculateActualEntry(this.points()[0],this.points()[1]);if(s){i.push(s);var r=this.findClosePoint(s,this.points()[1]);r&&i.push(r)}this._points=i,e!==this.properties().targetPrice.value()&&this.properties().targetPrice._listeners.fire(this.properties().targetPrice),t!==this.properties().stopPrice.value()&&this.properties().stopPrice._listeners.fire(this.properties().stopPrice)}}start(){super.start(),this.recalculate()}startMoving(e,t,i){e.logical.price=this._roundPrice(e.logical.price),super.startMoving(e,t,i)}move(e,t,i){e.logical.price=this._roundPrice(e.logical.price),super.move(e,t,i),this.recalculate(),this._entryPriceAxisView.update()}_correctPoints(e,t){return!!this.isActualSymbol()&&r.prototype._correctPoints.call(this,[e[0],e[1]],t)}entryPrice(){return this.points()[0].price}findClosePoint(e,t){for(var i=this._model.mainSeries().bars(),r=s(i.firstIndex()),n=Math.max(e.index,r),o=s(i.lastIndex()),a=Math.min(o,t.index),l=n;l<=a;l++){var c=i.valueAt(l);if(null!==c){var h=this.checkStopPrice(c);if(null!=h)return{index:l,price:h}}}return null}calculateActualEntry(e,t){var i=this._model.mainSeries().bars();if(i.isEmpty())return null;for(var r=s(i.firstIndex()),n=Math.max(e.index,r),o=e.price,a=s(i.lastIndex()),l=Math.min(a,t.index),c=n;c<=l;c++){var h=i.valueAt(c);if(null!==h&&h[TradingView.HIGH_PLOT]>=o&&h[TradingView.LOW_PLOT]<=o)return{index:c,price:o}}return null}axisPoints(){if(!this._points[a.ActualEntry])return[];var e=this._points[a.ActualEntry],t=null;if(4===this._points.length)t=this._points[a.ActualClose];else{var i=this.lastBarData();if(!i)return[];t={index:i.index,price:i.closePrice}}return[e,t]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,57591))).RiskRewardDefinitionsViewModel}template(){var e=this.properties(),t=r.prototype.template.call(this);return t.stopLevel=e.stopLevel.value(),t.profitLevel=e.profitLevel.value(),t}_applyTemplateImpl(e){delete e.targetPrice,delete e.stopPrice,delete e.entryPrice,super._applyTemplateImpl(e);var t=this.properties();void 0!==e.stopLevel&&t.stopLevel.setValue(e.stopLevel),void 0!==e.profitLevel&&t.profitLevel.setValue(e.profitLevel)}getOrderTemplate(){return null}_propertiesStateExclusions(){return["entryPrice","stopPrice","targetPrice"]}static _configureProperties(e){r._configureProperties(e),e.addExclusion("stopLevel"),e.addExclusion("profitLevel"),e.addExclusion("stopPrice"), e.addExclusion("targetPrice"),e.addExclusion("entryPrice")}_getClosePointIndex(e){var t=this._model.timeScale(),i=Math.round(t.width()/t.barSpacing());return e+Math.max(3,Math.round(.15*i))}}u.version=2;class p extends u{constructor(e,t,i){super(e,t||p.createProperties(),i);var s=this.properties();s.entryPrice.subscribe(this,this._recalculateQty),s.stopPrice.subscribe(this,this._recalculateQty),s.riskSize.subscribe(this,this._recalculateQty),s.entryPrice.subscribe(this,this._recalculateAmount),s.profitLevel.subscribe(this,this._recalculateAmount),s.stopLevel.subscribe(this,this._recalculateAmount),s.accountSize.subscribe(this,this._recalculateAmount),s.riskSize.subscribe(this,this._recalculateAmount),s.qty.subscribe(this,this._recalculateAmount)}_recalculateQty(){if(0!==this.points().length){var e=this.properties(),t=e.entryPrice.value(),i=e.stopPrice.value(),s=e.riskSize.value(),r=this._model.mainSeries().pointValue(),n=s/(Math.abs(i-t)*r);e.qty.setValue(n)}}_recalculateAmount(){if(0!==this.points().length){var e=this.properties(),t=e.accountSize.value(),i=e.entryPrice.value(),s=e.qty.value(),r=e.stopPrice.value(),n=e.targetPrice.value(),o=this._model.mainSeries().pointValue(),a=this._roundValue(t+(i-n)*s*o),l=this._roundValue(t-(r-i)*s*o);e.amountTarget.setValue(a),e.amountStop.setValue(l)}}name(){return"Risk/Reward short"}stopPrice(){return this.entryPrice()+this.properties().stopLevel.value()/this._model.mainSeries().base()}profitPrice(){return this.entryPrice()-this.properties().profitLevel.value()/this._model.mainSeries().base()}calculatePL(e){return this.entryPrice()-e}preparseStopPrice(e){e=this._roundPrice(e);var t=this.entryPrice()+1/this._model.mainSeries().base();return Math.max(e,t)}preparseProfitPrice(e){e=this._roundPrice(e);var t=this.entryPrice()-1/this._model.mainSeries().base();return Math.min(e,t)}checkStopPrice(e){var t=this.stopPrice(),i=this.profitPrice();return e[TradingView.HIGH_PLOT]>=t?this.stopPrice():e[TradingView.LOW_PLOT]<=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}static createProperties(e){var t=new o("linetoolriskrewardshort",e);return p._configureProperties(t),t}static _configureProperties(e){u._configureProperties(e)}}class _ extends u{constructor(e,t,i){super(e,t||_.createProperties(),i);var s=this.properties();s.entryPrice.subscribe(this,this._recalculateQty),s.stopPrice.subscribe(this,this._recalculateQty),s.riskSize.subscribe(this,this._recalculateQty),s.entryPrice.subscribe(this,this._recalculateAmount),s.profitLevel.subscribe(this,this._recalculateAmount),s.stopLevel.subscribe(this,this._recalculateAmount),s.accountSize.subscribe(this,this._recalculateAmount),s.riskSize.subscribe(this,this._recalculateAmount),s.qty.subscribe(this,this._recalculateAmount)}_recalculateQty(){if(0!==this.points().length){var e=this.properties(),t=e.entryPrice.value(),i=e.stopPrice.value(),s=e.riskSize.value(),r=this._model.mainSeries().pointValue(),n=s/(Math.abs(t-i)*r);e.qty.setValue(n)}}_recalculateAmount(){if(0!==this.points().length){ var e=this.properties(),t=e.accountSize.value(),i=e.entryPrice.value(),s=e.qty.value(),r=e.stopPrice.value(),n=e.targetPrice.value(),o=this._model.mainSeries().pointValue(),a=this._roundValue(t+(n-i)*s*o),l=this._roundValue(t-(i-r)*s*o);e.amountTarget.setValue(a),e.amountStop.setValue(l)}}stopPrice(){return this.entryPrice()-this.properties().stopLevel.value()/this._model.mainSeries().base()}profitPrice(){return this.entryPrice()+this.properties().profitLevel.value()/this._model.mainSeries().base()}calculatePL(e){return e-this.entryPrice()}preparseStopPrice(e){e=this._roundPrice(e);var t=this.entryPrice()-1/this._model.mainSeries().base();return Math.min(e,t)}preparseProfitPrice(e){e=this._roundPrice(e);var t=this.entryPrice()+1/this._model.mainSeries().base();return Math.max(e,t)}checkStopPrice(e){var t=this.stopPrice(),i=this.profitPrice();return e[TradingView.LOW_PLOT]<=t?this.stopPrice():e[TradingView.HIGH_PLOT]>=i?this.profitPrice():null}name(){return"Risk/Reward long"}_orderSide(){throw new Error("not supported")}static createProperties(e){var t=new o("linetoolriskrewardlong",e);return _._configureProperties(t),t}static _configureProperties(e){u._configureProperties(e)}}t.LineToolRiskRewardLong=_,t.LineToolRiskRewardShort=p},96312:(e,t,i)=>{"use strict";var s=i(72927).Point,r=i(89684).distanceToLine,n=i(76117).LineDataSource,o=i(11092).DefaultProperty,a=i(39096).LineToolColorsProperty;class l extends n{constructor(e,t){super(e,t||l.createProperties()),i.e(1583).then(i.t.bind(i,57414,19)).then(({RotatedRectanglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){var i=this._getPaneViews()[0],s=i._points[0],n=i._points[1],o=i._points[2];this._distance=r(s,n,o).distance}}setPoint(e,t,i){if(super.setPoint(e,t,i),0===e||1===e){var r=this._getPaneViews()[0];r.update();var n=r._points[0],o=r._points[1].subtract(n),a=new s(o.y,-o.x).normalized().scaled(this._distance),l=n.add(a),c=this.screenPointToPoint(l);this._points[2]=c}}endChanging(e,t){delete this._distance,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Rotated Rectangle"}hasEditableCoordinates(){return!1}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,32454))).GeneralFiguresDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o("linetoolrotatedrectangle",e);return l._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e),e.addChild("linesColors",new a([e.color]))}}t.LineToolRotatedRectangle=l},78124:(e,t,i)=>{"use strict";var s=i(81773),r=i(70799).LineToolPitchfork;class n extends r{constructor(e,t){super(e,t||n.createProperties())}name(){return"Modified Schiff Pitchfork"}static createProperties(e){var t=new s("linetoolschiffpitchfork",e,!1,{range:[0,8]});return n._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e)}}t.LineToolSchiffPitchfork=n},14444:(e,t,i)=>{"use strict" ;var s=i(81773),r=i(70799).LineToolPitchfork;class n extends r{constructor(e,t){super(e,t||n.createProperties())}name(){return"Schiff Pitchfork"}static createProperties(e){var t=new s("linetoolschiffpitchfork2",e,!1,{range:[0,8]});return n._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e)}}t.LineToolSchiffPitchfork2=n},6789:(e,t,i)=>{"use strict";i.d(t,{LineToolSignpost:()=>y});var s=i(79881),r=i(11092),n=i(76117),o=i(674),a=i.n(o),l=i(28994),c=i(5729),h=i.n(c);class d{constructor(e){this._image=null,this._currentImageURL=null,this._imageReady=!1,this._ready=new(h()),this._source=e,this.updateImage()}updateImage(){const e=this.imageURL();this._currentImageURL!==e&&(this._currentImageURL=e,this._image=null,this._imageReady=!1,null!==this._currentImageURL&&(this._image=new Image,this._image.onload=()=>{this._imageReady=!0,this._ready.fire()},this._image.crossOrigin="anonymous",this._image.src=this._currentImageURL))}itemIndex(){return 1}labelIndex(){return 0}image(){return this._imageReady&&this.showPlate()?this._image:null}showPlate(){return this._props().childs().showImage.value()}backgroundPlateColor(e){return this._props().childs().plateColor.value()}ready(){return this._ready}type(){return this._props().childs().itemType.value()}category(){return 1}index(){const e=this._source.points();return 0===e.length?null:e[0].index}imageURL(){const e=this._props().childs().emoji.value();return(0,l.getTwemojiUrl)(e,"png")||null}sourceImage(){return null}additionalImageURL(){return null}additionalImageSource(){return null}name(){return""}headline(){return this._props().childs().text.value()}text(){return""}fullTextAst(){return null}position(){return this._props().childs().position.value()}fontSize(){return this._props().childs().fontSize.value()}fontBold(){return this._props().childs().bold.value()}fontItalic(){return this._props().childs().italic.value()}sourceLabel(){return null}_props(){return this._source.properties()}}class u extends(a()){constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,()=>this.listeners().fire(this)),e.pointChanged().subscribe(this,()=>this.listeners().fire(this))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),this.listeners().fire(this),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1})}}var p=i(54388);class _ extends p.LineDataSourcePointIndexProperty{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}var m=i(39096),g=i(16282),f=i(71233),v=i(15521);class S extends n.LineDataSource{constructor(){super(...arguments),this._startMovingAnchorY=NaN}priceSource(){return this.ownerSource()}addPoint(e,t,i){return super.addPoint(this._updatePositionAndCorrectPoint(e),t,i)}setPoint(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!this.isPhantom()&&!this._allowChangeAnchorHorizontally()),i), this._syncPosition()}setPointAndChangeIndex(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!1),i),this._syncPosition()}startMoving(e,t,i,s){s||(this._startMovingAnchorY=(0,g.ensureNotNull)(this._anchorYCoordinate())),super.startMoving(e,t,i)}move(e,t,i,s){var r;const n=(0,g.ensureDefined)((0,g.ensureNotNull)(this.startMovingPoint()).logical),o=(0,g.ensureDefined)(e.logical);if(!s&&0===t){const e=this._points[0],t=o.index-n.index,i=(0,g.ensureNotNull)(this.priceScale()),s=(0,g.ensure)(null===(r=this.ownerSource())||void 0===r?void 0:r.firstValue()),a=i.priceToCoordinate(o.price,s)-i.priceToCoordinate(n.price,s),l=this._startMovingAnchorY+a,c=i.coordinateToPrice(l,s);this._updatePositionAndCorrectPoint({index:e.index+t,price:c})}super.move(e,t,i),s||this._syncPosition()}_allowChangeAnchorHorizontally(){return!1}_updatePositionAndCorrectPoint(e,t){t&&(e.index=this._points[0].index);const i=this.priceSource();if(null===i)return e;const s=i.priceScale(),r=i.firstValue();if(null===s||s.isEmpty()||null===r)return e;const n=s.height();let o=n/2,a=e.price>=s.coordinateToPrice(o,r)?1:-1;const l=this._model.mainSeries();if(i===l){const t=l.data().search(this._baseSeriesIndexForPoint(e));if(null!==t){const i=(0,f.seriesPrice)(l,t,-1),n=(0,f.seriesPrice)(l,t,1);a=e.price>=i?1:-1,o=s.priceToCoordinate(1===a?n:i,r),e.price=1===a?Math.max(n,e.price):e.price}}const c=1===(-1===a!==s.isInverted()?-1:1)?o:n-o,h=s.priceToCoordinate(e.price,r),d=Math.min(n,Math.abs(h-o)),u=Math.max(0,Math.min(100,100*d/c))*a;return this.properties().childs().position.setValue(u),e}_baseSeriesIndexForPoint(e){return e.index}_syncPosition(){const e=this.linkKey().value();if(null!==e){const t={position:this.properties().childs().position.value()};(0,v.changeLineStyle)({linkKey:e,state:t,model:this._model})}}_anchorYCoordinate(){const e=this.priceSource();if(null===e)return null;const t=e.priceScale(),i=e.firstValue();if(null===t||t.isEmpty()||null===i)return null;const s=this._model.mainSeries(),r=this.customEvent();if(null===r)return null;let n=null;if(e===s&&(n=(0,f.seriesBasePosition)(s,r)),null===n&&(n=(0,f.noDataBasePosition)(r,t,i)),null===n)return null;const o=r.position(),a=t.priceToCoordinate(n.price,i);return(0,f.positionToCoordinate)(o,t.height(),a,(0,f.positionVisualDirection)(o,t.isInverted()))}}class y extends S{constructor(e,t){const s=t||y.createProperties();super(e,s),this._item=new d(this),this.properties().childs().emoji.subscribe(this,()=>this._item.updateImage()),this._item.ready().subscribe(this,()=>this._model.updateSource(this)),i.e(1583).then(i.bind(i,21857)).then(t=>{this._setPaneViews([new t.SignpostPaneView(this,e)])})}isItemHovered(e){return!1}isItemSelected(e){return!1}isHidden(e){return!1}items(){return[this.customEvent()]}priceSource(){return this.ownerSource()}pointsCount(){return 1}name(){return"Signpost"}customEvent(){return this._item}showInObjectTree(){return!this.isPhantom()&&super.showInObjectTree()}isPhantom(){return this._model.isPhantomLine(this)}clonePositionOffset(){return{barOffset:1, xCoordOffset:0,yCoordOffset:0}}template(){const e=super.template(),t=this.properties().childs();return e.text=t.text.value(),e.position=t.position.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetoolsignpost",e);return y._configureProperties(t),t.hasChild("text")||t.addChild("text",new(a())((0,s.t)("Text"))),t.hasChild("position")||t.addChild("position",new(a())(50)),t.addExclusion("text"),t.addExclusion("position"),t.addChild("backgroundsColors",new m.LineToolColorsProperty([t.childs().plateColor])),t}_createPointProperty(e){super._createPointProperty(e);const t=this._pointsProperty.childs().points[e];t.removeProperty("price"),t.removeProperty("bar"),t.addChild("price",new u(this)),t.addChild("bar",new _(this,0))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text),this.properties().childs().position.setValue(e.position)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,69172)).then(e=>e.SignpostDefinitionsViewModel)}static _configureProperties(e){n.LineDataSource._configureProperties(e)}}y.supportPhantomMode=!0},39447:(e,t,i)=>{"use strict";i.d(t,{LineToolSineLine:()=>n});var s=i(11092),r=i(76117);class n extends r.LineDataSource{constructor(e,t){super(e,t||n.createProperties()),i.e(1583).then(i.bind(i,69486)).then(e=>{this._setPaneViews([new e.SineLinePaneView(this,this._model)])})}pointsCount(){return 2}name(){return"Sine Line"}static createProperties(e){const t=new s.DefaultProperty("linetoolsineline",e);return n._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,60468))).CyclicAndSineLinesPatternDefinitionsViewModel}static _configureProperties(e){r.LineDataSource._configureProperties(e)}}},17175:(e,t,i)=>{"use strict";i.d(t,{StudyLineDataSource:()=>f});var s=i(16282),r=i(47903),n=i(61627),o=i(76117),a=i(11092),l=i(85062),c=i.n(l),h=i(19625),d=i(30875),u=i(7171),p=i(28676),_=i(39951),m=i(84540),g=i(63059);class f extends o.LineDataSource{constructor(e,t,s,r){super(e,r),this._indexes=null,this._inputs=null,this._pointsetPoints=null,this._loadedPlots=null,this._loadedGraphics=null,this._beingCreatedPaneView=null,this._anchorsPaneView=null,this._definitionsViewModel=null,this._alignerCache=null,Promise.all([i.e(1583).then(i.bind(i,69473)),i.e(1583).then(i.bind(i,70014))]).then(t=>{const{LineToolBeingCreatedPaneView:i}=t[0],{StudyLineDataSourceAnchorsPaneView:s}=t[1];this._beingCreatedPaneView=new i(this,e),this._anchorsPaneView=new s(this,this.model()),this._model.lightUpdate()}),this._metaInfo=t,this._dataSource=new u.StudyDataSource(e.chartApi(),e.mainSeries().seriesSource(),s,t),this._dataSource.dataCleared().subscribe(this,this._onDataCleared),this._dataSource.dataUpdated().subscribe(this,this._onDataUpdated)}destroy(){this._dataSource.dataUpdated().unsubscribe(this,this._onDataUpdated),this._dataSource.dataCleared().unsubscribe(this,this._onDataCleared),this._dataSource.destroy(), null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._unsubscribeApplyInputsOnSeriesCompleted(),this._isDestroyed=!0,super.destroy()}stop(){super.stop(),this._isDestroyed||(this._dataSource.stop(),this.clearData())}start(){super.start(),this._isDestroyed||null===this._inputs||this._dataSource.start()}metaInfo(){return this._metaInfo}graphicsInfo(){return this._metaInfo.graphics}series(){return this._model.mainSeries()}translatedType(){return this._metaInfo.description}name(){return this._metaInfo.description}studyId(){return this._metaInfo.id}setPoint(e,t,i){super.setPoint(e,this._preparePoint(t,i))}move(e){}clearData(){this._clearAllDataExceptPointsetPoints(),this._pointsetPoints=null,this.updateAllViews()}data(){return this.plots()}plots(){return this._loadedPlots||this._dataSource.plots()}graphics(){return this._loadedGraphics||this._dataSource.graphics()}firstValue(){return this._model.mainSeries().firstValue()}state(e){const t=super.state(e);let i;this.metaInfo()instanceof c()?i=this.metaInfo().state():(i=(0,r.clone)(this.metaInfo()),i.id=c().parseIdString(i.id+(i.version?"-"+i.version:"")).fullId);const s={...t,metaInfo:i};return e&&(s.data=this.plots().state(),s.nonseriesindexes=this._indexes,s.graphics=(0,h.saveStudyGraphics)(this.graphics())),s}restoreData(e){var t;void 0!==e.data&&(this._loadedPlots=new n.PlotList((0,p.studyPlotFunctionMap)(this._metaInfo),p.studyEmptyPlotValuePredicate),this._loadedPlots.restoreState(e.data)),this._indexes=null!==(t=e.nonseriesindexes)&&void 0!==t?t:this._indexes,this._loadedGraphics=e.graphics?(0,h.loadStudyGraphics)(e.graphics):this._loadedGraphics}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then(e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel)):Promise.resolve(this._definitionsViewModel)}paneViews(e){let t=[];if(this.isSourceHidden())return t;if(this._isReady()&&this._changeStatesStack.isEmpty()){const i=super.paneViews(e);null!==i&&(t=t.concat(i))}else null!==this._beingCreatedPaneView&&t.push(this._beingCreatedPaneView);return null!==this._anchorsPaneView&&t.push(this._anchorsPaneView),t}propertiesChanged(e){super.propertiesChanged(e),this._onStudyInputsMayChange()}dataAndViewsReady(){return super.dataAndViewsReady()&&this._isReady()}endChanging(e,t){const i=super.endChanging(e,t);return i.indexesChanged?this.clearData():this._updateAnchorsPrice(!0),i}moveData(e){this._dataSource.moveData(e)}restorePoints(e,t,i){super.restorePoints(e,t,i),this._updateAnchorsPrice(!0)}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,_.prepareStudyPropertiesForLoadChart)(e,t,i,null,s);return f._configureProperties(r),r}_studyId(){return this._dataSource.studyId()}_isReady(){return!0}_updateAllPaneViews(){var e,t;super._updateAllPaneViews(),null===(e=this._beingCreatedPaneView)||void 0===e||e.update(), null===(t=this._anchorsPaneView)||void 0===t||t.update()}_getPointTime(e,t){const i=e.index,s=this._model.timeScale().indexToTimePoint(i);if(null!==s)return s;if(t||void 0===e.time)return null;const r=this._model.mainSeries().symbolInfo();if(null===r)return null;let n=this._model.properties().childs().timezone.value();"exchange"===n&&(n=r.timezone);const o=(0,m.cal_to_utc)((0,m.get_timezone)(n),e.time);return this._getStartBarAligner()(o)/1e3}_updateAnchorsPrice(e){}_onPointsetUpdated(e){super._onPointsetUpdated(e),this._pointsetPoints=this._points.map(e=>({price:e.price,index:e.index,time:e.time})),this._onStudyInputsMayChange()}_onDataCleared(){this.updateAllViews(),this._model.updateSource(this)}_onDataUpdated(e,t,i){this._updateAnchorsPrice(),this.updateAllViews(),this._model.updateSource(this)}_onStudyInputsMayChange(){let e=null;null!==this._pointsetPoints&&this._pointsetPoints.length===this.pointsCount()&&(e=this._studyInputs(this._pointsetPoints),null===e&&(this._clearAllDataExceptPointsetPoints(),this.updateAllViews())),this._areInputsEqual(this._inputs,e)||this._applyStudyInputs(e)}_onMainSeriesSymbolResolved(){super._onMainSeriesSymbolResolved(),this._alignerCache=null}_preparePoint(e,t){return super._preparePoint(this._alignPointToRangeOfActualData(e),t)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_subscribeApplyInputsOnSeriesCompleted(){this._unsubscribeApplyInputsOnSeriesCompleted(),this._model.mainSeries().dataEvents().completed().subscribe(this,()=>this._onStudyInputsMayChange(),!0)}_unsubscribeApplyInputsOnSeriesCompleted(){this._model.mainSeries().dataEvents().completed().unsubscribeAll(this)}_onInputsChanged(){0}static _createPropertiesFromStudyIdAndState(e,t){const i=c().getStudyPropertyRootNameById(e),s=new a.DefaultProperty(i,t);return f._configureProperties(s),s}static _createPropertiesFromStudyMetaInfo(e,t){const i=(0,_.prepareStudyProperties)(e,null,null,t);return f._configureProperties(i),i}static _configureProperties(e){o.LineDataSource._configureProperties(e)}_areInputsEqual(e,t){return null===t?null===e:null!==e&&(0,d.areStudyInputsEqual)(this._metaInfo.inputs,e,t)}_applyStudyInputs(e){const t=this._inputs;this._inputs=e,null!==e&&(this._unsubscribeApplyInputsOnSeriesCompleted(),this._dataSource.setInputs(e),null===t&&this.isStarted()&&!this._dataSource.isStarted()&&this._dataSource.start()),this._onInputsChanged()}_clearAllDataExceptPointsetPoints(){this._inputs=null,this._dataSource.clearData(),this._loadedPlots=null,this._indexes=null,this._loadedGraphics=null}_getStartBarAligner(){const e=this._model.mainSeries().interval();return null!==this._alignerCache&&this._alignerCache.resolution===this._model.mainSeries().interval()||(this._alignerCache={resolution:e,aligner:(0,g.createTimeToBarTimeAligner)(e,(0,s.ensureNotNull)(this._model.mainSeries().symbolInfo()))}),this._alignerCache.aligner}}},60598:(e,t,i)=>{"use strict";i.d(t,{LineToolText:()=>d,LineToolTextAbsolute:()=>u});var s=i(16282),r=i(72927),n=i(79881),o=i(76117),a=i(674),l=i.n(a),c=i(11092),h=i(39096) ;class d extends o.LineDataSource{constructor(e,t){const s=t||d.createProperties();super(e,s),this._barSpacing=e.timeScale().barSpacing(),this._recalculatePointsOnCenter=!1,i.e(1583).then(i.bind(i,15253)).then(({TextPaneView:t})=>{const i=this._recalculatePointsOnCenter?(e,t)=>{this._recalculatePointsOnCenter&&this._recalculateCenterPosition(e,t)}:void 0;this._setPaneViews([new t(this,e,void 0,void 0,void 0,void 0,void 0,i)])})}centerPosition(){this._recalculatePointsOnCenter=!0}setPoint(e,t,i){const s=this.properties().childs();let r;if(1===e&&s.wordWrapWidth.value()){const e=this.model().timeScale();r=this.isFixed()?this.fixedPoints()[0].x:e.indexToCoordinate(this.points()[0].index);const i=e.indexToCoordinate(t.index)-r-~~(s.fontsize.value()/6);if(!isFinite(i))return;s.wordWrapWidth.setValue(Math.max(100,i))}}pointsCount(){return 1}name(){return"Text"}setPriceScale(e){super.setPriceScale(e),e&&e.priceRange()&&(this._priceDencity=e.height()/(0,s.ensureNotNull)(e.priceRange()).length(),this._isPriceDencityLog=e.isLog())}restoreSize(){const e=(0,s.ensureNotNull)(this.priceScale());this._barSpacing=this.model().timeScale().barSpacing(),this._priceDencity=e.height()/(0,s.ensureNotNull)(e.priceRange()).length(),this.redraw()}redraw(){this.updateAllViews(),this._model.updateSource(this)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}state(e){const t=super.state(e);return e&&(t.state.fixedSize=!1),t}barSpacing(){return this._barSpacing}priceDencity(){return this._priceDencity}isPriceDencityLog(){return this._isPriceDencityLog}hasEditableCoordinates(){return!1}static createProperties(e){const t=new c.DefaultProperty("linetooltext",e);return d._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,74146)).then(e=>e.TextDefinitionsViewModel)}static _configureProperties(e){o.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(l())((0,n.t)("Text"))),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new h.LineToolColorsProperty([e.childs().color])),e.addExclusion("text"),e.addExclusion("linesColors"),e.addExclusion("textsColors")}_recalculateCenterPosition(e,t){const i=this.isFixed()?this.fixedPoints()[0]:(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),n=new r.Point(i.x-e/2,i.y-t/2),o=(0,s.ensureNotNull)(this.screenPointToPoint(n));this.setPoints([o]),this.normalizePoints(),this.createServerPoints(),this.redraw()}}class u extends d{constructor(e,t){super(e,t||u.createProperties())}name(){return"Anchored Text"}hasEditableCoordinates(){return!1}isFixed(){return!0}static createProperties(e){const t=new c.DefaultProperty("linetooltextabsolute",e);return u._configureProperties(t),t}static _configureProperties(e){d._configureProperties(e)}}},69066:(e,t,i)=>{"use strict";i.d(t,{LineToolThreeDrivers:()=>o}) ;var s=i(11092),r=i(76117),n=i(39096);class o extends r.LineDataSource{constructor(e,t){const s=t||o.createProperties();super(e,s),i.e(1583).then(i.bind(i,10319)).then(t=>{this._setPaneViews([new t.LineToolThreeDrivesPaneView(this,e)])})}pointsCount(){return 7}name(){return"Three Drives Pattern"}static createProperties(e){const t=new s.DefaultProperty("linetoolthreedrivers",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,39942)).then(e=>e.PatternWithoutBackgroundDefinitionsViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors")}}},56290:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e(1583).then(i.t.bind(i,24216,19)).then(({TimeCyclesPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Time Cycles"}setPoint(e,t,i){var s=Object.assign({},t),r=this._points[0],n=this._points[1];r.price=s.price,n.price=s.price,this._points[e]=s,this.normalizePoints()}addPoint(e,t,i){var r=s.prototype.addPoint.call(this,e,t,!0);if(r){var n=this._points[0];this._points[1].price=n.price,i||(this.normalizePoints(),this.createServerPoints())}return r}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,48549))).TimeCyclesPatternDefinitionsViewModel}static createProperties(e){var t=new r("linetooltimecycles",e);return n._configureProperties(t),t}static _configureProperties(e){s._configureProperties(e)}}t.LineToolTimeCycles=n},61834:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(75496).fixComputationError;class n extends s{constructor(e,t){super(e,t),this.customization.forcePriceAxisLabel=!0,this.customization.disableErasing=!0,this.customization.showInObjectsTree=!1,this.setSelectionEnabled(!1)}isSynchronizable(){return!1}pointsCount(){return n.POINTS_COUNT}hasContextMenu(){return!1}state(){return null}startMoving(){s.prototype.startMoving.apply(this,arguments),this._cursorMoved=!1}endMoving(){s.prototype.endMoving.apply(this,arguments),this._cursorMoved=!1}_correctPoints(e,t){this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price&&(this._cursorMoved=!0):this._cursorMoved=!1;for(var i=1/this.priceScale().mainSource().base(),s=0;s{"use strict";var s=i(674),r=i(72927).Point,n=i(76117).LineDataSource,o=i(11092).DefaultProperty;class a extends s{constructor(e){super(),this._lineSource=e}value(){var e=180*this._lineSource._angle/Math.PI;return Math.round(e)}setValue(e){var t=e*Math.PI/180;this._lineSource._angle=t;var i=this._lineSource.pointToScreenPoint(this._lineSource.points()[0]),s=Math.cos(this._lineSource._angle),n=-Math.sin(this._lineSource._angle),o=new r(s,n),a=i.addScaled(o,this._lineSource._distance),l=this._lineSource.screenPointToPoint(a);this._lineSource._points[1]=l,this._lineSource._model.updateSource(this._lineSource),this._lineSource.updateAllViews(),this._lineSource._model.updateSource(this._lineSource)}}class l extends n{constructor(e,t){super(e,t||l.createProperties()),this._properties.addChild("angle",new a(this)),i.e(1583).then(i.t.bind(i,10854,19)).then(({TrendAnglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}isSynchronizable(){return!1}pointsCount(){return 2}name(){return"Trend Angle"}_calculateAngle(){var e=this.pointToScreenPoint(this.points()[0]),t=this.pointToScreenPoint(this.points()[1]),i=t.subtract(e);i.length()>0?(i=i.normalized(),this._angle=Math.acos(i.x),i.y>0&&(this._angle=-this._angle),this._distance=t.subtract(e).length()):delete this._angle,this.properties().hasOwnProperty("angle")&&this.properties().angle.listeners().fire(this.properties().angle)}addPoint(e,t){var i=n.prototype.addPoint.call(this,e,t);return i&&this._calculateAngle(),i}setLastPoint(e,t){var i=super.setLastPoint(e,t);return this.points().length>1&&this._calculateAngle(),i}axisPoints(){if(this.points().length<2)return[];var e=[this.points()[0]],t=this.pointToScreenPoint(this.points()[0]),i=Math.cos(this._angle)*this._distance,s=-Math.sin(this._angle)*this._distance,n=t.add(new r(i,s)),o=this.screenPointToPoint(n);return e.push(o),e}setPoint(e,t,i){super.setPoint(e,t,i),this.points().length>1&&1===e&&this._calculateAngle()}restoreData(e){this._angle=e.angle,this._distance=e.distance}state(e){var t=n.prototype.state.call(this,e);return t.angle=this._angle,t.distance=this._distance,t}cloneData(e){this._angle=e._angle,this._distance=e._distance}canHasAlert(){return!0}_getAlertPlots(){return[this._linePointsToAlertPlot(this._points,null,this.properties().extendLeft.value(),this.properties().extendRight.value())]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,27138))).TrendAngleDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o("linetooltrendangle",e);return l._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e)}}t.LineToolTrendAngle=l},13768:(e,t,i)=>{"use strict" ;var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),this.version=d.version,i.e(1583).then(i.t.bind(i,67390,19)).then(({TrendBasedFibExtensionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 3}name(){return"Trend-Based Fib Extension"}migrateVersion(e,t,i){1===e&&this.properties().extendLines.setValue(!0)}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}static createProperties(e){var t=new o("linetooltrendbasedfibextension",e,!1,{range:[0,8]});return d._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,58481))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){n._configureProperties(e);for(var t=[e.child("trendline").child("linewidth"),e.child("levelsStyle").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=d.LevelsCount;s++)i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}fibLevelsBasedOnLogScale(){return this.properties().fibLevelsBasedOnLogScale.value()&&this.priceScale().isLog()}}d.version=2,d.LevelsCount=24,t.LineToolTrendBasedFibExtension=d},97835:(e,t,i)=>{"use strict";var s=i(79881).t,r=i(90963).TranslatedString,n=i(76117).LineDataSource,o=i(81773),a=i(39096),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new r("erase level line",s("erase level line"));class d extends n{constructor(e,t){super(e,t||d.createProperties()),this.version=d.version,i.e(1583).then(i.t.bind(i,8287,19)).then(({TrendBasedFibTimePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}levelsCount(){return d.LevelsCount}pointsCount(){return 3}name(){return"Trend-Based Fib Time"}migrateVersion(e,t,i){}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,72487))).TrendBasedFibTimeDefinitionsViewModel}static createProperties(e){var t=new o("linetooltrendbasedfibtime",e,!1,{range:[1,11]});return d._configureProperties(t),t}static _configureProperties(e){n._configureProperties(e);for(var t=[e.child("trendline").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=d.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=11,d.version=1,t.LineToolTrendBasedFibTime=d},12565:(e,t,i)=>{"use strict";var s=i(674),r=i(76117).LineDataSource,n=i(10100).LineToolPriceAxisView,o=i(11092).DefaultProperty;class a extends r{constructor(e,t){super(e,t||a.createProperties()),this._trendLinePaneView=null, i.e(1583).then(i.t.bind(i,45127,19)).then(({TrendLinePaneView:e})=>{this._trendLinePaneView=new e(this,this._model),this._setPaneViews([this._trendLinePaneView])})}dataAndViewsReady(){return r.prototype.dataAndViewsReady.call(this)&&this._trendLinePaneView&&this._trendLinePaneView.iconsReady()}stop(){super.stop()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new n(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}_getAlertPlots(){return[this._linePointsToAlertPlot(this._points,null,this.properties().extendLeft.value(),this.properties().extendRight.value())]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,74231))).TrendLineDefinitionsViewModel}template(){var e=r.prototype.template.call(this);return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o("linetooltrendline",e);return a._configureProperties(t),t}static _configureProperties(e){r._configureProperties(e),e.hasChild("text")||e.addChild("text",new s("")),e.addExclusion("text")}}t.LineToolTrendLine=a},89938:(e,t,i)=>{"use strict";i.d(t,{LineToolTrianglePattern:()=>o});var s=i(11092),r=i(76117),n=i(39096);class o extends r.LineDataSource{constructor(e,t){const s=t||o.createProperties();super(e,s),i.e(1583).then(i.bind(i,90137)).then(t=>{this._setPaneViews([new t.LineToolTrianglePatternPaneView(this,e)])})}pointsCount(){return 4}name(){return"Triangle Pattern"}static createProperties(e){const t=new s.DefaultProperty("linetooltrianglepattern",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,84377)).then(e=>e.PatternWithBackgroundDefinitionViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor]))}}},48650:(e,t,i)=>{"use strict";var s=i(76117).LineDataSource,r=i(11092).DefaultProperty,n=i(39096).LineToolColorsProperty;class o extends s{constructor(e,t){super(e,t||o.createProperties()),i.e(1583).then(i.t.bind(i,57984,19)).then(({TrianglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 3}name(){return"Triangle"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,32454))).GeneralFiguresDefinitionsViewModel}static createProperties(e){var t=new r("linetooltriangle",e);return o._configureProperties(t),t} static _configureProperties(e){s._configureProperties(e),e.addChild("linesColors",new n([e.childs().color]))}}t.LineToolTriangle=o},22086:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLineTimeAxisView:()=>r});var s=i(68845);class r extends s.LineDataSourceTimeAxisView{constructor(e){super(e,0)}_getBgColor(){return this._source.properties().linecolor.value()}_getAlwaysInViewPort(){return!1}_getIndex(){const e=this._source.points();return 0===e.length?null:e[0].index}}},60880:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLine:()=>h});var s=i(16282),r=i(72927),n=i(11092),o=i(674),a=i.n(o),l=i(76117),c=i(22086);class h extends l.LineDataSource{constructor(e,t){const s=t||h.createProperties();super(e,s),this._timeAxisView=new c.LineToolVertLineTimeAxisView(this),this._paneViewFactory=null,this.properties().childs().extendLine.subscribe(this,()=>e.lightUpdate()),i.e(1583).then(i.bind(i,73184)).then(t=>{this._paneViewFactory=i=>new t.VertLinePaneView(this,e,i),this._model.lightUpdate()})}destroy(){this.properties().childs().extendLine.unsubscribeAll(this),super.destroy()}pointsCount(){return 1}name(){return"Vertical Line"}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(){super.updateAllViews(),this._timeAxisView.update()}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}isMultiPaneAvailable(){return!0}isMultiPaneEnabled(){return this.properties().childs().extendLine.value()}paneViews(e){return e=(0,s.ensureDefined)(e),this.isMultiPaneEnabled()||this._model.paneForSource(this)===e?(null===this._getPaneViews(e)&&null!==this._paneViewFactory&&this._setPaneViews([this._paneViewFactory(e)],e,!0),super.paneViews(e)):null}priceAxisViews(){return null}priceAxisPoints(){return[]}pointToScreenPoint(e){const t=this._model.timeScale();if(t.isEmpty())return null;const i=t.indexToCoordinate(e.index);return new r.Point(i,0)}convertYCoordinateToPriceForMoving(e){return 0}static createProperties(e){null!=e&&(void 0===e.textOrientation&&(e.textOrientation="horizontal"),void 0===e.extendLine&&(e.extendLine=!1));const t=new n.DefaultProperty("linetoolvertline",e);return h._configureProperties(t),t}_getAlertPlots(){const e=this._points[0],t={index:e.index,price:e.price+1};return[this._linePointsToAlertPlot([e,t],null,!0,!0)]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8680),i.e(7371),i.e(8537)]).then(i.bind(i,30066)).then(e=>e.VerticalLineDefinitionsViewModel)}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){l.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new(a())("")),e.addExclusion("text")}}},65528:(e,t,i)=>{"use strict";i.d(t,{LineToolVbPFixed:()=>d});var s=i(45018),r=i(16282),n=i(345),o=i(17175),a=i(19625),l=i(4600),c=i(47903);const h=(0,n.studyIdString)("VbPFixed","tv-volumebyprice");class d extends o.StudyLineDataSource{constructor(e,t,i,s){ const r=i||e.studyMetaInfoRepository().findByIdSync({type:"java",studyId:h}),n=t||d._createPropertiesFromStudyMetaInfo(r,e.studyVersioning());super(e,r,"vbpfixed_",n),(0,a.createGraphicsPaneViews)(this,e).then(t=>{if(s=e.mainSeries(),r.plots.length>0){const i=new l.StudyPlotPaneView(this,s,e,r.plots[0].id);t.push(i)}if(r.plots.length>1){const i=new l.StudyPlotPaneView(this,s,e,r.plots[1].id);t.push(i)}if(r.plots.length>2){const i=new l.StudyPlotPaneView(this,s,e,r.plots[2].id);t.push(i)}this._setPaneViews(t)}),this.clearData()}pointsCount(){return 2}boundToSymbol(){return!1}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}calcIsActualSymbol(){this._isActualSymbol=!0,this._isActualCurrency=!0,this._isActualUnit=!0,this.calcIsActualInterval()}cloneable(){return!1}isSynchronizable(){return!1}static createProperties(e){const t=super._createPropertiesFromStudyIdAndState(h,e);return d._configureProperties(t),t}static studyId(){return h}_studyInputs(e){(0,r.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e,s=Math.max(t.index,i.index),n=this._model.mainSeries().bars().lastIndex(),o=this._getPointTime(t.index<=i.index?t:i,!0),a=this._getPointTime(i.index>=t.index?i:t,!0);if(null===o||null===a)return this._subscribeApplyInputsOnSeriesCompleted(),null;const l=this.properties().childs();return{rowsLayout:l.inputs.childs().rowsLayout.value(),rows:l.inputs.childs().rows.value(),volume:l.inputs.childs().volume.value(),vaVolume:l.inputs.childs().vaVolume.value(),first_bar_time:1e3*o,last_bar_time:1e3*a,subscribeRealtime:n===s}}_isReady(){return!(0,a.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(5019),i.e(607)]).then(i.bind(i,27051))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews(),this._model.updateSource(this)}_updateAnchors(){const e=this._calculateAnchors();if(!e)return;const[{index:t,price:i},{index:s,price:r}]=e;if(this._timePoint.length&&(this._timePoint[0].price=i,this._timePoint[1].price=r),this._points.length){const e=this.model().timeScale(),n=e.indexToTimePoint(t),o=e.indexToTimePoint(t);this._points[0]={index:t,price:i,time:(0,c.isNumber)(n)?new Date(1e3*n):void 0},this._points[1]={index:s,price:r,time:(0,c.isNumber)(o)?new Date(1e3*o):void 0}}}_calculateAnchors(){let e=null,t=null,i=null,r=null;if(this.graphics().hhists().forEach(s=>{s.forEach(s=>{const{priceLow:n,priceHigh:o,firstBarTime:a,lastBarTime:l}=s;(!e||nt)&&(t=o),(!i||ar)&&(r=l)})}),!((0,s.default)(e)||(0,s.default)(t)||(0,s.default)(r)||(0,s.default)(i)))return[{price:t,index:i},{price:e,index:r}]}_updateAnchorsPrice(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}}},38536:(e,t,i)=>{"use strict";var s;i.d(t,{MagnetMode:()=>s}),function(e){ e[e.WeakMagnet=0]="WeakMagnet",e[e.StrongMagnet=1]="StrongMagnet"}(s||(s={}))},70599:(e,t,i)=>{"use strict";i.d(t,{magnetEnabled:()=>m,magnetMode:()=>g,setIsMagnetEnabled:()=>f,setMagnetMode:()=>v});var s=i(11092),r=i(32856),n=i.n(r),o=i(38536),a=i(15521),l=i(67945),c=i(14734);const h=new(n())(!1),d=new(n())(o.MagnetMode.WeakMagnet),u=(0,c.modifierPressed)(),p=(0,c.shiftPressed)();function _(){const e=u.value();if(p.value()&&(a.isToolEditingNow.value()||a.isToolCreatingNow.value()))return void h.setValue(!1);const t=a.tool.value(),i=a.isStudyEditingNow.value()||a.isPointSelectedNow.value(),s=e&&((0,l.isLineToolName)(t)||a.isToolEditingNow.value()||(0,a.toolIsMeasure)(t)||i),r=(0,a.properties)().childs().magnet.value();d.setValue(!r&&s?o.MagnetMode.StrongMagnet:(0,a.properties)().childs().magnetMode.value()),h.setValue(s?!r:r)}function m(){return h}function g(){return d}function f(e){(0,s.saveDefaultProperties)(!0),(0,a.properties)().childs().magnet.setValue(e),(0,s.saveDefaultProperties)(!1)}function v(e){(0,s.saveDefaultProperties)(!0),(0,a.properties)().childs().magnetMode.setValue(e),(0,a.properties)().childs().magnet.setValue(!0),(0,s.saveDefaultProperties)(!1)}(0,a.runOnDrawingStateReady)(()=>{(0,a.properties)().childs().magnet.subscribe(null,_),(0,a.properties)().childs().magnetMode.subscribe(null,_),u.subscribe(_),p.subscribe(_),a.tool.subscribe(_),a.isToolEditingNow.subscribe(_),_()})},27089:(e,t,i)=>{"use strict";i.d(t,{MainSeriesScaleRatioProperty:()=>n});var s=i(5729),r=i.n(s);class n{constructor(e){this._changed=new(r()),this._model=e}getStepChangeValue(){return.1}getMinValue(){return 1e-7}getMaxValue(){return 99999999}value(){return this._model.mainSeriesScaleRatio()}setValue(e,t){(e!==this.value()||t)&&(this._model.setMainSeriesScaleRatio(e),this._onChanged())}state(){return null}clone(){return new n(this._model)}listeners(){return this._changed}subscribe(e,t){this._changed.subscribe(e,t)}unsubscribe(e,t){this._changed.unsubscribe(e,t)}unsubscribeAll(e){this._changed.unsubscribeAll(e)}storeStateIfUndefined(){return!0}_onChanged(){this._changed.fire(this)}}},66096:(e,t,i)=>{"use strict";i.d(t,{ensureTimePointIndexIndex:()=>n,unpackNonSeriesData:()=>o});var s=i(73211),r=i(16282);function n(e){if(e<0)throw new Error("TimePointIndexIndex should be non-negative integer");return e}async function o(e){if(""===e)return null;const t=JSON.parse(e);if(!(0,s.isObject)(t)||"function"==typeof t)throw new Error("Non-object content in the non-series envelope");if((0,s.hasProperty)(t,"indexes_replace"))return{indexes_replace:!0};const i={indexes_replace:!1};if((0,s.hasProperty)(t,"offsets")&&(i.offsets=t.offsets),(0,s.hasProperty)(t,"isUpdate")){if("boolean"!=typeof t.isUpdate)throw new Error('Invalid type of "isUpdate" field');i.isUpdate=t.isUpdate}return(0,s.hasProperty)(t,"data")&&(i.data=t.data),(0,s.hasProperty)(t,"graphicsCmds")&&(i.graphicsCmds=function(e){if(!(0,s.isObject)(e))throw new Error("Graphics commands should be wrapped in an object");if((0,s.hasProperty)(e,"create"),(0,s.hasProperty)(e,"erase")){ const t=e.erase;(0,r.assert)(Array.isArray(t),"Collection of erase commands should be array");for(const e of t){if(!(0,s.isObject)(e)||!(0,s.hasProperty)(e,"action"))throw new Error("Command should be an object with 'action' property");(0,r.assert)("all"===e.action||"one"===e.action,"Erase command action should be 'all' or 'one'")}}return e}(t.graphicsCmds)),i}},86447:(e,t,i)=>{"use strict";i.d(t,{OverlayPriceAxisView:()=>c});var s=i(27490),r=i(95426),n=i(25436),o=i(84995),a=i(77036);const l=s.enabled("force_exchange_as_title");class c extends r.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.lastValueData("close",!1);if(s.noData)return;const r=this._source.model(),n=this._source.priceScale();if(null===n)return;if(!r.isPriceScaleVisible(n))return;i.background=s.color,i.textColor=this.generateTextColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate;const l=this._source.model().properties().childs().scalesProperties.childs();l.showSeriesLastValue.value()&&(e.text=(0,a.getCurrentModePriceText)(n,s),l.seriesLastValueMode.value()!==o.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,a.getOppositeModePriceText)(n,s),e.visible=!0),t.text="",l.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return l?e=(0,n.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,n.displayedSymbolName)(t)),e}}},6805:(e,t,i)=>{"use strict";i.d(t,{PaneBase:()=>M});var s=i(72927),r=i(16282),n=i(65447),o=i(5729),a=i.n(o),l=i(45259),c=i(21698),h=i(50044),d=i(3092),u=i(67945),p=i(36512);const _=new Map([["price",e=>(0,h.isPriceDataSource)(e)],["trading",e=>(0,u.isTrading)(e)],["drawing",e=>(0,u.isLineTool)(e)&&!(0,u.isTrading)(e)&&!e.isPhantom()],["drawingsForAllSymbols",e=>(0,u.isLineTool)(e)&&!(0,u.isTrading)(e)&&!e.isPhantom()],["phantom",e=>(0,u.isLineTool)(e)&&e.isPhantom()],["restRowSources",e=>!(0,u.isLineTool)(e)&&!(0,u.isTrading)(e)],["leftPriceScale",(e,t)=>"left"===g(e,t)],["rightPriceScale",(e,t)=>"right"===g(e,t)],["overlayPriceScale",(e,t)=>"overlay"===g(e,t)]]),m=new Map([["price","visibleSorted"],["trading","visibleSorted"],["drawing","visibleSorted"],["drawingsForAllSymbols","allSorted"],["phantom","visibleSorted"],["restRowSources","visibleSorted"],["leftPriceScale","visibleSorted"],["rightPriceScale","visibleSorted"],["overlayPriceScale","visibleSorted"]]);function g(e,t){const i=e.priceScale();return null===i?"overlay":t.priceScalePosition(i)}class f{constructor(e){this._groupedSources=new Map,this._sources=null,this._pane=e}clear(){this._groupedSources.clear(),this._sources=null}destroy(){this.clear()}all(){return this._groupedSources.has("visibleSorted")||this._sortSources(),(0,r.ensureDefined)(this._groupedSources.get("visibleSorted"))}allIncludingHidden(){return this._groupedSources.has("allSorted")||this._sortSources(),(0, r.ensureDefined)(this._groupedSources.get("allSorted"))}allExceptSpecialSources(){if(!this._groupedSources.has("exceptSpecial")){const e=this.allIncludingHidden().filter(e=>!e.isSpeciallyZOrderedSource());this._groupedSources.set("exceptSpecial",e)}return(0,r.ensureDefined)(this._groupedSources.get("exceptSpecial"))}tradingSources(){return this._getSourcesByGroupType("trading")}priceSources(){return this._getSourcesByGroupType("price")}lineSources(){return this._getSourcesByGroupType("drawing")}lineSourcesForAllSymbols(){return this._getSourcesByGroupType("drawingsForAllSymbols")}phantomSources(){return this._getSourcesByGroupType("phantom")}allExceptLineAndTradingSources(){return this._getSourcesByGroupType("restRowSources")}hitTestSources(){if(!this._groupedSources.has("hitTest")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("hitTest",e)}return(0,r.ensureDefined)(this._groupedSources.get("hitTest"))}generalSources(){if(!this._groupedSources.has("general")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("general",(0,p.sortSources)(e))}return(0,r.ensureDefined)(this._groupedSources.get("general"))}leftPriceScalesSources(){return this._getSourcesByGroupType("leftPriceScale")}rightPriceScalesSources(){return this._getSourcesByGroupType("rightPriceScale")}overlayPriceScaleSources(){return this._getSourcesByGroupType("overlayPriceScale")}_getSourcesByGroupType(e){const t=(0,r.ensureDefined)(m.get(e));return this._groupedSources.has(t)?this._groupedSources.has(e)||this._groupSources(e):(this._sortSources(),this._groupSources(e)),(0,r.ensureDefined)(this._groupedSources.get(e))}_sortSources(){null===this._sources&&(this._sources=this._pane.dataSources());const e=(0,p.sortSources)(this._sources),t=e.filter(e=>!(0,u.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()&&e.isActualUnit());this._groupedSources.set("allSorted",e),this._groupedSources.set("visibleSorted",t)}_groupSources(e){const t=(0,r.ensureDefined)(m.get(e)),i=_.get(e);if(void 0!==i){const s=(0,r.ensureDefined)(this._groupedSources.get(t)).filter(e=>i(e,this._pane));this._groupedSources.set(e,s)}}}var v=i(56451),S=i(2397),y=i(25303),b=i(17e3),w=i(58007),P=i(40315),C=i(32856),T=i.n(C);const x=(0,n.getLogger)("Chart.Pane");function I(e,t,i){e.setMargins({top:t,bottom:i})}class M{constructor(e,t,i,s){this.m_dataSources=[],this._sourceWatchedValuesSubscriptions=new Map,this.m_mainDataSource=null,this._cachedOrderedSources=new f(this),this._sourcesById=new Map,this._priceSourcesById=new Map,this._sourcePropertiesChanged=new(a()),this._sourcesZOrderChanged=new(a()),this._tagsChanged=new(a()),this._stretchFactor=1e3,this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null,this._rightPriceScales=[],this._leftPriceScales=[],this._lockedPriceScale=null,this._currentPriceScaleRatio=null,this._onPriceScalesChanged=new(a()),this._isRecalculatingScales=!1,this._priceDataSources=[],this._symbolSources=[],this._symbolSourceResolved=new(a()), this._symbolSourceResolvingActive=new(T())(!1),this._bulkActions={activeCounter:0},this._reorderZOrderOnAddingSourceToCollectionAllowed=!0,this._height=0,this._width=0,this._dataSourcesCollectionChanged=new(a()),this._symbolSourceCollectionChanged=new(a()),this._recalcSymbolSourceResolvingActive=()=>{for(const e of this._symbolSources)if(e.symbolResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._onSymbolSourceCollectionChanged=()=>{0===this._bulkActions.activeCounter?this._symbolSourceCollectionChanged.fire():this._bulkActions.symbolSourceCollectionChanged=!0},this._priceScaleSelectionStrategy=(0,d.createPriceScaleSelectionStrategy)(i.properties().childs().priceScaleSelectionStrategyName.value()),this._id=null!=s?s:(0,l.randomHashN)(6)}id(){return this._id}bulkActionMacro(e){const t=this._bulkActions;t.activeCounter+=1,e(),t.activeCounter-=1,0===t.activeCounter&&(this._dataSourcesCollectionChanged.fire(),t.symbolSourceCollectionChanged&&this._symbolSourceCollectionChanged.fire(),t.symbolSourceCollectionChanged=!1)}sourcesByGroup(){return this._cachedOrderedSources}dataSourceForId(e){return this._sourcesById.get(e)||null}changeSourceId(e,t){(0,r.assert)(this.hasDataSource(e));const i=e.id();e.setId(t),this._sourcesById.delete(i),this._sourcesById.set(t,e),(0,h.isPriceDataSource)(e)&&(this._priceSourcesById.delete(i),this._priceSourcesById.set(t,e))}movePriceScale(e,t,i){const s=this.priceScalePosition(e);if(s!==t)this.removePriceScale(e),this._placePriceScale(e,t,i),e.invalidateMargins(),this._invalidateSourcesCache();else if(void 0!==i&&"overlay"!==s){const t="left"===s?this._leftPriceScales:this._rightPriceScales,r=t.indexOf(e);t.splice(r,1),t.splice(i,0,e)}}isEmpty(){return null===this.m_mainDataSource}recalculatePriceScale(e){if(!e)return;const t=e.sourcesForAutoscale();if((e.isAutoScale()||e.priceRangeShouldBeRecalculatedOnce())&&t&&t.length>0&&!this.timeScale().isEmpty()){const t=this.timeScale().visibleBarsStrictRange();e.recalculatePriceRange(t)}e.updateAllViews()}onSourceTagsChanged(){this._tagsChanged.fire()}insertDataSource(e,t,i){e.setZorder(i),t||(t=this.findSuitableScale(e)),this._addSourceToCollections(e);let s=!1;(e===this.model().mainSeries()||null===this.m_mainDataSource)&&(this.m_mainDataSource=e,s=!0),t.addDataSource(e,this._isInInsertManyDataSourcesState),e.setPriceScale(t),t.invalidateMargins(),e.onTagsChanged&&e.onTagsChanged().subscribe(this,this.onSourceTagsChanged),s&&this._processMainSourceChange(),this._tagsChanged.fire(),(0,h.isPriceDataSource)(e)&&this.recalculatePriceScale(t),this._invalidateSourcesCache()}addDataSource(e,t,i){let s=e.zorder();i||((0,u.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()?(s=null!==this._lastLineDataSourceZOrder?this._lastLineDataSourceZOrder+1:this.newLineToolZOrder(),this._isInInsertManyDataSourcesState&&(this._lastLineDataSourceZOrder=s)):(0,b.isStudy)(e)&&!e.isSpeciallyZOrderedSource()&&(s=this.newStudyZOrder())),this.insertDataSource(e,t,s)}removeDataSource(e,t,i){ const s=this.m_dataSources.indexOf(e);if(-1===s)return void x.logDebug("removeDataSource: invalid data source");this._removeSourceFromCollections(s,!!i),e!==this.m_mainDataSource||t||(this.m_mainDataSource=null);const r=e.priceScale();this.removeSourceFromPriceScale(e),e.onTagsChanged&&e.onTagsChanged().unsubscribe(this,this.onSourceTagsChanged),(0,h.isPriceDataSource)(e)&&!t&&this._processMainSourceChange(),this._tagsChanged.fire(),r&&(0,h.isPriceDataSource)(e)&&this.recalculatePriceScale(r),this._invalidateSourcesCache()}hasDataSource(e){return this._sourcesById.has(e.id())}hasPriceDataSource(e){return this._priceSourcesById.has(e.id())}dataSources(){return this.m_dataSources}priceDataSources(){return this._priceDataSources}symbolSources(){return this._symbolSources}replaceSource(e,t,i){const s=this.m_mainDataSource===e,r=e.zorder();this.insertDataSource(t,i,r),this.removeDataSource(e,s),this._sourcesById.set(t.id(),t),(0,h.isPriceDataSource)(t)&&this._priceSourcesById.set(t.id(),t),s&&(this.m_mainDataSource=t,this._processMainSourceChange())}isOverlay(e){const t=e.priceScale();return null===t||"overlay"===this.priceScalePosition(t)}updateAllViews(){for(const e of this.m_dataSources)e.updateAllViews();for(const e of this.model().customSources())e.updateViewsForPane(this)}priceScalePosition(e){return this._leftPriceScales.includes(e)?"left":this._rightPriceScales.includes(e)?"right":"overlay"}createPriceScaleAtPosition(e,t){const i=this.properties().childs().axisProperties.state();i.autoScale=!0;const s=new v.PriceScale(this.model().properties().childs().scalesProperties,i);return s.setHeight(this.height()),I(s,this._defaultTopMargin(),this._defaultBottomMargin()),this._placePriceScale(s,e,t),s}removePriceScale(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e===this._lockedPriceScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null);const t=this._leftPriceScales.indexOf(e);-1!==t&&(this._leftPriceScales[t].invalidateMargins(),this._leftPriceScales.splice(t,1));const i=this._rightPriceScales.indexOf(e);if(-1!==i&&(this._rightPriceScales[i].invalidateMargins(),this._rightPriceScales.splice(i,1)),null===e.mainSource()){const t=e.dataSources().length;0!==t&&x.logError("Invalid priceScale state: empty mainSource but non-empty data sources="+t)}this._onPriceScalesChanged.fire()}move(e,t,i){const s=e.priceScale();this.removeSourceFromPriceScale(e),t.addDataSource(e),e.setPriceScale(t),t.invalidateMargins(),this._processMainSourceChange(),this._invalidateSourcesCache(),e.isIncludedInAutoScale()&&(null!==s&&this.recalculatePriceScale(s),this.recalculatePriceScale(t)),this._onPriceScalesChanged.fire()}setZOrders(e){e.forEach((e,t)=>{t.setZorder(e)}),this._invalidateSourcesCache(),0===this._bulkActions.activeCounter&&this._dataSourcesCollectionChanged.fire(),this.model().lightUpdate()}isMainPane(){const e=this.model().mainSeries();for(const t of this.m_dataSources)if(t===e)return!0;return!1}isLast(){const e=this.model().panes() ;return e[e.length-1]===this}newStudyZOrder(){return(0,P.newStudyZOrder)(this._priceDataSources)}newLineToolZOrder(e){return(0,P.newLineToolZOrder)(this.m_dataSources,e)}containsMainSeries(){return this._sourcesById.has(this.model().mainSeries().id())}applyPriceScaleRatio(e,t){var i;null!==this._lockedPriceScale&&this._lockedPriceScale!==e||this._currentPriceScaleRatio===t||!this.isMainPane()||null===this._lockedPriceScale&&e!==(null===(i=this.mainDataSource())||void 0===i?void 0:i.priceScale())||(this._setNewPriceRangeByScaleRatio(e,t,this._mainSourceVisiblePriceRange(e),!0,!0),null!==this._lockedPriceScale?this._tryToApplyNewPriceScaleRatio():e.isLog()||this.model().mainSeriesScaleRatioPropertyOnChanged())}sendToBack(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[0],P.moveBeforeSource)}bringToFront(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[t.length-1],P.moveAfterSource)}sendBackward(e){const t=this.sourcesByGroup().allIncludingHidden(),i=t.indexOf(e[0]);if(0===i)this.bringToFront(e);else{const s=t[i-1];this.insertBefore(e,s)}}bringForward(e){const t=this.sourcesByGroup().allExceptSpecialSources(),i=t.indexOf(e[e.length-1]);if(i===t.length-1)this.sendToBack(e);else{const s=t[i+1];this.insertAfter(e,s)}}insertAfter(e,t){this._batchReorder(e,t,P.moveAfterSource)}insertBefore(e,t){this._batchReorder(e,t,P.moveBeforeSource)}priceScaleSelectionStrategy(){return this._priceScaleSelectionStrategy}findTargetPriceAxisViews(e,t,i,s){if((0,c.isDataSource)(e)&&this.model().paneForSource(e)!==this)return[];const r=e.priceScale();if(t===r)return i;if(null===r)return[];if("overlay"===this.priceScalePosition(r))return t===this.defaultPriceScale()?i:[];const n=this.priceScalePosition(t);if(n!==this.priceScalePosition(r))return[];const o="left"===n?this.leftPriceScales():this.rightPriceScales();return o.indexOf(t)t.setHeight(e)),this._rightPriceScales.forEach(t=>t.setHeight(e));for(let t=0;t(e.paneViews(this)||[]).some(e=>{const r=e.renderer(t,i);return r&&r.doesIntersectWithBox&&r.doesIntersectWithBox(s)}))}logicalRectToPixels(e){const t=this.defaultPriceScale(),i=this.timeScale(),n=(0,r.ensureNotNull)((0,r.ensureNotNull)(t.mainSource()).firstValue()),o=t.priceToCoordinate(e.p1.price,n),a=i.indexToCoordinate(e.p1.index),l=t.priceToCoordinate(e.p2.price,n),c=i.indexToCoordinate(e.p2.index),h=new s.Point(Math.min(a,c),Math.min(o,l)),d=new s.Point(Math.max(a,c),Math.max(o,l));return(0,s.box)(h,d)}clipboardLineToolOwnerSource(e){const t=this.dataSourceForId(e);if(null!==t){const e=t.ownerSource();if(null!==e&&null!==e.firstValue())return e}const i=this.mainDataSource();if(null!==i&&null!==i.firstValue())return i;for(const e of this.dataSources())if((0,h.isPriceDataSource)(e)&&null!==e.firstValue())return e;return null}realignLineTools(){let e=!1;for(const t of this.m_dataSources)(0,u.isLineTool)(t)&&(t.calcIsActualSymbol(),t.updateAllViews(),e=!0);return this._invalidateSourcesCache(),e}startScalePrice(e,t){e.startScale(t)}scalePriceTo(e,t){e.scaleTo(t),this.updateAllViews()}endScalePrice(e){e.endScale()}resetPriceScale(e){const t=this.timeScale().visibleBarsStrictRange();e.isLockScale()||e.setMode({autoScale:!0}),e.recalculatePriceRange(t),this.updateAllViews()}restorePriceScaleState(e,t){e.restoreState(t),this.updateAllViews()}beginInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!0,this._lastLineDataSourceZOrder=null}endInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null}removeSourceFromPriceScale(e){const t=e.priceScale();if(null!==t){const i=t.dataSources();i.indexOf(e)>=0&&t.removeDataSource(e),0===i.length&&this.removePriceScale(t)}}_addSourceToCollections(e,t){this.m_dataSources.push(e),this._sourcesById.set(e.id(),e),this._invalidateSourcesCache(),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire();const i=()=>{this._sourcePropertiesChanged.fire(e)};e.properties().subscribe(this,i),e.zOrderChanged().subscribe(this,t=>this._sourcesZOrderChanged.fire(e,t)),(0,u.isLineTool)(e)&&(e.normalizedPointsChanged().subscribe(this,i),e.fixedPointsChanged().subscribe(this,i),e.hasAlert.subscribe(i),e.sharingMode().subscribe(i),e.linkKey().subscribe(i),this._sourceWatchedValuesSubscriptions.set(e.id(),i));const s=(0,w.isSymbolSource)(e)?e:null;(0,h.isPriceDataSource)(e)&&(this._priceSourcesById.set(e.id(),e),e.currencyChanged().subscribe(this,()=>this._invalidateSourcesCache()),e.unitChanged().subscribe(this,()=>this._invalidateSourcesCache()),this._priceDataSources.push(e),null!==s&&(this._symbolSources.push(s),s.symbolResolved().subscribe(this,()=>this._symbolSourceResolved.fire(e)), s.symbolResolvingActive().subscribe(this._recalcSymbolSourceResolvingActive),s.symbolHibernated().subscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),e.isMultiPaneAvailable()&&this.model().addMultiPaneSource(e),!e.isSpeciallyZOrderedSource()&&this._reorderZOrderOnAddingSourceToCollectionAllowed&&((0,u.isLineTool)(e)&&(0,P.isReorderRequired)(null,e.zorder())||(0,b.isStudy)(e)&&(0,P.isReorderRequired)(e.zorder(),null))&&(this._reorderZOrderOnAddingSourceToCollectionAllowed=(0,P.reorderDataSourcesZOrder)(this.m_dataSources))}_removeSourceFromCollections(e,t){const i=this.m_dataSources[e];i.properties().unsubscribeAll(this),i.zOrderChanged().unsubscribeAll(this),this.m_dataSources.splice(e,1),this._sourcesById.delete(i.id());const s=i.id();if((0,u.isLineTool)(i)&&(i.normalizedPointsChanged().unsubscribeAll(this),i.fixedPointsChanged().unsubscribeAll(this),this._sourceWatchedValuesSubscriptions.has(s))){const e=this._sourceWatchedValuesSubscriptions.get(s);i.hasAlert.unsubscribe(e),i.linkKey().unsubscribe(e)}this._invalidateSourcesCache();const n=(0,w.isSymbolSource)(i)?i:null;if((0,h.isPriceDataSource)(i)){this._priceSourcesById.delete(i.id()),i.currencyChanged().unsubscribeAll(this),i.unitChanged().unsubscribeAll(this);const e=this._priceDataSources.indexOf(i);if((0,r.assert)(-1!==e),this._priceDataSources.splice(e,1),null!==n){const e=this._symbolSources.indexOf(n);(0,r.assert)(-1!==e,"Source is not found"),this._symbolSources.splice(e,1),n.symbolResolved().unsubscribeAll(this),n.symbolResolvingActive().unsubscribe(this._recalcSymbolSourceResolvingActive),n.symbolHibernated().unsubscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged()}}t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire(),i.isMultiPaneAvailable()&&this.model().removeMultiPaneSource(i),this._reorderZOrderOnAddingSourceToCollectionAllowed=!0}_recalculatePriceScaleByScaleRatio(e){this.isMainPane()&&e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToPriceScale():this._tryToApplyNewPriceScaleRatio())}_defaultBottomMargin(){return.01*this.properties().childs().bottomMargin.value()}_defaultTopMargin(){return.01*this.properties().childs().topMargin.value()}_updateMargins(){const e=this._defaultTopMargin(),t=this._defaultBottomMargin();for(const i of this._leftPriceScales)I(i,e,t);for(const i of this._rightPriceScales)I(i,e,t);for(const i of this.m_dataSources)if(this.isOverlay(i)){const s=i.priceScale();null!==s&&(I(s,e,t),this.recalculatePriceScale(s))}for(const e of this._leftPriceScales)this.recalculatePriceScale(e);for(const e of this._rightPriceScales)this.recalculatePriceScale(e);this.updateAllViews()}_batchReorder(e,t,i){i(this.sourcesByGroup().allExceptSpecialSources(),e,t),this._invalidateSourcesCache(),this._dataSourcesCollectionChanged.fire(),this.model().fullUpdate()}_placePriceScale(e,t,i){ if("overlay"===t)return void e.invalidateMargins();const s="left"===t?this._leftPriceScales:this._rightPriceScales,n=void 0===i?s.length:i;s.splice(n,0,e),e.modeChanged().subscribe(this,this._onPriceScaleModeChanged.bind(this,e)),e.internalHeightChanged().subscribe(this,this._recalculatePriceScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._recalculateTimeScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._onPriceScaleSetMinMaxPriceRange.bind(this,e)),e.isLockScale()&&((0,r.assert)(null===this._lockedPriceScale),this._lockedPriceScale=e,this._currentPriceScaleRatio=null),e.invalidateMargins(),this._onPriceScalesChanged.fire()}_onPriceScaleModeChanged(e,t,i){if(i.lockScale&&(this._lockedPriceScale!==e&&null!==this._lockedPriceScale&&this._lockedPriceScale.setMode({lockScale:!1}),this._lockedPriceScale=e,this._currentPriceScaleRatio=(0,S.scaleRatio)(this.timeScale(),e)),t.lockScale&&!i.lockScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null),t.percentage===i.percentage&&t.indexedTo100===i.indexedTo100)return;const s=this.timeScale().visibleBarsStrictRange();null!==s&&(e.recalculatePriceRange(s),e.updateAllViews())}_applyOldScaleRatioToPriceScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||null===this._lockedPriceScale||(this._isRecalculatingScales=!0,this._setNewPriceRangeByScaleRatio(this._lockedPriceScale,this._currentPriceScaleRatio,this._mainSourceVisiblePriceRange(this._lockedPriceScale)),this._isRecalculatingScales=!1)}_setNewPriceRangeByScaleRatio(e,t,i,s,r){const n=(0,S.priceRangeByScaleRatio)(e,this.timeScale().barSpacing(),t);e.setPriceRange(null!==n?n:i,s,r)}_applyOldScaleRatioToTimeScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||(this._isRecalculatingScales=!0,this._setNewBarSpacingByScaleRatio(),this._isRecalculatingScales=!1)}_tryToApplyNewPriceScaleRatio(){const e=(0,r.ensureNotNull)(this._lockedPriceScale),t=(0,S.scaleRatio)(this.timeScale(),e);this._currentPriceScaleRatio===t||e.isLog()||(this._currentPriceScaleRatio=t,this.model().mainSeriesScaleRatioPropertyOnChanged())}_recalculateTimeScaleByScaleRatio(e){e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToTimeScale():this._tryToApplyNewPriceScaleRatio())}_setNewBarSpacingByScaleRatio(){const e=this.timeScale().getValidBarSpacing((0,S.barSpacingByScaleRatio)((0,r.ensureNotNull)(this._lockedPriceScale),this._currentPriceScaleRatio));this.timeScale().isValidBarSpacing(e)&&this.timeScale().setBarSpacing(e)}_mainSourceVisiblePriceRange(e){const t=this.timeScale().visibleBarsStrictRange();return null!==t?(0,r.ensureNotNull)((0,r.ensureNotNull)(e.mainSource()).priceRange(t.firstBar(),t.lastBar())):new y.PriceRange(-.5,.5)}_setMinMaxPriceRange(){const e=(0,r.ensureNotNull)(this._lockedPriceScale),t=(0,S.priceRangeByScaleRatio)(e,this.timeScale().maxBarSpacing(),this._currentPriceScaleRatio),i=(0,S.priceRangeByScaleRatio)(e,this.timeScale().minBarSpacing(),this._currentPriceScaleRatio) ;null!==t&&e.setMaxPriceRange(t),null!==i&&e.setMinPriceRange(i)}_onPriceScaleSetMinMaxPriceRange(e){e===this._lockedPriceScale&&this._setMinMaxPriceRange()}}},10992:(e,t,i)=>{"use strict";var s;i.d(t,{PaneCursorType:()=>s}),function(e){e[e.Default=0]="Default",e[e.Pointer=1]="Pointer",e[e.Eraser=2]="Eraser",e[e.Dot=3]="Dot",e[e.Grabbing=4]="Grabbing",e[e.ZoomIn=5]="ZoomIn",e[e.VerticalResize=6]="VerticalResize",e[e.HorizontalResize=7]="HorizontalResize",e[e.DiagonalNeSwResize=8]="DiagonalNeSwResize",e[e.DiagonalNwSeResize=9]="DiagonalNwSeResize"}(s||(s={}))},13114:(e,t,i)=>{"use strict";i.d(t,{PanePriceAxisView:()=>n});var s=i(92137);class r{constructor(e){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._width=0,this._height=0,this._textWidthCache=e}setParams(e,t,i,s,r){this._priceAxisViewRenderer=e,this._rendererOptions=t,this._width=i,this._height=s,this._align=r}draw(e,t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(e,this._rendererOptions,this._textWidthCache,this._width,this._height,this._align,t.pixelRatio)}hitTest(e){var t,i;return void 0===(null===(t=this._priceAxisViewRenderer)||void 0===t?void 0:t.hitTest)?null:null===(i=this._priceAxisViewRenderer)||void 0===i?void 0:i.hitTest(e,this._width,this._align)}}class n{constructor(e,t,i){this._renderer=null,this._invalidated=!0,this._priceAxisView=e,this._textWidthCache=new s.TextWidthCache(100),this._dataSource=t,this._chartModel=i,this._fontSize=-1,this._panePriceAxisViewRenderer=new r(this._textWidthCache)}update(){this._invalidated=!0}renderer(e,t){return this._invalidated&&this._updateImpl(e,t),this._renderer}_updateImpl(e,t){this._renderer=null;const i=this._chartModel.crossHairSource(),s=this._dataSource===i?i.pane:this._chartModel.paneForSource(this._dataSource);if(null===s)return;const r=this._priceScale();if(null===r)return;let n=s.priceScalePosition(r);if("overlay"===n&&(n=s.priceScalePosition(s.defaultPriceScale())),"overlay"===n)return;const o=this._chartModel.priceAxisRendererOptions();o.fontSize!==this._fontSize&&(this._fontSize=o.fontSize,this._textWidthCache.reset()),this._panePriceAxisViewRenderer.setParams(this._priceAxisView.paneRenderer(),o,t,e,n),this._renderer=this._panePriceAxisViewRenderer,this._invalidated=!1}_priceScale(){return this._dataSource.priceScale()}}},9537:(e,t,i)=>{"use strict";i.d(t,{PaneRendererArea:()=>a});var s=i(16282),r=i(59109),n=i(5025),o=i(21344);class a extends r.PaneRendererLine{constructor(e){e.forceLineColor=!1,super(e)}draw(e,t){var i;const r=this._data;if(0===r.items.length)return;let a=0;for(;a=0&&!(0,o.coordinateIsValid)(r.items[l].y);)l--;if(a>l)return;e.save(),e.scale(t.pixelRatio,t.pixelRatio),e.lineCap="butt",e.strokeStyle=r.lineColor,e.lineWidth=r.lineWidth,(0,n.setLineStyle)(e,r.lineStyle),e.lineWidth=1;const c={},h=r.items;for(let e=a;e<=l;e++){const t=h[e];let i;if(i=t.style?t.style.color:r.lineColor,e{"use strict";i.d(t,{CompositeRenderer:()=>s});class s{constructor(){this._renderers=[],this._globalAlpha=1}setGlobalAlpha(e){this._globalAlpha=e}append(e){this._renderers.push(e)}insert(e,t){this._renderers.splice(t,0,e)}clear(){this._renderers.length=0}isEmpty(){return 0===this._renderers.length}draw(e,t){for(let i=0;i=0;s--){const r=this._renderers[s].hitTest(e,t);null!==r&&(null===i||r.result()>i.result())&&(i=r)}return i}doesIntersectWithBox(e){return this._renderers.some(t=>!!t.doesIntersectWithBox&&t.doesIntersectWithBox(e))}}},55430:(e,t,i)=>{"use strict";i.d(t,{clearRectWithGradient:()=>o,fillRectInnerBorder:()=>a,drawHorizontalLine:()=>l,drawVerticalLine:()=>c,drawRoundRect:()=>d,drawRoundRectWithInnerBorder:()=>u,fillRectWithBorder:()=>p,createCircle:()=>_});var s=i(72927),r=i(5025),n=i(64417);function o(e,t,i,s,r,n,o){e.save(),e.globalCompositeOperation="copy";const a=e.createLinearGradient(0,0,0,r);a.addColorStop(0,n),a.addColorStop(1,o),e.fillStyle=a,e.fillRect(t,i,s,r),e.restore()}function a(e,t,i,s,r,n){e.fillRect(t+n,i,s-2*n,n),e.fillRect(t+n,i+r-n,s-2*n,n),e.fillRect(t,i,n,r),e.fillRect(t+s-n,i,n,r)}function l(e,t,i,s){e.beginPath();const r=e.lineWidth%2?.5:0;e.moveTo(i,t+r),e.lineTo(s,t+r),e.stroke()}function c(e,t,i,s){e.beginPath();const r=e.lineWidth%2?.5:0;e.moveTo(t+r,i),e.lineTo(t+r,s),e.stroke()}function h(e,t){return Array.isArray(e)?e.map(e=>0===e?e:e+t):e+t}function d(e,t,i,s,r,n,o){let a,l,c,h;if(Array.isArray(n))if(2===n.length){const e=Math.max(0,n[0]),t=Math.max(0,n[1]);a=e,l=e,c=t,h=t}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");a=Math.max(0,n[0]),l=Math.max(0,n[1]),c=Math.max(0,n[2]),h=Math.max(0,n[3])}else{const e=Math.max(0,n);a=e,l=e,c=e,h=e}o||e.beginPath(),e.moveTo(t+a,i),e.lineTo(t+s-l,i),0!==l&&e.arcTo(t+s,i,t+s,i+l,l),e.lineTo(t+s,i+r-c),0!==c&&e.arcTo(t+s,i+r,t+s-c,i+r,c),e.lineTo(t+h,i+r),0!==h&&e.arcTo(t,i+r,t,i+r-h,h),e.lineTo(t,i+a),0!==a&&e.arcTo(t,i,t+a,i,a)} function u(e,t,i,s,o,a,l=0,c=0,u="",p=n.LineStyle.Solid){if(e.save(),!c||!u||u===a)return d(e,t,i,s,o,l),e.fillStyle=a,e.fill(),void e.restore();const _=c/2;if("transparent"!==a){const r="transparent"!==u&&p!==n.LineStyle.Solid;d(e,r?t:t+c,r?i:i+c,r?s:s-2*c,r?o:o-2*c,r?l:h(l,-c)),e.fillStyle=a,e.fill()}if("transparent"!==u){d(e,t+_,i+_,s-c,o-c,h(l,-_)),e.lineWidth=c,e.strokeStyle=u,(0,r.setLineStyle)(e,p),e.closePath(),e.stroke()}e.restore()}function p(e,t,i,n,o,a,l,c,h,d,u,p,_,m,g){const f=d?0:t,v=u?_:n;if(void 0!==a&&(e.fillStyle=a,e.fillRect(f,i,v-f+m,o-i)),void 0!==l&&c>0){if(e.beginPath(),(0,r.setLineStyle)(e,h),void 0!==g){const t=g.map(e=>e*c);(0,r.setLineDash)(e,t)}let a=(0,s.point)(0,0),d=(0,s.point)(0,0),u=(0,s.point)(0,0),_=(0,s.point)(0,0);switch(p){case"outer":{const e=.5*c;u=(0,s.point)(0,e),_=(0,s.point)(0,e),a=(0,s.point)(e,-c),d=(0,s.point)(e,-c);break}case"center":{const e=c%2?.5:0,t=c%2?.5:m;u=(0,s.point)(.5*c-e,-e),_=(0,s.point)(t+.5*c,-e),a=(0,s.point)(-e,e+.5*c),d=(0,s.point)(t,e+.5*c);break}case"inner":{const e=.5*c;u=(0,s.point)(0,-e),_=(0,s.point)(1,-e),a=(0,s.point)(-e,c),d=(0,s.point)(1-e,c);break}}e.lineWidth=c,e.strokeStyle=l,e.moveTo(f-u.x,i-u.y),e.lineTo(v+_.x,i-_.y),e.moveTo(n+d.x,i+d.y),e.lineTo(n+d.x,o-d.y),e.moveTo(f-u.x,o+u.y),e.lineTo(v+_.x,o+_.y),e.moveTo(t-a.x,i+a.y),e.lineTo(t-a.x,o-a.y),e.stroke()}}function _(e,t,i,s){e.beginPath(),e.arc(t,i,s,0,2*Math.PI,!1),e.closePath()}},21344:(e,t,i)=>{"use strict";i.r(t),i.d(t,{extendAndClipLineSegment:()=>h,getArrowPoints:()=>d,optimalBarWidth:()=>u,optimalCandlestickWidth:()=>p,optimalHiLoWidth:()=>_,interactionTolerance:()=>m,coordinateIsValid:()=>g,setValidLineStyle:()=>f,fillScaledRadius:()=>v,strokeScaledRadius:()=>S});var s=i(72927),r=i(95196),n=i(87910),o=i(47903),a=i(5025);const l={line:13,minDistanceBetweenPoints:10,series:14,curve:10,anchor:13,esd:4},c={line:3,minDistanceBetweenPoints:5,series:2,curve:3,anchor:2,esd:0};function h(e,t,i,n,o,a){if((0,s.equalPoints)(e,t))return null;const l=new s.Point(0,0),c=new s.Point(i,n);if(o){if(a){const i=(0,r.intersectLineAndBox)((0,s.lineThroughPoints)(e,t),(0,s.box)(l,c));return Array.isArray(i)?i:null}{const i=(0,r.intersectRayAndBox)(t,e,(0,s.box)(l,c));return null===i||(0,s.equalPoints)(t,i)?null:(0,s.lineSegment)(t,i)}}if(a){const i=(0,r.intersectRayAndBox)(e,t,(0,s.box)(l,c));return null===i||(0,s.equalPoints)(e,i)?null:(0,s.lineSegment)(e,i)}{const i=(0,r.intersectLineSegmentAndBox)((0,s.lineSegment)(e,t),(0,s.box)(l,c));return Array.isArray(i)?i:null}}function d(e,t,i,s){const r=.5*i,n=Math.sqrt(2),o=t.subtract(e),a=o.normalized();let l=5*i;s&&(l=Math.min(l,.35*o.length()));const c=1*r;if(l*n*.2<=c)return[];const h=a.scaled(l),d=t.subtract(h),u=a.transposed(),p=1*l,_=u.scaled(p),m=d.add(_),g=d.subtract(_),f=m.subtract(t).normalized().scaled(c),v=g.subtract(t).normalized().scaled(c),S=t.add(f),y=t.add(v),b=r*(n-1),w=u.scaled(b),P=Math.min(l-1*r/n,r*n*1),C=a.scaled(P),T=t.subtract(w),x=t.add(w),I=t.subtract(C);return[[m,S],[g,y],[T,I.subtract(w)],[x,I.add(w)]]}function u(e,t){ return t=t||1,Math.floor(.3*e*t)}function p(e,t){if(e>=2.5&&e<=4)return Math.floor(3*t);const i=1-.2*Math.atan(Math.max(4,e)-4)/(.5*Math.PI),s=Math.floor(e*i*t),r=Math.floor(e*t),n=Math.min(s,r);return Math.max(Math.floor(t),n)}function _(e){return.4*e}function m(){return(0,n.lastMouseOrTouchEventInfo)().isTouch?l:c}function g(e){return null!=e&&!(0,o.isNaN)(e)}function f(e,t){void 0!==t&&(0,a.setLineStyle)(e,t)}function v(e,t){const i=Math.max(1,Math.floor(t))%2?.5:0;return Math.round(e*t)+i}function S(e,t,i){const s=Math.max(1,Math.floor(t))%2?.5:0;return Math.round(e*t)+(s!==i%2?.5:0)}},29982:(e,t,i)=>{"use strict";i.d(t,{HorizontalLineRenderer:()=>a});var s=i(10288),r=i(5025),n=i(55430),o=i(21344);class a{constructor(){this._data=null,this._hitTest=new s.HitTestResult(s.HitTestResult.REGULAR)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||!1===this._data.visible||null===this._hitTest)return null;const t=(0,o.interactionTolerance)().line,i=Math.abs(e.y-this._data.y)<=t+this._data.linewidth/2,s=void 0===this._data.left||this._data.left-e.x<=t,r=void 0===this._data.right||e.x-this._data.right<=t;return i&&s&&r?this._hitTest:null}draw(e,t){if(null===this._data)return;if(!1===this._data.visible)return;if(this._data.y<-this._data.linewidth/2||this._data.y>t.cssHeight+this._data.linewidth/2)return;const i=t.pixelRatio;e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(e,this._data.linestyle);const s=void 0!==this._data.left?Math.max(this._data.left,0):0,o=void 0!==this._data.right?Math.min(this._data.right,t.cssWidth):t.cssWidth,a=Math.round(this._data.y*i),l=Math.floor(s*i),c=Math.ceil(o*i);(0,n.drawHorizontalLine)(e,a,l,c)}}},8356:(e,t,i)=>{"use strict";function s(e,t){return e.pixelRatio===t.pixelRatio}i.d(t,{areEqualPaneRenderParams:()=>s})},71172:(e,t,i)=>{"use strict";var s;i.d(t,{LineEnd:()=>s}),function(e){e[e.Normal=0]="Normal",e[e.Arrow=1]="Arrow",e[e.Circle=2]="Circle"}(s||(s={}))},59109:(e,t,i)=>{"use strict";i.d(t,{PaneRendererLine:()=>l});var s=i(72927),r=i(89684),n=i(10288),o=i(5025),a=i(21344);class l{constructor(e){this._data=e}hitTest(e,t){const i=(0,a.interactionTolerance)().series+this._data.lineWidth/2;let o=0,l=this._data.items.length-1;for(;l-o>2;){const t=Math.round((l+o)/2);this._data.items[t].x<=e.x?o=t:l=t}o=Math.max(1,o-1),l=Math.min(this._data.items.length-1,l+1);for(let t=o;t<=l;++t){const o=this._data.items[t-1],a=this._data.items[t],l=o.x,c=a.x;if((0,r.distanceToSegment)(new s.Point(l,o.y),new s.Point(c,a.y),new s.Point(e.x,e.y)).distance<=i)return this._data.hittest?this._data.hittest:new n.HitTestResult(n.HitTestResult.REGULAR)}return null}draw(e,t){e.save(),e.scale(t.pixelRatio,t.pixelRatio),e.lineCap="square",e.lineJoin="round",e.strokeStyle=this._data.lineColor,e.fillStyle=this._data.lineColor,e.lineWidth=this._data.lineWidth,(0,o.setLineStyle)(e,this._data.lineStyle),(0,a.setValidLineStyle)(e,this._data.lineStyle), this._data.simpleMode?this._drawSimpleMode(e,t.pixelRatio):this._drawLines(e),e.restore()}_drawSimpleMode(e,t){if(e.beginPath(),this._walkLine(e,this._data.items,!1,NaN),e.stroke(),this._data.withMarkers){e.save(),e.scale(1/t,1/t);const i=Math.max(1,Math.floor(t))%2/2,s=(this._data.lineWidth+2)*t+i,r=2*Math.PI;e.beginPath();for(let n=this._data.items.length;n--;){const o=this._data.items[n];if(o){const n=Math.round(o.x*t)+i,a=o.y*t;e.moveTo(n,a),e.arc(n,a,s,0,r)}}e.fill(),e.restore()}}_walkLine(e,t,i,s){if(!t)return;const r=.25*this._data.barSpacing;let n,o,l,c,h;const d=a.coordinateIsValid;for(let e=0;e{"use strict";i.d(t,{RectangleRenderer:()=>d});var s=i(16282),r=i(72927),n=i(71044),o=i(89684),a=i(10288),l=i(50968),c=i(33420),h=i(55430);class d{constructor(e,t,i){this._data=null,this._hitTestResult=e||new a.HitTestResult(a.HitTestResult.MOVEPOINT),this._backHitTestResult=t||new a.HitTestResult(a.HitTestResult.MOVEPOINT_BACKGROUND),this._forceOverrideTransparency=Boolean(i)}setData(e){this._data=e}hitTest(e,t){if(null===this._data||this._data.points.length<2||this._data.nohittest)return null;const[i,s]=this._getPointsInPhysicalSpace(t),n=new r.Point(s.x,i.y),a=new r.Point(i.x,s.y),l=new r.Point(e.x*t.pixelRatio,e.y*t.pixelRatio),c=this._extendAndHitTestLineSegment(l,i,n,t);if(null!==c)return c;const h=this._extendAndHitTestLineSegment(l,a,s,t);if(null!==h)return h;let d=(0,o.distanceToSegment)(n,s,l);return d.distance<=3?this._hitTestResult:(d=(0,o.distanceToSegment)(i,a,l),d.distance<=3?this._hitTestResult:this._data.fillBackground?this._hitTestBackground(l,i,s,t):null)}getColor(){const e=(0,s.ensure)(this._data);return void 0===e.transparency?e.backcolor:(0,l.generateColor)(e.backcolor,e.transparency,this._forceOverrideTransparency)}draw(e,t){ if(null===this._data||this._data.points.length<2||this._data.linewidth<=0&&!this._data.fillBackground)return;e.save();const[i,s]=this._getPointsInPhysicalSpace(t),r=this._data.linewidth?Math.max(1,Math.floor(this._data.linewidth*t.pixelRatio)):0,n=this._data.fillBackground?this.getColor():void 0,o=Math.max(1,Math.floor(t.pixelRatio));(0,h.fillRectWithBorder)(e,i.x,i.y,s.x,s.y,n,this._data.color,r,c.LINESTYLE_SOLID,this._data.extendLeft,this._data.extendRight,"center",t.physicalWidth,this._data.includeRightEdge&&1===o?1:0),e.restore()}_getPointsInPhysicalSpace(e,t=0){const i=(0,s.ensureNotNull)(this._data),[n,o]=i.points,a=e.pixelRatio,l=Math.min(n.x,o.x),c=Math.max(n.x,o.x),h=Math.min(n.y,o.y),d=Math.max(n.y,o.y),u=Math.round(l*a)+t,p=Math.round(c*a)+t,_=Math.round(h*a)+t,m=Math.round(d*a)+t;return[new r.Point(u,_),new r.Point(p,m)]}_extendAndHitTestLineSegment(e,t,i,s){const r=this._extendAndClipLineSegment(t,i,s);if(null!==r){if((0,o.distanceToSegment)(r[0],r[1],e).distance<=3)return this._hitTestResult}return null}_extendAndClipLineSegment(e,t,i){const n=(0,s.ensureNotNull)(this._data);if((0,r.equalPoints)(e,t))return null;const o=i.physicalWidth,a=Math.min(e.x,t.x),l=Math.max(e.x,t.x),c=n.extendLeft?0:Math.max(a,0),h=n.extendRight?o:Math.min(l,o);return c>h||h<=0||c>=o?null:[new r.Point(c,e.y),new r.Point(h,t.y)]}_hitTestBackground(e,t,i,s){const o=this._extendAndClipLineSegment(t,i,s);return null!==o&&(0,n.pointInBox)(e,(0,r.box)(o[0],o[1]))?this._backHitTestResult:null}}},58729:(e,t,i)=>{"use strict";i.d(t,{ScaledPaneRenderer:()=>s,ScaledPaneRendererWrapper:()=>r});class s{draw(e,t){e.save(),e.scale(t.pixelRatio,t.pixelRatio),e.translate(.5,.5),this._drawImpl(e,{...t,pixelRatio:1}),e.restore()}drawBackground(e,t){e.save(),e.scale(t.pixelRatio,t.pixelRatio),e.translate(.5,.5),this._drawBackgroundImpl(e,{...t,pixelRatio:1}),e.restore()}_drawBackgroundImpl(e,t){}}class r{constructor(e){this._base=e}hitTest(e,t){return this._base.hitTest(e,t)}draw(e,t){e.save(),e.scale(t.pixelRatio,t.pixelRatio),e.translate(.5,.5),this._base.draw(e,{...t,pixelRatio:1}),e.restore()}drawBackground(e,t){e.save(),e.scale(t.pixelRatio,t.pixelRatio),e.translate(.5,.5),this._base.drawBackground&&this._base.drawBackground(e,{...t,pixelRatio:1}),e.restore()}}},63736:(e,t,i)=>{"use strict";i.d(t,{PaneRendererBaseline:()=>h});var s=i(72927),r=i(95196),n=i(89684),o=i(21344),a=i(49382),l=i(58729),c=i(10288);class h extends l.ScaledPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){if(null===this._data)return null;const{items:t,topLineWidth:i,bottomLineWidth:r}=this._data,l=(0,o.interactionTolerance)().series+(i+r)/4,h=(0,a.lowerbound)(t,e,(e,t)=>e.x<=t.x),d=Math.max(1,h-1),u=Math.min(t.length-1,h+1);for(let i=d;i<=u;++i){const r=t[i-1],o=t[i],{distance:a}=(0,n.distanceToSegment)(new s.Point(r.x,r.y),new s.Point(o.x,o.y),new s.Point(e.x,e.y));if(a<=l)return new c.HitTestResult(c.HitTestResult.REGULAR)}return null}_drawImpl(e){if(null===this._data)return ;const{items:t,baseLevelCoordinate:i,bottom:n,bottomFillColor1:a,bottomFillColor2:l,topFillColor1:c,topFillColor2:h,topLineColor:d,bottomLineColor:u,topLineWidth:p,bottomLineWidth:_}=this._data;if(!function(e){if(0===e.length)return!1;const t=e.findIndex(e=>(0,o.coordinateIsValid)(e.y));if(-1===t)return!1;let i=e.length-1;for(;i>t&&!(0,o.coordinateIsValid)(e[i].y);)i--;return!(t>i)}(t))return;const{topItems:m,bottomItems:g}=function(e,t){const i=[],n=[];let a=null;for(let l=0;l=t&&n.push(c),a=c;else{if(null===a)continue;c=a}if((0,o.coordinateIsValid)(h.y)&&(c.y>t&&h.yt))if(Math.abs(c.x-h.x)<1){const e=new s.Point(c.x,t);i.push(e),n.push(e)}else{const e=(0,r.intersectLineSegments)(c,h,new s.Point(c.x,t),new s.Point(h.x,t));if(null!==e){const t=c.add(h.subtract(c).scaled(e));i.push(t),n.push(t)}}}return{topItems:i,bottomItems:n}}(t,i);e.lineCap="round",e.lineJoin="round",0!==m.length&&(e.beginPath(),e.moveTo(m[0].x,i),this._makeLine(e,m,!0,0),e.closePath(),e.fillStyle=this._makeLinearGradient(e,c,h,i-n,i),e.fill(),e.beginPath(),this._makeLine(e,m,!1,0),e.lineWidth=p,e.strokeStyle=d,e.stroke()),0!==g.length&&(e.beginPath(),e.moveTo(g[0].x,i),this._makeLine(e,g,!0,1),e.closePath(),e.fillStyle=this._makeLinearGradient(e,a,l,i,i+n),e.fill(),e.beginPath(),this._makeLine(e,g,!1,1),e.lineWidth=_,e.strokeStyle=u,e.stroke())}_makeLine(e,t,i,s){if(null===this._data)return;const r=t.findIndex(e=>(0,o.coordinateIsValid)(e.y));if(-1===r)return;const{barSpacing:n,baseLevelCoordinate:a}=this._data,l=.25*n;let c;const h=t.length;for(let n=r;n=a&&h.y>=a){e.moveTo(h.x,h.y);continue}}else if(c&&c.y<=a&&h.y<=a){e.moveTo(h.x,h.y);continue}if(c&&(0,o.coordinateIsValid)(c.y))e.lineTo(h.x,h.y),i&&!(0,o.coordinateIsValid)(d.y)&&e.lineTo(h.x,a);else if(d&&(0,o.coordinateIsValid)(d.y))i?(n!==r&&e.lineTo(h.x,a),e.lineTo(h.x,h.y)):e.moveTo(h.x,h.y);else if(i){if(0===n)continue;n!==r&&e.lineTo(h.x-l,a),e.lineTo(h.x-l,h.y),e.lineTo(h.x+l,h.y),e.lineTo(h.x+l,a)}else e.moveTo(h.x-l,h.y),e.lineTo(h.x+l,h.y);c=h}}}_makeLinearGradient(e,t,i,s,r){const n=e.createLinearGradient(0,s,0,r);return n.addColorStop(0,t),n.addColorStop(1,i),n}}},98678:(e,t,i)=>{"use strict";var s;i.d(t,{StatsPosition:()=>s}),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(s||(s={}))},73175:(e,t,i)=>{"use strict";i.d(t,{StepLineDecoration:()=>s,PaneRendererStepLine:()=>g});var s,r=i(89684),n=i(10288),o=i(72927),a=i(5025),l=i(49382),c=i(21344),h=i(55430),d=i(50968);!function(e){e[e.None=0]="None",e[e.Diamonds=1]="Diamonds"}(s||(s={}));class u{initialize(e,t,i,s){var r,n,o,l;const c=e.lineStyle;t.lineCap="butt",t.lineJoin="round";const h=Math.max(Math.floor(null!==(n=null===(r=s.style)||void 0===r?void 0:r.width)&&void 0!==n?n:e.lineWidth*i.pixelRatio));void 0!==c&&(0,a.setLineStyle)(t,c);const d=h%2?.5:0 ;t.moveTo(Math.round(s.x*i.pixelRatio)+d,Math.round(s.y*i.pixelRatio)+d),t.strokeStyle=null!==(l=null===(o=s.style)||void 0===o?void 0:o.color)&&void 0!==l?l:e.lineColor,t.lineWidth=h}finishFragment(e){e.stroke()}hitTest(e,t,i,s,n){var a,l;const h=Math.round((i.x+s.x)/2),d=new o.Point(h,i.y),u=new o.Point(h,s.y),p=null!==(l=null===(a=i.style)||void 0===a?void 0:a.width)&&void 0!==l?l:e.lineWidth,_=(0,c.interactionTolerance)().series+p/2;return Math.min((0,r.distanceToSegment)(i,d,n).distance,(0,r.distanceToSegment)(d,u,n).distance,(0,r.distanceToSegment)(u,s,n).distance)<=_}applyColor(e,t){e.strokeStyle=t}applyLineWidth(e,t){e.lineWidth=t}drawItem(e,t,i,s){e.lineTo(i.x,i.y),void 0!==s&&(e.lineTo(s.x,i.y),e.lineTo(s.x,s.y))}}class p{constructor(){this._lineWidth=1}initialize(e,t,i,s){var r,n,o,a;this.applyColor(t,null!==(n=null===(r=s.style)||void 0===r?void 0:r.color)&&void 0!==n?n:e.lineColor),this._lineWidth=Math.max(Math.floor(null!==(a=null===(o=s.style)||void 0===o?void 0:o.width)&&void 0!==a?a:e.lineWidth*i.pixelRatio))}finishFragment(e){e.fill()}drawItem(e,t,i,s,r){if(r&&void 0!==s&&!Number.isNaN(s.y)){e.save(),e.translate(s.x,s.y),e.rotate(Math.PI/4);const i=this._scaleByLineWidth(this._lineWidth);e.scale(i,i),this._drawItemRotatedAndTranslated(e,t),e.restore()}}applyLineWidth(e,t){this._lineWidth=t}hitTest(e,t,i,s,r){var n,a;if(!s.valIsNotSameAsPrev)return!1;const l=Math.round((i.x+s.x)/2),c=new o.Point(l,s.y),h=r.subtract(c),d=Math.max(Math.floor(null!==(a=null===(n=i.style)||void 0===n?void 0:n.width)&&void 0!==a?a:e.lineWidth*t.pixelRatio));return this._hitTestTranslated(h,d)}_scaleByLineWidth(e){return Math.sqrt(e)}}class _ extends p{applyColor(e,t){e.fillStyle=t}_hitTestTranslated(e,t){return Math.abs(e.x)+Math.abs(e.y)<8*this._scaleByLineWidth(t)/2}_drawItemRotatedAndTranslated(e,t){(0,h.drawRoundRect)(e,-4,-4,8,8,2,!0)}}class m extends p{applyColor(e,t){e.fillStyle=(0,d.applyTransparency)(t,85)}_hitTestTranslated(e,t){return Math.abs(e.x)+Math.abs(e.y)<21*this._scaleByLineWidth(t)/2}_drawItemRotatedAndTranslated(e,t){(0,h.drawRoundRect)(e,-10.5,-10.5,21,21,5,!0)}}class g{constructor(){this._data=null}setData(e){this._data=e}hitTest(e,t){var i;const r=this._data;if(null===r||0===r.items.length)return null;const o=r.items,a=(0,l.lowerbound)(o,e,(e,t)=>e.x<=t.x),c=Math.max(0,a-1),h=Math.min(o.length-1,a+1),d=function(e){switch(e){case s.Diamonds:return[new u,new m];default:return[new u]}}(null===(i=this._data)||void 0===i?void 0:i.decoration);for(let i=c;ii.hitTest(r,t,s,a,e)))return new n.HitTestResult(n.HitTestResult.REGULAR)}return null}draw(e,t){if(null===this._data||0===this._data.items.length)return;e.save();(function(e){switch(e){case s.Diamonds:return[new u,new _,new m];default:return[new u]}})(this._data.decoration).forEach(i=>this._drawImpl(e,t,i)),e.restore()}_drawImpl(e,t,i){var s,r,n,a,l,c,h,d,u,p;if(null===this._data||0===this._data.items.length)return;const{lineWidth:_,lineColor:m,items:g}=this._data,f=g.length,v=t.pixelRatio ;let S=Math.max(Math.floor(null!==(r=null===(s=g[0].style)||void 0===s?void 0:s.width)&&void 0!==r?r:_*v)),y=S%2?.5:0;i.initialize(this._data,e,t,g[0]),e.beginPath();for(let s=0;s{"use strict";i.d(t,{calculateLabelPosition:()=>p,wordWrap:()=>g,TextRenderer:()=>M});var s=i(72927),r=i(16282),n=i(71044),o=i(76553),a=i(10288),l=i(55430),c=i(5025),h=i(47903),d=i(16932),u=i(33420);function p(e,t,i,r,n){const o=.5*(t.x+i.x);let a=i.y;return t.y>i.y?(a-=e.height/2+r.y,a=Math.max(e.height/2,a)):(a+=e.height/2+r.y,a=Math.min(n-e.height/2,a)),new s.Point(o,a)}let _;function m(){const e=document.createElement("canvas");e.width=0,e.height=0,_=(0,r.ensureNotNull)(e.getContext("2d"))}function g(e,t,i){_||m(),i=(0,h.isString)(i)?parseInt(i):i,e+="";const s=!(0,h.isNumber)(i)||!isFinite(i)||i<=0?e.split(/\r\n|\r|\n|$/):e.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);if(s[s.length-1]||s.pop(),!(0,h.isNumber)(i)||!isFinite(i)||i<=0)return s;_.font=t;const r=[];for(let e=0;e0&&_.measureText(o.slice(0,3*--e-1).join("")).width>i;);if(e>0)r.push(o.slice(0,3*e-1).join("")),o.splice(0,3*e);else{const e=o[0]+(o[1]||"");if(a=1===a?1:~~(i/_.measureText(e).width*e.length),_.measureText(e.substring(0,a)).width<=i)for(;_.measureText(e.substring(0,a+1)).width<=i;)a++;else for(;a>1&&_.measureText(e.substring(0,--a)).width>i;);a<1&&(a=1),r.push(e.substring(0,a)),o[0]=e.substring(a),o[1]=""}if(_.measureText(o.join("")).width<=i){r.push(o.join(""));break}}}return r}function f(e,t,i){if(0===i)return e.clone();const r=(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,n=(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y;return new s.Point(r,n)}function v(e,t){return t+2*P(e)+2*b(e)}function S(e,t){return T(e)*t+C(e)*(t-1)+2*w(e)+2*y(e)}function y(e){return void 0!==e.boxPaddingVert?e.boxPaddingVert*I(e):void 0!==e.boxPadding?e.boxPadding*I(e):T(e)/3}function b(e){return void 0!==e.boxPaddingHorz?e.boxPaddingHorz*I(e):void 0!==e.boxPadding?e.boxPadding*I(e):T(e)/3}function w(e){return(e.backgroundVertInflate||0)*I(e)} function P(e){return(e.backgroundHorzInflate||0)*I(e)}function C(e){return(e.padding||0)*I(e)}function T(e){return Math.ceil(x(e)*I(e))}function x(e){return e.fontsize||e.fontSize||30}function I(e){const t=Math.min(1,Math.max(.2,Math.min(e.scaleX||1,e.scaleY||1)));if(1===t)return t;const i=x(e);return Math.ceil(t*i)/i}class M{constructor(e,t){this._data=null,this._internalData=null,this._boxSize=null,this._polygonPoints=null,this._linesInfo=null,this._fontInfo=null,this._hittest=t||new a.HitTestResult(a.HitTestResult.MOVEPOINT,{areaName:a.AreaName.Text}),void 0!==e&&this.setData(e)}setData(e){e.horzTextAlign||(e.horzTextAlign=e.horzAlign),function(e,t){if(null===e||null===t)return null===e==(null===t);if(void 0===e.points!=(void 0===t.points))return!1;if(void 0!==e.points&&void 0!==t.points){if(e.points.length!==t.points.length)return!1;for(let r=0;re){const i=(0,s.box)(new s.Point(0,0),new s.Point(e,t));return this._getPolygonPoints().every(e=>!(0,n.pointInBox)(e,i))}return!1}setPoints(e,t){(0,r.ensureNotNull)(this._data).points=e,this._hittest=t||new a.HitTestResult(a.HitTestResult.MOVEPOINT)}fontStyle(e){return null===this._data?"":this._getFontInfo().fontStyle}wordWrap(e,t,i){ return g(e,i||this.fontStyle(),t)}draw(e,t){if(null===this._data||void 0===this._data.points||0===this._data.points.length)return;if(this.isOutOfScreen(t.cssWidth,t.cssHeight))return;const i=t.pixelRatio,s=this._getInternalData(),r=this._getRotationPoint().scaled(i);e.save(),e.translate(r.x,r.y),e.rotate(this._data.angle||0),e.translate(-r.x,-r.y);const n=this._getFontInfo().fontSize;e.textBaseline=s.textBaseLine,e.textAlign=s.textAlign,e.font=this.fontStyle();const{scaledLeft:o,scaledRight:a,scaledTop:h,scaledBottom:p}=function(e,t){const i=Math.round(e.boxLeft*t),s=Math.round(e.boxTop*t);return{scaledLeft:i,scaledRight:i+Math.round(e.boxWidth*t),scaledTop:s,scaledBottom:s+Math.round(e.boxHeight*t)}}(s,i);if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){const t=this._data.borderWidth||Math.max(n/12,1),s=Math.round(t*i),r=s/2;let d=!1;if(this._data.boxShadow){e.save();const{shadowColor:t,shadowBlur:i,shadowOffsetX:s=0,shadowOffsetY:r=0}=this._data.boxShadow;e.shadowColor=t,e.shadowBlur=i,e.shadowOffsetX=s,e.shadowOffsetY=r,d=!0}if(this._data.backgroundRoundRect)this._data.backgroundColor&&((0,l.drawRoundRect)(e,o,h,a-o,p-h,this._data.backgroundRoundRect*i),e.fillStyle=this._data.backgroundColor,e.fill(),d&&(e.restore(),d=!1)),this._data.borderColor&&((0,l.drawRoundRect)(e,o-r,h-r,a-o+s,p-h+s,this._data.backgroundRoundRect*i+s),e.strokeStyle=this._data.borderColor,e.lineWidth=s,e.stroke(),d&&(e.restore(),d=!1));else if(this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.fillRect(o,h,a-o,p-h),d&&(e.restore(),d=!1)),this._data.borderColor||this._data.highlightBorder){let t;this._data.borderColor?(e.strokeStyle=this._data.borderColor,t=s):(e.strokeStyle=this._data.color,(0,c.setLineStyle)(e,u.LINESTYLE_DASHED),t=Math.max(1,Math.floor(i))),e.lineWidth=t,e.beginPath(),e.moveTo(o-t/2,h-t/2),e.lineTo(o-t/2,p+t/2),e.lineTo(a+t/2,p+t/2),e.lineTo(a+t/2,h-t/2),e.lineTo(o-t/2,h-t/2),e.stroke(),d&&e.restore()}}e.fillStyle=this._data.color;const _=(o+Math.round(s.textStart*i))/i,m=.05*n;let g=(h+Math.round((s.textTop+m)*i))/i;const f=C(this._data),v=this._getLinesInfo();for(const t of v.lines)(0,d.drawScaled)(e,i,()=>e.fillText(t,_,g)),g+=n+f;e.restore()}_getLinesMaxWidth(e){if(_||m(),_.textBaseline="alphabetic",_.font=this.fontStyle(),null!==this._data&&this._data.wordWrapWidth&&!this._data.forceCalculateMaxLineWidth)return this._data.wordWrapWidth*I(this._data);let t=0;for(const i of e)t=Math.max(t,_.measureText(i).width);return t}_getInternalData(){if(null!==this._internalData)return this._internalData;const e=(0,r.ensureNotNull)(this._data),t=this._getBoxSize(),i=t.boxWidth,s=t.boxHeight,n=(0,r.ensureDefined)(e.points)[0];let a=n.y;switch(e.vertAlign){case"bottom":a-=s+e.offsetY;break;case"middle":a-=s/2;break;case"top":a+=e.offsetY}let l=n.x;const c=b(e),h=y(e),d=P(e)+c;let u;const p=a+(w(e)+h)+T(e)/2;let _;switch(e.horzAlign){case"left":l+=e.offsetX;break;case"center":l-=i/2;break;case"right":l-=i+e.offsetX}switch((0, r.ensureDefined)(e.horzTextAlign)){case"left":_="start",u=l+d,(0,o.isRtl)()&&(e.forceTextAlign?_="left":(u=l+i-d,_="right"));break;case"center":_="center",u=l+i/2;break;case"right":_="end",u=l+i-d,(0,o.isRtl)()&&e.forceTextAlign&&(_="right")}return this._internalData={boxLeft:l,boxTop:a,boxWidth:i,boxHeight:s,textStart:u-l,textTop:p-a,textAlign:_,textBaseLine:"middle"},this._internalData}_getLinesInfo(){if(null===this._linesInfo){const e=(0,r.ensureNotNull)(this._data);let t=this.wordWrap(e.text,e.wordWrapWidth);if(void 0!==e.maxHeight){const i=function(e){const t=(0,r.ensureDefined)(e.maxHeight),i=T(e),s=C(e);return Math.floor((t+s)/(i+s))}(e);t.length>i&&(t=t.slice(0,i))}this._linesInfo={linesMaxWidth:this._getLinesMaxWidth(t),lines:t}}return this._linesInfo}_getFontInfo(){if(null===this._fontInfo){const e=(0,r.ensureNotNull)(this._data),t=T(e),i=(e.bold?"bold ":"")+(e.italic?"italic ":"")+t+"px "+e.font;this._fontInfo={fontStyle:i,fontSize:t}}return this._fontInfo}_getBoxSize(){if(null===this._boxSize){const e=this._getLinesInfo(),t=(0,r.ensureNotNull)(this._data);this._boxSize={boxWidth:v(t,e.linesMaxWidth),boxHeight:S(t,e.lines.length)}}return this._boxSize}_getPolygonPoints(){if(null!==this._polygonPoints)return this._polygonPoints;if(null===this._data)return[];const e=this._data.angle||0,{boxLeft:t,boxTop:i,boxWidth:r,boxHeight:n}=this._getInternalData(),o=this._getRotationPoint();return this._polygonPoints=[f(new s.Point(t,i),o,e),f(new s.Point(t+r,i),o,e),f(new s.Point(t+r,i+n),o,e),f(new s.Point(t,i+n),o,e)],this._polygonPoints}_getRotationPoint(){const{boxLeft:e,boxTop:t,boxWidth:i,boxHeight:n}=this._getInternalData(),{horzAlign:o,vertAlign:a}=(0,r.ensureNotNull)(this._data);let l,c;switch(o){case"center":l=e+i/2;break;case"left":l=e;break;case"right":l=e+i}switch(a){case"middle":c=t+n/2;break;case"top":c=t;break;case"bottom":c=t+n}return new s.Point(l,c)}}},6397:(e,t,i)=>{"use strict";i.d(t,{drawArrow:()=>d,TrendLineRenderer:()=>u});var s=i(16282),r=i(89684),n=i(71172),o=i(10288),a=i(5025),l=i(21344),c=i(55430);function h(e,t,i,s,r){t.save(),t.fillStyle="#000000",t.beginPath(),t.arc(e.x*r,e.y*r,i*r,0,2*Math.PI,!1),t.fill(),s.strokeWidth&&(t.lineWidth=s.strokeWidth,t.stroke()),t.restore()}function d(e,t,i,s,r,n=!1){if(t.subtract(e).length()<1)return;const o=(0,l.getArrowPoints)(e,t,s,n);for(let e=0;e0&&(l[0].x===l[1].x?(0, c.drawVerticalLine)(e,Math.round(l[0].x*s),l[0].y*s,l[1].y*s):l[0].y===l[1].y?(0,c.drawHorizontalLine)(e,Math.round(l[0].y*s),l[0].x*s,l[1].x*s):(0,a.drawLine)(e,l[0].x*s,l[0].y*s,l[1].x*s,l[1].y*s)),i.overlayLineEndings&&this._drawEnds(e,o,i.linewidth,s)}hitTest(e,t){const i=this._data;if(null===i)return null;if("points"in i&&i.points.length<2)return null;const s=(0,l.interactionTolerance)().line,n=i.points[0],o=i.points[1],a=this._extendAndClipLineSegment(n,o,t);if(null!==a){if((0,r.distanceToSegment)(a[0],a[1],e).distance<=s)return this._hittest}return null}_extendAndClipLineSegment(e,t,i){const r=(0,s.ensureNotNull)(this._data);return(0,l.extendAndClipLineSegment)(e,t,i.cssWidth,i.cssHeight,r.extendleft,r.extendright)}_drawEnds(e,t,i,r){const o=t[0],a=t[1],l=(0,s.ensureNotNull)(this._data);switch(l.leftend){case n.LineEnd.Arrow:d(a,o,e,i,r);break;case n.LineEnd.Circle:h(o,e,i,(0,s.ensureDefined)(l.endstyle),r)}switch(l.rightend){case n.LineEnd.Arrow:d(o,a,e,i,r);break;case n.LineEnd.Circle:h(a,e,i,(0,s.ensureDefined)(l.endstyle),r)}}}},69819:(e,t,i)=>{"use strict";i.d(t,{VerticalLineRenderer:()=>a});var s=i(10288),r=i(5025),n=i(55430),o=i(21344);class a{constructor(){this._data=null,this._hitTest=new s.HitTestResult(s.HitTestResult.MOVEPOINT)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||null===this._hitTest)return null;const t=(0,o.interactionTolerance)().line,i=Math.abs(e.x-this._data.x)<=t+this._data.linewidth/2,s=void 0===this._data.top||this._data.top-e.y<=t,r=void 0===this._data.bottom||e.y-this._data.bottom<=t;return i&&s&&r?this._hitTest:null}draw(e,t){if(null===this._data)return;if(this._data.linewidth<=0)return;if(this._data.x<-this._data.linewidth/2||this._data.x>t.cssWidth+this._data.linewidth/2)return;const i=t.pixelRatio;e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(e,this._data.linestyle);const s=void 0!==this._data.top?Math.max(this._data.top,0):0,o=void 0!==this._data.bottom?Math.min(this._data.bottom,t.cssHeight):t.cssHeight,a=Math.round(this._data.x*i),l=Math.floor(s*i),c=Math.ceil(o*i);(0,n.drawVerticalLine)(e,a,l,c)}}},36512:(e,t,i)=>{"use strict";i.d(t,{specialZOrderBase:()=>s,sortSourcesPreOrdered:()=>r,sortSources:()=>n});const s=1e7,r={ChartEventsSource:s+1,Dividends:s+2,Splits:s+3,Earnings:s+4,LineToolOrder:s+5,LineToolPosition:s+6,LineToolExecution:s+7,AlertLabel:s+8};function n(e){return[...e].sort((e,t)=>e.zorder()-t.zorder())}},37923:(e,t,i)=>{"use strict";var s=i(5729),r=i(49382).moveToHead,n=i(22769).ExecutionsPositionController,o=i(76117).LineDataSource,a=i(50044).isPriceDataSource,l=i(67945).isLineTool,c=i(56451).PriceScale,h=i(3092).createPriceScaleSelectionStrategy,d=i(6805).PaneBase,u=i(36512).sortSources;class p extends d{constructor(e,t,i,r){super(e,t,i,r),this.m_timeScale=e,this.m_mainDataSource=null,this._properties=t,this._model=i,this._destroyed=new s, i.properties().priceScaleSelectionStrategyName.listeners().subscribe(null,function(e){this._priceScaleSelectionStrategy=h(e.value()),this._priceScaleSelectionStrategy.apply(this)}.bind(this)),this.m_timeScale.barSpacingChanged().subscribe(this,function(){this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())}.bind(this)),t.topMargin.listeners().subscribe(this,p.prototype._updateMargins),t.bottomMargin.listeners().subscribe(this,p.prototype._updateMargins),this._updateMargins(),this._maximized=!1}destroy(){this._properties.topMargin.listeners().unsubscribe(this,p.prototype._updateMargins),this._properties.bottomMargin.listeners().unsubscribe(this,p.prototype._updateMargins),this._model.properties().priceScaleSelectionStrategyName.listeners().unsubscribeAll(this),this.m_timeScale.barSpacingChanged().unsubscribeAll(this),this._leftPriceScales.concat(this._rightPriceScales).forEach((function(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this)}),this);for(var e=0;ee.left){var t=r(this._leftPriceScales,this.mainDataSource().priceScale());return t.splice(e.left),t}return this._leftPriceScales}visibleRightPriceScales(){var e=this._model.priceScaleSlotsCount();if(this._rightPriceScales.length>e.right){var t=r(this._rightPriceScales,this.mainDataSource().priceScale());return t.splice(e.right),t}return this._rightPriceScales}timeScale(){return this.m_timeScale}_processMainSourceChange(){var e;if(null===this.m_mainDataSource)for(var t=0;t{this.removeSourceFromPriceScale(e),l.addDataSource(e),e.setPriceScale(l)}),this.removePriceScale(c)}this.move(r,l,!0), this.recalculatePriceScale(r.priceScale())}}}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews()}endScrollPrice(e){e.endScroll()}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e)}defaultPriceScale(){var e=this.m_mainDataSource?this.m_mainDataSource.priceScale():null;return null===e&&(e=new c(this._model.properties().scalesProperties)),e}_priceScaleIsPrice(e){var t=e.mainSource();return!!t&&(!!TradingView.isInherited(t.constructor,TradingView.Series)||!!TradingView.isInherited(t.constructor,TradingView.Study)&&t.metaInfo().is_price_study)}findSuitableScale(e,t,i){return this._priceScaleSelectionStrategy.findSuitableScale(this,e,t,i)}createNewPriceScaleIfPossible(){return this._priceScaleSelectionStrategy.createNewPriceScaleIfPossible(this)}canCreateNewPriceScale(){return this._priceScaleSelectionStrategy.canCreateNewPriceScale(this)}mainDataSource(){return this.m_mainDataSource}recalculate(){this.recalculatePriceScale(this.m_rightPriceScale),this.recalculatePriceScale(this.m_leftPriceScale);for(var e=0;e=0;t--)TradingView.isInherited(this.m_dataSources[t].constructor,TradingView.Series)&&this._removeSourceFromCollections(t,e)}nonOverlayPricesSourcesCount(){return this.m_dataSources.filter((function(e){return(!e.properties().linkedToSeries||!e.properties().linkedToSeries.value())&&(a(e)&&e.showInObjectTree()&&!this.isOverlay(e))}),this).length}canHaveMoreNoScaleSources(){return this.nonOverlayPricesSourcesCount()>1}actionNoScaleIsEnabled(e){return!(!this.isOverlay(e)&&a(e))||this.canHaveMoreNoScaleSources()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new n(this,this._model.timeScale())),this._executionsPositionController}setMaximized(e){this._maximized=e}isMaximized(){return this._maximized}properties(){return this._properties}priceScaleRatio(){return this._currentPriceScaleRatio}getPriceScaleById(e){var t=this.m_dataSources.find((function(t){return null!==t.priceScale()&&t.priceScale().id()===e}));return void 0===t?null:t.priceScale()}setPriceScaleSelectionStrategy(e){this._priceScaleSelectionStrategy=e,e.apply(this)}priceScaleIndex(e,t){switch(t){case"left":return this.leftPriceScales().indexOf(e);case"right":return this.rightPriceScales().indexOf(e)}}}p.DEFAULT_STRETCH_FACTOR=1e3,p.PANE_ANIMATION_DURATION=500,t.Pane=p},61627:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ PlotRowSearchMode:()=>a,PlotList:()=>h,mergeMinMax:()=>d,mergePlotRows:()=>u});var s=i(16282),r=i(49382),n=i(67620);const o=(0,i(65447).getLogger)("Chart.PlotList");var a;!function(e){e[e.NearestLeft=-1]="NearestLeft",e[e.Exact=0]="Exact",e[e.NearestRight=1]="NearestRight"}(a||(a={}));function l(e){return e.index}function c(e){return e.value[0]}class h{constructor(e=null,t=null){this._items=[],this._start=0,this._end=0,this._shareRead=!1,this._minMaxCache=new Map,this._rowSearchCacheByIndex=new Map,this._rowSearchCacheByIndexWithoutEmptyValues=new Map,this._rowSearchCacheByTime=new Map,this._rowSearchCacheByTimeWithoutEmptyValues=new Map,this._plotFunctions=e||new Map,this._emptyValuePredicate=t}clear(){this._items=[],this._start=0,this._end=0,this._shareRead=!1,this._minMaxCache.clear(),this._invalidateSearchCaches()}first(){return this.size()>0?this._items[this._start]:null}last(){return this.size()>0?this._items[this._end-1]:null}firstIndex(){return this.size()>0?this._indexAt(this._start):null}lastIndex(){return this.size()>0?this._indexAt(this._end-1):null}size(){return this._end-this._start}isEmpty(){return 0===this.size()}contains(e){return null!==this.search(e,a.Exact)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}add(e,t){if(this._shareRead)return o.logDebug("add: readonly collection modification attempt"),!1;const i={index:e,value:t},s=this._nonCachedSearch(e,a.Exact,l);return this._invalidateSearchCaches(),null===s?(this._items.splice(this._lowerbound(e,l),0,i),this._start=0,this._end=this._items.length,!0):(this._items[s]=i,!1)}search(e,t=a.Exact,i){return this._searchImpl(e,t,this._rowSearchCacheByIndex,this._rowSearchCacheByIndexWithoutEmptyValues,l,i)}searchByTime(e,t=a.Exact,i){return this._searchImpl(e,t,this._rowSearchCacheByTime,this._rowSearchCacheByTimeWithoutEmptyValues,c,i)}fold(e,t){let i=t;for(let t=this._start;t=i;--t){const i=this._indexAt(t),s=this._valueAt(t);if(e(i,s))return{index:i,value:s}}return null}each(e){for(let t=this._start;t!1,next:()=>{throw new Error("Invalid operation")}};let r=i-1;return{hasNext:()=>r(r+=1,this._items[r])}}minMaxOnRangeCached(e,t,i){if(this.isEmpty())return null;let s=null;for(const r of i){ s=d(s,this._minMaxOnRangeCachedImpl(e-r.offset,t-r.offset,r.name))}return s}minMaxOnRange(e,t,i){if(this.isEmpty())return null;let s=null;for(const r of i){s=d(s,this._minMaxOnRange(e-r.offset,t-r.offset,r.name))}return s}merge(e){return this._shareRead?(o.logDebug("merge: readonly collection modification attempt"),null):0===e.length?null:this.isEmpty()||e[e.length-1].indexthis._items[this._items.length-1].index?this._append(e):1===e.length&&e[0].index===this._items[this._items.length-1].index?(this._updateLast(e[0]),e[0]):this._merge(e)}addTail(e,t=!1){let i=0;t&&this._end-this._start>0&&(i=1,this._items[this._end-this._start-1].value=e[0].value);for(let t=i;tvoid 0!==e).sort((e,t)=>e.index-t.index),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._start=0,this._end=this._items.length}remove(e){if(this._shareRead)return o.logDebug("remove: readonly collection modification attempt"),null;const t=this._nonCachedSearch(e,a.NearestRight,l);if(null===t)return null;const i=this._items.splice(t);return this._end=this._items.length,this._minMaxCache.clear(),this._invalidateSearchCaches(),i.length>0?i[0]:null}state(){return{start:this._start,end:this._end,data:this._items,shareread:this._shareRead}}restoreState(e){e?(this._start=e.start,this._end=e.end,this._shareRead=e.shareread,this._items=e.data,this._minMaxCache.clear(),this._invalidateSearchCaches()):this.clear()}_indexAt(e){return this._items[e].index}_valueAt(e){return this._items[e].value}_length(){return this._items.length}_searchImpl(e,t,i,s,r,n){const o=void 0!==n?i:s,a=void 0!==n?1e4*(t+1)+n:t;let l=o.get(e);if(void 0!==l){const e=l.get(a);if(void 0!==e)return e}const c=this._nonCachedSearch(e,t,r,n);if(null===c)return null;const h={index:this._indexAt(c),value:this._valueAt(c)};return void 0===l&&(l=new Map,o.set(e,l)),l.set(a,h),h}_nonCachedSearch(e,t,i,s){const r=this._lowerbound(e,i),n=r===this._end||e!==i(this._items[r]);if(n&&t!==a.Exact)switch(t){case a.NearestLeft:return this._searchNearestLeft(r,s);case a.NearestRight:return this._searchNearestRight(r,s);default:throw new TypeError("Unknown search mode")}if(void 0===s||n||t===a.Exact)return n?null:r;switch(t){case a.NearestLeft:return this._nonEmptyNearestLeft(r,s);case a.NearestRight:return this._nonEmptyNearestRight(r,s);default:throw new TypeError("Unknown search mode")}}_nonEmptyNearestRight(e,t){const i=(0, s.ensure)(this._emptyValuePredicate),r=(0,s.ensure)(t);for(;e=this._start&&i(this._valueAt(e),r);)e-=1;return et(e)t.index>e,this._start,this._end)}_plotMinMax(e,t,i){let s=null;const r=this._plotFunctions.get(i);if(void 0===r)throw new Error(`Plot "${i}" is not registered`);for(let i=e;is.max&&(s.max=e)))}return s}_invalidateCacheForRow(e){const t=Math.floor(e.index/30);this._minMaxCache.forEach(e=>e.delete(t))}_prepend(e){return(0,s.assert)(!this._shareRead,"collection should not be readonly"),(0,s.assert)(0!==e.length,"plotRows should not be empty"),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._items=e.concat(this._items),this._start=0,this._end=this._items.length,e[0]}_append(e){return(0,s.assert)(!this._shareRead,"collection should not be readonly"),(0,s.assert)(0!==e.length,"plotRows should not be empty"),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._items=this._items.concat(e),this._start=0,this._end=this._items.length,e[0]}_updateLast(e){(0,s.assert)(!this.isEmpty(),"plot list should not be empty");const t=this._items[this._end-1];(0,s.assert)(t.index===e.index,"last row index should match new row index"),this._invalidateCacheForRow(e),this._invalidateSearchCaches(),this._items[this._end-1]=e}_merge(e){return(0,s.assert)(0!==e.length,"plot rows should not be empty"),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._items=u(this._items,e),this._start=0,this._end=this._items.length,e[0]}_minMaxOnRangeCachedImpl(e,t,i){if(this.isEmpty())return null;let r=null;const n=(0,s.ensureNotNull)(this.firstIndex()),o=(0,s.ensureNotNull)(this.lastIndex()),a=Math.max(e,n),l=Math.min(t,o),c=30*Math.ceil(a/30),h=Math.max(c,30*Math.floor(l/30));r=d(r,this._minMaxOnRange(a,Math.min(c,t,l),i));let u=this._minMaxCache.get(i);void 0===u&&(u=new Map,this._minMaxCache.set(i,u));for(let e=Math.max(c+1,a);et[o].index?o++:(n++,o++,r--);return r}(e,t),s=new Array(i);let r=0,n=0;const o=e.length,a=t.length;let l=0;for(;rt[n].index?(s[l]=t[n],n++):(s[l]=t[n],r++,n++),l++;for(;r{"use strict";i.d(t,{PriceAxisView:()=>p});var s=i(72927),r=i(71044),n=i(87910),o=i(50968),a=i(76553),l=i(16932),c=i(10288),h=i(55430),d=i(10992);class u{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,r,n,c){var d,u,p;const _=this._data;if(!_.visible||this._isOutOfScreen(t,r))return;const m=this._commonData,g=void 0!==_.labelIcon,f=_.ignoreOffset?0:t.offsetSize,v=t.borderSize,S=t.paddingTop+m.additionalPaddingTop,y=t.paddingBottom+m.additionalPaddingBottom,b=t.paddingInner,w=t.paddingOuter,P=t.fontSize;let C=_.text,T=_.textColor||m.textColor,x=_.secondLine||"",I=m.secondLineTextColor||T,M=_.thirdLine||"";const L=m.thirdLineTextColor||T;0===x.length&&(x=M,I=L,M=""),0===C.length&&(C=x,T=I,x=M,I=L,M=""),e.save(),e.font=t.font;const A=i.yMidCorrection(e,C)*c,k=Math.ceil(i.measureText(e,C)),E=P+S+y,D=Boolean(x),V=Boolean(M),B=D?Math.ceil(i.measureText(e,x)):0,N=V?Math.ceil(i.measureText(e,M)):0,R=v+b+w+k+f,O=B>0?v+b+w+B+f:0,F=N>0?v+b+w+N+f:0,W=Math.max(R,O,F),H=Math.max(1,Math.floor(c));let z=Math.round(E*c);z%2!=H%2&&(z+=1);const U=Math.round((P+t.lineSpacing)*c),j=Math.round(2*(P+t.lineSpacing)*c),G=Math.max(1,Math.floor(v*c)),q=_.separatorVisible?G:0,Y=_.borderVisible?G:0,$=g?z:Math.round(W*c),K=Math.round(f*c),X=Math.ceil(s*c),Z=Math.ceil(b*c),J=Math.round((null!==(d=m.fixedCoordinate)&&void 0!==d?d:m.coordinate)*c)-Math.floor(.5*c),Q=Math.floor(J+H/2-z/2),ee=Q+z,te="right"===n,ie=te?X-q:q,se=X;let re,ne=ie;const oe=(0,o.resetTransparency)(null!==(u=_.backgroung)&&void 0!==u?u:m.background);e.fillStyle=oe;const ae=2*c;if(e.textAlign=te?"right":"left",e.textBaseline="middle",te?(ne=ie-$,re=ie-K-Z-1):(ne=ie+$,re=ie+K+Z),C||g){const i=V?z+j:D?z+U:z;if(((t,s,r)=>{te?(0,h.drawRoundRectWithInnerBorder)(e,ne,Q,$,i,t,[ae,0,0,ae],Y,s,r):(0,h.drawRoundRectWithInnerBorder)(e,ie,Q,$,i,t,[0,ae,ae,0],Y,s,r)})(oe,null!==(p=m.borderColor)&&void 0!==p?p:oe,m.borderStyle),_.separatorVisible&&(e.fillStyle=t.paneBackgroundColor,e.fillRect(te?se-q:0,Q,q,ee-Q)),g){switch(_.labelIcon){case 0:this._drawPlusIcon(e,ie,ne,Q,J,ee,H);break;case 1:this._drawClockIcon(e,ie,ne,J,H,c)}return void e.restore()}e.save(),e.translate(re,(Q+ee)/2+A),(0,l.drawScaled)(e,c,()=>{e.fillStyle=T,e.fillText(C,0,0)}),e.restore()}D&&(e.fillStyle=I,e.save(),e.translate(re,(Q+ee)/2+A+U),(0,l.drawScaled)(e,c,()=>{e.fillText((0, a.startWithLTR)(x),0,0)}),e.restore()),V&&(e.fillStyle=L,e.save(),e.translate(re,(Q+ee)/2+A+j),(0,l.drawScaled)(e,c,()=>{e.fillText((0,a.startWithLTR)(M),0,0)}),e.restore()),e.restore()}height(e){const t=this._lines();return this._data.visible&&0!==t?t*e.fontSize+(t-1)*e.lineSpacing+e.paddingTop+this._commonData.additionalPaddingTop+e.paddingBottom+this._commonData.additionalPaddingBottom:0}hitTest(e){const t=this._data.hitTestData;if(void 0===t||!this._data.visible)return null;const i=(0,n.lastMouseOrTouchEventInfo)().isTouch?10:0,o=(0,s.box)(new s.Point(t.xl-i,t.y-i),new s.Point(t.xl+t.containerWidth+i,t.y+t.containerHeight+i)),a=t.left&&(0,r.pointInBox)(e,o),l=(0,s.box)(new s.Point(t.xr-i,t.y-i),new s.Point(t.xr+t.containerWidth+i,t.y+t.containerHeight+i)),h=t.right&&(0,r.pointInBox)(e,l);if(a||h){const i=a?"left":"right";return new c.HitTestResult(c.HitTestResult.CUSTOM,{cursorType:d.PaneCursorType.Default,clickHandler:void 0===t.clickHandler?void 0:t.clickHandler.bind(this,e,i),tapHandler:void 0===t.clickHandler?void 0:t.clickHandler.bind(this,e,i),tooltip:t.tooltip})}return null}_drawPlusIcon(e,t,i,s,r,n,o){e.fillStyle=this._commonData.textColor,e.strokeStyle=this._commonData.textColor,e.lineWidth=o;const a=Math.abs(t-i);let l=Math.round(.35*a);l%2!=o%2&&(l+=1);let c=Math.round(.65*a);c%2!=o%2&&(c+=1);const h=Math.floor((a-l)/2),d=Math.min(t,i),u=d+Math.floor(a/2-o/2);e.fillRect(d+h,r,l,o),e.fillRect(u,s+h,o,l),e.beginPath(),e.arc(u+o/2,r+o/2,c/2,0,2*Math.PI,!1),e.stroke()}_drawClockIcon(e,t,i,s,r,n){e.fillStyle=this._commonData.textColor,e.lineWidth=r;const o=Math.abs(t-i);let a=Math.round(.35*o);a%2!=r%2&&(a+=1);let l=Math.round(.65*o);l%2!=r%2&&(l+=1);const c=Math.min(t,i)+Math.floor(o/2-r/2);e.save(),e.translate(c+r/2-l/2,s+r/2-l/2),e.scale(n,n);const h=new Path2D("M7.5 0.8a1 1 0 0 0 0 13.4 1 1 0 0 0 0-13.4zm0 1a1 1 0 0 1 0 11 1 1 0 0 1 0-11zm-.97-.25A3.5 3.5 0 0 0 3.5 0 3.5 3.5 0 0 0 0 3.5a3.5 3.5 0 0 0 1.75 3.03l.5-.86A2.5 2.5 0 0 1 1 3.5 2.5 2.5 0 0 1 3.5 1a2.5 2.5 0 0 1 2.17 1.25zm6.72 4.78A3.5 3.5 0 0 0 15 3.5 3.5 3.5 0 0 0 11.5 0a3.5 3.5 0 0 0-3.03 1.75l.86.5A2.5 2.5 0 0 1 11.5 1 2.5 2.5 0 0 1 14 3.5a2.5 2.5 0 0 1-1.25 2.17zM7 5h1v5H7zm3 2v1H5V7z");e.fill(h),e.restore()}_lines(){const e=this._data;return(e.text?1:0)+(e.secondLine?1:0)+(e.thirdLine?1:0)}_isOutOfScreen(e,t){var i;const s=this._commonData,r=null!==(i=s.fixedCoordinate)&&void 0!==i?i:s.coordinate,n=this.height(e),o=n/this._lines();return r-o/2-3>t||r+(n-o/2)+3<0}}class p{constructor(e){this._commonRendererData={coordinate:0,textColor:"#FFF",background:"#000",additionalPaddingBottom:0,additionalPaddingTop:0},this._axisRendererData={text:"",visible:!1,separatorVisible:!1,borderVisible:!1,ignoreOffset:!1},this._paneRendererData={text:"",visible:!1,separatorVisible:!0,borderVisible:!1,ignoreOffset:!0},this._invalidated=!0,this._axisRenderer=new(e||u)(this._axisRendererData,this._commonRendererData),this._paneRenderer=new(e||u)(this._paneRendererData,this._commonRendererData)}text(){return this._updateRendererDataIfNeeded(), this._axisRendererData.text}secondLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.secondLine}thirdLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.thirdLine}background(){return this._updateRendererDataIfNeeded(),this._commonRendererData.background}color(){return this._updateRendererDataIfNeeded(),this.generateTextColor(this.background())}generateTextColor(e){return(0,o.colorFromBackground)(e)}coordinate(){return this._updateRendererDataIfNeeded(),this._commonRendererData.coordinate}floatCoordinate(){var e;return this._updateRendererDataIfNeeded(),null!==(e=this._commonRendererData.floatCoordinate)&&void 0!==e?e:this._commonRendererData.coordinate}update(){this._invalidated=!0}height(e){return this._updateRendererDataIfNeeded(),Math.max(this._axisRenderer.height(e),this._paneRenderer.height(e))}getFixedCoordinate(){return this._commonRendererData.fixedCoordinate||0}setFixedCoordinate(e){this._commonRendererData.fixedCoordinate=e}isVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible||this._paneRendererData.visible}isAxisLabelVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible}isPaneLabelVisible(){return this._updateRendererDataIfNeeded(),this._paneRendererData.visible}renderer(){return this._updateRendererDataIfNeeded(),this._axisRenderer}paneRenderer(){return this._updateRendererDataIfNeeded(),this._paneRenderer}setPaneRendererLabelIcon(e){this._paneRendererData.labelIcon=e}setPaneLabelVisible(e){this._paneRendererData.visible=e,this._invalidated=!0}ignoreAlignment(){return!1}_updateRendererDataIfNeeded(){this._invalidated&&(this._commonRendererData.fixedCoordinate=void 0,this._updateRendererData(this._axisRendererData,this._paneRendererData,this._commonRendererData),this._invalidated=!1)}}},50044:(e,t,i)=>{"use strict";i.d(t,{isPriceDataSource:()=>a,PriceDataSource:()=>l});var s=i(46015),r=i(5729),n=i.n(r),o=i(58007);function a(e){return e instanceof l}class l extends s.DataSource{constructor(e){super(),this._formatterChanged=new(n()),this._priceStepChanged=new(n()),this._currencyChanged=new(n()),this._unitChanged=new(n()),this._priceRangeReadyChanged=new(n()),this._priceStep=null,this._priceRangeReady=!0,this._model=e}barColorer(){return null}base(){return 0}model(){return this._model}currencyChanged(){return this._currencyChanged}isCurrencySource(){return!0}unitChanged(){return this._unitChanged}isUnitSource(){return!0}priceRange(e,t){return null}isDraggable(){return!0}priceLineColor(e){return e}formatterChanged(){return this._formatterChanged}priceStep(e){return this._priceStep}priceStepChanged(){return this._priceStepChanged}isIncludedInAutoScale(){return!0}correctScaleMargins(e){return e}priceRangeReady(){return this._priceRangeReady}priceRangeReadyChanged(){return this._priceRangeReadyChanged}disablePriceRangeReady(){const e=this.priceScale();null===e||e.isAutoScale()||e.mainSource()!==this||(this._priceRangeReady=!1,e.recalculatePriceRangeOnce()),this._priceRangeReadyChanged.fire(!1)} statusView(){return null}legendView(){return null}marketStatusModel(){return null}dataUpdatedModeModel(){return null}dataProblemModel(){return null}_enablePriceRangeReady(){this._priceRangeReady=!0,this._priceRangeReadyChanged.fire(!0)}_onSourceCurrencyChanged(){(0,o.isSymbolSource)(this)||this._currencyChanged.fire()}_onSourceUnitChanged(){(0,o.isSymbolSource)(this)||this._unitChanged.fire()}_onSourcePriceRangeReadyChanged(e){(0,o.isSymbolSource)(this)||e||this.disablePriceRangeReady()}}},46556:(e,t,i)=>{"use strict";i.d(t,{PriceLineAxisView:()=>c,SeriesPriceLineAxisView:()=>h,StudyPriceLineAxisView:()=>d});var s=i(95426),r=i(16282),n=i(5025),o=i(33420),a=i(55430);class l{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,l,c,h){var d;if(!this._data.visible)return;const u=null!==(d=this._commonData.fixedCoordinate)&&void 0!==d?d:this._commonData.coordinate;e.lineWidth=Math.max(1,Math.floor((0,r.ensureDefined)(this._data.linewidth)*h)),e.lineCap="butt",(0,n.setLineStyle)(e,void 0===this._data.linestyle?o.LINESTYLE_DOTTED:this._data.linestyle),e.strokeStyle=this._commonData.textColor,(0,a.drawHorizontalLine)(e,Math.round(u*h),0,Math.ceil(s*h))}height(e){return 0}}class c extends s.PriceAxisView{constructor(e){super(e||l)}ignoreAlignment(){return!0}_updateRendererData(e,t,i){if(t.visible=!1,e.visible=!1,!this._isVisible())return;const s=this._value();s.noData||(i.background="",i.textColor=this._priceLineColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate,e.linewidth=this._lineWidth(),e.linestyle=this._lineStyle(),e.backgroundAreaVisible=this._backgroundAreaVisible(),e.backgroundAreaColor=this._backgroundAreaColor(),e.backgroundAreaHeight=this._backgroundAreaHeight(),e.visible=!0)}_lineStyle(){return o.LINESTYLE_DOTTED}_backgroundAreaVisible(){return!1}_backgroundAreaColor(){return""}_backgroundAreaHeight(){return 0}}class h extends c{constructor(e){super(),this._series=e}_value(){return this._series.lastValueData(void 0,!0)}_priceLineColor(e){return this._series.priceLineColor(e)}_lineWidth(){return this._series.properties().childs().priceLineWidth.value()}_isVisible(){const e=this._series.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._series.properties().childs().showPriceLine.value()&&e}}class d extends c{constructor(e,t){super(),this._study=e,this._plotname=t}_value(){return this._study.lastValueData(this._plotname,!0)}_lineWidth(){return this._study.properties().styles[this._plotname].linewidth.value()}_lineStyle(){return o.LINESTYLE_DOTTED}_priceLineColor(e){return e}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showStudyLastValue.value();return this._study.properties().styles[this._plotname].trackPrice.value()&&e}}},63339:(e,t,i)=>{"use strict";i.d(t,{PriceScaleBase:()=>L});var s=i(16282),r=i(47903),n=i(5729),o=i.n(n),a=i(49382),l=i(25303),c=i(77036),h=i(95975),d=i(50044),u=i(674),p=i.n(u),_=i(17e3),m=i(58007),g=i(25436),f=i(42010),v=i(36512),S=i(57968) ;class y{constructor(e,t){if(this._base=e,this._integralDividers=t,(0,S.isBaseDecimal)(this._base))this._fractionalDividers=[2,2.5,2];else{this._fractionalDividers=[];for(let e=this._base;1!==e;){if(e%2==0)this._fractionalDividers.push(2),e/=2;else{if(e%5!=0)throw new Error("unexpected base");this._fractionalDividers.push(2),this._fractionalDividers.push(2.5),e/=5}if(this._fractionalDividers.length>100)throw new Error("something wrong with base")}}}tickSpan(e,t,i){const s=0===this._base?0:1/this._base;let r=Math.pow(10,Math.max(0,Math.ceil((0,S.log10)(e-t)))),n=0,o=this._integralDividers[0];for(;;){const e=(0,S.greaterOrEqual)(r,s,1e-14)&&r>s+1e-14,t=(0,S.greaterOrEqual)(r,i*o,1e-14),a=(0,S.greaterOrEqual)(r,1,1e-14);if(!(e&&t&&a))break;r/=o,o=this._integralDividers[++n%this._integralDividers.length]}if(r<=s+1e-14&&(r=s),r=Math.max(1,r),this._fractionalDividers.length>0&&(0,S.equal)(r,1,1e-14))for(n=0,o=this._fractionalDividers[0];(0,S.greaterOrEqual)(r,i*o,1e-14)&&r>s+1e-14;)r/=o,o=this._fractionalDividers[++n%this._fractionalDividers.length];return r}}class b{constructor(e,t,i,s){this._marks=null,this._priceScale=e,this._base=t,this._coordinateToLogicalFunc=i,this._logicalToCoordinateFunc=s}base(){return this._base}setBase(e){if(e<0)throw new Error("base < 0");this._base=e}tickSpan(e,t,i=0){if(ei&&(l=c);const h=o.tickSpan(e,t,r);h>i&&(l=Math.min(l,h));const d=a.tickSpan(e,t,r);return d>i&&(l=Math.min(l,d)),l>0?l:e-t}rebuildTickMarks(){this._marks=null}marks(){return null===this._marks&&(this._marks=this._rebuildTickMarksImpl()),this._marks}_fontHeight(){return this._priceScale.fontSize()}_tickMarkHeight(){return Math.ceil(2.5*this._fontHeight())}_rebuildTickMarksImpl(){const e=this._priceScale,t=[],i=e.mainSource();if(e.isEmpty()||null===i)return t;let s=i.firstValue();null===s&&(s=0);const r=e.height(),n=this._coordinateToLogicalFunc(r-1,s),o=this._coordinateToLogicalFunc(0,s),a=Math.max(n,o),l=Math.min(n,o);if(a===l)return t;let c=this.tickSpan(a,l),h=a%c;h+=h<0?c:0;const d=a>=l?1:-1;let u=null;const p=e.formatter();let _=NaN;for(let i=a-h;i>l;i-=c){i===_&&(c=this.tickSpan(a,l,c)),_=i;const r=this._logicalToCoordinateFunc(i,s);null!==u&&Math.abs(r-u)e?(0,c.toLog)(e,this._logFormula):e),null!==h)for(let e=0;ethis._currencyCache=null),e.unitChanged().subscribe(this,()=>this._unitCache=null),(0,m.isSymbolSource)(e)&&(this._seriesLikeSources.push(e),this._seriesLikeSourcesSet.add(e),e.symbolResolved().subscribe(this,()=>{this._currencyCache=null,this._unitCache=null}),e instanceof h.Series))){const t=e.properties();this._hasSeries||(t.childs().lockScale&&(this.setMode({lockScale:t.childs().lockScale.value()}),t.removeProperty("lockScale")), t.childs().pnfStyle.child("lockScale")&&t.childs().pnfStyle.removeProperty("lockScale")),this._hasSeries=!0}e.properties().visible.listeners().subscribe(this,this._dropScaleCache),(0,_.isStudy)(e)&&(e.onIsActualIntervalChange().subscribe(this,this._dropScaleCache),e.onHibernationStateChange().subscribe(this,this._dropScaleCache),0===this._studiesCount&&(0,P.hideAllIndicators)().subscribe(this,this._dropScaleCache),this._studiesCount++),(0,w.isLineTool)(e)&&(0===this._drawingCount&&(0,P.hideAllDrawings)().subscribe(this,this._dropScaleCache),this._drawingCount++),this.m_dataSources.push(e),this._mainSource=null,this._correctedMarginsCache=null,this._sourcesToUpdateViews=null,this._dropScaleCache(),this.updateFormatter(),this._initScaleProperties(),this.invalidateSourcesCache()}}removeDataSource(e){const t=this.m_dataSources.indexOf(e);if((0,s.assert)(-1!==t,"Source is not attached to scale"),e.properties().visible.listeners().unsubscribe(this,this._dropScaleCache),this.m_dataSources.splice(t,1),(0,d.isPriceDataSource)(e)){const t=this._priceDataSources.indexOf(e);if((0,s.assert)(-1!==t,"Source is not found"),this._priceDataSources.splice(t,1),(0,m.isSymbolSource)(e)){const t=this._seriesLikeSources.indexOf(e);(0,s.assert)(-1!==t,"Source is not found"),this._seriesLikeSources.splice(t,1),this._seriesLikeSourcesSet.delete(e),e.symbolResolved().unsubscribeAll(this),e instanceof h.Series&&(this._hasSeries=!1)}e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this)}this.mainSource()||this.setMode({autoScale:!0}),(0,_.isStudy)(e)&&(e.onIsActualIntervalChange().unsubscribe(this,this._dropScaleCache),e.onHibernationStateChange().unsubscribe(this,this._dropScaleCache),this._studiesCount--,0===this._studiesCount&&(0,P.hideAllIndicators)().unsubscribe(this,this._dropScaleCache)),(0,w.isLineTool)(e)&&(this._drawingCount--,0===this._drawingCount&&(0,P.hideAllDrawings)().unsubscribe(this,this._dropScaleCache)),this._mainSource=null,this._correctedMarginsCache=null,this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this.updateFormatter(),this.invalidateSourcesCache(),0===this.m_dataSources.length&&this._lastSourceRemoved.fire(),this._currencyCache=null,this._unitCache=null}currency(e){if(null!==this._currencyCache&&e.size()===this._currencyCache.availableCurrenciesCount)return this._currencyCache.value;let t;const i=new Set,r=new Set,n=new Set,o=new Map;let a,l=0===this._seriesLikeSources.length,c=!0,h=0,d=0;for(const d of this._seriesLikeSources){if(!d.isVisible())continue;const u=d.symbolInfo();if(null===u){t=null;break}const p=(0,g.symbolOriginalCurrency)(u);if(null===p){t=null;break}o.set(p,(0,s.ensureNotNull)((0,g.symbolOriginalCurrency)(u,!0)));const _=d.currency();if(null===_){t=null;break}o.set(_,(0,s.ensureNotNull)((0,g.symbolCurrency)(u,!0)));const m=(0,g.symbolBaseCurrency)(u);null!==m&&r.add(m),c=c&&p===_,n.add(_),i.add(p),void 0===a?a=_:null!==a&&a!==_&&(a=null),l||e.convertible(_)&&(0,g.symbolCurrencyConvertible)(u)||(l=!0),h+=1}if(null!==t)for(const i of this._priceDataSources){ if(this._seriesLikeSourcesSet.has(i))continue;const r=i;if(!r.isCurrencySource()||!r.isVisible())continue;const c=r.currency();if(null===c){t=null;break}n.add(c),d+=1;const h=(0,s.ensureNotNull)(r.symbolSource()),u=r.currencySourceSymbolInfo();if(null===u){t=null;break}if(l||e.convertible(c)&&(0,g.symbolCurrencyConvertible)(u)||(l=!0),o.set(c,(0,s.ensureNotNull)((0,g.symbolCurrency)(u,!0))),this._seriesLikeSourcesSet.has(h)||(l=!0),void 0===a)a=c;else if(null!==a&&a!==c){a=null;break}}return void 0===t&&(t=0===h&&0===d?null:{readOnly:l,selectedCurrency:a||null,currencies:n,originalCurrencies:i,baseCurrencies:r,symbolSourceCount:h,allCurrenciesAreOriginal:c,displayedValues:o}),this._currencyCache={value:t,availableCurrenciesCount:e.size()},t}unit(e){if(null!==this._unitCache&&e.size()===this._unitCache.availableUnitsCount)return this._unitCache.value;let t;const i=new Set,r=new Set,n=new Map,o=new Map;let l,c=0===this._seriesLikeSources.length?new Set:e.allGroups(),h=!0,d=0,u=0;for(const s of this._seriesLikeSources){if(!s.isVisible())continue;const u=s.symbolInfo();if(null===u){t=null;break}const p=(0,g.symbolOriginalUnit)(u);if(null===p){t=null;break}n.set(p,e.name(p)),o.set(p,e.description(p));const _=s.unit();if(null===_){t=null;break}if(n.set(_,e.name(_)),o.set(_,e.description(_)),h=h&&p===_,r.add(_),i.add(p),void 0===l?l=_:null!==l&&l!==_&&(l=null),c.size>0){const t=(0,f.unitConvertibleGroups)(u,_,e);c=(0,a.intersect)(c,new Set(t))}d+=1}if(null!==t)for(const i of this._priceDataSources){if(this._seriesLikeSourcesSet.has(i))continue;const h=i;if(!h.isUnitSource()||!h.isVisible())continue;const d=h.unit();if(null===d){t=null;break}r.add(d),u+=1;const p=(0,s.ensureNotNull)(h.symbolSource()),_=p.symbolInfo();if(null===_){t=null;break}if(c.size>0){const t=(0,f.unitConvertibleGroups)(_,d,e);c=(0,a.intersect)(c,new Set(t))}if(n.set(d,e.name(d)),o.set(d,e.description(d)),this._seriesLikeSourcesSet.has(p)||(c=new Set),void 0===l)l=d;else if(null!==l&&l!==d){l=null;break}}if(void 0===t)if(0===d&&0===u)t=null;else{const e=l||null;t={availableGroups:c,selectedUnit:e,units:r,originalUnits:i,symbolSourceCount:d,allUnitsAreOriginal:h,names:n,descriptions:o}}return this._unitCache={value:t,availableUnitsCount:e.size()},t}setMargins(e){if(!(0,r.isNumber)(e.top)||!(0,r.isNumber)(e.bottom))throw new TypeError("invalid margin");if(e.top<0||e.top>30||e.bottom<0||e.bottom>30)throw new RangeError("invalid margin");this._margins.top===e.top&&this._margins.bottom===e.bottom||(this._margins=e,this._correctedMarginsCache=null,this._invalidateInternalHeightCache(),this._marksCache=null)}topMargin(){return this._correctedMargins().top}bottomMargin(){return this._correctedMargins().bottom}invalidateMargins(){this._correctedMarginsCache=null}topPixelMargin(){return this.isInverted()?this.bottomMargin()*this.height()+this._bottomPixelMargin:this.topMargin()*this.height()+this._topPixelMargin}bottomPixelMargin(){return this.isInverted()?this.topMargin()*this.height()+this._topPixelMargin:this.bottomMargin()*this.height()+this._bottomPixelMargin }marks(){return this._makeSureItIsValid(),null===this._marksCache&&(this._markBuilder.rebuildTickMarks(),this._marksCache=this._markBuilder.marks(),this._onMarksChanged.fire()),this._marksCache}onMarksChanged(){return this._onMarksChanged}priceRangeInPrice(){if(this.isEmpty())return null;const e=this.mainSource();if(null===e)return null;const t=(0,s.ensureNotNull)(e.firstValue()),i=this.height();return{from:this.coordinateToPrice(i-1,t),to:this.coordinateToPrice(0,t)}}setPriceRangeInPrice(e){if(this.isPercentage()||this.isIndexedTo100())return;const t=this.isInverted(),i=t?this.bottomMargin():this.topMargin(),s=t?this.topMargin():this.bottomMargin(),r=this.isLog();let n=r?(0,c.toLog)(e.from,this._logFormula):e.from,o=r?(0,c.toLog)(e.to,this._logFormula):e.to;const a=o-n;n+=s*a,o-=i*a,this.setMode({autoScale:!1}),this.setPriceRange(new l.PriceRange(n,o)),this._marksCache=null,this._onMarksChanged.fire()}hasMainSeries(){return this._hasSeries}getStudies(){return this.dataSources().filter(_.isStudy)}lastSourceRemoved(){return this._lastSourceRemoved}sourcesForAutoscale(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.childs().scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||(this._sourcesForAutoscale=this._recalculateSourcesForAutoscale()),this._sourcesForAutoscale}recalculatePriceRange(e){this._invalidatedForRange={visibleBars:e,isValid:!1}}internalHeightChanged(){return this._internalHeightChanged}orderedSources(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;let e=this.m_dataSources.slice();return e=(0,v.sortSources)(e),this._cachedOrderedSoruces=e,this._cachedOrderedSoruces}invalidateSourcesCache(){this._cachedOrderedSoruces=null,this._sourcesToUpdateViews=null}startScale(e){var t,i;this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint||null!==this._priceRangeSnapshot||(this._scaleStartPoint=this.m_height-e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null)}scaleTo(e){if(this.isPercentage()||this.isIndexedTo100()||null===this._scaleStartPoint)return;this.setMode({autoScale:!1}),(e=this.m_height-e)<0&&(e=0);let t=(this._scaleStartPoint+.2*(this.m_height-1))/(e+.2*(this.m_height-1));const i=(0,s.ensureNotNull)(this._priceRangeSnapshot).clone();t=Math.max(t,.1),i.scaleAroundCenter(t),this.setPriceRange(i)}endScale(){this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._priceRangeSnapshot=null)}startTwoPointsScale(e,t){if(this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._twoPointsScaleStartPosition)return;const i=Math.min(e,t),s=Math.max(e,t);this._twoPointsScaleStartPosition={topLogical:this._coordinateToLogical(i),bottomLogical:this._coordinateToLogical(s)}}twoPointsScale(e,t){if(this.isPercentage()||this.isIndexedTo100()||null===this._twoPointsScaleStartPosition)return;this.setMode({autoScale:!1}) ;const i=Math.min(e,t),s=Math.max(e,t),{topLogical:r,bottomLogical:n}=this._twoPointsScaleStartPosition,o=this.bottomPixelMargin(),a=this.internalHeight()-1,c=(this._invertedCoordinate(i)-o)/a,h=(n-r)/((this._invertedCoordinate(s)-o)/a-c),d=r-h*c,u=d+h;this.setPriceRange(new l.PriceRange(this.priceToLogical(d),this.priceToLogical(u)))}endTwoPointsScale(){this._twoPointsScaleStartPosition=null}startScroll(e){var t,i;this.isAutoScale()||null===this._scrollStartPoint&&null===this._priceRangeSnapshot&&(this.isEmpty()||(this._scrollStartPoint=e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null))}scrollTo(e){if(this.isAutoScale())return;if(null===this._scrollStartPoint||null===this._priceRangeSnapshot)return;const t=this.priceRange();if(null===t)return;let i=e-this._scrollStartPoint;this.isInverted()&&(i*=-1);const s=i*(t.length()/(this.internalHeight()-1)),r=this._priceRangeSnapshot.clone();r.shift(s),this.setPriceRange(r,!0),this._marksCache=null}endScroll(){this.isAutoScale()||null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._priceRangeSnapshot=null)}_recalculateSourcesForAutoscale(){this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.childs().scaleSeriesOnly.value());const e=this._scaleSeriesOnly&&this._hasSeries;return this.m_dataSources.filter(t=>!!(t.properties().visible.value()||t instanceof h.Series)&&(e?t instanceof h.Series:(0,_.isStudy)(t)?!t.isSourceHidden()&&t.isIncludedInAutoScale():t.isIncludedInAutoScale()))}_updateAutoScaleDisabledProperty(e){const t=this._properties.childs(),i=t.indexedTo100.value()||t.percentage.value()||t.lockScale.value();e?t.autoScaleDisabled.setValueSilently(i):t.autoScaleDisabled.setValue(i)}_setAutoScaleValueWithDependentProperties(e){const t=this._properties.childs();t.autoScale.setValueSilently(e),e&&(t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.logDisabled.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLockScaleValueWithDependentProperties(e){const t=this._properties.childs();t.lockScale.setValueSilently(e),e&&(t.autoScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.log.setValueSilently(!1)),t.percentageDisabled.setValueSilently(e),t.logDisabled.setValueSilently(e),this._updateAutoScaleDisabledProperty(!0)}_setPercentageValueWithDependentProperties(e){const t=this._properties.childs();t.percentage.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setIndexedTo100ValueWithDependentProperties(e){const t=this._properties.childs();t.indexedTo100.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLogValueWithDependentProperties(e){const t=this._properties.childs() ;t.log.setValueSilently(e),e&&(t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_recalculatePriceRangeImpl(){const e=this._invalidatedForRange.visibleBars;if(null===e)return;let t=null;const i=this.sourcesForAutoscale(),s=this.isPercentage(),r=this.isIndexedTo100();let n=0,o=0;for(const a of i){if(!a.properties().visible.value())continue;const i=a.firstValue();if(null===i)continue;const l=e.firstBar(),h=e.lastBar(),d=a.autoScaleInfo(l,h);let u=d.range;u&&(s?u=(0,c.toPercentRange)(u,i):r&&(u=(0,c.toIndexedTo100Range)(u,i)),t=null===t?u:t.merge(u)),void 0!==d.topPixelMargin&&(n=Math.max(n,d.topPixelMargin)),void 0!==d.bottomPixelMargin&&(o=Math.max(o,d.bottomPixelMargin))}if((Math.abs(n-this._topPixelMargin)>0||Math.abs(o-this._bottomPixelMargin)>0)&&(this._bottomPixelMargin=o,this._topPixelMargin=n,this._marksCache=null,this._invalidateInternalHeightCache()),t){if(t.minValue()===t.maxValue()&&(t=new l.PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.isLog()){const e=this._convertPriceRangeFromLog(t),i=(0,c.logFormulaForPriceRange)(e);if(!(0,c.logFormulasAreSame)(i,this._logFormula)){const s=this._priceRangeSnapshot?this._convertPriceRangeFromLog(this._priceRangeSnapshot):null;this._logFormula=i,t=this._convertPriceRangeToLog(e),s&&(this._priceRangeSnapshot=this._convertPriceRangeToLog(s))}}this.setPriceRange(t)}else this.m_priceRange||(this.setPriceRange(new l.PriceRange(-.5,.5)),this._logFormula=(0,c.logFormulaForPriceRange)(null));this._invalidatedForRange.isValid=!0;const a=this.mainSource();null!==a&&this._recalculatePriceRangeOnce&&(this._recalculatePriceRangeOnce=!a.priceRangeReady())}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null,this._internalHeightChanged.fire()}_coordinateToLogical(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;const t=this._invertedCoordinate(e),i=(0,s.ensureNotNull)(this.priceRange()),r=i.minValue()+(i.maxValue()-i.minValue())*((t-this.bottomPixelMargin())/(this.internalHeight()-1));return this.logicalToPrice(r)}_logicalToCoordinate(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;e=this.priceToLogical(e);const t=(0,s.ensureNotNull)(this.priceRange()),i=this.bottomPixelMargin()+(this.internalHeight()-1)*(e-t.minValue())/(t.maxValue()-t.minValue());return this._invertedCoordinate(i)}_dropScaleCache(){this._sourcesForAutoscale=null,this._currencyCache=null,this._unitCache=null}_invertedCoordinate(e){return this.isInverted()?e:this.height()-1-e}_initScaleProperties(){const e=this.isLockScale(),t=this.properties().childs();e&&(t.percentage.setValue(!1),t.indexedTo100.setValue(!1),t.log.setValue(!1),t.autoScale.setValue(!1)),t.percentageDisabled.setValue(e),t.logDisabled.setValue(e),this._updateAutoScaleDisabledProperty(!1),t.percentage.value()&&(t.log.setValue(!1),t.indexedTo100.setValue(!1)),t.indexedTo100.value()&&(t.log.setValue(!1), t.percentage.setValue(!1))}_correctedMargins(){if(null===this._correctedMarginsCache){const e=this.mainSource();this._correctedMarginsCache=null!==e?e.correctScaleMargins(this._margins):this._margins}return this._correctedMarginsCache}_getSourcesToUpdateViews(){return this._sourcesToUpdateViews||(this._sourcesToUpdateViews=this.m_dataSources.filter(e=>!(0,w.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency())),this._sourcesToUpdateViews}_mainSourceFormatter(){const e=this.mainSource();return(null==e?void 0:e.formatter())||I}_priceToPercentOrIndexedTo100IfNeeded(e,t){return this.isPercentage()?(0,c.toPercent)(e,t):this.isIndexedTo100()?(0,c.toIndexedTo100)(e,t):e}}},84995:(e,t,i)=>{"use strict";var s;i.d(t,{PriceAxisLastValueMode:()=>s}),function(e){e[e.LastPriceAndPercentageValue=0]="LastPriceAndPercentageValue",e[e.LastValueAccordingToScale=1]="LastValueAccordingToScale"}(s||(s={}))},77036:(e,t,i)=>{"use strict";i.r(t),i.d(t,{fromPercent:()=>o,toPercent:()=>a,toPercentRange:()=>l,fromIndexedTo100:()=>c,toIndexedTo100:()=>h,toIndexedTo100Range:()=>d,toLog:()=>u,fromLog:()=>p,logFormulaForPriceRange:()=>_,logFormulasAreSame:()=>m,getCurrentModePriceText:()=>g,getOppositeModePriceText:()=>f});var s=i(25303),r=i(57968);const n={logicalOffset:4,coordOffset:1e-4};function o(e,t){return t<0&&(e=-e),e/100*t+t}function a(e,t){const i=100*(e-t)/t;return t<0?-i:i}function l(e,t){const i=a(e.minValue(),t),r=a(e.maxValue(),t);return new s.PriceRange(i,r)}function c(e,t){return t<0&&(e=-e),(e-=100)/100*t+t}function h(e,t){const i=100*(e-t)/t+100;return t<0?-i:i}function d(e,t){const i=h(e.minValue(),t),r=h(e.maxValue(),t);return new s.PriceRange(i,r)}function u(e,t){const i=Math.abs(e);if(i<1e-15)return 0;const s=(0,r.log10)(i+t.coordOffset)+t.logicalOffset;return e<0?-s:s}function p(e,t){const i=Math.abs(e);if(i<1e-15)return 0;const s=Math.pow(10,i-t.logicalOffset)-t.coordOffset;return e<0?-s:s}function _(e){if(null===e)return n;const t=Math.abs(e.maxValue()-e.minValue());if(t>=1||t<1e-15)return n;const i=Math.ceil(Math.abs(Math.log10(t))),s=n.logicalOffset+i;return{logicalOffset:s,coordOffset:1/Math.pow(10,s)}}function m(e,t){return e.logicalOffset===t.logicalOffset&&e.coordOffset===t.coordOffset}function g(e,t){return e.isPercentage()?t.formattedPricePercentage:e.isIndexedTo100()?t.formattedPriceIndexedTo100:t.formattedPriceAbsolute}function f(e,t){return e.isPercentage()||e.isIndexedTo100()?t.formattedPriceAbsolute:t.formattedPricePercentage}},25303:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PriceRange:()=>n});var s=i(47903);const r=(0,i(65447).getLogger)("Chart.PriceRange");class n{constructor(e,t){if(null!==e&&"object"==typeof e){const t=e;this._minValue=t.m_minValue,this._maxValue=t.m_maxValue}else{const i=e;this._minValue=i,void 0!==t&&(this._maxValue=t)}}equals(e){return this._minValue===e._minValue&&this._maxValue===e._maxValue}clone(){return new n(this._minValue,this._maxValue)}minValue(){return this._minValue}setMinValue(e){this._minValue=e}maxValue(){return this._maxValue}setMaxValue(e){this._maxValue=e}length(){ return this._maxValue-this._minValue}isEmpty(){return this._maxValue===this._minValue||this._maxValue!=this._maxValue||this._minValue!=this._minValue}serialize(){return{m_maxValue:this._maxValue,m_minValue:this._minValue}}state(){return{max:this._maxValue,min:this._minValue}}merge(e){return new n(Math.min(this.minValue(),e.minValue()),Math.max(this.maxValue(),e.maxValue()))}apply(e,t){this._minValue=Math.min(this._minValue,e),this._maxValue=Math.max(this._maxValue,t)}set(e,t){this._minValue=e,this._maxValue=t}scaleAroundCenter(e){if(!(0,s.isNumber)(e))return void r.logDebug("PriceRange.scaleAroundCenter: invalid coeff");if(0===this._maxValue-this._minValue)return;const t=.5*(this._maxValue+this._minValue);let i=this._maxValue-t,n=this._minValue-t;i*=e,n*=e,this._maxValue=t+i,this._minValue=t+n}shift(e){(0,s.isNumber)(e)?(this._maxValue+=e,this._minValue+=e):r.logDebug("PriceRange.shift: invalid coeff")}containsStrictly(e){return e.minValue()>this._minValue&&e.maxValue(){"use strict";var s=i(5729),r=i(63339).PriceScaleBase,n=i(50044).isPriceDataSource,o=i(25303).PriceRange,a=i(45259).randomHash,l=i(17e3).isStudy,c=i(77036),h=c.fromLog,d=c.toLog;class u extends r{constructor(e,t){super(t),this._scalesProperties=e;var i=this;this._modeChanged=new s,this._properties.isInverted.listeners().subscribe(this,u.prototype._onIsInvertedChanged),this._properties.listeners().subscribe(null,(function(){if(i.mainSource()&&i.mainSource().model()){var e=i.mainSource().model().paneForSource(i.mainSource());i.mainSource().model().updatePane(e)}})),this._scalesProperties.listeners().subscribe(this,(function(){this._marksCache=null})),this.setId(a())}_convertPriceRangeFromLog(e){if(null===e)return null;var t=h(e.minValue(),this._logFormula),i=h(e.maxValue(),this._logFormula);return new o(t,i)}_convertPriceRangeToLog(e){if(null===e)return null;var t=d(e.minValue(),this._logFormula),i=d(e.maxValue(),this._logFormula);return new o(t,i)}_canConvertPriceRangeFromLog(e){if(null===e)return!1;var t=h(e.minValue(),this._logFormula),i=h(e.maxValue(),this._logFormula);return isFinite(t)&&isFinite(i)}mode(){return{autoScale:this._properties.autoScale.value(),lockScale:this._properties.lockScale.value(),percentage:this._properties.percentage.value(),indexedTo100:this._properties.indexedTo100.value(),log:this._properties.log.value()}}setMode(e){var t={},i=this.mode(),s=this._properties.state(),r=null;void 0!==e.autoScale&&e.autoScale!==s.autoScale&&(t.autoScale=e.autoScale,this._setAutoScaleValueWithDependentProperties(e.autoScale)),void 0!==e.lockScale&&e.lockScale!==s.lockScale&&(t.lockScale=e.lockScale,this._setLockScaleValueWithDependentProperties(e.lockScale)),void 0!==e.percentage&&e.percentage!==s.percentage&&(t.percentage=e.percentage,this._setPercentageValueWithDependentProperties(e.percentage),this._invalidatedForRange.isValid=!1),void 0!==e.indexedTo100&&e.indexedTo100!==s.indexedTo100&&(t.indexedTo100=e.indexedTo100, this._setIndexedTo100ValueWithDependentProperties(e.indexedTo100),this._invalidatedForRange.isValid=!1),void 0!==e.log&&e.log!==s.log&&(t.log=e.log,this._setLogValueWithDependentProperties(e.log)),s.log&&!this._properties.log.value()&&(this._canConvertPriceRangeFromLog(this.m_priceRange)?null!==(r=this._convertPriceRangeFromLog(this.m_priceRange))&&this.setPriceRange(r):this.properties().autoScale.setValue(!0)),!s.log&&this._properties.log.value()&&null!==(r=this._convertPriceRangeToLog(this.m_priceRange))&&this.setPriceRange(r),s.autoScale!==this._properties.autoScale.value()&&this._properties.autoScale.listeners().fire(this._properties.autoScale),s.autoScaleDisabled!==this._properties.autoScaleDisabled.value()&&this._properties.autoScaleDisabled.listeners().fire(this._properties.autoScaleDisabled),s.lockScale!==this._properties.lockScale.value()&&this._properties.lockScale.listeners().fire(this._properties.lockScale),s.percentage!==this._properties.percentage.value()&&(this._properties.percentage.listeners().fire(this._properties.percentage),this.updateFormatter()),s.indexedTo100!==this._properties.indexedTo100.value()&&(this._properties.indexedTo100.listeners().fire(this._properties.indexedTo100),this.updateFormatter()),s.percentageDisabled!==this._properties.percentageDisabled.value()&&this._properties.percentageDisabled.listeners().fire(this._properties.percentageDisabled),s.log!==this._properties.log.value()&&this._properties.log.listeners().fire(this._properties.log),s.logDisabled!==this._properties.logDisabled.value()&&this._properties.logDisabled.listeners().fire(this._properties.logDisabled),void 0===t.log&&void 0===t.percentage&&void 0===t.lockScale&&void 0===t.autoScale&&void 0===t.indexedTo100||this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}fontSize(){return this._scalesProperties.fontSize.value()}isEmpty(){return this._makeSureItIsValid(),0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}canDetachSource(e){return this.m_dataSources.some((function(t){return t!==e&&n(t)&&!(l(t)&&t.isLinkedToSeries())}))}}t.PriceScale=u},68137:(e,t,i)=>{"use strict";i.d(t,{createPrimitiveProperty:()=>n});var s=i(674),r=i.n(s);function n(e){return new(r())(e)}},53226:(e,t,i)=>{"use strict";i.d(t,{convertPropertyToWatchedValue:()=>n});var s=i(32856),r=i.n(s);function n(e){const t=new(r())(e.value());let i=!1;e.subscribe(t,()=>{i||(i=!0,t.setValue(e.value()),i=!1)});const s=()=>{i||(i=!0,e.setValue(t.value()),i=!1)};return t.subscribe(s),t.spawn(()=>{e.unsubscribeAll(t),t.unsubscribe(s)})}},69881:(e,t,i)=>{"use strict";i.d(t,{combineProperty:()=>n,createWVFromGetterAndSubscription:()=>s.createWVFromGetterAndSubscription});var s=i(51759);i(98445),i(674);var r=i(68137);function n(e,...t){const i=()=>e(...t.map(e=>e.value())),s=(0,r.createPrimitiveProperty)(i()),n=()=>s.setValue(i()),o={};for(const e of t)e.subscribe(o,n);return s.destroy=()=>{t.forEach(e=>e.unsubscribeAll(o))},s}},51759:(e,t,i)=>{ "use strict";i.d(t,{createWVFromGetterAndSubscription:()=>n});var s=i(32856),r=i.n(s);function n(e,t){const i=new(r())(e()),s={};t.subscribe(s,()=>{i.setValue(e())});return i.readonly().spawn(()=>t.unsubscribeAll(s))}},98445:(e,t,i)=>{"use strict";i.d(t,{createWVFromGetterAndSubscriptions:()=>n});var s=i(32856),r=i.n(s);function n(e,t){const i=new(r())(e()),s={};t.forEach(t=>t.subscribe(s,()=>{i.setValue(e())}));return i.readonly().spawn(()=>t.forEach(e=>e.unsubscribeAll(s)))}},674:(e,t,i)=>{"use strict";var s=i(5729),r=i(47903).isFunction;function n(e){if(this._listeners=new s,this._childs=[],this._muteChildChanges=!1,void 0!==e)if(this.isPrimitiveType(e))this._value=e;else for(var t in e)this.addProperty(t,e[t])}n.prototype.merge=function(e,t){var i=null;if(t)var s=(i=[]).length;if(void 0===e)return i;if(this.isPrimitiveType(e))return t&&this._value!==e&&i.push(this),this._value=e,i;if(Array.isArray(e))for(var r=0;rs&&i.push(this),i},n.prototype.mergeAndFire=function(e){var t=this.merge(e,!0);this._muteChildChanges=!0,t.forEach((function(e){e._muteChildChanges=!0})),t.forEach((function(e){e._muteChildChanges=!1,e.listeners().fire(e)})),this._muteChildChanges=!1,t.length>0&&this.listeners().fire(this)},n.prototype.state=function(e){var t=r(this.value)?this.value():void 0;void 0===t&&(t={});for(var i=0;i=0},n.prototype.addChild=function(e,t){this[e]&&this[e].unsubscribe(this,this.childChanged),this[e]=t, -1===this._childs.indexOf(e)&&this._childs.push(e),t.subscribe(this,this.childChanged)},n.prototype.childChanged=function(e,t){this._muteChildChanges||this.listeners().fire(this)},n.prototype.subscribe=function(e,t){this.listeners().subscribe(e,t,!1)},n.prototype.unsubscribe=function(e,t){this.listeners().unsubscribe(e,t)},n.prototype.unsubscribeAll=function(e){this.listeners().unsubscribeAll(e)},n.prototype.childs=function(){return this},e.exports=n},84310:(e,t,i)=>{"use strict";i.d(t,{QuotesProvider:()=>a});var s=i(17915),r=i(5729),n=i.n(r),o=i(45259);class a{constructor(e="full"){this._quotes=null,this._quoteSessionSymbol=null,this._quoteSessionClientId="",this._quotesUpdate=new(n()),this._quoteSymbolChanged=new(n()),this._multiplexerType=e}setQuotesSessionSymbol(e){this._quoteSessionSymbol!==e&&(this._quoteSessionClientId||(this._quoteSessionClientId="series-"+(0,o.guid)()),this._unsubscribeQuoteSession(),e&&this._subscribeQuoteSession(e),this._quoteSymbolChanged.fire())}quotesUpdate(){return this._quotesUpdate}quoteSymbolChanged(){return this._quoteSymbolChanged}quotes(){return this._quotes}destroy(){this._unsubscribeQuoteSession()}_onUpdate(e,t){this._quotes=e&&e.values||null,t&&t.values&&this._quotesUpdate.fire(e,t)}_subscribeQuoteSession(e){this._quoteSessionSymbol=e,(0,s.getQuoteSessionInstance)(this._multiplexerType).subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,this._onUpdate.bind(this))}_unsubscribeQuoteSession(){this._quoteSessionSymbol&&((0,s.getQuoteSessionInstance)(this._multiplexerType).unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=null,this._quotes=null)}}},91840:(e,t,i)=>{"use strict";i.d(t,{rangesAreEqual:()=>n});var s=i(89077),r=i(35001);function n(e,t){return!!r.Interval.isEqual(e.res,t.res)&&(0,s.areEqualTimeFrames)(e.val,t.val)}},1467:(e,t,i)=>{"use strict";i.r(t),i.d(t,{normalizeIntervalString:()=>_,isAvailable:()=>m,setLastUsedResolution:()=>g,getRangeResolution:()=>f,getTimeBasedResolution:()=>v,getDefaultResolution:()=>S,getResolutionByChartStyle:()=>y,getServerInterval:()=>b,isResolutionMultiplierValid:()=>w,getMaxResolutionValue:()=>C,getResolutionsFromSettings:()=>T,convertResolutionsFromSettings:()=>x,mergeResolutions:()=>I,sortResolutions:()=>M,getCustomResolutions:()=>k,getTranslatedResolution:()=>E,getTranslatedResolutionModel:()=>D,isSecondsEnabled:()=>B,isTicksEnabled:()=>N});var s=i(79881),r=i(35001),n=i(25436),o=i(64222),a=i(24287),l=i(4334),c=i(47903),h=i(27490);const d={[r.ResolutionKind.Ticks]:1,[r.ResolutionKind.Seconds]:60,[r.ResolutionKind.Minutes]:1440,[r.SpecialResolutionKind.Hours]:24,[r.ResolutionKind.Days]:365,[r.ResolutionKind.Weeks]:52,[r.ResolutionKind.Months]:12,[r.ResolutionKind.Range]:1e6,[r.ResolutionKind.Invalid]:NaN},u={[r.ResolutionKind.Ticks]:0,[r.ResolutionKind.Seconds]:1,[r.ResolutionKind.Minutes]:2,[r.SpecialResolutionKind.Hours]:3,[r.ResolutionKind.Days]:4,[r.ResolutionKind.Weeks]:5,[r.ResolutionKind.Months]:6,[r.ResolutionKind.Range]:7,[r.ResolutionKind.Invalid]:8},p={ [r.ResolutionKind.Invalid]:"",[r.ResolutionKind.Ticks]:(0,s.t)("T",{context:"interval_short"}),[r.ResolutionKind.Seconds]:(0,s.t)("s",{context:"interval_short"}),[r.ResolutionKind.Minutes]:(0,s.t)("m",{context:"interval_short"}),[r.SpecialResolutionKind.Hours]:(0,s.t)("h",{context:"interval_short"}),[r.ResolutionKind.Days]:(0,s.t)("D",{context:"interval_short"}),[r.ResolutionKind.Weeks]:(0,s.t)("W",{context:"interval_short"}),[r.ResolutionKind.Months]:(0,s.t)("M",{context:"interval_short"}),[r.ResolutionKind.Range]:(0,s.t)("R",{context:"interval_short"})};function _(e){return r.Interval.parse(e).value()}function m(e){const t=r.Interval.parse(e);if(!B()&&t.isSeconds())return!1;if(!N()&&t.isTicks())return!1;const i=t.value(),s=a.linking.supportedResolutions.value();return void 0!==s?void 0!==s.find(e=>_(e)===i):t.isSeconds()?Boolean(a.linking.seconds.value()):t.isTicks()?Boolean(a.linking.ticks.value()):t.isIntraday()?Boolean(a.linking.intraday.value()):t.isDWM()}function g(e){r.Interval.isValid(e)&&(r.Interval.isRange(e)?o.setValue("chart.lastUsedRangeResolution",e):o.setValue("chart.lastUsedTimeBasedResolution",e))}function f(e){const t=o.getValue("chart.lastUsedRangeResolution");if(void 0!==t&&r.Interval.isRange(t))return t;let i="100R";for(const t of e){const e=r.Interval.parse(t);if(e.isRange()){const t=e.value();if("100R"===t)return t;i=t}}return i}function v(e){const t=o.getValue("chart.lastUsedTimeBasedResolution");if(void 0!==t&&r.Interval.isTimeBased(t))return t;let i="1D";for(const t of e){const e=r.Interval.parse(t);if(e.isTimeBased()){const t=e.value();if("1D"===t)return t;i=t}}return i}function S(e){return e?"100R":"1D"}function y(e,t,i){const s=n.isRangeStyle(e),o=r.Interval.isRange(t);return!s&&o?v(i):s&&!o?f(i):t}function b(e){return r.Interval.isRange(e)?"1":e}function w(e){const{interval:t,guiResolutionKind:i}=r.Interval.parseExt(e);if(!t.isValid())return!1;return(i===r.SpecialResolutionKind.Hours?t.multiplier()/60:t.multiplier())<=P(i)}function P(e){const t=d[e];return Number.isNaN(t)?1:t}function C(e){return P(r.Interval.parseExt(e).guiResolutionKind)}function T(e){const t=x(o.getJSON(e,[]));return(0,l.uniq)(t.filter(w).map(_))}function x(e){return Array.isArray(e)?e:Object.keys(e).map(r.Interval.normalize).filter(c.notNull)}function I(...e){let t=[].concat(...e);return t=(0,l.uniq)(t.filter(w).map(_)),M(t)}function M(e){return e.sort(A)}function L(e){const t=r.Interval.parse(e),i=t.multiplier()||1;return t.isMinuteHours()?[r.SpecialResolutionKind.Hours,i/60]:[t.kind(),i]}function A(e,t){const[i,s]=L(e),[r,n]=L(t);return i!==r?u[i]-u[r]:s-n}function k(){return[]}function E(e){const{multiplier:t,shortKind:i}=D(e);return`${t}${i}`}function D(e,t){const i=r.Interval.parse(e);let s=i.multiplier(),n=i.kind();if(!i.isValid()){if(t)return null;throw new TypeError("Can't translate invalid interval")}return i.isMinuteHours()&&(s=Math.floor(s/60),n=r.SpecialResolutionKind.Hours),{multiplier:s.toString(),shortKind:V(n),hint:`${s} ${V(n,s)}`,mayOmitMultiplier:i.isDWM()&&1===s, mayOmitShortKind:i.isMinutes()&&!i.isMinuteHours()}}function V(e,t){if(!t)return p[e];switch(e){case r.ResolutionKind.Ticks:return(0,s.t)("tick",{plural:"ticks",count:t});case r.ResolutionKind.Days:return(0,s.t)("day",{plural:"days",count:t});case r.ResolutionKind.Weeks:return(0,s.t)("week",{plural:"weeks",count:t});case r.ResolutionKind.Months:return(0,s.t)("month",{plural:"months",count:t});case r.ResolutionKind.Seconds:return(0,s.t)("second",{plural:"seconds",count:t});case r.ResolutionKind.Minutes:return(0,s.t)("minute",{plural:"minutes",count:t});case r.SpecialResolutionKind.Hours:return(0,s.t)("hour",{plural:"hours",count:t});case r.ResolutionKind.Range:return(0,s.t)("range",{plural:"ranges",count:t});default:return e}}function B(){return h.enabled("seconds_resolution")}function N(){return h.enabled("tick_resolution")}},2397:(e,t,i)=>{"use strict";i.d(t,{scaleRatio:()=>r,priceRangeByScaleRatio:()=>n,barSpacingByScaleRatio:()=>o});var s=i(25303);function r(e,t){if(t.isLog()||e.isEmpty()||t.isEmpty())return null;const i=function(e){if(e.isEmpty())return null;const t=e.priceRange();if(null===t)return null;const i=t.length();return e.internalHeight()/i}(t);if(null===i)return null;return e.getValidBarSpacing()/Math.max(1e-10,i)}function n(e,t,i){if(e.isLog()||null===i||e.isEmpty())return null;const r=e.priceRange();if(null===r||r.isEmpty())return null;const n=e.internalHeight()/(t/i),o=r.length();if(n===o)return r;const a=(n-o)/2;return new s.PriceRange(r.minValue()-a,r.maxValue()+a)}function o(e,t){if(e.isLog()||null===t||e.isEmpty())return null;const i=e.priceRange();if(null===i)return null;const s=i.length();return e.internalHeight()/s*t}},3092:(e,t,i)=>{"use strict";i.d(t,{createPriceScaleSelectionStrategy:()=>l,allPriceScaleSelectionStrategyInfo:()=>c});var s=i(16282),r=i(79881),n=i(17e3);class o{constructor(e){this._priceScalesLimit=8,this._metaInfo=e}metaInfo(){return this._metaInfo}findSuitableScale(e,t,i,s){if(void 0!==s)return this._tryToGetDesiredPriceScale(e,t,s,i);if((0,n.isStudy)(t)){const s=t.metaInfo();if("Volume"===s.shortId&&e.containsMainSeries())return e.createPriceScaleAtPosition("overlay");const r=t.desiredPriceScalePosition();if(null!==r)return this._tryToGetDesiredPriceScale(e,t,r,i);if(void 0!==i&&((0,n.isStudy)(i)||e.isMainPane())&&s.is_price_study)return this._getPriceScaleTheSameAsForSource(i,e)}let r=!1;if((0,n.isStudy)(t)){const i=t.metaInfo().groupingKey;if(void 0!==i){const t=e.model().findNonOverlayStudyWithGroupingKey(i,e);if(null!==t)return this._getPriceScaleTheSameAsForSource(t.study,t.pane)}r=Boolean(t.metaInfo().is_price_study)}else t===e.model().mainSeries()&&(r=!0);if(r){const t=this._findFirstScaleForPriceStudy(e);if(null!==t)return t}return this.createNewPriceScaleIfPossible(e)}canCreateNewPriceScale(e){return e.leftPriceScales().length+e.rightPriceScales().lengthi&&this._priceScaleIsPrice(e.rightPriceScales()[i],t))return e.rightPriceScales()[i];if(e.leftPriceScales().length>i&&this._priceScaleIsPrice(e.leftPriceScales()[i],t))return e.leftPriceScales()[i]}return null}_targetPriceScaleIndex(e,t){if(e.mainSource()===t.mainSeries())return 0}_tryToGetDesiredPriceScale(e,t,i,r){switch(i){case"left":return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("left"):e.createPriceScaleAtPosition("overlay");case"right":return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("right"):e.createPriceScaleAtPosition("overlay");case"as-series":return void 0!==r?(0,s.ensureNotNull)(r.priceScale()):e.isMainPane()?(0,s.ensureNotNull)((0,s.ensureNotNull)(e.mainDataSource()).priceScale()):this.createNewPriceScaleIfPossible(e);case"overlay":return e.createPriceScaleAtPosition("overlay")}}}const a=[{name:"left",title:(0,r.t)("Stack on the left"),ctor:class extends o{constructor(e){super(e)}apply(e){const t=e.model();e.rightPriceScales().slice(0).forEach(i=>e.movePriceScale(i,"left",this._targetPriceScaleIndex(i,t)))}createNewPriceScaleIfPossible(e){return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("left"):e.createPriceScaleAtPosition("overlay")}}},{name:"right",title:(0,r.t)("Stack on the right"),ctor:class extends o{constructor(e){super(e)}apply(e){const t=e.model();e.leftPriceScales().slice(0).forEach(i=>e.movePriceScale(i,"right",this._targetPriceScaleIndex(i,t)))}createNewPriceScaleIfPossible(e){return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("right"):e.createPriceScaleAtPosition("overlay")}}},{name:"auto",title:(0,r.t)("Auto"),ctor:class extends o{constructor(e){super(e)}apply(e){if(e.containsMainSeries()){const t=(0,s.ensureNotNull)((0,s.ensureNotNull)(e.mainDataSource()).priceScale());e.movePriceScale(t,"right",0)}const t=e.model();for(;e.leftPriceScales().length>e.rightPriceScales().length;){const i=e.leftPriceScales()[e.leftPriceScales().length-1];e.movePriceScale(i,"right",this._targetPriceScaleIndex(i,t))}for(;e.rightPriceScales().length-e.leftPriceScales().length>1;){const i=e.rightPriceScales()[e.rightPriceScales().length-1];e.movePriceScale(i,"left",this._targetPriceScaleIndex(i,t))}}createNewPriceScaleIfPossible(e){if(!this.canCreateNewPriceScale(e))return e.createPriceScaleAtPosition("overlay");const t=e.leftPriceScales().lengtht.name===e));return new t.ctor(t)}function c(){return a}},98742:(e,t,i)=>{"use strict";i.d(t,{SelectionIndexes:()=>r});var s=i(16282);class r{constructor(e){this._baseIndex=null,this._offsetInBar=null,this._offsetInTime=null,this._barsBetweenPoints=null,this._timescale=e}indexes(){const e=this._timescale.visibleBarsStrictRange();if(null===e)return[] ;const t=e.firstBar(),i=e.lastBar();if(null===this._offsetInTime||null===this._barsBetweenPoints){const e=this._timescale.barSpacing();this._barsBetweenPoints=Math.floor(120/e),this._offsetInBar=i%this._barsBetweenPoints,this._offsetInTime=this._timescale.indexToTimePoint(this._offsetInBar),this._baseIndex=this._timescale.baseIndex()}const r=this._timescale.baseIndex();this._baseIndex!==r&&(this._baseIndex=r,this._offsetInBar=(0,s.ensureNotNull)(this._timescale.timePointToIndex(this._offsetInTime)));const n=(0,s.ensureNotNull)(this._offsetInBar),o=[];let a=Math.floor((t-n)/this._barsBetweenPoints);const l=Math.floor((i-n)/this._barsBetweenPoints);for(;a<=l;a++)o.push(n+a*this._barsBetweenPoints);return o}clear(){this._offsetInBar=null,this._offsetInTime=null,this._baseIndex=null,this._barsBetweenPoints=null}}},73301:(e,t,i)=>{"use strict";i.d(t,{SelectionRenderer:()=>l});var s=i(71044),r=i(53312),n=i(10288),o=i(10992);const a=r.colorsPalette["color-tv-blue-600"];class l{constructor(e){this._data=e||null}setData(e){this._data=e}draw(e,t){if(null===this._data||!this._data.visible)return;const i=t.pixelRatio;e.strokeStyle=void 0!==this._data.color?this._data.color:a,e.lineCap="butt";const s=Math.max(1,Math.floor(i));e.lineWidth=s;const r=this._data.vertOffset||0;for(let t=0;t(0,s.pointInBox)(t,e))}_drawMarker(e,t,i,s,r){let n=Math.round(3.5*r*2);n%2!=s%2&&(n+=1);let o=Math.round(n+2*(.5*s+.75*r));o%2!=s%2&&(o+=1);const a=Math.round(t.x*r),l=Math.round((t.y+i)*r),c=s%2/2;e.beginPath(),e.arc(a+c,l+c,o/2,0,2*Math.PI,!0),e.closePath(),e.fill(),e.beginPath(),e.arc(a+c,l+c,n/2,0,2*Math.PI,!0),e.closePath(),e.stroke()}}},4812:(e,t,i)=>{"use strict";var s=i(16282).assert,r=i(14563),n=(i(79881).t, r.rgba),o=r.rgbaToString,a=r.parseRgb,l=i(23221).TradingSourcesHorizontalAlignment,c=i(16389),h=i(56451).PriceScale,d=i(73228).StudyStub,u=i(67945),p=u.createLineTool,_=u.createLineToolProperties,m=u.createStudyLineToolProperties,g=u.isLineToolName,f=u.isStudyLineToolName,v=i(76117).LineDataSource,S=i(8902).LineToolBarsPattern,y=i(8902).LineToolParallelChannel,b=i(8902).LineToolCallout,w=i(67945).isLineTool,P=i(75622),C=i(39951),T=C.Study,x=C.prepareStudyPropertiesForLoadChart,I=i(17e3).createStudy,M=i(95975).Series,L=i(74645),A=i(25436),k=i(85062),E=i(27490),D=i(65447).getLogger("Chart.Serialization"),V=i(8902).LineToolTrendAngle,B=i(8902).LineToolGhostFeed,N=i(8902).LineToolElliott,R=i(50044).PriceDataSource,O=i(37923).Pane,F=i(50968),W=i(61389).createDeferredPromise,H=i(89537).mergeIntervalVisibilitiesDefaults,z=i(2460).preferencesByWhiteList,U=(D=i(65447).getLogger("Chart.Serialization"),i(94254).LineToolsGroupModel),j=i(73748).StudyStatusType;const{isLineToolState:G,isMainSeriesState:q,isStudyState:Y}=i(58921),{reorderDataSourcesStateZOrder:$}=i(40315);c.prototype.state=function(e,t,i,s){for(var r={panes:[]},n=0;n1&&r.push(l)),o=(o+1)%t.length}return r},c.prototype.restoreState=function(e,t,i){new K(this).reset();var s,r={};if(!e.panes)return void D.logDebug("ChartModel.restoreState: invalid state") ;if(!Array.isArray(e.panes))return void D.logDebug("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void D.logDebug("ChartModel.restoreState: invalid state");if(this._shouldBeSavedEvenIfHidden=void 0===e.shouldBeSavedEvenIfHidden||e.shouldBeSavedEvenIfHidden,e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties){var n=TradingView.factoryDefaults("chartproperties").scalesProperties;TradingView.merge(n,e.chartProperties.scalesProperties),!("showLastValue"in n)||"showSeriesLastValue"in n||"showStudyLastValue"in n||(n.showSeriesLastValueProperty=n.showLastValue,n.showStudyLastValueProperty=n.showLastValue),"showSeriesLastValue"in n&&(r.showSeriesLastValueProperty=!0),"showStudyLastValue"in n&&(r.showStudyLastValueProperty=!0),e.chartProperties.paneProperties.vertGridProperties=e.chartProperties.paneProperties.vertGridProperties||TradingView.clone(e.chartProperties.paneProperties.gridProperties),e.chartProperties.paneProperties.horzGridProperties=e.chartProperties.paneProperties.horzGridProperties||TradingView.clone(e.chartProperties.paneProperties.gridProperties),"backgroundType"in e.chartProperties.paneProperties||(e.chartProperties.paneProperties.backgroundType="solid"),this._properties.paneProperties.mergeAndFire(e.chartProperties.paneProperties),this._properties.scalesProperties.mergeAndFire(n),e.chartProperties.timezone&&this._properties.timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties&&this._properties.chartEventsSourceProperties.mergeAndFire(e.chartProperties.chartEventsSourceProperties),e.chartProperties.tradingProperties&&this._properties.tradingProperties&&(void 0===e.chartProperties.tradingProperties.horizontalAlignment&&(e.chartProperties.tradingProperties.horizontalAlignment=(s=e.chartProperties.tradingProperties.lineLength)<=40?l.Right:s>=60?l.Left:l.Center),this._properties.tradingProperties.mergeAndFire(e.chartProperties.tradingProperties)),this._timeScale.restoreState(e.timeScale,t),this._updateDateTimeFormatter()}if(e.timeScale&&this._timeScale.restoreState(e.timeScale,t),!this.readOnly()){var o=this._getExceedingChildStudies(e.panes);if(o.length){for(var a=e.panes.length-1;a>=0;--a){for(var c=(_=e.panes[a]).sources.length-1;c>=0;--c){var h=_.sources[c];~o.indexOf(h)&&_.sources.splice(c,1)}_.sources.length||e.panes.splice(a,1)}0}}const d=e.version||0;var u=e.panes;this.panes()[0].restoreState(u[0],t,d,r,i,!0);var p=1;for(a=1;ay&&f%100==0?{lines_limit_exceeded:!0,line_tools_count:f}:(this.panes().forEach(function(e){this._dataSourceCollectionChanged.fire(e)}.bind(this)),this._lineToolsGroupModel.fireChangedAll(),{})},O.prototype.state=function(e,t,i,s,r,n){var o={},a=new Map;function l(e){if(a.has(e))return a.get(e);var o=null,l=i&&!e.isSavedInStudyTemplates()||!e.state||w(e)&&n||!(o=e.state(t,r))||!e.isSavedInChart(t)||s&&e.isActualSymbol&&!e.isActualSymbol()||e.isPhantom()?null:o;return a.set(e,l),l}if(e){o.sources=[];for(var c=0;c{"use strict";i.d(t,{SeriesBase:()=>Xe});var s=i(16282),r=i(43367),n=i(87438),o=i(18437),a=i(65447),l=i(50044),c=i(61627),h=i(18213),d=i(674),u=i.n(d),p=i(25436),_=i(59104),m=i(74645),g=i(44264),f=i(79881),v=i(27490),S=i(7691),y=i(22287),b=i(46786);function w(e){const t="QUANDL"===(e=e||{}).exchange,i={title:"",description:"",interval:"",exchange:"",provider:"",chartStyle:"",sessionDescription:""};let s="";if(e.description&&t)if(2===e.description.split("/").length)s=e.description.split("/")[1];else{e.description.split("'").filter(e=>e.length).forEach(e=>{let t=[];t=e&&("/"===e[0]||/\d+\/\(?/.test(e))?[e]:e.split("/").filter(e=>e.length),s+=t[2===t.length?1:0]})}else s=e.description?e.description:e.symbol;if(e.ticker?(i.title=e.ticker,i.description=P(s)):i.title=P(s),e.interval&&(i.interval=(0,b.translatedIntervalString)(e.interval)),t&&e.description){const t=/[\w_]+\/[\w_]+/.exec(e.description);t&&t[0]?i.provider=P(t[0].split("/")[0]):i.provider=P(e.description.split("/")[0])}return e.exchange&&(i.exchange=P(e.exchange)),i.chartStyle=P(function(e){return e.inputs,8===e.style?(0,f.t)("Heikin Ashi"):""}(e)),e.branding&&!s.toUpperCase().includes("TradingView".toUpperCase())&&(i.branding="TradingView"),e.sessionDescription&&(i.sessionDescription=P(e.sessionDescription)),i}function P(e){return e.replace(/'/g,"")}const C=(0,f.t)("Symbol Error"),T=v.enabled("hide_unresolved_symbols_in_legend");class x extends y.StatusProviderBase{constructor(e,t,i,s){super(t),this._series=e,this._statusViewProperties=i,this._options=s||{}}text(){return function(e){const t=w(e);return(e.ticker?t.description:t.title)+(t.interval?", "+t.interval:"")+function(e,t=", "){ return(e.provider?`${t}${e.provider}`:"")+(e.exchange?`${t}${e.exchange}`:"")+(e.chartStyle?`${t}${e.chartStyle}`:"")+(e.branding?`${t}${e.branding}`:"")+(e.sessionDescription?`${t}${e.sessionDescription}`:"")}(t)}(this._getTitleGenerationOptions())}getSplitTitle(){return w(this._getTitleGenerationOptions())}bold(){return!1}size(){return this._statusViewProperties.childs().fontSize.value()+"px"}errorStatus(){const e=this._series.seriesErrorMessage();return null!==e?{error:e,title:C}:null}_getTitleGenerationOptions(){const e=this._series.symbolInfo(),t=this._statusViewProperties.childs(),i=this._series.symbolTextSourceProxyProperty().value();return{description:"ticker"===i?e&&e.name||void 0:(0,S.getTranslatedSymbolDescription)({pro_name:e&&e.pro_name||void 0,short_name:e&&e.name||void 0,description:e&&e.description||void 0,short_description:e&&e.short_description||void 0,local_description:e&&e.local_description||void 0,language:e&&e.language||void 0}),exchange:t.showExchange.value()?null==e?void 0:e.exchange:void 0,symbol:T&&null===e?"":this._series.symbol(),interval:t.showInterval.value()&&!this._options.hideResolution?this._series.interval():void 0,style:this._series.properties().childs().style.value(),inputs:this._series.getInputsProperties().state(),boxSize:this._series.data().boxSize,reversalAmount:this._series.data().reversalAmount,ticker:"ticker-and-description"===i?e&&e.name||void 0:"",branding:this._options.branding}}}class I extends g.StatusView{constructor(e,t,i,s){super(new x(e,t,i,s)),this._invalidated=!0,this._series=e,this._series.onRestarted().subscribe(this,this.update),this._series.dataEvents().symbolResolved().subscribe(this,this.update),this._series.dataEvents().completed().subscribe(this,this.update),this._series.boxSizeValue().subscribe(this.update.bind(this)),i.childs().symbolTextSource.listeners().subscribe(this,this.update)}getSeriesPrecision(){let e=4;const t=this._series.symbolInfo();return t&&t.pricescale&&(e=Math.round(Math.log(t.pricescale)/Math.log(10))),e}round(e){const t=this.getSeriesPrecision(),i=Math.round(e*Math.pow(10,t))/Math.pow(10,t);return i?i.toString():""}update(){this._invalidated=!0}text(){return this._updateImpl(),super.text()}color(){return this._updateImpl(),super.color()}bold(){return this._updateImpl(),super.bold()}size(){return this._updateImpl(),super.size()}getSplitTitle(){return this._updateImpl(),this._statusProvider.getSplitTitle()}_updateImpl(){this._invalidated&&(this._bold=this._statusProvider.bold(),this._size=this._statusProvider.size(),this._text=this._statusProvider.text(),this._invalidated=!1)}}var M=i(62043),L=i(15521),A=i(83111),k=i(67945);const E=r.CheckMobile.any(),D=v.enabled("hide_resolution_in_legend");class V extends M.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._series=e,this._model=t,this._valuesProvider=this._createValuesProvider(e,t),this._items=this._valuesProvider.getItems().map(e=>new M.DataWindowItem(e.title,"")),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(), this._invalidated=!1),this._items}series(){return this._series}_updateImpl(){const e=this._series.symbolInfo();if(e){const t=[e.name];D||t.push((0,b.translatedIntervalString)(this._series.interval())),t.push((0,r.onWidget)()||"forex"===e.type?e.exchange:e.listed_exchange),this._header=t.join(", "),this._title=e.description}else this._header=this._series.symbol();const t=this._model.crossHairSource().appliedIndex(),i=this._valuesProvider.getValues(t);for(let e=0;ee||t||i,i.showBarChange,i.showSeriesOHLC,i.showVolume),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return null}marketTitle(){const e=this._series.marketStatusModel().status().value();return this._showLastPriceAndChangeOnly()&&("pre_market"===e||"post_market"===e)?O+":":""}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_createValuesProvider(e,t){return new N(e,t)}}var W=i(32856),H=i.n(W),z=i(10616),U=i(12125),j=i(84540);function G(){const e=window.ChartApiInstance.serverTimeOffset();return Date.now()/1e3+e}function q(e,t,i){ return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}class Y{constructor(e,t){this._marketStatus=new(H())(null),this._lastMarketStatus=null,this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new(H())(null),this._recalcNextSessionEdgeTimerId=null,z.showMarketOpenStatusProperty.subscribe(this,()=>this._update()),this._quotesProvider=e,e.quotesUpdate().subscribe(this,this._update.bind(this)),e.quoteSymbolChanged().subscribe(this,()=>{this._nextSessionEdgeInternal=null,this._recalculateNextSessionEdge()}),this._resetSubscription=t,this._resetSubscription.subscribe(this,this._resetStatus)}destroy(){z.showMarketOpenStatusProperty.unsubscribeAll(this),this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),this._resetSubscription.unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId)}setSymbolInfo(e){var t,i,s,r,n;if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);const o=new U.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let a,l;const c=null===(i=e.subsessions)||void 0===i?void 0:i.find(e=>"premarket"===e.id),h=null===(s=e.subsessions)||void 0===s?void 0:s.find(e=>"postmarket"===e.id);void 0!==c&&(a=new U.SessionSpec(e.timezone,null!==(r=c["session-display"])&&void 0!==r?r:c.session,e.session_holidays,c["session-correction"])),void 0!==h&&(l=new U.SessionSpec(e.timezone,null!==(n=h["session-display"])&&void 0!==n?n:h.session,e.session_holidays,h["session-correction"])),this._sessionsSpec={general:o,preMarket:a,postMarket:l},this._recalculateNextSessionEdge()}status(){return this._marketStatus}nextSessionEdge(){return this._nextSessionEdge}_resetStatus(){this._marketStatus.setValue(null)}_update(e){void 0!==e&&void 0!==e.values.current_session&&(this._lastMarketStatus=e.values.current_session),null===this._lastMarketStatus||"market"===this._lastMarketStatus&&!z.showMarketOpenStatusProperty.value()?this._resetStatus():this._marketStatus.setValue(this._lastMarketStatus)}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*G();if(null===this._nextSessionEdgeInternal||(null!==(e=this._nextSessionEdgeInternal.timestamp)&&void 0!==e?e:1/0)<=t/1e3){const{general:e,preMarket:i,postMarket:s}=this._sessionsSpec,r=(0,j.get_timezone)(e.timezone()),n=(0,j.utc_to_cal)(r,t),o=q((0,j.cal_to_utc)(r,e.alignToNearestSessionStart(n,1)),(0,j.cal_to_utc)(r,e.alignToNearestSessionEnd(n,1)),t),a=q(void 0!==i?(0,j.cal_to_utc)(r,i.alignToNearestSessionStart(n,1)):1/0,void 0!==i?(0,j.cal_to_utc)(r,i.alignToNearestSessionEnd(n,1)):1/0,t),l=q(void 0!==s?(0,j.cal_to_utc)(r,s.alignToNearestSessionStart(n,1)):1/0,void 0!==s?(0,j.cal_to_utc)(r,s.alignToNearestSessionEnd(n,1)):1/0,t),c=Math.min(o,a,l);c===1/0&&(this._nextSessionEdgeInternal={timestamp:null}),this._nextSessionEdgeInternal=c===l?{timestamp:c,status:"post_market"}:c===a?{ timestamp:c,status:"pre_market"}:{timestamp:c}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-G())};if(null===this._recalcNextSessionEdgeTimerId){let e=Math.ceil(t.remainingSeconds%60);0===e&&(e+=60),this._recalcNextSessionEdgeTimerId=setTimeout(()=>this._recalculateNextSessionEdgeByTimer(),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}var $=i(35001),K=i(51759),X=i(61125),Z=i.n(X);const J=["DJ","CBOE","JSE"],Q=["NZX"];var ee=i(97849);const te=(0,a.getLogger)("Chart.Definitions.Series");function ie(e){const t=[];return!function(e){return"index"===e.type&&J.includes(e.listed_exchange)||"futures"===e.type&&Q.includes(e.listed_exchange)}(e)?t.push("DelayToRealtime"):t.push("DelayNoRealtime"),t}function se(e,t){const i=[];return void 0!==(s=e.delay)&&s>0?ie(e):function(e,t){return Z().hasEodSymbols(e.full_name)||t===m.STATUS_EOD}(e,t)?(i.push("EOD"),i):i;var s}class re{constructor(e,t,i){this._dataUpdatedModeStatus=new(H())(null),this._symbolInfo=(0,K.createWVFromGetterAndSubscription)(e.getter,e.onChange),this._status=(0,K.createWVFromGetterAndSubscription)(t.getter,t.onChange),this._symbolInfo.subscribe(this._update.bind(this)),this._status.subscribe(this._update.bind(this)),this._resetSubscription=i,this._resetSubscription.subscribe(this,this._resetStatus)}destroy(){this._symbolInfo.destroy(),this._status.destroy(),this._resetSubscription.unsubscribeAll(this)}status(){return this._dataUpdatedModeStatus.readonly()}symbolName(){const e=this._symbolInfo.value();return null!==e?e.name:""}time(){const e=this._symbolInfo.value(),t=null!==e&&e.delay&&e.delay>0?e.delay:900;return Math.round(t/60)}listedExchange(){const e=this._symbolInfo.value();return null!==e?e.listed_exchange:""}async description(){const e=this._symbolInfo.value();if(null===e)return"";let t={};try{t=(0,s.ensureNotNull)(await async function(e){return null}())}catch(e){te.logWarn("Cannot get exchange "+(0,ee.errorToString)(e))}return t.description||e.listed_exchange}exchange(){const e=this._symbolInfo.value();return null!==e?e.exchange:""}firstReplacedByBatsExchange(){const e=this._symbolInfo.value();return e&&null}_resetStatus(){this._dataUpdatedModeStatus.setValue(null)}_update(){const e=this._symbolInfo.value();if(null===e)return void this._dataUpdatedModeStatus.setValue(null);const t=this._status.value();if("string"==typeof t)return void this._dataUpdatedModeStatus.setValue(null);if(t===m.STATUS_LOADING||t===m.STATUS_RESOLVING)return;const i=se(e,t);0!==i.length?this._dataUpdatedModeStatus.setValue(i):this._dataUpdatedModeStatus.setValue(null)}}var ne=i(78556),oe=i(47903);class ae{constructor(e,t){this._dataProblem=new ne.WatchedObject(null),this._quotesProvider=e,this._quotesProvider.quotesUpdate().subscribe(this,this._update.bind(this)), this._resetSubscription=t,this._resetSubscription.subscribe(this,this._resetStatus)}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._resetSubscription.unsubscribeAll(this)}status(){return this._dataProblem}_resetStatus(){this._dataProblem.setValue(null)}_update(e){void 0===e.values||void 0===e.values.data_problem?this._resetStatus():this._dataProblem.setValue((0,oe.clone)(e.values.data_problem))}}var le=i(84310),ce=i(50968),he=i(95426),de=i(84995);function ue(e){return e<10?"0"+e:e.toString()}var pe=i(77036);const _e=[0,1,2,3,9,8,10],me=v.enabled("force_exchange_as_title"),ge={alwaysShowGlobalLast:!1,visibleOnHistoryOnly:!1,showCountdown:!0,showSymbolLabel:!0};class fe extends he.PriceAxisView{constructor(e,t,i){super(),this._previousCountdown="",this._source=e,this._model=t,this._options={...ge,...i}}updateCountdown(){this._countdownText()!==this._previousCountdown&&(this.update(),this._model.updateSourcePriceScale(this._source))}_getSource(){return this._source}_getModel(){return this._model}_isCountdownEnabled(){return this._options.showCountdown}_countdownText(){const e=$.Interval.parse(this._source.interval());if(e.isDWM()||e.isTicks()||e.isSeconds()&&1===e.multiplier())return"";const t=this._source.data().bars().last();if(null===t)return"";const i=1e3*(0,s.ensure)(t.value[0]),r=$.Interval.parse(this._source.interval()).inMilliseconds(),n=i.valueOf()+r;let o=Math.round((n-this._currentTime())/1e3);if(o<=0)return"";o=Math.min(o,r/1e3);let a=null;o>=3600&&(a=ue(Math.floor(o/3600))),o%=3600;const l=ue(Math.floor(o/60));o%=60;const c=ue(Math.floor(o));return null!==a?`${a}:${l}:${c}`:`${l}:${c}`}_updateRendererData(e,t,i){if(e.visible=!1,t.visible=!1,!this._source.isVisible())return;const s=this._source.properties().childs();if(12===s.style.value())return;const r=this._model.timeScale().visibleBarsStrictRange(),n=this._source.data().last();if(null===r||null===n)return;if(this._options.visibleOnHistoryOnly&&r.contains(n.index))return;const o=this._model.properties().childs().scalesProperties.childs();let a=o.showSeriesLastValue.value(),l=this._isCountdownEnabled()&&-1!==_e.indexOf(s.style.value())&&s.showCountdown.value()&&(this._options.alwaysShowGlobalLast||r.contains(n.index)),c=this._options.showSymbolLabel&&o.showSymbolLabels.value();const h=o.seriesLastValueMode.value()===de.PriceAxisLastValueMode.LastPriceAndPercentageValue,d=this._source.lastValueData(void 0,this._options.alwaysShowGlobalLast);if(d.noData)return;const u=8===s.style.value();if((a||l||c)&&u&&s.haStyle.childs().showRealLastPrice.value()){const e=this._source.lastValueData(void 0,!1),t=this._source.lastValueData(void 0,!0);e.noData||t.noData||e.index!==t.index||(a=!1,l=!1,c=!1)}if(a||l){const t=this._axisFirstLineText(d,a);e.text=t,i.textColor=this.generateTextColor(i.background),e.textColor=i.textColor;const s=a&&h?(0,pe.getOppositeModePriceText)(this._source.priceScale(),d):"";e.secondLine=s,i.secondLineTextColor=i.textColor;const r=l?this._countdownText():"";this._previousCountdown=r,e.thirdLine=r, i.thirdLineTextColor=(0,ce.generateColor)(i.textColor,25),0===t.length&&0===s.length&&0===r.length||(e.visible=!0)}c&&(t.text=this._paneText(c),t.visible=t.text.length>0),i.background=this._source.priceLineColor(d.color),i.coordinate=d.coordinate,i.floatCoordinate=d.floatCoordinate}_paneText(e){let t="";const i=this._source.symbolInfo();return me?t=(0,p.displayedSymbolExchange)(i):e&&(t=(0,p.displayedSymbolName)(i)),t}_axisFirstLineText(e,t){return t?(0,pe.getCurrentModePriceText)(this._source.priceScale(),e):""}_currentTime(){return Date.now()+1e3*this._source.serverTimeOffset()}}var ve=i(46556);class Se extends fe{lastPrice(){return this._getSource().data().lastProjectionPrice}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._getModel(),n=this._getSource(),o=n.priceScale(),a=r.timeScale(),l=this.lastPrice();if(a.isEmpty()||o.isEmpty()||void 0===l)return;const h=a.visibleBarsStrictRange();if(null===h)return;const d=h.firstBar(),u=h.lastBar(),p=n.data(),_=p.search(u,c.PlotRowSearchMode.NearestLeft);if(null===_)return;const m=n.nearestIndex(d,c.PlotRowSearchMode.NearestRight);if(void 0===m)return;const g=n.model().properties().childs().scalesProperties.childs(),f=(0,s.ensureNotNull)(p.valueAt(m))[4];let v=i.background,S=g.showSeriesLastValue.value(),y=!1,b=!1,w=!1;const P=n.lastValueData(4,!1),C=n.properties().childs();if(8===C.style.value()&&C.haStyle.childs().showRealLastPrice.value()){const e=n.lastValueData(4,!0);if(e.noData||e.color===i.background||(v=e.color),!e.noData&&!P.noData){const t=e.index===P.index;y=t&&g.showSymbolLabels.value(),b=g.seriesLastValueMode.value()===de.PriceAxisLastValueMode.LastPriceAndPercentageValue,S=S&&t,w=t&&this._isCountdownEnabled()&&C.showCountdown.value()}}else{v=n.barColorer().barStyle(_.index,!0).barColor}if(i.background=v,i.textColor=this.generateTextColor(v),i.secondLineTextColor=i.textColor,i.thirdLineTextColor=(0,ce.generateColor)(i.textColor,25),i.coordinate=o.priceToCoordinate(l,f),e.visible=S||w,!P.noData){const i=n.priceScale().isPercentage();P.formattedPriceAbsolute=o.formatPriceAbsolute(l),P.formattedPricePercentage=o.formatPricePercentage(l,f,!0),P.text=i?P.formattedPricePercentage:P.formattedPriceAbsolute,e.text=this._axisFirstLineText(P,S),e.secondLine=S&&b?i?P.formattedPriceAbsolute:P.formattedPricePercentage:"",e.thirdLine=w?this._countdownText():"",t.text=this._paneText(y)}t.visible=y}}var ye=i(13114),be=i(42225),we=i(53312),Pe=i(33420);const Ce={light:{lineStyle:Pe.LINESTYLE_DOTTED,lineWidth:1,textColor:we.colorsPalette["color-cold-gray-900"],backgroundColor:we.colorsPalette["color-tv-blue-50"],lineColor:we.colorsPalette["color-cold-gray-500"]},dark:{lineStyle:Pe.LINESTYLE_DOTTED,lineWidth:1,textColor:we.colorsPalette["color-white"],backgroundColor:we.colorsPalette["color-tv-blue-a800"],lineColor:we.colorsPalette["color-cold-gray-500"]}};function Te(e){return e?Ce.dark:Ce.light}class xe extends be.HorizontalLinePaneView{constructor(e,t,i){super(),this._model=e,this._isVisible=t,this._getValue=i}_updateImpl(){const e=this._lineRendererData ;if(e.visible=!1,!this._isVisible.value())return;const t=this._model.mainSeries(),i=t.priceScale(),s=t.firstValue(),r=this._getValue();if(null===s||null===r)return;const n=Te(this._model.isDark());e.visible=!0,e.y=i.priceToCoordinate(r,s),e.linestyle=n.lineStyle,e.linewidth=n.lineWidth,e.color=n.lineColor}}class Ie extends he.PriceAxisView{constructor(e,t,i,s){super(),this._model=e,this._label=t,this._isVisible=i,this._getValue=s}_updateRendererData(e,t,i){if(e.visible=!1,t.visible=!1,!this._isVisible.value())return;const s=this._model.mainSeries(),r=s.priceScale(),n=s.firstValue(),o=this._getValue();if(null===n||null===o)return;const a=Te(this._model.isDark());e.visible=!0,t.visible=!0,e.text=r.formatPriceAbsolute(o),t.text=this._label,i.coordinate=r.priceToCoordinate(o,n),i.background=a.backgroundColor,i.textColor=a.textColor}}class Me extends ve.PriceLineAxisView{constructor(e,t,i){super(),this._model=e,this._isLineVisible=t,this._getValue=i}_isVisible(){return this._isLineVisible.value()}_lineWidth(){return Te(this._model.isDark()).lineWidth}_lineStyle(){return Te(this._model.isDark()).lineStyle}_priceLineColor(e){return Te(this._model.isDark()).lineColor}_value(){const e=this._model.mainSeries(),t=e.priceScale(),i=e.firstValue(),s=this._getValue();if(null===i||null===s)return{noData:!0};const r=t.priceToCoordinate(s,i);return{noData:!1,floatCoordinate:r,coordinate:r,color:"",formattedPricePercentage:"",formattedPriceAbsolute:"",formattedPriceIndexedTo100:"",text:"",index:0}}}const Le=(0,f.t)("High"),Ae=(0,f.t)("Low");(0,f.t)("Avg");function ke(e,t,i,s,r,n){const o=new xe(e,r,n),a=new Ie(e,i,s,n);return{paneView:o,panePriceAxisView:new ye.PanePriceAxisView(a,t,e),priceAxisView:a,priceLineAxisView:new Me(e,r,n)}}var Ee=i(5729),De=i.n(Ee),Ve=i(92898),Be=i(72927);class Ne{constructor(){this._data=null}setData(e){this._data=e}data(){return this._data}draw(e,t){const i=this._data;if(null===i)return;const s=t.pixelRatio;e.save();const r=Math.max(1,Math.floor(s)),n=r%2/2,o=Math.round(i.center.x*s)+n,a=i.center.y*s;e.fillStyle=i.seriesLineColor,e.beginPath();const l=Math.max(2,1.5*i.seriesLineWidth)*s;e.arc(o,a,l,0,2*Math.PI,!1),e.fill(),e.fillStyle=i.fillColor,e.beginPath(),e.arc(o,a,i.radius*s,0,2*Math.PI,!1),e.fill(),e.lineWidth=r,e.strokeStyle=i.strokeColor,e.beginPath(),e.arc(o,a,i.radius*s+r/2,0,2*Math.PI,!1),e.stroke(),e.restore()}hitTest(e,t){return null}}function Re(e){return e}const Oe=[{start:0,end:.25,startRadius:4,endRadius:10,startFillAlpha:.25,endFillAlpha:0,startStrokeAlpha:.4,endStrokeAlpha:.8,easing:Re},{start:.25,end:.525,startRadius:10,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:.8,endStrokeAlpha:0,easing:Re},{start:.525,end:1,startRadius:14,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:0,endStrokeAlpha:0,easing:Re}];function Fe(e,t,i,s){const r=i+(s-i)*t;return(0,ce.applyTransparency)(e,(0,ce.alphaToTransparency)(r))}function We(e,t){const i=e%2600/2600;let s;for(const e of Oe)if(i>=e.start&&i<=e.end){s=e;break} if(void 0===s)throw new Error("Last price animation internal logic error");const r=s.easing((i-s.start)/(s.end-s.start));return{fillColor:Fe(t,r,s.startFillAlpha,s.endFillAlpha),strokeColor:Fe(t,r,s.startStrokeAlpha,s.endStrokeAlpha),radius:(n=r,o=s.startRadius,a=s.endRadius,o+(a-o)*n)};var n,o,a}class He{constructor(e){this._renderer=new Ne,this._invalidated=!0,this._stageInvalidated=!0,this._startTime=performance.now(),this._endTime=this._startTime-1,this._series=e}update(e){if(this._invalidated=!0,e){const e=performance.now(),t=this._endTime-e;if(t>0)return void(t<650&&(this._endTime+=2600));this._startTime=e,this._endTime=e+2600}}invalidateStage(){this._stageInvalidated=!0}animationActive(){return performance.now()<=this._endTime}stopAnimation(){this._endTime=this._startTime-1}renderer(e,t){return this._invalidated?(this._updateImpl(e,t),this._invalidated=!1,this._stageInvalidated=!1):this._stageInvalidated&&(this._updateRendererDataStage(),this._stageInvalidated=!1),this._renderer}_updateImpl(e,t){this._renderer.setData(null);const i=this._series.model().timeScale(),s=i.visibleBarsStrictRange(),r=this._series.firstValue(),n=this._series.lastValueData(void 0,!0,!0);if(null===s||null===r||void 0===n.index||void 0===n.price||!s.contains(n.index))return;const o=new Be.Point(i.indexToCoordinate(n.index),this._series.priceScale().priceToCoordinate(n.price,r)),a=n.color,l=this._series.properties().childs();let c;switch(this._series.style()){case 3:c=l.areaStyle.childs().linewidth.value();break;case 10:const t=l.baselineStyle,i=Math.round(e*(Math.abs(100-t.childs().baseLevelPercentage.value())/100));c=o.y<=i?t.childs().topLineWidth.value():t.childs().bottomLineWidth.value();break;default:c=l.lineStyle.childs().linewidth.value()}const h=We(this._duration(),a);this._renderer.setData({seriesLineColor:a,seriesLineWidth:c,fillColor:h.fillColor,strokeColor:h.strokeColor,radius:h.radius,center:o})}_updateRendererDataStage(){const e=this._renderer.data();if(null!==e){const t=We(this._duration(),e.seriesLineColor);e.fillColor=t.fillColor,e.strokeColor=t.strokeColor,e.radius=t.radius}}_duration(){return this.animationActive()?performance.now()-this._startTime:2599}}var ze=i(47329),Ue=i(6195);const je=v.enabled("price_scale_always_last_bar_value"),Ge=v.enabled("display_data_mode"),qe=(r.CheckMobile.any(),!v.enabled("hide_series_legend_item")),Ye=v.enabled("hide_price_scale_global_last_bar_value"),$e=(0,a.getLogger)("Chart.Series"),Ke={countdownEnabled:!0,lastPriceAnimationEnabled:!0};class Xe extends l.PriceDataSource{constructor(e,t,i,r){super(e),this.chartWidgetInitialized=new(De()),this.requestingIntradayWhenNotSupported=new(De()),this.requestingResolutionWhenNotSupported=new(De()),this.requestingStyleIsNotSupported=new(De()),this.requestingStyleSupportRecovered=new(De()),this._paneView=null,this._priceStep=null,this._symbolInfo=null,this._prevSymbolInfo=null,this._isPrePostMarketPricesForbiddenProperty=new(u())(!0),this._isBackAdjustmentForbiddenProperty=new(u())(!0),this._isSettlementAsCloseForbiddenProperty=new(u())(!0), this._highLowAvgPriceCache=new Map,this._prevClosePriceAxisView=null,this._priceScaleChanged=new(De()),this._priceScaleAboutToBeChanged=new(De()),this._onRestarted=new(De()),this._onStatusChanged=new(De()),this._extendedHoursChanged=new(De()),this._tagsChanged=new(De()),this._sessionIdChanged=new(De()),this._currency=null,this._unit=null,this._endOfData=!1,this._lineStyleLastPriceCirclePaneView=new He(this),this._prevClosePriceLineView=null,this._dataPoweredBy=null,this._loading=!0,this._seriesLoaded=!1,this._status=0,this._symbolResolvingActive=new(H())(!1),this._predictBars=0,this._boxSizeValue=new(H()),this._base=100,this._pointValue=1,this._formatter=new _.PriceFormatter(this._base),this._ignoreMinMoveFormatter=new _.PriceFormatter(this._base),this._ignoreMinMovePriceStep=null,this._lastBarCloseTime=null,this._onSessionIdPropertyChangedBound=this._onSessionIdPropertyChanged.bind(this),this._ignoreSessionIdProxyPropertyChanges=!1,this._textSourceIsAlwaysTickerRestrictionEnabled=!1,this._lastPriceAnimationActive=!1,this._currentSession="out_of_session",this._onStyleChanged=new(De()),this._preventRestartOnChartStyleChange=!1,this._intervalObj=null,this._obsoleteZOrder=0,this._seriesErrorMessage=null,this._seriesAlwaysFalseHibernatedVW=new(H())(!1),this._styleToRecover=null,this._seriesSource=new Ue.SeriesDataSource(e.chartApi(),"s",r);const n=this._seriesSource.dataEvents();n.symbolResolved().subscribe(this,this._onSymbolResolved),n.symbolError().subscribe(this,this._onSymbolError),n.seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),n.seriesError().subscribe(this,this._onSeriesError),n.loading().subscribe(this,this._onSeriesLoading),n.completed().subscribe(this,this._onSeriesCompleted),n.dataUpdated().subscribe(this,this._onDataUpdated),n.barReceived().subscribe(this,this._onBarReceived),this._quotesProvider=new le.QuotesProvider,this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const o=t.childs();if(t.hasChild("extendedHours")){(0,s.ensureDefined)(o.extendedHours).value()&&!t.hasChild("sessionId")&&t.addChild("sessionId",new(u())("extended")),t.removeProperty("extendedHours")}t.hasChild("sessionId")||t.addChild("sessionId",new(u())("regular")),this._setProperties(t),this._sessionIdProxyProperty=new(u())(o.sessionId.value()),o.sessionId.subscribe(this,()=>this._updateSessionIdProxyProperty()),this._sessionIdProxyProperty.subscribe(this,this._onSessionIdProxyPropertyChanged),this._symbolTextSourceProxyProperty=new(u()),this._recalcSymbolTextSourceProxyProperty(),o.statusViewStyle.childs().symbolTextSource.subscribe(this,this._recalcSymbolTextSourceProxyProperty),this._symbolTextSourceProxyProperty.subscribe(this,()=>e.lightUpdate()),this._options=(0,oe.merge)((0,oe.clone)(Ke),i),this._prevChartStyle=o.style.value(),this._priceAxisView=new fe(this,e,{alwaysShowGlobalLast:!Ye,showCountdown:i.countdownEnabled});let a=null;je||Ye||(a=new fe(this,e,{visibleOnHistoryOnly:!0,showSymbolLabel:!1,showCountdown:!1,alwaysShowGlobalLast:!1})), this._priceLinePriceAxisView=new ve.SeriesPriceLineAxisView(this),this._priceLineAxisViews=[this._priceLinePriceAxisView];const l=new Se(this,e,{showCountdown:i.countdownEnabled});this._priceAxisViews=[this._priceAxisView,l],null!==a&&this._priceAxisViews.push(a),this._panePriceAxisView=new ye.PanePriceAxisView(this._priceAxisView,this,e),this._historyPricePanePriceAxisView=null!==a?new ye.PanePriceAxisView(a,this,e):null,this._projectionPriceAxisView=new ye.PanePriceAxisView(l,this,e),this._labelPaneViews=[this._panePriceAxisView,this._projectionPriceAxisView],null!==this._historyPricePanePriceAxisView&&this._labelPaneViews.push(this._historyPricePanePriceAxisView),this._highLowAvgPaneViews=[],this._createHighLowAvgViews(),this._subscribeRestartToSessionIdChange(),o.visible.subscribe(this,this._updateLastPriceAnimationActive),this._updateLastPriceAnimationActive(),this._dataWindowView=new V(this,e),this._legendView=new F(this,e);const c={branding:!1};this._statusView=new I(this,this._model.properties().childs().scalesProperties.childs().textColor,o.statusViewStyle,c),this._marketStatusModel=new Y(this._quotesProvider,o.symbol.listeners()),this._dataUpdatedModeModel=Ge?new re({getter:this.symbolInfo.bind(this),onChange:n.symbolResolved()},{getter:this.status.bind(this),onChange:this._onStatusChanged},o.symbol.listeners()):null,this._dataProblemModel=new ae(this._quotesProvider,o.symbol.listeners())}supportsPressedChunks(){return!0}pressedChunks(e,t){return this.data().pressedChunks(e,t)}seriesErrorMessage(){return this._seriesErrorMessage}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._model.timeScale().visibleBarsStrictRangeChanged().unsubscribeAll(this),this._unsubscribeRestartToSessionIdChange()}properties(){return this._properties}zorder(){return 0}quotesProvider(){return this._quotesProvider}currentSession(){return this._currentSession}labelPaneViews(){return this._labelPaneViews}topPaneViews(){if(this._lastPriceAnimationActive){const e=this._lineStyleLastPriceCirclePaneView;return e.animationActive()&&setTimeout(()=>this._model.invalidate(ze.InvalidationMask.cursor()),0),e.invalidateStage(),[e]}return null}priceAxisViews(e,t){return e.findTargetPriceAxisViews(this,t,this._priceAxisViews,this._priceLineAxisViews)}clearHighLowAvgPriceCache(){this._highLowAvgPriceCache.clear()}priceScaleChanged(){return this._priceScaleChanged}priceScaleAboutToBeChanged(){return this._priceScaleAboutToBeChanged}disconnect(){this._seriesSource.stop(),this.m_symbol=void 0,this._predictBars=0,this._status=0,this._model.isSnapshot()||(this._prevSymbolInfo=null,this._symbolInfo=null)}isStatusBad(){return 12===this.status()||4===this.status()||10===this.status()}isStatusError(){return 12===this.status()}actualSymbol(){return(0,p.actualSymbol)(this.symbolInfo(),this.symbol())}proSymbol(){return(0,p.proSymbol)(this.symbolInfo(),this.symbol())}onStyleChanged(){return this._onStyleChanged}style(){return this.properties().childs().style.value()}setStyle(e){this.properties().childs().style.setValue(e)} symbolSameAsCurrent(e){return(0,Ve.symbolSameAsCurrent)(e,this.m_symbol,this.symbolInfo())}symbolInfo(){return this._symbolInfo}symbolResolved(){return this.dataEvents().symbolResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._seriesAlwaysFalseHibernatedVW}formatter(e=!0){return e?this._formatter:this._ignoreMinMoveFormatter}priceStep(e=!0){return e?this._priceStep:this._ignoreMinMovePriceStep}interval(){return this.properties().childs().interval.value()}setInterval(e){this.properties().childs().interval.setValue(e)}intervalObj(){const e=this.interval();if(null!==this._intervalObj&&this._intervalObj.resolutionString===e)return this._intervalObj.interval;const t=$.Interval.parse(e);return this._intervalObj={resolutionString:e,interval:t},t}prevClose(){const e=this.priceScale();if(e.isEmpty()||this.data().isEmpty())return null;const t=this.quotes(),i=this.firstValue();if(null===t||null===i)return null;const s=t.prev_close_price;return void 0===s?null:{coordinate:e.priceToCoordinate(s,i),floatCoordinate:e.priceToCoordinate(s,i),formattedPricePercentage:e.formatPricePercentage(s,i,!0),formattedPriceAbsolute:e.formatPriceAbsolute(s),formattedPriceIndexedTo100:e.formatPriceIndexedTo100(s,i)}}hasClosePrice(){return 12!==this.properties().childs().style.value()}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this.model().timeScale().isEmpty()||r.isEmpty()||this.data().isEmpty())return s;const n=this.model().timeScale().visibleBarsStrictRange(),o=this.firstValue();if(null===n||null===o)return s;let a,l;if(t){const e=this.data().bars().last();if(null===e)return s;a=e.value,l=e.index}else{const e=this.data().bars().search(n.lastBar(),c.PlotRowSearchMode.NearestLeft);if(null===e)return s;a=e.value,l=e.index}const h=void 0!==e?a[e]:this._barFunction(a),d=this.barColorer().barStyle(l,!1),u=r.priceToCoordinate(h,o),p={...r.getFormattedValues(h,o,!0),noData:!1,color:d.barColor,floatCoordinate:u,coordinate:u,index:l};return i&&(p.price=h),p}isDWM(){return this.intervalObj().isDWM()}nearestValue(e,t,i){const s=this.nearestData(e,i);return s?s.value[t]:void 0}onStatusChanged(){return this._onStatusChanged}onRestarted(){return this._onRestarted}onExtendedHoursChanged(){return this._extendedHoursChanged}sessionId(){return this.properties().childs().sessionId.value()}sessionIdChanged(){return this._sessionIdChanged}autoScaleInfo(e,t){const i=this.priceRange(e,t);if(null===this._paneView)return{range:i};const s=this._paneView;return{range:i,topPixelMargin:s.topPixelMargin?s.topPixelMargin():void 0,bottomPixelMargin:s.bottomPixelMargin?s.bottomPixelMargin():void 0}}onChartStyleChanged(){var e;this._updateBarFunction(),!this._preventRestartOnChartStyleChange&&this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.restart());const t=this.properties();this._prevChartStyle=t.childs().style.value(),this._onStyleChanged.fire(t.childs().style.value()),this.invalidateBarStylesCache(),this._updateLastPriceAnimationActive(), (null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}sessionIdProxyProperty(){return this._sessionIdProxyProperty}symbolTextSourceProxyProperty(){return this._symbolTextSourceProxyProperty}setTextSourceIsAlwaysTickerRestrictionEnabled(e){this._textSourceIsAlwaysTickerRestrictionEnabled=e,this._recalcSymbolTextSourceProxyProperty()}isPrePostMarketPricesForbiddenProperty(){return this._isPrePostMarketPricesForbiddenProperty}isSettlementAsCloseForbiddenProperty(){return this._isSettlementAsCloseForbiddenProperty}isBackAdjustmentForbiddenProperty(){return this._isBackAdjustmentForbiddenProperty}dataWindowView(){return this._dataWindowView}statusView(){return qe?this._statusView:null}legendView(){return this._legendView}marketStatusModel(){return this._marketStatusModel}dataUpdatedModeModel(){return this._dataUpdatedModeModel}dataProblemModel(){return this._dataProblemModel}quotes(){return this.data().isEmpty()?null:this._quotesProvider.quotes()}base(){return this._base}pointValue(){return this._pointValue}barCloseTime(){return this._lastBarCloseTime}barFunction(){return this._barFunction}setSymbolParams(e){const{symbol:t,interval:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=void 0!==t&&t!==o.symbol.value(),l=void 0!==s&&s!==o.currencyId.value(),c=void 0!==r&&r!==o.unitId.value(),h=void 0!==i&&i!==o.interval.value(),d=void 0!==n&&n!==o.style.value();a&&o.symbol.setValueSilently(t),l&&o.currencyId.setValueSilently(s),c&&o.unitId.setValueSilently(r),h&&o.interval.setValueSilently(i),d&&o.style.setValueSilently(n),a&&o.symbol.listeners().fire(o.symbol),l&&o.currencyId.listeners().fire(o.currencyId),c&&o.unitId.listeners().fire(o.unitId),h&&o.interval.listeners().fire(o.interval),d&&(a||l||c?(this._preventRestartOnChartStyleChange=!0,o.style.listeners().fire(o.style),this._preventRestartOnChartStyleChange=!1):o.style.listeners().fire(o.style))}setSymbol(e){this.setSymbolParams({symbol:e})}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,p.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.properties().childs().unitId.setValue(e)}isConvertedToOtherUnit(){return(0,p.isConvertedToOtherUnit)(this.symbolInfo())}symbolSource(){return this}title(){return this.symbolTitle()}name(){return this.symbolTitle()}symbolTitle(e,t,i="exchange"){let s=this.properties().childs().symbol.value();const r=this.symbolInfo();if(null!==r){const{type:t}=r;s=(0,p.symbolTitle)(r,e,"forex"===t?"exchange":i)}return t?s:`${s}, ${(0,b.translatedIntervalString)(this.properties().childs().interval.value())}`}setObsoleteZOrder(e){this._obsoleteZOrder=e}obsoleteZOrder(){return this._obsoleteZOrder}valuesProvider(){return new N(this,this.model())}statusProvider(e){return new x(this,this._model.properties().childs().scalesProperties.childs().textColor,this.properties().childs().statusViewStyle,e)}open(e){ const t=this.data().valueAt(e);return t&&t[1]}high(e){const t=this.data().valueAt(e);return t&&t[2]}low(e){const t=this.data().valueAt(e);return t&&t[3]}close(e){const t=this.data().valueAt(e);return t&&t[4]}moveItem(e,t,i){if(10===this.style()&&0===t){const t=this.priceScale(),i=this.properties().childs().baselineStyle,s=t.height(),r=100-e.y/s*100,n=r<0?0:Math.round(10*r)/10;i.childs().baseLevelPercentage.setValue(Math.max(Math.min(n,100),0))}}endOfData(){return this._endOfData}dataPoweredBy(){return null}boxSizeValue(){return this._boxSizeValue}isUserDeletable(){return!1}changeSymbol(){this.setSymbolIntervalCurrencyDelayed(),this.model().checkLineToolSelection()}changeInterval(){this.setSymbolIntervalCurrencyDelayed()}changeTimeFrame(){(0,n.trackEvent)("GUI","Change timeframe")}onTagsChanged(){return this._tagsChanged}_updateBarFunction(){if(12===this.properties().childs().style.value())this._barFunction=(0,h.barFunction)("low");else{const e=this.priceSource()||"close";this._barFunction=(0,h.barFunction)(e)}}_setProperties(e){e.hasChild("timeframe")||e.merge({timeframe:""}),e.hasChild("shortName")||e.merge({shortName:""}),e.hasChild("currencyId")||e.addChild("currencyId",new(u())(null)),e.hasChild("unitId")||e.addChild("unitId",new(u())(null)),this._properties=e;const t=e.childs();t.symbol.listeners().subscribe(this,this.changeSymbol),t.interval.listeners().subscribe(this,this.changeInterval),t.currencyId.listeners().subscribe(this,this._changeCurrency),t.unitId.listeners().subscribe(this,this._changeUnit),t.timeframe.listeners().subscribe(this,this.changeTimeFrame),e.subscribe(this,this._onPropertiesChanged)}_updateSessionIdProxyProperty(e){const t=this._properties.childs().sessionId.value();let i=t;if(e){const e=this.symbolInfo();null!==e&&(i=e.subsession_id||t)}this._ignoreSessionIdProxyPropertyChanges=!0,this._sessionIdProxyProperty.setValue(i),this._ignoreSessionIdProxyPropertyChanges=!1}_onSessionIdProxyPropertyChanged(){this._ignoreSessionIdProxyPropertyChanges||this._properties.childs().sessionId.setValue(this._sessionIdProxyProperty.value()),this._updateLastPriceAnimationActive()}_onSeriesLoading(e){this._loading=!0,this._setStatus(2)}_onDataUpdated(e,t){if(this.hasDelayedSymbolIntervalChange()){if(this._willSymbolIntervalCurrencyChanged())return void $e.logNormal("command comes during symbol/interval changing");$e.logNormal("data_update comes when symbol interval delay present but symbol/interval should not be changed")}t?this._endOfData=!1:this._lastPriceAnimationActive&&this._seriesLoaded&&this._lineStyleLastPriceCirclePaneView.update(!0),this._lastBarCloseTime=e&&e.closeTime||null,this._boxSizeValue.setValue(this.data().boxSize),this._statusView.update(),this.clearHighLowAvgPriceCache();const i=this.model(),r=(0,s.ensureNotNull)(i.paneForSource(this));i.recalculatePane(r),i.updateSource(this),i.updateLineTools()}_setStatus(e){this._status=e,this._statusView.update(),this.model().updateSource(this),this._onStatusChanged.fire()}_willSymbolIntervalCurrencyChanged(){ const e=this.properties().childs(),t=this._checkIntervalWillChanged(e.interval.value()),i=this._checkSymbolWillChanged(e.symbol.value()),s=this._checkCurrencyWillChanged(e.currencyId.value()),r=this._checkUnitWillChanged(e.unitId.value());return i||t||s||r}_checkSymbolWillChanged(e){return!this.symbolSameAsCurrent(e)}_checkIntervalWillChanged(e){return!$.Interval.isEqual(this.m_interval,e)}_recreateFormatter(){this._formatter=(0,p.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value()),this._ignoreMinMoveFormatter=(0,p.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value(),!0),this.priceScale()&&this.priceScale().updateFormatter(),this._formatterChanged.fire()}_recreatePriceStep(){const{minMove:e,priceScale:t}=(0,p.getSeriesPriceFormattingState)(this.symbolInfo()),i=e/t;this._ignoreMinMovePriceStep=1/t,this._priceStep!==i&&(this._priceStep=i,this._priceStepChanged.fire())}_recreatePriceFormattingDependencies(){this._recreateFormatter(),this._recreatePriceStep()}_onQuotesUpdate(e,t){void 0!==e.values.current_session&&e.values.current_session!==this._currentSession&&(this._currentSession=e.values.current_session,this._updateLastPriceAnimationActive())}_updateIsPrePostMarketPricesForbiddenProperty(){const e=!this.isDWM()&&!(0,p.isRegularSessionId)(this.sessionIdProxyProperty().value());this._isPrePostMarketPricesForbiddenProperty.setValue(e)}_updateSettlementAsCloseForbiddenProperty(){}_updateBackAdjustmentForbiddenProperty(){}_getSymbolForApi(){return(0,p.symbolForApi)(this.symbolInfo()||this._prevSymbolInfo,this.symbol())}_getSymbolObject(){const e=this._getExtendedSymbolObject();if(m.SYMBOL_STRING_DATA.hasOwnProperty(this.properties().childs().style.value())){return{symbol:e,type:this.styleStudyInfo(this.getStyleShortName()+"Style").studyId+"!",inputs:this.getInputsProperties().state()}}return e}_getExtendedSymbolObject(){const e={symbol:this._getSymbolForApi()};null!==this.currency()&&(e["currency-id"]=this.currency());const t=this.unit();return null!==t&&(e["unit-id"]=t),e}_changeCurrency(){this.setSymbolIntervalCurrencyDelayed(),this.model().checkLineToolSelection(),this._currencyChanged.fire()}_changeUnit(){this.setSymbolIntervalCurrencyDelayed(),this.model().checkLineToolSelection(),this._unitChanged.fire()}_checkCurrencyWillChanged(e){return this._currency!==e}_checkUnitWillChanged(e){return this._unit!==e}_checkInterval(){if(this._symbolInfo&&($.Interval.isIntraday(this.interval())&&!this._symbolInfo.has_intraday&&this.requestingIntradayWhenNotSupported.fire(),this._symbolInfo.hasOwnProperty("supported_resolutions"))){const e=$.Interval.normalize(this._properties.childs().interval.value());null!==e&&-1===this._symbolInfo.supported_resolutions.indexOf(e)&&this.requestingResolutionWhenNotSupported.fire(this._symbolInfo.supported_resolutions[0])}}_checkChartStyle(){const e=this.style();(0,p.isCloseBasedSymbol)(this.symbolInfo())?(0,p.isSingleValueBasedStyle)(e)||(this.requestingStyleIsNotSupported.fire(),this._styleToRecover={correctedStyle:this.style(), originalStyle:e}):null!==this._styleToRecover&&(this.requestingStyleSupportRecovered.fire(this._styleToRecover.originalStyle),this._styleToRecover=null)}_updateSymbolInfo(e,t){var i;if(this._prevSymbolInfo=t?this._symbolInfo:null,this._symbolInfo=e,e){const t=this._properties.childs();t.shortName.setValue(e.name);const s=(0,p.extractSymbolNameFromSymbolInfo)(e,null!==(i=this.m_symbol)&&void 0!==i?i:null);s&&t.symbol.setValue(s),this._currency=(0,p.symbolCurrency)(e),this._unit=(0,p.symbolUnit)(e);const r=this._model.properties().childs().scalesProperties.childs();(this._currency!==t.currencyId.value()&&r.showCurrency.value()||this._unit!==t.unitId.value()&&r.showUnit.value())&&this._model.fullUpdate(),t.currencyId.setValue(this._currency),t.unitId.setValue(this._unit),this._updateSessionIdProxyProperty(!0)}this._base=e?e.pricescale/e.minmov:100,this._pointValue=e&&e.pointvalue||1;const s=this._getSymbolForApi();this._quotesProvider.setQuotesSessionSymbol(s),this._marketStatusModel.setSymbolInfo(e),e&&this._recreatePriceFormattingDependencies(),this._statusView.update(),this.priceScale().updateFormatter(),this._symbolResolvingActive.setValue(!e)}_createHighLowAvgViews(){const e=this.properties().childs().highLowAvgPrice,t=this._getHighLowAvgPrice.bind(this),i=function(e,t,i,s){const r=i.childs(),n=(0,R.combineProperty)((e,t)=>e||t,r.highLowPriceLabelsVisible,new(u())(!1)),o=(0,R.combineProperty)((e,t)=>e||t,r.highLowPriceLinesVisible,new(u())(!1)),a=ke(e,t,Le,n,o,()=>s(0)),l=ke(e,t,Ae,n,o,()=>s(1));return{paneViews:[a.paneView,l.paneView],panePriceAxisViews:[a.panePriceAxisView,l.panePriceAxisView],priceAxisViews:[a.priceAxisView,l.priceAxisView],priceLineAxisViews:[a.priceLineAxisView,l.priceLineAxisView]}}(this._model,this,e,t);this._highLowAvgPaneViews.push(...i.paneViews),this._labelPaneViews.push(...i.panePriceAxisViews),this._priceAxisViews.push(...i.priceAxisViews),this._priceLineAxisViews.push(...i.priceLineAxisViews)}_getHighLowAvgPrice(e){if(!this._highLowAvgPriceCache.has(e)){const t=this._model.timeScale().visibleBarsStrictRange();if(null===t)return null;const i=this._model.mainSeries().bars(),s=t.firstBar(),r=t.lastBar();if(2===e){const e=function(e,t,i){const s=(0,h.barFunction)("close");let r=0,n=0;for(let o=t;o<=i;o++){const t=e.valueAt(o);null!==t&&(r+=s(t),n++)}return n?r/n:null}(i,s,r);if(null===e)return null;this._highLowAvgPriceCache.set(2,e)}else{const e=function(e,t,i){return e.minMaxOnRangeCached(t,i,[{name:"low",offset:0},{name:"high",offset:0}])}(i,s,r);if(null===e)return null;this._highLowAvgPriceCache.set(1,e.min),this._highLowAvgPriceCache.set(0,e.max)}}return this._highLowAvgPriceCache.get(e)}_onSessionIdPropertyChanged(){this._sessionIdChanged.fire(),this.isDWM()||(this.restart(),this._updateLastPriceAnimationActive())}_subscribeRestartToSessionIdChange(){this.properties().childs().sessionId.subscribe(this,this._onSessionIdPropertyChangedBound)}_unsubscribeRestartToSessionIdChange(){this.properties().childs().sessionId.unsubscribe(this,this._onSessionIdPropertyChangedBound)} _updateLastPriceAnimationActive(){if(!this._options.lastPriceAnimationEnabled)return;const e=this._lastPriceAnimationActive,t=this.properties().childs(),i=t.style.value();if(this._model.isSnapshot()||!t.visible.value()||3!==i&&10!==i&&2!==i)this._lastPriceAnimationActive=!1;else{const e=this.currentSession(),t=!(0,p.isRegularSessionId)(this.sessionIdProxyProperty().value())&&!this.isDWM();this._lastPriceAnimationActive="market"===e||t&&("pre_market"===e||"post_market"===e)}this._lastPriceAnimationActive&&e!==this._lastPriceAnimationActive&&this.model().invalidate(ze.InvalidationMask.cursor())}_onPropertiesChanged(e){const t=this._properties.childs();e!==t.symbol&&e!==t.interval&&e!==t.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews(),this.model().updateSource(this),(0,o.emit)("series_properties_changed",this._id))}_recalcSymbolTextSourceProxyProperty(){this._textSourceIsAlwaysTickerRestrictionEnabled?this._symbolTextSourceProxyProperty.setValue("ticker"):this._symbolTextSourceProxyProperty.setValue(this._properties.childs().statusViewStyle.childs().symbolTextSource.value())}}},74645:(e,t,i)=>{"use strict";i.r(t),i.d(t,{STATUS_OFFLINE:()=>s,STATUS_RESOLVING:()=>r,STATUS_LOADING:()=>n,STATUS_READY:()=>o,STATUS_INVALID_SYMBOL:()=>a,STATUS_SNAPSHOT:()=>l,STATUS_EOD:()=>c,STATUS_PULSE:()=>h,STATUS_DELAYED:()=>d,STATUS_DELAYED_STREAMING:()=>u,STATUS_NO_BARS:()=>p,STATUS_REPLAY:()=>_,STATUS_ERROR:()=>m,SERIES_STATUS_TEXT:()=>g,STYLE_LINE_TYPE_MARKERS:()=>f,STYLE_LINE_TYPE_STEP:()=>v,STYLE_LINE_TYPE_SIMPLE:()=>S,STYLE_BARS:()=>y,STYLE_CANDLES:()=>b,STYLE_LINE:()=>w,STYLE_AREA:()=>P,STYLE_RENKO:()=>C,STYLE_KAGI:()=>T,STYLE_PNF:()=>x,STYLE_PB:()=>I,STYLE_HEIKEN_ASHI:()=>M,STYLE_HOLLOW_CANDLES:()=>L,STYLE_BASELINE:()=>A,STYLE_RANGE:()=>k,STYLE_HILO:()=>E,STYLE_SHORT_NAMES:()=>D,SYMBOL_STRING_DATA:()=>V});const s=0,r=1,n=2,o=3,a=4,l=5,c=6,h=7,d=8,u=9,p=10,_=11,m=12,g={[s]:"connecting",[r]:"loading",[n]:"loading",[o]:"realtime",[a]:"invalid",[l]:"snapshot",[c]:"endofday",[h]:"endofday",[d]:"delayed",[u]:"delayed_streaming",[p]:"forbidden",[_]:"replay",[m]:"error"},f=0,v=1,S=2,y=0,b=1,w=2,P=3,C=4,T=5,x=6,I=7,M=8,L=9,A=10,k=11,E=12,D={0:"bar",1:"candle",9:"hollowCandle",2:"line",3:"area",4:"renko",7:"pb",5:"kagi",6:"pnf",8:"ha",10:"baseline",11:"range",12:"hilo"},V={4:{type:"BarSetRenko@tv-prostudies",basicStudyVersion:40},7:{type:"BarSetPriceBreak@tv-prostudies",basicStudyVersion:34},5:{type:"BarSetKagi@tv-prostudies",basicStudyVersion:34},6:{type:"BarSetPnF@tv-prostudies",basicStudyVersion:34},8:{type:"BarSetHeikenAshi@tv-basicstudies",basicStudyVersion:60},11:{type:"BarSetRange@tv-basicstudies",basicStudyVersion:72}}},18213:(e,t,i)=>{"use strict";i.d(t,{seriesPlotFunctionMap:()=>c,barFunction:()=>h,SeriesData:()=>p});var s,r=i(16282),n=i(61627),o=i(49382);!function(e){e[e.FromLeft=-1]="FromLeft",e[e.FromRight=1]="FromRight"}(s||(s={}));const a={open:e=>e[1],high:e=>e[2],low:e=>e[3],close:e=>e[4],hl2:e=>(e[2]+e[3])/2,hlc3:e=>(e[2]+e[3]+e[4])/3,ohlc4:e=>(e[1]+e[2]+e[3]+e[4])/4 },l=["open","high","low","close","hl2","hlc3","ohlc4"];function c(){const e=new Map;return l.forEach((t,i)=>{e.set(t,h(t))}),e}function h(e){return a[e]}function d(e,t){return null==e[t]}const u=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,forBarspacingLargerThen:0}];class p{constructor(){this._pressedChunks={chunks:new Map,priceSource:"uninitialized"},this.m_bars=new n.PlotList(c(),d),this.m_nsBars=new n.PlotList(c(),d),this._clearPressedChunks()}bars(){return this.m_bars}nsBars(){return this.m_nsBars}pressedChunks(e,t){if(t!==this._pressedChunks.priceSource){this._pressedChunks.priceSource=t;const e=this.m_bars.first();e&&(this._clearPressedChunks(),this._rebuildPressedChunks(e))}const i=(0,r.ensureDefined)(u.find(t=>t.forBarspacingLargerThen<=e));return(0,r.ensureDefined)(this._pressedChunks.chunks.get(i.barsToMerge))}mergeRegularBars(e){const t=this.m_bars.size(),i=this.m_bars.merge(e);return i&&"uninitialized"!==this._pressedChunks.priceSource&&(t===this.m_bars.size()&&i.index===this.m_bars.lastIndex()?this._updateLatestChunks():this._rebuildPressedChunks(i)),i}size(){return this.m_bars.size()+this.m_nsBars.size()}each(e){this.m_bars.each(e),this.m_nsBars.each(e)}clear(){this.m_bars.clear(),this.m_nsBars.clear(),this.lastProjectionPrice=void 0,this._clearPressedChunks()}isEmpty(){return this.m_bars.isEmpty()&&this.m_nsBars.isEmpty()}first(){return this.m_bars.isEmpty()?this.m_nsBars.first():this.m_bars.first()}last(){return this.m_nsBars.isEmpty()?this.m_bars.last():this.m_nsBars.last()}search(e,t){return this.nsBars().isEmpty()?this.bars().search(e,t):this.bars().isEmpty()||(0,r.ensureNotNull)(this.nsBars().firstIndex())<=e?this.nsBars().search(e,t):this.bars().search(e,t)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}plotValueToTimePointIndex(e,t,i){if(i===s.FromRight){const i=(i,s)=>{const r=s[t];return null!=r&&e>=r},s=this.m_bars.findLast(i);if(null!==s)return s.index;const r=this.m_nsBars.findLast(i);return null!==r?r.index:this.m_bars.firstIndex()}if(i===s.FromLeft){const i=(i,s)=>{const r=s[t];return null!=r&&e<=r},s=this.m_bars.findFirst(i);if(null!==s)return s.index;const r=this.m_nsBars.findFirst(i);return null!==r?r.index:this.m_bars.lastIndex()}throw new Error("plotValueToTimePointIndex: unsupported search mode")}moveData(e){this.m_bars.move(e),this.m_nsBars.move(e),this.m_bars.size()>0&&this._rebuildPressedChunks((0,r.ensureNotNull)(this.m_bars.first()))}_rebuildPressedChunks(e){const t=this._pressedChunks.priceSource;if("uninitialized"===t)return;const i=e.index,s=a[t],n=(e,t,i)=>{let r=null;for(;e.hasNext();){const n=e.next(),o=s(n.value);r&&n.index-r.startTime>=i.barsToMerge&&(t.push(r),r=null),r?(r.endTime=n.index,r.high=Math.max(r.high,o),r.low=Math.min(r.low,o),r.close=o):r={startTime:n.index,endTime:n.index,open:o,high:o,low:o,close:o}}r&&t.push(r)};u.forEach(e=>{const t=(0,r.ensureDefined)(this._pressedChunks.chunks.get(e.barsToMerge)),s=(0, o.lowerbound)(t,i,(e,t)=>e.endTime0){const i=t[0].startTime-1,s=(0,r.ensureNotNull)(this.m_bars.firstIndex()),o=this.m_bars.rangeIterator(s,i),a=[];n(o,a,e);const l=a.concat(t);this._pressedChunks.chunks.set(e.barsToMerge,l)}else{const i=(0,r.ensureNotNull)(this.m_bars.lastIndex());t.splice(s);let o=(0,r.ensureNotNull)(this.m_bars.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const a=this.m_bars.rangeIterator(o,i);n(a,t,e)}})}_updateLatestChunks(){const e=(0,r.ensureNotNull)(this.m_bars.lastIndex());u.forEach(t=>{const i=(0,r.ensureDefined)(this._pressedChunks.chunks.get(t.barsToMerge)),s=this.m_bars.rangeIterator(e,e).next(),n=s.value[4],o=i[i.length-1];o.high=Math.max(o.high,n),o.low=Math.min(o.low,n),o.close=n,o.endTime=s.index})}_clearPressedChunks(){u.forEach(e=>this._pressedChunks.chunks.set(e.barsToMerge,[]))}}},96370:(e,t,i)=>{"use strict";i.d(t,{SeriesTimeRangeVolumeCalculator:()=>s});class s{constructor(e){this._value=null,this._series=e,this._series.dataEvents().dataUpdated().subscribe(this,this._onSeriesUpdated)}destroy(){this._series.dataEvents().dataUpdated().unsubscribeAll(this)}volume(e,t){if(null!==this._value&&this._value.from===e&&this._value.to===t)return this._value.value;let i=0;const s=this._series.data().bars(),r=s.firstIndex(),n=s.lastIndex();if(null!==r&&en&&t>n)i=NaN;else{const s=this._series.data().bars().rangeIterator(Math.min(e,t),Math.max(e,t));for(;s.hasNext();){const e=s.next().value[5];if(void 0===e){i=NaN;break}i+=e}}return this._value={from:e,to:t,value:i},i}_onSeriesUpdated(e,t){if(null===this._value)return;if(t)return void(this._value=null);const i=this._series.data().bars().lastIndex();(null===i||i<=this._value.to)&&(this._value=null)}}},25436:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isRequiringRestartSeriesStyles:()=>S,isRangeBasedStyle:()=>y,isRangeStyle:()=>b,isTimeBasedStyle:()=>w,isValidStyle:()=>P,isSingleValueBasedStyle:()=>C,setLastUsedStyle:()=>T,getLastUsedStyle:()=>x,getLastUsedSingleValueBasedStyle:()=>I,getDefaultStyle:()=>M,getChartStyleByResolution:()=>L,chartStyleStudyId:()=>A,preparePriceAxisProperties:()=>k,hasProjection:()=>D,isPriceSourceStyle:()=>V,getSeriesPriceFormattingState:()=>B,createSeriesFormatter:()=>N,symbolCurrencyConvertible:()=>R,symbolCurrency:()=>O,symbolOriginalCurrency:()=>F,symbolBaseCurrency:()=>W,isConvertedToOtherCurrency:()=>H,symbolUnitConvertible:()=>z,symbolUnit:()=>U,symbolOriginalUnit:()=>j,isConvertedToOtherUnit:()=>G,symbolUnitConvertibleGroupsIfExist:()=>q,symbolCurrentContract:()=>Y,extractSymbolNameFromSymbolInfo:()=>$,symbolTitle:()=>K,displayedSymbolName:()=>X,displayedSymbolExchange:()=>Z,actualSymbol:()=>J,proSymbol:()=>Q,symbolForApi:()=>ee,isRegularSessionId:()=>te,isCloseBasedSymbol:()=>ie,hasVolume:()=>se,isEconomicsSymbol:()=>re});var s=i(64222),r=i(74645),n=i(35001),o=i(59104),a=i(27490),l=i(16282),c=i(76559),h=i(62159) ;const d=a.enabled("pay_attention_to_ticker_not_symbol"),u=a.enabled("uppercase_instrument_names"),p=a.enabled("charting_library_single_symbol_request"),_=a.enabled("use_ticker_on_symbol_info_update"),m=[4,5,6,7,8],g=[4,5,6,7,8,11],f=[0,1,9,2,3,10],v=[2,10,3];function S(e){return-1!==m.indexOf(e)}function y(e){return-1!==g.indexOf(e)}function b(e){return 11===e}function w(e){return-1!==f.indexOf(e)}function P(e){return y(e)||w(e)}function C(e){switch(e){case 3:case 10:case 2:return!0;default:return!1}}function T(e,t){P(e)&&(11!==e&&s.setValue("chart.lastUsedStyle",e),ie(t)&&C(e)&&s.setValue("chart.lastUsedSingleValueBasedStyle",e))}function x(){const e=s.getInt("chart.lastUsedStyle");return void 0===e?1:e}function I(){const e=s.getInt("chart.lastUsedSingleValueBasedStyle");return void 0===e?2:e}function M(e){return e?11:1}function L(e,t){const i=b(t),s=n.Interval.isRange(e);return!i&&s?M(!0):i&&!s?M(!1):t}function A(e,t){const i=r.SYMBOL_STRING_DATA[e];return void 0===i?null:t?`${i.type}-${i.basicStudyVersion}`:i.type}function k(e){const t=e.priceAxisProperties,i=t.lockScale.value(),s=6===e.style.value();(s||i)&&(t.log.setValue(!1),t.percentage.setValue(!1)),t.logDisabled.setValue(!(!s&&!i)),t.percentageDisabled.setValue(!(!s&&!i))}const E=[4,7,5,6];function D(e){return-1!==E.indexOf(e)}function V(e){return v.includes(e)}function B(e,t="default",i=!1){let s,r,n=100,o=1;if("default"===t)null!=e&&(n=e.pricescale,o=e.minmov,s=e.fractional,r=e.minmove2);else{let e=t.split(",");3!==e.length&&(e=["100","1","false"]),n=parseInt(e[0]),o=parseInt(e[1]),s="true"===e[2]}return i&&(o=1),{priceScale:n,minMove:o,fractional:s,minMove2:r}}function N(e,t,i=!1){if("default"===t&&null!=e){if("volume"===e.formatter||"volume"===e.format)return new c.VolumeFormatter(2);if("percent"===e.formatter||"percent"===e.format)return new h.PercentageFormatter(e.pricescale)}const{priceScale:s,minMove:r,fractional:n,minMove2:a}=B(e,t,i);return new o.PriceFormatter(s,r,n,a)}function R(e){return null!==e&&"spread"!==e.type}function O(e,t,i){if(null===e)return null;const s=!t||i?e.currency_id:e.currency_code;return void 0===s||""===s?null:s}function F(e,t){return(t?e.original_currency_code:e.original_currency_id)||O(e,t)}function W(e){return e.base_currency_id||null}function H(e){return!(null===e||!R(e))&&(void 0!==e.original_currency_id&&e.original_currency_id!==e.currency_id)}function z(e){return null!==e&&"spread"!==e.type}function U(e){if(null===e)return null;const t=e.unit_id;return void 0===t||""===t?null:t}function j(e){return e.original_unit_id||U(e)}function G(e){return!(null===e||!z(e))&&(void 0!==e.original_unit_id&&e.original_unit_id!==e.unit_id)}function q(e){return null!==e&&z(e)?e.unit_conversion_types||null:[]}function Y(e){return"futures"===e.type&&e.front_contract||null}function $(e,t){let i=e&&(e.pro_name||e.full_name||e.name);return p&&t?i=t:_&&e&&e.ticker&&(i=e.ticker),u&&i&&(i=i.toUpperCase()),i}function K(e,t,i="exchange"){return t?e.name:`${e.name}, ${e[i]}`}function X(e){let t=e&&(Y(e)||e.name)||"" ;return t.length>40&&(t=t.substring(0,37)+"..."),t.trim()}function Z(e){const t=e?e.exchange:"";return u?t.toUpperCase():t}function J(e,t){return null!==e?e.full_name:t}function Q(e,t){return null!==e?e.pro_name:t}function ee(e,t){return d&&e?(0,l.ensureDefined)(e.ticker):J(e,t)}function te(e){return"regular"===e||"us_regular"===e}function ie(e){return"c"===(null==e?void 0:e.visible_plots_set)}function se(e){return void 0!==e.visible_plots_set?"ohlcv"===e.visible_plots_set:!e.has_no_volume}function re(e){return"ECONOMICS"===e.listed_exchange}},95975:(e,t,i)=>{"use strict";var s=i(5729),r=i(674),n=i(25303).PriceRange;TradingView.DEFAULT_BAR_COUNT=300,TradingView.TIME_PLOT=0,TradingView.OPEN_PLOT=1,TradingView.HIGH_PLOT=2,TradingView.LOW_PLOT=3,TradingView.CLOSE_PLOT=4,TradingView.ADT_PLOT=6,TradingView.STYLE_PLOT=7;var o=i(16282).assert,a=i(16282).ensureNotNull,l=i(43845).SeriesBase,c=i(90887),h=c.SeriesAreaPaneView,d=c.SeriesLinePaneView,u=c.SeriesHollowCandlesPaneView,p=c.SeriesCandlesPaneView,_=c.SeriesBarsPaneView,m=c.SeriesHeikenAshiPaneView,g=c.SeriesBaselinePaneView,f=i(21499).SeriesHiLoPaneView,v=i(49418).SeriesWaterlinePaneView,S=i(27490),y=i(45672).BarsRange,b=i(36559).SeriesBarColorer,w=i(18213).SeriesData,P=i(61627),C=P.PlotRowSearchMode,T=P.mergeMinMax,x=i(10945).SyncModel,I=i(87438).trackEvent,M=i(65447).getLogger("Chart.Series"),L=i(74645),A=i(25436),k=i(1467),E=k.getServerInterval,D=k.getResolutionByChartStyle,V=i(35001).Interval,B=i(47229).SeriesHorizontalBaseLinePaneView,N=i(71287).SeriesPriceLinePaneView,R=i(7532).deepExtend,O=i(89164).encodeExtendedSymbolOrGetSimpleSymbolString,F=i(18437),W=i(60183).permissionDenied,H=i(89077).TIMEFRAMETYPE,z=i(47329).InvalidationMask,U=i(25436).isSingleValueBasedStyle;class j extends l{constructor(e,t,r,n){var o=i(4812);t.removeProperty("currencyId"),super(e,t,r,n),this._symbolIntervalChanged=new s,this._intervalChanged=new s,this.requestingIntradayWhenNotSupported=new s,this.requestingResolutionWhenNotSupported=new s,this._onInReplayStateChanged=new s,this._replayExitedDueUnsupportedInterval=new s,this._replayExitedDueUnavailableForUserInterval=new s,this._onTimeFrameApplied=new s,this.m_model=e,this._chartApi=e._chartApi,this.m_data=null,this.createPaneView(),this._syncModel=null,this._replaySubscriber=null,this._isReplayResolutionAvailableForUser=null,this._haStyle={studyId:A.chartStyleStudyId(j.STYLE_HEIKEN_ASHI,!0)},this._renkoStyle={studyId:A.chartStyleStudyId(j.STYLE_RENKO,!0)},this._pbStyle={studyId:A.chartStyleStudyId(j.STYLE_PB,!0)},this._kagiStyle={studyId:A.chartStyleStudyId(j.STYLE_KAGI,!0)},this._pnfStyle={studyId:A.chartStyleStudyId(j.STYLE_PNF,!0)},this._rangeStyle={studyId:A.chartStyleStudyId(j.STYLE_RANGE,!0)},this._properties.addExclusion&&(this._properties.addExclusion("visible"),this._properties.addExclusion("currencyId")),this._futureBarsPaneView=null,this._properties.showInDataWindow.listeners().subscribe(e,o.prototype.fullUpdate),this.properties().minTick.listeners().subscribe(this,j.prototype._recreateFormatter);var a=this ;this.properties().minTick.listeners().subscribe(null,(function(){a.m_model.fullUpdate()})),this._priceLineView=null,this._baseHorizontalLineView=new B(this),this._gotoDateResultCleared=!1,this._gotoDateView=null,this.bindStyleChange(),this.bindJapChartsInputs(),this._createIsDWMProperty(),this._symbolIntervalChanged.subscribe(this,this._checkInterval),this.properties().showCountdown.listeners().subscribe(this,j.prototype._onChangeShowCountdown),this._onChangeShowCountdown(this.properties().showCountdown),this._recreatePriceFormattingDependencies(),this.properties().lineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().areaStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this.properties().baselineStyle.priceSource.listeners().subscribe(this,this._updateBarFunction),this._updateBarFunction()}isLoading(){return this._loading}isSymbolInvalid(){return this._status===j.STATUS_INVALID_SYMBOL}styleStudyInfos(){return{haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle}}styleStudyInfo(e){return this.styleStudyInfos()[e]}priceLineColor(e){return this.properties().priceLineColor.value()||e}serverTimeOffset(){return this._chartApi.serverTimeOffset()}_onChangeShowCountdown(e){var t=this;e.value()?this._countdownUpdateTimer=this.m_model.setInterval((function(){t._priceAxisView.updateCountdown()}),500):(this.m_model.clearInterval(this._countdownUpdateTimer),delete this._countdownUpdateTimer)}_createIsDWMProperty(){this._isDWMProperty=new r(this.isDWM()),this._onRestarted.subscribe(this,(function(){this._isDWMProperty.setValue(this.isDWM())}))}isDWMProperty(){return this._isDWMProperty}model(){return this.m_model}fixLastBar(e){0}clearData(){o(null===this.m_data,"Cannot clear loaded data"),this._seriesSource.clearData()}data(){return this.m_data||this._seriesSource.data()}isPulse(){return this._symbolInfo&&this._symbolInfo.resolutions.length>0}onSymbolIntervalChanged(){return this._symbolIntervalChanged}onIntervalChanged(){return this._intervalChanged}status(){return this._status}createPaneView(){this._paneView=null,this._projectionBarsPaneView=null,this._waterlineView=null,this._priceLineView=this.hasClosePrice()?new N(this):null;var e=this._properties.style.value();switch(e){case j.STYLE_BARS:this._paneView=new _(this,this.m_model);break;case j.STYLE_CANDLES:this._paneView=new p(this,this.m_model);break;case j.STYLE_LINE:this._paneView=new d(this,this.m_model);break;case j.STYLE_AREA:this._paneView=new h(this,this.m_model);break;case j.STYLE_HEIKEN_ASHI:this._paneView=new m(this,this.m_model);break;case j.STYLE_HOLLOW_CANDLES:this._paneView=new u(this,this.m_model);break;case j.STYLE_BASELINE:this._paneView=new g(this,this.m_model),this._waterlineView=new v(this);break;case j.STYLE_HILO:this._paneView=new f(this,this.m_model)}if(null===this._paneView)throw Error("Unknown chart style assigned: "+e)}_clearStylePlot(e,t){if(0!==e.size()){ var i=t||a(e.firstIndex()),s=a(e.lastIndex())+1;e.range(i,s).each((function(e,t){t[TradingView.STYLE_PLOT]=null}))}}invalidateBarStylesCache(e){M.logDebug("Invalidate style cache starting from "+e),this._clearStylePlot(this.bars(),e),this._clearStylePlot(this.nsBars())}invalidateBarColorerCache(){delete this._barColorerCache,this.invalidateBarStylesCache()}barColorer(){if(this._barColorerCache)return this._barColorerCache;for(var e=null,t=this.m_model.dataSources(),i=t.length-1;i>=0;i--){var s=t[i];if(s.metaInfo&&TradingView.isInherited(s.constructor,TradingView.Study)&&s.hasBarColorer()&&!s.isSourceHidden()){var r=s.barColorer();null===e?e=r:e.pushBackBarColorer(r)}}return null===e?e=new b(this):e.pushBackBarColorer(new b(this)),this._barColorerCache=e,this._barColorerCache}_barsState(e){var t=e.state();return t.data.forEach((function(e){e.value.splice(7,1)})),t}state(e){var t=this===this.m_model.mainSeries()?"MainSeries":TradingView.className(this.constructor);const i=this.obsoleteZOrder();var s={type:t,id:this.id(),state:this.properties().state(),zorder:i,haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle};return this._symbolInfo&&this._symbolInfo.ticker&&(s.state.symbol=this._symbolInfo.ticker),e&&(s.bars=this._barsState(this.bars()),s.nsBars=this._barsState(this.nsBars()),s.symbolInfo=this._symbolInfo,s.rtPrice=this.data().lastProjectionPrice),s.boxSize=this.data().boxSize,s.reversalAmount=this.data().reversalAmount,s}restoreState(e,t){t&&this._setStatus(j.STATUS_SNAPSHOT),this._properties.mergeAndFire(e.state),this._properties.hasChild("esdBreaksStyle")&&this._properties.removeProperty("esdBreaksStyle"),this._prevChartStyle=this.properties().style.value(),this.createPaneView(),t&&this.restoreData(e.bars,e.nsBars,e.symbolInfo,e.rtPrice,e.boxSize,e.reversalAmount)}alertCreationAvailable(){const e=this.symbolInfo();return this.hasStateForAlert()&&e&&!A.isEconomicsSymbol(e)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}idForAlert(){return l.prototype.idForAlert.call(this)}restoreData(e,t,i,s,r,n){this._status=j.STATUS_SNAPSHOT,this.m_data=new w,this.m_data.m_bars.restoreState(e),this.m_data.m_nsBars.restoreState(t),this._updateSymbolInfo(i,!1),this.m_data.lastProjectionPrice=s,this.m_data.boxSize=r,r||(this.properties().style.value()===j.STYLE_PNF?this.m_data.boxSize=this.properties().pnfStyle.inputs.boxSize.value():this.properties().style.value()===j.STYLE_RENKO&&(this.m_data.boxSize=this.properties().renkoStyle.inputs.boxSize.value())),this.m_data.reversalAmount=n,n||this.properties().style.value()===j.STYLE_KAGI&&(this.m_data.reversalAmount=this.properties().kagiStyle.inputs.reversalAmount.value()),this._loading=!1}seriesSource(){return this._seriesSource}_onSymbolResolved(e){this._seriesErrorMessage=null,this._updateSymbolInfo(e,!1),this.m_model.updateSource(this),this.m_model.realignLineTools(),TradingView.onWidget()||(I("Symbol",e.listed_exchange,e.name), I("Symbol Type",e.type,e.listed_exchange));var t=this.symbolInfo().minmov/this.symbolInfo().pricescale,i=this.properties();i.style.value()===j.STYLE_RENKO&&i.renkoStyle.inputs.boxSize.value()e.update()),this._labelPaneViews.forEach(e=>e.update()),this._priceAxisViews.forEach(e=>e.update()),this._priceLineAxisViews.forEach(e=>e.update()),this._futureBarsPaneView&&this._futureBarsPaneView.update(),this._projectionBarsPaneView&&this._projectionBarsPaneView.update(),null!==this._waterlineView&&this._waterlineView.update(),null!==this._priceLineView&&this._priceLineView.update(),null!==this._gotoDateView&&this._gotoDateView.update(),this._baseHorizontalLineView.update();var e=this._model.activeStrategySource().value();null!==e&&e.updateAllViews(),this._lineStyleLastPriceCirclePaneView.update()}requestMoreData(e){ if((this._status===j.STATUS_READY||this._status===j.STATUS_PULSE||this._status===j.STATUS_DELAYED||this._status===j.STATUS_DELAYED_STREAMING||this._status===j.STATUS_EOD||this._status===j.STATUS_REPLAY)&&!this.m_model.timeScale().isEmpty()){var t=this.m_model.timeScale().visibleBarsStrictRange();if(null!==t&&0!==this.bars().size()){var i=t.lastBar()-a(this.data().last()).index;if(this._predictBars{this._gotoDateResultCleared||(this._gotoDateView=new t(this,e),this.m_model.updateSource(this))})}clearGotoDateResult(e){this._gotoDateView=null, this._gotoDateResultCleared=!0}syncModel(){if(!this._syncModel){var e=this.symbolInfo(),t=this.interval();if(!e||!t)return null;this._syncModel=new x(e,t)}return this._syncModel}getSourceIcon(){return{type:"loadSvg",svgId:"series."+this.properties().style.value()}}isStyleSupported(e){return!0}isIntervalSupported(e){return!0}isStyleSupportedForReplay(e){return A.isTimeBasedStyle(e)}isInReplay(){return null!==this._replaySubscriber}onTimeFrameApplied(){return this._onTimeFrameApplied}onInReplayStateChanged(){throw new Error("Not implemented")}replayExitedDueUnsupportedInterval(){throw new Error("Not implemented")}replayExitedDueUnavailableForUserInterval(){throw new Error("Not implemented")}switchToReplay(e,t){throw new Error("Not implemented")}switchToRealtime(){throw new Error("Not implemented")}_removeReplaySubscriber(){throw new Error("Not implemented")}_onBeforeModifySeries(e,t){0}_getTelemetryAdditionalData(e,t){t=void 0===t||t;var i={symbol:this.actualSymbol()};return t&&(i.resolution=this.interval()),void 0!==e&&(i.reason=e),i}_sendTelemetryReport(e,t,i){void 0===i&&(i=this._getTelemetryAdditionalData());var s=Object.assign(t,{additional:i});(void 0).sendChartReport(e,s)}_sendTelemetryCounter(e,t){this._sendTelemetryReport(e,{count:1},t)}destroy(){this._replayExitedDueUnsupportedInterval.destroy(),this._replayExitedDueUnavailableForUserInterval.destroy(),this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),this.clearGotoDateResult(),this._legendView.destroy(),this._marketStatusModel.destroy(),null!==this._dataUpdatedModeModel&&this._dataUpdatedModeModel.destroy(),this._dataProblemModel.destroy(),this._paneView&&this._paneView.destroy&&this._paneView.destroy(),this._onTimeFrameApplied.destroy(),this._seriesSource.destroy(),super.destroy()}dataEvents(){return this._seriesSource.dataEvents()}moveData(e){return this._seriesSource.moveData(e)}}Object.assign(j,L),TradingView.Series=j,t.Series=j,t.isSeries=function(e){return e instanceof j}},28834:(e,t,i)=>{"use strict";function s(e,t){return 100*(t-e)/Math.abs(e)}i.d(t,{barPercentChange:()=>s})},58605:(e,t,i)=>{"use strict";i.d(t,{PaneRendererBars:()=>n});var s=i(21344),r=i(95788);class n extends r.PaneRendererSeriesBase{constructor(e){super(),this._bars=e.bars,this._barSpacing=e.barSpacing,this._dontDrawOpen=e.dontDrawOpen,this._thinBars=e.thinBars}draw(e,t){e.save();const i=t.pixelRatio;if(this._barWidth=this._calcBarWidth(i),this._barWidth>=2){Math.max(1,Math.floor(i))%2!=this._barWidth%2&&this._barWidth--}this._barLineWidth=this._thinBars?Math.min(this._barWidth,Math.floor(i)):this._barWidth;let s=null;const r=this._barLineWidth<=this._barWidth&&this._barSpacing>=Math.floor(1.5*t.pixelRatio);for(const t of this._bars){s!==t.color&&(e.fillStyle=t.color,s=t.color);const n=Math.floor(.5*this._barLineWidth),o=Math.round(t.time*i),a=o-n,l=this._barLineWidth,c=a+l-1,h=Math.min(t.high,t.low),d=Math.max(t.high,t.low),u=Math.round(h*i)-n,p=Math.round(d*i)+n,_=Math.max(p-u,this._barLineWidth);e.fillRect(a,u,l,_) ;const m=Math.ceil(1.5*this._barWidth);if(r){const s=o-m,r=o+m,h=Math.min(a-s,r-c);if(!this._dontDrawOpen){let r=Math.max(u,Math.round(t.open*i)-n),o=r+l-1;o>u+_-1&&(o=u+_-1,r=o-l+1),e.fillRect(s,r,h,o-r+1)}let d=Math.max(u,Math.round(t.close*i)-n),p=d+l-1;p>u+_-1&&(p=u+_-1,d=p-l+1),e.fillRect(c+1,d,h,p-d+1)}}e.restore()}_getTolerance(){const e=this._calcBarWidth(1),t=this._thinBars?Math.min(e,1):e;return(0,s.interactionTolerance)().series+t/2}_getBarSpacing(){return this._barSpacing}_calcBarWidth(e){const t=Math.floor(e);return Math.max(t,Math.floor((0,s.optimalBarWidth)(this._barSpacing,e)))}}},49418:(e,t,i)=>{"use strict";i.d(t,{SeriesWaterlinePaneView:()=>a});var s=i(87747),r=i(10992),n=i(10288),o=i(33420);class a extends s.SeriesHorizontalLinePaneView{constructor(e){super(e);const t={cursorType:r.PaneCursorType.VerticalResize,activeItem:0,areaName:n.AreaName.SourceItemMove};this._lineRenderer.setHitTest(new n.HitTestResult(n.HitTestResult.MOVEPOINT,t)),this._lineRendererData.visible=!0,this._lineRendererData.linestyle=o.LINESTYLE_SPARSE_DOTTED}_updateImpl(){const e=this._series.properties().childs().baselineStyle.childs(),t=Math.abs(100-e.baseLevelPercentage.value());this._lineRendererData.y=Math.round(this._series.priceScale().height()*(t/100)),this._lineRendererData.color=e.baselineColor.value()}}},95788:(e,t,i)=>{"use strict";i.d(t,{PaneRendererSeriesBase:()=>r});var s=i(10288);class r{constructor(){this._bars=[]}hitTest(e){const t=this._bars,i=this._getBarSpacing(),s=i/2;if(0===t.length)return null;const r=this._getTolerance(),n=t[0],o=t[t.length-1];if(e.xo.time+s+r)return null;let a=0,l=t.length-1,c=-1;for(;a<=l;){const i=Math.floor((a+l)/2),h=t[i];let d=s;if(h!==n&&h!==o||(d+=r),Math.abs(h.time-e.x)<=d){c=i;break}e.x-h.time>s?a=i+1:l=i-1}if(-1!==c){const n=Math.ceil(r/i);if(0!==n){const i=Math.max(0,c-n),o=Math.min(t.length-1,c+n);for(let n=i;n<=o;n++)if(Math.abs(e.x-t[n].time)<=s+r&&this._isPointAtBar(t[n],e.y,r))return this._getHitTest()}else if(this._isPointAtBar(t[c],e.y,r))return this._getHitTest()}return null}_getHitTest(){return new s.HitTestResult(s.HitTestResult.REGULAR)}_isPointAtBar(e,t,i){const s=Math.min(e.high,e.low),r=Math.max(e.high,e.low);return s-i<=t&&t<=r+i}}},67596:(e,t,i)=>{"use strict";i.d(t,{PaneRendererCandles:()=>l});var s=i(16282),r=i(10288),n=i(55430),o=i(21344),a=i(95788);class l extends a.PaneRendererSeriesBase{constructor(e){super(),this._barSpacing=1,this._barWidth=1,this._borderVisible=!1,this._barBorderWidth=1,this._wickVisible=!1,this._bodyVisible=!0,this._borderColor=void 0,this._wickColor=void 0,this._hittest=void 0,this._isPriceScaleInverted=!1,e&&this.setData(e)}setData(e){this._bars=e.bars,this._barSpacing=e.barSpacing,this._borderVisible=e.borderVisible,this._bodyVisible=e.bodyVisible,this._wickVisible=e.wickVisible,this._borderColor=e.borderColor,this._wickColor=e.wickColor,this._hittest=e.hittest,this._isPriceScaleInverted=e.isPriceScaleInverted}hitTest(e){ return this._wickVisible||this._borderVisible||this._bodyVisible?super.hitTest(e):null}draw(e,t){if(0===this._bars.length)return;const i=t.pixelRatio;if(this._barWidth=(0,o.optimalCandlestickWidth)(this._barSpacing,i),this._barWidth>=2){Math.floor(i)%2!=this._barWidth%2&&this._barWidth--}this._wickVisible&&this._drawWicks(e,i),this._borderVisible&&this._drawBorder(e,i),this._bodyVisible&&this._drawCandles(e,i)}_getTolerance(){return(0,o.interactionTolerance)().series+this._barBorderWidth/2}_getBarSpacing(){return this._barSpacing}_getHitTest(){return this._hittest||new r.HitTestResult(r.HitTestResult.REGULAR)}_isPointAtBar(e,t,i){const s=this._bodyVisible||this._borderVisible,r=this._wickVisible;if(!s&&!r)return!1;if(s){const s=r?Math.min(e.high,e.low):Math.min(e.open,e.close),n=r?Math.max(e.high,e.low):Math.max(e.open,e.close);return s-i<=t&&t<=n+i}{const s=Math.min(e.open,e.close),r=Math.max(e.open,e.close);return e.high-i<=t&&t<=s+i||r-i<=t&&t<=e.low+i}}_drawWicks(e,t){const i=this._bars;let r="",n=Math.min(Math.floor(t),Math.floor(this._barSpacing*t));n=Math.max(Math.floor(t),Math.min(n,this._barWidth));const o=Math.floor(.5*n);let a=null;for(const l of i){const i=l.wickColor?l.wickColor:(0,s.ensureDefined)(this._wickColor);i!==r&&(e.fillStyle=i,r=i);let c=Math.round(Math.min(l.open,l.close)*t),h=Math.round(Math.max(l.open,l.close)*t);this._isPriceScaleInverted&&([h,c]=[c,h]);const d=Math.round(l.high*t),u=Math.round(l.low*t);let p=Math.round(t*l.time)-o;const _=p+n-1;null!==a&&(p=Math.max(a+1,p),p=Math.min(p,_));const m=_-p+1;e.fillRect(p,d,m,c-d),e.fillRect(p,h+1,m,u-h-1),a=_}}_calculateBorderWidth(e){let t=Math.floor(1*e);this._barWidth<=2*t&&(t=Math.floor(.5*(this._barWidth-1)));const i=Math.max(Math.floor(e),t);return this._barWidth<=2*i?Math.max(Math.floor(e),Math.floor(1*e)):i}_drawBorder(e,t){let i="";const r=this._calculateBorderWidth(t);let o=null;for(const a of this._bars){if(a.borderColor!==i&&(e.fillStyle=a.borderColor?a.borderColor:(0,s.ensureDefined)(this._borderColor),i=a.borderColor),this._bodyVisible&&a.hollow)continue;let l=Math.round(a.time*t)-Math.floor(.5*this._barWidth);const c=l+this._barWidth-1,h=Math.round(Math.min(a.open,a.close)*t),d=Math.round(Math.max(a.open,a.close)*t);if(null!==o&&(l=Math.max(o+1,l),l=Math.min(l,c)),this._barSpacing*t>2*r)(0,n.fillRectInnerBorder)(e,l,h,c-l+1,d-h+1,r);else{const t=c-l+1;e.fillRect(l,h,t,d-h+1)}o=c}}_drawCandles(e,t){let i="";const s=this._calculateBorderWidth(t);for(const r of this._bars){if(this._borderVisible&&this._barWidth<=2*s&&!r.hollow)continue;let o=Math.round(Math.min(r.open,r.close)*t),a=Math.round(Math.max(r.open,r.close)*t),l=Math.round(r.time*t)-Math.floor(.5*this._barWidth),c=l+this._barWidth-1;if(r.color!==i){const t=r.color;e.fillStyle=t,i=t}if(r.hollow)e.fillStyle=r.color,(0,n.fillRectInnerBorder)(e,l,o,c-l+1,a-o+1,s);else{if(this._borderVisible&&(l+=s,o+=s,c-=s,a-=s),o>a)continue;e.fillRect(l,o,c-l+1,a-o+1)}}}}},21499:(e,t,i)=>{"use strict";i.d(t,{SeriesHiLoPaneView:()=>f}) ;var s=i(16282),r=i(73395),n=i(90887),o=i(49382),a=i(21344),l=i(10288),c=i(58729);class h extends c.ScaledPaneRenderer{constructor(){super(...arguments),this._data=null,this._barWidth=null}setData(e){this._data=e,this._barWidth=Math.max(1,Math.round((0,a.optimalHiLoWidth)(e.barSpacing)))}hitTest(e){if(null===this._data||null===this._barWidth)return null;const t=this._data.bars,i=.5*this._data.barSpacing;if(0===t.length)return null;if(e.xt[t.length-1].time+i)return null;const s=t[(0,o.lowerbound)(t,e.x-i,(e,t)=>e.times.time+i)return null;const r=(0,a.interactionTolerance)().series+this._barWidth/2,n=Math.min(s.high,s.low),c=Math.max(s.high,s.low),h=this._data.fontSize;return n-r-h<=e.y&&e.y<=n+r||c-r<=e.y&&e.y<=c+r+h?new l.HitTestResult(l.HitTestResult.REGULAR):null}_drawImpl(e){if(null===this._data||null===this._barWidth)return;e.save(),e.translate(.5,.5),e.textAlign="center",e.fillStyle=this._data.labelColor,e.font=(0,r.makeFont)(this._data.fontSize,this._data.font);const t=this._data.bars,i=this._data.inverted;for(let s=0;se.highLabelWidth<=r&&e.lowLabelWidth<=r),o={bars:this._bars(),wickVisible:!1,bodyVisible:s.drawBody.value(),barSpacing:r,borderVisible:s.showBorders.value(),barWidth:(0,a.optimalHiLoWidth)(r),font:m.CHART_FONT_FAMILY,fontSize:s.fontSize.value(),labelColor:s.labelColor.value(),inverted:this._series().priceScale().isInverted(),labelsPadding:3},l=new u.CompositeRenderer;return this._candlesRenderer.setData(o),l.append(this._candlesRenderer),n&&(this._labelsRenderer.setData(o),l.append(this._labelsRenderer)),this._model().selection().isSelected(this._series())&&this._isMarkersEnabled&&l.append(new p.SelectionRenderer(this._selectionData)),l}topPixelMargin(){return this._margin()}bottomPixelMargin(){return this._margin()}_margin(){const e=this._series().properties().childs().hiloStyle.childs();return e.showLabels.value()?e.fontSize.value()+6:0}_barUpdater(e,t,i,s){const r=i[2],n=i[3] ;return!(!g(r)||!g(n))&&(s.high=s.open=r,s.low=s.close=n,t&&(s.highLabel=e.format(r),s.highLabelWidth=this._getLabelWidth(s.highLabel),s.lowLabel=e.format(n),s.lowLabelWidth=this._getLabelWidth(s.lowLabel)),!0)}_needLabels(){const e=this._model().timeScale().barSpacing();return this._series().properties().childs().hiloStyle.childs().showLabels.value()&&e>5}_getLabelWidth(e){return this._widthsCache.measureText(this._context,e)}}},6195:(e,t,i)=>{"use strict";i.d(t,{SeriesDataSource:()=>f});var s=i(16282),r=i(47903),n=i(89164),o=i(35001),a=i(18213),l=i(66096),c=i(60183),h=i(5729),d=i.n(h);class u{constructor(){this._loading=new(d()),this._completed=new(d()),this._error=new(d()),this._symbolError=new(d()),this._symbolResolved=new(d()),this._seriesError=new(d()),this._symbolNotPermitted=new(d()),this._symbolGroupNotPermitted=new(d()),this._chartTypeNotPermitted=new(d()),this._intradaySpreadNotPermitted=new(d()),this._intradayExchangeNotPermitted=new(d()),this._customIntervalNotPermitted=new(d()),this._secondsIntervalNotPermitted=new(d()),this._tickMarksRangeChanged=new(d()),this._barReceived=new(d()),this._seriesTimeFrame=new(d()),this._dataUpdated=new(d())}destroy(){this._loading.destroy(),this._completed.destroy(),this._error.destroy(),this._symbolError.destroy(),this._symbolResolved.destroy(),this._seriesError.destroy(),this._symbolNotPermitted.destroy(),this._symbolGroupNotPermitted.destroy(),this._chartTypeNotPermitted.destroy(),this._intradaySpreadNotPermitted.destroy(),this._intradayExchangeNotPermitted.destroy(),this._customIntervalNotPermitted.destroy(),this._secondsIntervalNotPermitted.destroy(),this._tickMarksRangeChanged.destroy(),this._barReceived.destroy(),this._seriesTimeFrame.destroy(),this._dataUpdated.destroy()}loading(){return this._loading}completed(){return this._completed}error(){return this._error}symbolError(){return this._symbolError}symbolResolved(){return this._symbolResolved}seriesError(){return this._seriesError}symbolNotPermitted(){return this._symbolNotPermitted}symbolGroupNotPermitted(){return this._symbolGroupNotPermitted}chartTypeNotPermitted(){return this._chartTypeNotPermitted}intradaySpreadNotPermitted(){return this._intradaySpreadNotPermitted}intradayExchangeNotPermitted(){return this._intradayExchangeNotPermitted}customIntervalNotPermitted(){return this._customIntervalNotPermitted}secondsIntervalNotPermitted(){return this._secondsIntervalNotPermitted}tickMarksRangeChanged(){return this._tickMarksRangeChanged}barReceived(){return this._barReceived}seriesTimeFrame(){return this._seriesTimeFrame}dataUpdated(){return this._dataUpdated}fireCompleted(e,t){this._completed.fire(e,t)}fireLoading(e){this._loading.fire(e)}fireError(){this._error.fire()}fireSymbolError(e){this._symbolError.fire(e),this.fireError()}fireSymbolResolved(e){this._symbolResolved.fire(e)}fireSeriesError(e){this._seriesError.fire(e),this.fireError()}fireSymbolNotPermitted(e){this._symbolNotPermitted.fire(e),this.fireError()}fireSymbolGroupNotPermitted(e){this._symbolGroupNotPermitted.fire(e),this.fireError()} fireChartTypeNotPermitted(e){this._chartTypeNotPermitted.fire(e),this.fireError()}fireIntradaySpreadNotPermitted(){this._intradaySpreadNotPermitted.fire(),this.fireError()}fireIntradayExchangeNotPermitted(){this._intradayExchangeNotPermitted.fire(),this.fireError()}fireCustomIntervalNotPermitted(){this._customIntervalNotPermitted.fire(),this.fireError()}fireSecondsIntervalNotPermitted(){this._secondsIntervalNotPermitted.fire(),this.fireError()}fireTickMarksRangeChanged(e){this._tickMarksRangeChanged.fire(e)}fireBarReceived(e){this._barReceived.fire(e)}fireSeriesTimeFrame(e,t,i,s,r){this._seriesTimeFrame.fire(e,t,i,s,r)}fireDataUpdated(e,t){this._dataUpdated.fire(e,t)}}const p=(0,i(65447).getLogger)("Chart.SeriesDataSource");var _;!function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingFirstDataUpdate=2]="AwaitingFirstDataUpdate",e[e.Active=3]="Active"}(_||(_={}));let m=1;let g=1;class f{constructor(e,t,i){var r;this._instanceId=null,this._symbolInstanceId=null,this._symbol=null,this._resolution=null,this._timeFrame=null,this._data=new a.SeriesData,this._dataEvents=new u,this._status=_.Idle,this._turnaroundCounter=1,this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e,this._turnaroundPrefix=t,this._createSeriesParams=(r=null!=i?i:{count:300}).startDate?r.endDate||r.count?r.endDate?["from_to",r.startDate,r.endDate]:["bar_count",r.startDate,(0,s.ensure)(r.count)]:["from_to",r.startDate]:r.count||300,this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged)}destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged)}modifySeries(e,t,i=null,n=!1){n&&(p.logNormal("Due to force flag clearing symbol & resolution to force re-requesting data."),this._symbol=null,this._resolution=null);const a=this._symbol,l=this._resolution;if(this._symbol=e,this._resolution=t,null===this._instanceId)return void(this._timeFrame=i);const c=!(0,r.deepEquals)(a,e)[0],h=null===l||!o.Interval.isEqual(l,t);(c||h||null!==i)&&(this._timeFrame=null,(c||h)&&this._turnaroundCounter++,c&&this._resolveSymbol(),this._gateway.modifySeries(this._instanceId,this.turnaround(),(0,s.ensureNotNull)(this._symbolInstanceId),this._resolution,i,this._onMessage.bind(this)))}requestMoreData(e){null!==this._instanceId&&this._gateway.requestMoreData(this._instanceId,e,this._onMessage.bind(this))}requestMoreTickmarks(e){null!==this._instanceId&&this._gateway.requestMoreTickmarks(this._instanceId,e,this._onMessage.bind(this))}isStarted(){return this._status!==_.Idle}isActive(){return this._status===_.Active}start(){this.isStarted()?p.logNormal("start: data source is already started, nothing to do"):((0,s.assert)(null!==this._symbol,"symbol must be set before start"),(0,s.assert)(null!==this._resolution,"resolution must be set before start"),this._gateway.isConnected().value()?this._createSeries():this._changeStatusTo(_.AwaitingConnection))}stop(){ this.isStarted()?(null!==this._instanceId&&(this._gateway.removeSeries(this._instanceId),this._instanceId=null),this._changeStatusTo(_.Idle)):p.logNormal("stop: data source is already stopped, nothing to do")}instanceId(){return this._instanceId}data(){return this._data}clearData(){this.isStarted()?this._enqueueUpdate(()=>this._clearDataImpl()):this._clearDataImpl()}dataEvents(){return this._dataEvents}turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}symbolInstanceId(){return this._symbolInstanceId}moveData(e){this._enqueueUpdate(()=>this._data.moveData(e))}_clearDataImpl(){this._data.clear()}_resolveSymbol(){null!==this._symbol&&(this._symbolInstanceId="sds_sym_"+m++,this._gateway.resolveSymbol(this._symbolInstanceId,(0,n.encodeExtendedSymbolOrGetSimpleSymbolString)(this._symbol),this._onMessage.bind(this)))}_changeStatusTo(e){(0,s.assert)(this._status!==e,"Source and destination status should be distinct"),p.logNormal(`Status changed from ${_[this._status]} to ${_[e]}`),this._status=e}_createSeries(){(0,s.assert)(this._status!==_.Active,'Status should not be "Active" when creating a study'),this._instanceId="sds_"+g++,this._resolveSymbol(),this._gateway.createSeries(this._instanceId,this.turnaround(),(0,s.ensureNotNull)(this._symbolInstanceId),(0,s.ensureNotNull)(this._resolution),this._createSeriesParams,this._timeFrame,this._onMessage.bind(this)),this._timeFrame=null,this._changeStatusTo(_.AwaitingFirstDataUpdate)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===_.AwaitingConnection&&this._createSeries()}_onGatewayDisconnected(){this._status!==_.Idle&&this._status!==_.AwaitingConnection&&(this._instanceId=null,this._changeStatusTo(_.AwaitingConnection)),this._turnaroundCounter=1}_onMessage(e){this._enqueueUpdate(()=>this._onMessageImpl(e))}async _onMessageImpl(e){switch(e.method){case"symbol_resolved":{const[t,i]=e.params;if(t!==this._symbolInstanceId){p.logNormal(`Resolve for old symbol, expected: ${this._symbolInstanceId}, actual ${e.params[0]}`);break}this._onSymbolResolved(i);break}case"symbol_error":if(e.params[0]!==this._symbolInstanceId){p.logNormal(`Symbol error for old symbol, expected: ${this._symbolInstanceId}, actual ${e.params[0]}`);break}this._onSymbolError(e);break;case"series_timeframe":{const[t,i,s,r,n,o,a]=e.params;if(!this._checkTurnaround(t,i)){p.logNormal(`Time frame for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${i})`);break}this._onSeriesTimeFrame(s,r,n,o,a);break}case"series_error":{const[t,i]=e.params;if(!this._checkTurnaround(t,i)){p.logNormal(`Series error for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${i})`);break}this._onSeriesError(e.params[2]);break}case"series_loading":{const[t,i]=e.params;if(!this._checkTurnaround(t,i))break;this._onSeriesLoading(e.time);break}case"series_completed":{const[t,i,s]=e.params;if(!this._checkTurnaround(t,s)){ p.logNormal(`Series completed for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${s})`);break}this._onSeriesCompleted(i,e.time);break}case"data_update":if(!this._checkTurnaround(e.params.customId,e.params.turnaround)){p.logNormal(`Data update for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${e.params.customId} (${e.params.turnaround})`);break}await this._onDataUpdate(e.params.plots,e.params.nonseries,e.params.lastBar);break;case"clear_data":if(e.params.turnaround!==this.turnaround()){p.logNormal(`Clear data for old data, expected: ${this.turnaround()}, actual ${e.params.turnaround}`);break}this._clearDataImpl(),this._dataEvents.fireDataUpdated(void 0,!1)}}_onSeriesError(e){let t,i;if("string"==typeof e)i={error:e},t=e;else if(i=e,e.ctx){const i={};Object.entries(e.ctx).forEach(([e,t])=>{i[e]=t.toString()}),t=e.error.format(i)}else t=e.error;if(t.startsWith("study_not_auth:")){const e=t.split(":",2)[1].split("@",2)[0];["BarSetRenko","BarSetPriceBreak","BarSetKagi","BarSetPnF"].includes(e)?this._dataEvents.fireChartTypeNotPermitted(e):"BarSetSpread"===e?this._dataEvents.fireIntradaySpreadNotPermitted():"BarSetRange"===e&&this._dataEvents.fireCustomIntervalNotPermitted()}else"resolution_not_entitled"===t?this._dataEvents.fireIntradayExchangeNotPermitted():"custom_resolution"===t?this._dataEvents.fireCustomIntervalNotPermitted():"seconds_not_entitled"===t&&this._dataEvents.fireSecondsIntervalNotPermitted();this._dataEvents.fireSeriesError(i)}_onSeriesTimeFrame(e,t,i,s,r){this._dataEvents.fireSeriesTimeFrame(e,t,i,null==s||s,r)}_onSymbolError(e){if(e.params[1]===c.permissionDenied)switch(e.params[2]){case c.SymbolErrorPermissionDeniedReason.Symbol:this._dataEvents.fireSymbolNotPermitted(e.params[3]);break;case c.SymbolErrorPermissionDeniedReason.GroupPermission:this._dataEvents.fireSymbolGroupNotPermitted(e.params[3]);break;default:this._dataEvents.fireSymbolNotPermitted(e.params[2])}this._dataEvents.fireSymbolError(e.params[1])}_onSymbolResolved(e){this._dataEvents.fireSymbolResolved(e)}async _onDataUpdate(e,t,i){this._onDataUnpacked(e,i,await async function(e){if(void 0===e)return{projectionPlots:[],boxSize:null};if(""===e.d||"nochange"===e.indexes)return null;const t=await(0,l.unpackNonSeriesData)(e.d);if(null===t||t.indexes_replace)return null;const i=e.indexes,{bars:s,price:r,boxSize:n,reversalAmount:o}=t.data,a=(s||[]).map(e=>{let t;return"factor"in e?t=e.factor:"additionalPrice"in e&&(t=e.additionalPrice),{index:i[e.time],value:[0,e.open,e.high,e.low,e.close,e.volume,t]}});return{lastPrice:r,projectionPlots:a,reversalAmount:o,boxSize:n}}(t))}_enqueueUpdate(e){return this._ongoingDataUpdate=this._ongoingDataUpdate.then(e,e),this._ongoingDataUpdate}_onDataUnpacked(e,t,i){if(this._status===_.Idle)return;this._status===_.AwaitingFirstDataUpdate&&(this._changeStatusTo(_.Active),this._clearDataImpl());const s=this._data.bars().size(),r=this._data.bars().firstIndex(),n=this._data.mergeRegularBars(e);null!==i&&(this._data.nsBars().clear(), this._data.nsBars().merge(i.projectionPlots),this._data.lastProjectionPrice=i.lastPrice,null!==i.boxSize&&(this._data.boxSize=i.boxSize),this._data.reversalAmount=i.reversalAmount);const o=null===r||null!==n&&n.index{"use strict";i.d(t,{SeriesHorizontalBaseLinePaneView:()=>r});var s=i(87747);class r extends s.SeriesHorizontalLinePaneView{constructor(e){super(e)}_updateImpl(){this._lineRendererData.visible=!1;const e=this._series.priceScale().mode();if(!e.percentage&&!e.indexedTo100)return;const t=this._series.firstValue();null!==t&&(this._lineRendererData.visible=!0,this._lineRendererData.y=this._series.priceScale().priceToCoordinate(t,t),this._lineRendererData.color=this._series.properties().childs().baseLineColor.value())}}},87747:(e,t,i)=>{"use strict";i.d(t,{SeriesHorizontalLinePaneView:()=>r});var s=i(42225);class r extends s.HorizontalLinePaneView{constructor(e){super(),this._series=e,this._model=e.model()}}},71287:(e,t,i)=>{"use strict";i.d(t,{SeriesPriceLinePaneView:()=>n});var s=i(87747),r=i(33420);class n extends s.SeriesHorizontalLinePaneView{constructor(e){super(e),this._lineRendererData.linestyle=r.LINESTYLE_DOTTED}_updateImpl(){this._lineRendererData.visible=!1;const e=this._series.properties().childs();if(!e.showPriceLine.value())return;if(12===e.style.value())return;const t=this._series.lastValueData(void 0,!0);t.noData||(this._lineRendererData.visible=!0,this._lineRendererData.y=t.coordinate,this._lineRendererData.color=this._series.priceLineColor(t.color),this._lineRendererData.linewidth=e.priceLineWidth.value())}}},83111:(e,t,i)=>{"use strict";i.d(t,{calculateColor:()=>C,SeriesValuesProvider:()=>T});var s=i(16282),r=i(75496),n=i(14563),o=i(79881),a=i(43367),l=i(50968),c=i(76553),h=i(61627),d=i(67945),u=i(15521),p=i(62159),_=i(76559),m=i(36559),g=i(28834),f=i(7518);const v=a.CheckMobile.any(),S=v&&!0,y=new p.PercentageFormatter,b=new _.VolumeFormatter(2),w=(0,o.t)("n/a"),P=`${w} (${w}%)`;function C(e,t){const i=(0,n.parseRgb)(t),s=(0,n.parseRgb)(e);return(0,n.distanceRgb)(i,s)<70?(0,n.rgbToHexString)((0,n.invertRgb)(i)):t}class T{constructor(e,t){this._series=e,this._model=t,this._emptyValues=[{title:(0,o.t)("Open"),visible:!1,value:"",index:0,id:""},{title:(0,o.t)("High"),visible:!1,value:"",index:1,id:""},{title:(0,o.t)("Low"),visible:!1,value:"",index:2,id:""},{title:(0,o.t)("Close"),visible:!1,value:"",index:3,id:""},{title:"",visible:!1,value:"",index:4,id:""},{title:"",visible:!1,value:"",index:5,id:""},{title:(0,o.t)("Change"),visible:!1,value:"",index:6,id:""},{title:(0,o.t)("Vol"),visible:!1,value:"",index:7,id:""}]}getItems(){return this._emptyValues}getValues(e){const t=this._showLastPriceAndChangeOnly(),i=this._emptyValues.map(e=>({...e,visible:!t})) ;i[0].value=w,i[1].value=w,i[2].value=w,i[3].value=w,i[6].value=P,i[7].value=w,i[5].visible=!1;const n=i[4];if(n.value=w,n.visible=!1,this._model.timeScale().isEmpty()||0===this._series.bars().size()||this._series.priceScale().isEmpty())return i;(0,r.isNumber)(e)||(e=(0,s.ensureNotNull)(this._series.data().last()).index);const o=this._series.nearestIndex(e,h.PlotRowSearchMode.NearestLeft);if(void 0===o)return i;const a=this._series.data().valueAt(o),d=this._model.backgroundTopColor().value();if(null===a)return i;const u=a[1],p=a[2],_=a[3],g=a[4],{values:v}=this._changesData(g,o,t),T=(0,f.getPriceValueFormatterForSource)(this._series);if((0,f.shouldBeFormattedAsPercent)(this._series))i[6].value="";else if(void 0!==v){const e=this._series.formatter();i[6].value=(0,c.forceLTRStr)(`${e.format(v.change,!0)} (${y.format(v.percentChange,!0)})`)}if(t)i[5].value=null==g?w:T(g),i[5].visible=!0,i[6].visible=!0;else{i[0].value=null==u?w:T(u),i[1].value=null==p?w:T(p),i[2].value=null==_?w:T(_),i[3].value=null==g?w:T(g),i[4].value=T(this._series.barFunction()(a));const e=a[5];(0,r.isNumber)(e)?i[7].value=b.format(e):i[7].visible=!1}let x=null;if(t&&!S)x=void 0===v||v.change>=0?m.SeriesBarColorer.upColor(this._series.properties()):m.SeriesBarColorer.downColor(this._series.properties());else{const e=this._series.barColorer().barStyle(o,!1);x=C(d,null!=e.barBorderColor?e.barBorderColor:e.barColor)}x=(0,l.resetTransparency)(C(d,x));for(const e of i)e.color=x;return i}_showLastPriceAndChangeOnly(){return v&&(null===this._model.crossHairSource().pane||(0,d.isLineToolName)(u.tool.value())||null!==this._model.lineBeingEdited())}_changesData(e,t,i){var s;if(i&&!S){const e=this._series.quotes();if(null!==e)return{values:{change:e.change,percentChange:e.change_percent}}}else{const i=this._series.data().search(t-1,h.PlotRowSearchMode.NearestLeft),r=null!==(s=null==i?void 0:i.value[4])&&void 0!==s?s:null;if(null!==r&&null!=e)return{values:{change:e-r,percentChange:(0,g.barPercentChange)(r,e)}}}return{}}}},90887:(e,t,i)=>{"use strict";var s=i(72927).Point,r=i(73301).SelectionRenderer,n=i(10288).HitTestResult,o=i(58605).PaneRendererBars,a=i(59109).PaneRendererLine,l=i(73175).PaneRendererStepLine,c=i(9537).PaneRendererArea,h=i(67596).PaneRendererCandles,d=i(63736).PaneRendererBaseline,u=i(87088).CompositeRenderer,p=i(50968),_=i(61627).PlotRowSearchMode,m=i(27490),g=i(21344),f=i(98742).SelectionIndexes;function v(e,t){this.m_series=e,this.m_model=t,this.m_bars=[],this._invalidated=!0,this._isMarkersEnabled=m.enabled("source_selection_markers"),this._selectionData=null,this._selectionIndexer=new f(t.timeScale())}function S(e,t){return void 0!==e[TradingView.OPEN_PLOT]&&void 0!==e[TradingView.HIGH_PLOT]&&void 0!==e[TradingView.LOW_PLOT]&&void 0!==e[TradingView.CLOSE_PLOT]&&(t.open=e[TradingView.OPEN_PLOT],t.high=e[TradingView.HIGH_PLOT],t.low=e[TradingView.LOW_PLOT],t.close=e[TradingView.CLOSE_PLOT],!0)}function y(e,t){v.call(this,e,t)}function b(e,t){v.call(this,e,t)}function w(e,t){v.call(this,e,t)}function P(e,t){v.call(this,e,t)}function C(e,t){ this.m_series=e,this.m_model=t,this.m_items=[],this._isMarkersEnabled=m.enabled("source_selection_markers"),this._selectionIndexer=new f(t.timeScale())}function T(e,t){C.call(this,e,t),this._invaidated=!0}function x(e,t){C.call(this,e,t),this._invaidated=!0}function I(e,t){C.call(this,e,t),this._invaidated=!0,this._renderer=new d}v.prototype._series=function(){return this.m_series},v.prototype._model=function(){return this.m_model},v.prototype._bars=function(){return this.m_bars},v.prototype.update=function(){this._invalidated=!0},v.prototype._updateImpl=function(e){var t=this;if((e=e||S,this.m_bars=[],!this.m_model.timeScale().isEmpty()&&!this.m_series.priceScale().isEmpty())&&(null!==(a=this.m_model.timeScale().visibleBarsStrictRange())&&0!==this.m_series.bars().size())){for(var i=this.m_series.nearestIndex(a.firstBar(),_.NearestRight),r=this.m_series.nearestIndex(a.lastBar(),_.NearestLeft);i<=r;i++){if(null!==this.m_series.bars().valueAt(i))break}if(!(i>r)){var o,a=this.m_series.bars().range(i,r),l=this.m_series.priceScale(),c=this.m_series.barColorer(),h={};if(a.each((function(i,s){var r,n={};(n.time=Math.round(i),e(s,n))&&(h.value=s,r=s[TradingView.STYLE_PLOT]?s[TradingView.STYLE_PLOT]:c.barStyle(i,!1,h),s[TradingView.STYLE_PLOT]=r,h.previousValue=s,n.color=r.barColor,n.borderColor=r.barBorderColor,n.wickColor=r.barWickColor,n.hollow=r.isBarHollow,t.m_bars.push(n))}),this),0!==this.m_bars.length&&(o=this.m_series.firstValue(),l.barPricesToCoordinates(this.m_bars,o)),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_model.selection().isSelected(this.m_series)){var d=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0};var u=this.m_model.paneForSource(this.m_series).height();this._selectionData.hittestResult=n.REGULAR;for(var p=0;p{"use strict";i.d(t,{sessionsPreferencesDefault:()=>r});var s=i(53312);const r={graphics:{backgrounds:{outOfSession:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1},preMarket:{color:"#FF9800",transparency:92,visible:!1},postMarket:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1}},vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}}}}},22287:(e,t,i)=>{"use strict";i.d(t,{StatusProviderBase:()=>s});class s{constructor(e){this._colorProperty=e}size(){return"13px"}bold(){return!1}color(){return this._colorProperty.value()}}},44264:(e,t,i)=>{"use strict";i.d(t,{StatusView:()=>s});class s{constructor(e){this._text="",this._color="",this._size="13px",this._bold=!1,this._statusProvider=e}text(){return this._text}getSplitTitle(){return[this._text]}color(){return this._statusProvider.color()}bold(){return this._bold}size(){return this._size}}},79739:(e,t,i)=>{"use strict";var s;i.d(t,{StoriesTimeLineItemType:()=>s}),function(e){e[e.Image=0]="Image",e[e.Emoji=1]="Emoji"}(s||(s={}))},71233:(e,t,i)=>{"use strict";i.d(t,{seriesPrice:()=>n,positionVisualDirection:()=>a,positionToCoordinate:()=>l,noDataBasePosition:()=>c,seriesBasePosition:()=>h,getNoDataPosition:()=>d,getSeriesPosition:()=>u});var s=i(16282),r=i(61627);function n(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:return s(t.value);default:return t.value[-1===i?3:2]}}function o(e){return e>=0?1:-1}function a(e,t){return-1===o(e)!==t?-1:1}function l(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function c(e,t,i){const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i)}}function h(e,t){const i=e.data().bars(),s=i.first(),a=i.last();if(null===s||null===a)return null;let l;const c=t.index();if(null===c){if(void 0===t.time)return null;const e=t.time(),n=s.value[0],o=a.value[0];if(eo)return null;l=i.searchByTime(e,r.PlotRowSearchMode.NearestRight,4)}else l=i.search(c);return null===l?null:{index:l.index,price:n(e,l,o(t.position()))}}function d(e,t,i){const s=c(e,t,i);if(null===s)return null ;const r=a(e.position(),t.isInverted());return{index:s.index,price:s.price,poleStartY:t.height(),visualDirection:1,positionPointDirection:r}}function u(e,t){const i=h(e,t),r=e.priceScale(),n=(0,s.ensureNotNull)(e.firstValue());if(null===i)return d(t,r,n);let o=0;const l=e.properties().childs(),c=e.model().timeScale(),u=r.priceToCoordinate(i.price,n);switch(e.style()){case 3:o=l.areaStyle.childs().linewidth.value()/2;break;case 2:o=l.lineStyle.childs().linewidth.value()/2;break;case 10:const e=Math.abs(100-l.baselineStyle.childs().baseLevelPercentage.value());o=r.height()*e/100>u?l.baselineStyle.childs().topLineWidth.value()/2:l.baselineStyle.childs().bottomLineWidth.value()/2;break;case 1:case 9:case 8:case 12:o=3;break;case 0:o=l.barStyle.childs().thinBars.value()?3:Math.max(3,.25*c.barSpacing());break;case 11:o=l.rangeStyle.childs().thinBars.value()?3:Math.max(3,.25*c.barSpacing());break;case 4:case 7:o=3;break;case 5:o=Math.max(4,.25*c.barSpacing());break;case 6:o=Math.max(5,.25*c.barSpacing())}const p=a(t.position(),r.isInverted()),_=u-p*o;return{index:i.index,price:i.price,poleStartY:_,visualDirection:p,positionPointDirection:p}}},19625:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LiveStudyGraphics:()=>C,StaticStudyGraphics:()=>f,createGraphicsPaneViews:()=>D,createGraphicsPriceAxisViews:()=>B,emptyStudyGraphics:()=>b,isStudyGraphicsEmpty:()=>n,loadStudyGraphics:()=>w,saveStudyGraphics:()=>P});var s=i(65447);const r=["horizlines","vertlines","lines","hlines","textmarks","shapemarks","backgrounds","polygons","trendchannels","hhists","dwglabels","dwglines","dwgboxes","dwgtables","dwgtablecells","dwglinefills"];function n(e){return!r.some(t=>e[t]().size>0)}function o(e){const t=new Map;return e.forEach((e,i)=>{e.forEach(e=>{const s={...e,styleId:i},r=e.firstBarTime;let n=t.get(r);void 0===n&&(n=new Set,t.set(r,n)),n.add(s)})}),t}var a=i(67620),l=i(16282),c=i(66096);function h(e,t){if(e.startIndex>=t.length||e.endIndex>=t.length)return null;const i=t[e.startIndex],s=t[e.endIndex];return i===a.INVALID_TIME_POINT_INDEX||s===a.INVALID_TIME_POINT_INDEX?null:((0,l.assert)(i<=s,"startIndex should not exceed endIndex"),{startIndex:i,endIndex:s,level:e.level,extendLeft:e.extendLeft,extendRight:e.extendRight})}function d(e,t,i){const s=(0,c.ensureTimePointIndexIndex)(i.indexOf(e.startIndex)),r=(0,c.ensureTimePointIndexIndex)(i.indexOf(e.endIndex));return{id:t,...e,startIndex:s,endIndex:r}}function u(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===a.INVALID_TIME_POINT_INDEX?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function p(e,t,i){const s=(0,c.ensureTimePointIndexIndex)(i.indexOf(e.index));return{id:t,...e,index:s}}var _=i(31505);function m(e,t){for(const i of e.points){if(i.index>=t.length)return null;if(t[i.index]===a.INVALID_TIME_POINT_INDEX)return null}return{points:e.points.map(e=>({index:t[e.index],offset:e.offset,level:e.level}))}}function g(e,t,i){return{id:t,points:e.points.map(e=>({...e,index:(0, c.ensureTimePointIndexIndex)(i.indexOf(e.index))}))}}class f{constructor(e,t){if(this._indexes=[],this._horizlines=new Map,this._vertlines=new Map,this._lines=new Map,this._hlines=new Map,this._textmarks=new Map,this._shapemarks=new Map,this._backgrounds=new Map,this._polygons=new Map,this._trendchannels=new Map,this._hhists=new Map,this._dwglabels=new Map,this._dwglines=new Map,this._dwgboxes=new Map,this._dwgtables=new Map,this._dwgtablecells=new Map,this._dwglinefills=new Map,"data"===e){const e=t;this._indexes=e.indexes,this._vertlines=v(e.vertlines,this._indexes,u),this._horizlines=v(e.horizlines,this._indexes,h),this._polygons=v(e.polygons,this._indexes,m),this._hhists=v(e.hhists,this._indexes,_.materializeHHist)}else if("state"===e){const e=t;this._indexes=e.indexes||[],this._vertlines=S(e.vertlines,this._indexes,u),this._horizlines=S(e.horizlines,this._indexes,h),this._polygons=S(e.polygons,this._indexes,m),this._hhists=S(e.hhists,this._indexes,_.materializeHHist)}this._hhistsByTimePointIndex=o(this._hhists)}horizlines(){return this._horizlines}vertlines(){return this._vertlines}lines(){return this._lines}hlines(){return this._hlines}textmarks(){return this._textmarks}shapemarks(){return this._shapemarks}backgrounds(){return this._backgrounds}polygons(){return this._polygons}trendchannels(){return this._trendchannels}hhists(){return this._hhists}dwglabels(){return this._dwglabels}dwglines(){return this._dwglines}dwgboxes(){return this._dwgboxes}dwgtables(){return this._dwgtables}dwgtablecells(){return this._dwgtablecells}dwglinefills(){return this._dwglinefills}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}}function v(e,t,i){const s=new Map;return e.forEach((e,r)=>{const n=s.get(r)||new Set;e.forEach(e=>{const s=i(e,t);null!==s&&n.add(s)}),s.set(r,n)}),s}function S(e,t,i){const s=new Map;if(void 0===e)return s;for(const r of e){const e=r.styleId,n=s.get(e)||new Set;r.data.forEach(e=>{const s=i(e,t);null!==s&&n.add(s)}),s.set(e,n)}return s}function y(e,t,i,s){const r=[];return e.forEach((e,n)=>{e.forEach(e=>{!function(e,t,i){let s=null;for(const i of e)i.styleId===t&&(s=i);null===s&&(s={styleId:t,data:[]},e.push(s)),s.data.push(i)}(r,n,s(e,t(e),i))})}),r.length>0?r:void 0}function b(){return new f}function w(e){return new f("state",e)}function P(e){const t=function(e){const t=new Set;e.horizlines().forEach((e,i)=>{e.forEach(e=>{t.add(e.startIndex),t.add(e.endIndex)})}),e.vertlines().forEach((e,i)=>{e.forEach(e=>{t.add(e.index)})}),e.lines().forEach((e,i)=>{e.forEach(e=>{t.add(e.startIndex),t.add(e.endIndex)})}),e.textmarks().forEach((e,i)=>{e.forEach(e=>{t.add(e.time)})}),e.shapemarks().forEach((e,i)=>{e.forEach(e=>{t.add(e.time)})}),e.backgrounds().forEach((e,i)=>{e.forEach(e=>{t.add(null!==e.start?e.start:a.INVALID_TIME_POINT_INDEX),t.add(e.stop)})}),e.polygons().forEach((e,i)=>{e.forEach(e=>{e.points.forEach(e=>{t.add(e.index)})})}),e.trendchannels().forEach((e,i)=>{e.forEach(e=>{t.add(e.startIndex),t.add(e.endIndex)})}),e.hhists().forEach((e,i)=>{e.forEach(e=>{t.add(e.firstBarTime), t.add(e.lastBarTime)})}),e.dwglabels().forEach((e,i)=>{e.forEach(e=>{t.add(e.x)})}),e.dwglines().forEach((e,i)=>{e.forEach(e=>{var i,s;t.add(null!==(i=e.x1)&&void 0!==i?i:a.INVALID_TIME_POINT_INDEX),t.add(null!==(s=e.x2)&&void 0!==s?s:a.INVALID_TIME_POINT_INDEX)})}),e.dwgboxes().forEach((e,i)=>{e.forEach(e=>{var i,s;t.add(null!==(i=e.left)&&void 0!==i?i:a.INVALID_TIME_POINT_INDEX),t.add(null!==(s=e.right)&&void 0!==s?s:a.INVALID_TIME_POINT_INDEX)})});const i=Array.from(t);return i.sort((e,t)=>e-t),i}(e),i={indexes:t};let s=0;const r=()=>++s;return i.vertlines=y(e.vertlines(),r,t,p),i.horizlines=y(e.horizlines(),r,t,d),i.polygons=y(e.polygons(),r,t,g),i.hhists=y(e.hhists(),r,t,_.dematerializeHHist),i}class C{constructor(){this._indexes=[],this._horizlines=new Map,this._vertlines=new Map,this._lines=new Map,this._hlines=new Map,this._textmarks=new Map,this._shapemarks=new Map,this._backgrounds=new Map,this._polygons=new Map,this._trendchannels=new Map,this._hhists=new Map,this._dwglabels=new Map,this._dwgboxes=new Map,this._dwglines=new Map,this._dwgtables=new Map,this._dwgtablecells=new Map,this._dwglinefills=new Map,this._hhistsByTimePointIndex=new Map}horizlines(){return this._horizlines}vertlines(){return this._vertlines}lines(){return this._lines}hlines(){return this._hlines}textmarks(){return this._textmarks}shapemarks(){return this._shapemarks}backgrounds(){return this._backgrounds}polygons(){return this._polygons}trendchannels(){return this._trendchannels}hhists(){return this._hhists}dwglabels(){return this._dwglabels}dwglines(){return this._dwglines}dwgboxes(){return this._dwgboxes}dwgtables(){return this._dwgtables}dwgtablecells(){return this._dwgtablecells}dwglinefills(){return this._dwglinefills}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}clear(){this._indexes=[],this._clearPrimitives()}extract(){const e=e=>e.extract(),t={indexes:this._indexes,horizlines:x(this._horizlines,e),vertlines:x(this._vertlines,e),lines:x(this._lines,e),hlines:x(this._hlines,e),textmarks:x(this._textmarks,e),shapemarks:x(this._shapemarks,e),backgrounds:x(this._backgrounds,e),polygons:x(this._polygons,e),trendchannels:x(this._trendchannels,e),hhists:x(this._hhists,e),dwglabels:x(this._dwglabels,e),dwglines:x(this._dwglines,e),dwgboxes:x(this._dwgboxes,e),dwgtables:x(this._dwgtables,e),dwgtablecells:x(this._dwgtablecells,e),dwglinefills:x(this._dwglinefills,e)};return this._hhistsByTimePointIndex=new Map,new f("data",t)}replaceIndexesTo(e){this._indexes=e;const t=e=>e.replaceIndexesTo(this._indexes);this._horizlines.forEach(t),this._vertlines.forEach(t),this._lines.forEach(t),this._hlines.forEach(t),this._textmarks.forEach(t),this._shapemarks.forEach(t),this._backgrounds.forEach(t),this._polygons.forEach(t),this._trendchannels.forEach(t),this._hhists.forEach(t),this._dwglabels.forEach(t),this._dwgboxes.forEach(t),this._dwglines.forEach(t),this._dwgtables.forEach(t),this._dwgtablecells.forEach(t),this._dwglinefills.forEach(t),this._hhistsByTimePointIndex=o(this._hhists)}processCommands(e,t){ void 0!==e.erase&&this._processEraseCommands(e.erase),void 0!==e.create&&this._processCreateCommands(e.create,t)}_processCreateCommands(e,t){for(const i in e){if(!e.hasOwnProperty(i))continue;const s=i;switch((0,l.assert)(s in t,`There is a '${s}' in study response, but it doesn't present in graphics info!`),s){case"hhists":I(this._hhists,e[s],t[s],this._indexes,_.materializeHHist);break;case"horizlines":I(this._horizlines,e[s],t[s],this._indexes,h);break;case"vertlines":I(this._vertlines,e[s],t[s],this._indexes,u);break;case"polygons":I(this._polygons,e[s],t[s],this._indexes,m)}}this._hhistsByTimePointIndex=o(this._hhists)}_processEraseCommands(e){for(const t of e)if("all"===t.action)this._clearPrimitives();else{const e=e=>e.deleteById(t.id);switch(t.type){case"horizlines":this._horizlines.forEach(e);break;case"vertlines":this._vertlines.forEach(e);break;case"lines":this._lines.forEach(e);break;case"hlines":this._hlines.forEach(e);break;case"textmarks":this._textmarks.forEach(e);break;case"shapemarks":this._shapemarks.forEach(e);break;case"backgrounds":this._backgrounds.forEach(e);break;case"polygons":this._polygons.forEach(e);break;case"trendchannels":this._trendchannels.forEach(e);break;case"hhists":this._hhists.forEach(e);break;case"dwglabels":this._dwglabels.forEach(e);break;case"dwglines":this._dwglines.forEach(e);break;case"dwgboxes":this._dwgboxes.forEach(e);break;case"dwgtables":this._dwgtables.forEach(e);break;case"dwgtablecells":this._dwgtablecells.forEach(e);break;case"dwglinefills":this._dwglinefills.forEach(e)}}this._hhistsByTimePointIndex=o(this._hhists)}_clearPrimitives(){this._horizlines.clear(),this._vertlines.clear(),this._lines.clear(),this._hlines.clear(),this._textmarks.clear(),this._shapemarks.clear(),this._backgrounds.clear(),this._polygons.clear(),this._trendchannels.clear(),this._hhists.clear(),this._dwglabels.clear(),this._dwgboxes.clear(),this._dwglines.clear(),this._dwgtables.clear(),this._dwgtablecells.clear(),this._dwglinefills.clear(),this._hhistsByTimePointIndex=new Map}}class T{constructor(e,t){this._primitivesDataById=new Map,this._primitiveById=new Map,this._materializePrimitive=e,this._indexes=t}forEach(e,t){this._primitiveById.forEach(i=>{e.call(t,i,i,this)})}has(e){let t=!1;return this._primitiveById.forEach(i=>{t=t||i===e}),t}get size(){return this._primitiveById.size}[Symbol.iterator](){throw new Error("Not implemented")}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){throw new Error("Not implemented")}hasId(e){return this._primitiveById.has(e)}addData(e){this._primitivesDataById.set(e.id,e),this._tryMaterialize(e)}deleteById(e){this._primitiveById.delete(e),this._primitivesDataById.delete(e)}clear(){this._primitivesDataById.clear(),this._primitiveById.clear()}replaceIndexesTo(e){this._indexes=e,this._primitiveById.clear(),this._primitivesDataById.forEach(this._tryMaterialize,this)}extract(){const e=new Set(this._primitivesDataById.values());return this._primitivesDataById=new Map,this._primitiveById.clear(),e}_tryMaterialize(e){ const t=this._materializePrimitive(e,this._indexes);null!==t&&((0,l.assert)(!this._primitiveById.has(e.id),"primitive with specified id should not exist"),this._primitiveById.set(e.id,t))}}function x(e,t){const i=new Map;return e.forEach((e,s)=>i.set(s,t(e))),i}function I(e,t,i,s,r){if(void 0!==t)for(const n of t){const t=n.styleId;void 0!==i&&(0,l.assert)(t in i,"Every style used by graphics primitive should be declared in study metainfo");let o=e.get(t);void 0===o&&(o=new T(r,s),e.set(t,o)),n.data.forEach(o.addData.bind(o))}}var M=i(95426);class L extends M.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.priceScale(),r=this._source.properties().visible.value();if(!s||s.isEmpty()||!r)return;const n=this._source.properties().graphics[this._data.lineType][this._data.styleId];if(!(n.visible&&n.visible.value()&&n.showPrice&&n.showPrice.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const o=this._source.firstValue();if(null===o)return;const a=this._data.line.level,l=n.color.value();i.background=l,i.textColor=this.generateTextColor(l),i.coordinate=s.priceToCoordinate(a,o),e.text=s.formatPrice(a,o,!0),e.visible=!0}_isLabelVisibleAccordinglyToProperties(){return!!this._source.model().properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().showLabelsOnPriceScale.value()}}const A=(0,s.getLogger)("Chart.StudyGraphics"),k=new Set(["dwgtablecells"]);async function E(e,t,s,r){switch(e){case"hhists":return new((await i.e(507).then(i.bind(i,67046))).HHistPaneView)(t,s,r);case"horizlines":return new((await i.e(507).then(i.bind(i,95630))).HorizLinePaneView)(t,s,r);case"vertlines":return new((await i.e(507).then(i.bind(i,61469))).VertLinePaneView)(t,s,r);case"polygons":return new((await i.e(507).then(i.bind(i,87030))).PolygonPaneView)(t,s,r)}return null}async function D(e,t,i){const s=[],r=Object.keys(e.graphicsInfo());r.sort((e,t)=>V(e)-V(t));for(const n of r){const r=await E(n,e,t,i);null!==r?s.push(r):k.has(n)||A.logWarn(n+" is not supported by this build of graphics subsystem, skipping")}return s}function V(e){switch(e){case"polygons":return-100;case"trendchannels":return-90;default:return 0}}function B(e){const t=Object.keys(e.graphicsInfo()),i=[];for(const s of t)switch(s){case"hlines":e.graphics().hlines().forEach((t,r)=>{t.forEach(t=>{void 0!==t.level&&i.push(new L(e,{line:{level:t.level},styleId:r,lineType:s}))})});break;case"horizlines":e.graphics().horizlines().forEach((t,r)=>{t.forEach(t=>{void 0!==t.level&&i.push(new L(e,{line:{level:t.level},styleId:r,lineType:s}))})})}return i}},31505:(e,t,i)=>{"use strict";i.d(t,{HHistDirection:()=>s,HHistLocation:()=>r,materializeHHist:()=>l,dematerializeHHist:()=>c});var s,r,n=i(16282),o=i(67620),a=i(66096);function l(e,t){if(e.firstBarTime>=t.length||e.lastBarTime>=t.length)return null;const i=t[e.firstBarTime],s=t[e.lastBarTime];return i===o.INVALID_TIME_POINT_INDEX||s===o.INVALID_TIME_POINT_INDEX?null:((0, n.assert)(i<=s,"firstBarTime should not exceed lastBarTime"),(0,n.assert)(e.priceLow<=e.priceHigh,"priceLow should not exceed priceHigh"),{firstBarTime:i,lastBarTime:s,rate:e.rate,priceHigh:e.priceHigh,priceLow:e.priceLow})}function c(e,t,i){const s=(0,a.ensureTimePointIndexIndex)(i.indexOf(e.firstBarTime)),r=(0,a.ensureTimePointIndexIndex)(i.indexOf(e.lastBarTime));return{id:t,...e,firstBarTime:s,lastBarTime:r}}!function(e){e.LeftToRight="left_to_right",e.RightToLeft="right_to_left"}(s||(s={})),function(e){e.Relative="relative",e.Absolute="absolute"}(r||(r={}))},64417:(e,t,i)=>{"use strict";var s,r,n,o;i.d(t,{MarkLocation:()=>s,HAlign:()=>r,LineStyle:()=>o}),function(e){e.AboveBar="AboveBar",e.BelowBar="BelowBar",e.Top="Top",e.Bottom="Bottom",e.Right="Right",e.Left="Left",e.Absolute="Absolute",e.AbsoluteUp="AbsoluteUp",e.AbsoluteDown="AbsoluteDown"}(s||(s={})),function(e){e.Left="left",e.Center="center",e.Right="right"}(r||(r={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(n||(n={})),function(e){e[e.Solid=0]="Solid",e[e.Dotted=1]="Dotted",e[e.Dashed=2]="Dashed"}(o||(o={}))},1049:(e,t,i)=>{"use strict";i.d(t,{makeNextSymbolId:()=>r,makeNextStudyId:()=>o});let s=0;function r(){return s++,"ss_"+s}let n=0;function o(){return n++,"st"+n}},6345:(e,t,i)=>{"use strict";i.d(t,{migrateMetaInfoAndPropState:()=>l});var s=i(16282),r=i(85062),n=i.n(r),o=i(47903);const a=[new class{targetMetaInfoVersion(){return 47}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=47,!t.defaults||void 0===t.defaults.precision)return void(i.format={type:"inherit"});const s=t.defaults&&t.defaults.precision,r=(0,o.isNumber)(s)?s:parseInt(s);0===r?i.format={type:"volume"}:isFinite(r)?i.format={type:"price",precision:r}:i.format={type:"inherit"},delete t.defaults.precision}migratePropState(e){}},new class{targetMetaInfoVersion(){return 50}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=50,void 0===t.defaults||void 0===t.defaults.ohlcPlots||void 0===t.ohlcPlots)return;const r=t.ohlcPlots,n=t.defaults.ohlcPlots,o=(0,s.ensureDefined)((0,s.ensureDefined)(i.defaults).ohlcPlots);for(const e of Object.keys(n)){const t=n[e];if("ohlc_candles"===t.plottype){let i=!1;const s=r[e];void 0!==s&&(i=!!s.drawBorder,delete s.drawBorder),o[e]={borderColor:"#000000",drawBorder:i,...t}}}}migratePropState(e){}}];function l(e,t){const i=n().versionOf(e),r=e;void 0===r._serverMetaInfoVersion&&(r._serverMetaInfoVersion=i),a.forEach(r=>{i<0||i>=r.targetMetaInfoVersion()||(r.migrateMetaInfo(e),void 0!==t&&r.migratePropState(t),(0,s.assert)(e._metainfoVersion===r.targetMetaInfoVersion()))})}a.sort((function(e,t){return e.targetMetaInfoVersion()-t.targetMetaInfoVersion()}))},58891:(e,t,i)=>{"use strict";i.d(t,{NonSeriesStudy:()=>n});var s=i(16282),r=i(39951);class n extends r.Study{clearData(){this._customData=null,this._indexes=null}restoreData(e,t,i){r.Study.prototype.restoreData.call(this,e),this._customData=t,this._indexes=i}state(e){const t=super.state(e);return e&&(t.nonSeriesData=this._customData,t.indexes=this._indexes),t}customData(){ return this._customData}_setPaneViews(e){this._paneViews=e,this.model().lightUpdate()}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace?((0,s.assert)("nochange"!==i),this._indexes=i):(this._customData=t.data,"nochange"!==i&&(this._indexes=i))),super._onDataUpdated(e,t,i)}}},83853:(e,t,i)=>{"use strict";i.d(t,{OverlayDataWindowView:()=>h});var s=i(75496),r=i(62043),n=i(43367),o=i(33033),a=i(15521),l=i(6713);const c=n.CheckMobile.any();class h extends r.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map(e=>new r.DataWindowItem(e.title,"")),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){this._header=this._study.title();let e;this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,s.isNumber)(e)||(e=this._study.data().lastIndex()));const t=this._valueProvider.getValues(e);for(let e=0;e{"use strict";i.d(t,{OverlayLegendValuesProvider:()=>w});var s=i(25436),r=i(75496),n=i(79881),o=i(43367),a=i(50968),l=i(76553),c=i(62159),h=i(83111),d=i(61627),u=i(67945),p=i(15521),_=i(28834),m=i(36559),g=i(7518);const f=o.CheckMobile.any(),v=f&&!0,S=new c.PercentageFormatter,y=(0,n.t)("n/a"),b=`${y} (${y}%)`;class w extends class{constructor(e,t){this._study=e,this._model=t,this._emptyValues=[{title:(0,n.t)("Open"),visible:!1,value:"",index:0,id:""},{title:(0,n.t)("High"),visible:!1,value:"",index:1,id:""},{title:(0,n.t)("Low"),visible:!1,value:"",index:2,id:""},{title:(0,n.t)("Close"),visible:!1,value:"",index:3,id:""},{title:"",visible:!1,value:"",index:4,id:""},{title:"",visible:!1,value:"",index:5,id:""},{title:(0,n.t)("Change"),visible:!1,value:"",index:6,id:""}]}getItems(){return this._emptyValues}getValues(e){const t=this._emptyValues.map(e=>({...e}));if(this._model.timeScale().isEmpty())return t;if(0===this._study.data().size())return t;const i=this._showLastPriceAndChangeOnly();if((0,r.isNumber)(e)||(i?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,r.isNumber)(e)||(e=this._study.data().lastIndex()))),null===e||!(0,r.isNumber)(e))return t;const s=this._study.data().search(e,d.PlotRowSearchMode.NearestLeft,1),n=this._model.backgroundTopColor().value();if(null===s)return t;const o=s.index,c=s.value,u=c[1],p=c[2],_=c[3],f=c[4];t[0].value=y,t[1].value=y,t[2].value=y,t[3].value=y,t[6].value=b;for(const e of t)e.visible=!i;const w=t[4];w.visible=!1;const{values:P}=this._changesData(f,u,o,i),C=(0, g.getPriceValueFormatterForSource)(this._study);if((0,g.shouldBeFormattedAsPercent)(this._study))t[6].value="";else if(void 0!==P){const e=this._study.formatter();t[6].value=(0,l.forceLTRStr)(`${e.format(P.change,!0)} (${S.format(P.percentChange,!0)})`)}i?(t[5].value=null==f?y:C(f),t[5].visible=!0,t[6].visible=!0):(t[0].value=null==u?y:C(u),t[1].value=null==p?y:C(p),t[2].value=null==_?y:C(_),t[3].value=null==f?y:C(f),w.value=C(this._study.barFunction()(c)),t[5].visible=!1);let T=null;if(i&&!v)T=void 0===P||P.change>=0?m.SeriesBarColorer.upColor(this._study.properties()):m.SeriesBarColorer.downColor(this._study.properties());else{const e=this._study.barColorer().barStyle(o,!1),t=null!=e.barBorderColor?e.barBorderColor:e.barColor;T=(0,h.calculateColor)(n,t)}T=(0,a.resetTransparency)((0,h.calculateColor)(n,T));for(const e of t)e.color=T;return t}_showLastPriceAndChangeOnly(){return f&&(null===this._model.crossHairSource().pane||(0,u.isLineToolName)(p.tool.value())||null!==this._model.lineBeingEdited())}_changesData(e,t,i,s){var r;if(s&&!v){const e=this._study.quotes();if(null!==e)return{values:{change:e.change,percentChange:e.change_percent},priceDirection:{basedOnCurrentBar:e.change>=0?0:1,basedOnPrevClose:e.change>=0?0:1}}}else{const s=this._study.data().search(i-1,d.PlotRowSearchMode.NearestLeft,1),n=null!==(r=null==s?void 0:s.value[4])&&void 0!==r?r:null;if(null!==n&&null!=e&&null!=t)return{values:{change:e-n,percentChange:(0,_.barPercentChange)(n,e)},priceDirection:{basedOnCurrentBar:e>=t?0:1,basedOnPrevClose:e>=n?0:1}}}return null==e||null==t?{}:{priceDirection:{basedOnCurrentBar:e>=t?0:1,basedOnPrevClose:e>=t?0:1}}}}{constructor(e,t){super(e,t);const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._showBarChange=i.showBarChange,this._showSeriesOHLC=i.showSeriesOHLC,this._seriesStyle=e.properties().childs().style}getValues(e){const t=super.getValues(e);if(!this._showLastPriceAndChangeOnly()){const e=(0,s.isPriceSourceStyle)(this._seriesStyle.value()),i=this._showSeriesOHLC.value(),r=i&&!e,n=i&&e;t[0].visible=r,t[1].visible=r,t[2].visible=r,t[3].visible=r,t[6].visible=this._showBarChange.value(),t[4].visible=n}return t}}},41268:(e,t,i)=>{"use strict";i.d(t,{OverlayLegendView:()=>o});i(79881);var s=i(83853),r=i(38318),n=i(69881);class o extends s.OverlayDataWindowView{constructor(e,t){super(e,t),this._additional=null,this._studyOverlay=e,this._backgroundColorSpawn=t.backgroundTopColor().spawn(),this._backgroundColorSpawn.subscribe(this.update.bind(this));const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._visibilityProperty=(0,n.combineProperty)((e,t)=>e||t,i.showBarChange,i.showSeriesOHLC),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new r.OverlayLegendValuesProvider(e,t)}}},85630:(e,t,i)=>{ "use strict";i.d(t,{OverlayStudyPriceLineAxisView:()=>r});var s=i(46556);class r extends s.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}},72494:(e,t,i)=>{"use strict";i.d(t,{OverlayStatusProvider:()=>r});var s=i(39425);class r extends s.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(!0,void 0,!1,!1)}}},22096:(e,t,i)=>{"use strict";i.d(t,{PivotPointsStandardLastPricesView:()=>o});var s=i(61627);const r=["p","s1","r1","s2","r2","s3","r3","s4","r4","s5","r5"],n={P:"P",S1:"S1/R1",S2:"S2/R2",S3:"S3/R3",S4:"S4/R4",S5:"S5/R5",R1:"S1/R1",R2:"S2/R2",R3:"S3/R3",R4:"S4/R4",R5:"S5/R5"};class o{constructor(e){this._visiblePivots=new Set,this._invidated=!0,this._prices=[],this._source=e}visiblePivots(){return this._visiblePivots}update(){this._invidated=!0}prices(){return this._invidated&&(this._updateImpl(),this._invidated=!1),this._prices}_updateImpl(){this._visiblePivots.clear();const e=this._source.model(),t=this._source.priceScale();if(null===t)return;if(e.timeScale().isEmpty()||t.isEmpty())return;const i=e.timeScale().visibleBarsStrictRange();if(null===i)return;if(!this._source.customData()||!this._source.customData().pivots)return;const o=e.mainSeries().bars().search(i.lastBar(),s.PlotRowSearchMode.NearestLeft);if(null===o)return;const a=o.index,l=this._source.customData().pivots,c=this._source.indexes(),h=this._source.properties(),d=this._source.firstValue();for(let e=0;e=a||o)){this._visiblePivots.add(l[e]),this._prices=[];for(let i=0;i{"use strict";i.d(t,{PaneRendererStandardPivotLabel:()=>r});var s=i(10288);class r{constructor(e,t,i){this._drawRects=[],this._cacheProvider=e,this._point=t,this._label=i}draw(e,t){const i=this._cacheProvider(t);e.save(),e.setTransform(1,0,0,1,0,0);const s=t.pixelRatio;this._drawRects=[];const r=t=>{const r=i.labelRectByIndex(t),n={left:Math.round(this._point.x-r.width+o),top:Math.round(this._point.y-r.height/2),width:r.width,height:r.height};return e.drawImage(i.canvas(),Math.round(r.left*s),Math.round(r.top*s),r.width*s,r.height*s,Math.round(n.left*s),Math.round(n.top*s),n.width*s,n.height*s),this._drawRects.push(n),r.width},n=this._label.split("/") ;let o=0;for(let e=0;e0&&(o+=r(t+11)/2),o+=r(t)/2}e.restore()}hitTest(e){for(const t of this._drawRects)if(e.x>=t.left&&e.x<=t.left+t.width&&e.y>=t.top&&e.y<=t.top+t.height)return new s.HitTestResult(s.HitTestResult.REGULAR);return null}}},7313:(e,t,i)=>{"use strict";i.d(t,{StandardPivotPointsImageCache:()=>n});var s=i(16932),r=i(16282);class n{constructor(e,t,i,r){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._paneRenderParams=e,this._recreateCanvasAndContext(new s.Size(0,0)),this.reset({font:t,fontSize:i,backColors:r})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce((e,t)=>{const i=this._cache.measureText(t).width;return Math.max(i,e)},0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)),width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const i=(e,t)=>{const i=void 0===e,s=void 0===t;return(!i&&!s||i===s)&&(0,r.ensureDefined)(e).formatted===(0,r.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let s=0;s{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,this._cache.textBaseline="middle";for(let e=0;e{"use strict";i.d(t,{StandardPivotPointsPriceAxisView:()=>n});var s=i(95426);const r=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"];class n extends s.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t;const i=t.name;this._completeName="P"===i.toUpperCase()?"P":`S${i[1]}/R${i[1]}`}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.properties();if(!s.visible.value())return;const n=this._completeName,o=s.levelsStyle.visibility ;if(!o[n]||!o[n].value())return;const a=this._source.model().timeScale(),l=this._source.priceScale();if(a.isEmpty()||null===a.visibleBarsStrictRange()||null!==l&&l.isEmpty())return;const c=this._source.customData();if(!c||!c.pivots)return;const h=this._source.pricesView().prices()[r.indexOf(this._data.name.toUpperCase())];if(!h)return;i.background=h.color,i.textColor=this.generateTextColor(h.color),i.coordinate=h.coordinate,i.floatCoordinate=h.floatCoordinate;const d=this._source.model().properties().childs().scalesProperties.childs();d.showStudyLastValue.value()&&(e.text=h.formatted,e.visible=!0),d.showStudyPlotLabels.value()&&(t.text=this._source.priceLabelText(this._data.name),t.visible=!0)}}},77904:(e,t,i)=>{"use strict";var s=i(25303).PriceRange,r=i(72927).Point,n=i(53289).StudyStatusView,o=i(74393).StudyDataWindowView,a=i(58891).NonSeriesStudy,l=i(66238).StandardPivotPointsPriceAxisView,c=i(13114).PanePriceAxisView,h=i(10288).HitTestResult,d=i(87088).CompositeRenderer,u=i(8356).areEqualPaneRenderParams,p=i(7313).StandardPivotPointsImageCache,_=i(22096).PivotPointsStandardLastPricesView,m=i(82157).PaneRendererStandardPivotLabel,g=i(29982).HorizontalLineRenderer,f=i(54837);class v{constructor(e,t){this._model=e,this._source=t,this._pivots=[],this._textCache={}}setCache(e){this._cache=e}priceAxisViews(e,t){return this._priceAxisViews}mergeLabel(e,t,i){var s=""+t;void 0===e[s]?(e[s]={},e[s].text=i,e[s].ids=[this.complete(i)]):(e[s].text+="/"+i,e[s].ids.push(this.complete(i)))}complete(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]}update(){this._invalidated=!0}_updateImpl(){if(this._source.pricesView().prices(),this._pivots=[],this._source.customData()&&this._source.customData().pivots&&this._source.properties().visible.value()){var e=this._source.customData().pivots,t=this._source._indexes,i=this._model.timeScale(),s=this._source.priceScale();if(s&&!s.isEmpty()&&!i.isEmpty()&&e){var r=i.visibleBarsStrictRange(),n=r.firstBar(),o=r.lastBar();if(this._source.ownerSource())for(var a=this._source.ownerSource().firstValue(),l=0;lo)){var d={},u=this._source.properties().levelsStyle.visibility;u.P.value()&&this.mergeLabel(d,e[l].p,"P"),u["S1/R1"].value()&&(this.mergeLabel(d,e[l].s1,"S1"),this.mergeLabel(d,e[l].r1,"R1")),u["S2/R2"].value()&&(this.mergeLabel(d,e[l].s2,"S2"),this.mergeLabel(d,e[l].r2,"R2")),u["S3/R3"].value()&&(this.mergeLabel(d,e[l].s3,"S3"),this.mergeLabel(d,e[l].r3,"R3")),u["S4/R4"].value()&&(this.mergeLabel(d,e[l].s4,"S4"),this.mergeLabel(d,e[l].r4,"R4")),u["S5/R5"].value()&&(this.mergeLabel(d,e[l].s5,"S5"),this.mergeLabel(d,e[l].r5,"R5"));var p=i.indexToCoordinate(c),_=i.indexToCoordinate(h);for(var m in d){var g=parseFloat(m),f=s.priceToCoordinate(g,a);this._pivots.push({x1:p,x2:_,y:f,label:d[m].text,labelIds:d[m].ids,src:e[l]})}}}}}}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1) ;for(var e=new d,t=this._source.properties().levelsStyle.colors,i=this._source.properties().levelsStyle.widths,s=this._source.visiblePivots(),n=0;nt)){var l=[],c=this._properties.levelsStyle.visibility;c.P.value()&&l.push(i[o].p),c["S1/R1"].value()&&l.push(i[o].s1,i[o].r1),c["S2/R2"].value()&&l.push(i[o].s2,i[o].r2),c["S3/R3"].value()&&l.push(i[o].s3,i[o].r3),c["S4/R4"].value()&&l.push(i[o].s4,i[o].r4),c["S5/R5"].value()&&l.push(i[o].s5,i[o].r5);for(var h=0;h{"use strict";function s(e){e.lineWidth=void 0,e.lineStyle=void 0;for(let t=0;ts,createEmptyStyle:()=>r})},4600:(e,t,i)=>{"use strict";i.d(t,{StudyPlotPaneView:()=>E});var s=i(16282),r=i(72927),n=i(14563),o=i(27490),a=i(57968),l=i(47903),c=i(50968),h=i(85545);function d(e,t){const i=new Map;return function(...s){const r=""+(t?t.apply(null,s):s[0]);if(!i.has(r)){const t=e.apply(this,s);return i.set(r,t),t}return i.get(r)}}var u=i(10288),p=i(9537),_=i(87088),m=i(59109),g=i(73175),f=i(61627),v=i(98742),S=i(73301),y=i(37326),b=i(21344),w=i(43367);class P{constructor(e){this._data=e}draw(e,t){const i=this._data,s=t.pixelRatio,r=Math.max(1,Math.floor(s))%2?.5:0,n=i.vertOffset||0,o=i.lineColor||i.color,a=i.lineWidth||i.height/2;let c="",h=!1;for(const t of i.items){const i=t.x,d=t.y+n;if((0,l.isNaN)(i)||(0,l.isNaN)(d))continue;let u,p;null!=t.style?(u=t.style.color,p=t.style.width):(u=o,p=a),(u!==c||w.isSafari)&&(c=u,h&&e.fill(),e.beginPath(),e.fillStyle=u);const _=Math.round(i*s)+r,m=Math.round(d*s)+r,g=Math.round(p*s)+r;e.moveTo(_+g,m),e.arc(_,m,g,0,2*Math.PI,!1),h=!0}h&&e.fill()}hitTest(e){const t=this._data,i=t.lineWidth||t.height/2,s=t.vertOffset||0,n=(0,b.interactionTolerance)().series+i;for(const o of t.items){if(!o)continue;if(new r.Point(o.x,o.y+s).subtract(e).length()+i<=n)return new u.HitTestResult(u.HitTestResult.REGULAR)}return null}}class C{constructor(e){this._data=null,this._precalculatedCache=[],this.setData(e)}setData(e){this._data=e,this._precalculatedCache=[]}draw(e,t){ if(null===this._data||0===this._data.items.length)return;const i=t.pixelRatio;this._precalculatedCache.length||this._fillPrecalculatedCache(i);const s=Math.max(1,Math.floor(i)),r=Math.round(this._data.histogramBase*i)-Math.floor(s/2),n=r+s,o=this._data.lineColor;for(let t=0;t=i&&r<=s){const i=t.y;if(e.y>=Math.min(i,this._data.histogramBase)&&e.y<=Math.max(i,this._data.histogramBase))return new u.HitTestResult(u.HitTestResult.REGULAR)}}return null}_fillPrecalculatedCache(e){if(null===this._data||0===this._data.items.length)return void(this._precalculatedCache=[]);const t=Math.ceil(this._data.barSpacing*e)<=1?0:Math.max(1,Math.floor(e)),i=Math.round(this._data.barSpacing*e)-t;this._precalculatedCache=new Array(this._data.items.length);for(let t=0;ts.center?s.right=i.left-t-1:i.left=s.right+t+1))}let s=Math.ceil(this._data.barSpacing*e);for(let e=0;e0&&s<4)for(let e=0;es&&(t.roundedCenter>t.center?t.right-=1:t.left+=1)}}}var T=i(89684);class x{constructor(e){this._data=e}draw(e,t){var i,s,r,n;const o=t.pixelRatio;let a="",c=!1;for(const t of this._data.items){if((0,l.isNaN)(t.x)||(0,l.isNaN)(t.y))continue;const h=null!==(s=null===(i=t.style)||void 0===i?void 0:i.color)&&void 0!==s?s:this._data.lineColor,d=Math.max(1,Math.floor((null!==(n=null===(r=t.style)||void 0===r?void 0:r.width)&&void 0!==n?n:this._data.lineWidth)*o));(h!==a||w.isSafari)&&(a=h,c&&e.fill(),e.beginPath(),e.fillStyle=h);let u=3*d;u%2!=d%2&&(u+=1);const p=Math.round(Math.round(t.x*o)-u/2),_=Math.round(Math.round(t.y*o)-u/2),m=p+Math.floor(u/2-d/2),g=_+Math.floor(u/2-d/2);e.rect(p,g,u,d),e.rect(m,_,d,u),c=!0}c&&e.fill()}hitTest(e){const t=(0,b.interactionTolerance)().series+this._data.lineWidth/2;let i,s,n,o;for(let a=1;a{const t=(0,n.rgbToHsl)((0,n.parseRgb)(e)),i=t[0]+.05;return t[0]=i-Math.floor(i),(0,n.rgbToHexString)((0,n.hslToRgb)(t))},k=d(A);class E{constructor(e,t,i,s){this._histogramBase=null,this._items=[],this._selectionData=null,this._lineColor="",this._lineWidth=1,this._color1="",this._color2="",this._invalidated=!1,this._renderer=new _.CompositeRenderer,this._isMarkersEnabled=o.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s,this._plotIndex=e.metaInfo().plots.findIndex(e=>e.id===s),this._colorProvider=(0,L.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new v.SelectionIndexes(i.timeScale())}items(){return this._items}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_getTranspValue(){const e=this._study.properties(),t=e.styles[this._plotName];let i=0;const s=this._study.metaInfo();return"Volume@tv-basicstudies"===s.id&&s.version<=46&&"transparency"in e?(i=e.transparency.value(),i=(0,l.isNumber)(i)?i:0,i):(t.transparency&&(i=t.transparency.value(),i=(0,l.isNumber)(i)?i:0),i)}_updateImpl(){var e,t,i,n,o;this._renderer.clear();const d=this._study.properties().styles[this._plotName];if(!d.visible.value())return;if(!this._study.priceScale())return;this._histogramBase=null,this._items=[];const _=this._study.priceScale();if(this._model.timeScale().isEmpty()||null===_||_.isEmpty())return;const v=this._model.timeScale().visibleBarsStrictRange();if(null===v)return;let b=null!==(e=this._series.nearestIndex(v.firstBar()-1,f.PlotRowSearchMode.NearestLeft))&&void 0!==e?e:this._series.bars().firstIndex(),w=null!==(t=this._series.nearestIndex(v.lastBar()+1,f.PlotRowSearchMode.NearestRight))&&void 0!==t?t:this._series.bars().lastIndex();if(null===b||null===w)return;const T=this._study.offset(this._plotName);T>0?(b-=T,w+=T):(b+=T,w-=T);const L=this._study.getMinFirstBarIndexForPlot(this._plotName);if(L>w)return;b=Math.max(L,b) ;const E=d.plottype.value(),D=[M.LineStudyPlotStyle.Line,M.LineStudyPlotStyle.Area,M.LineStudyPlotStyle.Circles,M.LineStudyPlotStyle.Cross].indexOf(E)>=0,V=this._study.data(),B=this._study.firstValue();if(null===B)return;const N=V.rangeIterator(b,w),R=this._study.priceScale();if(null===R)return;const O=(0,a.clamp)(this._getTranspValue(),0,100),F=new Map,W=(e,t)=>{let i=F.get(e);void 0===i&&(i=new Map,F.set(e,i));let s=i.get(t);if(void 0===s){const r=!this._plotName||"vol"!==this._plotName;s=(0,c.generateColor)(e,t,r),i.set(t,s)}return s};let H=NaN,z=NaN;const U=(0,y.createEmptyStyle)();for(;N.hasNext();){const e=N.next();let t=e.index;const o=e.value;t+=T,t=Math.floor(t);let a=o[this._plotIndex+1];const l=null==a;if(a=l?NaN:a,D&&l){z=a;continue}const h=new r.Point(t,(0,s.ensure)(a));h.timePointIndex=t,h.valIsNotSameAsPrev=a!==z;if(this._colorProvider.isColorDefined()&&(h.style={color:W(d.color.value(),100),width:d.linewidth.value(),style:d.linestyle.value()},null!=a)){const e=this._colorProvider.getPlotPointStyle(o,U),t=e.colors[0];void 0!==t&&(h.style.color=(0,c.isHexColor)(t)?W(t,O):t),h.style.width=null!==(i=e.lineWidth)&&void 0!==i?i:h.style.width,h.style.style=null!==(n=e.lineStyle)&&void 0!==n?n:h.style.style}D||isNaN(H)||H===t-1||this._items.push(new r.Point(t-1,NaN)),H=t,z=a,this._items.push(h)}if(R.pointsArrayToCoordinates(this._items,B),this._model.timeScale().timedValuesToCoordinates(this._items),d.histogramBase&&(this._histogramBase=R.priceToCoordinate(d.histogramBase.value(),B)),this._model.selection().isSelected(this._study)){const e=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,hittestResult:u.HitTestResult.REGULAR,barSpacing:this._model.timeScale().barSpacing()};const t=(0,s.ensureNotNull)(this._model.paneForSource(this._study)).height();for(let i=0;i{"use strict";i.d(t,{createStudyPlotColorProvider:()=>p});var s=i(77455),r=i(16282),n=i(37326);const o=new Map([[0,"color"],[2,"textColor"],[3,"borderColor"],[4,"wickColor"],[5,"colorup"],[6,"colordown"]]);class a{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return o.forEach((e,t)=>{this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())}),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}const l=[0,1,2,3,4,5,6];class c{constructor(e,t,i,s){this._palettesColors=new Map,this._defaultPlotColors=new Map,this._indexes=s;const n=t.styles[i];if(n)for(const[e,t]of o)this._defaultPlotColors.set(e,n[t]);const a=(0,r.ensureDefined)(e.palettes),l=e.plots;s.forEach((e,i)=>{const s=l[e];if(s&&"palette"in s){const e=a[s.palette],r=t.palettes[s.palette];if(e&&r){const{valToIndex:t}=e,{colors:s}=r,n={...s};t&&Object.keys(t).forEach(e=>{const i=t[e];void 0!==i&&(n[e]=s[i])}),this._palettesColors.set(i,n)}}})}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return l.forEach(t=>{var s,n;if(this._palettesColors.has(t)){const n=e[(0,r.ensureDefined)(this._indexes.get(t))+1];if("number"==typeof n){const e=null===(s=this._palettesColors.get(t))||void 0===s?void 0:s[n];0===t&&e&&(i.lineWidth=e.width.value(),i.lineStyle=e.style.value()),i.colors[t]=null==e?void 0:e.color.value()}else i.colors[t]="transparent"}else i.colors[t]=null===(n=this._defaultPlotColors.get(t))||void 0===n?void 0:n.value()}),i} getDefaultPlotPointStyle(){var e;const t=null===(e=this._palettesColors.get(0))||void 0===e?void 0:e[0];if(void 0!==t){return{colors:[t.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineStyle:void 0,lineWidth:t.width.value()}}return null}isColorDefined(){return!!this._palettesColors.size}singleColor(){return!1}}var h=i(50968);class d{constructor(e){this._indexes=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return this._indexes.forEach((t,s)=>{const r=e[t+1];if(null!=r){const e=(0,h.rgbaFromInteger)(r);i.colors[s]=e}else i.colors[s]="transparent"}),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}}const u=new Map([[0,function(e,t){const i=(0,s.isColorerPlot)(t)||(0,s.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[2,function(e,t){const i=(0,s.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[1,function(e,t){return(0,s.isBgColorerPlot)(t)&&t.id===e}],[3,function(e,t){const i=(0,s.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[4,function(e,t){const i=(0,s.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[5,function(e,t){const i=(0,s.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[6,function(e,t){const i=(0,s.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function p(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex(e=>e.id===t),r=new Map;return i.forEach((e,i)=>{u.forEach((s,n)=>{s(t,e)&&r.set(n,i)})}),{plotIndex:-1===s?null:s,colorers:r}}(e,i);if(s.size)return e.isRGB?new d(s):new c(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new a(e[i]);const s=t.styles[i];return new a(s)}}},77455:(e,t,i)=>{"use strict";var s,r;function n(e){return"line"===e.type}function o(e){return"shapes"===e.type}function a(e){return"chars"===e.type}function l(e){return"arrows"===e.type}function c(e){return"dataoffset"===e.type}function h(e){return"ohlc_open"===e.type}function d(e){return"ohlc_high"===e.type}function u(e){return"ohlc_low"===e.type}function p(e){return"ohlc_close"===e.type}function _(e){return h(e)||d(e)||u(e)||p(e)}function m(e){return"colorer"===e.type}function g(e){return"bar_colorer"===e.type}function f(e){return"bg_colorer"===e.type}function v(e){return"text_colorer"===e.type}function S(e){return"ohlc_colorer"===e.type}function y(e){return"wick_colorer"===e.type}function b(e){return"border_colorer"===e.type}function w(e){return"up_colorer"===e.type}function P(e){return"down_colorer"===e.type}function C(e){return"alertcondition"===e.type}function T(e){return"Plot"!==e}function x(e){return"ohlc_bars"===e.plottype}function I(e){return"ohlc_candles"===e.plottype}function M(e){return m(e)||g(e)||f(e)||c(e)||S(e)||C(e)||w(e)||P(e)||b(e)||y(e)||v(e)}function L(e){return m(e)||v(e)||g(e)||c(e)||S(e)||y(e)||b(e)||w(e)||P(e)||C(e)}i.r(t),i.d(t,{LineStudyPlotStyle:()=>s,isLinePlot:()=>n,isShapesPlot:()=>o,isCharsPlot:()=>a,isArrowsPlot:()=>l,isDataOffsetPlot:()=>c,isOhlcOpenPlot:()=>h,isOhlcHighPlot:()=>d,isOhlcLowPlot:()=>u, isOhlcClosePlot:()=>p,isOhlcPlot:()=>_,isColorerPlot:()=>m,isBarColorerPlot:()=>g,isBgColorerPlot:()=>f,isTextColorerPlot:()=>v,isOhlcColorerPlot:()=>S,isCandleWickColorerPlot:()=>y,isCandleBorderColorerPlot:()=>b,isUpColorerPlot:()=>w,isDownColorerPlot:()=>P,isAlertConditionPlot:()=>C,isPlotTitleDefined:()=>T,isOhlcPlotStyleBars:()=>x,isOhlcPlotStyleCandles:()=>I,PlotSymbolSize:()=>r,isPlotWithTechnicalValues:()=>M,isNonVisualPlot:()=>L}),function(e){e[e.Line=0]="Line",e[e.Histogram=1]="Histogram",e[e.Cross=3]="Cross",e[e.Area=4]="Area",e[e.Columns=5]="Columns",e[e.Circles=6]="Circles",e[e.LineWithBreaks=7]="LineWithBreaks",e[e.AreaWithBreaks=8]="AreaWithBreaks",e[e.StepLine=9]="StepLine",e[e.StepLineWithDiamonds=10]="StepLineWithDiamonds"}(s||(s={})),function(e){e.Auto="auto",e.Tiny="tiny",e.Small="small",e.Normal="normal",e.Large="large",e.Huge="huge"}(r||(r={}))},17e3:(e,t,i)=>{"use strict";i.r(t),i.d(t,{createStudy:()=>T,isESDStudy:()=>w,isFundamentalStudy:()=>b,isFundamentalStudyMetaInfo:()=>P,isStudy:()=>v,isStudyStrategy:()=>S,isStudyStub:()=>y,studyColorRotationMode:()=>x,useSameColorRotationComparator:()=>M});var s=i(85062),r=i.n(s),n=i(39951),o=i(77904),a=i(33508),l=i(32643),c=i(17404),h=i(73228);const d=i(27490).enabled("hide_main_series_symbol_from_indicator_legend");class u extends n.Study{constructor(e,t,i,s){super(e,t,i,s),this.properties().styles.vol_ma.visible.listeners().subscribe(this,()=>this.invalidateTitleCache())}base(){return 1}destroy(){this.properties().styles.vol_ma.visible.listeners().unsubscribeAll(this),super.destroy()}_titleInputs(){const e={symbolsForDisplay:!0,skipHiddenInputs:!0,fakeInputsForDisplay:!0,asObject:!1,skipOptionalEmptySymbolInputs:d};return this.properties().styles.vol_ma.visible.value()?this.inputs(e):this.inputs({...e,skippedInputs:["length"]})}}var p=i(16282),_=i(25303);class m extends n.Study{priceRange(e,t){let i=!1;this.graphics().hhists().forEach((e,t)=>{i=i||this.properties().child("graphics").child("hhists").child(t).child("showValues").value()});const s=function(e,t,i,s){let r=null;return e.forEach((e,s)=>{e.forEach(e=>{e.firstBarTime<=i&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow{"use strict";i.d(t,{StudyColorRotatorFactory:()=>h});var s=i(53312),r=i(14563),n=i(50968),o=i(17e3);const a=["color-sky-blue-400","color-banana-yellow-700","color-deep-blue-500","color-grapes-purple-a700","color-iguana-green-500","color-minty-green-a700","color-ripe-red-a200","color-berry-pink-200","color-tv-blue-a100","color-tan-orange-a200","color-sky-blue-a400","color-deep-blue-a100","color-grapes-purple-400","color-iguana-green-a700","color-minty-green-200","color-ripe-red-200","color-berry-pink-a200","color-ripe-red-500","color-grapes-purple-500","color-deep-blue-400","color-tv-blue-a200","color-sky-blue-500","color-iguana-green-400","color-minty-green-400","color-banana-yellow-600","color-tan-orange-500","color-berry-pink-400","color-ripe-red-300","color-grapes-purple-300","color-deep-blue-300","color-tv-blue-300","color-sky-blue-300","color-iguana-green-300","color-minty-green-300","color-banana-yellow-400","color-tan-orange-300","color-berry-pink-300","color-tan-orange-a700"];class l{constructor(e){this._offset=0,this._offset=e}getColor(e){if(0===this._offset)return e;const t=a[(this._offset-1)%a.length],i=s.colorsPalette[t],o=(0,n.isHexColor)(e)?1:(0,r.parseRgba)(e)[3];return(0,n.generateColor)(i,(0,n.alphaToTransparency)(o))}}class c{constructor(e,t){this._offset=e,this._modelStartOffset=t}getColor(e){if((0,n.isHexColor)(e)){const t=(0,r.parseRgb)(e);return(0,r.rgbToHexString)((0,r.shiftRgb)(t,this._offset,this._modelStartOffset))}{const t=(0,r.parseRgba)(e);return(0,r.rgbaToString)((0,r.shiftRgba)(t,this._offset,this._modelStartOffset))}}}class h{constructor(e){this._chartModel=e}getColorRotator(e){const t=(0,o.studyColorRotationMode)(e);if(null===t)return null;const i=this._calcDefaultColorsOffset(e);switch(t){case"loop":return new l(i);case"shift":{const e=this._chartModel.getStudyShiftColorStartOffset();return new c(i,e)}}}_calcDefaultColorsOffset(e){let t=0;const i=(0,o.useSameColorRotationComparator)(e);return this._chartModel.dataSources().filter(o.isStudy).forEach(s=>{i(e,s.metaInfo())&&t++}),t}}},7171:(e,t,i)=>{"use strict";i.d(t,{StudyDataSource:()=>_}) ;var s=i(16282),r=i(5729),n=i.n(r),o=i(61627),a=i(66096),l=i(1049),c=i(28676),h=i(19625);const d=(0,i(65447).getLogger)("Chart.StudyDataSource");var u,p;!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(u||(u={})),function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingParent=2]="AwaitingParent",e[e.AwaitingFirstDataUpdate=3]="AwaitingFirstDataUpdate",e[e.Active=4]="Active"}(p||(p={}));class _{constructor(e,t,i,s){this._inputs=null,this._status=p.Idle,this._studyId=null,this._turnaroundCounter=1,this._studyStatus={type:u.Undefined},this._studyStatusChanged=new(n()),this._graphics=new h.LiveStudyGraphics,this._dataCleared=new(n()),this._dataUpdated=new(n()),this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e,this._metaInfo=s,this._seriesSource=t,this._turnaroundPrefix=i,this._plots=new o.PlotList((0,c.studyPlotFunctionMap)(s),c.studyEmptyPlotValuePredicate),this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged)}destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged),this._dataUpdated.destroy(),this._dataCleared.destroy(),this._studyStatusChanged.destroy()}metaInfo(){return this._metaInfo}inputs(){return this._inputs}setInputs(e){this._inputs=e,null!==this._studyId&&(this._turnaroundCounter++,this._onStudyStatusChangedTo({type:u.Undefined}),this._gateway.modifyStudy(this._studyId,this._turnaround(),e,this._onMessage.bind(this)),this._status===p.Active&&this._changeStatusTo(p.AwaitingFirstDataUpdate))}isStarted(){return this._status!==p.Idle}isActive(){return this._status===p.Active}start(){this.isStarted()?d.logNormal("start: data source is already started, nothing to do"):((0,s.assert)(null!==this._inputs,"Inputs should be defined when starting a study data source"),this._gateway.isConnected().value()?this._createStudy():this._changeStatusTo(p.AwaitingConnection))}stop(){this.isStarted()?(null!==this._studyId&&(this._gateway.removeStudy(this._studyId),this._studyId=null,this._onStudyStatusChangedTo({type:u.Undefined})),this._changeStatusTo(p.Idle)):d.logNormal("stop: data source is already stopped, nothing to do")}studyId(){return this._studyId}studyStatus(){return this._studyStatus}studyStatusChanged(){return this._studyStatusChanged}plots(){return this._plots}graphics(){return this._graphics}clearData(){this._plots.clear(),this._graphics.clear(),this._dataCleared.fire()}stopAndStealData(){(0,s.assert)(this._status===p.Active,"Couldn't steal data from non-active data source"),this.stop();const e=this._plots,t=this._graphics.extract();return this._plots=new o.PlotList((0,c.studyPlotFunctionMap)(this._metaInfo),c.studyEmptyPlotValuePredicate),{plots:e,graphics:t}}dataCleared(){return this._dataCleared}dataUpdated(){return this._dataUpdated}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then(()=>{this._plots.move(e)})}_changeStatusTo(e){(0, s.assert)(this._status!==e,"Source and destination status should be distinct"),d.logNormal(`Status changed from ${p[this._status]} to ${p[e]}`),this._status=e}_createStudy(){const e=this._seriesSource.instanceId();null!==e?this._createStudyUsingParentId(e):(this._changeStatusTo(p.AwaitingParent),this._seriesSource.dataEvents().completed().subscribe(this,this._onSeriesCompleted,!0))}_createStudyUsingParentId(e){(0,s.assert)(this._status!==p.Active,'Status should not be "Active" when creating a study'),(0,s.assert)(this._studyStatus.type===u.Undefined,'Study status should be "Undefined" when creating a study'),(0,s.assert)(null===this._studyId,"Study id should be empty when creating a study"),this._studyId=(0,l.makeNextStudyId)(),this._gateway.createStudy(this._studyId,this._turnaround(),e,this._metaInfo.fullId+("tv-basicstudies"===this._metaInfo.packageId?"":"!"),(0,s.ensureNotNull)(this._inputs),this._onMessage.bind(this)),this._changeStatusTo(p.AwaitingFirstDataUpdate)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===p.AwaitingConnection&&this._createStudy()}_onGatewayDisconnected(){this._status!==p.Idle&&this._status!==p.AwaitingConnection&&(this._studyId=null,this._changeStatusTo(p.AwaitingConnection),this._studyStatus.type!==u.Undefined&&this._onStudyStatusChangedTo({type:u.Undefined})),this._turnaroundCounter=1}_onSeriesCompleted(){this._status===p.AwaitingParent&&this._createStudyUsingParentId((0,s.ensure)(this._seriesSource.instanceId()))}_onStudyStatusChangedTo(e){const t=this._studyStatus;this._studyStatus=e,d.logNormal(`Study status type changed from ${u[t.type]} to ${u[e.type]}`),this._studyStatusChanged.fire(t,e)}_onMessage(e){if("data_update"===e.method){const{customId:t,turnaround:i,plots:r,nonseries:n}=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onDataUpdate(r,(0,s.ensureDefined)(n))}else if("study_loading"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyLoading(s)}else if("study_completed"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyCompleted(s)}else if("study_error"===e.method){const[t,i,s,r,n]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyError(s,r,n)}else"clear_data"===e.method&&this._checkTurnaround(e.params.turnaround)&&this.clearData()}_onDataUpdate(e,t){const i=(0,a.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then(()=>i,()=>i).then(this._onDataUnpacked.bind(this,e,t.indexes)),this._ongoingDataUpdate}_onDataUnpacked(e,t,i){this._status!==p.Idle&&(this._status===p.AwaitingFirstDataUpdate&&(this._changeStatusTo(p.Active),this.clearData()),this._mergePlots(e),null!==i&&(i.indexes_replace?((0,s.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds,this._metaInfo.graphics))),this._dataUpdated.fire(e,i,t))}_onStudyLoading(e){ this._onStudyStatusChangedTo({type:u.Loading,startTime:Date.now()})}_onStudyError(e,t,i){this.clearData();const s="string"==typeof e?{error:e.split(":",2)[0]}:e;this._onStudyStatusChangedTo({type:u.Error,errorDescription:s})}_onStudyCompleted(e){this._onStudyStatusChangedTo({type:u.Completed})}_mergePlots(e){this._plots.merge(e)}_turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}_checkTurnaround(e){const t=this._turnaround();return e===t||e===this._seriesSource.turnaround()||e===`${this._seriesSource.turnaround()}_${t}`}}},74393:(e,t,i)=>{"use strict";i.d(t,{StudyDataWindowView:()=>n});var s=i(62043),r=i(98460);class n extends s.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map(e=>new s.DataWindowItem(e.title,"")),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}study(){return this._study}_updateImpl(){this._header=this._study.title(!0),this._title=this._study.title();const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t{"use strict";function s(e){const t=new Map;return e.plots.forEach((e,i)=>{t.set(e.id,e=>e[i+1])}),t}function r(e,t){return null==e[t]}i.d(t,{studyPlotFunctionMap:()=>s,studyEmptyPlotValuePredicate:()=>r})},345:(e,t,i)=>{"use strict";function s(e,t){return`${e}@${t}`}function r(e){return e.replace(/(@[^-]+-[^-]+).*$/,"$1")}i.d(t,{studyIdString:()=>s,extractStudyId:()=>r})},30875:(e,t,i)=>{"use strict";function s(e){return["text","integer","float","price","session","resolution"].includes(e.type)&&e.hasOwnProperty("options")}function r(e,t,i){for(const s of e)if(t[s.id]!==i[s.id])return!1;return!0}function n(e){return[]}i.d(t,{isStudyInputOptionsInfo:()=>s,areStudyInputsEqual:()=>r,editableStudyInputs:()=>n})},62311:(e,t,i)=>{"use strict";i.d(t,{StudyInserter:()=>a});var s,r=i(85062),n=i.n(r);!function(e){e.StudyCannotBeChild="cannot_be_child",e.StubWasRemoved="stub_was_removed",e.CannotGetMetainfo="cannot_get_metainfo",e.Cancelled="cancelled",e.Unknown="unknown"}(s||(s={}));const o=(0,i(65447).getLogger)("Chart.Studies.StudyInserter");class a{constructor(e,t,i){this._parentSource=void 0,this._propsState=void 0,this._preferredPriceScale=void 0,this._allowChangeCurrency=!1,this._allowChangeUnit=!1,this._paneSize=void 0,this._forceOverlay=!1,this._studyMetaInfoRepository=t,this._inserterImpl=i,this._studyDescriptor=e}setParentSource(e){this._parentSource=e||void 0}setPaneSize(e){this._paneSize=e}setPreferredPriceScale(e){this._preferredPriceScale=e}setAllowChangeCurrency(e){ this._allowChangeCurrency=e}setAllowChangeUnit(e){this._allowChangeUnit=e}setForceOverlay(e){this._forceOverlay=e}setPropertiesState(e){this._propsState=e}setTargetPriceScaleMode(e){this._targetPriceScaleMode=e}async insert(e,t){const i=void 0!==(r=this._inserterImpl).createStub&&void 0!==r.removeStub?this._inserterImpl.createStub():null;var r;let n,a=!0;try{n=await this._studyMetaInfoRepository.findById(this._studyDescriptor)}catch(e){return o.logWarn("Cannot get study "+JSON.stringify(this._studyDescriptor)),Promise.reject(s.CannotGetMetainfo)}finally{null!==i&&(a=this._inserterImpl.removeStub(i))}if(!a)return Promise.reject(s.StubWasRemoved);if(void 0!==t&&t.cancelled)return Promise.reject(s.Cancelled);if(!this._canApplyStudyToParent(n))return Promise.reject(s.StudyCannotBeChild);const l={...n.defaults.inputs};let c={};if(void 0!==e){const t=await e(l,n.inputs,n);c=t.inputs,void 0===this._parentSource&&t.parentSource&&(this._parentSource=t.parentSource)}if(void 0!==t&&t.cancelled)return Promise.reject(s.Cancelled);const h=this._insertStudy(n,c);return null===h?Promise.reject(s.Unknown):h}_insertStudy(e,t){return this._inserterImpl.createStudy(e,t,null,this._propsState,this._forceOverlay,this._parentSource,this._preferredPriceScale,this._allowChangeCurrency,this._allowChangeUnit,this._paneSize,this._targetPriceScaleMode)}_canApplyStudyToParent(e){return void 0===this._parentSource||n().canBeChild(e)}}},6713:(e,t,i)=>{"use strict";i.d(t,{StudyLegendValuesProvider:()=>r});var s=i(98460);class r extends s.StudyValuesProvider{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues}getValues(e){const t=super.getValues(e),i=this._study.properties(),s=this._showStudyValues.value()&&i.showLegendValues.value();for(const e of t)e.visible=e.visible&&s;return t}}},27640:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfoRepository:()=>h});var s=i(79881),r=i(16282),n=i(85062),o=i.n(n),a=i(6345),l=i(36054);const c=(0,i(65447).getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});class h{constructor(e){this._nextRequestNumber=1,this._rawStudiesMetaInfo=[],this._isReady=!1,this._metaInfoQueryQueue=[],this._javaMetaInfoQueryQueue=[],this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._gateway=e}requestMetaInfo(){this._requestStarted();const e=this._makeNextRequestId();return c.logNormal("Requesting metainfo #"+e),new Promise(t=>{c.logNormal("Requesting studies metadata #"+e),this._gateway.requestMetadata(e,i=>{c.logNormal(`Requesting studies metadata #${e} finished`);const s=i.params[1].metainfo.slice();this._processLibraryMetaInfo(s),this._requestFinished(),t()})})}findById(e){if(!this._isReady)return this._enqueueMetaInfoQuery(e);const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}findAllJavaStudies(){ return this._isReady?Promise.resolve(this._javaStudiesMetaInfo):this._enqueueJavaMetaInfoQuery()}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}getMigrations(){return this._studiesMigrations}addPineMetaInfo(e){return u(this._pineMetaInfoCache,e)}_processMigrations(e){throw new Error("not implemented")}_processSiteMetaInfo(e,t){throw new Error("not implemented")}_processLibraryMetaInfo(e){for(const t of e)d(t),u(this._javaStudiesMetaInfo,t);this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:i{this._metaInfoQueryQueue.push({studyDescriptor:e,resolver:t})})}_enqueueJavaMetaInfoQuery(){return new Promise(e=>{this._javaMetaInfoQueryQueue.push({resolver:e})})}_processPendingMetaInfoQueries(){for(;this._metaInfoQueryQueue.length;){const e=this._metaInfoQueryQueue.shift();this.findById(e.studyDescriptor).then(e.resolver)}}_processPendingFullMetaInfoQueries(){for(;this._javaMetaInfoQueryQueue.length;){this._javaMetaInfoQueryQueue.shift().resolver(this._javaStudiesMetaInfo)}}_findStudyMetaInfo(e){return"java"===e.type?this._javaStudiesMetaInfo.find(t=>t.id===e.studyId)||null:this._pineMetaInfoCache.find(t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0,r.ensureDefined)(t.pine).version===e.pineVersion))||null}_makeNextRequestId(){return"metadata_"+this._nextRequestNumber++}_compilePine(e){throw new Error("unsupported")}}function d(e){e.description_localized=(0,s.t)(e.description,{context:"study"})}function u(e,t){const i=new(o())(t);(0,a.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex(e=>e.id===i.id);if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?l.Version.parse(t.pine.version):null,o=void 0!==i.pine?l.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}},45373:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProviderBase:()=>c});var s=i(22287),r=i(73748),n=i(79881);const o={NONE:"Default"},a=(0,n.t)("No volume data"),l=new Map;class c extends s.StatusProviderBase{constructor(e,t){super(t),this._source=e}getSplitTitle(){return this._source.titleInParts(!0,o,void 0,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(!0,o,void 0,!1)}: ${this.sourceStatusText()}`:`${this._source.title(!0,o,void 0,!1)} ${this.sourceStatusText()}`:this._source.title(!0,o,void 0,!1)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}sourceStatusSolutionId(){const e=this._source.status() ;if(e.type===r.StudyStatusType.Error)return e.errorDescription.solution_id?e.errorDescription.solution_id:function(e){for(const t of Array.from(l.keys()))if(e.includes(t))return l.get(t)}(e.errorDescription.error)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;return this._source.status().type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:this.sourceStatusSolutionId(),title:this.sourceStatusTitle()}:null}sourceStatusTitle(){const e=this._source.status();if(e.type===r.StudyStatusType.Error)return-1!==e.errorDescription.error.toLowerCase().indexOf("the data vendor doesn't provide volume data for this symbol.")?a:void 0}}},39425:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProvider:()=>n});var s=i(79881),r=(i(73748),i(45373));(0,s.t)("Fundamental studies are no longer available on charts");class n extends r.StudyStatusProviderBase{constructor(e,t){super(e,t),this._study=e}color(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":super.color()}sourceStatusText(){this._study.status();return super.sourceStatusText()}}},53289:(e,t,i)=>{"use strict";i.d(t,{StudyStatusView:()=>r});var s=i(44264);class r extends s.StatusView{constructor(e){super(e.statusProvider())}color(){return this._statusProvider.color()}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},73748:(e,t,i)=>{"use strict";i.r(t),i.d(t,{StudyStatusType:()=>n,convertStudyStatusToString:()=>o});var s=i(79881);const r=(0,s.t)("loading...");var n;function o(e,t){if(e.type===n.Loading)return t?r:"loading...";if(e.type===n.Error){const i=e.errorDescription,r=t?(0,s.t)(i.error):i.error;if(i.ctx){const e={};return Object.entries(i.ctx).forEach(([t,i])=>{e[t]=i.toString()}),r.format(e)}return r}return""}!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(n||(n={}))},73228:(e,t,i)=>{"use strict";i.d(t,{StudyStub:()=>m});var s=i(53289),r=i(50044),n=i(59104),o=i(5729),a=i.n(o),l=i(674),c=i.n(l),h=i(45373);class d extends h.StudyStatusProviderBase{text(){return this._source.isActualInterval()?`${this._source.title()} ${this.sourceStatusText()}`:this._source.title()}}var u=i(73748);class p{getItems(){return[]}getValues(e){return[]}}const _=new(a());class m extends r.PriceDataSource{constructor(e,t,i){super(e),this._priceStep=.01,this._status={type:u.StudyStatusType.Undefined},this._statusChanged=new(a()),this._formatter=new n.PriceFormatter(100),this._origState=t,this._title=i;this._properties=new(c())({visible:!0}),this._statusView=new s.StudyStatusView(this)}properties(){return this._properties}statusView(){return this._statusView}legendView(){return null}state(e){return this._origState}setStatus(e){this._status=e,this._statusChanged.fire()}formatter(){return this._formatter}name(){return this._title}title(){return this._title}titleInParts(){return[this._title]}isFailed(){return this._status.type===u.StudyStatusType.Error}isLoading(){ return this._status.type===u.StudyStatusType.Loading}setFailed(e){this.setStatus({type:u.StudyStatusType.Error,errorDescription:{error:e}}),this._model.updateSource(this)}isSymbolInvalid(){return!1}isActualInterval(){return!0}onIsActualIntervalChange(){return _}start(){}status(){return this._status}onStatusChanged(){return this._statusChanged}firstValue(){return null}currency(){return null}sessionId(){return this._model.mainSeries().sessionId()}sessionIdChanged(){return this._model.mainSeries().sessionIdChanged()}unit(){return null}symbolSource(){return this._model.mainSeries()}valuesProvider(){return new p}statusProvider(e){return new d(this,this._model.properties().childs().scalesProperties.childs().textColor)}}},98460:(e,t,i)=>{"use strict";i.d(t,{StudyValuesProvider:()=>S});var s=i(75496),r=i(79881),n=i(43367),o=i(50968),a=i(27490),l=i(61627),c=i(67945),h=i(15521),d=i(77455),u=i(150),p=i(7518),_=i(16282),m=i(76559);const g=n.CheckMobile.any(),f=(0,r.t)("n/a"),v=a.enabled("hide_last_na_study_output");class S{constructor(e,t){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t;const i=e.metaInfo().plots;i&&i.forEach((t,i)=>{if((0,d.isPlotWithTechnicalValues)(t))return;const s=t.id;this._emptyValues.push({id:s,index:i,title:this._study.guiPlotName(s),value:"",visible:!1});const r=(0,d.isOhlcPlot)(t)?t.target:t.id;this._colorProviders.set(r,(0,u.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),r))})}getItems(){return this._emptyValues}getValues(e){const t=this._emptyValues.map(e=>({...e}));let i=null;const r=this._study.data().lastIndex();if(null!==r)for(const e of t){if(!this._study.properties().styles[e.id].visible.value())continue;const t=this._study.nearestIndex(r,l.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===t)continue;const s=t+this._study.offset(e.id);i=null!==i?Math.max(s,i):s}(null===e||null!==i&&e>i)&&(e=i);const n=this._hideValues(),a=this._study.isVisible()&&!n?f:"";for(const e of t)e.value=a;if(n)return t;if(v&&t.length&&(t[t.length-1].value=""),this._study.metaInfo().graphics.hhists)return this._getValuesForHHist(t,e);const c=this._study.priceScale();if(!this._study.isVisible()||null===e||null===c||c.isEmpty()||this._model.timeScale().isEmpty())return t;const h=this._study.metaInfo().plots,u=(0,p.getPriceValueFormatterForSource)(this._study),_={};for(const i of t){let t=i.id;const n=this._study.properties().styles[t].visible.value();if(i.visible=n,!n)continue;const a=i.index,c=e-this._study.offset(t),p=null!==r&&c>r?l.PlotRowSearchMode.NearestLeft:l.PlotRowSearchMode.Exact,m=this._study.nearestIndex(c,p);if(void 0===m)continue;let g=_[t];if(void 0===g&&(g=this._study.getMinFirstBarIndexForPlot(t),Number.isFinite(g)&&(_[t]=g)),g>m)continue;const f=this._study.data().last(),v=this._study.data().valueAt(m)||(null!==f?f.value:null);if(null===v)continue;const S=v[a+1];if(!(0,s.isNumber)(S))continue;const y=S>0;i.value=u(S);const b=this._study.properties().styles[t];let w=b.color.value();const P=h[a];(0,d.isOhlcPlot)(P)?(t=P.target||t, w=this._study.properties().ohlcPlots[t].color.value()):(0,d.isArrowsPlot)(P)&&(w=y?b.colorup.value():b.colordown.value());let C=w;const T=this._colorProviders.get(t),x=T&&T.getPlotPointStyle(v);x&&((0,d.isArrowsPlot)(P)?(y&&void 0!==x.colors[5]&&(C=x.colors[5]),y||void 0===x.colors[6]||(C=x.colors[6])):void 0!==x.colors[0]&&(C=x.colors[0])),"transparent"===C&&(C=w),C=(0,o.resetTransparency)(C),i.color=C}return t}_hideValues(){return g&&(null===this._model.crossHairSource().pane||(0,c.isLineToolName)(h.tool.value())||null!==this._model.lineBeingEdited())}_getValuesForHHist(e,t){e.forEach(e=>{e.visible=this._study.isVisible(),e.value=f});const i=this._study.priceScale(),r=this._model.timeScale();if(null===i||i.isEmpty()||r.isEmpty()||this._hideValues())return e;if(null===t||!isFinite(t)){const i=this._study.data().last();if(null===i)return e;t=i.index}const n=this._model.crossHairSource(),o=n.price;if(!isFinite(n.y)&&null===(t=function(e,t){var i;const s=null===(i=e.visibleBarsStrictRange())||void 0===i?void 0:i.lastBar();if(!s)return null;const r=t.data().search(s,l.PlotRowSearchMode.NearestLeft);return r?r.index:null}(this._model.timeScale(),this._model.mainSeries())))return e;const a=function(e,t,i,s){if(0===e.size)return null;if(!i){const e=(0,_.ensureNotNull)(s.data().valueAt(t));i=s.barFunction()(e)}const r=function(e,t){let i=null;return e.forEach((e,s)=>{s<=t&&(null===i||s>i)&&(i=s)}),i}(e,t);if(null===r)return null;const n=e.get(r);if(!n||0===n.size)return null;return function(e,t){let i=null;return e.forEach(e=>{e.priceLow<=t&&t{e.value="0"}),e;const c=this._study.metaInfo().graphics.hhists;if(void 0===c)return e;const h=c[a.styleId];if(void 0===h)return e;const d=this._study.properties().child("graphics").child("hhists").child(a.styleId),u=new m.VolumeFormatter;return e.forEach((e,t)=>{if(t1&&t===d.colors.childCount()){const t=a.rate.reduce((e,t)=>e+t,0);return e.value=u.format(t),void(e.color=d.valuesColor.value())}e.value=""}}),e}}},19429:(e,t,i)=>{"use strict";i.d(t,{StudyBase:()=>ut});var s=i(16282),r=i(79881),n=i(65447),o=i(43367),a=i(5729),l=i.n(a),c=i(50044),h=i(25303),d=i(61627),u=i(85062),p=i.n(u),_=i(19625),m=i(64417),g=i(74393),f=i(6713);class v extends g.StudyDataWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update),this._study.properties().showLegendValues.subscribe(this,this.update)}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this),this._study.properties().showLegendValues.unsubscribeAll(this)} _createValuesProvider(e,t){return new f.StudyLegendValuesProvider(e,t)}}var S=i(15521),y=i(53289),b=i(89164),w=i(1049),P=i(60183),C=i(39425),T=i(47903),x=i(57649),I=i(77455),M=(i(30875),i(27490)),L=i(72927),A=i(50968),k=i(87088);class E{constructor(e){this._data=e}draw(e,t){}drawBackground(e,t){e.save();const i=this._data,s=t.pixelRatio;let r=null;const n=Math.round(this._data.w*s);for(let t=0;t0){i.items[t-1].index===o.index-1&&null!==r&&(l=r+1)}const c=a+n,h=c-l+1;e.fillRect(l,Math.round(i.y*s),h,Math.round(i.h*s)),r=c}e.restore()}hitTest(e){return null}}var D=i(150);class V{constructor(e,t,i,r){this._items=[],this._invalidated=!0,this._isMarkersEnabled=M.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=r;const n=this._study.metaInfo().plots;for(let e=0;e0?(i-=n,r+=n):(i+=n,r-=n);const o=this._study.getMinFirstBarIndexForPlot(this._plotName);if(o>r)return;i=Math.max(o,i);const a=this._study.data().rangeIterator(i,r);for(;a.hasNext();){const e=a.next();let i=e.index;const r=e.value;i+=n;const o=new L.Point(Math.floor(i)-.5,NaN);let l=(0,T.isNumber)(t)?t:50;l=Math.min(l,100),l=Math.max(l,0);const c=this._colorProvider.getPlotPointStyle(r);void 0!==c.colors[1]&&(o.color=(0,A.generateColor)((0,s.ensureDefined)(c.colors[1]),l)),o.index=i,this._items.push(o)}this._model.timeScale().timedValuesToCoordinates(this._items)}} var B=i(79039),N=i(73301),R=i(13618),O=i(57968),F=i(10288),W=i(98742),H=i(18213),z=i(37326),U=i(71044);function j(e,t,i){const s=e.get(t);return void 0!==s?s:(e.set(t,i),i)}function G(e,t,i,s,r){const n=j(e,t,new Map),o=j(n,i,new Map);return j(o,s,r)}class q{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}var Y,$,K=i(73395),X=i(16932);!function(e){e.Left="left",e.Right="right",e.Center="center"}(Y||(Y={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}($||($={}));const Z=(0,X.createDisconnectedCanvas)(document,new X.Size(0,0),1);class J{constructor(e,t,i,r,n,o="center",a=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,K.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,r,n),this._fontSize=n,this._verticalPadding=~~(n/6),this._textAlign=o,this._lineSpacing=a;const l=(0,s.ensureNotNull)(Z.getContext("2d"));l.font=this._font,l.textBaseline="top";let c=0;for(let e=0;e{for(const t of this._lines)e.fillText(t,l,c),c+=this._fontSize,c+=this._lineSpacing}),e.restore()}}class Q extends q{constructor(e){super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,lineSpacing:r=0}=e;if(!i||!t||!s)return null;const n=G(this._map,r,s,t,new Map);let o=n.get(i);return void 0!==o||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([t,s,r,i]),o=new J(i,e.bold,e.italic,e.font,t,s,r),n.set(i,o)),o}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,r,n]=e,o=(0,s.ensureDefined)(this._map.get(r)),a=(0,s.ensureDefined)(o.get(i)),l=(0,s.ensureDefined)(a.get(t));l.delete(n),0===l.size&&a.delete(t),0===a.size&&o.delete(i),0===o.size&&this._map.delete(r)}}var ee=i(54837);class te{constructor(e,t={skipRenderingOptimizations:!1}){this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new Q(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}draw(e,t){this._preDrawInit(),this._drawOperation(e,t)}hitTest(e){const t=F.HitTestResult.REGULAR;let i=null ;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,U.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new F.HitTestResult(t,e)}}return i}setData(e){this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"),void 0!==e.items&&void 0!==e.barSpacing&&this.setItems(e.items,e.barSpacing)}setItems(e,t){this._setBaseData(e,t)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,r=i.textImageHeight,n=s/2,o=e.y+t+e.textVertOffset,a=t>0?0:-r,l=t>0?r:0,c=new L.Point(e.x-n,o+a),h=new L.Point(e.x+n,o+l);return(0,L.box)(c,h)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),r=Math.min(e.min.y,t.min.y),n=Math.max(e.max.y,t.max.y),o=new L.Point(i,r),a=new L.Point(s,n);return(0,L.box)(o,a)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){const e=void 0===t.width?(0,s.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,s.ensureDefined)(this._height):t.height,r=void 0===t.vertOffset?this._vertOffset:t.vertOffset,n=r>0?i:-i;this._items.push({width:e,height:i,vertOffset:r,textVertOffset:n,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t,i){const s=this._getTextCache(i);if(null===s)return;const r=i.x,n=i.vertOffset,o=i.y+n+i.textVertOffset;let a;a=i.style&&void 0!==i.style.textColor?i.style.textColor:this._textColor,s.paintTo(e,t,a,r,o,Y.Center,n>0?$.Top:$.Bottom)}_drawWithOptimizations(e,t){let i,s,r=null,n=!1;for(const a of this._items)a.style&&void 0!==a.style.color?(i=a.style.color||"rgba(0, 0, 0, 0)",s=a.style.borderColor||"rgba(0, 0, 0, 0)"):(i=this._color,s=this._borderColor),(r!==i||o.isSafari)&&(r=i,n&&this._endPath(e),this._startPath(e,t,i,s)),this._drawItemShape(e,t,a),n=!0;n&&this._endPath(e);for(const i of this._items)this._drawItemText(e,t,i)}_drawWithoutOptimizations(e,t){let i,r;for(const n of this._items){const o=(0,s.ensureDefined)(n.style);i=o.color||"rgba(0, 0, 0, 0)",r=o.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i,r),this._drawItemShape(e,t,n),this._endPath(e),this._drawItemText(e,t,n)}}_drawItemShape(e,t,i){(0,X.drawScaled)(e,t.pixelRatio,()=>this._drawItemShapeUsingCSSPixels(e,i))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i,s){}_endPath(e){}_getTextCache(e){var t;const i=e.text||this._text,s=e.fontSize||this._fontSize,r=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,n=e.textAlign||this._textAlign;return this._textCache.get({text:i,bold:!1,italic:!1,font:ee.CHART_FONT_FAMILY,fontSize:s,lineSpacing:r,align:n})}}class ie extends te{ _startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.strokeStyle=i}_endPath(e){e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.pixelRatio))}}class se extends te{_startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.fillStyle=i,e.strokeStyle=s}_endPath(e){e.fill(),e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.pixelRatio))}}class re extends se{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=this._sign,o=this._arrowWidth,a=this._headHeight,l=Math.abs(i.height),c=Math.round(i.x*s)+r,h=i.vertOffset,d=Math.round((i.y+h+n*l/2)*s)+r,u=(0,O.ceiledEven)(o*s),p=u/2,_=Math.round(l*s),m=Math.round(a*s);e.translate(c,d),this._thinArrow?(e.moveTo(0,0),e.lineTo(-p,-p*n),e.moveTo(0,0),e.lineTo(p,-p*n),e.moveTo(0,0),e.lineTo(0,-_*n),e.moveTo(-p,-_*n),e.lineTo(p,-_*n)):(e.moveTo(0,0),_=0?e.vertOffset:e.vertOffset-e.shapeHeight}}),he.set("PaneRendererLabelDown",class extends oe{_calcBoundingBox(e){const t=e.x-e.shapeWidth/2,i=e.x+e.shapeWidth/2,s=e.y-e.shapeHeight+e.vertOffset,r=e.y+e.vertOffset,n=new L.Point(t,s),o=new L.Point(i,r);return(0,L.box)(n,o)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=Math.max(1,Math.floor(s))%2?.5:0,o=this._getArrowSize(i);let a=Math.round(o*s);(n+a)%1!=r%1&&(a+=.5);let l=Math.round(i.shapeWidth/2*s);(n+l)%1!=r%1&&(l+=.5);const c=Math.round(i.x*s)+n,h=Math.round((i.y+i.vertOffset)*s)+r,d=c+a,u=Math.round((i.y+i.vertOffset-o)*s)+r,p=c-a,_=c+l,m=Math.round((i.y+i.vertOffset-i.shapeHeight)*s)+r,g=c-l;e.moveTo(d,u),e.lineTo(c,h),e.lineTo(p,u),i.shapeWidth<=2*o?(e.lineTo(g,u),this._drawCorner(e,g,m,le.leftUp,s),this._drawCorner(e,_,m,le.rightUp,s),e.lineTo(_,u)):(this._drawCorner(e,g,u,le.leftDown,s),this._drawCorner(e,g,m,le.leftUp,s),this._drawCorner(e,_,m,le.rightUp,s),this._drawCorner(e,_,u,le.rightDown,s)),e.lineTo(d,u)}_getVerticalTextOffset(e){return-e.shapeHeight/2-this._getArrowSize(e)/2}_calcVertOffset(e){return Math.sign(e.vertOffset)<=0?e.vertOffset:e.vertOffset+e.shapeHeight}}),he.set("PaneRendererSquare",class extends se{_drawItemShape(e,t,i){const s=t.pixelRatio,r=Math.max(1,Math.floor(s))%2?.5:0,n=this._lineWidth(t)%2?.5:0;let o=Math.round(i.height/2*s);(r+o)%1!=n%1&&(o+=.5);const a=Math.round(i.x*s)+r,l=Math.round((i.y+i.vertOffset)*s)+r,c=a-o,h=l-o,d=a+o,u=l+o;e.rect(c,h,d-c,u-h)}_calcBoundingBox(e){const t=e.height,i=Math.round(t/2),s=e.x-i,r=e.vertOffset,n=e.y+r-i,o=s,a=s+t,l=n,c=n+t,h=new L.Point(o,l),d=new L.Point(a,c);let u=(0,L.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}}),he.set("PaneRendererTriangleApexUp",class extends ce{_drawItemShape(e,t,i){const s=i.width,r=i.height,n=Math.round(r/3),o=i.vertOffset-2*n,a=t.pixelRatio,l=this._lineWidth(t)%2?.5:0,c=Math.max(1,Math.floor(a)),h=c%2?.5:0;let d=Math.round(s*a) ;d%2!=c%2&&(d+=1);const u=Math.round(i.x*a)+h,p=Math.round((i.y+o)*a),_=u+d/2,m=Math.round((i.y+o+r)*a)+l,g=u-d/2;e.moveTo(u,p),e.lineTo(_,m),e.lineTo(g,m),e.lineTo(u,p)}}),he.set("PaneRendererTriangleApexDown",class extends ce{_drawItemShape(e,t,i){const s=i.width,r=i.height,n=Math.round(r/3),o=i.vertOffset-n,a=t.pixelRatio,l=this._lineWidth(t)%2?.5:0,c=Math.max(1,Math.floor(a)),h=c%2?.5:0;let d=Math.round(s*a);d%2!=c%2&&(d+=1);const u=Math.round(i.x*a)+h,p=Math.round((i.y+o)*a)+l,_=u+d/2,m=Math.round((i.y+o+r)*a),g=u-d/2;e.moveTo(g,p),e.lineTo(_,p),e.lineTo(u,m),e.lineTo(g,p)}}),he.set("PaneRendererXCross",class extends ie{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=t.x-i/2,n=t.vertOffset,o=t.y-s/2+n;e.moveTo(r,o),e.lineTo(r+i,o+s),e.moveTo(r,o+s),e.lineTo(r+i,o)}_calcBoundingBox(e){const t=e.width,i=e.height,s=e.x-t/2,r=e.vertOffset,n=e.y-i/2+r,o=s,a=s+t,l=n,c=n+i,h=new L.Point(o,l),d=new L.Point(a,c);let u=(0,L.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}});class de{constructor(e,t,i,s){this._items=[],this._invalidated=!1,this._renderer=null,this._isMarkersEnabled=M.enabled("source_selection_markers"),this._selectionData=null,this._plotIndex=null,this._topCoord=0,this._bottomCoord=0,this._study=e,this._series=t,this._model=i,this._plotName=s;const r=e.metaInfo().plots;for(let e=0;e0?(r-=o,n+=o):(r+=o,n-=o);const a=this._study.getMinFirstBarIndexForPlot(this._plotName);if(a>n)return;r=Math.max(a,r);const l=this._study.data(),c=this._study.firstValue();if(null===c)return;const h=l.rangeIterator(r,n),u=this._getTranspValue();let p=[];const _=this._model.selection().isSelected(this._study);_?(p=this._selectionIndexer.indexes(),this._selectionData={points:[],hittestResult:F.HitTestResult.REGULAR,vertOffset:0,bgColors:[],barSpacing:e.barSpacing(),visible:!0}):(this._selectionIndexer.clear(),this._selectionData=null) ;const m=this._series.properties().childs().style.value(),g=2===m?"lineStyle":3===m?"areaStyle":null;let f,v;g?(f=this._series.properties().childs()[g].childs().priceSource.value(),v=f):(f="high",v="low");const S=t.isInverted(),y=t.coordinateToPrice(t.height()*t.topMargin(),c),b=t.coordinateToPrice(t.height()*(1-t.bottomMargin()),c);this._topCoord=S?b:y,this._bottomCoord=S?y:b;const w=(0,s.ensureNotNull)(this._model.paneForSource(this._study)).height(),P=this._study.properties().styles[this._plotName],C=P.color.value(),T=P.textColor?P.textColor.value():void 0,x=C,I=C,M=void 0===T?void 0:T,L=(0,s.ensureNotNull)(this._plotIndex),A=(0,z.createEmptyStyle)();for(;h.hasNext();){const e=h.next(),t=e.index,i=e.value,s=Math.floor(t+o),r=i[L+1];if(null==r)continue;const n=this._createItem(s,r,f,v);if(null!==n){if(this._colorProvider.isColorDefined()){n.style={color:x,borderColor:I,textColor:M};const e=this._colorProvider.getPlotPointStyle(i,A);this._fillItemWithPointStyle(n,e,u)}_&&-1!==p.indexOf(t)&&null!==this._selectionData&&(this._selectionData.points.push(n),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(n.y/w))),this._items.push(n)}}this._convertItemsToCoordinates()}_fillItemWithPointStyle(e,t,i){const r=(0,s.ensureDefined)(e.style);if(void 0!==t.colors[0]){r.color=(0,A.generateColor)((0,s.ensureDefined)(t.colors[0]),i);const e=i>9?i-10:0;r.borderColor=(0,A.generateColor)(r.color,e)}void 0!==t.colors[2]&&(r.textColor=(0,A.generateColor)((0,s.ensureDefined)(t.colors[2]),i))}_updateRenderer(e){this._updateImpl();const t=this._model.timeScale(),i={},s=this._getTranspValue(),r=t.barSpacing(),n=this._calculateShapeHeight(r),o=this._study.properties().styles[this._plotName].location.value(),a=this._calculateVerticalOffset(o,n+n/2);i.barSpacing=r,i.items=this._items,i.color=(0,A.generateColor)(this._study.properties().styles[this._plotName].color.value(),s),i.height=n,i.vertOffset=a;const l=this._study.properties().styles[this._plotName].plottype.value(),c=R.plotShapesData[l],h=new k.CompositeRenderer;c&&h.append(this._createRenderer(c.paneRendererClass,i)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=a,h.append(new N.SelectionRenderer(this._selectionData))),this._renderer=h}_createRenderer(e,t){const i=he.get(e);return new((0,s.ensureDefined)(i))(t)}_getSeriesVal(e,t){const i=(0,H.barFunction)(e),s=this._series.data().valueAt(t);return null===s?null:i(s)}_getTranspValue(){let e=0;this._study.properties().transparency&&(e=this._study.properties().transparency.value(),e=(0,T.isNumber)(e)?e:50);const t=this._study.properties().styles[this._plotName];return t.transparency&&(e=t.transparency.value(),e=(0,T.isNumber)(e)?e:50),(0,O.clamp)(e,0,100)}_createItem(e,t,i,r){const n=this._study.properties().styles[this._plotName].location.value();if((null===t||0===t)&&n!==m.MarkLocation.Absolute)return null;let o;switch(n){case m.MarkLocation.AboveBar:const a=this._getSeriesVal(i,e);if(null===a)return null;o=a;break ;case m.MarkLocation.BelowBar:const l=this._getSeriesVal(r,e);if(null===l)return null;o=l;break;case m.MarkLocation.Top:o=this._topCoord;break;case m.MarkLocation.Bottom:o=this._bottomCoord;break;case m.MarkLocation.Absolute:o=(0,s.ensureNotNull)(t);break;default:throw new Error("Bad value: "+n)}return new L.Point(e,o)}_convertItemsToCoordinates(){const e=this._model.timeScale(),t=this._study.priceScale();e.timedValuesToCoordinates(this._items);const i=(0,s.ensureNotNull)(this._study.firstValue());(0,s.ensureNotNull)(t).pointsArrayToCoordinates(this._items,i)}_calculateVerticalOffset(e,t){let i=0;switch(e){case m.MarkLocation.AboveBar:case m.MarkLocation.Bottom:i=-t;break;case m.MarkLocation.BelowBar:case m.MarkLocation.Top:i=t}return(0,s.ensureNotNull)(this._study.priceScale()).isInverted()&&(i*=-1),i}_calculateShapeHeight(e,t){let i=e;switch(t){case I.PlotSymbolSize.Tiny:i=.3*e;break;case I.PlotSymbolSize.Small:i=.6*e;break;case I.PlotSymbolSize.Normal:i=e;break;case I.PlotSymbolSize.Large:i=1.5*e;break;case I.PlotSymbolSize.Huge:i=2*e}return i}}class ue extends de{renderer(){const e=this._study.properties().styles[this._plotName];return e.visible&&e.visible.value()&&this._scalesReady()?(this._invalidated&&(this._updateRenderer(e),this._invalidated=!1),this._renderer):null}_updateRenderer(e){this._updateImpl();const t=this._model.timeScale(),i={},s=this._getTranspValue(),r=t.barSpacing();let n;if(e.size){const t=e.size.value();n=this._calculateShapeHeight(25,t)}else n=Math.round(r/2);n=Math.max(n,1);const o=e.location.value(),a=(0,A.generateColor)(e.color.value(),s),l=s>19?s-10:0,c=this._calculateVerticalOffset(o,Math.round(1.5*n));i.barSpacing=r,i.items=this.items(),i.color=a,i.borderColor=(0,A.generateColor)(e.color.value(),l),i.height=n,i.vertOffset=c;const h=e.plottype.value(),d=R.plotShapesData[h],u=new k.CompositeRenderer,p=e.text?e.text.value():void 0;if(void 0!==p&&""!==p.trim()){let t=p.trim().replace(/\\n/gm,"\n");t=(0,B.cleanButAmpersand)(t,!0),i.text=t,i.fontSize=12;const r=e.textColor?e.textColor.value():void 0;i.textColor=r?(0,A.generateColor)(r,s):a}u.append(super._createRenderer(d.paneRendererClass,i)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=c,u.append(new N.SelectionRenderer(this._selectionData))),this._renderer=u}}var pe=i(68277),_e=i.n(pe),me=i(21344);class ge extends te{constructor(e,t){super(null,t),this._fontSizeEnsured=0,this._ch="",this._fontFamily=ee.CHART_FONT_FAMILY,this._charCache=null,null!==e&&this.setData(e)}setData(e){super.setData(e),this._fontSizeEnsured=(0,s.ensureDefined)(this._height);const t=e.char.slice(0,40);this._ch=_e()(t)[0]||" ",this._fontFamily=e.fontFamily||ee.CHART_FONT_FAMILY}hitTest(e){const t=(0,me.interactionTolerance)().series+this._fontSizeEnsured/2;for(const i of this._items){if(new L.Point(i.x,i.y+i.vertOffset).subtract(e).length()<=t)return new F.HitTestResult(F.HitTestResult.REGULAR)}return null}_drawItemShape(e,t,i){ const s=i.x,r=i.vertOffset>0?1:-1,n=i.y+i.vertOffset-r*Math.round(this._fontSizeEnsured/2);let o;o=i.style&&void 0!==i.style.color?i.style.color:this._color;const a=this._textImageCache(),l=t.pixelRatio;if(this._fontSizeEnsured<=4/l){e.save();const t=Math.max(1,Math.floor(l));let r=Math.max(1,Math.floor(a.textImageWidth*l));r%2!=t%2&&(r+=r>1?-1:1);const c=Math.round(n*l)+(i.vertOffset>=0?0:-r);return e.fillStyle=o,e.fillRect(Math.round(s*l)+(l%2?.5:0)-r/2,c,r,r),void e.restore()}a.paintTo(e,t,o,s,n,Y.Center,i.vertOffset>0?$.Top:$.Bottom)}_startPath(e,t,i,s){}_endPath(e){}_textImageCache(){return null!==this._charCache&&this._charCache.fontFamily===this._fontFamily&&this._charCache.fontSize===this._fontSizeEnsured||(this._charCache={fontSize:this._fontSizeEnsured,fontFamily:this._fontFamily,cache:new J(this._ch,!1,!1,this._fontFamily,this._fontSizeEnsured,"center",0)}),this._charCache.cache}}class fe extends de{constructor(){super(...arguments),this._compositeRenderer=new k.CompositeRenderer,this._charRenderer=new ge(null)}renderer(){const e=this._study.properties().styles[this._plotName];return e.visible&&e.visible.value()&&this._scalesReady()?(this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._compositeRenderer):null}_updateImpl(){if(this._compositeRenderer.clear(),super._updateImpl(),0===this._items.length)return;const e=this._getTranspValue(),t=this._model.timeScale().barSpacing();let i;const s=this._study.properties().styles[this._plotName];if(s.size){const e=s.size.value();i=this._calculateShapeHeight(50,e)}else i=Math.round(t);const r=s.location.value(),n=(0,A.generateColor)(s.color.value(),e),o=this._calculateVerticalOffset(r,i),a={items:this.items(),barSpacing:t,char:s.char.value(),height:i,vertOffset:o,color:n},l=s.text?s.text.value():void 0;if(void 0!==l&&""!==l.trim()){let t=l.trim().replace(/\\n/gm,"\n");t=(0,B.cleanButAmpersand)(t,!0),a.text=t,a.fontSize=12;const i=s.textColor?s.textColor.value():void 0;a.textColor=i?(0,A.generateColor)(i,e):n}this._charRenderer.setData(a),this._compositeRenderer.append(this._charRenderer),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=o,this._compositeRenderer.append(new N.SelectionRenderer(this._selectionData)))}}var ve=i(14563);class Se extends L.Point{constructor(e,t,i,s){super(e,t),this.height=i,this.isUp=s,this.style={}}}function ye(e){return Math.round(e/4)}function be(e){return Math.round(e/2)}class we{constructor(e){this._data=e}draw(e,t){var i;const s=t.pixelRatio,r=this._data,n=be(r.barSpacing),o=ye(r.barSpacing),a=n<4,l=Math.max(n/2,1),c=(0,O.ceiledEven)(n*s),h=c/2,d=Math.round(n*s);e.lineCap="butt",e.lineWidth=Math.max(1,Math.floor(s));const u=e.lineWidth%2?.5:0;for(const t of r.items){const n=t.isUp?-1:1,p=Math.round(Math.abs(t.height)*s),_=Math.round(t.x*s)+u,m=Math.round((t.y-n*o)*s)+u;e.beginPath(),e.translate(_,m);const g=null!==(i=t.style&&t.style.color)&&void 0!==i?i:t.isUp?r.colorup:r.colordown;a?(e.moveTo(0,0),e.lineTo(-h,-h*n),e.moveTo(0,0), e.lineTo(h,-h*n),e.moveTo(0,0),e.lineTo(0,-p*n),e.moveTo(-h,-p*n),e.lineTo(h,-p*n),e.lineWidth=l,e.strokeStyle=g,e.stroke()):(e.moveTo(0,0),pthis._maxAbsValue&&(this._maxAbsValue=Math.abs(t));const r=t>0;let n;if(r){const t=this._getSeriesVal(s,e);if(null===t)return null;n=t}else{const t=this._getSeriesVal(i,e);if(null===t)return null;n=t} return new Se(e,n,t,r)}_convertItemsToCoordinates(){const e=this._model.timeScale(),t=(0,s.ensureNotNull)(this._study.priceScale());e.timedValuesToCoordinates(this._items),t.pointsArrayToCoordinates(this._items,(0,s.ensureNotNull)(this._study.firstValue()));let i=Math.abs(this._study.properties().styles[this._plotName].minHeight.value()),r=Math.abs(this._study.properties().styles[this._plotName].maxHeight.value());if(i>r){const e=i;i=r,r=e}const n=(r-i)/this._maxAbsValue,o=this._items;for(let e=0;er)return;i=Math.max(n,i);const o=this._study.data(),a=this._study.firstValue();if(null===a)return;const l=o.rangeIterator(i,r),c=this._study.properties().ohlcPlots[this._plotName],h=new Map,u=(e,t)=>{const i=e+"@"+t;if(!h.has(i)){const s=(0,A.generateColor)(e,t);return h.set(i,s),s}return h.get(i)},p=(0,z.createEmptyStyle)();for(;l.hasNext();){const e=l.next();let t=e.index;const i=e.value;t=Math.floor(t);let r=!0;const n=new Map;for(let e=1;e<=4;++e){const t=this._ohlcPlotIndexes.get(e);if(void 0===t){r=!1;break}const s=i[t+1];if(null==s){r=!1;break}n.set(e,s)}if(!r)continue;const o=(0,s.ensureDefined)(n.get(1)),a=(0,s.ensureDefined)(n.get(4)),h=(0,s.ensureDefined)(n.get(2)),d=(0,s.ensureDefined)(n.get(3)),_=Math.max(o,h,d,a),m=Math.min(o,h,d,a);let g=(0,s.ensureDefined)(u(c.color.value(),0));const f=this._colorProvider.getPlotPointStyle(i,p);void 0!==f.colors[0]&&(g=(0,s.ensureDefined)(f.colors[0]));const v={time:Math.round(t),open:o,high:_,low:m,close:a,color:g,wickColor:f.colors[4],borderColor:f.colors[3],hollow:null};this._bars.push(v)}if(e.barPricesToCoordinates(this._bars,a),this._model.timeScale().barIndexesToCoordinates(this._bars), this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:F.HitTestResult.REGULAR,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=(0,s.ensureNotNull)(this._model.paneForSource(this._study)).height(),r=(0,s.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let s=0;sthis._actualLength?this._items[this._actualLength]:null;return null!==e&&Boolean(e.invalidateCache)&&e.invalidateCache(),e} invalidateCache(){this._invalidations+=1,3e3===this._invalidations&&(this._items.splice(this._actualLength),this._invalidations=0),this._actualLength=0}at(e){return this._items[e]}data(){return this._items}length(){return this._actualLength}}class Re{constructor(){this._map=new Map,this._usedKeys=new Set,this._invalidations=0}invalidateCache(){this._invalidations+=1,50===this._invalidations&&(this._deleteUnused(),this._invalidations=0),this._usedKeys.clear(),this._map.forEach((e,t)=>e.invalidateCache())}get(e){const t=this._map.get(e);return void 0!==t&&this._usedKeys.add(e),t}set(e,t){this._usedKeys.add(e),this._map.set(e,t)}forEach(e){this._map.forEach((t,i)=>{this._usedKeys.has(i)&&e(t,i)})}delete(e){const t=this._map.get(e);void 0!==t&&t.invalidateCache(),this._usedKeys.delete(e)}_deleteUnused(){const e=[];this._map.forEach((t,i)=>{this._usedKeys.has(i)||e.push(i)});for(const t of e)this._map.delete(t)}}class Oe extends Ne{constructor(){super(),this.points1=new Ne,this.points2=new Ne,this.push(this.points1),this.push(this.points2)}addPoints1Point(e,t){let i=this.points1.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points1.push(i)}addPoints2Point(e,t){let i=this.points2.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points2.push(i)}invalidateCache(){this.points1.invalidateCache(),this.points2.invalidateCache()}}class Fe extends Be.ScaledPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e,t){return null}_drawImpl(e,t){if(null===this._data)return;const i=.25*this._data.barSpacing,s=this._data.transparency;this._data.colorAreas.forEach((t,r)=>{e.beginPath();for(let s=0;s=0;t--)e.lineTo(r.points2.at(t).x,r.points2.at(t).y)}else{const t=r.points2.at(0).x,s=r.points2.at(0).y;e.lineTo(n+i,o),e.lineTo(t+i,s),e.lineTo(t-i,s),e.lineTo(n-i,o)}}e.closePath(),e.fillStyle=(0,A.generateColor)(r,s),e.fill()})}}var We=i(45672);class He extends Ne{constructor(){super(...arguments),this._startIndex=0}setStartIndex(e){this._startIndex=e}at(e){const t=e-this._startIndex;for(;t>=this._actualLength;){if(this._items.length<=t)this._items.push({plot1Value:void 0,plot2Value:void 0,colorIndex:void 0});else{const e=this._items[this._actualLength];e.plot1Value=void 0,e.plot2Value=void 0,e.colorIndex=void 0}this._actualLength+=1}return this._items[t]}}class ze{constructor(e,t,i=!1){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._colorValues=[],this._colors=new Ne,this._areaRenderer=new Fe,this._invalidated=!0,this._plIndex1=null,this._plIndex2=null,this._level1=0,this._level2=0,this._studyValuesCache=new He,this._points1=new Ne,this._points2=new Ne,this._timePoints=new Ne,this._colorAreas=new Re,this._source=e,this._model=t, this._fillGaps=i}update(){this._invalidated=!0}renderer(e,t){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._areaRenderer}_correctVisibleRange(e){const t=this._source.data(),i=t.search(e.firstBar(),d.PlotRowSearchMode.NearestLeft,this._plotIndex1()),s=t.search(e.firstBar(),d.PlotRowSearchMode.NearestLeft,this._plotIndex2()),r=t.search(e.lastBar(),d.PlotRowSearchMode.NearestRight,this._plotIndex1()),n=t.search(e.lastBar(),d.PlotRowSearchMode.NearestRight,this._plotIndex2()),o=null!==i?i.index:e.firstBar(),a=null!==s?s.index:e.firstBar(),l=null!==r?r.index:e.lastBar(),c=null!==n?n.index:e.lastBar();return[Math.min(o,a),Math.max(l,c)]}_plotNames(){return this._source.metaInfo().plots.map(e=>e.id)}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImpl(){var e,t,i;if(this._areaRenderer.setData(null),!this._visible())return;const r=this._source.priceScale(),n=this._model,o=n.timeScale();if(!r||r.isEmpty()||o.isEmpty())return;if(n.mainSeries().bars().isEmpty())return;const a=this._source.firstValue();if(null===a)return;if(this._isHlineFill){const e=this._source.properties().bands[(0,s.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[(0,s.ensureNotNull)(this._bandBKey)];this._level1=r.priceToCoordinate(e.value.value(),a),this._level2=r.priceToCoordinate(t.value.value(),a)}const l=o.visibleBarsStrictRange();if(null===l)return;this._timePoints.invalidateCache(),this._points1.invalidateCache(),this._points2.invalidateCache(),null===(e=this._colors)||void 0===e||e.invalidateCache(),this._colorAreas.invalidateCache();const[c,h]=this._correctVisibleRange(l),d=this._isPerBarColoringSupported()?this._colors:null,u=this._source.offset(this._plotAId()),p=this._source.offset(this._plotBId()),_=Math.min(u,p),m=Math.max(u,p),g=this._plotIndex1(),f=this._plotIndex2(),v=this._source.data();if(v.isEmpty())return;let S,y;const b=(0,s.ensureNotNull)(v.firstIndex()),w=(0,s.ensureNotNull)(v.lastIndex()),P=b-Math.max(0,-_),C=w+Math.max(0,m),x=Math.max(c-1,P),I=Math.min(h+1,C),M=this._studyValuesCache;M.invalidateCache();const L=x-m,A=v.rangeIterator(L,I-_),k=Math.max(l.firstBar()-1,Math.min(L-m-1,L-1+_));M.setStartIndex(k);const E=new We.BarsRange(l.firstBar()-1,l.lastBar()+1);for(;A.hasNext();){const e=A.next(),t=e.index,i=e.value,r=i[g],n=i[f],o=t+u,a=t+p;if(o===a&&E.contains(o)){const e=M.at(o);e.plot1Value=r,e.plot2Value=n}else{if(E.contains(o)){M.at(o).plot1Value=r}if(E.contains(a)){M.at(a).plot2Value=n}}if(null!==d){const e=t-1+_;if(l.contains(e)){const t=i[(0,s.ensureNotNull)(this._colorPlotIndex)+1];M.at(e).colorIndex=t}}}const D=this._timePoints,V=this._points1,B=this._points2;let N=null;const R=k+M.length();for(let e=k;e<=R;e++){if(!this._fillGaps&&(null===S||null===y)){const t=e-1;D.push(t),V.push(NaN),B.push(NaN),null==d||d.push(null)}const s=M.at(e);if(null!==d){const e=s.colorIndex ;N=null==e?null:this._getColorByPlotValue(e)}if(this._isHlineFill){D.push(e),null!==d&&d.push(N);continue}const r=null!==(t=s.plot1Value)&&void 0!==t?t:null,n=null!==(i=s.plot2Value)&&void 0!==i?i:null;(null!==r||null!==n||Number.isFinite(S)||Number.isFinite(y))&&(S=r,y=n,V.push(r),B.push(n),D.push(e),null!==d&&d.push(N))}r.pricesArrayToCoordinates(V.data(),a,V.length()),r.pricesArrayToCoordinates(B.data(),a,B.length()),o.indexesToCoordinates(D.data(),D.length());const O=this._transparency();let F=(0,T.isNumber)(O)?O:50;F=Math.min(F,100),F=Math.max(F,0);const W={barSpacing:this._model.timeScale().barSpacing(),transparency:F,colorAreas:this._getFilledAreas(D,V,B,d)};this._areaRenderer.setData(W)}_getFilledAreas(e,t,i,s){const r=this._isHlineFill;if(!r&&(0===t.length()||0===i.length()))return new Re;const n=this._colorAreas;let o=null,a=null;const l=this._color();for(let c=0;c{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)})}}var Xe=i(73748),Ze=i(89537),Je=i(32856),Qe=i.n(Je),et=i(25436),tt=i(23952);const{property:it,availableValues:st}=(0,tt.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility"),rt=(0,n.getLogger)("Chart.Study"),nt=(0,r.t)("Invalid Symbol");const ot={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:M.enabled("dont_show_boolean_study_arguments"),asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!0,priceInputsForDisplay:!1},at=M.enabled("study_symbol_ticker_description"),lt=M.enabled("hide_main_series_symbol_from_indicator_legend");function ct(e,t){const i=e.plots[t];if(!i||!(0,I.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,I.isOhlcPlotStyleBars)(r)||n&&(0,I.isOhlcPlotStyleBars)(n)||!!o&&(0,I.isOhlcPlotStyleBars)(o)}function ht(e,t){const i=e.plots[t];if(!i||!(0,I.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,I.isOhlcPlotStyleCandles)(r)||n&&(0,I.isOhlcPlotStyleCandles)(n)||!!o&&(0,I.isOhlcPlotStyleCandles)(o)}function dt(e,t){(0,s.assert)(void 0!==e,"zOrder must be defined"),(0,s.assert)(!t.has(e),"zOrder must be unique")}class ut extends c.PriceDataSource{constructor(e,t,i,s){super(e),this.onStart=new(l()),this._onHibernationStateChange=new(l()),this._symbolsResolved=new(l()),this._statusChanged=new(l()),this._paneViews=[],this._priceAxisViews=[],this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._source=null,this._isChildStudy=!1,this._status={type:Xe.StudyStatusType.Undefined},this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new x.NumericFormatter, this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._labelPaneViews=[],this._ownFirstValue=null,this._plotOffsets={},this._formatter=null,this._tagsChanged=new(l()),this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new(l()),this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new(Qe())(0),this._currencySourceSymbolInfo=null,this._currencySourceSymbolInputProperty=null,this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),i instanceof ut&&(this._source=i,this._isChildStudy=!0,this._source.setChild(this));const r=this.parentSource();r.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),r.unitChanged().subscribe(this,this._onSourceUnitChanged),r.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),r.formatterChanged().subscribe(this,this._onSourceFormatterChanged),r.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),at&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,()=>{this.invalidateTitleCache(!0)}),this._properties.subscribe(this,this._onPropertiesChanged),this._properties.visible.subscribe(this,this._visibleChanged),this._properties.visible.subscribe(this,this.processHibernate),this._properties.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),this._properties.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offsets&&this._properties.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offset&&this._properties.offset.listeners().subscribe(this,this._updateMaxOffsetValue),this._initializeCurrencySource(),S.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e=0?e:0}}return this._isChildStudy&&p().patchChildStudyMetaInfoState(l),l}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}isChildStudy(){return this._isChildStudy}hasChildren(){return this._children.length>0}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){ if(this._model.collapsed().value()||!this.properties().visible.value()||!this.isActualInterval())return!1;const e=this.metaInfo();if(e.plots.length>0)return!0;for(const t of Object.keys(e.graphics))for(const i of Object.keys(e.graphics[t])){const e=this.properties().graphics[t][i];if(!e.visible||e.visible.value())return!0}return!(!e.isTVScriptStrategy&&!e.hasAlertFunction)}inputs(e){const t=(0,T.merge)((0,T.clone)(ot),e||{});return t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0),this._buildInputs(t)}metaInfo(){return this._metaInfo}status(){return this._status}name(e){return e?this.metaInfo().shortDescription||this._properties.shortDescription&&this._properties.shortDescription.value()||"Study":this.metaInfo().description||this._properties.description&&this._properties.description.value()||"Study"}title(e,t,i,s){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const r=JSON.stringify([e,t,i,s]);if(this._titleStrCache[r])return this._titleStrCache[r];if(this._titleInPartsCache[r])return this._joinTitlesParts(this._titleInPartsCache[r]);const n=this._title(e,t,i,s);return this._titleStrCache[r]=n,n}titleInParts(e,t,i,s){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const r=JSON.stringify([e,t,i,s]);if(this._titleInPartsCache[r])return this._titleInPartsCache[r];const n=this._titleInParts(e,t,i,s);return this._titleInPartsCache[r]=n,n}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;te.update()),this._labelPaneViews.forEach(e=>e.update()),null===(e=this._dataWindowView)||void 0===e||e.update(),null===(t=this._legendView)||void 0===t||t.update(),null===(i=this._statusView)||void 0===i||i.update(),this._priceAxisViews.forEach(e=>e.update()),this._priceLinesAxisViews.forEach(e=>e.update()),null===(s=this._inputsLinesPaneView)||void 0===s||s.update(),null===(r=this._inputsAnchorsPaneView)||void 0===r||r.update(),this._inputsTimeAxisPaneViews.forEach(e=>e.update()),this._inputsPriceAxisPaneViews.forEach(e=>e.update())}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&p().isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}currency(){if(null!==this._currencySourceSymbolInfo)return(0,et.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this.parentSource().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this.parentSource().unit():null}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}inputsForAlertState(){return this.inputs()}sessionId(){return this.parentSource().sessionId()}sessionIdChanged(){return this.parentSource().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,b.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new f.StudyLegendValuesProvider(this,this.model())}statusProvider(e){return new C.StudyStatusProvider(this,this._model.properties().childs().scalesProperties.childs().textColor)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){ return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&S.hideAllIndicators().value()}paneViews(e){if(this.isSourceHidden()||!e.hasPriceDataSource(this))return null;const t=[];return!this._startMovingPoint&&this._wasCompletedBefore&&t.push(...this._paneViews),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&t.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&t.push(this._inputsAnchorsPaneView),t}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){if(this.properties().oldShowLastValue&&!this.properties().oldShowLastValue.value())return null;let i=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(i=i.concat(this._inputsPriceAxisPaneViews)),e.findTargetPriceAxisViews(this,t,i,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e,this.stop()}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews()}}endMoving(e,t){return this._startMovingPoint=null,this.start(),{indexesChanged:!1,pricesChanged:!1}}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._isChildStudy&&(0,s.ensureNotNull)(this._source).processHibernate(),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every(e=>e.isHibernationAllowed()))}maxOffset(){return this._maxOffset}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,s.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,s.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}isHibernated(){return!this.isVisible()&&!this.isStarted()}_createViews(){var e,t;this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._paneViews=[],this._labelPaneViews=[];const i=new Set,r=this.metaInfo(),n=Boolean(r.usePlotsZOrder),o=new Map;if(r.plots)for(let t=0;t{const i=this._properties.bands[t];if(i&&i.visible.value()){const t=new qe(i,this),r=n?(0,s.ensureDefined)(e.zorder):o.size;dt(r,o),o.set(r,{paneViews:[t]})}}),this._properties.bandsBackground&&((0,s.assert)(!n,"'usePlotsZOrder' flag does not supported"),o.set(o.size,{paneViews:[new $e(this)]}));const a=this._paneViews;(0,_.createGraphicsPaneViews)(this,this.model()).then(e=>{for(let t=0;tr.plots.some(t=>(0,I.isColorerPlot)(t)&&t.target===e);if(this._properties.filledAreas&&r.filledAreas)for(let e=0;ee-t);for(let e=0;e0?" ("+t+")":"")}_titleInParts(e,t,i,s){var n;const o=this.name(e);t=t||{};const a=[(0,r.t)(o,{context:"study"})];let l=[];if(!i){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&a.push(i);const r=this.metaInfo(),o=this._titleInputs(s,!0)||[];if(o.length>0){const i={};if(this._isChildStudy)for(let t=0;t=0&&this._source){const t=this._source.metaInfo(),r=this._source.title(e,{},!0,s);if(1===t.plots.length)i[l]=r;else{const e=l.split("$")[1],s=null===(n=t.plots[parseInt(e)])||void 0===n?void 0:n.id,o=t.styles&&t.styles[s],a=o&&o.title||s;i[l]=r+": "+a}}break}l=o.map(e=>{let s=(0,T.isNumber)(e)?this._numericFormatter.format(e):i&&i[e.toString()]||e.toString();return t&&t[s.toString()]&&(s=t[s.toString()]),s})}}return[a.join(" · "),l]}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;t"line"===e.type)}_hasAlertConditions(){if(this.metaInfo().plots.some(I.isAlertConditionPlot))return!0;const e=this.stateForAlert();return Boolean(e.alerts&&e.alerts.conditions)}_hasAlertFunction(){const e=this.metaInfo();return Boolean(e.hasAlertFunction)}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_allSymbolsAreResolved(){const e=this.metaInfo(),t=[];let i=!1;for(let s=0;sthis._symbolsResolved.fire()):e}return Promise.all(t).catch(e=>(this._setStatus({type:Xe.StudyStatusType.Error,errorDescription:{error:nt}}),this.stop(!0),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e))).then(()=>{null!==this._studyId&&this.stop(!0),this.start(!0),this._symbolsResolved.fire(), this._recheckLineToolsActuality()})}_getSymbolForApi(e){return e}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise((i,s)=>{this._onSymbolResolvingStart(),this._chartApi.resolveSymbol((0,w.makeNextSymbolId)(),e,r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":this._setStatus({type:Xe.StudyStatusType.Undefined}),this._resolvedSymbols[e]=r.params[1],this._resolvedSymbolsByInput[t]=r.params[1],this._onSymbolResolved(e,t,r.params[1]),this.invalidateTitleCache(!0),i();break;case"symbol_error":if(this._setStatus({type:Xe.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===P.permissionDenied&&r.params[2])switch(r.params[2]){case P.SymbolErrorPermissionDeniedReason.Symbol:if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i);break;default:return void this._resolveSymbol(r.params[2],t).then(i)}0,s()}})}),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach(e=>{e.ownerSource()===this&&e.calcIsActualSymbol()})}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){this._onCurrencyMayChange()}_onSymbolResolvingStart(){}_onSymbolError(){}_setStatus(e,t){var i;this._status=e,e.type===Xe.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==Xe.StudyStatusType.Error&&e.type!==Xe.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(e))}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;ivoid 0!==i[e],1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)}_onCurrencyChanged(){"alwaysOff"!==it().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_tryChangeInputs(){const e=(0,s.ensureDefined)((0,T.clone)(this._inputs));this.isStarted()&&this._chartApi.isConnected().value()?this._allInputsAreValid()?this._allSymbolsAreResolved().then(()=>{const t=this.inputs({keepOptionalSymbolsEmpty:!0}),i=JSON.stringify(t)!==JSON.stringify(this._inputs);this._isStopped()?i&&this.disablePriceRangeReady():i&&(this._changeInputsImpl(t,e),this._inputs=t)}).catch(e=>{rt.logError("ERROR: "+this._debugId()+" _tryChangeInputs: cannot modify study, "+e)}):this.stop():(this.stop(!0),this.start(!0)),this._tagsChanged.fire()}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_isStopped(){return!this.isStarted()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){const r=s.id,n=this.properties().styles[r],o=(0,I.isShapesPlot)(s)||(0,I.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,I.isArrowsPlot)(s);let a=(0,I.isLinePlot)(s)||(0,I.isOhlcPlot)(s);if(o){const e=n.location.value(),t=[m.MarkLocation.Absolute,m.MarkLocation.Top,m.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||o&&t,a=a||e===m.MarkLocation.Absolute}if(!a)return i;const l={name:r,offset:this.offset(r)},c=n.plottype.value();if(!this.properties().skipHistogramBaseOnAutoScale&&[I.LineStudyPlotStyle.Histogram,I.LineStudyPlotStyle.Columns,I.LineStudyPlotStyle.Area].indexOf(c)>=0){const s=n.histogramBase.value(),r=this.data().minMaxOnRangeCached(e,t,[l]);return(0,T.isNumber)(s)&&null!==r&&(i.baseValueMinMax=(0,d.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,d.mergeMinMax)(i.baseValueMinMax,r)),i}return i.fields.push(l),i}_fillPrecalculatedAutoscaleInfo(e,t){return this._metaInfo.plots.filter(e=>!(0,I.isPlotWithTechnicalValues)(e)).filter(e=>{const t=e.id;let i;if((0,I.isOhlcPlot)(e)){const t=e.target;i=this.properties().ohlcPlots[t]}else i=this.properties().styles[t];return i.visible.value()}).reduce((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_buildInputs(e){(0,s.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){rt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach(i=>{null!=t[i]&&(e[i]=t[i])}),e}{const e=[];return Object.keys(t).forEach(i=>{null!=t[i]&&e.push(t[i])}),e}}_prepareInput(e,t){ const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return[]}_dependenciesForAlerts(){throw new Error("Not implemented")}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,Ze.isActualInterval)(this._series.intervalObj(),this.properties().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this.source();if(e instanceof ut){const t=e.metaInfo();return t.is_price_study&&"Compare@tv-basicstudies"!==t.id?e._getNonPriceParent():e}return null}_updateInputValue(e,t){const i=this._properties.inputs;if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){var e;null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=null!==(e=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()])&&void 0!==e?e:null)}_initializeCurrencySource(){var e;const t=this.metaInfo(),i="symbolInputTargetCurrency"===(null===(e=t.targetCurrency)||void 0===e?void 0:e.type)&&t.targetCurrency.inputId,s=t.inputs.find(e=>e.id===i),r="symbol"===(null==s?void 0:s.type);if("string"==typeof i&&r&&t.is_price_study){const e=this._properties.inputs[i];null!=e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}}},32643:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>B});var s=i(16282),r=i(39951),n=i(25436),o=i(674),a=i.n(o),l=i(27490),c=i(84995),h=i(95426),d=i(77036);const u=l.enabled("force_exchange_as_title");class p extends h.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._studyCompare.priceScale(),r=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(r.noData||null===s||s.isEmpty())return;i.background=r.color,i.textColor=this.generateTextColor(r.color),i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const n=this._studyCompare.model().properties().childs().scalesProperties.childs();n.showSeriesLastValue.value()&&(e.text=(0,d.getCurrentModePriceText)(s,r),n.seriesLastValueMode.value()!==c.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,d.getOppositeModePriceText)(s,r),e.visible=!0),t.text="",n.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return u?e=(0,n.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0, n.displayedSymbolName)(t)),e}}i(79881);var _=i(74393),m=i(33033),g=i(15521),f=i(43367),v=i(47903),S=i(98460);class y extends S.StudyValuesProvider{constructor(e,t){super(e,t),this._emptyValues[0].title=e.guiPlotName("")}_hideValues(){return!1}}const b=f.CheckMobile.any();class w extends _.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new y(e,t)}_currentIndex(){const e=this._model.crossHairSource().lockedIndex;let t;return b&&(null===this._model.crossHairSource().pane&&void 0===e||(0,m.isLineToolName)(g.tool.value())||null!==this._model.lineBeingEdited())?t=this._study.data().lastIndex():(t=this._model.crossHairSource().appliedIndex(),(0,v.isNumber)(t)||(t=this._study.data().lastIndex())),t}}class P extends w{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC,this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._additional}_updateImpl(){super._updateImpl()}}var C=i(53289),T=i(39425);class x extends T.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(!0,void 0,!1,!1)}}var I=i(92898),M=i(32856),L=i.n(M);const A=l.enabled("study_overlay_compare_legend_option"),k=l.enabled("force_exchange_as_title"),E=l.enabled("uppercase_instrument_names"),D=!l.enabled("hide_study_compare_legend_item"),V=l.enabled("hide_unresolved_symbols_in_legend");class B extends r.Study{constructor(e,t,i,s){t.hasChild("currencyId")||t.addChild("currencyId",new(a())(null)),t.hasChild("unitId")||t.addChild("unitId",new(a())(null)),t.addExclusion("currencyId"),t.addExclusion("unitId"),super(e,t,i,s),this.properties().childs().minTick.subscribe(null,()=>this._recreatePriceFormattingDependencies()),this.properties().childs().minTick.subscribe(null,()=>this._model.fullUpdate()),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this.properties().merge({skipHistogramBaseOnAutoScale:!0}),this._symbolResolvingActive=new(L())(!1),this._symbolHibernated=new(L())(!1)}properties(){return super.properties()}createPriceAxisView(e){return new p(this,{plotIndex:"compare"})}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){return this._properties.inputs.symbol.value()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.inputs.symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){ return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,I.symbolSameAsCurrent)(e,this.symbol(),this.symbolInfo())}currency(){return this._properties.currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,n.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this._properties.unitId.value()||null}setUnit(e){this._properties.unitId.setValue(e)}isConvertedToOtherUnit(){return(0,n.isConvertedToOtherUnit)(this.symbolInfo())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}state(e,t){const i=super.state(e,t);return e&&((0,s.ensureDefined)(i.data).symbols={___snapshot:this.symbolInfo()||void 0}),i}symbolTitle(e,t){return this.title(!0,{},!1,e)}titleInParts(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return[E?r.toUpperCase():r]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return D?super.statusView():null}guiPlotName(e){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}valuesProvider(){return new y(this,this.model())}statusProvider(e){return new x(this,this._model.properties().childs().scalesProperties.childs().textColor)}_createViews(){this._legendView||(this._legendView=new P(this,this._model)),this._dataWindowView||(this._dataWindowView=new w(this,this._model)),this._statusView||(this._statusView=new C.StudyStatusView(this)),super._createViews()}_showLastValueOnPriceScale(){return this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.value()}_onUnitChanged(){this._model.properties().childs().scalesProperties.childs().showUnit.value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return null!==s&&(t["unit-id"]=s),t}_getSymbolForApi(e){return(0,n.symbolForApi)(this._resolvedSymbolsByInput[e]||null,e)}_onSymbolResolvingStart(){super._onSymbolResolvingStart(),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,n.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,n.symbolCurrency)(i),o=(0,n.symbolUnit)(i);this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:o},i),this.model().realignLineTools(),this._symbolResolvingActive.setValue(!1)}_changeInputsImpl(e,t){super._changeInputsImpl(e,t),e.symbol!==t.symbol&&this._model.realignLineTools()}_createStudyOnServer(){super._createStudyOnServer(),this._model.realignLineTools()}_tryCreateFormatter(){const e=this.symbolInfo();return(0, n.createSeriesFormatter)(e,this.properties().childs().minTick.value())}_titleInParts(e,t,i,s){const r=this.properties().childs().inputs.childs().symbol.value(),n=this.symbolInfo(),o=n&&n.exchange&&0!==n.exchange.length;let a;if(k&&o&&n)a=n.exchange;else if(n){if(a=n.name,A)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":a=n.description;break;case"ticker-and-description":a=`${n.name}, ${n.description}`}else if(o&&!s)return[a,[n.exchange]]}else a=V?"":r;return[a]}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),c=o.unitId.value();if(void 0!==i&&i!==a&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&s!==l&&o.currencyId.setValueSilently(s),void 0!==r&&r!==c&&o.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,n.symbolCurrency)(e)),o.unitId.setValueSilently((0,n.symbolUnit)(e)))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol),o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId),o.unitId.value()!==c&&o.unitId.listeners().fire(o.unitId)}}},82755:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>A});var s=i(16282),r=i(43367),n=i(65447),o=i(39951),a=i(18213),l=i(25436),c=i(674),h=i.n(c),d=i(89164),u=i(27490),p=i(84310),_=i(92898),m=i(6195),g=i(1467),f=i(61627),v=i(47903),S=i(25303),y=i(32856),b=i.n(y);const w=r.CheckMobile.any()&&!1,P=u.enabled("uppercase_instrument_names"),C=u.enabled("study_overlay_compare_legend_option"),T=u.enabled("secondary_series_extend_time_scale"),x=u.enabled("hide_unresolved_symbols_in_legend"),I=!u.enabled("hide_study_overlay_legend_item"),M=(0,n.getLogger)("Chart.StudyOverlay");function L(e,t){return null==e[t]}class A extends o.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new(h())(null)),e.hasChild("unitId")||e.addChild("unitId",new(h())(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._quotesProvider=new p.QuotesProvider,this._seriesSource=null,this._symbolResolvingActive=new(b())(!1),this._symbolHibernated=new(b())(!1),this._styleToRecover=null,this.m_data=new f.PlotList((0,a.seriesPlotFunctionMap)(),L),w&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged),r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(), this._formatter=null}destroy(){super.destroy()}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.inputs.symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}supportsPressedChunks(){return!1}pressedChunks(e,t){throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,_.symbolSameAsCurrent)(e,this.symbol(),this.symbolInfo())}priceSource(){switch(this._properties.style.value()){case 2:return this._properties.lineStyle.priceSource.value();case 3:return this._properties.areaStyle.priceSource.value();case 10:return this._properties.baselineStyle.priceSource.value()}return null}barFunction(){return this._barFunction}quotes(){return this._quotesProvider.quotes()}currency(){return this._properties.currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,l.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this._properties.unitId.value()||null}setUnit(e){this._properties.unitId.setValue(e)}isConvertedToOtherUnit(){return(0,l.isConvertedToOtherUnit)(this.symbolInfo())}style(){return this.properties().childs().style.value()}setStyle(e){this.properties().childs().style.setValue(e)}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}state(e,t){const i=super.state(e,t);return e&&((0,s.ensureDefined)(i.data).symbols={___snapshot:this.symbolInfo()||void 0}),i}symbolTitle(e,t){return this.title(!0,{},!1,e)}title(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return P?r.toUpperCase():r}titleInParts(e,t,i,s){const r=this._titleInParts(e,t,i,s).join(", ");return[P?r.toUpperCase():r]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,f.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==i?this._barFunction(i.value):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s ;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),f.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s;const c=this._lastNonEmptyPlotRow(4),h=null!==c&&n.contains(c.index),d=null!==c?c.value:null,u=t||h?d:this.data().valueAt(a);if(null===u)return s;const p=this._barFunction(u);if(!(0,v.isNumber)(p))return s;const _=r.priceToCoordinate(p,l);let m;switch(o.style.value()){case 0:m=u[1]<=u[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:case 9:m=u[1]<=u[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 2:m=o.lineStyle.childs().color.value();break;case 3:m=o.areaStyle.childs().color1.value();break;case 10:{const e=o.baselineStyle.childs();m=_{this._onStudyError(this._convertSeriesErrorToStudy(e))}),e.loading().subscribe(this,this._onStudyLoading),e.completed().subscribe(this,(e,t)=>{this._onStudyCompleted(t)}),e.dataUpdated().subscribe(this,()=>{this._studyModified=!1;const e=this._model.paneForSource(this);this._model.recalculatePane(e),this._updateSources(),this.priceRangeReady()||this._enablePriceRangeReady()})}else{if(null!==this._seriesSource){const e=this._seriesSource.dataEvents();e.seriesError().unsubscribeAll(this),e.loading().unsubscribeAll(this),e.completed().unsubscribeAll(this),e.dataUpdated().unsubscribeAll(this),this._seriesSource.destroy()}this._seriesSource=null}e&&this.start(!0)}_convertSeriesErrorToStudy(e){return{error:e.error,ctx:e.ctx,solution_id:e.solution_id}}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),c=o.currencyId.value(),h=o.unitId.value(),d=o.style.value() ;if(void 0!==i&&i!==a&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&s!==c&&o.currencyId.setValueSilently(s),void 0!==r&&r!==h&&o.unitId.setValueSilently(r),void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,l.symbolCurrency)(e)),o.unitId.setValueSilently((0,l.symbolUnit)(e)))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol),o.currencyId.value()!==c&&o.currencyId.listeners().fire(o.currencyId),o.unitId.value()!==h&&o.unitId.listeners().fire(o.unitId),o.style.value()!==d&&o.style.listeners().fire(o.style),this._checkStyle()}_updateBarFunction(){var e;const t=null!==(e=this.priceSource())&&void 0!==e?e:"close";this._barFunction=(0,a.barFunction)(t)}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,l.isCloseBasedSymbol)(this.symbolInfo())?(0,l.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}}},79270:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>r});var s=i(95426);class r extends s.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.model(),r=this._source.priceScale();if(null===r)return;if(!s.isPriceScaleVisible(r))return;const n=this._source.lastValueData(this._data.plotIndex,!1);if(n.noData)return;i.background=n.color;let o=n.color;"transparent"===o&&(o=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(o),i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate,this._showAxisLabel()&&(e.text=n.text,e.visible=!0),this._updatePaneRendererData(t)}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().showLabelsOnPriceScale.value()}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().showLabelsOnPriceScale.value()}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},70635:(e,t,i)=>{"use strict";i.d(t,{applyOverridesToStudy:()=>c,applyOverridesToStudyDefaults:()=>h});var s=i(16282),r=i(77455);const n=(0,i(65447).getLogger)("Chart.Model.StudyPropertiesOverrider");var o,a;function l(e,t,i,s){const r=i.split(".");if(0===r.length||0===r[0].length)return;const l=function(e){const t=e.split(":");return{name:t[0],type:2===t.length?t[1]:null} }(r[0]),c=l.name,h=l.type,d=null!==h,u=!d||"band"===h,p=!d||"area"===h,_=!d||"input"===h,m=!d||"plot"===h?a.getPlotIdByTitle(e,c):null,g=u?a.getBandIndexByName(e,c):null,f=p?a.getFilledAreaIdByTitle(e,c):null,v=_?a.getInputByName(e,c):null,S=t.hasOwnProperty(c);if((null!==m?1:0)+(null!==g?1:0)+(null!==f?1:0)+(null!==v?1:0)+(S?1:0)>1)return void n.logWarn(`Study '${e.description}' has ambiguous identifier '${c}'`);const y=r[1];if(null!==m){if(1===r.length)return void n.logWarn(`Path of sub-property of '${c}' plot for study '${e.description}' must be not empty`);const i=r.slice(1);o.applyPlotProperty(e,t,m,i,s)}else if(null!==v)o.applyInputValue(t,v,s);else if(null!==g){if(void 0===y)return void n.logWarn(`Property name of '${c}' band for study '${e.description}' must be set`);o.applyBandProperty(t,g,y,s)}else if(null!==f){if(void 0===y)return void n.logWarn(`Property name of '${c}' area for study '${e.description}' must be set`);o.applyFilledAreaProperty(t,f,y,s)}else S?o.setRootProperty(t,r,s):n.logWarn(`Study '${e.description}' has no plot or input '${c}'`)}function c(e,t){const i=e.properties(),s=i.state();for(const i in t)t.hasOwnProperty(i)&&l(e.metaInfo(),s,i,t[i]);i.mergeAndFire(s)}function h(e,t,i){for(const s in e){if(!e.hasOwnProperty(s))continue;const r=s.indexOf(".");if(-1===r)continue;const o=s.substring(0,r),c=a.getMetaInfoByDescription(t,o);if(null===c){n.logWarn("There is no such study "+o);continue}const h=i(c);null!==h?l(c,h,s.substring(r+1),e[s]):n.logWarn("Cannot apply overrides for study "+o)}}!function(e){const t={line:r.LineStudyPlotStyle.Line,histogram:r.LineStudyPlotStyle.Histogram,cross:r.LineStudyPlotStyle.Cross,area:r.LineStudyPlotStyle.Area,columns:r.LineStudyPlotStyle.Columns,circles:r.LineStudyPlotStyle.Circles,line_with_breaks:r.LineStudyPlotStyle.LineWithBreaks,area_with_breaks:r.LineStudyPlotStyle.AreaWithBreaks};e.applyPlotProperty=function(e,i,o,a,l){if(void 0===i.styles)return void n.logWarn("Study does not have styles");const c=a[0];if("color"===c){return void function(e,t,i,r,o){if(void 0!==e.styles)if(null===t&&!isNaN(r)&&r>0)n.logWarn("Study plot does not have color #"+r);else{if(0===r||isNaN(r)){(0,s.ensureDefined)(e.styles[i]).color=String(o),r=0}null!==t&&((0,s.ensureDefined)(t.colors[r]).color=String(o))}else n.logWarn("Study does not have styles")}(i,function(e,t,i){if(void 0===e.plots)return null;for(const s of e.plots){if(!(0,r.isColorerPlot)(s)||void 0===t.palettes)continue;const e=t.palettes[s.palette];if(s.target===i&&void 0!==e)return e}return null}(e,i,o),o,a.length>1?parseInt(a[1]):NaN,l)}const h=i.styles[o];if(void 0!==h&&h.hasOwnProperty(c)){if("plottype"===c){const e=t[String(l)];if(void 0===e)return void n.logWarn("Unsupported plot type for plot: "+l);l=e}h[c]=l}else n.logWarn(`Study plot does not have property '${c}'`)},e.applyBandProperty=function(e,i,s,r){if(void 0===e.bands)return void n.logWarn("Study does not have bands");const o=e.bands[i];if(void 0!==o&&o.hasOwnProperty(s)){if("plottype"===s){const e=t[String(r)] ;if(void 0===e)return void n.logWarn("Unsupported plot type for band: "+r);r=e}o[s]=r}else n.logWarn(`Study band does not have property '${s}'`)},e.applyFilledAreaProperty=function(e,t,i,s){if(void 0===e.filledAreasStyle)return void n.logWarn("Study does not have areas");const r=e.filledAreasStyle[t];void 0!==r&&r.hasOwnProperty(i)?r[i]=s:n.logWarn(`Study area does not have property '${i}'`)},e.applyInputValue=function(e,t,i){void 0!==e.inputs&&e.inputs.hasOwnProperty(t)?e.inputs[t]=i:n.logWarn(`Study does not have input '${t}'`)},e.setRootProperty=function(e,t,i){if(0===t.length)return;let s=e;for(const e of t.slice(0,-1)){if(null==s||!s.hasOwnProperty(e))break;s=s[e]}const r=t[t.length-1];null!=s&&s.hasOwnProperty(r)?s[r]=i:n.logWarn("Study does not have property "+t.join("."))}}(o||(o={})),function(e){e.getInputByName=function(e,t){if(void 0===e.inputs)return null;t=t.toLowerCase();for(const i of e.inputs)if(i.name.toLowerCase()===t)return i.id;return null},e.getPlotIdByTitle=function(e,t){if(void 0===e.styles)return null;t=t.toLowerCase();for(const i in e.styles){const s=e.styles[i];if((void 0!==s&&void 0!==s.title?s.title:i).toLowerCase()===t)return i}return null},e.getFilledAreaIdByTitle=function(e,t){if(void 0===e.filledAreas)return null;t=t.toLowerCase();for(const i of e.filledAreas)if(i.title.toLowerCase()===t)return i.id;return null},e.getBandIndexByName=function(e,t){if(void 0===e.bands)return null;t=t.toLowerCase();for(let i=0;i{"use strict";var s=i(674),r=i(5729),n=i(16282).assert,o=i(66096).unpackNonSeriesData,a=i(25436).symbolTitle,l=i(36559).StudyBarColorer,c=i(79270).StudyPriceAxisView,h=i(19625),d=h.emptyStudyGraphics,u=h.loadStudyGraphics,p=h.LiveStudyGraphics,_=h.createGraphicsPriceAxisViews,m=i(85060).ChartApiInterface,g=i(11092).DefaultProperty,f=i(59104).PriceFormatter,v=i(76559).VolumeFormatter,S=i(62159).PercentageFormatter,y=i(61627).PlotList,b=i(85062),w=i(18437),P=i(77455),C=P.LineStudyPlotStyle,T=i(46556).StudyPriceLineAxisView,x=i(28676).studyPlotFunctionMap,I=i(28676).studyEmptyPlotValuePredicate,M=i(1049).makeNextStudyId,L=i(27490),A=i(19429).StudyBase,k=i(47329).InvalidationMask,E=i(73748),D=i(81694).IntervalsVisibilitiesProperty,V=E.StudyStatusType,B=(E.convertStudyStatusToString,i(50968).colorToInteger),N=i(25220).intervalsVisibilitiesDefaults,R=i(65447).getLogger("Chart.Study"),O=L.enabled("datasource_copypaste"),F=L.enabled("study_symbol_ticker_description"),W=L.enabled("hide_unresolved_symbols_in_legend");function H(e,t,i){var s=new g(t,i,!0);s.removeProperty("intervalsVisibilities"),s.addChild("intervalsVisibilities",new D(i&&i.intervalsVisibilities)),s.addExclusion("visible"),s.addExclusion("precision"),s.addExclusion("minTick"),s.addExclusion("intervalsVisibilities");for(var r=0;r=0?c:l}return l}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===i)return this._metaInfo.defaults.inputs.text;if("pineId"===i)return this._metaInfo.scriptIdPart;if("pineVersion"===i)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){var h=this._properties.inputs[i].value();return B(h)}if("price"===e.type){var d=this._properties.inputs[i].value();return t.priceInputsForDisplay?this.formatter().format(d):d}return this._properties.inputs[i].value()}return this._properties.inputs[i].value()}_rebindToSource(e,t){var i=this.parentSource();if(this._isChildStudy){var s;this._source.unsetChild(this);var r=null;if(e===this._model.mainSeries())this._source=null,this._isChildStudy=!1,this._ownerSource=null,s=this._series.seriesSource().instanceId(),r=m.REBIND_STUDY_CHILD_TO_STANDALONE;else{if(!(e instanceof j))return R.logError("Unable to rebind study to source of this type"),!1;this._ownerSource=e,this._source=e,s=this._source.sourceId(),this._source.setChild(this),this._source.isHibernated()&&this._source.start()}this._incrementTurnaround(),this.disablePriceRangeReady(),this._chartApi.rebindStudy(this._studyId,this._turnaround,s,this._studyName,t,this._handler,r)}else{if(!(e instanceof j))return R.logError("Unable to rebind study to source of this type"),!1 ;var n=e.isHibernated();n&&e.start();var o=!1;if(this._canCreateStudyWithRebindType(m.REBIND_STUDY_STANDALONE_TO_CHILD)&&(this._incrementTurnaround(),this.disablePriceRangeReady(),o=this._chartApi.rebindStudy(this._studyId,this._turnaround,e.sourceId(),this._studyName,t,this._handler,m.REBIND_STUDY_STANDALONE_TO_CHILD)),!o)return n&&e.stop(),!1;this._isChildStudy=!0,this._ownerSource=e,this._source=e,this._source.setChild(this),this._childStudyByRebind.fire()}var a=this.m_priceScale,l=e.priceScale();if(a!==l){var c=this._model.paneForSource(this),h=this._model.paneForSource(e);c===h&&h.move(this,l,!0)}const d=this.parentSource();return i.formatterChanged().unsubscribe(this,this._onSourceFormatterChanged),d.formatterChanged().subscribe(this,this._onSourceFormatterChanged),i.priceStepChanged().unsubscribe(this,this._onSourcePriceStepChanged),d.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),i.currencyChanged().unsubscribeAll(this),d.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),i.unitChanged().unsubscribeAll(this),d.unitChanged().subscribe(this,this._onSourceUnitChanged),i.priceRangeReadyChanged().unsubscribeAll(this),d.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),this._recreatePriceFormattingDependencies(),!0}childStudyByRebind(){return this._childStudyByRebind}_changeInputsImpl(e,t){var i=this.source(),s=this._properties.inputs&&this._properties.inputs.state(),r=b.getSourceIdByInputs(this._metaInfo.inputs,s),n=!0;if(r)if("high"===r||"open"===r||"low"===r||"close"===r||"hl2"===r||"ohl3"===r||"ohlc4"===r)i=this._model.mainSeries();else for(var o=this._model.dataSources().filter((function(e){return e instanceof j&&e.canHaveChildren()})),a=0;a0){var s=this.barColorer().firstColoredBar(e[0].index);this._model.mainSeries().invalidateBarStylesCache(s)}null!==t&&this._postProcessGraphics();var r=this._model.paneForSource(this);this._model.recalculatePane(r),this._updateSources()}transformData(e){}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then(function(){this._invalidateLastNonEmptyPlotRowCache(),this.data().move(e)}.bind(this))}replaceData(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(i,t)}_updateSources(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}static processPlotOffsets(e,t){t&&t.indexes_replace||(e._plotOffsets=t&&t.offsets||{},e._updateMaxOffsetValue())}_processPlotOffsets(e){j.processPlotOffsets(this,e)}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache(),this.data().merge(e)}_postProcessGraphics(){this._graphicsPriceAxisViews=_(this),this._concatPriceAxisViews()}static offset(e,t){var i=0;return e._plotOffsets&&void 0!==e._plotOffsets[t]&&(i+=e._plotOffsets[t]),e.properties().offsets&&void 0!==e.properties().offsets[t]&&(i+=e.properties().offsets[t].val.value()),e.properties().offset&&(i+=e.properties().offset.val.value()),i}offset(e){return j.offset(this,e)}labelPaneViews(){return this.isSourceHidden()?null:this._labelPaneViews}_showLastValueOnPriceScale(){return this._model.properties().scalesProperties.showStudyLastValue.value()}hasBarColorer(){for(var e=0;e=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_sendTelemetryReport(e,t,i){void 0===i&&(i=this._getTelemetryAdditionalData());var s=Object.assign(t,{additional:i});(void 0).sendChartReport(e,s)}_sendTelemetryCounter(e,t){this._sendTelemetryReport(e,{count:1},t)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}destroy(){this._aboutToBeDestroyed.fire(),this._isDestroyed=!0,null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._properties.precision.listeners().unsubscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.listeners().unsubscribe(this,this.invalidateTitleCache),this._properties.description.listeners().unsubscribe(this,this.invalidateTitleCache),this._properties.shortDescription&&this._properties.shortDescription.listeners().unsubscribe(this,this.invalidateTitleCache),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this),this._properties.showInDataWindow.listeners().unsubscribe(this._model,this._model.fullUpdate),this.hasBarColorer()&&this._properties.visible.listeners().unsubscribe(this._model.mainSeries(),this._model.mainSeries().invalidateBarStylesCache),this._model.mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._recreatePriceFormattingDependencies),void 0!==this._properties.offsets&&this._properties.offsets.listeners().unsubscribe(this,this._updateMaxOffsetValue),void 0!==this._properties.offset&&this._properties.offset.listeners().unsubscribe(this,this._updateMaxOffsetValue),super.destroy()}desiredPriceScalePosition(){return this.metaInfo().isTVScriptStub?"overlay":this.metaInfo().linkedToSeries?"as-series":void 0===this.metaInfo().priceScale?null:["right","left","overlay"][this.metaInfo().priceScale]}guiPlotName(e){var t=this.properties().styles;return t&&t[e]&&t[e].title?t[e].title.value():this.title()}formatterChanged(){return this._formatterChanged}copiable(){return O&&!this.isChildStudy()}setPriceScale(e){super.setPriceScale(e),w.emit("study_event",this.id(),"price_scale_changed")}getStudyName(){return this._studyName}}TradingView.Study=j,t.Study=j,t.prepareStudyProperties=function(e,t,r,o,a){return function(e,t,r,o,a,l){var c=function(e,t,r,o){var a=i(65618);if(b.versionOf(e)<1)throw new Error("This function cannot work with metainfo of the old format version. Required format version >= 1");var l=TradingView.clone(defaults("study")) ;z(l,e);var c=b.getStudyPropertyRootName(e),h=TradingView.clone(defaults(c,o));h.intervalsVisibilities=TradingView.clone(N),("Overlay"===e.shortId||"Compare"===e.shortId)&&(h.currencyId=null,h.unitId=null);e.isTVScript&&e.TVScriptSourceCode!==h.TVScriptSourceCode&&(h=TradingView.clone(TradingView.factoryDefaults(c,o)));TradingView.merge(l,h),t&&(n(!(t instanceof s),"propsState should not be an instance of Property"),TradingView.merge(l,t));var d=TradingView.clone(e),u={};a.mergeInputsObjPart(u,d.defaults.inputs),a.mergeInputsObjPart(u,l.inputs),l.inputs=u,delete d.inputs,delete d.defaults.inputs;var p={};if(TradingView.merge(p,d.defaults),TradingView.merge(p,TradingView.factoryDefaults(c)),TradingView.merge(p,l),TradingView.merge(p,d),delete p.defaults,l=p,null!==r){var _=r.model().studiesColorRotatorFactory().getColorRotator(e);null!==_&&("Overlay@tv-basicstudies"===e.id?l.lineStyle.color=_.getColor(l.lineStyle.color,e):TradingView.merge(l,function(e,t){for(var i in e.styles){var s=e.styles[i].color;s&&(e.styles[i].color=t.getColor(s))}return e}(l,_)))}t&&TradingView.merge(l.styles,t.styles);return l}(e,t,r,o),h=b.getSourceInputIds(e);if(h.length>0){var d=h[0];l instanceof j?c.inputs[d]="{pid}$0":void 0!==c.inputs[d]&&-1!==c.inputs[d].indexOf("$")&&(c.inputs[d]="close")}return H(e,a,c)}(e,t,r,o,b.getStudyPropertyRootName(e),a)},t.prepareStudyPropertiesForLoadChart=function(e,t,s,r,n,o){return function(e,t,s,r,n,o,a){var l=function(e,t,s,r,n,o){var a=i(65618);e.version&&s.version&&e.version!==s.version&&R.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+s.version);var l=TradingView.clone(defaults("study"));l.intervalsVisibilities=TradingView.clone(N),TradingView.merge(l,TradingView.factoryDefaults(b.getStudyPropertyRootName(e))),z(l,e),TradingView.merge(l,s),l=n.updateStudyState(l,e,t),void 0!==o&&(l=o(s,l,e,t));var c=TradingView.clone(t||e);if(c&&b.versionOf(c)>=1){var h={};a.mergeInputsObjPart(h,(c.defaults||{}).inputs),a.mergeInputsObjPart(h,l.inputs),l.inputs=h,delete c.inputs,c.defaults&&delete c.defaults.inputs;var d={};TradingView.merge(d,c.defaults),TradingView.merge(d,TradingView.factoryDefaults(b.getStudyPropertyRootName(c))),TradingView.merge(d,l),delete c.defaults,TradingView.merge(d,c),l=d}return l}(e,t,s,0,n,a);return H(t||e,o,l)}(e,t,s,0,n,b.getStudyPropertyRootName(e),o)}},13618:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(79881);const r={shape_arrow_down:{guiName:(0,s.t)("Arrow Down"),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:(0,s.t)("Arrow Up"),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:(0,s.t)("Circle"),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:(0,s.t)("Cross"),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:(0, s.t)("Diamond"),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:(0,s.t)("Flag"),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:(0,s.t)("Label Down"),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:(0,s.t)("Label Up"),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:(0,s.t)("Square"),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:(0,s.t)("Triangle Down"),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:(0,s.t)("Triangle Up"),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:(0,s.t)("X Cross"),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},40976:(e,t,i)=>{"use strict";var s=i(36054).Version,r=i(65447).getLogger("Chart.StudyMigration");function n(e){this._studyId=e,this._maxToVers=s.ZERO,this._maxFromVers=s.ZERO,this._migrs=[]}n.prototype.addMigration=function(e,t,i){var r=s.parse(e),n=s.parse(t);r.isGreater(this._maxFromVers)&&(this._maxFromVers=r),n.isGreater(this._maxToVers)&&(this._maxToVers=n),this._migrs.push({fromVers:r,toVers:n,rules:i})},n.prototype.updateInputs=function(e,t,i){if(!i)return i;for(var s=TradingView.clone(i),n=e;n.isLess(t);){var o=this._findMigration(n);if(null==o)break;if(r.logNormal("Migrating study inputs from "+o.fromVers+" to "+o.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(o)+", inputs: "+JSON.stringify(i)),s=this._applyMigration(s,o),!n.isLess(o.toVers))throw new Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");n=o.toVers}return n>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(s)),s},n.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,s=0;s=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw new Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return it.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw new Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},33508:(e,t,i)=>{"use strict";var s=i(72927).Point,r=i(95975).Series,n=i(39951).Study,o=i(86447).OverlayPriceAxisView,a=i(13114).PanePriceAxisView,l=i(90887),c=l.SeriesAreaPaneView,h=l.SeriesLinePaneView,d=l.SeriesHollowCandlesPaneView,u=l.SeriesCandlesPaneView,p=l.SeriesBarsPaneView,_=l.SeriesBaselinePaneView,m=i(49418).SeriesWaterlinePaneView,g=i(53289).StudyStatusView,f=i(83853).OverlayDataWindowView,v=i(41268).OverlayLegendView,S=i(38318).OverlayLegendValuesProvider,y=i(72494).OverlayStatusProvider,b=i(36559).SeriesBarColorer,w=i(29982).HorizontalLineRenderer,P=i(85630).OverlayStudyPriceLineAxisView,C=i(82755).StudyOverlayBase;class T{constructor(e,t){this._source=e,this._model=t,this._points=[new s(0,0)],this._lineRenderer=new w}update(){if(this._visible=!1,this._source.properties().showPriceLine.value()){var e=this._source.lastValueData(void 0,!0);e.noData||(this._visible=!0,this._points=[new s(0,e.coordinate)],this._color=e.color)}}renderer(){var e={};return e.width=this._model.timeScale().width(),e.height=this._source.priceScale().height(),e.y=this._points[0].y,e.color=this._color,e.linewidth=1,e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.visible=this._visible,this._lineRenderer.setData(e),this._lineRenderer}}t.study_Overlay=class extends C{constructor(e,t,i,s){super(e,t,i,s),this._paneView=null;var r=this ;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()}))}_showLastValueOnPriceScale(){return this._model.properties().scalesProperties.showSeriesLastValue.value()}_createViews(){this._priceAxisViews=[];var e=new o(this);this._priceAxisViewsBase=[e];var t=new P(this);this._priceLinesAxisViews=[t],this._paneViews=[],this._labelPaneViews=[];var i=null,s=null;switch(this._properties.style.value()){case r.STYLE_BARS:s=new p(this,this._model);break;case r.STYLE_CANDLES:s=new u(this,this._model);break;case r.STYLE_HOLLOW_CANDLES:s=new d(this,this._model);break;case r.STYLE_LINE:s=new h(this,this._model);break;case r.STYLE_AREA:s=new c(this,this._model);break;case r.STYLE_BASELINE:s=new _(this,this._model),i=new m(this)}s&&this._paneViews.push(s),null!==i&&this._paneViews.push(i),this._paneViews.push(new T(this,this._model)),this._dataWindowView||(this._dataWindowView=new f(this,this._model)),this._legendView||(this._legendView=new v(this,this._model)),this._statusView||(this._statusView=new g(this)),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews),this._labelPaneViews.push(new a(e,this,this._model))}barColorer(){return new b(this)}_tryChangeInputs(){n.prototype._tryChangeInputs.call(this),this.m_formatter=null,this.priceScale().updateFormatter()}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}tags(){var e=[],t=this.symbolInfo();return t?e.push(t.name):this._properties.inputs.symbol.value()&&e.push(this._properties.inputs.symbol.value()),e}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8680),i.e(7371),i.e(5019),i.e(607)]).then(i.bind(i,28603))).StudyOverlayDefinitionsViewModel}defaultPlotIdForAlert(){return""}changeStyles(){this.data().each((function(e,t){t[TradingView.STYLE_PLOT]=null})),n.prototype.changeStyles.call(this)}valuesProvider(){return new S(this,this.model())}statusProvider(e){return new y(this,this.model())}}},17404:(e,t,i)=>{"use strict";var s=i(16282).assert,r=i(47903).clone,n=i(39951).Study,o=i(61627).PlotList,a=i(28676).studyPlotFunctionMap,l=i(28676).studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var d=!1;s&&(d=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),d?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}} t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this.m_data=new o(a(this._metaInfo),l));var i=this.m_data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this.m_data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this.m_data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},65618:(e,t,i)=>{"use strict";var s=i(16282).assert,r=i(36054).Version,n=i(65447).getLogger("Chart.Study.Versioning"),o=i(42971),a=i(85062),l=i(36413).extractPineId,c=i(6345).migrateMetaInfoAndPropState;function h(e,t){if(!e)throw new Error("No studies metainfo");var s=i(40976);if(this._studiesMetainfo=e,!t)throw new Error("No studies migrations");this._studiesMigrations=t,this._migrations={};for(var r=0;r=22)return t;for(var i={},s=0,r=0;;){var n=t[r];if(void 0===n)break;var o=t[n.id];n.isFake&&(n.id="in_"+s++),i[r]=n,i[n.id]=o,r++}return i}]}h.prototype.updateMetaInfo=function(e){if(!e)return e;s(!e.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync");for(var t=null,i=this._studiesMetainfo,r=0;r=12&&l<=26){var c={};for(o=0;o=12&&c<=26){var d=r.columns;r.columns=[];for(var u=0;ut&&n.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description))}},h._fixInputsMaxValue=function(e,t){if(!TradingView.isAbsent(t)){var i=h.INPUT_MAX_VALUE;if(t.inputs)for(var s=0;si&&(a.max=i))}if(e&&e.inputs){var r=h.splitInputs(e.inputs),n=r.arr;for(var o in n){var a;"integer"===(a=n[o]).type&&(a.max&&a.max>i&&(a.max=i))}e.inputs=TradingView.merge(r.obj,r.arr)}}},h.prototype.patchPropsStateAndMetaInfo=function(e,t,i){"Script$BOOKER"!==t.productId||t.alerts||delete e.alerts, h._fixInputsOrder(e,t),h._fixInputsMaxValue(e,t);var s=h.splitInputs(e.inputs);e.inputs=s.obj;var r=a.versionOf(t);ri&&(i=r))}e[i+1]=t},h.splitInputs=function(e){var t={},i={};for(var s in e)isNumber(parseInt(s,10))?t[s]=e[s]:i[s]=e[s];return{arr:t,obj:i}},h.findInputKeyById=function(e,t){var i=null;for(var s in e)if(isNumber(parseInt(s,10))&&e[s].id===t){i=s;break}return i},h.getInputKeyById=function(e,t){var i=h.findInputKeyById(e,t);if(!i)throw new Error("Cannot find input with id: "+t);return i},e.exports=h},92898:(e,t,i)=>{"use strict";i.d(t,{areEqualSymbols:()=>r,symbolSameAsCurrent:()=>o});const s=i(27490).enabled("uppercase_instrument_names");function r(e,t){ return void 0===e?void 0===t:void 0!==t&&(s?e.toUpperCase()===t.toUpperCase():e===t)}function n(e,t){return e.some(e=>r(t,e))}function o(e,t,i){if(r(t,e))return!0;if(i){if(r(i.full_name,e)||r(i.pro_name,e))return!0;if(r(i.ticker,e))return!0;if(i.aliases&&n(i.aliases,e))return!0;if(i.alternatives&&n(i.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&r(i.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}},92137:(e,t,i)=>{"use strict";i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this._getMetrics(e,t).width}yMidCorrection(e,t){const i=this._getMetrics(e,t);return((i.actualBoundingBoxAscent||0)-(i.actualBoundingBoxDescent||0))/2}_getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t);return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},12234:(e,t,i)=>{"use strict";var s=i(5729);function r(){this._marksByIndex=new Map,this._marksBySpan=[],this.changed=new s,this.minIndex=void 0,this.maxIndex=void 0}r.prototype.reset=function(){this._resetImpl(),this.changed.fire()},r.prototype._resetImpl=function(){this._marksByIndex=new Map,this._marksBySpan=[],this.minIndex=void 0,this.maxIndex=void 0,this._cache=void 0},r.prototype.merge=function(e){if(0!==e.length){var t=e[0].index,i=e[e.length-1].index;t<=this.minIndex&&i>=this.maxIndex&&this._resetImpl();for(var s=this._marksBySpan,r=new Set,n=0;n=this.maxIndex&&this.maxIndex--,this.maxIndex2;){if(1e3*this._marksByIndex.get(t).time===e)return t;if(1e3*this._marksByIndex.get(i).time===e)return i;var s=Math.round((t+i)/2);1e3*this._marksByIndex.get(s).time>e?i=s:t=s}return t},r.prototype.build=function(e,t){var i=Math.ceil(t/e);if(this._maxbar===i&&this._cache)return this._cache;this._maxbar=i;for(var s=[],r=this._marksBySpan.length;r--;)if(this._marksBySpan[r]){var n=s;s=[];for(var o=n.length,a=0,l=this._marksBySpan[r],c=l.length,h=1/0,d=-1/0,u=0;u=i&&_-d>=i&&(s.push(p),d=_)}for(;a{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(50968),r=i(16932);class n{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=t.font;const n=Math.round(t.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=t.paddingHorizontal,a=n+2*o,l=a/2;let c=s.coordinate,h=Math.floor(c-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(c+=Math.abs(0-h),h=Math.floor(c-l)+.5):h+a>e&&(c-=Math.abs(e-(h+a)),h=Math.floor(c-l)+.5)}const d=h+a,u=Math.ceil(0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const p=Math.round(h*i),_=Math.round(0*i),m=Math.round(d*i),g=Math.round(u*i),f=Math.round(2*i);e.beginPath(),e.moveTo(p,_),e.lineTo(p,g-f),e.arcTo(p,g,p+f,g,f),e.lineTo(m-f,g),e.arcTo(m,g,m,g-f,f),e.lineTo(m,_),e.fill();const v=0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const S=t.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*i,(v+S)*i),(0, r.drawScaled)(e,i,()=>e.fillText(s.text,0,0)),e.restore()}}class o{constructor(e){this._renderer=new n,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate}_getAlwaysInViewPort(){return!0}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty()||!this._isVisible())return;const t=this._getIndex();if(null===t)return;e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort();const i=this._model.timeScale().indexToUserTime(t);e.text=null!==i?this._model.dateTimeFormatter().format(i):"",this._invalidated=!1}}},67620:(e,t,i)=>{"use strict";i.d(t,{INVALID_TIME_POINT_INDEX:()=>s});const s=-2e6},10945:(e,t,i)=>{"use strict";i.d(t,{SyncModel:()=>o});var s=i(42062),r=i(25853);let n=0;class o{constructor(e,t){this._extrapolatedData=[],this._cacheForFuture=!1,this._modelId=n++,this._builderCache=null,this._resolution=t,this._symbolInfo=e,this._valid=Boolean(e.timezone)&&Boolean(e.session),this._session=new s.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections)}getSymbolInfo(){return this._symbolInfo}getSession(){return this._session}getResolution(){return this._resolution}uniqueId(){return this._modelId}distance(e,t){if(!this.isValid())return{success:!1};if(e>t)return{success:!1};if(e===t)return{success:!0,result:0};let i=this._extrapolatedData.length,s=0!==i?this._extrapolatedData[0]:null,n=null!==s?this._extrapolatedData[i-1]:null;const o=en){const s=(0,r.extrapolateBarsFrontToTime)(this._barBuilder(),n||1e3*e,1e3*t,2e3,!0);this._extrapolatedData=this._extrapolatedData.concat(s.times),i=this._extrapolatedData.length,this._cacheForFuture=o}if(n=this._extrapolatedData[i-1],n<1e3*t)return{success:!1};const a=this._extrapolatedData.indexOf(1e3*t);return-1===a?{success:!1}:{success:!0,result:a}}projectTime(e,t){if(!this.isValid())return e;let i=this._extrapolatedData.length,s=i>0?this._extrapolatedData[0]:null,n=null!==s?this._extrapolatedData[i-1]:null;const o=t>=0;1e3*e===s&&this._cacheForFuture===o||(this._extrapolatedData=[1e3*e],i=1,s=null,n=null);const a=Math.abs(t);if(null===s||a>=i){const s=(0,r.extrapolateBarsFrontByCount)(this._barBuilder(),n||1e3*e,Math.sign(t)*(a-i+1),!0);this._extrapolatedData=this._extrapolatedData.concat(s.times),i=this._extrapolatedData.length,this._cacheForFuture=o}return i{"use strict";i.d(t,{TimeSynchronizer:()=>l});var s=i(35001),r=i(84540),n=i.n(r),o=i(42062);let a=null;class l{constructor(e,t){var i,r;this._sourceTargetBarBuilder=null,this._cache=new Map,this._source=e,this._target=t,this._isResolutionTheSame=s.Interval.isEqual(e.getResolution(),t.getResolution()),this._isSessionTheSame=(i=e.getSymbolInfo(),r=t.getSymbolInfo(),i.timezone===r.timezone&&i.session===r.session),this._shouldCorrectTradingDay=s.Interval.isDWM(e.getResolution())&&!this._isSessionTheSame}sourceTimeToTargetTime(e){if(this._isSessionTheSame&&this._isResolutionTheSame)return e;if(!this._source.isValid()||!this._target.isValid())return e;let t=this._cache.get(e);if(void 0===t){let i=1e3*e;if(this._shouldCorrectTradingDay){let e=n().utc_to_cal(this._source.getSession().timezone,i);e=this._source.getSession().spec.correctTradingDay(e);const t=new Date(e);n().set_hms(t,0,0,0,0,this._source.getSession().timezone),i=t.valueOf()}const s=this._sourceTargetBuilder();s.moveTo(i);const r=s.indexOfBar(i);t=s.startOfBar(Math.max(0,r))/1e3,this._cache.set(e,t)}return t}_sourceTargetBuilder(){if(null===this._sourceTargetBarBuilder){const e=this._isSessionTheSame?this._target.getSession():(null===a&&(a=new o.SessionInfo("Etc/UTC","24x7")),a);this._sourceTargetBarBuilder=(0,o.newBarBuilder)(this._target.getResolution(),this._target.getSession(),e)}return this._sourceTargetBarBuilder}}},58252:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MINUTE_SPAN:()=>s,HOUR_SPAN:()=>r,DAY_SPAN:()=>n,WEEK_SPAN:()=>o,MONTH_SPAN:()=>a,YEAR_SPAN:()=>l,DEFAULT_BAR_SPACING:()=>c});const s=20,r=30,n=40,o=50,a=60,l=70,c=6},25084:(e,t,i)=>{"use strict";i.d(t,{trackDrawingCreated:()=>r,trackDrawingPasted:()=>n,trackDrawingCloned:()=>o,trackChartStyleChanged:()=>a});i(16282),i(74645);function s(e,t){0}function r(e){s()}function n(e){s()}function o(e){s()}function a(e){0}},46786:(e,t,i)=>{"use strict";i.d(t,{translatedIntervalString:()=>r});i(79881);var s=i(1467);function r(e){const t=(0,s.getTranslatedResolutionModel)(e,!0);return null===t?e:t.multiplier+(t.mayOmitShortKind?"":t.shortKind)}},64934:(e,t,i)=>{"use strict";i.d(t,{ApplyLineToolTemplateUndoCommand:()=>r});var s=i(5980);class r extends s.UndoCommand{constructor(e,t,i){super(i),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}},41591:(e,t,i)=>{"use strict";i.d(t,{ChangeToolBarsThemeUndoCommand:()=>c});var s=i(79881),r=i(90963),n=i(99182),o=i(14829),a=i(5980);const l=new r.TranslatedString("apply toolbars theme",(0,s.t)("apply toolbars theme"));class c extends a.UndoCommand{constructor(e,t,i=!0){super(l),this._prevThemeName=e,this._themeName=t,this._syncState=i}undo(){(0,n.isStdThemeName)(this._prevThemeName)&&((0,o.setTheme)(this._prevThemeName),this._syncState&&(0,n.syncTheme)())}redo(){(0, n.isStdThemeName)(this._themeName.toLowerCase())&&((0,o.setTheme)(this._themeName.toLowerCase()),this._syncState&&(0,n.syncTheme)())}}},65105:(e,t,i)=>{"use strict";i.d(t,{ChartLoadThemeUndoCommand:()=>m});var s=i(79881),r=i(90963),n=i(7532),o=i(11092),a=i(18130),l=i(5980);function c(e){const{visible:t,...i}=e;return i}function h(e){const{visible:t,...i}=e;return i}function d(e){const{visible:t,style:i,symbol:s,interval:r,sessionId:n,highLowAvgPrice:o,showCountdown:a,bidAsk:l,prePostMarket:d,priceAxisProperties:u,...p}=e;return{bidAsk:c(l),prePostMarket:h(d),...p}}function u(e){const{scaleSeriesOnly:t,showSeriesLastValue:i,showStudyLastValue:s,showSymbolLabels:r,showBidAskLabels:n,showPrePostMarketPriceLabel:o,showStudyPlotLabels:a,showFundamentalNameLabel:l,showFundamentalLastValue:c,seriesLastValueMode:h,...d}=e;return d}function p(e){const{topMargin:t,bottomMargin:i,...s}=e;return s}const _=new r.TranslatedString("apply chart theme",(0,s.t)("apply chart theme"));class m extends l.UndoCommand{constructor(e,t,i){var s,r,o;super(_),this._model=e,this._newSessionProps=t.sessions||(0,a.factoryDefaults)("sessions"),["candleStyle","hollowCandleStyle","haStyle"].forEach(e=>{t.mainSourceProperties[e].wickUpColor=t.mainSourceProperties[e].wickUpColor||t.mainSourceProperties[e].wickColor,t.mainSourceProperties[e].wickDownColor=t.mainSourceProperties[e].wickDownColor||t.mainSourceProperties[e].wickColor}),t.chartProperties=null!==(s=t.chartProperties)&&void 0!==s?s:{paneProperties:void 0,scalesProperties:void 0},t.chartProperties.paneProperties.vertGridProperties=null!==(r=t.chartProperties.paneProperties.vertGridProperties)&&void 0!==r?r:t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.horzGridProperties=null!==(o=t.chartProperties.paneProperties.horzGridProperties)&&void 0!==o?o:t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.legendProperties=this._model.properties().state().paneProperties.legendProperties;const l=(0,a.factoryDefaults)("chartproperties"),c=(0,n.deepExtend)({},l,t.chartProperties);this._newChartProps={paneProperties:p(c.paneProperties),scalesProperties:u(c.scalesProperties)},e.timeScale().preserveBarSpacing()&&delete this._newChartProps.scalesProperties.barSpacing;const h=(0,a.factoryDefaults)("chartproperties.mainSeriesProperties"),m=(0,n.deepExtend)({},h,t.mainSourceProperties);this._newSeriesProps=i?m:d(m);const g=e.properties().state();this._oldChartProps={paneProperties:p(g.paneProperties),scalesProperties:u(g.scalesProperties)};const f=e.mainSeries().properties().state();this._oldSeriesProps=i?f:d(f),this._oldSessionProps=this._model.sessions().properties().state()}undo(){this._merge(this._oldChartProps,this._oldSeriesProps,this._oldSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}redo(){this._merge(this._newChartProps,this._newSeriesProps,this._newSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()} _merge(e,t,i){var s,r,n,a;const l=this._model;(0,o.saveDefaultProperties)(!0),e&&(l.properties().childs().paneProperties.mergeAndFire(e.paneProperties),l.properties().childs().scalesProperties.mergeAndFire(e.scalesProperties)),"priceAxisProperties"in t&&l.mainSeries().priceScale().setMode({autoScale:null===(s=t.priceAxisProperties)||void 0===s?void 0:s.autoScale,percentage:null===(r=t.priceAxisProperties)||void 0===r?void 0:r.percentage,log:null===(n=t.priceAxisProperties)||void 0===n?void 0:n.log,lockScale:null===(a=t.priceAxisProperties)||void 0===a?void 0:a.lockScale}),l.mainSeries().properties().mergeAndFire(t),l.mainSeries().properties().saveDefaults(),l.mainSeries().createPaneView(),l.mainSeries().invalidateBarStylesCache(),l.recalculateAllPanes(),l.fullUpdate(),l.properties().saveDefaults(),l.sessions().restoreState({properties:i},!1),(0,o.saveDefaultProperties)(!1)}}},52201:(e,t,i)=>{"use strict";i.d(t,{ExcludeLineToolsFromGroupUndoCommand:()=>l});var s=i(16282),r=(i(95068),i(79881)),n=i(90963),o=i(5980);const a=new n.TranslatedString("exclude line tools from group {group}",(0,r.t)("exclude line tools from group {group}"));class l extends o.UndoCommand{constructor(e,t,i){super(a.format({group:t.name()})),this._model=e,this._groupId=t.id,this._groupName=t.name(),this._lineToolsIds=i.map(e=>e.id())}redo(){const e=(0,s.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map(e=>this._model.dataSourceForId(e));e.excludeLineTools(t),0===e.lineTools().length&&this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map(e=>this._model.dataSourceForId(e)),t=this._model.lineToolsGroupModel().groupForId(this._groupId);null!==t?t.addLineTools(e):this._model.lineToolsGroupModel().createGroup(e,this._groupName,this._groupId)}}},31495:(e,t,i)=>{"use strict";i.d(t,{MergeUpUndoCommand:()=>o,MergeDownUndoCommand:()=>a,MergeToTargetPane:()=>l});var s=i(16282),r=i(9911);class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i),this._restorePane=!1}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=(0,s.ensureNotNull)(this._chartModel.paneForSource(i)),n=this._chartModel.children(i,!0);r.bulkActionMacro(()=>{n.forEach(e=>this._chartModel.detachSource(e)),this._restorePane=this._chartModel.detachSource(i)});const o="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,o),l=0===a.dataSources().length;if(t.bulkActionMacro(()=>{t.addDataSource(i,a,!1),n.forEach(e=>t.addDataSource(e,a,!1))}),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){(0,s.ensureNotNull)(i.priceScale()).restoreState(this._newPriceScaleState(t.isOverlay(i)))}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e ;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,s.ensureNotNull)(this._chartModel.paneForSource(t)),r=this._chartModel.children(t,!0);i.bulkActionMacro(()=>{r.forEach(e=>this._chartModel.detachSource(e)),this._chartModel.detachSource(t)});let n=e.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro(()=>{e.addDataSource(t,n,!0),r.forEach(t=>e.addDataSource(t,n,!1))}),(0,s.ensureNotNull)(t.priceScale()).restoreState(this._originalPriceScaleState()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex-1}}class a extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex+1}}class l extends n{constructor(e,t,i,s){super(e,t,s),this._targetPane=i}_targetPaneIndex(){return this._targetPane}}},9911:(e,t,i)=>{"use strict";i.d(t,{MoveSourceUndoCommand:()=>n});var s=i(16282),r=i(5980);class n extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const r=(0,s.ensureNotNull)(t.priceScale());this._initialPriceScaleId=r.id(),this._initialPriceScaleState=(0,s.ensureNotNull)(t.priceScale()).state();const n=(0,s.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=n.priceScalePosition(r),this._initialPriceScaleIndex=n.priceScaleIndex(r,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(n)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,t}_originalPriceScaleState(){return this._initialPriceScaleState}}},13863:(e,t,i)=>{"use strict";i.d(t,{MoveToNewPriceScaleUndoCommand:()=>o,MoveToExistingPriceScaleUndoCommand:()=>a});var s=i(16282),r=i(9911);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,s),this._sourcePaneRemoved=!1,this._targetPaneIndex=e.panes().indexOf(i)}redo(){const e=this._chartModel.panes()[this._initialPaneIndex],t=this._chartModel.panes()[this._targetPaneIndex],i=e!==t,r=this._targetPriceScale(t),n=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),o=this._chartModel.children(n,!0);for(const e of o)i?(this._chartModel.detachSource(e),t.addDataSource(e,r,!1)):t.move(e,r);i?(this._sourcePaneRemoved=this._chartModel.detachSource(n),t.addDataSource(n,r,!1)):t.move(n,r);const a=t.priceScalePosition(r);t.movePriceScale(r,a,this._targetPriceScaleIndex(n)),this._chartModel.fullUpdate()}undo(){this._sourcePaneRemoved&&this._chartModel.createPane(this._initialPaneIndex);const e=this._chartModel.panes()[this._initialPaneIndex],t=e!==this._chartModel.panes()[this._targetPaneIndex],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId));let r=e.getPriceScaleById(this._initialPriceScaleId) ;null===r&&(r=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex));const n=this._chartModel.children(i,!0);for(const i of n)t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r),(0,s.ensureNotNull)(i.priceScale()).restoreState(this._originalPriceScaleState()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScalePosition=s}_targetPriceScale(e){const t=e.createPriceScaleAtPosition(this._targetPriceScalePosition);return t.restoreState(this._newPriceScaleState("overlay"===this._targetPriceScalePosition)),t}_targetPriceScaleIndex(e){return e===this._chartModel.mainSeries()?0:void 0}}class a extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScaleId=s.id()}_targetPriceScale(e){return(0,s.ensureNotNull)(e.getPriceScaleById(this._targetPriceScaleId))}_targetPriceScaleIndex(e){}}},36292:(e,t,i)=>{"use strict";i.d(t,{PriceScaleChangeUndoCommand:()=>h});var s=i(16282),r=i(79881),n=i(90963),o=i(65447),a=i(5980);const l=(0,o.getLogger)("Chart.ChartUndoModel"),c=new n.TranslatedString("scale price",(0,r.t)("scale price"));class h extends a.UndoCommand{constructor(e,t,i,s,r){super(c,!1),this._newPriceScaleState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._priceScaleId=i.id(),this._state=s,this._timestamp=r?performance.now():null}undo(){if(null!==this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");const[e,t]=this._paneAndScale();this._newPriceScaleState=t.state(),this._model.restorePriceScaleState(e,t,this._state)}redo(){if(null===this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");const[e,t]=this._paneAndScale();this._model.restorePriceScaleState(e,t,this._newPriceScaleState),this._newPriceScaleState=null}canMerge(e){return e instanceof h&&null!==this._timestamp&&null!==e._timestamp&&null===this._newPriceScaleState&&e._model===this._model&&e._paneIndex===this._paneIndex&&e._priceScaleId===this._priceScaleId&&Math.abs(e._timestamp-this._timestamp)<1e3}merge(e){this._timestamp=e._timestamp}_paneAndScale(){const e=this._model.panes()[this._paneIndex],t=(0,s.ensureNotNull)(e.getPriceScaleById(this._priceScaleId));return[e,t]}}},40597:(e,t,i)=>{"use strict";i.d(t,{RemoveSourcesCommand:()=>m});var s=i(16282),r=i(79881),n=i(90963),o=i(5980),a=i(67945),l=i(65447),c=i(72236),h=i(17e3),d=i(52201);class u extends o.UndoCommand{constructor({title:e,chartModel:t,lineDataSourceIds:i}){super(e),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._chartModel=t,this._lineDataSourceIds=i}redo(){const e=this._lineDataSourceIds.map(e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e)));this._groupLineToolsByGroups(e).forEach((e,t)=>{const i=new d.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)}),e.forEach(e=>{ this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,s.ensureNotNull)(this._chartModel.paneForSource(e)))}),this._chartModel.removeSource(e)})}undo(){for(let e=this._undoState.shift();e;e=this._undoState.shift())this._chartModel.restoreSource(!1,e.paneIndex,null,e.state,null);this._excludeLineToolsFromGroupUndoCommands.forEach(e=>e.undo())}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e},new Map)}}const p=(0,l.getLogger)("Chart.RemoveSourcesCommand"),_=new n.TranslatedString("remove line data sources",(0,r.t)("remove line data sources"));class m extends o.UndoCommand{constructor(e,t,i){super(i),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[r,n]=(0,c.closeSourcesSet)(e,t).reduce((e,t)=>((0,a.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e),[[],[]]);this._chartModel=e,this._sourceIds=r,this._lineDataSourceIds=n,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const o=t[0];1===t.length&&(0,h.isStudy)(o)&&(this._initialPriceScaleMode=(0,s.ensureNotNull)(o.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}redo(){this._chartModel.panes().length;const e=this._sourceIds.map(e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e)));this._sourceStates=e.map(e=>(0,s.ensureNotNull)(e.state(!1)));const t=e.map(e=>(0,s.ensureNotNull)(this._chartModel.paneForSource(e)));this._paneIndexes=t.map(e=>this._chartModel.panes().indexOf(e)),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new u({title:_,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map((e,i)=>{const s=e.priceScale();if(null===s)return null;const r=t[i].priceScalePosition(s);return{id:s.id(),position:r,priceScaleIndex:t[i].priceScaleIndex(s,r)}});const i=new Set;e.forEach((e,t)=>{i.add(this._paneIndexes[t])}),this._paneStates=e.map((e,s)=>{const r=this._paneIndexes[s];return i.has(r)?t[s].state(!1,!0):null}),this._restorePanes=e.map(e=>this._chartModel.removeSource(e))}undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],this._sourceStates[t],this._priceScalePositionIds[t]);i&&e.push(i)}e.some((t,i)=>t.id()!==this._sourceIds[e.length-i-1])&&p.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,s.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}},56456:(e,t,i)=>{"use strict";i.d(t,{RestoreDefaultsPreferencesUndoCommand:()=>p});var s=i(16282),r=i(79881),n=i(90963),o=i(5980),a=i(2460),l=i(23930),c=i(10616),h=i(80525),d=i(92932) ;const u=new n.TranslatedString("apply all chart properties",(0,r.t)("apply all chart properties"));class p extends o.UndoCommand{constructor(e){super(u),this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._model=e,this._trading=(0,h.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0,a.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=l.dateFormatProperty.value(),this._prevAddPlusButton=d.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=c.showMarketOpenStatusProperty.value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),(0,l.restoreDateFormatSettingsValue)(),(0,d.restoreAddPlusButtonSettingsValue)(),(0,c.restoreShowMarketOpenStatusProperty)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,s.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,s.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,s.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,s.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,s.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,s.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),l.dateFormatProperty.setValue(this._prevDateFormat),c.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),d.addPlusButtonProperty.setValue(this._prevAddPlusButton);const e=this._model.watermarkSource() ;null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}},11204:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleCurrencyUndoCommand:()=>o});var s=i(16282),r=i(5980),n=i(25436);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesCurrencies=new Map,this._oldSourcesCurrencies=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible())continue;const e=t||(0,n.symbolOriginalCurrency)((0,s.ensureNotNull)(i.symbolInfo()));this._newSourcesCurrencies.set(i.id(),e),this._oldSourcesCurrencies.set(i.id(),i.currency()),this._showFade=this._showFade||i===o&&i.currency()!==e}}redo(){this._applyCurrencies(this._newSourcesCurrencies)}undo(){this._applyCurrencies(this._oldSourcesCurrencies)}_applyCurrencies(e){this._showFade&&this._chartWidget.screen.show();const t=this._chartWidget.model().model();e.forEach((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setCurrency(e)}),this._chartWidget.model().selectionMacro(e=>{e.clearSelection()})}}},18174:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleModeCommand:()=>n});var s=i(11092),r=i(5980);class n extends r.UndoCommand{constructor(e,t,i,s){super(i),this._newMode=e,this._priceScaleId=t.id(),this._model=s,this._oldMode=t.mode()}redo(){this._applyMode(this._newMode)}undo(){this._applyMode(this._oldMode)}_applyMode(e){const t=this._findPriceScaleById();null!==t&&((0,s.saveDefaultProperties)(!0),t.setMode(e),(0,s.saveDefaultProperties)(!1),this._model&&(this._model.recalculateAllPanes(),this._model.lightUpdate()))}_findPriceScaleById(){const e=this._model.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleSelectionStrategyCommand:()=>a});var s=i(16282),r=i(5980),n=i(3092);class o{constructor(e){this._leftScales=e.leftPriceScales().map(e=>e.id()),this._rightScales=e.rightPriceScales().map(e=>e.id())}restorePane(e){this._leftScales.reverse().map(t=>(0,s.ensureNotNull)(e.getPriceScaleById(t))).forEach(t=>e.movePriceScale(t,"left")),this._rightScales.reverse().map(t=>(0,s.ensureNotNull)(e.getPriceScaleById(t))).forEach(t=>e.movePriceScale(t,"right"))}}class a extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,n.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map(e=>new o(e))}redo(){this._chartModel.panes().forEach(e=>e.setPriceScaleSelectionStrategy(this._targetStrategy)),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleUnitUndoCommand:()=>o});var s=i(16282),r=i(5980),n=i(25436);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesUnits=new Map,this._oldSourcesUnits=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){ if(!i.isVisible())continue;const e=t||(0,n.symbolOriginalUnit)((0,s.ensureNotNull)(i.symbolInfo()));this._newSourcesUnits.set(i.id(),e),this._oldSourcesUnits.set(i.id(),i.unit()),this._showFade=this._showFade||i===o&&i.unit()!==e}}redo(){this._applyUnits(this._newSourcesUnits)}undo(){this._applyUnits(this._oldSourcesUnits)}_applyUnits(e){this._showFade&&this._chartWidget.screen.show();const t=this._chartWidget.model().model();e.forEach((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setUnit(e)}),this._chartWidget.model().selectionMacro(e=>{e.clearSelection()})}}},81241:(e,t,i)=>{"use strict";i.d(t,{SetResolutionUndoCommand:()=>o});var s=i(5980),r=i(35001),n=i(25436);class o extends s.UndoCommand{constructor(e,t,i,s){super(s),this._property=e,this._value=t,this._prevValue=e.value(),this._chartWidget=i}redo(){this._chartWidget.screen.show(),this._property.setValue(this._value),this._handleResolution(this._value)}undo(){this._chartWidget.screen.show(),this._property.setValue(this._prevValue),this._handleResolution(this._prevValue)}_handleResolution(e){const t=this._chartWidget.model().mainSeries().properties().childs(),i=t.style.value(),s=(0,n.isRangeStyle)(i),o=r.Interval.isRange(e);!s&&o?t.style.setValue(11):s&&!o&&t.style.setValue((0,n.getLastUsedStyle)())}}},7346:(e,t,i)=>{"use strict";i.d(t,{SetScaleRatioPropertiesCommand:()=>n});var s=i(5980),r=i(11092);class n extends s.UndoCommand{constructor(e,t,i,s){super(i),this._property=e,this._newValue=t,this._model=s,this._priceScale=this._model.mainSeries().priceScale(),this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode()}redo(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),(0,r.saveDefaultProperties)(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes(),this._model.lightUpdate()}undo(){(0,r.saveDefaultProperties)(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes(),this._model.lightUpdate()}}},55796:(e,t,i)=>{"use strict";i.d(t,{SetChartLayoutCommand:()=>l});var s=i(79881),r=i(90963),n=i(5980),o=i(1799);const a=new r.TranslatedString("change chart layout to {title}",(0,s.t)("change chart layout to {title}"));class l extends n.UndoCommand{constructor(e,t){super(a.format({title:o.layouts[t].title})),this._chartWidgetCollection=e,this._newLayoutType=t,this._oldLayoutType=e.layout.value()}redo(){this._chartWidgetCollection.setLayout(this._newLayoutType)}undo(){this._chartWidgetCollection.setLayout(this._oldLayoutType)}}},72236:(e,t,i)=>{"use strict";function s(e,t){const i=new Set,s=t=>{e.children(t,!1).forEach(e=>{i.has(e)||(i.add(e),s(e))})};return t.forEach(s),t.filter(e=>!i.has(e)).map(t=>function e(t,i){let s=[];const r=t.children(i,!1);for(let i=0;ie.concat(t),[])}i.d(t,{closeSourcesSet:()=>s})},60331:(e,t,i)=>{"use strict" ;i.d(t,{TimeScaleChangeUndoCommand:()=>o});var s=i(65447),r=i(5980);const n=(0,s.getLogger)("Chart.ChartUndoModel");class o extends r.UndoCommand{constructor(e,t,i){super(i,!1),this._newRightOffsetAndBarSpacing=null,this.setCustomFlag("doesnt_affect_save",!0),this._model=e,this._rightOffsetAndBarSpacing=t}undo(){if(null!==this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");const e=this._model.timeScale();this._newRightOffsetAndBarSpacing={barSpacing:e.barSpacing(),rightOffset:e.rightOffset()},e.setBarSpacing(this._rightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._rightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate()}redo(){if(null===this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");const e=this._model.timeScale();e.setBarSpacing(this._newRightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._newRightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate(),this._newRightOffsetAndBarSpacing=null}}},5980:(e,t,i)=>{"use strict";i.d(t,{UndoCommand:()=>r});var s=i(90963);class r{constructor(e,t=!0){this._customFlags={},this._text=e||new s.TranslatedString("",""),this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},80437:(e,t,i)=>{"use strict";i.d(t,{createUndoHistory:()=>u});var s=i(16282),r=i(27850),n=i(81262),o=i(5980);class a extends o.UndoCommand{constructor(e,t,i){super(i),this._wv=e,this._newValue=t,this._oldValue=e.value()}redo(){this._wv.setValue(this._newValue)}undo(){this._wv.setValue(this._oldValue)}}var l=i(65447),c=i(5729),h=i.n(c);const d=(0,l.getLogger)("Common.UndoHistory");function u(){const e=[],t=new r.UndoStack,i=new r.UndoStack,o=new(h());function l(s){if(e.length>0)e[e.length-1].addCommand(s);else{i.clear();const e=t.head(),r=e&&e.text().originalText();e&&e.canMerge(s)?e.merge(s):t.push(s);const n=s.text().originalText();""!==n&&n!==r&&d.logNormal("DO: "+n)}s.executeOnPush()&&s.redo(),e.length||o.fire(c())}function c(){const e=t.head(),s=i.head();return{enableUndo:!t.isEmpty(),undoText:void 0===e?void 0:e.text().translatedText(),enableRedo:!i.isEmpty(),redoText:void 0===s?void 0:s.text().translatedText()}}return{beginUndoMacro:function(t){const i=new n.UndoMacroCommand(t);return e.push(i),i},clearStack:function(){t.clear(),i.clear(),o.fire(c())},createUndoCheckpoint:function(){return{lastActualCommand:t.isEmpty()?null:t.head()}},endUndoMacro:function(){const t=(0,s.ensureDefined)(e.pop());t.isEmpty()||l(t)},pushUndoCommand:l,redo:function(){if(i.isEmpty())return!1;const e=i.pop();return!!e&&(e.redo(),t.push(e),d.logNormal("REDO: "+e.text().originalText()),o.fire(c()),!0)},redoStack:function(){return i},setWatchedValue:function(e,t,i,s){if(e.value()!==t){const r=new a(e,t,i);r.setCustomFlag("doesnt_affect_save",!!s),l(r),r.redo()}}, undo:function(){if(t.isEmpty())return!1;const e=t.pop();return!!e&&(e.undo(),i.push(e),d.logNormal("UNDO: "+e.text().originalText()),o.fire(c()),!0)},undoStack:function(){return t},undoToCheckpoint:function(e){for(;!t.isEmpty()&&e.lastActualCommand!==t.head();)t.pop().undo();i.clear(),o.fire(c())},state:c,onChange:function(){return o}}}},81262:(e,t,i)=>{"use strict";i.d(t,{UndoMacroCommand:()=>r});var s=i(5980);class r extends s.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(){for(let e=0;e=0;e--)this._subcommands[e].undo()}commands(){return this._subcommands}}},27850:(e,t,i)=>{"use strict";i.d(t,{UndoStack:()=>a});var s=i(5980),r=i(5729),n=i.n(r);const o=(0,i(65447).getLogger)("Common.UndoStack");class a{constructor(){this._commands=[],this._onChange=new(n())}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof s.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void o.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}},3062:(e,t,i)=>{"use strict";i.d(t,{UnmergeDownUndoCommand:()=>o,UnmergeUpUndoCommand:()=>a,UnmergeToNewBottomPane:()=>l});var s=i(16282),r=i(9911);class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro(()=>{i.forEach(e=>this._chartModel.detachSource(e)),this._chartModel.detachSource(e)});const r=this._chartModel.createPane(this.targetPaneIndex()),n=r.findSuitableScale(e);r.bulkActionMacro(()=>{r.addDataSource(e,n,!1),i.forEach(e=>r.addDataSource(e,n,!1))}),(0,s.ensureNotNull)(e.priceScale()).restoreState(this._newPriceScaleState(r.isOverlay(e))),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro(()=>{i.forEach(e=>this._chartModel.detachSource(e));const t=this._chartModel.detachSource(e);(0,s.assert)(t,"Undo of detaching must remove pane")});const r=this._chartModel.panes()[this._initialPaneIndex];let n=r.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=r.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),r.bulkActionMacro(()=>{r.addDataSource(e,n,!0),i.forEach(e=>r.addDataSource(e,n,!1))}),(0,s.ensureNotNull)(e.priceScale()).restoreState(this._originalPriceScaleState()), this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex+1}}class a extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex}}class l extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}},42010:(e,t,i)=>{"use strict";i.d(t,{unitConvertibleGroups:()=>n,sourceNewUnitOnPinningToPriceScale:()=>o});var s=i(58007),r=i(25436);function n(e,t,i){const s=(0,r.symbolUnitConvertibleGroupsIfExist)(e);if(null!==s)return s;const n=i.unitGroupById(t);return null===n?[]:[n]}function o(e,t,i,r){let o=null;if(i.unitConversionEnabled()&&(0,s.isSymbolSource)(e)){const s=i.availableUnits(),a=t.unit(s),l=e.unit(),c=null===l?[]:n(e.symbolInfo(),l,s);null!==a&&null!==a.selectedUnit&&!a.allUnitsAreOriginal&&a.selectedUnit!==l&&(r&&null===l||null!==l&&s.convertible(l,c))&&(o=a.selectedUnit)}return o}},77664:(e,t,i)=>{"use strict";i.r(t),i.d(t,{watermarkProperty:()=>h,restoreWatermarkPropertyDefaults:()=>d});var s=i(14563),r=i(64222),n=i(674),o=i.n(n);const a={visibility:!1,color:"rgba(80, 83, 94, 0.25)"};function l(){const e=r.getJSON("symbolWatermark");let t=Object.assign({},a,e);if(void 0===e){if(void 0!==r.getJSON("chartproperties")){const e=r.getJSON("chartproperties").symbolWatermarkProperties;if(void 0!==e){const i=(0,s.tryParseRgba)(e.color);t=Object.assign(t,e),null!==i&&(0!==i[3]?t.visibility=!0:(i[3]=.25,t.color=(0,s.rgbaToString)(i)))}}delete t.transparency}return t}let c=null;function h(){return null===c&&(c=new(o())(l()),r.onSync.subscribe(null,()=>{null!==c&&c.mergeAndFire(l())}),c.listeners().subscribe(null,()=>{null!==c&&r.setJSON("symbolWatermark",c.state())})),c}function d(){null!==c&&c.mergeAndFire(a)}},75066:(e,t,i)=>{"use strict";var s=i(46786).translatedIntervalString,r=i(7691).getTranslatedSymbolDescription,n=i(54837).CHART_FONT_FAMILY,o=i(77664),a=o.watermarkProperty,l=o.restoreWatermarkPropertyDefaults,c=i(16932).drawScaled,h=i(18130).applyDefaultsOverrides,d=i(18130).applyPropertiesOverrides;t.Watermark=function(e,t){var i={},o=a();function u(e,t){var s=e.font;return i.hasOwnProperty(s)||(i[s]={}),i[s].hasOwnProperty(t)||(i[s][t]=e.measureText(t).width),i[s][t]}h(o,void 0,!1,"symbolWatermarkProperties"),o.listeners().subscribe(this,(function(){e.updateSource(this)})),this.destroy=function(){o.listeners().unsubscribeAll(this)},this.properties=function(){return o},this.restorePropertiesDefaults=function(){l()},this.applyOverrides=function(e){d(o,void 0,!1,e,"symbolWatermarkProperties")};var p={renderer:function(e,i){return{draw:function(a,l){c(a,l.pixelRatio,(function(){var l=t.symbolInfo();a.fillStyle=o.color.value();var c,h=l.name;/QUANDL/.test(l.exchange)&&((c=h.split(/\//)).length&&(h=c[c.length-1]));for(var d={description:l.description,short_description:l.short_description,pro_name:l.pro_name,short_name:l.name,local_description:l.local_description,language:l.language},p=[{text:h?h+", "+s(t.interval()):"",font:"96px "+n,lineHeight:117,vertOffset:0},{text:r(d)||"", font:"48px "+n,lineHeight:58,vertOffset:5}],_=0,m=0;mi?i/g:1,_+=v.lineHeight*v.zoom}}var f=Math.max((e-_)/2,0);for(m=0;m{"use strict";i.r(t),i.d(t,{reorderCollection:()=>S,reorderDataSourcesStateZOrder:()=>y,reorderDataSourcesZOrder:()=>b,newLineToolZOrder:()=>C,newLineToolStateZOrder:()=>T,newStudyZOrder:()=>x,isReorderRequired:()=>L,moveAtIndex:()=>k,moveAfterItem:()=>E,moveBeforeItem:()=>D,moveAfterSource:()=>V,moveBeforeSource:()=>B,moveAfterSourceState:()=>N,moveBeforeSourceState:()=>R});var s=i(67945),r=i(17e3),n=i(95975),o=i(36512),a=i(58921),l=i(49382);function c(e){return(0,s.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()}function h(e){return(0,r.isStudy)(e)&&!e.isSpeciallyZOrderedSource()}function d(e,t){return e.zorder-t.zorder}function u(e,t){return e.zorder()-t.zorder()}function p(e,t){(0,a.isMainSeriesState)(e)?e.zorder=0:e.zorder=t}function _(e,t){e.setZorder(t)}function m(e){return e.zorder}function g(e){return e.zorder()}function f(e,t,i,s,r,n,o){let a=0;for(let l=t;l>=0;--l){const t=e[l];void 0!==o&&o(t)||(n(t)?(r(t,i),a=Math.max(a,I(i)),s=i-1,i-=1e4,0===s&&(i-=1e4)):(r(t,s),a=Math.max(a,M(s)),s-=1))}return a}function v(e,t,i,s,r,n,o){let a=0;for(let l=t;l0||o%1e4<-1)return o+1;if((o+1)%1e4==0)for(const e of w(o,c))s(e,r(e)-100);return o+1-100}function C(e,t){return P(e,c,h,_,g,t)}function T(e,t){return P(e,a.isLineToolState,a.isStudyState,p,m,t)}function x(e){let t=-1e4;for(const i of e)h(i)&&(t=Math.min(t,i.zorder()-1e4));return 0===t?-1e4:t}function I(e){return Math.abs(e/o.specialZOrderBase)}function M(e){return Math.abs(e%1e4/1e4)}function L(e,t){return null!==e&&I(e)>=.7||null!==t&&M(t)>.7}function A(e,t){const i=1e4*((s=e/1e4)>=0?Math.ceil(s):Math.floor(s));var s;return i===e?i+1e4*t:i}function k(e,t,i,s,r,n,a,c,h){ if(s(t[0]))return void(i0?(0,l.moveAfter)(e,t,i-1):(0,l.moveBefore)(e,t,0),p=u,_=u+t.length-1,m=p>0?c(d[p-1]):c(d[p])-1,g=_=0&&g>0)v(d,p,A(m,1),m+1,a,r,s);else if(g<=0&&m<0)f(d,_,A(g,-1),g-1,a,r,s);else{let e=-o.specialZOrderBase;for(const t of d)s(t)?e=1:(a(t,e),e+=1);S(d,s,r,n,a,h)}}function E(e,t,i,s,r,n,o,a,l){const c=e.indexOf(i)+1;k(e,t,c,s,r,n,o,a,l)}function D(e,t,i,s,r,n,o,a,l){const c=e.indexOf(i);k(e,t,c,s,r,n,o,a,l)}function V(e,t,i){E(e,t,i,n.isSeries,h,c,_,g,u)}function B(e,t,i){D(e,t,i,n.isSeries,h,c,_,g,u)}function N(e,t,i){E(e,t,i,a.isMainSeriesState,a.isStudyState,a.isLineToolState,p,m,d)}function R(e,t,i){D(e,t,i,a.isMainSeriesState,a.isStudyState,a.isLineToolState,p,m,d)}},20480:(e,t,i)=>{"use strict";i.d(t,{setSymbolSearchCompleteOverrideFunction:()=>r,getSymbolSearchCompleteOverrideFunction:()=>n});let s=e=>Promise.resolve(e);function r(e){s=e}function n(){return s}},85062:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(674),r=i(65447).getLogger("Chart.Study.MetaInfo"),n=i(70635).applyOverridesToStudyDefaults,o={};function a(e){TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),TradingView.merge(this,e);var t=e.fullId||e.id;TradingView.merge(this,a.parseIdString(t))}a.VERSION_STUDY_ARG_SOURCE=41,a.METAINFO_FORMAT_VERSION_SOS_V2=42,a.VERSION_PINE_PROTECT_TV_4164=43,a.CURRENT_METAINFO_FORMAT_VERSION=52,a.VERSION_NEW_STUDY_PRECISION_FORMAT=46,a.CHILD_STUDY_ALLOWED_PLOT_TYPES=["line"],a.canPlotBeSourceOfChildStudy=function(e){return a.CHILD_STUDY_ALLOWED_PLOT_TYPES.includes(e)},a.CHILD_STUDY_EXCLUDE_IDS=["CorrelationCoefficient@tv-basicstudies","Correlation - Log@tv-basicstudies-1"],a.CHILD_STUDY_PARENT_EXCLUDE_IDS=[],a.FilledArea={},a.FilledArea.TYPE_PLOTS="plot_plot",a.FilledArea.TYPE_HLINES="hline_hline",a.versionOf=function(e){var t="_metainfoVersion"in e&&isNumber(e._metainfoVersion)?e._metainfoVersion:0;return t<0&&r.logError("Metainfo format version cannot be negative: "+t),t},a.parseIdString=function(e){var t={};if(-1===e.indexOf("@"))t.shortId=e,t.packageId="tv-basicstudies",t.id=e+"@"+t.packageId,t.version=1;else{var i=e.split("@");t.shortId=i[0];var s=i[1].split("-");if(3===s.length)t.packageId=s.slice(0,2).join("-"),t.id=t.shortId+"@"+t.packageId,t.version=s[2];else if(1===s.length&&"decisionbar"===s[0])t.packageId="les-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1;else{if(1!==s.length)throw new Error("unexpected study id:"+e);t.packageId="tv-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1}}if(t.fullId=t.id+"-"+t.version,"tv-scripting"===t.packageId){var r=t.shortId;if(0===r.indexOf("Script$")||0===r.indexOf("StrategyScript$")){var n=r.indexOf("_");t.productId=n>=0?r.substring(0,n):t.packageId}else t.productId=t.packageId}else t.productId=t.packageId;return t},a.getPackageName=function(e){return(/^[^@]+@([^-]+-[^-]+)/.exec(e||"")||[0,"tv-basicstudies"])[1]}, a.cutDollarHash=function(e){var t=e.indexOf("$"),i=e.indexOf("@");return-1===t?e:e.substring(0,t)+(i>=0?e.substring(i):"")},a.hasUserIdSuffix=function(e){return/^USER;[\d\w]+;\d+$/.test(e)},a.isStandardPine=function(e){return/^(Strategy)?Script\$STD;.*@tv-scripting$/.test(e)},a.getSourceIdByInputs=function(e,t){if(!Array.isArray(e)||!t)return null;for(var i=0;i0){var l=o.replace(/^[^\$]+/,t);i.inputs[n.id].setValue(l)}}}},a.patchChildStudyMetaInfoState=function(e){e.state&&function e(t){if("object"==typeof t)for(var i in t)"string"==typeof t[i]&&/^[^\$]+\$\d+$/.test(t[i])?t[i]=t[i].replace(/^[^\$]+/,"{pid}"):e(t[i])}(e.state.inputs),e.state.isChildStudy=!0},a.getStudyIdWithLatestVersion=function(e){const t=a.cutDollarHash(e.id);let i=t;return t.indexOf("@tv-scripting")>=0?i+="-101!":i+="-"+e.version,i},a.prototype.parseValue=function(e,t){return"bool"===e?TradingView.parseBool(t):t},a.prototype.defaultInputs=function(){for(var e=[],t=0;t0?e[0].id:null},a.prototype.createDefaults=function(){if(this.defaults){var e=TradingView.clone(this.defaults);e.precision="default";var t=a.getStudyPropertyRootName(this);defaults.create(t,e)}},a.prototype.removeDefaults=function(){defaults.remove(a.getStudyPropertyRootName(this))},a.findStudyMetaInfoByDescription=function(e,t){if(e){for(var i=0;i{"use strict";window.TradingView=window.TradingView||{},window.requireAll=function(e){return e.keys().map(e)},i(79881),i(96404).setClasses(),i(91164),i(82041).install(),i(43367),i(47903),i(5025),i(95068),i(68177),i(79039),i(20265),i(64222),i(67869)},55218:(e,t,i)=>{"use strict";var s=i(79881).t;i(72111);var r=i(16282).assert;i(8997),i(18130),i(84277);const n=i(27490);JSON.parse(urlParams.disabledFeatures).forEach((function(e){n.setEnabled(e,!1)})),JSON.parse(urlParams.enabledFeatures).forEach((function(e){n.setEnabled(e,!0)})),function(){window.__settingsOverrides=window.parent[window.urlParams.uid].settingsOverrides||{};var e=window.parent[window.urlParams.uid].settingsAdapter;null!=e?(TVSettings.setSettingsAdapter(e),TVSettings.sync()):n.enabled("use_localstorage_for_settings")&&TVSettings.sync()}();var o=i(54837).setChartFontFamily;window.urlParams.customFontFamily&&o(window.urlParams.customFontFamily);var a=i(215).RestrictedToolsetBootloader,l=i(64457).HeaderToolbarBootloader,c=i(1940).DrawingToolbarBootloader,h=i(90096).isDrawingToolbarVisible;(0,i(96404).setClasses)() ;var d=i(99182),u=i(14829).setTheme,p=i(88933),_=i(15755),m=i(60934),g=i(27192).migrateShortcut,f=i(89171).ChartSaver,v=i(72757).SaveChartService,S=i(93357).LoadChartService,y=i(96431).StudyTemplates,b=i(62685).FavoriteStudyTemplateService,w=i(24287).linking,P=i(18437),C=i(59104).formatterOptions,T=i(62737).customFormatters,x=i(42677).StudyMarket,I=i(2308).TVXWindowEvents,M=i(61389).createDeferredPromise,L=i(7532).deepExtend,A=i(45259).randomHash,k=i(53226).convertPropertyToWatchedValue,E=i(49044).property,D=i(42028).property,V=i(23930).dateFormatProperty,B=i(58848).default,N=i(35001).Interval,R=i(89979).Root,O=i(41547).ChartPage,F=i(17915).destroyQuoteSessions,W=i(89077).TIMEFRAMETYPE,H=new O(new R(window).allocate()),z=H.allocate({areaName:"center"}),U=(H.allocate({areaName:"tradingpanel"}),window.parent[urlParams.uid].brokerFactory,Boolean(!1)),j=i(468).CHART_WIDGET_COLLECTION_SERVICE,G=i(86573);i(27317);var q=i(17444),Y=i(65109).createFavoriteDrawingToolbar,$=i(30618).setupChartEventHint,K=i(82831).setupChartScreenshotHint,X=i(68606),Z=i(85062),J=i(54736);i(81137),i(82708);var Q=i(67985).setSearchRequestDelay,ee=i(74645),te=i(77392),ie=i(63939).addBrandingSource,se=i(10426).setAdditionalSymbolInfoFields,re=i(20480).setSymbolSearchCompleteOverrideFunction,ne=i(3306).DropdownApi,oe=i(6799).ContextMenuManager,ae=window.parent[urlParams.uid].getCustomIndicators,le=M(),ce=M(),he=n.enabled("left_toolbar");if(void 0!==window.parent[urlParams.uid].contextMenu){var de=window.parent[urlParams.uid].contextMenu;void 0!==de.items_processor&&oe.setCustomItemsProcessor(de.items_processor),void 0!==de.renderer_factory&&oe.setCustomRendererFactory(de.renderer_factory)}if(Promise.all([le.promise,ce.promise]).then((function(){window.ChartApiInstance.start()})),"function"==typeof ae){var ue=ae(te);ue&&ue.then?ue.then((function(e){if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void le.resolve();JSServer.studyLibrary.push.apply(JSServer.studyLibrary,e),le.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((function(e){console.warn("Error loading custom indicators "+e),le.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),le.resolve())}else le.resolve();window.widgetReady=function(e){P.subscribe("onChartReady",e)};var pe=urlParams.theme&&urlParams.theme.toLowerCase();function _e(e){window.__defaultsOverrides=window.__defaultsOverrides||{},L(window.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&(window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools())}!function(e){d.themes[e]&&u(e)}(pe),window.applyStudiesOverrides=function(e){e&&(window.chartWidgetCollection?window.chartWidgetCollection.applyStudiesOverrides(e):Z.mergeDefaultsOverrides(e))},window.applyOverrides=function(e){_e(e), window.chartWidgetCollection&&window.chartWidgetCollection.applyOverrides(e)},window.doWhenApiIsReady=function(e){window.tradingViewApi?e():ce.promise.then(e)},window.applyTradingCustomization=function(e){for(var t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];for(var t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t]},window.changeTheme=function(e,t){var i=d.themes[e.toLowerCase()];return i?window.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},window.getTheme=function(){return window.tradingViewApi.themes().getCurrentThemeName()},window.is_authenticated=!1;JSON.parse(window.urlParams.brokerConfig);s("charts by TradingView"),s("powered by TradingView"),s("by TradingView");var me=null,ge=M(),fe=null,ve=function(){if(n.setEnabled("charting_library_debug_mode","true"===urlParams.debug),n.setEnabled("chart_property_page_trading",!1),n.enabled("remove_library_container_border")){var e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}n.enabled("no_min_chart_width")&&(window.document.body.style.minWidth="0px"),null!=urlParams.studiesOverrides&&Z.mergeDefaultsOverrides(JSON.parse(urlParams.studiesOverrides)),r(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),_e(JSON.parse(urlParams.overrides)),urlParams.numeric_formatting=urlParams.numeric_formatting&&JSON.parse(urlParams.numeric_formatting),urlParams.numeric_formatting&&"string"==typeof urlParams.numeric_formatting.decimal_sign&&(C.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),window.ChartApiInstance=new X(window.parent[urlParams.uid].datafeed),window.parent[urlParams.uid].customFormatters&&(window.parent[urlParams.uid].customFormatters.timeFormatter&&(T.timeFormatter=window.parent[urlParams.uid].customFormatters.timeFormatter),window.parent[urlParams.uid].customFormatters.dateFormatter&&(T.dateFormatter=window.parent[urlParams.uid].customFormatters.dateFormatter),window.parent[urlParams.uid].customFormatters.tickMarkFormatter&&(T.tickMarkFormatter=window.parent[urlParams.uid].customFormatters.tickMarkFormatter)),window.ChartApiInstance.setStudiesAccessController(window.ChartApiInstance.createStudiesAccessController(urlParams.studiesAccess));var t=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,o=urlParams.chartContentExtendedData?JSON.parse(urlParams.chartContentExtendedData):t?t.extendedData:void 0,u=urlParams.interval||"D",_=function(e){var t=/(\d+)(\w+)/;return e.map((function(e){var i=t.exec(e.text),r=i[2].toLowerCase(),n=parseInt(i[1]),o="y"===r?12*n+"M":n+r,a=N.parse(e.resolution);return{text:s(e.title)||n+s(r,{context:"dates",count:n}),description:e.description||"",value:{value:o.toUpperCase(),type:W.PeriodBack},targetResolution:a.value(),requiresIntraday:a.isIntraday()}}))}(JSON.parse(urlParams.timeFrames)),m={resizerBridge:z,padding:n.enabled("border_around_the_chart")?2:0,content:t,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0, addVolume:window.ChartApiInstance.studiesAccessController.isToolEnabled("Volume"),muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:u,compareSymbols:urlParams.compareSymbols&&JSON.parse(urlParams.compareSymbols),defTimeframe:urlParams.timeframe,paneContextMenuEnabled:n.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:U},priceScaleContextMenuEnabled:n.enabled("scales_context_menu"),currencyConversionEnabled:n.enabled("pricescale_currency"),unitConversionEnabled:n.enabled("pricescale_unit"),legendWidgetEnabled:n.enabled("legend_widget"),legendWidget:{contextMenu:{settings:n.enabled("show_chart_property_page"),showOpenMarketStatus:n.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:n.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:n.enabled("scales_context_menu"),timezoneMenuEnabled:n.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:n.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:n.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:n.enabled("right_bar_stays_on_scroll"),minBarSpacing:urlParams.time_scale&&JSON.parse(urlParams.time_scale).min_bar_spacing},goToDateEnabled:n.enabled("go_to_date"),crossHair:{menuEnabled:n.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:n.enabled("mouse_wheel_scale"),pinch:n.enabled("pinch_scale"),axisPressedMouseMove:{time:n.enabled("axis_pressed_mouse_move_scale"),price:n.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:n.enabled("mouse_wheel_scroll"),pressedMouseMove:n.enabled("pressed_mouse_move_scroll"),horzTouchDrag:n.enabled("horz_touch_drag_scroll"),vertTouchDrag:n.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:n.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:n.enabled("cropped_tick_marks"),countdownEnabled:n.enabled("countdown"),indicatorsDialogShortcutEnabled:n.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:n.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:n.enabled("go_to_date"),availableTimeFrames:function(e,t){return e?t!==ee.STATUS_DELAYED&&t!==ee.STATUS_DELAYED_STREAMING&&t!==ee.STATUS_READY?[]:_.filter((function(t){return!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))})):[]}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:n.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:!1,backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,fullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:urlParams.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:n.enabled("save_shortcut")};he&&(Y(),m.widgetOptions.isDrawingToolbarVisible=h),o&&(m.metaInfo={id:o.uid, name:o.name,description:o.description,uid:o.uid,username:"",tags:""}),window.parent[urlParams.uid].additionalSymbolInfoFields&&se(window.parent[urlParams.uid].additionalSymbolInfoFields),window.parent[urlParams.uid].symbolSearchComplete&&re(window.parent[urlParams.uid].symbolSearchComplete);var g=window.chartWidgetCollection=new q(m);ie(g),window.studyMarket=new x(g),void 0!==G&&G.registerService(j,g),g.activeChartWidget.subscribe((function(e){P.emit("activeChartChanged",g.getAll().indexOf(e))})),window.saver=new f(g);var M=new v(g,window.saver),L=new S(g);window.chartWidget=g.activeChartWidget.value(),window.pro=new TradingView.Pro;var A=function(e){if(!n.enabled("header_widget"))return null;var t=H.allocate({areaName:"top"}),s=new(0,i(9884).ChartChangesWatcher)(e.chartWidgetCollection.undoHistory,e.chartWidgetCollection.lineToolSynchronizerHasChanges,window.saver,P),r=JSON.parse(urlParams.favorites);r.intervals=r.intervals.map((function(e){var t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t}));var o=null;n.enabled("study_templates")&&(o=new b(I,TVSettings),fe=new y({chartWidgetCollection:e.chartWidgetCollection,favoriteStudyTemplatesService:o}));var c=void 0,h=urlParams.header_widget_buttons_mode;"fullsize"===h&&(c=["full"]);"compact"===h&&(c=["small"]);return new l(new a,{chartSaver:window.saver,chartApiInstance:ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:r.chartTypes,defaultFavoriteIntervals:r.intervals,hideStudyTemplates:!0,resizerBridge:t,studyMarket:window.studyMarket,studyTemplates:fe,favoriteStudyTemplatesService:o,allowedModes:c,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:s,onClick:Ie,snapshotUrl:e.snapshotUrl})}({chartWidgetCollection:g,saveChartService:M,loadChartService:L,snapshotUrl:urlParams.snapshotUrl});null!==A?A.load().then((function(e){me=e.getComponent(),ge.resolve()})):(ge.promise.catch((function(){})),ge.reject("header widget is not loaded"));var k=function(e){if(he){var t=urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)?String(urlParams.toolbarbg):void 0;if(t){var i=document.createElement("style");i.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(i)}return new c({bgColor:t,chartWidgetCollection:e,drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,resizerBridge:H.allocate({areaName:"left"}),onClick:Ie})}return null}(g),E=null;window.tradingViewApi=new J({chartWidgetCollection:g,chartApiInstance:window.ChartApiInstance,saveChartService:M,loadChartService:L});if(w.bindToChartWidgetCollection(g),TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),!TradingView.isNaN(urlParams.ssreqdelay)){var D=Math.max(0,+urlParams.ssreqdelay);Q(D)}window.ChartApiInstance.connect(), Promise.all([i.e(3876),i.e(7610),i.e(9448),i.e(3894),i.e(3996),i.e(4078),i.e(7936),i.e(706),i.e(8604),i.e(2359),i.e(2273),i.e(6548),i.e(9843),i.e(7607),i.e(6637),i.e(1941),i.e(4985),i.e(3223),i.e(5514),i.e(306),i.e(4940),i.e(708),i.e(7962),i.e(1890),i.e(5254),i.e(8434),i.e(2306)]).then(i.t.bind(i,45466,23)).then(({default:e})=>{window.lineToolPropertiesToolbar=new e(g)});var V=document.querySelector(".tv-content");function R(){k&&k.load(),E&&E.load().then((function(e){window.footerWidget=e.getComponent()}))}null!==V&&V.addEventListener("contextmenu",(function(e){null!==e.target&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),ce.resolve(),g.undoHistory.undoStack().onChange().subscribe(null,B((function(){P.emit("onAutoSaveNeeded")}),1e3*(urlParams.autoSaveDelay||5),{leading:!1,trailing:!0})),window.chartWidget.withModel(null,(function(){if(ChartApiInstance.on("realtime_tick",(function(e){P.emit("onTick",e)})),!d.savedThemeName()&&pe){var e=d.getStdTheme(pe);e&&e.content&&void 0===t&&g.applyTheme(e.content,!1,!1,pe,!0,!0).then(()=>window.applyOverrides(window.__defaultsOverrides))}n.enabled("charting_library_debug_mode")&&P.subscribeToAll((function(){var e=Array.prototype.slice.call(arguments);console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})),$&&($(g),$=null),K&&(K(g,{seriesControlBarEnabled:n.enabled("timeframes_toolbar")}),K=null)})),p.isAnyChartWidgetInitialized(g)?R():p.waitAnyChartWidgetInitialized(g,R),P.subscribe("chart_load_requested",(function(e){window.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}))};window.addEventListener("unload",(function(){window.ChartApiInstance&&window.ChartApiInstance.disconnect(),window.chartWidgetCollection&&(window.chartWidgetCollection.destroy(),window.chartWidgetCollection=null),F(),window.ChartApiInstance&&(window.ChartApiInstance.destroy(),window.ChartApiInstance=null)})),n.enabled("saveload_storage_customization")&&(window.parent[urlParams.uid].saveLoadAdapter?_.setCustomAdapter(window.parent[urlParams.uid].saveLoadAdapter):void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?_.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(n.setEnabled("saveload_storage_customization",!1),n.setEnabled("header_saveload",!1)));var Se=M();function ye(){Se.resolve()}window.parent[urlParams.uid].loadLastChart&&n.enabled("saveload_storage_customization")?_.getCharts().then((function(e){if(0!==e.length){var t=e.sort((function(e,t){return t.modified_iso-e.modified_iso}))[0];_.getChartContent(t).then((function(e){var t=JSON.parse(e.content);t.extendedData=e,urlParams.chartContent=JSON.stringify({json:t}),ye()})).catch(ye)}else ye()})).catch(ye):ye();var be,we,Pe=M();Promise.all([Pe.promise,Se.promise]).then((function(){var e,t,i,s,r,o,a=document.querySelector(".loading-indicator");if(a&&(a.style.display="none"),setTimeout(ve,0), n.enabled("14851")&&Math.random()<=.02){e=window,t=document,i="script",s="ga",e.GoogleAnalyticsObject=s,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,r=t.createElement(i),o=t.getElementsByTagName(i)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",o.parentNode.insertBefore(r,o);var l=document.URL.match(new RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-112911840-1","auto"),ga("set","anonymizeIp",!0),ga("set",{hostname:l,page:l,referrer:l}),ga("send","pageview")}})),be=!0,window.parent[urlParams.uid].datafeed.onReady((function(e){be&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=e,Pe.resolve()})),be=!1,window.getFunctionFromArguments=function(e){return window.parent[urlParams.uid][e]},window.createShortcutAction=(we=m.createGroup({desc:"API"}),function(e,t){we.add({hotkey:g(e),handler:t})}),window.initializationFinished=function(){window.chartWidgetCollection.undoHistory.clearStack()},window.headerReady=function(){return ge.promise},window.createButton=function(e){if(null===me)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");var t=(e=e||{}).align||"left";return me.addButton(A(),t)},window.createDropdown=function(e){if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=A();return me?(me.addDropdown(t,e),Promise.resolve(new ne(me,t))):ge.promise.then(()=>(me.addDropdown(t,e),new ne(me,t)))},window.getAllFeatures=function(){const e=n.getAllFeatures();return Object.keys(e).forEach((function(t){isNaN(parseFloat(t))||delete e[t]})),e};var Ce=null;window.getNavigationButtonsVisibility=function(){return null===Ce&&(Ce=k(E())),Ce};var Te=null;window.getPaneButtonsVisibility=function(){return null===Te&&(Te=k(D())),Te};var xe=null;function Ie(e){var t=TradingView.bottomWidgetBar;t&&t.turnOffMaximize()}window.getDateFormat=function(){return null===xe&&(xe=k(V)),xe}},79039:(e,t,i)=>{e=i.nmd(e),TradingView.cleanButAmpersand=function(e,t){var i=t?["&"]:["&"];return TradingView.clean(e,t,i)},TradingView.strip_tags=function(e){return e&&e.replace?e.replace(/(<([^>]+)>)/gi,""):e},TradingView.encodeSpread=function(e){return encodeURIComponent(e)},TradingView.clean=function(e,t,i){var s=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]],r=e;if(!e||!e.replace)return r;for(var n=0;n{"use strict";i.r(t);var s=i(2308),r=i(87438),n=i(74384);function o(e,t=!1){ "loading"!==document.readyState?t?setTimeout(()=>e(),1):e():document.addEventListener("DOMContentLoaded",()=>e())}new Promise(e=>{o(e)});function a(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth{document.addEventListener("mouseenter",e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){let e="x";if(t.matches(".apply-overflow-tooltip--direction_both")?e="both":t.matches(".apply-overflow-tooltip--direction_y")&&(e="y"),t.matches(".apply-overflow-tooltip--check-children")){let i=!1;const s=t.children;for(let t=0;t(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e),[]).join("").trim(),(0,n.showOnElement)(t,{text:i});const s=()=>{(0,n.hide)(),["mouseleave","mousedown"].forEach(e=>t.removeEventListener(e,s))};["mouseleave","mousedown"].forEach(e=>t.addEventListener(e,s))}},!0)});var l=i(5729),c=i.n(l),h=i(68177),d=i(7532);let u;function p(e){window.iframeAuthWidget&&!1===window.user.profile_data_filled&&(window.iframeAuthWidget.preventClose=!0);const t=window.user.available_offers||{};window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.user.is_pro&&window.location.reload()),!1===window.user.profile_data_filled&&((0,r.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):(Object.keys(t).forEach(e=>{const i=e;t[i].available_for_anons||delete t[i]}),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:t},h.TVLocalStorage.removeItem("trial_availiable"))}u=window.loginStateChange?window.loginStateChange:window.loginStateChange=new(c()),u.subscribe(null,p),s.TVXWindowEvents.on("loginStateChange",e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,u.fire()}),s.TVXWindowEvents.on("signOut",()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//].forEach(t=>{t.test(window.location.pathname)&&(e=!1)}),e&&window.location.reload()}()}),(()=>{const e={};window.crossTabSyncUserAttr=e=>{const t={};e instanceof Array?e.forEach(e=>{t[e]=window.user[e]}):t[e]=window.user[e],s.TVXWindowEvents.emit("user-obj-changed",JSON.stringify(t))},s.TVXWindowEvents.on("user-obj-changed",t=>{const i=JSON.parse(t);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(e[s]||[]).forEach(e=>{e.fire(i[s])})}})})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),u.fire()},window.loginUser=function(e,t){ window.TVDialogs&&window.TVDialogs.signModal&&window.TVDialogs.signModal.close(),window.user=(0,d.deepExtend)({},e),window.TradingView.changeLoginState(!0),"function"==typeof t&&window.TVDialogs&&window.TVDialogs.signModal?window.TVDialogs.signModal.on("signinSuccess",()=>{t()}):"function"==typeof t&&t()},window.loginRequiredDelegate=new(c()),window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=p,window.TradingView.setTrialAvailiable=e=>{h.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new(c())},50968:(e,t,i)=>{"use strict";i.r(t),i.d(t,{generateColor:()=>r,alphaToTransparency:()=>n,transparencyToAlpha:()=>o,applyTransparency:()=>a,resetTransparency:()=>l,getLuminance:()=>c,isHexColor:()=>h,colorFromBackground:()=>d,gradientColorAtPercent:()=>u,isColorDark:()=>p,rgbaFromInteger:()=>_,rgbaToInteger:()=>m,colorToInteger:()=>g});var s=i(14563);function r(e,t,i){if(t=t||0,!h(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(o(t)))):e;const[r,n,a]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(o(t));return(0,s.rgbaToString)([r,n,a,l])}function n(e){return 100*(1-e)}function o(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function a(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),r=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],o(t)*r))}function l(e){return"transparent"===e||h(e)?e:(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function c(e){const t=(0,s.parseRgb)(e).map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function h(e){return 0===e.indexOf("#")}function d(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function u(e,t,i){const[r,n,o,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(d-a));return(0,s.rgbaToString)(u)}function p(e){return c(l(e))<.5}function _(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},99432:(e,t,i)=>{"use strict";i.d(t,{doAnimate:()=>n});const s={from:0,duration:250,easing:i(83939).easingFunc.easeOutCubic};class r{constructor(e){this._doing=!0,this._completed=!1,this._options={...s,...e};const t=performance.now();window.requestAnimationFrame(e=>{this._animation(t,this._options.from,e)})}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const s=(i=!i||i<1e12?performance.now():i)-e,r=s>=this._options.duration||t===this._options.to,n=(o=this._options.from,a=this._options.to,l=this._options.easing(s/this._options.duration),o*(1-l)+a*l);var o,a,l;const c=r?this._options.to:n,h=c-t ;this._options.onStep(h,c),r?this._finishAnimation():window.requestAnimationFrame(t=>{this._animation(e,c,t)})}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function n(e){return new r(e)}},95152:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>s});(0,i(65447).getLogger)("Fetch");function s(e,t,i={}){return window.fetch(e,t)}},65447:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LOGLEVEL:()=>n,getLogLevel:()=>_,isHighRateEnabled:()=>m,setLogLevel:()=>g,getRawLogHistory:()=>f,serializeLogHistoryEntry:()=>v,getLogHistory:()=>S,getLogger:()=>b,loggingOn:()=>P,loggingOff:()=>C});const s="undefined"!=typeof window?window:{};let r=!1;try{localStorage.getItem(""),r=!0}catch(e){}var n;!function(e){e[e.ERROR=1]="ERROR",e[e.WARNING=2]="WARNING",e[e.INFO=3]="INFO",e[e.NORMAL=4]="NORMAL",e[e.DEBUG=5]="DEBUG"}(n||(n={}));let o=0;const a=[];let l=null,c=null,h=null,d=NaN,u=n.WARNING,p=!1;function _(){return u}function m(){return p}function g(e){e=Math.max(n.ERROR,Math.min(n.DEBUG,e)),u=e,T()}function f(e,t){let i=a.reduce((e,t)=>e.concat(t),[]);return i.sort((e,t)=>e.id-t.id),void 0!==t&&(i=i.filter(e=>e.subSystemId===t)),"number"==typeof e&&(i=i.slice(-e)),i}function v(e){return new Date(e.timestamp).toISOString()+":"+e.subSystemId+":"+e.message.replace(/"/g,"'")}function S(e,t){return function(e,t){let i,s=0,r=0;for(i=e.length-1;i>=1&&(s+=8*(1+encodeURIComponent(e[i]).length),!(i-1>0&&(r=8*(1+encodeURIComponent(e[i-1]).length),s+r>t)));i--);return e.slice(i)}(f(e,t).map(v),75497472)}function y(e,t,i,s){if(t===c&&s.id===h)return;const r=new Date;if(e<=n.NORMAL&&function(e,t,i,s,r){"function"==typeof structuredClone&&(t=structuredClone(t));const n={id:o,message:t,subSystemId:s,timestamp:Number(e)};o+=1,i.push(n),void 0!==r&&i.length>r&&i.splice(0,1)}(r,t,i,s.id,s.maxCount),e<=u&&(!s.highRate||m())&&(!l||s.id.match(l))){const i=r.toISOString()+":"+s.id+":"+t;switch(e){case n.DEBUG:console.debug(i);break;case n.INFO:case n.NORMAL:s.color?console.log("%c"+i,"color: "+s.color):console.log(i);break;case n.WARNING:console.warn(i);break;case n.ERROR:console.error(i)}c=t,h=s.id,d&&clearTimeout(d),d=setTimeout(()=>{c=null,h=null,d=NaN},1e3)}}function b(e,t={}){const i=[];a.push(i);const s=Object.assign(t,{id:e});function r(e){return t=>y(e,String(t),i,s)}return{logDebug:r(n.DEBUG),logError:r(n.ERROR),logInfo:r(n.INFO),logNormal:r(n.NORMAL),logWarn:r(n.WARNING)}}const w=b("logger"),P=s.lon=(e,t)=>{g(n.DEBUG),w.logNormal("Debug logging enabled"),p=Boolean(e),l=t||null,T()},C=s.loff=()=>{g(n.INFO),w.logInfo("Debug logging disabled")};function T(){try{r&&(localStorage.setItem("tv.logger.logHighRate",String(p)),localStorage.setItem("tv.logger.loglevel",String(u)))}catch(e){w.logWarn(`Cannot save logger state (level: ${u}, high-rate: ${p}) to localStorage: ${e.message}`)}}!function(){p=!!r&&"true"===localStorage.getItem("tv.logger.logHighRate");let e=parseInt(r&&localStorage.getItem("tv.logger.loglevel")||"");Number.isNaN(e)&&(e=n.WARNING),g(e),w.logNormal(`Init with settings - level: ${u}, high-rate: ${p}`)}(), s.performance&&s.performance.now?w.logNormal("Sync logger and perf times, now is "+s.performance.now()):w.logWarn("Perf time is not available")},73395:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},81447:(e,t,i)=>{"use strict";i.d(t,{visitObject:()=>n});var s=i(47903);function r(e,t,i){return(0,s.isArray)(e)?function(e,t,i){return e.map(e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s})}(e,t,i):(0,s.isObject)(e)&&((0,s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach(n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o}),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},46568:(e,t,i)=>{"use strict";function s(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}i.d(t,{regExpEscape:()=>s})},76553:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isRtl:()=>r,stripLTRMarks:()=>o,startWithLTR:()=>a,forceLTRStr:()=>l,forceLTRStrSsr:()=>c,forceRTLStr:()=>h,getLTRScrollLeft:()=>d,getLTRScrollLeftOffset:()=>u,detectAutoDirection:()=>m});var s=i(46417);const r=()=>"rtl"===window.document.dir,n=new RegExp("‎|‪|‫|‬","g");function o(e){return""!==e&&r()&&null!=e?e.replace(n,""):e}function a(e){return""!==e&&r()&&null!=e?"‎"+e:e}function l(e){return""!==e&&r()&&null!=e?"‪"+e+"‬":e}function c(e){return"‪"+e+"‬"}function h(e){return""!==e&&r()&&null!=e?"‫"+e+"‬":e}function d(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function u(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}const p=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,_=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function m(e){const t=p.exec(e);return t?_.test(t[0])?"rtl":"ltr":""}},83939:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(8596)},41062:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(3876),i.e(7039),i.e(8193),i.e(2614),i.e(5514),i.e(306),i.e(2402),i.e(1829),i.e(2077)]).then(i.bind(i,12028))}i.d(t,{loadChangeIntervalDialog:()=>s})},21273:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(41062);let r=null;function n(e){const t=r=(0,s.loadChangeIntervalDialog)().then(i=>{t===r&&i.showChangeIntervalDialog(e)});return t}},98737:(e,t,i)=>{"use strict";function s(e){ return Promise.all([i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(4078),i.e(8193),i.e(9602),i.e(9305),i.e(587),i.e(1778),i.e(6333),i.e(2321),i.e(9423),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(7591),i.e(7365),i.e(2444),i.e(9628),i.e(1859)]).then(i.bind(i,93548)).then(t=>t.showGoToDateDialog(e))}i.d(t,{showGoToDateDialog:()=>s})},97102:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(79881),r=i(87614);function n(e){"number"!=typeof e&&(e=TradingView.STUDY_COUNT_LIMIT),(0,r.showWarning)({title:(0,s.t)("Warning"),text:(0,s.t)("Studies limit exceeded: {number} studies per layout.\nPlease, remove some studies.").format({number:e})})}},42677:(e,t,i)=>{"use strict";i.d(t,{StudyMarket:()=>n});var s=i(32856),r=i.n(s);class n{constructor(e,t){this._visibility=new(r())(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t){var i;null===this._dialog&&this._requestDialog(e,t),null===(i=this._dialog)||void 0===i||i.open(e,void 0,t)}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}resetAllPages(){var e;null===(e=this._dialog)||void 0===e||e.resetAllStudies()}_requestDialog(e,t){if(null===this._dialogPromise){let s;s=Promise.all([i.e(3876),i.e(7039),i.e(4595),i.e(5698),i.e(4078),i.e(3708),i.e(2359),i.e(2850),i.e(9256),i.e(5514),i.e(306),i.e(2402),i.e(3590),i.e(6456)]).then(i.bind(i,36108)).then(e=>new e.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options)),this._dialogPromise=s.then(i=>{this._dialog=i,this._dialog.visible().subscribe(e=>{this._visibility.setValue(e)}),this._dialog.open(e,void 0,t)})}return this._dialogPromise}}},10426:(e,t,i)=>{"use strict";i.d(t,{setAdditionalSymbolInfoFields:()=>r,getAdditionalSymbolInfoFields:()=>n});let s=[];function r(e){s=e}function n(){return s}},41543:(e,t,i)=>{"use strict";function s(e,t){Promise.all([i.e(3876),i.e(7039),i.e(5410),i.e(5514),i.e(306),i.e(2402),i.e(9374)]).then(i.t.bind(i,69303,19)).then(i=>{i.showSymbolInfoDialog(e,t)})}i.d(t,{showSymbolInfoDialog:()=>s})},55799:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>s});class s{constructor(e){this._chartWidgetCollection=e}saveChartLineTools(e,t,i){return Promise.reject("Line tools storage is not supported")}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols(),s=i[t.activeChartWidget.value().id()],r={...(n=s,{...n,legs:JSON.stringify(null!==(o=n.legs)&&void 0!==o?o:[])})};var n,o;const a=t.metaInfo;return a.id.value()&&(r.id=a.id.value()),r.name=a.name.value()||"",r.description=a.description.value()||"",r.charts_symbols=function(e){const t={};for(const i of Object.keys(e))t[i]={symbol:e[i].symbol};return JSON.stringify(t)}(i),r.is_realtime=r.is_realtime=e?"0":"1",r}_saveLineToolsToStorage(){return Promise.resolve()}}},89171:(e,t,i)=>{"use strict";var s=i(5729),r=i(79881).t,n=i(16282).assert,o=i(47903).deepEquals,a=i(90774).backend,l=i(55799).ChartSaverBase ;r("The publication preview could not be loaded. Please disable your browser extensions and try again."),r("Failed to save library"),r("Failed to save script");function c(e,t){e.content=JSON.stringify(t)}t.ChartSaver=class extends l{constructor(e){super(e),this._chartAboutToBeSavedDelegate=new s,this._chartSavedDelegate=new s,this._prevChartState=null,this._chartSizeLimitExceededDelegate=new s}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}whenReadyToSave(e){var t=this._chartWidgetCollection.activeChartWidget.value().model().mainSeries();if(t.hasDelayedSymbolIntervalChange()){var i,s=null;i=function(){t.dataEvents().symbolError().unsubscribe(null,s,!0),e()},s=function(){t.dataEvents().symbolResolved().unsubscribe(null,i,!0)},t.dataEvents().symbolResolved().subscribe(null,i,!0),t.dataEvents().symbolError().subscribe(null,s,!0)}else e()}saveToJSON(){var e=this._getCommonSavingInfo(!1);return c(e,this._getChartWidgetCollectionState(!1,!0)),e}_getChartWidgetCollectionState(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)}publishChart(e){}publishScript(e,t,i){}onPublish(e,t){}_saveChartImpl(e,t,i,s,r,n){var o=i,l=s;if(o=function(s){t.id.value()||(t.id.setValue(s),t.uid.setValue(s)),"function"==typeof i&&i(t,e)},!e.name)return console.warn("Saving chart with empty name is not allowed"),void s();a.saveChart(e.name,e.short_name,e.resolution,e,t).then(o.bind(this)).catch(l.bind(this))}_saveChart(e,t,i,s){var r=this._chartWidgetCollection.metaInfo,n=function(n){return o(this._prevChartState,n)[0]&&null!=r.id.value()?(this._chartSavedDelegate.fire(!0),void(t&&t(r,n))):this._saveChartImpl(n,r,t,i,s,e)}.bind(this);this._saveLineToolsToStorage().then((function(){var t=e(!0);return n(t)})).catch((function(t){var i=e(!1);return n(i)}))}saveChartSilently(e,t,i){i=i||{};var s=function(e){var t=e&&(void 0)("remove_line_tools_from_content"),s=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),r=this._getCommonSavingInfo(!1,t);return c(r,s),i.chartName&&(r.name=i.chartName),r.name&&0!==r.name.length||!i.defaultChartName||(r.name=i.defaultChartName),i.autoSave&&(r.autoSave=!0),r}.bind(this);this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart(s,function(t,i){n(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),this._chartWidgetCollection.metaInfo.name.setValue(i.name),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid.value(),data:i}),delete this._prevChartState.savingToken}.bind(this),function(){this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t.apply(null,arguments)}.bind(this),i)}isSaveInProcess(){return this._isSaveInProcess}}},7691:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(79881);function s(e){return e.description||""}},22675:(e,t,i)=>{ "use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},85545:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const r=e.length;for(;is})},7532:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach(t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach(i=>{const n=e[i],o=t[i];if(o===e)return;const a=Array.isArray(o);if(o&&(r(o)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&r(n)?n:{},e[i]=s(t,o)}else void 0!==o&&(e[i]=o)})}),e):e}function r(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},97849:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},28994:(e,t,i)=>{"use strict";i.d(t,{getTwemojiUrl:()=>r});var s=i(45623);function r(e,t){let i="";return s.default.parse(e,e=>(i=s.default.base+("svg"===t?`svg/${e}.svg`:`72x72/${e}.png`),!1)),i}},45259:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>r,randomHash:()=>n,randomHashN:()=>o});const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function n(){return o(12)}function o(e){let t="";for(let i=0;i{"use strict";i.d(t,{parseHtml:()=>r,parseHtmlElement:()=>n});const s=new WeakMap;function r(e,t){let i,r;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(r=s.get(i)),r||(r=i.ownerDocument.createRange(),r.selectNodeContents(i),s&&s.set(i,r)),r.createContextualFragment(e)}function n(e,t){const i=r(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}},39197:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const r=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(r.join(", "))&&e.preventDefault()}},5225:(e,t,i)=>{"use strict";i.d(t,{htmlEscape:()=>n,removeSpaces:()=>o,capitalizeFirstLetterInWord:()=>a});const s=/[<"'&>]/g,r=e=>`&#${e.charCodeAt(0)};`;function n(e){return e.replace(s,r)}function o(e=""){ return e.replace(/\s+/g,"")}function a(e=""){return e.replace(/\b\w/g,e=>e.toUpperCase())}},4334:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},26134:(e,t,i)=>{"use strict";i.d(t,{ChunkLoader:()=>s});class s{constructor(){this._retries=5,this._cache=null,this._tryLoad=e=>{this._retries=this._retries-1;this._startLoading().then(e,0!==this._retries?()=>setTimeout(()=>this._tryLoad(e),3e3):void 0)}}load(){return this._cache||(this._cache=new Promise(this._tryLoad)),this._cache}}},33350:(e,t,i)=>{"use strict";function s(e,t){const i=e.files&&e.files.length>0;if(!i&&t&&t.eventPhase>0)return r(t,e),Promise.resolve();if(!i){let t=!1;const i=i=>{i.stopImmediatePropagation(),r(i,e),t=!0};try{document.addEventListener("copy",i,!0),document.execCommand("copy")}finally{document.removeEventListener("copy",i,!0)}if(t)return Promise.resolve()}return async function(e){if(!navigator.clipboard||!navigator.clipboard.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");const t={};for(const i of e.files||[])t[i.type]=i;e.text&&(t["text/plain"]=e.text);e.html&&(t["text/html"]=e.html);return navigator.clipboard.write([new window.ClipboardItem(t)])}(e)}function r(e,t){e.preventDefault();const i=e.clipboardData;t.text&&i.setData("text/plain",t.text),t.html&&i.setData("text/html",t.html)}async function n(e,t){if("text/plain"===t&&!navigator.clipboard.write){const t=await e;return navigator.clipboard.writeText(await t.text())}if(!navigator.clipboard||!navigator.clipboard.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");let i=null;try{i=new window.ClipboardItem({[t]:e})}catch(s){i=new window.ClipboardItem({[t]:await e})}if(i)return navigator.clipboard.write([i]);throw new Error("ClipboardApi is not supported")}i.d(t,{writeImpl:()=>s,writePromiseUsingApi:()=>n})},50494:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return null;const t=e.match(/(delayed_streaming)_([\d]{1,4})/);return null===t?null:{mode:t[1],interval:parseInt(t[2])}}i.d(t,{parseUpdateMode:()=>s})},10165:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{WeekDays:()=>s,Months:()=>r}),function(e){e[e.SUNDAY=1]="SUNDAY",e[e.MONDAY=2]="MONDAY",e[e.TUESDAY=3]="TUESDAY",e[e.WEDNESDAY=4]="WEDNESDAY",e[e.THURSDAY=5]="THURSDAY",e[e.FRIDAY=6]="FRIDAY",e[e.SATURDAY=7]="SATURDAY"}(s||(s={})),function(e){e[e.JANUARY=0]="JANUARY",e[e.FEBRUARY=1]="FEBRUARY",e[e.MARCH=2]="MARCH",e[e.APRIL=3]="APRIL",e[e.MAY=4]="MAY",e[e.JUNE=5]="JUNE",e[e.JULY=6]="JULY",e[e.AUGUST=7]="AUGUST",e[e.SEPTEMBER=8]="SEPTEMBER",e[e.OCTOBER=9]="OCTOBER",e[e.NOVEMBER=10]="NOVEMBER",e[e.DECEMBER=11]="DECEMBER"}(r||(r={}))},61389:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},42971:(e,t,i)=>{"use strict";function s(e=location.host){ return-1!==["i18n.tradingview.com","partial.tradingview.com","www.tradingview.com","wwwcn.tradingview.com"].indexOf(e)||-1!==["d33t3vvu2t2yu5.cloudfront.net","dwq4do82y8xi7.cloudfront.net","s.tradingview.com","s3.tradingview.com"].indexOf(e)||e.match(/^[a-z]{2}\.tradingview\.com/)||e.match(/prod-[^.]+.tradingview.com/)?"battle":e.includes("tradingview.com")||e.includes("staging")?"staging":e.match(/webcharts/)?"staging_local":(e.match(/^localhost(:\d+)?$/),"local")}function r(){return"local"===s()}function n(){return"battle"===s()}function o(){return!n()}i.r(t),i.d(t,{environment:()=>s,isLocal:()=>r,isProd:()=>n,isDebug:()=>o})},52541:(e,t,i)=>{"use strict";i.d(t,{preventDefault:()=>r,wrapHandlerWithPreventEvent:()=>n,preventScrollByWheelClick:()=>o});var s=i(43367);function r(e){e.cancelable&&e.preventDefault()}function n(e){return t=>{r(t),e()}}function o(e){s.isChrome&&e.addEventListener("mousedown",e=>{if(1===e.button)return e.preventDefault(),!1})}},85103:(e,t,i)=>{"use strict";i.d(t,{FeatureToggleWatchedValue:()=>n});var s=i(32856),r=i.n(s);class n extends(r()){constructor(e,t){super(function(e,t){return t}(0,t))}destroy(){0}}},67869:(e,t,i)=>{"use strict";var s=i(68177).TVLocalStorage,r=i(5729);i(43367);var n=new r;TradingView.FeatureToggle={force_prefix:"forcefeaturetoggle.",onChanged:new r,enableFeature:function(e){s.setItem(this.force_prefix+e,"true"),n.fire(e)},disableFeature:function(e){s.setItem(this.force_prefix+e,"false"),n.fire(e)},resetFeature:function(e){s.removeItem(this.force_prefix+e),n.fire(e)},onFeaturesStateChanged:function(){return n}},TradingView.isFeatureEnabled=function(e){function t(e){try{var t=(void 0)(e+function(){if(window.user&&window.user.id)return window.user.id;var e=s.getItem("featuretoggle_seed");return null!==e||(e=Math.floor(1e6*Math.random()),s.setItem("featuretoggle_seed",e)),e}());return new DataView(t).getUint32(0,!0)/4294967296}catch(e){return.5}}return function(i){return!("local"!==window.environment||!function(e){var t=new RegExp("broker_[A-Z]+[a-zA-Z0-9_]+_dev","g"),i=new RegExp("hide_[A-Z]+[a-zA-Z0-9_]+_on_ios","g"),s=new RegExp("hide_[A-Z]+[a-zA-Z0-9_]+_on_android","g"),r=new RegExp("hide_[A-Z]+[a-zA-Z0-9_]+_on_mobile_web","g") ;return-1===["broker_FXCM_token_v2","broker_TRADESTATION_V3","broker_TRADOVATE_dev","black_friday_mainpage","black_friday_popup","datawindow","trading-fast-renew-oauth-token","switching_trial_year_to_month_disabled","switching_year_to_month_disabled","default_year_billing_cycle_switcher","marketing-analytics","google-ads","visible_address_fields_by_default","slow-support-warning","hide-trading-floating-toolbar","tvcoins_donations","save-short-streams","details_disable_bid_ask","vat_disabled","pro_plan_upgrades_disabled","pro_plan_downgrades_disabled","unit_conversion","disable_recaptcha_on_signup","braintree-order-one-click-dropdown","braintree-trial-implementation","braintree-gopro-in-order-dialog","braintree-apple-pay","braintree-google-pay","braintree-apple-pay-trial","braintree-google-pay-trial","hide_gopro_popup_upgrade_button","yandex_metric_enabled","broker_id_session","remove_line_tools_from_content","do_not_save_shared_line_tools_to_charts","save_shared_line_tools","chart_storage_with_broker_name","do_not_invalidate_chart_on_changing_line_tools","autosave_line_tools_immediately","log_removing_line_tools_group","oanda-european-accounts-warning","mobile_show_bottom_panel","disable_save_settings","desktop_version_notification_enabled","paperrest_2fa","paperrest_preview","favorites-in-broker-dropdown","streams_stats_profile","hide_ecomonic_events","aggregating_page_pings","mobile_trading_web","mobile_trading_ios","mobile_trading_android","hide_real_brokers_on_mobile","percentage_values_for_percentage_scale","hide_ranges_label_colors","disable_user_specific_encryption","remove_scale_settings_from_menu","enable_deep_history_backtesting","show_checkbox_of_house_rules_to_idea_and_script","disable_phone_verification_sms"].indexOf(e)&&-1===e.indexOf("-maintenance")&&!1===t.test(e)&&!1===i.test(e)&&!1===s.test(e)&&!1===r.test(e)}(i))||(!e[i]||-1!==e[i])&&(!!("true"===s.getItem(TradingView.FeatureToggle.force_prefix+i)||window.is_authenticated&&"undefined"!=typeof user&&user.settings&&"true"===user.settings[TradingView.FeatureToggle.force_prefix+i])||!("false"===s.getItem(TradingView.FeatureToggle.force_prefix+i)||window.is_authenticated&&"undefined"!=typeof user&&user.settings&&"false"===user.settings[TradingView.FeatureToggle.force_prefix+i])&&(!!e[i]&&(1===e[i]||t(i)<=e[i])))}}(window.featureToggleState||{}),t.FeatureToggle=TradingView.FeatureToggle,t.isFeatureEnabled=TradingView.isFeatureEnabled,t.onFeaturesStateChanged=TradingView.FeatureToggle.onFeaturesStateChanged.bind(TradingView.FeatureToggle)},82041:(e,t,i)=>{"use strict";function s(e){if(e instanceof Error)return e.stack||e.message;try{return e.outerHTML.slice(0,1024)}catch(e){}try{if(void 0!==e)return JSON.stringify(e).slice(0,1024)}catch(e){}return String(e)}function r(){window.__tv_js_errors||(window.__tv_js_errors=[]),window.addEventListener("error",e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} ${e.message||"JS error"}. ${e.filename||""}, line ${e.lineno}, col ${e.colno}.\nError: `+s(e.error))},!1), window.addEventListener("unhandledrejection",e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(t+" Unhandled rejection.\nReason: "+s(e.reason))},!1),document.addEventListener("securitypolicyviolation",e=>{var t,i;const r=(new Date).toISOString(),n="report"===e.disposition?"CSP report-only":"CSP violation";window.__tv_js_errors.push(`${r} ${n}: ${e.violatedDirective||e.effectiveDirective}. ${e.sourceFile||""}, line ${null!==(t=e.lineno)&&void 0!==t?t:e.lineNumber}, col ${null!==(i=e.colno)&&void 0!==i?i:e.columnNumber}.\nBlocked URI: ${e.blockedURL||e.blockedURI}\nSample: ${e.sample}\nTarget: `+s(e.target))},!1)}i.d(t,{install:()=>r})},18437:(e,t,i)=>{"use strict";i.r(t),i.d(t,{unsubscribe:()=>l,on:()=>c,subscribe:()=>h,subscribeToAll:()=>d,emit:()=>u,emitOnce:()=>p});var s=i(5729),r=i.n(s);const n={},o=[],a={};function l(e,t,i){n[e].unsubscribe(i,t)}function c(e,t,i){h(e,t,i)}function h(e,t,i,s){n.hasOwnProperty(e)||(n[e]=new(r())),a[e]?t.call(i):n[e].subscribe(i,t,s)}function d(e){o.push(e)}function u(e,...t){const i=[e].concat(t);o.forEach(e=>{e.apply(null,i)}),n.hasOwnProperty(e)&&n[e].fire.apply(n[e],t)}function p(e){a[e]&&console.warn(`Something went wrong: emitOnce called multiple times with same event (${e})`),a[e]=!0,u.apply(null,arguments)}},60934:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Modifiers:()=>s.Modifiers,createGroup:()=>u,pressedKeys:()=>d,registerWindow:()=>p,unregisterWindow:()=>_});var s=i(42998),r=i(15738),n=i(32856),o=i.n(n);var a=i(87438);class l{constructor(e,t){this._group=e,this.hotkey=t.hotkey,this.handler=t.handler,this.desc=t.desc,this.element=t.element||null,t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1}destroy(){this._group&&(this._group.remove(this),this._group=null)}}class c{constructor(e,t){this._actions=[],this._manager=e,this.modal=!(!t||!t.modal),t&&(this.desc=t.desc),t&&t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1,this._manager.registerGroup(this)}add(e){const t=new l(this,e);return this._actions.push(t),t}remove(e){for(let t=this._actions.length;t-- >0;)this._actions[t]===e&&this._actions.splice(t,1)}handleHotkey(e,t){for(let i=this._actions.length;i-- >0;){const r=this._actions[i];if(r.hotkey===e&&((!r.element||t.target&&r.element.contains(t.target))&&!r.isDisabled()))return r.handler(t),t.preventDefault(),(0,a.trackEvent)("Keyboard Shortcuts",(0,s.humanReadableHash)(e)),!0}return!1}promote(){this._manager.promoteGroup(this)}destroy(){this._actions.length=0,this._manager.unregisterGroup(this)}}const h=new class{constructor(){this._groups=[],this._pressedKeys=new(o())(0),this._keyDownListener=e=>{if(e.defaultPrevented)return;const t=(0,s.hashFromEvent)(e);if(this._pressedKeys.setValue(t),!(0,r.isNativeUIInteraction)(t,e.target))for(let i=this._groups.length;i-- >0;){const s=this._groups[i];if(!s.isDisabled()){if(s.handleHotkey(t,e))return;if(s.modal)return}}},this._keyUpListener=e=>{const t=(0, s.hashFromEvent)(e);this._pressedKeys.setValue(t)},this._blurEvent=()=>{this._pressedKeys.setValue(0)},this._mouseEvent=e=>{const t=(0,s.modifiersFromEvent)(e),i=255&this._pressedKeys.value();this._pressedKeys.setValue(t|i)}}listen(e){e.addEventListener("keydown",this._keyDownListener),e.addEventListener("keyup",this._keyUpListener),e.addEventListener("blur",this._blurEvent),e.addEventListener("mousemove",this._mouseEvent)}unlisten(e){e.removeEventListener("keydown",this._keyDownListener),e.removeEventListener("keyup",this._keyUpListener),e.removeEventListener("blur",this._blurEvent),e.removeEventListener("mousemove",this._mouseEvent)}registerGroup(e){this._groups.push(e)}unregisterGroup(e){for(let t=this._groups.length;t--;)this._groups[t]===e&&this._groups.splice(t,1)}promoteGroup(e){let t=this._groups.length-1;for(let i=this._groups.length;i--;){if(this._groups[i]===e)return void(i!==t&&(this._groups.splice(i,1),this._groups.splice(t,0,e)));this._groups[i].modal&&(t=i-1)}}pressedKeys(){return this._pressedKeys}},d=h.pressedKeys();function u(e){return new c(h,e)}function p(e){h.listen(e)}function _(e){h.unlisten(e)}p(window)},42998:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMacKeyboard:()=>r,Modifiers:()=>n,modifiersFromEvent:()=>o,hashFromEvent:()=>a,hashShiftPlusEnter:()=>l,humanReadableModifiers:()=>c,humanReadableHash:()=>d});var s=i(43367);const r=(0,s.isMac)()||s.CheckMobile.iOS();var n;function o(e){let t=0;return e.shiftKey&&(t+=1024),e.altKey&&(t+=512),e.ctrlKey&&(t+=256),e.metaKey&&(t+=2048),t}function a(e){return o(e)|e.keyCode}!function(e){e[e.None=0]="None",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Mod=r?2048:256]="Mod",e[e.Control=256]="Control",e[e.Meta=2048]="Meta"}(n||(n={}));const l=1037;function c(e,t=!r){let i="";return 256&e&&(i+=r?"^":"Ctrl",t&&(i+=" + ")),512&e&&(i+=r?"⌥":"Alt",t&&(i+=" + ")),1024&e&&(i+=r?"⇧":"Shift",t&&(i+=" + ")),2048&e&&(i+=r?"⌘":"Win",t&&(i+=" + ")),i}const h={9:"⇥",13:"↵",27:"Esc",8:r?"⌫":"Backspace",32:"Space",35:"End",36:"Home",37:"←",38:"↑",39:"→",40:"↓",45:"Ins",46:"Del",188:",",191:"/"};for(let e=1;e<=16;e++)h[e+111]="F"+e;function d(e){let t=c(e);const i=255&e;return t+=i in h?h[i]:String.fromCharCode(i),t}},27192:(e,t,i)=>{"use strict";i.d(t,{migrateShortcut:()=>o});var s=i(42998);function r(e){if("number"==typeof e)return e;switch(e.toLowerCase()){case"ctrl":return s.Modifiers.Control;case"shift":return s.Modifiers.Shift;case"alt":return s.Modifiers.Alt;default:return e.toUpperCase().charCodeAt(0)}}function n(e){let t=0;for(let i=0;i{"use strict";i.d(t,{isTextEditingField:()=>r,isNativeUIInteraction:()=>n});var s=i(42998);function r(e){if("INPUT"===e.tagName){const t=e.type;return"text"===t||"email"===t||"number"===t||"password"===t||"search"===t||"tel"===t||"url"===t}return"TEXTAREA"===e.tagName||e.isContentEditable}function n(e,t){if(!t)return!1;const i=255&e;if(27===i||i>>>4==7)return!1;switch(e^i){ case s.Modifiers.Alt:return(38===i||40===i)&&"SELECT"===t.tagName||r(t);case s.Modifiers.Alt+s.Modifiers.Shift:return r(t);case s.Modifiers.Mod:if(67===i||!s.isMacKeyboard&&45===i){const e=t.ownerDocument&&t.ownerDocument.getSelection();if(e&&!e.isCollapsed)return!0}return r(t);case s.Modifiers.Mod+s.Modifiers.Shift:return i>=33&&i<=40&&r(t);case s.Modifiers.Shift:case 0:return!!(9!==i||t.ownerDocument&&t!==t.ownerDocument.body&&t!==t.ownerDocument.documentElement)&&((13===i||32===i||!function(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){const t=e.type;if("submit"===t||"button"===t||"reset"===t||"checkbox"===t||"radio"===t)return!0}return!1}(t))&&("form"in t||t.isContentEditable))}return!1}},24287:(e,t,i)=>{"use strict";i.d(t,{linking:()=>u});var s=i(99479),r=i(32856),n=i.n(r),o=i(27490),a=i(25436),l=i(65447),c=i(96675);const h=(0,l.getLogger)("Linking");var d;!function(e){e[e.NotBound=0]="NotBound",e[e.BoundToWidget=1]="BoundToWidget",e[e.BoundToModel=2]="BoundToModel"}(d||(d={}));const u=new class{constructor(){this._watchedSymbol=new(n()),this._seriesShortSymbol=new(n()),this._proSymbol=new(n()),this._watchedInterval=new(n()),this._watchedIntraday=new(n()),this._watchedSeconds=new(n()),this._watchedTicks=new(n()),this._watchedRange=new(n()),this._watchedSupportedResolutions=new(n()),this._watchedSupportedChartStyles=new(n())([]),this._symbolNamesList=new(n()),this._chartWidgetBindingState=d.NotBound,this._activeChartWidget=null,this._watchedSymbolListenerBound=this._watchedSymbolListener.bind(this),this._watchedIntervalListenerBound=this._watchedIntervalListener.bind(this),this._onSymbolLinkBound=this._onSymbolLink.bind(this),this._searchCharts=null,this._searchChartsLoadDebounced=null,this._selfEmit=!1,this._preventFeedBySymbol=!1,this._feedBySymbolDebounceCounter=0}get symbol(){return this._watchedSymbol}get proSymbol(){return this._proSymbol}get symbolNamesList(){return this._symbolNamesList}get seriesShortSymbol(){return this._seriesShortSymbol.readonly()}get interval(){return this._watchedInterval}get intraday(){return this._watchedIntraday.readonly()}get seconds(){return this._watchedSeconds.readonly()}get ticks(){return this._watchedTicks.readonly()}get range(){return this._watchedRange.readonly()}get supportedResolutions(){return this._watchedSupportedResolutions.readonly()}get supportedChartStyles(){return this._watchedSupportedChartStyles.readonly()}get preventFeedBySymbol(){return this._preventFeedBySymbol}bindToChartWidget(e){if(this.unbindFromChartWidget(),this._activeChartWidget=e,e.hasModel())return void this._onChartModelCreated(e.model());e.modelCreated().subscribe(this,this._onChartModelCreated),this._chartWidgetBindingState=d.BoundToWidget;const t=e.properties().childs().mainSeriesProperties.childs();this._watchedSymbol.setValue(t.symbol.value()),this._watchedInterval.setValue(t.interval.value())}unbindFromChartWidget(){switch(this._chartWidgetBindingState){case d.BoundToWidget:if(!this._activeChartWidget)throw new Error("ChartWidget is undefined") ;this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);break;case d.BoundToModel:this._symbolProperty().unsubscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.unsubscribe(this._watchedSymbolListenerBound),this._mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._updateSeriesSymbolInfo),this._mainSeries().dataEvents().symbolError().unsubscribe(this,this._updateSeriesSymbolInfo),this._intervalProperty().unsubscribe(this,this._onIntervalPropertyChange),this._watchedInterval.unsubscribe(this._watchedIntervalListenerBound),delete this._watchedSymbol.hook,delete this._watchedSymbol.writeLock}this._activeChartWidget=null,this._chartWidgetBindingState=d.NotBound}getChartWidget(){return this._activeChartWidget}bindToChartWidgetCollection(e){this._chartWidgetCollection=e,this.unbindFromChartWidget(),e.activeChartWidget.subscribe(e=>{this.unbindFromChartWidget(),this.bindToChartWidget(e)},{callWithLast:!0})}bindToSearchCharts(e){this.unbindFromSearchCharts(),this._searchCharts=e,e.onSearchBySymbol.subscribe(this,this._onSearchBySymbol),e.loadingSymbol.subscribe(e=>{!1===e&&(this._feedBySymbolDebounceCounter=0)}),this._watchedSymbol.subscribe(this._onSymbolLinkBound)}unbindFromSearchCharts(){this._searchCharts&&(this._searchCharts.onSearchBySymbol.unsubscribe(this,this._onSearchBySymbol),this._watchedSymbol.unsubscribe(this._onSymbolLinkBound),this._searchCharts=null)}setPreventFeedBySymbol(e){this._preventFeedBySymbol=e}_onSearchBySymbol(e){if(!e.resolved_symbol)throw new Error("no resolved_symbol");this._selfEmit=!0,this._watchedSymbol.setValue(e.resolved_symbol),this._selfEmit=!1}_onSymbolLink(e){if(!this._selfEmit){if(!this._searchCharts){const e="No search charts defined";throw h.logError(e),new Error(e)}this._preventFeedBySymbol||this._loadSearchCharts(e)}}_loadSearchCharts(e){if(!this._searchCharts){const e="No search charts defined";throw h.logError(e),new Error(e)}if(this._searchChartsLoadDebounced)return void(this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced(e)));const t=e=>this._searchCharts?(!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchChartsLoadDebounced=null,this._searchCharts.feedBySymbol.call(this._searchCharts,e)):()=>{};!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchCharts.feedBySymbol(e)}_mainSeries(){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");return this._activeChartWidget.model().mainSeries()}_properties(){return this._mainSeries().properties()}_symbolProperty(){return this._properties().symbol}_intervalProperty(){return this._properties().interval}_watchedSymbolListener(e){ this._symbolProperty().value()!==e&&this._chartWidgetCollection.setSymbol(e)}_sendSnowplowAnalytics(){if(!window.user.do_not_track)throw new Error("unsupported")}_onSymbolPropertyChange(){const e=this._symbolProperty().value()!==this._watchedSymbol.value();this._watchedSymbol.setValue(this._symbolProperty().value()),e&&this._chartWidgetCollection.setSymbol(this._symbolProperty().value())}_onSymbolResolved(e){const t=this._mainSeries().symbolInfo();t&&this._applyValuesFromSymbolInfo(t)}_applyValuesFromSymbolInfo(e){const t=e.pro_name||o.enabled("trading_terminal")&&(e.full_name||e.name)||"";this._proSymbol.setValue(t),e.aliases&&this._symbolNamesList.setValue(e.aliases)}_updateSeriesSymbolInfo(){this._seriesShortSymbol.setValue(this._properties().shortName.value());const e=this._mainSeries().symbolInfo();if(e){this._applyValuesFromSymbolInfo(e);{const t=e.supported_resolutions;t?this._watchedSupportedResolutions.setValue(t):this._watchedSupportedResolutions.setValue(void 0)}let t=(0,c.allChartStyles)();(0,a.isCloseBasedSymbol)(e)&&(t=t.filter(e=>(0,a.isSingleValueBasedStyle)(e))),this._watchedSupportedChartStyles.setValue(t),this._watchedIntraday.setValue(!!e.has_intraday),this._watchedSeconds.setValue(!!e.has_seconds),this._watchedTicks.setValue(!(0,a.isCloseBasedSymbol)(e)&&!!e.has_ticks),this._watchedRange.setValue(!(0,a.isCloseBasedSymbol)(e))}else this._watchedIntraday.deleteValue(),this._watchedSeconds.deleteValue(),this._watchedTicks.deleteValue(),this._watchedRange.deleteValue(),this._proSymbol.deleteValue()}_watchedIntervalListener(e){this._intervalProperty().value()!==e&&this._chartWidgetCollection.setResolution(e)}_onIntervalPropertyChange(){const e=this._intervalProperty().value()!==this._watchedInterval.value();this._watchedInterval.setValue(this._intervalProperty().value()),e&&this._chartWidgetCollection.setResolution(this._intervalProperty().value())}_onChartModelCreated(e){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");this._chartWidgetBindingState=d.BoundToModel,this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);const t=this._symbolProperty();t.subscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.setValue(t.value()),this._watchedSymbol.subscribe(this._watchedSymbolListenerBound);const i=this._mainSeries();i.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),this._watchedSymbol.hook=e=>(i.symbolSameAsCurrent(e)&&(e=i.symbol()),e),i.dataEvents().symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolError().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolGroupNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo();const s=this._intervalProperty();s.subscribe(this,this._onIntervalPropertyChange),this._watchedInterval.setValue(s.value()),this._watchedInterval.subscribe(this._watchedIntervalListenerBound), this._activeChartWidget.readOnly()&&(this._watchedSymbol.writeLock=!0)}};window.TradingViewApi||(window.TradingViewApi={linking:u})},68177:(e,t,i)=>{"use strict";const{getLogger:s}=i(65447),r=s("TVLocalStorage");var n=function(){try{this.isAvailable=!0,this.localStorage=window.localStorage,this.localStorage.setItem("tvlocalstorage.available","true")}catch(e){delete this.isAvailable,delete this.localStorage}this._updateLength();try{this._report()}catch(e){}};n.prototype._report=function(){if(this.isAvailable){const e=10,t=[];for(let e=0;et.length-e.length);const i=t.slice(0,e);t.sort((e,t)=>t.key.length-e.key.length);const s=t.slice(0,e);r.logNormal("Total amount of keys in Local Storage: "+this.length),r.logNormal(`Top ${e} keys with longest values: ${JSON.stringify(i)}`),r.logNormal(`Top ${e} longest key names: ${JSON.stringify(s)}`);try{navigator.storage.estimate().then(e=>{r.logNormal("Storage estimate: "+JSON.stringify(e))})}catch(e){}}},n.prototype.length=0,n.prototype.isAvailable=!1,n.prototype.localStorage={"tvlocalstorage.available":"false"},n.prototype._updateLength=function(){if(this.isAvailable)this.length=this.localStorage.length;else{var e,t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},n.prototype.key=function(e){return this.isAvailable?this.localStorage.key(e):Object.keys(this.localStorage)[e]},n.prototype.getItem=function(e){return this.isAvailable?this.localStorage.getItem(e):void 0===this.localStorage[e]?null:this.localStorage[e]},n.prototype.setItem=function(e,t){this.isAvailable?this.localStorage.setItem(e,t):this.localStorage[e]=t,this._updateLength()},n.prototype.removeItem=function(e){this.isAvailable?this.localStorage.removeItem(e):delete this.localStorage[e],this._updateLength()},n.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()};var o=function(e){this.storage=e};o.prototype.getItem=function(e){return Promise.resolve(this.storage.getItem(e))},o.prototype.setItem=function(e,t){return Promise.resolve(this.storage.setItem(e,t))},window.TVLocalStorage=new n,window.TVLocalStorageAsync=new o(window.TVLocalStorage),e.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},22900:(e,t,i)=>{"use strict";function s(e,t=!1){return!1}function r(e){return e}i.d(t,{isOnMobileAppPage:()=>s,urlWithMobileAppParams:()=>r})},73305:(e,t,i)=>{"use strict";function s(){}i.d(t,{addPerfMark:()=>o});const r=console.timeStamp?console.timeStamp.bind(console):s,n=window.performance&&performance.mark?performance.mark.bind(performance):s;window.performance&&performance.measure&&performance.measure.bind(performance),window.performance&&performance.clearMarks&&performance.clearMarks.bind(performance);function o(e){r(e),n(e)}},36413:(e,t,i)=>{"use strict";function s(e){return e===r(e)}function r(e){const t=e.indexOf("$"),i=e.indexOf("@") ;return t<0&&i>=0?null:e.substring(Math.max(t+1,0),i>=0?i:e.length)}i.d(t,{isPineIdString:()=>s,extractPineId:()=>r})},86573:(e,t,i)=>{"use strict";i.r(t),i.d(t,{registerService:()=>o,unregisterService:()=>a,hasService:()=>l,service:()=>c,waitServiceRegistered:()=>h});var s=i(61389);const r={},n=new Map;function o(e,t){if(l(e))throw new Error("Service already registered");r[e.id]=t;const i=n.get(e.id);void 0!==i&&(n.delete(e.id),i.resolve(t))}function a(e){if(!l(e))throw new Error("Service not found");r[e.id]=void 0}function l(e){return void 0!==r[e.id]}function c(e){const t=r[e.id];if(void 0===t)throw new Error("ServiceLocator: Service "+e.id+" not found");return t}function h(e){if(l(e))return Promise.resolve(c(e));let t=n.get(e.id);return void 0===t&&(t=(0,s.createDeferredPromise)(),n.set(e.id,t)),t.promise}},64222:(e,t,i)=>{"use strict";e=i.nmd(e),i(43367);i(95152).fetch;var s=i(46568).regExpEscape,r=i(2308).TVXWindowEvents,n=i(68177).TVLocalStorage,o=i(5729),a=i(27490),l=["s.tradingview.com","betacdn.tradingview.com"],c=a.enabled("use_localstorage_for_settings"),h=window.TVSettings=function(){var e=!1,t=null;function i(){return!t&&c}try{e=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}if(e){var d={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},u=function(e,t,i){var s=d[e];return null==s?t:s},p=function(){};return{loaded:!1,loadedModel:!1,getValue:u,getJSON:u,getBool:u,getFloat:u,getInt:u,setValue:p,setJSON:p,remove:p,keys:function(){return Object.keys(d)},keysMask:function(){return[]},sync:p,onSync:{subscribe:function(){}}}}window.environment;var _,m=TradingView.onWidget()?"tradingview-widget":"tradingview",g=m+".",f={},v=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^domepanel.visible$/,/^orderpanel.visible$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/,/^trading\.orderWidgetMode\./,/^symbolWatermark$/,/^pinereference\.size$/,/^pinereference\.position$/,/^hint\.+/,/^ChartDrawingToolbarWidget\.visible/];const S=["current_theme.name"];function y(e){return g+e}function b(e){return e.substring(g.length)}function w(e,t){var i=f[e];return null==i?t:i}function P(e,t,i){i=i||{};var s=""+t;return f[e]!==s&&(f[e]=s,T(e)),i.forceFlush&&!_&&(_=setTimeout((function(){_=void 0,x()}),10)),h}function C(e,t){return t=t||{},null!=f[e]&&(delete f[e],T(e)),t.forceFlush&&x(),h}function T(e){if(t)null==f[e]?t.removeValue(e):t.setValue(e,f[e]);else if(i())try{null==f[e]?n.removeItem(y(e)):n.setItem(y(e),f[e])}catch(e){}else 0;r.emit("settings",JSON.stringify({key:e,value:f[e]}))}function x(e){}function I(){return Object.keys(f)}function M(e){for(var t=0;t=0;n--)e.test(i[n])&&r.push(i[n]),e.lastIndex=0;return r},sync:function(e){null!==e?(t?A(t.initialSettings||{}):i()?(function(){if(TradingView.onWidget()&&l.includes(window.location.host))for(var e=n.length;e--;){var t=n.key(e);if(0===t.indexOf("tradingview.")){var i=t.replace("tradingview.",m+".");n.setItem(i,n.getItem(t)),n.removeItem(t)}}}(),function(){for(const e of S)f[e]&&!n.getItem(y(e))&&n.setItem(y(e),f[e])}(),function(){f={};for(var e=!a.enabled("save_chart_properties_to_local_storage"),t=n.length;t--;){var i=n.key(t);if(i&&L(i)){var s=i.substring(g.length);e&&!M(s)||(f[s]=n.getItem(i))}}}()):A(e||{}),k.fire()):!0},onSync:k,setSettingsAdapter:function(e){t=e}}}();e&&e.exports&&(e.exports=h)},71577:(e,t,i)=>{"use strict";i.d(t,{StdTheme:()=>a.StdTheme,getStdChartTheme:()=>h,getStdThemeNames:()=>c,isStdTheme:()=>u,translateThemeName:()=>d});var s=i(79881),r=i(14563) ;const n=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#131722","lineColor":"rgba(42, 46, 57, 0.14)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"horzGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#ffffff","backgroundGradientStartColor":"#ffffff","backgroundGradientEndColor":"#ffffff"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7","style":2,"width":1}}}},"mainSourceProperties":{"baseLineColor":"#B2B5BE","candleStyle":{"borderColor":"#378658","upColor":"#26a69a","wickColor":"#737375","wickUpColor":"#26a69a","wickDownColor":"#ef5350","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350"},"haStyle":{"borderColor":"#378658","upColor":"#26a69a","wickColor":"#737375","wickUpColor":"#26a69a","wickDownColor":"#ef5350","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350"},"barStyle":{"downColor":"#ef5350","upColor":"#26a69a"},"pnfStyle":{"downColor":"#ef5350","upColor":"#26a69a","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"baselineStyle":{"baselineColor":"rgba( 117, 134, 150, 1)","topFillColor1":"rgba( 38, 166, 154, 0.28)","topFillColor2":"rgba( 38, 166, 154, 0.05)","bottomFillColor1":"rgba( 239, 83, 80, 0.05)","bottomFillColor2":"rgba( 239, 83, 80, 0.28)","topLineColor":"rgba( 38, 166, 154, 1)","bottomLineColor":"rgba( 239, 83, 80, 1)"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF","linewidth":2,"linestyle":0},"renkoStyle":{"upColor":"#26a69a","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae","wickUpColor":"#26a69a","wickDownColor":"#ef5350"},"lineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"kagiStyle":{"downColor":"#ef5350","upColor":"#26a69a","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"pbStyle":{"upColor":"#26a69a","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae"},"rangeStyle":{"upColor":"#26a69a","downColor":"#ef5350","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"}}}}'),o=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#B2B5BE","lineColor":"rgba(240, 243, 250, 0.12)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"horzGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#131722","backgroundGradientStartColor":"#181C27","backgroundGradientEndColor":"#131722","backgroundType":"gradient"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7","style":2,"width":1}}}},"mainSourceProperties":{"baseLineColor":"#5d606b","candleStyle":{"borderColor":"#378658","upColor":"#26a69a","wickColor":"#B5B5B8","wickUpColor":"#26a69a","wickDownColor":"#ef5350","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350"},"haStyle":{"borderColor":"#378658","upColor":"#26a69a","wickColor":"#B5B5B8","wickUpColor":"#26a69a","wickDownColor":"#ef5350","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350"},"barStyle":{"downColor":"#ef5350","upColor":"#26a69a"},"pnfStyle":{"downColor":"#ef5350","upColor":"#26a69a","upColorProjection":"#336854","downColorProjection":"#7f323f"},"baselineStyle":{"baselineColor":"rgba( 117, 134, 150, 1)","topFillColor1":"rgba( 38, 166, 154, 0.28)","topFillColor2":"rgba( 38, 166, 154, 0.05)","bottomFillColor1":"rgba( 239, 83, 80, 0.05)","bottomFillColor2":"rgba( 239, 83, 80, 0.28)","topLineColor":"rgba( 38, 166, 154, 1)","bottomLineColor":"rgba( 239, 83, 80, 1)"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF","linewidth":2,"linestyle":0},"renkoStyle":{"upColor":"#26a69a","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f","wickUpColor":"#26a69a","wickDownColor":"#ef5350"},"lineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"kagiStyle":{"downColor":"#ef5350","upColor":"#26a69a","upColorProjection":"#336854","downColorProjection":"#7f323f"},"pbStyle":{"upColor":"#26a69a","downColor":"#ef5350","borderUpColor":"#26a69a","borderDownColor":"#ef5350","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f"},"rangeStyle":{"upColor":"#26a69a","downColor":"#ef5350","upColorProjection":"#336854","downColorProjection":"#7f323f"}}}}') ;var a=i(87822);function l(){return{[a.StdTheme.Light]:JSON.parse(JSON.stringify(n)),[a.StdTheme.Dark]:JSON.parse(JSON.stringify(o))}}function c(){return[a.StdTheme.Light,a.StdTheme.Dark]}function h(e){return l()[e]}function d(e){return{[a.StdTheme.Light]:s.t("Light",{context:"colorThemeName"}),[a.StdTheme.Dark]:s.t("Dark",{context:"colorThemeName"})}[e]||e}function u(e){const t=l();return c().some(i=>p(t[i],e))}function p(e,t){let i=e.content===t.content;return function(e={},t){try{!function e(t,i,s){for(const r in t)if(t.hasOwnProperty(r)){const n=i.concat(r);if("object"==typeof t[r])e(t[r],n,s);else if(s(n,t[r]))throw new Error("exit")}}(e,[],t)}catch(e){return}}(e.content,(e,s)=>{const n=function(e,t={}){let i=t;for(let t=0;t{"use strict";var s;i.d(t,{StdTheme:()=>s}),function(e){e.Light="light",e.Dark="dark"}(s||(s={}))},99182:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_THEME:()=>p,extractThemeFromModel:()=>R,getCurrentTheme:()=>S,getStdTheme:()=>L,getStdThemeNames:()=>I,getStdThemedValue:()=>A,getTheme:()=>T,getThemeNames:()=>x,getThemedColor:()=>y,isPublicTheme:()=>v,isStdTheme:()=>N,isStdThemeName:()=>M,isStdThemedDefaultValue:()=>k,isThemeExist:()=>V,loadTheme:()=>b,removeTheme:()=>D,restoreTheme:()=>w,saveTheme:()=>E,savedThemeName:()=>P,syncTheme:()=>C,themes:()=>f,translateStdThemeName:()=>B});var s=i(14563),r=i(18130),n=i(64222);function o(){return(0,n.getValue)("current_theme.name")||null}var a=i(95152);const l=(0,i(65447).getLogger)("Themes.Provider");let c=null;function h(e){return(0,a.fetch)("/theme/?themeName="+encodeURIComponent(e),{credentials:"include",method:"GET"}).then(e=>e.json()).then(e=>{const t={};return e.content&&(t.content=JSON.parse(e.content)),t})}var d=i(71577),u=i(14829);const p="light";var _=i(79881) ;const m=JSON.parse('{"color-bg-primary":"color-cold-gray-850","color-bg-primary-hover":"color-cold-gray-800","color-bg-secondary":"color-cold-gray-900","color-bg-highlight":"color-cold-gray-900","color-bg-scroll-buttons":"color-cold-gray-800","color-legacy-bg-scroll-buttons":"color-cold-gray-550","color-legacy-bg-widget":"color-cold-gray-900","color-text-primary":"color-cold-gray-200","color-text-secondary":"color-cold-gray-500","color-text-tertiary":"color-cold-gray-400","color-text-disabled":"color-cold-gray-650","color-accent-content":"color-white","color-divider":"color-cold-gray-700","color-divider-hover":"color-cold-gray-800","color-divider-secondary":"color-cold-gray-800","color-box-shadow":"color-cold-gray-900","color-active-hover-text":"color-cold-gray-300","color-alert-text":"color-cold-gray-200","color-border":"color-cold-gray-750","color-border-chat-fields":"color-cold-gray-750","color-border-hover":"color-cold-gray-650","color-border-table":"color-cold-gray-800","color-brand":"color-tv-blue-500","color-brand-hover":"color-tv-blue-600","color-brand-active":"color-tv-blue-700","color-button-hover-bg":"color-cold-gray-850","color-chart-page-bg":"color-cold-gray-800","color-common-tooltip-bg":"color-cold-gray-750","color-danger":"color-ripe-red-600","color-danger-hover":"color-ripe-red-500","color-danger-active":"color-ripe-red-400","color-depthrenderer-fill-style":"color-cold-gray-150","color-depthrenderer-stroke-style":"color-cold-gray-650","color-disabled-border-and-color":"color-cold-gray-800","color-disabled-input":"color-cold-gray-750","color-empty-container-message":"color-cold-gray-500","color-highlight-new":"color-tv-blue-a800","color-icons":"color-cold-gray-500","color-input-bg":"color-cold-gray-800","color-input-textarea-readonly":"color-cold-gray-650","color-input-placeholder-text":"color-cold-gray-700","color-input-publish-bg":"color-cold-gray-900","color-item-active-blue":"color-tv-blue-a800","color-item-hover-active-bg":"color-cold-gray-800","color-item-hover-bg":"color-cold-gray-800","color-item-hover-blue":"color-tv-blue-a800","color-item-selected-blue":"color-tv-blue-a800","color-item-active-text":"color-cold-gray-200","color-item-active-bg":"color-tv-blue-500","color-link":"color-tv-blue-500","color-link-hover":"color-tv-blue-600","color-link-active":"color-tv-blue-700","color-list-item":"color-cold-gray-500","color-list-nth-child-bg":"color-cold-gray-850","color-news-highlight":"color-cold-gray-800","color-pane-bg":"color-cold-gray-900","color-pane-secondary-bg":"color-cold-gray-850","color-placeholder":"color-cold-gray-650","color-popup-menu-item-hover-bg":"color-cold-gray-800","color-popup-menu-separator":"color-cold-gray-700","color-row-hover-active-bg":"color-cold-gray-800","color-sb-scrollbar-body-bg":"color-cold-gray-650","color-screener-description":"color-cold-gray-200","color-section-separator-border":"color-cold-gray-750","color-search-button-hover":"color-cold-gray-700","color-separator-table-chat":"color-cold-gray-750","color-success":"color-minty-green-700","color-success-hover":"color-minty-green-600","color-success-active":"color-minty-green-500","color-tag-active-bg":"color-cold-gray-750","color-tag-hover-bg":"color-cold-gray-800","color-text-regular":"color-cold-gray-200","color-toolbar-button-text":"color-cold-gray-300","color-toolbar-button-text-hover":"color-cold-gray-300","color-toolbar-button-text-active":"color-tv-blue-500","color-toolbar-button-text-active-hover":"color-tv-blue-600","color-toolbar-button-background-hover":"color-cold-gray-800","color-toolbar-button-background-secondary-hover":"color-cold-gray-750","color-toolbar-toggle-button-background-active":"color-tv-blue-500","color-toolbar-toggle-button-background-active-hover":"color-tv-blue-600","color-toolbar-interactive-element-text-normal":"color-cold-gray-300","color-toolbar-interactive-element-text-hover":"color-cold-gray-250","color-toolbar-opened-element-bg":"color-cold-gray-800","color-tooltip-bg":"color-cold-gray-750","color-tv-button-checked":"color-cold-gray-500","color-tv-dialog-caption":"color-cold-gray-50","color-tv-dropdown-item-hover-bg":"color-cold-gray-800","color-underlined-text":"color-cold-gray-300","color-widget-pages-bg":"color-cold-gray-900","color-warning":"color-tan-orange-700","color-forex-icon":"color-white","color-list-item-active-bg":"color-tv-blue-500","color-list-item-hover-bg":"color-cold-gray-800","color-list-item-text":"color-cold-gray-200","color-price-axis-label-back":"color-cold-gray-800","color-price-axis-label-text":"color-cold-gray-500","color-price-axis-gear":"color-cold-gray-500","color-price-axis-gear-hover":"color-cold-gray-400","color-price-axis-highlight":"color-cold-gray-800","color-bid":"color-tv-blue-500","color-scroll-bg":"color-cold-gray-750","color-scroll-border":"color-cold-gray-850","color-widget-border":"color-cold-gray-800","color-scroll-buttons-arrow":"color-white","color-control-intent-default":"color-cold-gray-650","color-control-intent-success":"color-minty-green-600","color-control-intent-primary":"color-tv-blue-500","color-control-intent-warning":"color-tan-orange-500","color-control-intent-danger":"color-ripe-red-700","color-growing":"color-minty-green-600","color-falling":"color-ripe-red-600","color-pre-market":"color-tan-orange-600","color-pre-market-bg":"color-tan-orange-400","color-post-market":"color-tv-blue-500","color-post-market-bg":"color-tv-blue-400","color-market-open":"color-minty-green-500","color-market-open-bg":"color-minty-green-400","color-market-closed":"color-cold-gray-400","color-market-holiday":"color-cold-gray-400","color-invalid-symbol":"color-ripe-red-400","color-invalid-symbol-hover":"color-ripe-red-500","color-replay-mode":"color-tv-blue-500","color-replay-mode-icon":"color-tv-blue-50","color-replay-mode-hover":"color-tv-blue-600","color-notaccurate-mode":"color-berry-pink-700","color-notaccurate-mode-bg":"color-berry-pink-400","color-delay-mode":"color-tan-orange-700","color-delay-mode-bg":"color-tan-orange-400","color-eod-mode":"color-grapes-purple-700","color-eod-mode-bg":"color-grapes-purple-400","color-data-problem":"color-ripe-red-600","color-data-problem-bg":"color-ripe-red-400","color-data-problem-hover":"color-ripe-red-500","color-list-item-bg-highlighted":"color-tv-blue-a900","color-list-item-bg-selected":"color-tv-blue-a800","color-list-item-bg-highlighted-hover":"color-tv-blue-a800","color-list-item-bg-selected-hover":"color-tv-blue-a700","color-screener-header-bg":"color-cold-gray-850","color-screener-header-bg-hover":"color-cold-gray-800","color-overlay":"color-cold-gray-950","color-card-border":"color-cold-gray-700","color-card-border-hover":"color-cold-gray-600","color-background-special-primary":"color-black","color-stroke-special-primary":"color-cold-gray-800","color-selection-bg":"color-tv-blue-a700"}') ;var g=i(53312);const f={[d.StdTheme.Light]:{name:d.StdTheme.Light,label:()=>(0,_.t)("Light",{context:"colorThemeName"}),order:2,getThemedColor:e=>(0,g.getHexColorByName)(e)},[d.StdTheme.Dark]:{name:d.StdTheme.Dark,label:()=>(0,_.t)("Dark",{context:"colorThemeName"}),order:1,getThemedColor:e=>{const t=m[e]||e;return(0,g.getHexColorByName)(t)}}};function v(e){return!e.isPrivate}function S(){return f[u.watchedTheme.value()]||f[p]}function y(e){return S().getThemedColor(e)}async function b(e,t,i,s,n=!0,o=!1,a=!1){const l=await(t?Promise.resolve(L(e)):T(e));if(void 0!==l.content){const h=!t;a&&(void 0!==(c=l.content).chartProperties&&(0,r.applyDefaultsOverrides)(c.chartProperties),void 0!==c.mainSourceProperties&&(0,r.applyDefaultsOverrides)(c.mainSourceProperties,void 0,!0,"mainSeriesProperties")),await s.applyTheme(l.content,h,i,e,t,n,o)}var c;return l}function w(){(0,u.setTheme)(o()||p)}function P(){return o()}function C(){var e;e=S().name,(0,n.setValue)("current_theme.name",e,{forceFlush:!0})}function T(e){return h(e)}function x(){return c||(0,a.fetch)("/themes/",{credentials:"include",method:"GET"}).then(e=>(c=e.json(),c))}function I(){return d.getStdThemeNames()}function M(e){return I().includes(e)}function L(e){return d.getStdChartTheme(e)||{content:void 0}}function A(e,t){const i=t||S().name,s=d.getStdChartTheme(i),r=0!==e.length&&e.split(".");return s&&s.content&&r?r.reduce((e,t)=>e[t],s.content):null}function k(e,t,i){const r=A(e,i);return null!==r&&(0,s.areEqualRgba)((0,s.parseRgba)(r),(0,s.parseRgba)(String(t)))}function E(e,t){return function(e,t){const i=new FormData;return i.append("content",JSON.stringify(t)),i.append("name",e),c=null,(0,a.fetch)("/save-theme/",{credentials:"include",method:"POST",body:i}).then(e=>e.json(),e=>l.logError(e))}(e,t)}function D(e){return function(e){const t=new FormData;return t.append("name",e),c=null,(0,a.fetch)("/remove-theme/",{credentials:"include",method:"POST",body:t}).then(e=>e.json(),e=>l.logError(e))}(e)}function V(e){return function(e){return h(e).then(e=>Boolean(e.content))}(e)}function B(e){return d.translateThemeName(e)}function N(e){return d.isStdTheme(e)}function R(e){return{content:{chartProperties:{paneProperties:e.model().properties().childs().paneProperties.state(),scalesProperties:e.model().properties().childs().scalesProperties.state()},sessions:e.model().sessions().properties().state(),mainSourceProperties:e.model().mainSeries().properties().state()}}}},14829:(e,t,i)=>{"use strict";i.d(t,{setTheme:()=>n,watchedTheme:()=>r});var s=i(32856);const r=new(i.n(s)());function n(e){r.setValue(e)}r.subscribe(e=>{!function(e,t=window){const i="theme-"+e,s=t.document.documentElement.classList;for(const e of Array.from(s))e.startsWith("theme-")&&e!==i&&s.remove(e);s.add(i)}(e,window)})},87438:(e,t,i)=>{"use strict";i.d(t,{trackEvent:()=>l,disableTrackingEvents:()=>c});var s=i(18437),r=i(27490);const n=(0,i(65447).getLogger)("Common.TrackEvent"),o=[/Study_(Drawing)_(.*)/,/(Study)_(.*)@tv-basicstudies/,/(Study)_(.*)/,/(Chart Style) (.*)/];let a=!1;const l=(e,t,i)=>{ if(a)return;if(r.enabled("charting_library_base"))return void((e,t,i)=>{t=t||e||i||"";let r="";for(let e=0;e{"use strict";i.d(t,{TVXWindowEvents:()=>o});i(95068);var s=i(65447),r=i(68177);const n=(0,s.getLogger)("XWindowEvents");var o;!function(e){const t="tvxwevents.",i={};let s;window.BroadcastChannel?(s=new BroadcastChannel("tvxwevents"),s.addEventListener("message",(function(e){const{data:{event:t,value:s}}=e;i[t]&&i[t].forEach(e=>{e(s)})})),function(){const e=[],i=performance.now();for(let i=0;i{t(e.newValue)});r.TVLocalStorage.removeItem(n)})),e.on=function(e,t){i[e]||(i[e]=[]),i[e].push(t)},e.off=function(e,t){if(!i[e])return;const s=i[e].indexOf(t);-1!==s&&(1===i[e].length?delete i[e]:i[e].splice(s,1))},e.emit=function(e,i=Date.now()){try{s?s.postMessage({event:e,value:i}):r.TVLocalStorage.setItem(t+e,i.toString())}catch(e){n.logError(e.message)}}}(o||(o={}))},96811:(e,t,i)=>{"use strict";i.r(t),i.d(t,{activateKeyPressHandler:()=>m,showDialog:()=>g});const s=[];let r=null;function n(e){for(let t=0;t=0&&!0!==s[t].func(e);t--);}window.addEventListener("keypress",o,!1);var a=i(72454),l=i(27490),c=i(21273),h=i(41062),d=i(40801),u=i(87438);let p=null;function _(e){if(!(0,a.globalKeypressMatches)(e))return!1;e.preventDefault();const t=String.fromCharCode(e.charCode);return l.enabled("show_interval_dialog_on_key_press")&&function(e){return/[1-9]/.test(e)}(t)?(0,c.showChangeIntervalDialogAsync)({initVal:t}):l.enabled("symbol_search_hot_key")&&(g({defaultValue:t,selectSearchOnInit:!1,source:"keyboard"}),(0,u.trackEvent)("GUI","SS","hotkey")),!0}function m(){(0,h.loadChangeIntervalDialog)(),function(e,t){const i={name:e,func:t},r=n(i.name);r>-1&&s.splice(r,1),s.unshift(i)}("symbolEdit",_)}function g(e){const t=p=(0,d.loadNewSymbolSearch)().then(i=>{t===p&&i.showDefaultSearchDialog(e)});return t}},67985:(e,t,i)=>{"use strict";let s;function r(){ return s}function n(e){s=e}i.d(t,{getSearchRequestDelay:()=>r,setSearchRequestDelay:()=>n})},28164:(e,t,i)=>{"use strict";i.d(t,{CLOSE_POPUPS_AND_DIALOGS_COMMAND:()=>s});const s="CLOSE_POPUPS_AND_DIALOGS_COMMAND"},98489:(e,t,i)=>{"use strict";i.d(t,{CompareDialogRenderer:()=>r});var s=i(58738);class r extends s.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(){this._load().then(e=>{var t,i;null===(t=this._dialog)||void 0===t||t.hide(),null===(i=this._dialog)||void 0===i||i.visible().unsubscribe(this._subscribe),this._dialog=e,e.visible().subscribe(this._subscribe),e.show()})}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}_load(){return Promise.all([i.e(7271).then(i.bind(i,66664)),Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(4595),i.e(5698),i.e(9448),i.e(3894),i.e(3996),i.e(7936),i.e(3708),i.e(706),i.e(8858),i.e(7757),i.e(4834),i.e(5514),i.e(306),i.e(2402),i.e(1529),i.e(5383),i.e(3590),i.e(5030),i.e(9772),i.e(731)]).then(i.bind(i,42857))]).then(([e,t])=>{const i=new e.CompareModel(this._chartWidgetCollection);return t.getCompareDialogRenderer(i)})}}},87614:(e,t,i)=>{"use strict";async function s(e,t){const s=await Promise.all([i.e(3876),i.e(7039),i.e(4078),i.e(8193),i.e(2273),i.e(4882),i.e(5514),i.e(306),i.e(2402),i.e(1829),i.e(8890)]).then(i.bind(i,68442));return s.showSimpleDialog(e,s.renameModule,t)}async function r(e,t){const s=await Promise.all([i.e(3876),i.e(7039),i.e(4078),i.e(8193),i.e(2273),i.e(4882),i.e(5514),i.e(306),i.e(2402),i.e(1829),i.e(8890)]).then(i.bind(i,68442));return s.showSimpleDialog(e,s.confirmModule,t)}async function n(e,t){const s=await Promise.all([i.e(3876),i.e(7039),i.e(4078),i.e(8193),i.e(2273),i.e(4882),i.e(5514),i.e(306),i.e(2402),i.e(1829),i.e(8890)]).then(i.bind(i,68442));return s.showSimpleDialog(e,s.warningModule,t)}i.d(t,{showRename:()=>s,showConfirm:()=>r,showWarning:()=>n})},49088:(e,t,i)=>{"use strict";i.d(t,{hideStateChange:()=>r});var s=i(5729);const r=new(i.n(s)())},35036:(e,t,i)=>{"use strict";i.d(t,{getHideOptions:()=>h,toggleHideMode:()=>d,getSavedHideMode:()=>u});var s=i(16282),r=i(79881),n=i(64222),o=i(80525),a=i(15521),l=i(49088);let c=null;function h(){if(null!==c)return c;const e=(0,o.tradingService)();return c=new Map([["drawings",{label:(0,r.t)("Hide drawings"),dataName:"hide-drawing-tools",tooltip:{active:(0,r.t)("Show all drawings"),inactive:(0,r.t)("Hide all drawings")},getBoxedValue:()=>(0,a.hideAllDrawings)(),trackLabel:"hide drawings"}],["indicators",{label:(0,r.t)("Hide indicators"),dataName:"hide-indicators",tooltip:{active:(0,r.t)("Show all indicators"),inactive:(0,r.t)("Hide all indicators")},getBoxedValue:()=>(0,a.hideAllIndicators)(),trackLabel:"hide indicators"}],["positions",{label:(0,r.t)("Hide positions & orders"),dataName:"hide-positions-and-orders",tooltip:{active:(0,r.t)("Show all positions & orders"),inactive:(0,r.t)("Hide all positions & orders")},getBoxedValue:()=>(0,s.ensureNotNull)(e).showTradedSources,inverted:!0,trackLabel:"hide positions" }],["all",{label:(0,r.t)("Hide all"),dataName:"hide-all",tooltip:{active:e?(0,r.t)("Show all drawings, indicators, positions & orders"):(0,r.t)("Show all drawings and indicators"),inactive:e?(0,r.t)("Hide all drawings, indicators, positions & orders"):(0,r.t)("Hide all drawings and indicators")},trackLabel:"hide all"}]]),e||c.delete("positions"),c}function d(e){e?n.setValue("ChartToolsHideMode",e):e=u();const t=p();let i=!t;return"all"===e?(_((e,t,s)=>{e.setValue(s?!i:i)}),l.hideStateChange.fire({hideMode:e,isActive:i}),i):(_((s,r,n)=>{if(r===e){const e=t?!n:!s.value();s.setValue(e),i=n?!e:e}else s.setValue(Boolean(n))}),l.hideStateChange.fire({hideMode:e,isActive:i}),i)}function u(){const e=n.getValue("ChartToolsHideMode","drawings");return h().has(e)?e:"drawings"}function p(){let e=!0;return _((t,i,s)=>{const r=t.value();e=e&&(s?!r:r)}),e}function _(e){h().forEach((t,i)=>{var s;const r=null===(s=t.getBoxedValue)||void 0===s?void 0:s.call(t);r&&e(r,i,t.inverted)})}},99392:(e,t,i)=>{"use strict";i.d(t,{showConfirmInputsDialog:()=>l});var s=i(79881),r=i(16282),n=i(47903),o=i(674),a=i.n(o);async function l(e,t,o,l,h="default"){let d,u=null;const p=e.model().model(),_=(0,n.clone)((0,r.ensureDefined)(t.defaults.inputs)),m=new(a())({inputs:_}),g=function(e,t){return"symbol"===t?e.inputs.filter(t=>t.id===e.symbolInputId()):e.inputs.filter(e=>e.confirm)}(t,h),f=()=>{d&&p.removeCustomSource(d)},v=()=>{f(),l()},S=e=>{o({inputs:e,parentSource:u}),f()},y=g.filter(c);if(y.length>0)try{const s=await Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3996),i.e(4078),i.e(8193),i.e(7936),i.e(3708),i.e(706),i.e(9602),i.e(8858),i.e(6548),i.e(9305),i.e(2778),i.e(83),i.e(8933),i.e(2321),i.e(2162),i.e(5551),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7591),i.e(9772),i.e(708),i.e(2391),i.e(7365),i.e(847),i.e(9628),i.e(4093),i.e(3030)]).then(i.bind(i,6825)),r=await s.selectInputValuesOnChart(e,y,m,t.shortDescription);d=r.customSourceId,u=r.destPane?r.destPane.mainDataSource():null}catch(e){return void v()}y.length!==g.length?Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3996),i.e(4078),i.e(8193),i.e(7936),i.e(3708),i.e(706),i.e(9602),i.e(8858),i.e(6548),i.e(9305),i.e(2778),i.e(83),i.e(8933),i.e(2321),i.e(2162),i.e(5551),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7591),i.e(9772),i.e(708),i.e(2391),i.e(7365),i.e(847),i.e(9628),i.e(4093),i.e(3030)]).then(i.bind(i,19932)).then(t=>{const i=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return(0,s.t)("Add Symbol");return(0,s.t)("Confirm Inputs")}(h),g,m,h,e.model(),S,v);return i.show(),i}):S(m.state().inputs||{})}function c(e){return"time"===e.type||"price"===e.type}},72087:(e,t,i)=>{"use strict";i.d(t,{GeneralChartPropertiesRenderer:()=>r});var s=i(58738);class r extends s.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e} show(){const e=this._chartWidgetCollection,t=e.activeChartWidget.value();return t.generalPropertiesDefinitions().then(s=>Promise.all([i.e(9685),i.e(3876),i.e(7039),i.e(7610),i.e(4595),i.e(5698),i.e(9448),i.e(3894),i.e(3996),i.e(4078),i.e(8193),i.e(7936),i.e(3708),i.e(706),i.e(8604),i.e(9602),i.e(8858),i.e(6473),i.e(6548),i.e(9305),i.e(2778),i.e(83),i.e(8933),i.e(8969),i.e(2850),i.e(2269),i.e(5514),i.e(306),i.e(2402),i.e(4940),i.e(1529),i.e(5383),i.e(3590),i.e(1829),i.e(5030),i.e(7591),i.e(9772),i.e(8680),i.e(708),i.e(2391),i.e(7365),i.e(847),i.e(8625),i.e(7078)]).then(i.bind(i,76270)).then(i=>{var r,n;const o=new i.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:e,propertyPages:s,activePageId:this._activePageId,model:t.model()});return null===(r=this._dialog)||void 0===r||r.hide(),null===(n=this._dialog)||void 0===n||n.visible().unsubscribe(this._subscribe),this._dialog=o,o.visible().subscribe(this._subscribe),o.show(),this._activePageId=void 0,o}))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}isVisible(){return this.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}},17722:(e,t,i)=>{"use strict";var s;i.d(t,{ToolboxType:()=>s}),function(e){e[e.Delete=0]="Delete"}(s||(s={}))},79424:(e,t,i)=>{"use strict";i.d(t,{globalCloseDelegate:()=>r,globalCloseMenu:()=>n});var s=i(5729);const r=new(i.n(s)());function n(){r.fire()}},58589:e=>{e.exports=''},25292:e=>{e.exports=''},96527:e=>{e.exports=''},26971:e=>{e.exports=''},3948:e=>{ e.exports=''},97033:e=>{e.exports=''},4754:e=>{e.exports=''},63708:e=>{e.exports=''},63310:e=>{e.exports=''},2116:e=>{ e.exports=''},78544:e=>{e.exports=''},23353:e=>{e.exports=''},62781:e=>{e.exports=''},65511:e=>{ e.exports=''},94817:e=>{e.exports=''},6857:e=>{e.exports=''},97663:e=>{e.exports=''},38069:e=>{"use strict";e.exports=JSON.parse('{"4":["v",["h",0,2],["h",1,3]],"6":["v",["h",0,2,4],["h",1,3,5]],"8":["v",["h",0,2,4,6],["h",1,3,5,7]],"2h":["h",0,1],"2v":["v",0,1],"2-1":["v",["h",0,2],1],"3s":["h",0,["v",1,2]],"3h":["h",0,1,2],"3v":["v",0,1,2],"1-2":["v",0,["h",1,2]],"3r":["h",["v",0,1],2],"4h":["h",0,1,2,3],"4v":["v",0,1,2,3],"4s":["h",0,["v",1,2,3]],"1-3":["v",0,["h",1,2,3]],"2-2":["v",["h",0,1],["v",2,3]],"1-4":["v",0,["h",1,2,3,4]],"5s":["h",0,["v",1,2,3,4]],"6c":["v",["h",0,1],["h",2,3],["h",4,5]],"8c":["v",["h",0,1],["h",2,3],["h",4,5],["h",6,7]],"s":0}')}},e=>{e.O(0,[8445,1216],()=>{return t=55218,e(e.s=t);var t});e.O()}]);