Files
ai/charting_library/static/bundles/library.0d1370eeea0dcf32f014.js
Jenkins f089d0055d commit 2016-04-25 08:13:07.845900
Users need to touch drawing tool menu twice to use the tool in mobile #1029
2016-04-25 03:14:10 -05:00

60 lines
1.8 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

webpackJsonp([0,4],[function(e,t,i){function r(e){return window.TVCallback[e]&&window.TVCallback[e].apply(null,Array.prototype.slice.call(arguments,1))}var n=i(1),o=i(371);i(376);var a=i(377),s=i(384),l=i(2),d=i(385),h=i(5).UndoHistory;window.TVCallback={};var p=!!urlParams.indicatorsFile,c=$.Deferred(),u=$.Deferred();$.when(c,u).done(function(){Q14.start()}),p?$.getScript(urlParams.indicatorsFile).done(function(){void 0!==window.__customIndicators&&window.isArray(window.__customIndicators)&&($81.studyLibrary=$81.studyLibrary.concat(window.__customIndicators),console.log("{0} custom indicators loaded.".format(window.__customIndicators.length)),c.resolve())}).fail(function(e){console.warn("Error loading custom indicators @ `{0}`: {1} ({2}) ".format(urlParams.indicatorsFile,e.statusText,e.status)),c.resolve()}):c.resolve(),window.__delayedMesssages=[],window.widgetReady=function(e){window.__delayedMesssages.push({callback:e})},window.customizeUI=function(e){if(e.studiesOverrides){var t=e.studiesOverrides;for(var i in t)TradingView.MetainfoTuner.setProperty(i,t[i])}window.__defaultsOverrides=e.defaultsOverrides},window.applyOverrides=function(e){$.extend(!0,window.__defaultsOverrides,e),window.applyDefaultsOverrides(TradingView.defaultProperties.chartproperties),window.applyDefaultOverridesToLinetools(),window.Q4.applyOverrides(e)},window.is_authenticated=!1;var _=function(){if(!Modernizr.canvas||!Modernizr.canvastext)throw"Charting library cannot be running under this browser";Z75.setEnabled("charting_library_debug_mode","true"==urlParams.debug);var e=window.headerChartPanel=$(".header-chart-panel"),t=$("#library-container"),i=$(".tv-header");$("#footer-chart-panel");Z75.enabled("remove_library_container_border")&&(t.css("border","0px"),t.css("padding","1px")),window.customizeUI({studiesOverrides:urlParams.studiesOverrides?JSON.parse(urlParams.studiesOverrides):void 0,defaultsOverrides: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&&(TradingView.PriceFormatter.prototype.decimalSign=urlParams.numeric_formatting.decimal_sign[0]),Z75.enabled("saveload_storage_customization")&&(void 0!==urlParams.chartsStorageUrl&&urlParams.chartsStorageUrl&&void 0!==urlParams.clientId&&urlParams.clientId?TradingView.ChartingLibraryBackend.initialize(urlParams.clientId,urlParams.userId,urlParams.chartsStorageUrl,urlParams.chartsStorageVer||"1.0"):(Z75.setEnabled("saveload_storage_customization",!1),Z75.setEnabled("header_saveload",!1))),window.Q14=new d(window.parent[urlParams.uid].datafeed),urlParams.autoSaveDelay&&Q14.setAutoSaveDelay(urlParams.autoSaveDelay),Q14.setTimeFramesList(JSON.parse(urlParams.timeFrames)),Q14.setStudiesAccessController(Q14.createStudiesAccessController(urlParams.studiesAccess,urlParams.enabledStudies,urlParams.disabledStudies)),Z75.enabled("narrow_chart_enabled")&&$(".chart-page").css("min-width","240px"),Z75.enabled("use_localstorage_for_settings")&&TVSettings.sync();var l=urlParams.chartContent?JSON.parse(urlParams.chartContent).json:void 0,h=urlParams.interval||"D",p={jqParent:$("#chart-area"),onResize:function(r){var n=$(document.body).height()-2;t.height(n);var o=$("#footer-chart-panel"),a=o&&o.is(":visible")?o.outerHeight():0,s=$("#bottom-area"),l=s&&s.is(":visible")?s.outerHeight():0,d=Z75.enabled("header_widget")&&e.is(":visible")?e.outerHeight():0,h=n-d-i.outerHeight()-l-a;h=Math.max(50,h),r.height(h)},padding:Z75.enabled("border_around_the_chart")?5:0,edge:Z75.enabled("border_around_the_chart")?5:0,content:l,widgetOptions:{hideIdeas:!0,addVolume:!0,handleSessionErrors:!0,muteSessionErrors:!0,timezone:urlParams.timezone,defSymbol:urlParams.symbol,defInterval:h,hideSymbolSearch:JSON.parse(urlParams.hideSymbolSearch)},globalEvents:!0,snapshotUrl:urlParams.snapshotUrl};if(l&&void 0!==l.extendedData){var c=l.extendedData;p.metaInfo={id:c.uid,name:c.name,description:c.description,uid:c.uid,username:"",tags:""}}var _=window.Q4=new n(p);_.activeChartWidget.subscribe(function(e){Q15.emit("activeChartChanged",_.getAll().indexOf(e))}),window.ChartSaverInstance=window.saver=new window.ChartSaver(_),window.Q1=_.activeChartWidget.value(),window.pro=new $54;var f=JSON.parse(urlParams.favorites);f.intervals=f.intervals.map(function(e){var t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t}),Z75.enabled("study_templates")&&(window.studyTemplates=new $64({Q4:_,notShowQuicks:!Z75.enabled("items_favoriting")})),window.headerWidget=new o({Q4:_,headerChartPanel:e,hideStudyTemplates:!0,favoriteIntervals:f.intervals,interval_options:{interval:h},favoriteChartTypes:f.chartTypes}),$44.bindToChartWidgetCollection(_);var g=function(){},v=JSON.parse(urlParams.logo);g=v.image?function(e,t,i){t=t||Q1._jqMainDiv,$(t).find(".onchart-custom-logo").remove();var r=$('<img src="'+v.image+'">'),n=v.link?$('<a href="'+v.link+'" target="_blank"/>').append(r):r,o=$('<span class="text">Powered&nbsp;by&nbsp;<span><a href="https://www.tradingview.com/" target="_blank"><span class="text logo-highlighted">TradingView</span></a>'),a=$('<div class="onchart-custom-logo"/>').appendTo(t),s=$('<div class="wrapper"/>').appendTo(a),l=$('<table class="inner">').appendTo(s),d=$("<tr>").appendTo(l);$('<td class="custom-logo">').append(n).appendTo(d);var h=$("<tr>").appendTo(l);Z75.enabled("link_to_tradingview")&&$('<td class="tv-link">').append(o).appendTo(h),i&&a.addClass("on-pane")}:function(e,t,i){if(Z75.enabled("link_to_tradingview")){t=t||Q1._jqMainDiv,$(t).find(".onchart-tv-logo").remove();var r=$('<div class="onchart-tv-logo wrapper"><div class="wrapper"><a class="inner" href="https://www.tradingview.com/" target="_blank"><img class="solid" src="images/charting_library/logo-widget-copyright.png" alt="TradingView Logo"><img class="faded" src="images/charting_library/logo-widget-copyright-faded.png" alt="TradingView Logo"><span class="text"><span id="logo-symbol"></span>&nbsp;charts&nbsp;by&nbsp;<span class="logo-highlighted">TradingView</span></span></a></div></div>').appendTo(t);Z75.enabled("minimalistic_logo")?r.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):r.addClass("expanded"),i&&r.addClass("on-pane")}};var m=Z75.enabled("widget_logo")&&"true"!=urlParams.disableLogo;if(m&&(Q1.createLogo=g,Z75.enabled("show_logo_on_all_charts")&&(_.createLogo=g.bind(this)),Z75.enabled("move_logo_to_main_pane")||Q1.withModel(null,g)),TradingView.tokenInitialized.resolve(),urlParams.toolbarbg){var y="#"+urlParams.toolbarbg;$(".tv-side-toolbar").css("background-color",y),$(".chart-controls-bar").css("background-color",y),$("#chart-area").css("background-color",y),e.css("background-color",y),$("#footer-chart-panel").css("background-color",y)}TradingView.isNaN(urlParams.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+urlParams.studyCountLimit)),TradingView.isNaN(urlParams.ssreqdelay)||$68.setSearchRequestDelay(Math.max(0,+urlParams.ssreqdelay));var w=new a({container:$(".tv-side-toolbar"),Q4:_,onWidget:!0,enabledDrawings:urlParams.enabledDrawings?JSON.parse(urlParams.enabledDrawings):[],disabledDrawings:urlParams.disabledDrawings?JSON.parse(urlParams.disabledDrawings):[],drawingsAccess:urlParams.drawingsAccess?JSON.parse(urlParams.drawingsAccess):void 0,forceVisible:"false"==urlParams.hideSideToolbar&&!!Z75.enabled("left_toolbar")});window.sideToolbar=w,window.lineToolPropertiesToolbar=new s(_),Q1.onDisconnected().subscribe(null,function(e){e&&window.showCriticalErrorMessage()}),$(".tv-content").bind("contextmenu",function(e){var t=$(e.originalEvent.target);return t.is("input")||t.is("textarea")?void 0:!1}),u.resolve(),function(){function e(e){Q1.withModel(null,function(){if(Q1.model().mainSeries().bars().size()>0)e();else{var t=function(){e(),Q1.model().mainSeries().onBarReceived().unsubscribe(null,t)};Q1.model().mainSeries().onBarReceived().subscribe(null,t)}})}window.widgetReady=e;for(var t=0;t<window.__delayedMesssages.length;++t)e(window.__delayedMesssages[t].callback)}(),Q1.withModel(null,function(){Q1.model().mainSeries().onSymbolResolved().subscribe(null,function(){var e=Q1.model().mainSeries().symbolInfo(),t=Q1.model().mainSeries().properties().interval.value(),i={name:e.name,exchange:e.exchange,description:e.description,type:e.type,interval:t};r("onSymbolChange",i)}),$44.interval.subscribe(function(e){r("onIntervalChange",e)}),Q14.on("realtime_tick",function(e){r("onTick",e)}),Q14.on("onAutoSaveNeeded",function(){r("onAutoSaveNeeded")}),Q15.subscribeToAll(function(){if(r.apply(null,arguments),Z75.enabled("charting_library_debug_mode")){var e=Array.prototype.slice.call(arguments);console.log("Event {0}, arguments: {1}".format(e[0],JSON.stringify(e.slice(1))))}})}),_.onScreenshotReady().subscribe(null,function(e){r("onScreenshotReady",e)})};window.destroyChart=function(){window.Q4&&(window.Q4.destroy(),window.Q4=null),Q14&&(Q14.destroy(),Q14=null)};var f=$.Deferred();$.when(window.localizationReady,f).done(function(){if(JSON.parse(urlParams.disabledFeatures).map(function(e){Z75.setEnabled(e,!1)}),JSON.parse(urlParams.enabledFeatures).map(function(e){Z75.setEnabled(e,!0)}),setTimeout(_,0),Z75.enabled("14851")){!function(e,t,i,r,n,o,a){e.GoogleAnalyticsObject=n,e[n]=e[n]||function(){(e[n].q=e[n].q||[]).push(arguments)},e[n].l=1*new Date,o=t.createElement(i),a=t.getElementsByTagName(i)[0],o.async=1,o.src=r,a.parentNode.insertBefore(o,a)}(window,document,"script","//www.google-analytics.com/analytics.js","ga");var e=document.URL.match(RegExp("(:?.*://)([^/]+)/.*"))[2];ga("create","UA-53174009-1","auto"),ga("set",{hostname:e,page:e,referrer:e}),ga("send","pageview")}}),function(){var e=!0;window.parent[urlParams.uid].datafeed.onReady(function(t){e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),window.configurationData=t,f.resolve()}),e=!1}(),window.getFunctionFromArguments=function(e){return window.parent[urlParams.uid][e]},window.loadChart=function(e){Q14.purgeCache(),Q14._studyEngine.stopSources(),window.Q4.loadContent(e.json),window.Q4.purgeUnusedWidgets(),e.extendedData&&(window.Q4.metaInfo.id.setValue(e.extendedData.uid),window.Q4.metaInfo.uid.setValue(e.extendedData.uid),window.Q4.metaInfo.name.setValue(e.extendedData.name)),$44.symbol.setValue(m().symbol()),Q15.emit("chart_loaded")},window.createShortcutAction=function(){var e={};return function(t,i){void 0===e[t]&&(e[t]=new TradingView.Action({shortcut:t})),e[t].callbacks().subscribe(null,i)}}(),window.closePopupsAndDialogs=function(){$82.dialogs.forEach(function(e){e.dialog.find("._tv-dialog-title-close").click()}),TradingView.ContextMenu.hideAll()},window.addCustomCSSFile=function(e){var t=document.createElement("link");document.getElementsByTagName("head")[0].appendChild(t),t.setAttribute("type","text/css"),t.setAttribute("rel","stylesheet"),t.setAttribute("href",e)},urlParams.customCSS&&window.addCustomCSSFile(urlParams.customCSS),window._initializationFinished=function(){h.clearStack()},window.getSymbolInterval=function(){return{symbol:$44.symbol.value(),interval:$44.interval.value()}},window.setCallback=function(e,t){window.TVCallback[e]=t},window.symbolInfo=function(e){var t=Q1.model().mainSeries().symbolInfo(),i=Q1.model().mainSeries().properties().interval.value(),r={name:t.name,exchange:t.exchange,description:t.description,type:t.type,interval:i};return e(r),r},window.saveChart=function(e){window.ChartSaverInstance.whenReadyToSave(function(){var t=window.ChartSaverInstance.saveToJSON();return e&&e(JSON.parse(t.content))})};var g=window.layout=function(){return window.Q4.layout.value()};window.setLayout=function(e){window.Q4.layout.setValue(e)};var v=window.chartsCount=function(){return l[g()].count};window.chart=function(e){if(void 0===e&&(e=0),0>e||e>v())throw"Incorrect index: "+e;return new TradingView.ChartWidgetApi(window.Q4.getAll()[e])};var m=window.activeChart=function(){return new TradingView.ChartWidgetApi(window.Q4.activeChartWidget.value())};window.changeSymbol=function(e,t,i){$44.interval.setValue(t),$44.symbol.setValue(e),i&&m().onDataLoaded().subscribe(null,i,!0)},window.resizeWindow=function(){$(window).resize()},window.mainSeriesPriceFormatter=function(){return Q1.model().mainSeries().priceScale().formatter()}},function(e,t,i){"use strict";function r(e){function t(e,t){for(var i=[],r=n[q].count,o=0;r>o;o++)i.push(W[o].Q1.state(e,t));var a={layout:q,charts:i};return K.value()&&(a.symbolLock=1),X.value()&&(a.intervalLock=1),TradingView.drawingState.hideAllDrawings().value()&&(a.hideAllDrawings=!0),a}function i(e){for(var t=$.Deferred(),i=[],r=n[q].count,o=0;r>o;o++)i.push(W[o].Q1.asyncState(e));return $.when.apply($,i).then(function(){for(var e={charts:[]},i=0;i<arguments.length;i++)e.charts.push(arguments[i]);t.resolve(e)}),t}function r(){se&&se(ae);var e=G||{};G={width:ae.width(),height:ae.height()};var t=ae[0];if(window.self!==window.top&&t.offsetWidth<t.clientWidth&&t.getBoundingClientRect().width<100){var i=Math.round(100*t.getBoundingClientRect().width),r=Math.round(100*t.getBoundingClientRect().height);G={width:i,height:r}}var n=!1;if(e.height===G.height&&e.width===G.width&&j||(n=!0),n)if(te)s(U);else for(var o=0;o<j.count;o++)s(o)}function s(e){var t=W[e];if(t){var i;i=te?n.s.sizer(0,G,D,B):j.sizer(e,G,D,B),W[e].wrap.css({width:Math.max(i.width||0,0),height:Math.max(i.height||0,0),top:Math.max(i.top||0,0),left:Math.max(i.left||0,0)}),t.metrics&&t.metrics.width===i.width&&t.metrics.height===i.height||(t.metrics=i,t.Q1&&t.Q1.resize())}}function l(){for(var e=0;e<W.length;e++)W[e].Q1.resizeSeriesControlUI()}function d(){for(var e=0;e<W.length;e++)W[e].Q1.tickSeriesControlClock()}function h(e){e=$.extend({Q4:O},e||{});var t,i=$(document.createElement("div")).addClass("chart-container").appendTo(ae).css({position:"absolute",overflow:"hidden"});i.on("mousedown touchstart",function(){N.setValue(t)});var r=W.length,n={wrap:i};return W.push(n),s(r),e.jqParent=i,n.Q1=t=new o(e),O.firstWidgetInitialized||t.chartWidgetInitialized.subscribe(null,function(){try{window.JsBridge.sendEvent("chart_widget_initialized")}catch(e){}O.firstWidgetInitialized=!0,l()},!0),O.createLogo&&(t.createLogo=O.createLogo,Z75.enabled("move_logo_to_main_pane")||t.withModel(t,function(){t.createLogo(null,t._jqMainDiv),t.adaptOnChartLogo()})),e.containsData?t.finishInitWithoutConnect():t.connect(),c(),u(),t}function p(e,t){Q15.emit("layout_about_to_be_changed",e),q=e,te=t,ie.setValue(te),e in n||(e="s"),j=n[e];var i=j.count;G={width:ae.width(),height:ae.height()};for(var r=0;i>r||r<W.length;r++){var o;if(o=t?U===r:i>r){if(W[r]){ae.append(W[r].wrap),W[r].Q1.isDetached=!1;var a=Y.shift();a&&W[r].Q1.loadContent(a.content)}else h($.extend({},re,Y.shift()||(N.value()?{content:N.value().state()}:null)||{},0===r||K.value()?{}:{defSymbol:null}));W[r].wrap.toggleClass("multiple",i>1),s(r)}else W[r]&&(W[r].Q1.isDetached=!0,W[r].wrap.detach())}c(),Q15.emit("layout_changed")}function c(){var e=Math.min(j.count,W.length)-1;if(0>e)return void N.deleteValue();var t=U;0>t&&(t=0),t>e&&(t=e),N.setValue(W[t].Q1)}function u(){for(var e=W.length;e--;){var t=e===U;W[e].wrap.toggleClass("active",t).toggleClass("inactive",!t)}}function _(){return $.grep(W,function(e){return!e.Q1.isDetached}).sort(function(e,t){var i=e.metrics.top,r=t.metrics.top,n=e.metrics.left,o=t.metrics.left;return i===r?o>n?-1:n>o?1:0:r>i?-1:1})}function f(){var e=O.layout.value();if("s"!==e){var t=n[e].count;ie.value()||(H=_());var i=z+1,r=H[i];!r||i>t?(r=H[0],z=0):z=i,N.setValue(r.Q1);var o=ie.value();o&&p(e,!0)}}function g(e){if(pe!==e){if(pe){pe.modelCreated().unsubscribe(null,v);var t=pe.model();if(t){var i=t.mainSeries().properties();i.style.unsubscribe(null,m);var r=t.model();r.onSelectedSourceChanged().unsubscribe(null,y),pe=null}}if(e){var n=e.model();n?v(n):e.modelCreated().subscribe(null,v),pe=e}}}function v(e){var t=e.mainSeries().properties();t.style.subscribe(null,m),m(t.style);var i=e.model();i.onSelectedSourceChanged().subscribe(null,y),y(e.selectedSource())}function m(e){de.setValue(e.value())}function y(e){he.setValue(e)}function w(e){if(e!==K.value()){if(a.UndoHistory.beginUndoMacro("Symbol Lock"),e)for(var t=N.value(),i=t.getSymbol(),r=0;r<W.length;r++){var n=W[r].Q1;n!==t&&n.getSymbol()!==i&&n.setSymbol(i)}a.UndoHistory.setWatchedValue(K,e,"Symbol Lock"),a.UndoHistory.endUndoMacro()}}function T(e){if(e!==X.value()){if(a.UndoHistory.beginUndoMacro("Interval Lock"),e)for(var t=N.value(),i=t.getResolution(),r=0;r<W.length;r++){var n=W[r].Q1;n!==t&&n.getResolution()!==i&&n.setResolution(i)}a.UndoHistory.setWatchedValue(X,e,"Resolution Lock"),a.UndoHistory.endUndoMacro()}}function b(e){K.value()?S(e):N.value().setSymbol(e)}function S(e){for(var t=!1,i=0;i<W.length;i++){var r=W[i].Q1;(r.model().mainSeries().properties().symbol.value()!==e||Z75.enabled("same_data_requery"))&&(t||(a.UndoHistory.beginUndoMacro("Change Symbol"),t=!0),r.setSymbol(e))}t&&a.UndoHistory.endUndoMacro()}function C(e){if(X.value()){for(var t=!1,i=0;i<W.length;i++){var r=W[i].Q1;r.model().mainSeries().properties().interval.value()!==e&&(t||(a.UndoHistory.beginUndoMacro("Change Resolution"),t=!0),r.setResolution(e))}t&&a.UndoHistory.endUndoMacro()}else N.value().setResolution(e)}function x(e){if(e&&e.onlyActiveChart||te)return{layout:"s",hidpiRatio:window.hidpiCanvasRatio||1,charts:[N.value().images()]};for(var t=[],i=j.count,r=0;r<W.length&&i>r;r++)t.push(W[r].Q1.images());return{layout:q,hidpiRatio:window.hidpiCanvasRatio||1,charts:t}}function P(){for(var e=[],t=0;t<W.length&&t<j.count;t++)e=e.concat(W[t].Q1.tags());return e=$.unique(e),e=$.map(e,function(e){return e.toLowerCase().replace(/\W+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")})}function L(e,t,i){if(i||Q&&!te)for(var r=j.count,n=0;n<W.length&&r>n;n++){var o=W[n].Q1;if(o!==t){var a=o.model();a&&a.model().setExternalPosition(e)}}}function E(){return W.forEach(function(e){e.Q1.destroy()})}function V(){oe.id.setValue(void 0),oe.uid.setValue(void 0),oe.name.setValue(void 0)}function I(){var t={snapshotUrl:e.snapshotUrl},i=Z75.enabled("show_dialog_on_snapshot_ready")?TradingView.getImageOfChart:TradingView.getImageOfChartSilently;i(this,t,function(e){le.fire(e)})}function A(){for(var e=n[q].count;e<W.length;e++)W[e].Q1.destroy();W.splice(n[q].count)}function k(e){for(var t=0;t<W.length;t++)W[t].Q1.applyOverrides(e)}function R(e){return Z75.enabled("charting_library_base")?e:("s"!=e&&TradingView.trackGoProFeature("multipleCharts"),"s"===e||window.user&&user.is_pro||re.containsData||F?e:($82.showGoProDialog({feature:"multipleCharts"}),"s"))}function M(e){if(Y=[],e){e.charts||(e={layout:"s",charts:[e]}),q=R(e.layout||"s");for(var t=0;t<e.charts.length;t++)Y.push({content:e.charts[t]});e.symbolLock&&K.setValue(!0),e.intervalLock&&X.setValue(!0),e.hideAllDrawings&&J.setValue(!0)}ee.setValue(q),p(q,te),TradingView.drawingState.hideAllDrawings().setValue(J.value()),Y.splice(0,Y.length)}var O=this,D=2,B=0,N=new WatchedValue,F=!1,W=[],H=[],z=0,U=0,G=null,j=null,q="s",Y=[],K=new WatchedValue(!1),X=new WatchedValue(!1),J=new WatchedValue(!1),Z=new WatchedValue(TVSettings.getBool("chart.syncCrosshair",!0)),Q=Z.value();Z.subscribe(function(e){e=!!e,Q=e,TVSettings.setValue("chart.syncCrosshair",e)});var ee=new WatchedValue(q),te=!1,ie=new WatchedValue(te);e=e||{},"padding"in e&&(D=e.padding),"edge"in e&&(B=e.edge);var re=e.widgetOptions||{};re.readOnly&&(F=!0);var ne=e.metaInfo||{},oe={id:new WatchedValue(ne.id),name:new WatchedValue(ne.name),description:new WatchedValue(ne.description),username:new WatchedValue(ne.username),uid:new WatchedValue(ne.uid)},ae=$(e.jqParent).eq(0),se=e.onResize,le=new Delegate;this.updateLayout=r;var de=new WatchedValue,he=new WatchedValue;de.subscribe(function(e){var t=N.value();if(t){var i=t.model();if(i){var r=i.mainSeries().properties().style;r.value()!==e&&i.setChartStyleProperty(r,e,"Change Series Style")}}});var pe=null;N.subscribe(function(e){if(e){for(var t,i=W.length;i--;)if(W[i].Q1===e){t=i;break}if(!isFinite(t))throw Error("Cannot make detached ChartWidget active");if(U!==t){U=t,u(),H.length&&(z=H.indexOf(W[U]));for(var i=W.length;i--;)W[i].Q1.setActive(!1);e.setActive(!0)}g(e)}},{callWithLast:!0}),$.extend(this,{createChartWidget:h,getAll:function(){return W.map(function(e){return e.Q1})},destroy:E,layout:ee,maximizeCurrentChart:ie,activeChartWidget:N,activeChartStyle:de,selectedSource:he.readonly(),metaInfo:oe,state:t,asyncState:i,readOnly:function(){return F},lock:{symbol:K,setSymbolLockWithUndo:w,interval:X,setIntervalLockWithUndo:T,crosshair:Z},setSymbol:b,setResolution:C,updateLayout:r,resizeWidgetsUI:l,images:x,tags:P,syncCrosshair:L,setSymbolAll:S,clearChartMetaInfo:V,onfeatures:e.onfeatures,takeScreenshot:I,onScreenshotReady:function(){return le},loadContent:M,purgeUnusedWidgets:A,applyOverrides:k,switchChart:f,createLogo:null}),M(e.onfeatures?void 0:e.content),ee.subscribe(function(e){U=0,z=0,u(),p(e,!1)}),ee.hook=function(e){return e===this.value()?e:R(e)},F&&(ee.writeLock=!0),ie.subscribe(function(e){e!==te&&(H=_(),p(q,e))}),setInterval(d,1e3),$(window).on("resize",r),$(document).on("onUpdate",r),Z75.enabled("datasource_copypaste")&&(TradingView.AppClipboard.init(),e.globalEvents&&($(window).on("appclip:paste",function(e){N.value().onAppClipboardPaste(),e.preventDefault()}),$(window).on("appclip:copy",function(e){N.value().onAppClipboardCopy(),e.preventDefault()}),$(window).on("appclip:cut",function(e){N.value().onAppClipboardCut(),e.preventDefault()})))}var n=i(2),o=i(3),a=i(5);e.exports=r},function(e,t){"use strict";e.exports={s:{title:"1 chart",count:1,sizer:function(e,t,i,r){return{width:t.width-r-r,height:t.height-r-r,top:r,left:r}}}}},function(e,t,i){"use strict";function r(e){var t=this;this._startSpinner(e.jqParent),TradingView.drawingState.init();var i=this;TradingView.drawingState.tool.subscribe(function(e){if(i.Z98){var t=e;if(i.Z98.model().setCurrentTool(t),TradingView.isMobile.any()){var r=i._paneWidgets[0];if(g.isLineTool(t)&&"LineToolBrush"!==t){var n=.5*i.Z98.model().timeScale().width(),o=.5*r._state.defaultPriceScale().height();i.Z98.model().setCurrentPosition(n,o,r._state),r._updateTooltip(n,o)}else r._hideTooltip()}i.Z98&&TradingView.isMobile.any()&&i.Z98.model().crossHairSource().updateAllViews()}});var n=function(e){var i=t.Z98.model(),r=i.timeScale().points().roughIndex(e);return r};TradingView.drawingState.createdLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=t.Z98.model().mainSeries().symbol();if(r==e.symbol){var o=i.paneForSource(t.Z98.model().mainSeries()),a={index:n(e.point.timeStamp),price:e.point.price};t.Z98.createLineTool(o,a,e.linetool,e.properties,e.linkKey)}}}),TradingView.drawingState.continuedLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r={index:n(e.point.timeStamp),price:e.point.price},o=t.Z98.lineBeingCreated();if(o){var a=t.Z98.model().coninueCreatingLine(r,e.envState,!!e.finalState);a&&e.finalState&&o.restoreExternalPoints(e.finalState)}}}),TradingView.drawingState.cancelledLineTool.subscribe(null,function(e){var i=t.Z98.model();e.model!=i&&t.Z98.model().cancelCreatingLine()}),TradingView.drawingState.startedMovingLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=t.Z98.model().mainSeries().symbol();if(r==e.symbol){var o=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];if(o&&o.isActualSymbol()){var a={index:n(e.point.timeStamp),price:e.point.price};t.Z98.model().startMovingSource(o,a)}}}}),TradingView.drawingState.movedLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i&&i.sourceBeingMoved()&&i.sourceBeingMoved().linkKey==e.linkKey){var r={index:n(e.point.timeStamp),price:e.point.price};t.Z98.model().moveSource(r)}}),TradingView.drawingState.finishedMovingLineTool.subscribe(null,function(e){var i=t.Z98.model();e.model!=i&&i.sourceBeingMoved()&&t.Z98.model().endMovingSource(!!e.finalState)}),TradingView.drawingState.startedChangingLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=t.Z98.model().mainSeries().symbol();if(r==e.symbol){var o=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];if(o&&o.isActualSymbol()){var a={index:n(e.point.timeStamp),price:e.point.price};t.Z98.model().startChangingLinetool(o,a,e.pointIndex,{})}}}}),TradingView.drawingState.changedLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i&&i.lineBeingEdited()&&i.lineBeingEdited().linkKey==e.linkKey){var r={index:n(e.point.timeStamp),price:e.point.price};t.Z98.model().changeLinePoint(r)}}),TradingView.drawingState.finishedChangingLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];i.lineBeingEdited()&&t.Z98.model().endChangingLinetool(!!e.finalState),r&&r.isActualSymbol()&&e.finalState&&r.restoreExternalPoints(e.finalState)}}),TradingView.drawingState.removedLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];r&&t.Z98.model().removeSource(r)}}),TradingView.drawingState.finishedLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];r&&t.Z98.model().finishLineTool()}}),TradingView.drawingState.changedLineStyle.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];r&&(r.properties().merge(e.state),r.propertiesChanged())}}),TradingView.drawingState.restoredLineToolState.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=i.Q17().filter(function(t){return t.linkKey==e.linkKey})[0];r&&i.restoreLineToolState(r,e.state)}}),TradingView.drawingState.restoredLineTool.subscribe(null,function(e){var i=t.Z98.model();e.model!=i&&i.restoreSource(e.state.restorePane,e.state.paneIndex,e.state.paneState,e.state.sourceState,e.state.priceScaleName)}),TradingView.drawingState.copiedLineTool.subscribe(null,function(e){var i=t.Z98.model();if(e.model!=i){var r=t.Z98.model().mainSeries().symbol();if(r==e.symbol){var o=i.paneForSource(t.Z98.model().mainSeries()),a=e.points[0],s={index:n(a.time_t),price:a.price},l=i.createLineTool(o,s,e.linetool,null,e.linkKey);if(i.lineBeingCreated())for(var d=1;d<e.points.length;d++){var s={index:n(e.points[d].absolute_time),price:e.points[d].price};d!=e.points.length-1||"LineToolBrush"!=e.linetool&&"LineToolGhostFeed"!=e.linetool||i.finishLineTool(!0),i.coninueCreatingLine(s,{},d<e.points.length-1,!0)}l.restoreExternalPoints({points:e.points,interval:e.state.interval}),l.properties().merge(e.state),l.restoreData&&l.restoreData(e),l.propertiesChanged()}}}),this._options=e=e||{};var o=e.jqParent,a=e.sizeFunc,s=e.content,l=e.readOnly,d=e.containsData,h=e.onWidget,p=e.onCmeWidget;p&&TradingView.logWarn("[ChartWidget] 'onCmeWidget' option is depricated");var c=e.widgetCustomer,u=e.timezone,_=e.withDateRanges,f=e.hideSymbolSearch,v=e.defSymbol,m=e.defInterval,y=e.defExtendedHours,w=-1!==$.inArray(e.defStyle,$.map($.grep(Object.keys(TradingView.Series),function(e){return/^STYLE_\w+/.test(e)}),function(e){return TradingView.Series[e]})),T=w?e.defStyle:void 0;this.Q3=e.Q4||null,this._withDateRanges=(void 0===_?!l:!!_)&&Z75.enabled("timeframes_toolbar"),this._jqParent=void 0!==o?o:$(document.body),this._setContent(s),this._readOnly=l,this._containsData=d,this._defSymbol=v,this._defInterval=m,this._defStyle=T,this._onWidget=!!h,this._onWidget&&(p?this._widgetCustomer="cme":c&&(this._widgetCustomer=c)),this._sizeFunc=a||function(){var e=t._jqParent.width(),i=t._jqParent.height(),r=t._jqParent[0];return window.self!==window.top&&r.offsetWidth<r.clientWidth&&r.getBoundingClientRect().width<100&&(e=Math.round(100*r.getBoundingClientRect().width),i=Math.round(100*r.getBoundingClientRect().height)),new TradingView.Rect(0,0,e,i-(t._withDateRanges?22:0))},this._hideSymbolSearch=f,this._jqMainDiv=null,this._rect=this._sizeFunc(),this._jqMainTable=null,this._paneWidgets=[],this._paneSeparators=[],this._timeAxisWidget=null,this._frameTime=30,this.Z98=null,this._metaInfo={};var b=this._contentSeriesProperties();b&&(v=b.symbol,m=b.interval),void 0===TradingView.Interval||TradingView.Interval.isValid(m)||(m=void 0),this.Q0=new J50("chartproperties"),this.Q0.mainSeriesProperties.merge(defaults("chartproperties.mainSeriesProperties")),this.Q0.mainSeriesProperties.merge({visible:!0,symbol:v?v:DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:m||"D",style:T,extendedHours:y,lineStyle:{styleType:TradingView.factoryDefaults("chartproperties.mainSeriesProperties.lineStyle.styleType")}}),this._containsData&&this.Q0.mainSeriesProperties.merge({showCountdown:!1}),u&&TradingView.timezoneIsAvailable(u)&&this.Q0.timezone.setValue(u),this._tagsChanged=new Delegate,this._modelCreated=new Delegate,this._disconnected=new Delegate,this._reconnectBailout=new Delegate,this._connected=new Delegate,this._redrawPanes=new Delegate,this.chartWidgetInitialized=new Delegate,this._studiesMetaData=[],this._studiesMigrations=[],this._chartSession=new TradingView.ChartSession(Q14),this.lhsPriceAxisWidthChanged=new Delegate,this.rhsPriceAxisWidthChanged=new Delegate,this.createLogo=null,!this._readOnly&&TradingView.perfomanceTestEnabled()&&(this.performance=new r.Performance(this))}function n(e){return e.description_localized=$.t(e.description,{context:"study"}),e}var o=i(4),a=i(5),s=i(362),l=i(175),d=i(359),h=i(363),p=i(80),c=i(71).BarsMarksContainer,u=i(364),_=i(365),f=i(74).Study,g=i(13).LineDataSource,v=i(61),m=v.ESDStudyBase,y=v.study_Script$TV_EARNINGS,w=v.study_Script$TV_SPLITS,T=v.study_Script$TV_DIVIDENDS,b=i(366),S=i(367),C=i(360),x=i(28),P=i(243);r.prototype.refreshMarks=function(){this.model().barsMarksSources().map(function(e){e.refreshData()})},r.prototype.clearMarks=function(){this.model().barsMarksSources().map(function(e){e.clearMarks()})},r._nextMetadataId=1,r.FREE_STUDY_LIMIT=10,r.prototype._onStudiesMetadata=function(e){TradingView.logDebugChart("ChartWidget _onStudiesMetadata called");
var t=this;if("studies_metadata"===e.method){this._studiesMigrations=[];for(var i=e.params[1].migrations,o=0;i&&o<i.length;o++)this._studiesMigrations.push(i[o]);for(var a=e.params[1].metainfo,o=0;o<a.length;o++)p._verifyInputsMaxValue(a[o]);for(var o=0;o<a.length;o++)n(a[o]);if(a=a.concat(this.privateMetaInfo(u)),a=a.concat(this.privateMetaInfo(_)),Z75.enabled("alerts")&&this._setAlertsStudiesList(a),void 0!==PineAddons){for(var s in PineAddons)a=a.concat(r._filterAuthorizedMetaInfo(PineAddons[s]));var s=PineAddons.ESDMetaInfo;assert(null!==s&&void 0!==s,"PineAddons.ESDMetaInfo not found")}else TradingView.logError("PineAddons is undefined. All Pine Script products will be unavailable");var l=this._tvScriptsRequestDfd;l||(l=$.Deferred().resolve([])),l.done(function(e){t._onScriptSources(e,a)})}},r.prototype._setAlertsStudiesList=function(e){this._alertsStudiesList=$.map($.grep(e,function(e){for(var t=e.plots||[],i=0;i<t.length;i++)if("line"===t[i].type)return!0;return!1}),function(e){return e.id})},r.prototype.canCreateAlertForDataSource=function(e){function t(e){var e=e;if(e instanceof $57&&(e=e.bars()),e instanceof TradingView.PlotList&&(e=e.state().data),!$.isArray(e))return!0;for(var t=e.length-1;t>=0;t--){var i=e[t];if(!$.isArray(i.value))return!0;for(var r=i.value.length-1;r>0;r--){var n=i.value[r];if(null!==n&&void 0!==n&&!TradingView.isNaN(n))return!0}}return!1}if(!Z75.enabled("alerts"))return!1;var i=function(){return e.data()&&!e.data().isEmpty()&&t(e.data())},r=e.uniqueId&&e.uniqueId(),n=e===this.Z98.mainSeries(),o=e instanceof f,a=!(e instanceof T||e instanceof w||e instanceof y),s=e.metaInfo?e.metaInfo():null,l=s?s.isTVScript:!1,d=s?s.isTVScriptStrategy:!1,h=function(){var t=e.stateForAlert&&e.stateForAlert();return t?x.prototype._getPlotsFromDatasourceState(t).length:!1},p=s?-1!=$.inArray(s.fullId,this._alertsStudiesList):!1;return r&&!d&&(n||o&&a&&i()&&(p||l&&h()))},r._filterAuthorizedMetaInfo=function(e){for(var t=[],i=0;e&&i<e.length;++i){var r=e[i],n=TradingView.StudyMetaInfo.parseIdString(r.id),o=n.productId;pro.hasPackage(o)&&t.push(r)}return t},r.prototype.privateMetaInfo=function(e){if(e){var t=new e(TradingView.StudyMetaInfo.CURRENT_METAINFO_FORMAT_VERSION);return t.generateMetaInfo()}return[]},r.prototype._onScriptSources=function(e,t){if(TradingView.logDebugChart("ChartWidget _onScriptSources called"),!this.onWidget()){for(var i=null,r=0;r<t.length;++r){var n=t[r];if(n.id.startsWith("Script@tv-scripting-")){i=TradingView.StudyMetaInfo.parseIdString(n.id).version;break}}if(null!=i){this.studyScriptingPkgVers=i;for(var o=0,a=0,r=0;r<e.length;++r){var s=e[r];if(TradingView.Q16("backtesting")||!s.isTVScriptStrategy){var l=s.scriptName;o++;try{var d=TradingView.StudyMetaInfo.createMetaInfoStub(s,i);t.push(d)}catch(h){TradingView.logError("Could not process script (skipped): "+l+" ("+h.message+")"),a++}}}TradingView.logDebugChart("User's Pine Scripts loaded "+o+", skipped "+a)}else TradingView.logError("Could not find tv-scripting package in metadata response")}for(var r=0;r<t.length;r++)TradingView.StudyMetaInfo.addStudyMetaInfo(this._studiesMetaData,t[r]);this._init(),this.chartWidgetInitialized.fire(),TradingView.logDebugChart("ChartWidget _onScriptSources done")},r.prototype._init=function(){var e=this;this._containsData||this._content&&this._content.timeScale&&!this._content.timeScale.m_lastVisibleBar&&(this._content.timeScale.m_rightOffset=this.Q0.timeScale.rightOffset.value()),this.model()&&this.model().mainSeries().clearData(),this.initColors(),this._makeDefaultGui(),this._makeDefaultModel(),this._checkObsoleteTimezone(),this._chartSession&&this._chartSession.connected()&&this.Z98.restart(),this._content&&(this.initColors(),this._updateGui(),this.update()),e.Z98.mainSeries().marketStatus.subscribe(function(t){e.indicatorImage&&e._updateDataAndMarketStatus(t,e.Z98.mainSeries().status())},{callWithLast:!0}),this._resizeHandler=function(e){this._rect=this._sizeFunc(),e&&(this._rect.w+=e,this._rect.h+=e),TradingView.setAbsoluteRect(this._jqMainDiv,this._rect),this._adjustSize(),this.Z98&&this.Z98.mainSeries().requestMoreData(),this.paint(),this.resizeSeriesControlUI(),this.checkCompactMode(),this.resizeIndicator()}.bind(this),this._resizeHandler(),this._jqMainDiv.appendTo(this._jqParent),this._spinner&&(this._spinner.stop(),delete this._spinner),$(window).on("visibilitychange",function(t,i){i&&navigator.userAgent.match(/mac os.+chrome/i)&&(e._resizeHandler(1),setTimeout(function(){e._resizeHandler()},0))}),$(window).keydown(function(e){27==e.which&&e.preventDefault()}),this._containsData||this._jqMainDiv.mousewheel(function(e,t,i,r){if((TradingView.onWidget()||!parent||parent===window||!parent.IS_DEMO_PAGE)&&this.model()&&!this.noScroll&&!this.model().timeScale().isEmpty()){var n=e.pageX-5,o=this._paneWidgets[0].lhsPriceAxisWidget.size.w,a=(this._paneWidgets[0].rhsPriceAxisWidget.size.w,this._timeAxisWidget.size.w);o&&(n=Math.max(0,n-o)),n=Math.min(n,a);var s=Z75.enabled("right_bar_stays_on_scroll")?1:2*(n/a-.5),l=Math.min(1,Math.abs(r));return r>0?this.model().zoomIn(s,l):0>r&&this.model().zoomOut(s,l),i&&this.model().scrollChart(-80*i),!1}}.bind(this)),this._initBarsMarksSources(),TradingView.Q16("esdindicatorfeature")&&this.initESDTimelineWidget(),this._containsData||this._createChartEventsSource(),this.setAutoScaleOnSymbolChange(),this.readOnly()||this._hideSymbolSearch||$68.registerDialogKeypressHandler(this),this.adaptOnChartLogo()},r.prototype._checkObsoleteTimezone=function(){var e=this.Q0.timezone.value();TradingView.timezoneIsAvailable(e)||this.Q0.timezone.setValue(TradingView.getTzByObsoleteName(e))},r.prototype._initBarsMarksSources=function(){var e=this;this.withModel(this,function(){this.model().barsMarksSources().map(function(t){t.onNeedRepaint.subscribe(e,e.paint)})})},r.prototype.initESDTimelineWidget=function(){new b(this)},r.prototype.setAutoScaleOnSymbolChange=function(){this.withModel(this,function(){this.model().mainSeries().properties().symbol.listeners().subscribe(this,function(){(!this.model().mainSeries()instanceof TradingView.Series||!this.model().mainSeries().properties().lockScale.value())&&this.model().mainSeries().priceScale().setAutoScale(!0)})})},r.prototype.initColors=function(){this.Q0.paneProperties.background.listeners().subscribe(this,r.prototype.setBackgroundColor),this.Q0.paneProperties.vertGridProperties.color.listeners().subscribe(this,r.prototype.redrawPanes),this.Q0.paneProperties.horzGridProperties.color.listeners().subscribe(this,r.prototype.redrawPanes),this.Q0.scalesProperties.lineColor.listeners().subscribe(this,r.prototype.setScaleLineColor),this.Q0.scalesProperties.textColor.listeners().subscribe(this,r.prototype.setScaleTextColor)},r.prototype.paneWidgets=function(){return this._paneWidgets},r.prototype.paneByCanvas=function(e){for(var t=0;t<this._paneWidgets.length;t++)if(this._paneWidgets[t].canvas===e||this._paneWidgets[t].top_canvas===e)return this._paneWidgets[t];return null},r.prototype.paneByState=function(e){for(var t=0;t<this._paneWidgets.length;t++)if(this._paneWidgets[t]._state===e)return this._paneWidgets[t];return null},r.prototype.priceAxisByCanvas=function(e){for(var t=0;t<this._paneWidgets.length;t++){var i=this._paneWidgets[t],r=i.priceAxisByCanvas(e);if(r)return r}return null},r.prototype.timeAxisByCanvas=function(e){return e===this._timeAxisWidget.canvas||e===this._timeAxisWidget.top_canvas?this._timeAxisWidget:null},r.prototype.properties=function(){return this.Q0},r.prototype.emulateCriticalError=function(){this._chartSession.removeSeries(-1,null)},r.prototype.readOnly=function(){return this._readOnly},r.prototype.onDisconnected=function(){return this._disconnected},r.prototype.onReconnectBailout=function(){return this._reconnectBailout},r.prototype.onConnected=function(){return this._connected},r.prototype.onRedrawPanes=function(){return this._redrawPanes},r.prototype.modelCreated=function(){return this._modelCreated},r.prototype.setResolution=function(e){if(!this.Z98)return void this.Q0.mainSeriesProperties.merge({interval:e});var t=this.Z98.mainSeries().properties().interval;this.Z98.setScreenChartProperty(t,e,this,$.t("Change Resolution"))},r.prototype.getResolution=function(){return this.Z98?this.Z98.mainSeries().properties().interval.value():this.Q0.mainSeriesProperties.interval.value()},r.prototype.addSymbol=function(e,t){var i=this.model(),r=i.studiesMetaData(),n="study_Overlay@tv-basicstudies",o=Z75.enabled("use_overrides_for_overlay")&&TradingView.defaultProperties[n]&&TradingView.defaultProperties[n].style,a=o||(i.mainSeries().properties().style.value()==TradingView.Series.STYLE_CANDLES?TradingView.Series.STYLE_BARS:TradingView.Series.STYLE_CANDLES),s={inputs:{symbol:e},style:a},l=r.filter(function(e){return"Overlay@tv-basicstudies"==e.id})[0];i.insertStudy(l,s,t)},r.prototype.addSymbolDialog=function(){$82.showAddSymbolDialog(this,{overlayOption:!0,callback:this.addSymbol.bind(this)})},r.prototype.updateActions=function(){function e(e){function t(){TradingView.showThemeSaveDialog(i.Z98)}r.applyColorTheme.subActions||(r.applyColorTheme.subActions=[]);var n=r.applyColorTheme.subActions;if(n.splice(0,n.length),is_authenticated){var o=new TradingView.Action({text:$.t("Save As...")});o.callbacks().subscribe(null,t),n.push(o),n.push(new TradingView.ActionSeparator)}e&&e.length?$.each(e,function(e,t){function r(e){return function(){var t=$.t("Do you really want to delete __themename__ theme?",{themename:e?'"'+e+'"':""});return $82.showConfirm($.t("Theme"),t,function(){$.post("/remove-theme/",{name:e}).error(function(e){TradingView.logError(e.responseText)}),TradingView.getThemesList.Q18()}),this._parentMenu._parentMenuItem._parentMenu.destroy(),!1}}var o=new TradingView.Action({text:$.t(t)});o.callbacks().subscribe(null,function(){$.getJSON("/theme/?themeName="+encodeURIComponent(t),function(e){i.model().model().restoreTheme(JSON.parse(e.content))})}),is_authenticated&&(o.deleteButton={action:r(o.text)}),n.push(o)}):n.push(new TradingView.Action({text:$.t("No color themes saved"),enabled:!1}))}function t(){var e=studyTemplates.plainList("custom"),t=studyTemplates.plainList("default");r.applyStudyTemplate.subActions||(r.applyStudyTemplate.subActions=[]);var i=r.applyStudyTemplate.subActions;i.splice(0,i.length);var n=new TradingView.Action({text:studyTemplates._SAVE_AS_TITLE});n.callbacks().subscribe(studyTemplates,studyTemplates.showSaveAsDiaolg),i.push(n),i.push(new TradingView.ActionSeparator),e.length||t.length?(e.length&&($.each(e,function(e,t){function r(e){return function(){return studyTemplates.deleteStudyTemplate(e),this._parentMenu._parentMenuItem._parentMenu.destroy(),!1}}var n=new TradingView.Action({text:t});n.callbacks().subscribe(studyTemplates,function(){this.applyStudyTemplate(t)}),n.deleteButton={action:r(n.text)},i.push(n)}),t.length&&i.push(new TradingView.ActionSeparator)),$.each(t,function(e,t){var r=new TradingView.Action({text:t});r.callbacks().subscribe(studyTemplates,function(){this.applyStudyTemplate(t)}),i.push(r)})):i.push(new TradingView.Action({text:$.t("No study templates saved"),enabled:!1}))}for(var i=this,r=this.actions(),n=this.Z98.Q17(),o=!1,a=!1,s=0,l=n.length;l>s;s++){var d=n[s];TradingView.isInherited(d.constructor,g)&&d.isUserDeletable()&&(o=!0),TradingView.isInherited(d.constructor,f)&&d.removeByRemoveAllStudies()&&(a=!0)}this._readOnly||(r.paneRemoveAllStudies&&r.paneRemoveAllStudies.setEnabled(a),r.paneRemoveAllDrawingTools&&r.paneRemoveAllDrawingTools.setEnabled(o),r.paneRemoveAllStudiesDrawingTools&&r.paneRemoveAllStudiesDrawingTools.setEnabled(a||o)),e(TradingView.getThemesList(e)),window.studyTemplates&&(t(),studyTemplates.refreshStudyTemplateList(t));var h=this,p=[],c=TradingView.availableTimezones,u=function(e){return e.id===h.model().model().properties().timezone.value()};c.forEach(function(e){if(!e.separator){var t=new TradingView.Action({text:e.title,checkable:!0,checked:u(e)});t.callbacks().subscribe(this,function(){h.model().setProperty(h.model().model().properties().timezone,e.id,"Changed Time Zone")}),p.push(t)}},this),r.applyTimeZone.subActions=p,r.addToWatchlist.text=$.t("Add {0} To Watchlist").format(this.getSymbol(!0)),r.addToTextNotes&&(r.addToTextNotes.text=$.t("Add Text Note For {0}").format(this.getSymbol(!0))),this.updateActionForIntradayOnly(r.sessionBreaks)},r.prototype.actions=function(){return this._actions||this._setActions(),this._actions},r.prototype._setActions=function(){var e=i(179).ActionBinder,t=this,n=[];if(!this._readOnly){n=[new TradingView.Action({text:$.t("Eraser"),callbackContext:"eraser"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Trend Line"),callbackContext:"LineToolTrendLine"}),new TradingView.Action({text:$.t("Horizontal Line"),callbackContext:"LineToolHorzLine"}),new TradingView.Action({text:$.t("Vertical Line"),callbackContext:"LineToolVertLine"}),new TradingView.Action({text:$.t("Arrow"),callbackContext:"LineToolArrow"}),new TradingView.Action({text:$.t("Ray"),callbackContext:"LineToolRay"}),new TradingView.Action({text:$.t("Extended"),callbackContext:"LineToolExtended"}),new TradingView.Action({text:$.t("Parallel Channel"),callbackContext:"LineToolParallelChannel"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Pitchfork"),callbackContext:"LineToolPitchfork"}),new TradingView.Action({text:$.t("Schiff Pitchfork"),callbackContext:"LineToolSchiffPitchfork"}),new TradingView.Action({text:$.t("Pitchfan"),callbackContext:"LineToolPitchfan"}),new TradingView.Action({text:$.t("Gann Square"),callbackContext:"LineToolGannSquare"}),new TradingView.Action({text:$.t("Gann Fan"),callbackContext:"LineToolGannFan"}),new TradingView.Action({text:$.t("Fib Retracement"),callbackContext:"LineToolFibRetracement"}),new TradingView.Action({text:$.t("Trend-Based Fib Extension"),callbackContext:"LineToolTrendBasedFibExtension"}),new TradingView.Action({text:$.t("Fib Speed Resistance Fan"),callbackContext:"LineToolFibSpeedResistanceFan"}),new TradingView.Action({text:$.t("Fib Time Zone"),callbackContext:"LineToolFibTimeZone"}),new TradingView.Action({text:$.t("Circle Lines"),callbackContext:"LineToolCircleLines"}),new TradingView.Action({text:$.t("Fib Circles"),callbackContext:"LineToolFibCircles"}),new TradingView.Action({text:$.t("Fib Speed Resistance Arcs"),callbackContext:"LineToolFibSpeedResistanceArcs"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Rectangle"),callbackContext:"LineToolRectangle"}),new TradingView.Action({text:$.t("Ellipse"),callbackContext:"LineToolEllipse"}),new TradingView.Action({text:$.t("Triangle"),callbackContext:"LineToolTriangle"}),new TradingView.Action({text:$.t("Polyline"),callbackContext:"LineToolPolyline"}),new TradingView.Action({text:$.t("Arc"),callbackContext:"LineToolArc"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Text"),callbackContext:"LineToolText"}),new TradingView.Action({text:$.t("Anchored Text"),callbackContext:"LineToolTextAbsolute"}),new TradingView.Action({text:$.t("Balloon"),callbackContext:"LineToolBalloon"}),new TradingView.Action({text:$.t("Price Label"),callbackContext:"LineToolPriceLabel"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Elliott Wave Subminuette"),callbackContext:"LineToolElliottSubminuette"}),new TradingView.Action({text:$.t("Elliott Wave Minor"),callbackContext:"LineToolElliottMinor"}),new TradingView.Action({text:$.t("Elliott Wave Circle"),callbackContext:"LineToolElliottCircle"}),new TradingView.Action({text:$.t("Elliott Minor Retracement"),callbackContext:"LineToolElliottMinorRetr"}),new TradingView.Action({text:$.t("Elliott Major Retracement"),callbackContext:"LineToolElliottMajorRetr"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Brush"),callbackContext:"LineToolBrush"}),new TradingView.ActionSeparator,new TradingView.Action({text:$.t("Forecast"),callbackContext:"LineToolPrediction"})];for(var t=this,o=function(e){TradingView.drawingState.tool.setValue(e.callbackContext())},s=0;s<n.length;s++)n[s].callbacks().subscribe(null,o)}var l=new TradingView.Action({text:$.t("Add Alert"),shortcut:"Alt+A"}),d=new TradingView.Action({text:$.t("Reset Chart"),shortcut:"Alt+R"});d.callbacks().subscribe(this,this.GUIResetScales);var h=new TradingView.Action({text:$.t("Undo"),shortcut:"ctrl+z"});h.callbacks().subscribe(null,function(){TradingView.trackEvent("GUI","Undo"),a.UndoHistory.undo()}),h.disable();var p=new TradingView.Action({text:$.t("Redo"),shortcut:"ctrl+y"});p.callbacks().subscribe(null,function(){TradingView.trackEvent("GUI","Redo"),a.UndoHistory.redo()}),p.disable(),a.UndoHistory.undoStack().onChange().subscribe(this,this.updateUndoRedo),a.UndoHistory.redoStack().onChange().subscribe(this,this.updateUndoRedo);var c=new TradingView.Action({text:$.t("Color Theme")}),u=new TradingView.Action({text:$.t("TimeZone")}),_=new TradingView.Action({text:$.t("Change Symbol..."),shortcut:$.t("Any Symbol"),doNotBindShortcut:!0});TVSettings.setValue("symboledit.dialog_last_entry",""),_.callbacks().subscribe(this,function(){$68.showDialog({callback:this.setSymbol.bind(this)})});var f=new TradingView.Action({text:$.t("Change Interval..."),shortcut:$.t("Any Number"),doNotBindShortcut:!0});f.callbacks().subscribe(this,function(){new TradingView.ChangeIntervalDialog({callback:function(e){$44.interval.setValue(e)}}).show()});var g,v;TradingView.onWidget()||(g=new TradingView.Action({text:$.t("Add To Watchlist"),shortcut:"Alt+W"}),v=new TradingView.Action({text:$.t("Add To Text Notes"),shortcut:"Alt+N"}),g.callbacks().subscribe(this,function(){for(var e,t=widgetbar.setPage("base"),i=0;i<t.widgets.length;i++)if("watchlist"==t.widgets[i].type){e=t.widgets[i].widgetObject;break}e&&e.addHighlight(this.getSymbol())}),v.callbacks().subscribe(this,function(){var e=this;runOrSignIn(function(){TradingView.bottomWidgetBar.toggleWidget("text_notes",!0),TradingView.bottomWidgetBar._widgets.text_notes.addNote(null,e.getSymbol(!0),e.getSymbol())},{source:"Add text note in chart context menu"})}));var m=new TradingView.Action({text:$.t("Insert Study Template")}),y=new TradingView.Action({shortcut:"ctrl+alt+q",text:$.t("Reset Scale")});y.callbacks().subscribe(null,function(e){t.model().resetTimeScale()});var w=new TradingView.Action({text:$.t("Insert Drawing Tool"),subActions:n}),T=new TradingView.Action({text:$.t("Remove All Indicators")}),b=new TradingView.Action({text:$.t("Remove All Drawing Tools")}),S=new TradingView.Action({text:$.t("All Indicators And Drawing Tools")}),C=new TradingView.Action({text:$.t("Insert Indicator..."),shortcut:"/"}),P=new TradingView.Action({text:$.t("Script Editor...")}),L=new TradingView.Action({text:$.t("Compare or Add Symbol...")}),E=new TradingView.Action({text:$.t("Compare...")}),V=new TradingView.Action({text:$.t("Objects Tree...")}),I=new TradingView.Action({text:$.t("Properties..."),callback:function(e,i){t.showChartProperties()}}),A=new TradingView.Action({text:$.t("Scales Properties...")}),k=new TradingView.Action({text:$.t("Timezone/Sessions Properties...")}),R=new TradingView.Action({text:$.t("Lock/Unlock")});R.callbacks().subscribe(this,r.prototype.toggleLockSelectedObject);var M=new TradingView.Action({text:$.t("Hide")});M.callbacks().subscribe(this,r.prototype.hideSelectedObject);var O=new TradingView.Action({text:$.t("Format...")});O.callbacks().subscribe(this,r.prototype.editSelectedObject);var D=new TradingView.Action({text:$.t("Source Code...")});D.callbacks().subscribe(this,this.openSelectedObjectSource);var B=new TradingView.Action({text:$.t("Left Axis"),checkable:!0});B.binder=new e(B,this.Q0.scalesProperties.showLeftScale,this.model(),$.t("Show Left Scale"));var N=new TradingView.Action({text:$.t("Right Axis"),checkable:!0});N.binder=new e(N,this.Q0.scalesProperties.showRightScale,this.model(),$.t("Show Right Scale")),this.Q0.scalesProperties.showLeftScale.listeners().subscribe(this,r.prototype._updateScalesActions),this.Q0.scalesProperties.showRightScale.listeners().subscribe(this,r.prototype._updateScalesActions);var F=new TradingView.Action({text:$.t("Scale Price Chart Only"),checkable:!0});F.binder=new e(F,this.Q0.scalesProperties.scaleSeriesOnly,this.model(),$.t("Scale Price Chart Only"));var W=this.model().model();this.Q0.scalesProperties.scaleSeriesOnly.listeners().subscribe(null,function(){W.recalculateAllPanes(),W.Q18(new $21($21.FULL_UPDATE))});var H=new TradingView.Action({text:$.t("Drawings Toolbar"),checkable:!0});window.sideToolbar&&(H.binder=new e(H,window.sideToolbar.visible,this.model(),$.t("Drawings Toolbar")));var z=new TradingView.Action({text:$.t("Favorite Drawings Toolbar"),checkable:!0});window.sideToolbar&&window.sideToolbar.favoriteDrawingToolbar&&(z.binder=new e(z,window.sideToolbar.favoriteDrawingToolbar.visibleProperty,this.model(),$.t("Drawings Toolbar")));var U=new TradingView.Action({text:$.t("Magnet Mode"),checkable:!0});U.binder=new e(U,TradingView.drawingState.properties().magnet,this.model(),"Magnet");var G=new TradingView.Action({text:$.t("Stay In Drawing Mode"),checkable:!0});G.binder=new e(G,TradingView.drawingState.properties().stayInDrawingMode,this.model(),$.t("Stay In Drawing Mode"));var j=new TradingView.Action({text:$.t("Sync drawings to all charts"),checkable:!0});j.binder=new e(j,TradingView.drawingState.properties().drawOnAllCharts,this.model(),"SyncDrawings");var q=new TradingView.Action({text:$.t("Lock All Drawing Tools"),checkable:!0});q.binder=new e(q,TradingView.drawingState.lockDrawings(),this.model(),$.t("Lock drawings"),function(e){e||this.binder.setValue(!this.binder.value()),TradingView.drawingState.lockDrawings().setValue(this.binder.value())}.bind(q));var Y=new TradingView.Action({text:$.t("Hide All Drawing Tools"),checkable:!0});Y.binder=new e(Y,TradingView.drawingState.hideAllDrawings(),this.model(),$.t("Hide All Drawing Tools"),function(e){e||this.binder.setValue(!this.binder.value()),TradingView.drawingState.hideAllDrawings().setValue(this.binder.value())}.bind(Y));var K=new TradingView.Action({text:$.t("Hide Marks On Bars"),checkable:!0});K.binder=new e(K,TradingView.drawingState.hideMarksOnBars(),this.model(),$.t("Hide Marks On Bars"),function(e){e||this.binder.setValue(!this.binder.value()),TradingView.drawingState.hideMarksOnBars().setValue(this.binder.value())}.bind(K));var X=new TradingView.Action({text:$.t("Extended Hours"),checkable:!0});X.binder=new e(X,this.model().mainSeries().properties().extendedHours,this.model(),$.t("Change Extended Hours"));var J=new TradingView.Action({text:$.t("Symbol Last Value"),checkable:!0,checked:!1});J.binder=new e(J,this.properties().scalesProperties.showSeriesLastValue,this.model(),$.t("Show Symbol Last Value"));var Z=new TradingView.Action({text:$.t("Symbol Labels"),checkable:!0,checked:!1});Z.binding=new e(Z,this.properties().scalesProperties.showSymbolLabels,this.model(),"Undo Show Symbol Labels");var Q=new TradingView.Action({text:$.t("Indicator Last Value"),checkable:!0,checked:!1});Q.binder=new e(Q,this.properties().scalesProperties.showStudyLastValue,this.model(),$.t("Show Indicator Last Value"));var ee=new TradingView.Action({text:$.t("Indicator Labels"),checkable:!0,checked:!1});ee.binding=new e(ee,this.properties().scalesProperties.showStudyPlotLabels,this.model(),"Undo Show Indicator Labels");var te=new TradingView.Action({text:$.t("Countdown"),checkable:!0,checked:!1});te.binder=new e(te,this.model().mainSeries().properties().showCountdown,this.model(),$.t("Show Countdown"));var ie;TradingView.onWidget()||Z75.enabled("charting_library_base")||(ie=new TradingView.Action({text:$.t("Go to Date..."),shortcut:"Alt+G"}),ie.callbacks().subscribe(null,function(){var e=t.Q3.activeChartWidget.value();TradingView.GotoDateDialog.get().open(e.model())}));var re=new TradingView.Action({text:$.t("Symbol Info..."),checkable:!1});re.callbacks().subscribe(null,function(){var e=t.model().mainSeries().symbol(),i=t.model().mainSeries().symbolInfo();TradingView.SymbolInfoDialog(e,{symbolInfo:i})});var ne;if(!t.onWidget()){ne=new TradingView.Action({text:$.t("Snapshot"),shortcut:"Alt+s"}),ne.callbacks().subscribe(null,function(){t.Q3.takeScreenshot()});var oe=new TradingView.Action({text:$.t("Publish idea"),shortcut:"Alt+p"});oe.callbacks().subscribe(null,function(){TradingView.Common.publishChart()});var ae=new TradingView.Action({text:$.t("Switch to the next chart"),shortcut:"Tab"});ae.callbacks().subscribe(null,function(){t.Q3.switchChart()})}if(this._actions={chartProperties:I,timeScaleReset:y,chartReset:d,compareOrAdd:L,compare:E,scalesProperties:A,tmzProperties:k,paneObjectTree:V,insertIndicator:C,insertDrawingTool:w,applyColorTheme:c,applyStudyTemplate:m,symbolSearch:_,showSymbolInfoDialog:re,changeInterval:f,seriesHide:M,studyHide:M,lineToggleLock:R,lineHide:M,showLeftAxis:B,showRightAxis:N,scaleSeriesOnly:F,drawingToolbarAction:H,favoriteDrawingToolbar:z,magnetAction:U,stayInDrawingModeAction:G,syncModeAction:j,lockDrawingsAction:q,hideAllDrawingsAction:Y,hideAllMarks:K,applyTimeZone:u,extendedHours:X,showCountdown:te,showSeriesLastValue:J,showSymbolLabelsAction:Z,showStudyLastValue:Q,showStudyPlotNamesAction:ee,undo:h,redo:p,viewSourceCode:D,takeScreenshot:ne},TradingView.onWidget()||(this._actions.addToWatchlist=g),!TradingView.onWidget()&&Z75.enabled("text_notes")&&(this._actions.addToTextNotes=v),Z75.enabled("charting_library_base")||(TradingView.onWidget()||(this._actions.gotoDate=ie),this._actions.scriptEditor=P),this.createSessionBreaksActions(),!this.readOnly()){var se=new TradingView.Action({text:$.t("Remove"),shortcut:"Del"});se.callbacks().subscribe(this,function(){var e;this.Q3&&(e=this.Q3.activeChartWidget.value()),e||(e=this),e.removeSelectedSource()});var le=new TradingView.Action({text:$.t("Stop syncing drawing")});le.callbacks().subscribe(this,function(){var e;this.Q3&&(e=this.Q3.activeChartWidget.value()),e||(e=this),e.unlinkSelectedLine()});var de=new TradingView.Action({text:$.t("Sync drawing to all charts")});de.callbacks().subscribe(this,function(){var e;this.Q3&&(e=this.Q3.activeChartWidget.value()),e||(e=this),e.copyLineToOtherCharts()}),Z75.enabled("alerts")&&(this._actions.addAlert=l,this._actions.addAlert.callbacks().subscribe(this,function(){this.Q3.activeChartWidget.value()===this&&runOrSignIn(function(){var e;return this.Q3&&(e=this.Q3.activeChartWidget.value()),e||(e=this),this.activePaneWidget?void new x(e,{series:e.model().hoveredSource()||this.activePaneWidget.state().mainDataSource(),value:e.model().crossHairSource().price}):void new x(e)}.bind(this),{source:"Alert add from context menu"})})),this._actions.insertDrawingTool=w,this._actions.paneRemoveAllStudies=T,this._actions.paneRemoveAllDrawingTools=b,this._actions.paneRemoveAllStudiesDrawingTools=S,this._actions.seriesRemove=se,this._actions.studyRemove=se,this._actions.lineRemove=se,this._actions.lineUnlink=le,this._actions.lineCopyToCharts=de,this._actions.format=O,this._actions.lockDrawingsAction=q,this._actions.hideAllDrawingsAction=Y,this._actions.hideAllMarks=K,this._actions.paneRemoveAllStudies.callbacks().subscribe(this,r.prototype.removeAllStudies),this._actions.paneRemoveAllDrawingTools.callbacks().subscribe(this,r.prototype.removeAllDrawingTools),this._actions.paneRemoveAllStudiesDrawingTools.callbacks().subscribe(this,r.prototype.removeAllStudiesDrawingTools)}this._actions.paneObjectTree.callbacks().subscribe(this,r.prototype.showSourceProperties),this._actions.chartProperties.callbacks().subscribe(this,r.prototype.showChartProperties),this._actions.insertIndicator.callbacks().subscribe(this,r.prototype.showIndicators),this._actions.scriptEditor&&this._actions.scriptEditor.callbacks().subscribe(this,r.prototype.showScriptEditor),this._actions.compareOrAdd.callbacks().subscribe(this,r.prototype.showCompareOrAdd),this._actions.compare.callbacks().subscribe(this,r.prototype.showCompareOrAdd),this._actions.scalesProperties.callbacks().subscribe(this,r.prototype.showScalesProperties),this._actions.tmzProperties.callbacks().subscribe(this,r.prototype.showTimezoneProperties),this._updateScalesActions()},r.prototype.executeActionByName=function(e){function t(e){for(var t in i._actions){var r=i._actions[t];if(r.text.toLowerCase()===e.toLowerCase())return r}return null}var i=this,r=t(e);return r?void r.callbacks().fire():void TradingView.logWarn("Unknown action: "+e)},r.prototype.executeActionById=function(e){if(e in this._actions){var t=this._actions[e];t.checkable&&t.setChecked(!t.checked),this._actions[e].callbacks().fire(t)}else console.warn("Unknown action id: "+e)},r.prototype._updateScalesActions=function(){if(this._actions){for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].updateScalesVisibility();this._timeAxisWidget.updatePriceScalesVisibility(),this._update(new $21($21.FULL_UPDATE))}},r.prototype.removeAllStudies=function(){this.Z98.removeAllStudies()},r.prototype.removeAllDrawingTools=function(){this.Z98.removeAllDrawingTools()},r.prototype.removeAllStudiesDrawingTools=function(){this.Z98.removeAllStudies(),this.Z98.removeAllDrawingTools()},r.prototype.model=function(){return this.Z98},r.prototype.connect=function(){this._handler=function(e){this._onData(e)}.bind(this),this._chartSession.connect(this._handler)},r.prototype.finishInitWithoutConnect=function(){this._chartSession.disable(),this._init(),this.chartWidgetInitialized.fire()},r.prototype.update=function(){if(this.Z98){for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].update();this._timeAxisWidget.update()}},r.prototype.paint=function(e){e||(e=new $21($21.FULL_UPDATE));for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint(e.invalidateForPane(t),!1);this._timeAxisWidget&&this._timeAxisWidget.paint(e.fullInvalidation()),this._redrawPanes.fire()},r.prototype._makeDefaultGui=function(){this._makeChartWidget(),this._makeLoadingScreen(),this._makeMasterTable(),this._makeTimeAxisWidget(),this._adjustSize(),this._updateScalesActions(),$("*",this._jqMainTable).selectable(!1),this.update(),this.paint()},r.prototype.widget=function(){return this._jqMainDiv},r.prototype.restoreState=function(e,t){this._adjustSize();var i=this.Z98.restoreState(this._content,t);this._setActions(),i.lines_limit_exceeded&&$82.showLineToolsWarning(i.line_tools_count,this,this.Z98)},r.prototype.redrawPanes=function(e){for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint();this._redrawPanes.fire()},r.prototype.adaptOnChartLogo=function(e){Z75.enabled("adapt_onchart_logo_background")&&(e=e||this.Q0.paneProperties.background.value(),$(this._jqMainDiv).find(".onchart-custom-logo .wrapper .inner").css("background-color",TradingView.generateColor(e,50)),$(this._jqMainDiv).find(".onchart-tv-logo .wrapper .inner").css("background-color",TradingView.generateColor(e,20)))},r.prototype.setBackgroundColor=function(e){this.adaptOnChartLogo(e.value()),this.scaleBackgroundColor=e.value();for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].paint(),this._paneWidgets[t].setCursorForTool();this.update(),this.paint()},r.prototype.setScaleLineColor=function(e){this.scaleLineColor=e.value(),$.each(this._paneSeparators,function(){
this.update()}),this.update(),this.paint()},r.prototype.setScaleTextColor=function(e){this.scaleTextColor=e.value(),this.update(),this.paint()},r.prototype._update=function(e){if(this.performance&&e.start(),e&&e.fullInvalidation()!==$21.FULL_UPDATE){if(e.fullInvalidation()===$21.LIGHT_UPDATE){this._timeAxisWidget.update();for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}else if(e.fullInvalidation()===$21.UPDATE_CURSOR_ONLY){for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].statusWidget().update();this._dataWindowWidget&&this._dataWindowWidget.update()}}else{this.Z98?this._updateGui():this._adjustSize(),this._timeAxisWidget.update();for(var t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t]._state=this.Z98.panes()[t],this._paneWidgets[t].statusWidget().updateLayout();this._dataWindowWidget&&this._dataWindowWidget.fullUpdate()}this.paint(e),this.performance&&(e.end(),this.performance.newChartDraw(e))},r.prototype._createVolumeIfNeeded=function(){Z75.enabled("create_volume_indicator_by_default")&&this._options.addVolume&&(!this._content||!this._content.loading&&Z75.enabled("charting_library_base"))&&this.Z98.mainSeries().onSymbolResolved().subscribe(this,function(){var e=this;setTimeout(function(){var t=e.Z98.model().mainSeries().symbolInfo();if(t){var i=!t.has_no_volume;if(!e.containsVolume()&&i){var r=TradingView.factoryDefaults("chartproperties.volumePaneSize");e.insertStudy("Volume@tv-basicstudies",!1,Z75.enabled("volume_force_overlay"),void 0,{paneSize:r})}else if(!i&&e.containsVolume()){var n=e.model().Q17().filter(function(e){return e instanceof f&&"Volume"==e.metaInfo().shortId})[0];e.Z98.model().removeSource(n)}}},0)},!Z75.enabled("charting_library_base"))},r.prototype._createChartEventsSource=function(){if(Z75.enabled("chart_events")&&TradingView.Q16("chart_events")){var e=this.Z98.mainSeries(),t=new C(e);this.Z98.paneForSource(e).insertDataSource(t,null)}},r.prototype._makeDefaultModel=function(){function e(){return s(i._chartSession,function(e){if(!(e instanceof $21))throw Error("Invalid mask");i._invalidateMask?i._invalidateMask.merge(e):i._invalidateMask=e,i._draw_planned||(i._draw_planned=!0,requestAnimationFrame(t))},i.Q0,i.readOnly(),o,i._studiesMetaData,i._studiesMigrations,i)}function t(){i._draw_planned=!1,i._inLoadingState||i._invalidateMask&&(i._invalidateMask=i._update(i._invalidateMask))}var i=this;if(this._content&&this._content.timeScale.points)var n=this._content.timeScale.points.items[0],o={startDate:n};if(!this._studiesMetaData)throw Error("Cannot create chart model: studies metainfo is absent");Z75.enabled("lean_chart_load")?this.Z98=this.Z98||e():this.Z98=e(),this._createVolumeIfNeeded(),this._content?(this.restoreState(this._content,this._containsData),Z75.enabled("chart_content_overrides_by_deafults")&&(this._defSymbol&&this.setSymbol(this._defSymbol),this._defInterval&&this.setResolution(this._defInterval),void 0!==this._defStyle&&this.setSeriesStyle(this.Z98.mainSeries(),this._defStyle))):this._setActions(),this.Z98.onTagsChanged().subscribe(this,r.prototype.onModelTagsChanged),this._updateGui(),this._modelCreated.fire(this.Z98),this._tagsChanged.fire();var i=this,a=this.Z98.mainSeries();this.Z98.lineCancelled().subscribe(this,this.onLineCancelled),a.onSymbolNotPermitted().subscribe(null,function(e){a.properties().symbol.setValue(e)}),this._options.handleSessionErrors&&(a.chartTypeNotPermitted.subscribe(null,function(){TradingView.trackGoProFeature("kagiRenko"),a.properties().interval.setValue("D"),i._options.muteSessionErrors||$82.showGoProDialog({feature:"kagiRenko"})}),a.intradaySpreadNotPermitted.subscribe(null,function(){a.properties().interval.setValue("D"),i._options.muteSessionErrors||$82.showGoProDialog({feature:"intradaySpread"})}),a.customIntervalNotPermitted.subscribe(null,function(){a.properties().interval.setValue("D"),i._options.muteSessionErrors||$82.showGoProDialog({feature:"customIntervals"})}),a.intradayExchangeNotPermitted.subscribe(null,function(){if(a.properties().interval.setValue("D"),!i._options.muteSessionErrors){var e=a.symbolInfo().listed_exchange;TradingView.TVChartApi.prototype.supportedExchangesList().forEach(function(t){t.value==e&&(e=t.name)}),$82.showGoProDialog({feature:"intradayExchange",exchangesButton:window.user.is_pro&&"pro_realtime_trial"!=window.user.pro_plan,exchange:e})}}),a.requestingIntradayWhenNotSupported.subscribe(null,function(){a.properties().interval.setValue("D"),i._options.muteSessionErrors||$82.showIntervalMismatchDialog()}),a.requestingResolutionWhenNotSupported.subscribe(null,function(e){a.properties().interval.setValue(e)}),i._options.muteSessionErrors||a.onExtendedHoursNotPermitted().subscribe(null,function(){TradingView.trackGoProFeature("extendedHours"),$82.showGoProDialog({feature:"extendedHours"})})),this._readOnly||!TradingView.Q16("paper_trading")&&!Z75.enabled("cqg_terminal")||this._onWidget||P.registerChartWidget(this)},r.prototype._updateGui=function(){this.Z98&&(this._makePaneWidgetsAndSeparators(),this._makeTimeAxisWidget(),$("*",this._jqMainTable).selectable(!1),this._adjustSize())},r.prototype.setVisibleTimeRange=function(e,t,i){this._chartSession.setVisibleTimeRange(e,t,i)},r.prototype._dateRangeResolutions=function(){var e=Q14.availableTimeFrames(this.Z98.mainSeries().symbolInfo(),this.Z98.mainSeries().status());return e||[]},r.prototype._makeChartWidget=function(){this._jqMainDiv=$(document.createElement("div")),this._jqMainDiv.addClass("chart-widget"),TradingView.setAbsoluteRect(this._jqMainDiv,this._rect);var e=this._withDateRanges&&(Z75.enabled("lean_chart_load")?!this._chartControlsBar:!0);e&&(this._chartControlsBar=$(document.createElement("div")).attr("class","chart-controls-bar").appendTo(this._jqParent),this._seriesControlWidget=new TradingView.SeriesControlWidget({parent:this._chartControlsBar,Q1:this})),(this._options.controlBar||Z75.enabled("control_bar"))&&(this._controlBarNavigation=new $9(this,this._jqMainDiv,!0)),this._containsData||this.createIndicatorImage()},r.prototype._makeLoadingScreen=function(){if(Z75.enabled("lean_chart_load")){if(this.screen)return;this.screen=new r.LoadingScreen(this,this._jqParent)}else this.screen=new r.LoadingScreen(this,this._jqMainDiv)},r.prototype.setSymbol=function(e,t){if(this.Z98){var i=this.Z98.mainSeries();if(!t&&i.symbolSameAsCurrent(e)&&!Z75.enabled("same_data_requery"))return;this.Z98.setSelectedSource(null),this.Z98.setScreenChartProperty(i.properties().symbol,e,this,"Change Symbol",Z75.enabled("same_data_requery"))}else this.Q0.mainSeriesProperties.merge({symbol:e})},r.prototype.getSymbol=function(e){var t;return t=this.Z98?this.Z98.mainSeries().properties():this.Q0.mainSeriesProperties,t?e&&t.shortName&&t.shortName.value()?t.shortName.value():t.symbol.value():""},r.LoadingScreen=function(e,t){this._cw=e,this.$element=$('<div class="chart-loading-screen">'),this.$shield=$('<div class="chart-loading-screen-shield">').appendTo(this.$element),this.$element.appendTo(t),this._showed=!1,this._cw.withModel(this,this._connectToModel)},r.LoadingScreen.prototype._connectToModel=function(){this._cw.model().mainSeries().onDataLoaded().subscribe(this,function(e){switch(e.method){case"symbol_error":"permission denied"!==e.params[1]&&this.hide();break;case"series_error":Z75.enabled("hide_loading_screen_on_series_error")&&this.hide();break;case"series_completed":this.hide()}})},r.LoadingScreen.prototype.show=function(){return this._cw._inLoadingState=!0,this._showed||this._cw.isDetached||(this._showed=!0,this._show()),$.Deferred().resolve()},r.LoadingScreen.prototype._show=function(){var e=this._cw.properties().paneProperties.background.value();this.$shield.css("background",e),this.$element.addClass("fade")},r.LoadingScreen.prototype.hide=function(){delete this._cw._inLoadingState,this._showed&&this._hide()},r.LoadingScreen.prototype._hide=function(){this._showed=!1,this.$element.removeClass("fade")},r.LoadingScreen.prototype.$canvas=null,r.LoadingScreen.prototype.context=null,r.prototype._makeMasterTable=function(){this._jqMainTable=$(document.createElement("table")),this._jqMainTable.appendTo(this._jqMainDiv),this._jqMainTable.addClass("chart-markup-table"),this._jqMainTable.attr("cellpading","0"),this._jqMainTable.attr("cellspacing","0")},r.prototype.unsetActivePaneWidget=function(){this.activePaneWidget=!1},r.prototype.setActivePaneWidget=function(e){this.activePaneWidget=e},r.prototype.isMaximizedPane=function(){return!!this._maximizedPaneWidget},r.prototype.toggleMaximizePane=function(e){if(!(this._paneWidgets.length<2)){this._maximizedPaneWidget?(this._maximizedPaneWidget=null,this._paneSeparators.forEach(function(e){e.show()})):(this._maximizedPaneWidget=e,this._paneSeparators.forEach(function(e){e.hide()}));for(var t=this._paneWidgets.length;t--;)this._paneWidgets[t].updateControls();this._adjustSize(),this.updateIndicatorImagePosition()}},r.prototype._makePaneWidgetsAndSeparators=function(){for(var e=this.Z98.panes(),t=e.length,i=this._paneWidgets.length,r=t;i>r;r++){var n=this._paneWidgets.pop();n.jqRow.remove(),n.jqRow.find("*").remove(),n.destroy();var a=this._paneSeparators.pop();a&&a.jqRow.remove()}for(var r=i;t>r;r++){var n=new o(this,e[r],this._onWidget);if(n.onMouseLeave=this.unsetActivePaneWidget.bind(this),n.onMouseEnter=this.setActivePaneWidget.bind(this),this._paneWidgets.push(n),r>0){var a=new $51(this,r-1,r);this._paneSeparators.push(a),this._timeAxisWidget?a.jqRow.insertBefore(this._timeAxisWidget.jqRow):a.jqRow.appendTo(this._jqMainTable)}this._timeAxisWidget?n.jqRow.insertBefore(this._timeAxisWidget.jqRow):n.jqRow.appendTo(this._jqMainTable)}for(var r=0;t>r;r++){var s=e[r],n=this._paneWidgets[r];n.state()!==s&&n.setState(s)}for(var r=t;r--;)this._paneWidgets[r].updateControls()},r.prototype._makeTimeAxisWidget=function(){this._timeAxisWidget||(this._timeAxisWidget=new h(this,this._onWidget),this._timeAxisWidget.jqRow.appendTo(this._jqMainTable))},r.prototype.insertStudyOrShowDialog=function(e){if(this.isSymbolicStudy(e)){var t=defaults("study_"+e.id).description;$82.showAddSymbolDialog(this,{title:t,okButtonTitle:$.t("Apply"),callback:function(t,i){var r={inputs:{symbol:t}};this.model().insertStudy(e,r,i)}.bind(this)})}else if(this.hasConfirmInputs(e)){var t=defaults("study_"+e.id).description;i(186),$82.showConfirmInputsDialog(this,e,{title:t,okButtonTitle:$.t("Apply"),callback:function(t){this.model().insertStudy(e,t,!1)}.bind(this)})}else if(f.isPointsBasedStudy(e.id)){var r=f.lineToolNameForPointsBasedStudy(e.id);TradingView.drawingState.tool.setValue(r)}else{var n="Volume@tv-basicstudies"==e.id;this.insertStudy(e.id,!0,n)}},r.prototype.hasConfirmInputs=function(e){var t=e.inputs;if(void 0===t)return!1;for(var i=0;i<t.length;++i){var r=t[i];if(void 0!==r.confirm&&r.confirm)return!0}return!1},r.prototype.isSymbolicStudy=function(e){switch(e.id){case"Overlay@tv-basicstudies":case"CorrelationCoefficient@tv-basicstudies":return!0;default:return!1}},r.prototype.isPointsBasedStudy=function(e){return f.isPointsBasedStudy(e.id)},r.prototype.insertStudy=function(e,t,i,r,n){var o=TradingView.StudyMetaInfo.findStudyMetaInfo(this._studiesMetaData,e);assert(!o.isTVScriptStubToCompile,"MetaInfo stub is unexpected here!");var a=r?{inputs:r}:{};n&&(a=$.extend(a,n)),t?this.Z98.insertStudy(o,a,i):this.Z98.model().insertStudy(o,a,i)},r.prototype.insertStudyStub=function(e){return this.model().insertStudyStub(e)},r.prototype.removeStudyStub=function(e){return this.model().removeStudyStub(e)},r.prototype._adjustSize=function(){var e=this,t=0,i=0,r=0;$.each(this._paneWidgets,function(){e._maximizedPaneWidget&&e._maximizedPaneWidget!==this||(t=Math.max(this.lhsPriceAxisWidget.optimalWidth(),t),i=Math.max(this.rhsPriceAxisWidget.optimalWidth(),i),r+=this.stretchFactor())});var n=this._rect,o=n.w-t-i,a=(this._paneWidgets.length,this._paneSeparators.length),s=$51.HEIGHT,l=this._timeAxisWidget.optimalHeight(),h=n.h-s*a-l,p=h/r;this._jqMainTable.width(n.w),this._jqMainTable.height(n.h),$.each(this._paneWidgets,function(r){e.Z98&&(this._state=e.Z98.panes()[r]);var n=e._maximizedPaneWidget?e._maximizedPaneWidget===this?h:0:Math.max(Math.round(this.stretchFactor()*p),2);this.setPriceAxisSize(d.LHS,new $60(t,n)),this.setPriceAxisSize(d.RHS,new $60(i,n)),this.setSize(new $60(o,n)),e.Z98&&this.state()&&e.Z98.setPaneHeight(this.state(),n)}),this._timeAxisWidget.setSize(new $60(o,l),new $60(t,l),new $60(i,l)),this.Z98&&this.Z98.setWidth(o),this.maxLhsPriceAxisWidth!==t&&(this.maxLhsPriceAxisWidth=t,this.lhsPriceAxisWidthChanged.fire(t)),this.maxRhsPriceAxisWidth!==i&&(this.maxRhsPriceAxisWidth=i,this.rhsPriceAxisWidthChanged.fire(i))},r.prototype._onData=function(e){switch(e.method){case"connected":this._onConnection();break;case"disconnected":this._onDisconnect();break;case"reconnect_bailout":this._reconnectBailout.fire();break;case"connection_error":this._onConnectionError(e.params[0]);break;case"critical_error":this._disconnected.fire(!0);break;default:this.Z98.onData(e)}},r.prototype._nextMetadataId=1,r.prototype._onConnection=function(){this._online=!0,this.Z98?(this.Z98.restart(),this._updateGui(),this.update(),this.paint(),this._connected.fire()):(Z75.enabled("charting_library_base")?this._chartSession.requestMetadata("metadata_"+r._nextMetadataId,function(e){for(var t=e.params[1],i=0;i<t.length;++i)TradingView.StudyMetaInfo.addStudyMetaInfo(this._studiesMetaData,n(t[i]));this._init(),this.chartWidgetInitialized.fire()}.bind(this)):(this._chartSession.requestMetadata("metadata_"+r._nextMetadataId,function(e){this._onStudiesMetadata(e)}.bind(this)),void 0!==window.scriptLib&&(this._tvScriptsRequestDfd=window.scriptLib.requestBuiltinAndUserScripts())),r._nextMetadataId++)},r.prototype._onDisconnect=function(){this.Z98&&this.Z98.disconnect(),this._online=!1,this.update(),this.paint(),this._disconnected.fire()},r.prototype.studiesMetaData=function(){return this.Z98.studiesMetaData()},r.prototype._onConnectionError=function(e){this._disconnected.fire()},r.prototype.getTimeScale=function(){return this._timeAxisWidget},r.prototype.setSeriesStyle=function(e,t){this.Z98.setProperty(e.properties().style,t)},r.prototype.showSourceProperties=function(e){new S({Q1:this},this.Z98).show()},r.prototype.showChartProperties=function(e){return e&&e.text==$.t("Properties...")&&TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Style")),new l(this.Z98.mainSeries(),this.Z98).show()},r.prototype.showScriptEditor=function(){TradingView.ScriptEditorWidget.open()},r.prototype.showCompareOrAdd=function(){var e=new TradingView.CompareDialog(this.Q3);e.show()},r.prototype.showIndicators=function(){window.studyMarket.isVisible()?window.studyMarket.hide():window.studyMarket.show()},r.prototype.showScalesProperties=function(e){var t={selectScales:!0};return new l(this.Z98.mainSeries(),this.Z98).show(t)},r.prototype.showTimezoneProperties=function(){return new l(this.Z98.mainSeries(),this.Z98).show({selectTmz:!0})},r.prototype.removeSelectedSource=function(){var e=this,t=e.Z98.selectedSource();!t||t===e.Z98.mainSeries()||t===e.Z98.lineBeingCreated()||t instanceof c||t instanceof m||(t.hasAlert.value()&&t.isUserDeletable()?$82.showConfirm($.t("Drawing Alert"),$.t("This drawing is used in alert. If you remove the drawing, the alert will be also removed. Do you want to remove the drawing anyway?"),e.Z98.removeSelectedSource.bind(e.Z98)):e.Z98.removeSelectedSource())},r.prototype.unlinkSelectedLine=function(){var e=this.Z98.selectedSource();e instanceof g&&this.Z98.unlinkLine(e)},r.prototype.copyLineToOtherCharts=function(){var e=this.Z98.selectedSource();e instanceof g&&this.Z98.copyToOtherCharts(e)},r.prototype.hideSelectedObject=function(){var e=this.Z98.selectedSource();e&&this.Z98.setProperty(e.properties().visible,!1,"Hide "+e.title())},r.prototype.toggleLockSelectedObject=function(){var e=this.Z98.selectedSource();if(e){var t=e.properties().frozen.value();this.Z98.setProperty(e.properties().frozen,!t,(t?$.t("Unlock"):$.t("Lock"))+" "+e.title())}},r.prototype.editSelectedObject=function(e){var t=this.Z98.selectedSource();return t?new l(t,this.Z98).show():void 0},r.prototype.openSelectedObjectSource=function(e){var t=this.Z98.selectedSource();if(t&&t.metaInfo){var i=t.metaInfo();i&&i.TVScriptSourceCode&&i.scriptIdPart&&TradingView.ScriptEditorWidget&&TradingView.ScriptEditorWidget.open({scriptSource:i.TVScriptSourceCode,scriptIdPart:i.scriptIdPart})}},r.prototype.resetPriceAxisOptimalWidth=function(e){$.each(this._paneWidgets,function(){this.resetPriceAxisOptimalWidth(e)}),this._redrawPanes.fire()},r.prototype.adjustPriceAxisWidth=function(e){this.resetPriceAxisOptimalWidth(e),this._adjustSize()},r.prototype.setPriceAxisVisible=function(e,t){$.each(this._paneWidgets,function(){this.setPriceAxisVisible(e,t)}),this._timeAxisWidget.setStubVisible(e,t),this._adjustSize(),this._redrawPanes.fire()},r.prototype.setTimeAxisVisible=function(e){this._timeAxisWidget.setVisible(e),this._adjustSize()},r.prototype.isTextTool=function(e){switch(e){case"LineToolBalloon":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":return!0}return!1},r.prototype.tags=function(){return this.Z98?this.Z98.calculateDefaultTags():[]},r.prototype.state=function(e,t){var i=this.Z98.state(e,t);return i},r.prototype.asyncState=function(e){return this.Z98.asyncState(e)},r.prototype.metaInfo=function(){var e=this._metaInfo;return this.Z98&&(e.systemTags=this.Z98.calculateDefaultTags()),e},r.prototype.image=function(){for(var e,t=document.createElement("canvas"),i=t.getContext("2d"),r=0,n=this._timeAxisWidget.size.h,o=this.properties().scalesProperties.lineColor.value(),a=0;a<this._paneWidgets.length;a++)e=this._paneWidgets[a],e&&e.state()&&(e.state().recalculate(!0),0===a&&(r=e.lhsPriceAxisWidget.size.w+e.size.w+e.rhsPriceAxisWidget.size.w),n+=e.size.h);n+=this._paneWidgets.length-1,this._update();var s=25,l=5;t.width=r+2*l,t.height=n+s+2*l,i.fillStyle="#F2F5F8",i.fillRect(0,0,t.width,t.height);var d=s+l,h=l,p=this.mainSeriesQuotesAndMetainfo();if(p.ohlc){var c="{0} O:{1} H:{2} L:{3} C:{4}".format(p.meta.symbol,p.ohlc[0],p.ohlc[1],p.ohlc[2],p.ohlc[3]);i.fillStyle="#000",i.font="12px Verdana, Arial",i.fillText(c,h,l+15)}for(var a=0;a<this._paneWidgets.length;a++)e=this._paneWidgets[a],i.drawImage(e.lhsPriceAxisWidget.canvas,h,d),i.drawImage(e.canvas,h+e.lhsPriceAxisWidget.size.w,d),e.statusWidget().renderTo(i,h+5,d+5),i.drawImage(e.rhsPriceAxisWidget.canvas,h+e.lhsPriceAxisWidget.size.w+e.size.w,d),d+=e.size.h,a<this._paneWidgets.length-1&&(i.fillStyle=o,i.fillRect(h,d,r,1),d++);return i.drawImage(this._timeAxisWidget.lhsCanvas,h,d),i.drawImage(this._timeAxisWidget.canvas,h+e.lhsPriceAxisWidget.size.w,d),i.drawImage(this._timeAxisWidget.rhsCanvas,h+e.lhsPriceAxisWidget.size.w+e.size.w,d),i.lineWidth=1,i.strokeStyle="#000",i.strokeRect(l+.5,s+l+.5,r-1,n-1),t},r.prototype.images=function(){TradingView.printing=!0;var e=this.Z98.selectedSource();this.Z98.setSelectedSource(null);for(var t=[],i=0;i<this._paneWidgets.length;i++){var r=this._paneWidgets[i];r.paint($21.LIGHT_UPDATE,this._onWidget);var n=r.image(this._onWidget);n.containsMainSeries=this._paneWidgets[i].containsMainSeries(),n.studies=[];for(var o=r.state().Q17(),a=0;a<o.length;a++){var s=o[a];s instanceof f?s.properties().visible.value()&&s.statusView()&&this.properties().paneProperties.legendProperties.showStudyTitles.value()&&this.properties().paneProperties.legendProperties.showLegend.value()&&n.studies.push(s.statusView().text()):s instanceof TradingView.Series&&this.properties().paneProperties.legendProperties.showLegend.value()&&this.properties().paneProperties.legendProperties.showSeriesTitle.value()&&(n.mainSeriesText=s.statusView().text())}t.push(n),i<this._paneWidgets.length-1&&t.push(this._paneSeparators[i].image())}this._timeAxisWidget.paint($21.LIGHT_UPDATE);var l=this._timeAxisWidget.image();TradingView.printing=!1,this.Z98.setSelectedSource(e),this.Z98.Q18(new $21($21.LIGHT_UPDATE));var d=this.mainSeriesQuotesAndMetainfo();return{panes:t,timeAxis:l,colors:{text:this.properties().scalesProperties.textColor.value(),bg:this.properties().paneProperties.background.value(),scales:this.properties().scalesProperties.lineColor.value()},meta:d.meta,ohlc:d.ohlc,quotes:d.quotes}},r.prototype.mainSeriesQuotesAndMetainfo=function(){var e,t,i,r=this.Z98.mainSeries();if(r){var n=function(e){return null==e?"":r.formatter().format(e)+""},o=function(e){return null==e?"":e+""};e={resolution:r.interval(),symbol:r.symbol()};var a=r.symbolInfo();a&&(e.symbol=a.full_name,e.description=a.description,e.exchange=a.exchange);var s=r.bars().last();s&&(t=s.value.slice(1,5).map(n)),r.quoteData&&(i={change:n(r.quoteData.change),changePercent:o(r.quoteData.change_percent),last:n(r.quoteData.last_price)})}return{meta:e,ohlc:t,quotes:i}},r.prototype.onTagsChanged=function(){return this._tagsChanged},r.prototype.onModelTagsChanged=function(){this._tagsChanged.fire()},r.prototype.destroy=function(){$(window).unbind("resize",this._resizeHandler),this.Z98.model().destroy(),this.performance&&this.performance.destroy(),this._chartSession.stopSession()},r.prototype.title=function(){return $.t("Chart Properties")},r.prototype.symbolProperty=function(){return this.Z98.mainSeries().properties().shortName?this.Z98.mainSeries().properties().shortName:this.Z98.mainSeries().properties().symbol},r.prototype.loadContent=function(e,t){this.screen.show();var i=this;this.isMaximizedPane()&&this.toggleMaximizePane();for(var r=i.Z98.model().Q17(),n=0;n<r.length;n++){var o=r[n];o!=i.Z98.mainSeries()&&i.Z98.model().removeSource(o,!0)}i._jqMainDiv&&(i._jqMainDiv.remove(),i._jqMainDiv=null),i._timeAxisWidget=null,i._paneWidgets=[],i.activePaneWidget=!1,i.Z98.mainSeries().purgeSymbolInfo(),TradingView.Trading&&TradingView.Trading.Broker&&TradingView.Trading.Broker.unregisterChartWidget(this),e.loading=!0,i._setContent(e);for(var s,n=0;n<e.panes.length;++n)for(var l=0;l<e.panes[n].sources.length;++l)if(e.panes[n].sources[l].state.symbol){s=e.panes[n].sources[l].state;break}if(!s)throw"An error occured while determining main series ion the chart";i.Q0.mainSeriesProperties.merge({visible:!0,symbol:s.symbol,timeframe:"",onWidget:i._onWidget,interval:s.interval||"D",style:s.style}),i._init(),$44.interval.setValue(s.interval),a.UndoHistory.clearStack(),i.updateSeriesControlUI(),i.createLogo&&!Z75.enabled("move_logo_to_main_pane")&&i.createLogo(void 0,this._jqMainDiv)},r.prototype._setContent=function(e){e&&e.panes.forEach(function(e){e.sources=e.sources.filter(function(e){return e?"MainSeries"==e.type?!0:e.points&&e.points.some(function(e){return null===e.time_t||!isFinite(e.time_t)})?(TradingView.logNormalChart("Dropped invalid "+e.type+". Reason: non-numeric point time"),!1):!0:!1});var t=function(t){return e.sources&&e.sources.some(function(e){return e.id==t})};e.leftAxisSources&&(e.leftAxisSources=e.leftAxisSources.filter(t)),e.rightAxisSources&&(e.rightAxisSources=e.rightAxisSources.filter(t))}),this._content=e},r.prototype._contentSeriesProperties=function(){if(this._content)for(var e=this._content.panes.length;e-- >0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state},r.prototype.updateSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.updateUI()},r.prototype.tickSeriesControlClock=function(){this._seriesControlWidget&&this._seriesControlWidget.tickClock()},r.prototype.resizeSeriesControlUI=function(){this._seriesControlWidget&&this._seriesControlWidget.resizeUI()},r.prototype.updateUndoRedo=function(){a.UndoHistory.undoStack().isEmpty()?this.actions().undo.setEnabled(!1):this.actions().undo.setEnabled(!0),a.UndoHistory.redoStack().isEmpty()?this.actions().redo.setEnabled(!1):this.actions().redo.setEnabled(!0)},r.prototype.createSessionBreaksActions=function(e){var t,r=i(179).ActionBinder,n=this,o=function(){t=new TradingView.Action({text:$.t("Session Breaks"),checkable:!0}),t.binder=new r(t,n.model().mainSeries().sessionsStudy().properties().graphics.vertlines.sessBreaks.visible,n.model(),"Session Breaks"),n._actions.sessionBreaks=t};n.model().mainSeries().sessionsStudy()?o():n.model().mainSeries().onSessionsStudyCreated().subscribe(n,function(){o()})},r.prototype.updateActionForIntradayOnly=function(e){!e||!e instanceof TradingView.Action||e.setEnabled(!!this.model().mainSeries().isIntradayInterval())},r.prototype.withModel=function(e,t){this.model()?t.call(e):this.modelCreated().subscribe(e,t,!0)},r.prototype.containsVolume=function(){return this.model().Q17().some(function(e){return e instanceof f&&"Volume"==e.metaInfo().shortId})},r.prototype.containsStudy=function(e){return this.Z98?this.Z98.Q17().some(function(t){if(!(t instanceof f))return!1;var i=t.metaInfo();return i.id===e||i.fullId===e}):!1},r.prototype.containsSessions=function(){return this.model().Q17().some(function(e){return e instanceof f&&"Sessions"==e.metaInfo().shortId})},r.prototype.isSmall=function(e){return this.constructor.isSmall(this._jqParent)},r.isSmall=function(e){return e.width()<550||e.height()<300},r.prototype.onWidget=function(){return this._onWidget},r.prototype.onCmeWidget=function(){return"cme"===this.widgetCustomer()},r.prototype.widgetCustomer=function(){return this._widgetCustomer},r.prototype.resize=function(){this._resizeHandler&&this._jqMainDiv&&this._resizeHandler()},r.prototype.chartSession=function(){return this._chartSession},r.prototype.maxLhsPriceAxisWidth=0,r.prototype.maxRhsPriceAxisWidth=0,r.prototype.GUIResetScales=function(){TradingView.trackEvent("GUI","Reset Scales"),this.model()&&(this._containsData&&this.model().chartModel().restoreAxisState(this._content),this.model().resetScales())},r.prototype.onLineCancelled=function(){TradingView.drawingState.resetToCursor()},r.prototype.createIndicatorImage=function(){var e=this;this.indicatorImage=$('<span class="chart-status-picture"></span>').appendTo(this._jqMainDiv),Z75.enabled("display_market_status")&&(this.indicatorText=$('<span class="series-status-text"><span class="dot apply-common-tooltip"></span><span class="text"></span><span class="market-status"></span></span>').appendTo(this.indicatorImage),this.indicatorDot=this.indicatorText.find(".dot")),e.withModel(null,function(){var t=e.Z98.mainSeries();t.onStatusChanged().subscribe(null,e.updateIndicatorImage.bind(e)),t.marketStatus.subscribe(e.updateIndicatorImage.bind(e)),e.updateIndicatorImage(),e.checkCompactMode(),e.Z98.onRearrangePanes().subscribe(null,function(){e.resetIndicatorSize(),e.resizeIndicator()})}),e.rhsPriceAxisWidthChanged.subscribe(e,e.updateIndicatorImagePosition),e.updateIndicatorImagePosition()},r.prototype.updateIndicatorImage=function(){function e(e,t){return a.hasOwnProperty(e)?a[e]:t}var t=this.indicatorImage;if(this.indicatorImage){var i=this.Z98;if(i){var r=i.mainSeries(),n=r.status(),o=this._statusDetails(),a=null;a=o.hasOwnProperty(n)?o[n]:o.defaults,t.attr("title",e("title","")),this._updateDataAndMarketStatus(r.marketStatus.value(),r.status())}}},r.prototype.checkCompactMode=function(){this._jqMainDiv&&this._jqMainDiv.toggleClass("i-compact",this._jqMainDiv.width()<=400),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth())},r.prototype._statusDetails=function(){return this.__statusDetails||(this.__statusDetails={},this.__statusDetails[TradingView.Series.STATUS_SNAPSHOT]={className:"snapshot",text:"",showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_LOADING]=this.__statusDetails[TradingView.Series.STATUS_RESOLVING]={className:"loading",text:$.t("loading data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_INVALID_SYMBOL]={className:"invalid",text:$.t("invalid symbol"),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_NO_BARS]={className:"invalid",text:$.t("no bars"),showBatsWarn:!1,priority:1},this.__statusDetails[TradingView.Series.STATUS_OFFLINE]={className:"connecting",text:$.t("retrying"),priority:1},this.__statusDetails[TradingView.Series.STATUS_EOD]=this.__statusDetails[TradingView.Series.STATUS_PULSE]={className:"eod",text:$.t("eod data"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED]={className:"delayed",title:$.t("Quotes are delayed by 10 min and updated every 30 seconds"),text:$.t("eod delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_DELAYED_STREAMING]={className:"delayed-streaming",text:$.t("delayed"),priority:1},this.__statusDetails[TradingView.Series.STATUS_READY]=this.__statusDetails.defaults={className:"realtime",text:$.t("realtime"),priority:-1},this.__statusDetails.pre_market={text:$.t("pre-market"),className:"pre-market",priority:0},this.__statusDetails.post_market={text:$.t("post-market"),className:"post-market",priority:0},this.__statusDetails.out_of_session={text:$.t("closed"),className:"out-of-session",priority:0},this.__statusDetails.market=this.__statusDetails.defaults),this.__statusDetails},r.prototype._updateDataAndMarketStatus=function(e,t){if(void 0!==this.indicatorText){var i=this._resultingStatusRecord(e,t);this.indicatorText.removeClass().addClass("series-status-text "+i.className).find(".text").html(i.text),this.indicatorDot.attr("title",i.text),this.indicatorImage&&(this._indicatorWidth=this.indicatorImage.outerWidth()),this.resizeIndicator()}},r.prototype.resetIndicatorSize=function(){if(this._paneWidgets[0]&&this._paneWidgets[0].legendWidget)for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].legendWidget.firstTitle().css("padding-right","")},r.prototype.resizeIndicator=function(){this._paneWidgets[0]&&this._paneWidgets[0].legendWidget&&this._indicatorWidth&&this._paneWidgets[0].legendWidget.firstTitle().css("padding-right",this._indicatorWidth+10)},r.prototype._resultingStatusRecord=function(e,t){if(e){var i=this._statusDetails()[e],r=this._statusDetails()[t];return r||(r=this._statusDetails().defaults),r.priority>i.priority?r:i}return this._statusDetails()[t]},r.prototype.updateIndicatorImagePosition=function(){var e=this.indicatorImage;this.indicatorImage&&e.css("marginRight",this.maxRhsPriceAxisWidth)},r.prototype._startSpinner=function(e){if("function"==typeof Spinner&&!this._spinner){var t=$(e).get(0);t&&(this._spinner=TradingView.unifiedSpinner("",{zIndex:"auto"}).spin(t))}},r.prototype.isJustClonedChart=function(){return!!(this._options||{}).justCloned},r.prototype.getLastPaneLeftBottom=function(){var e=this._paneWidgets[this._paneWidgets.length-1].jqPane,t=e.offset();return{left:t.left,bottom:$(document.body).height()-t.top-e.height()}},r.prototype.setDataWindowWidget=function(e){this._dataWindowWidget=e},r.prototype.removeDataWindowWidget=function(){this._dataWindowWidget=null},Z75.enabled("datasource_copypaste")&&(r.prototype.onAppClipboardPaste=function(e,t){TradingView.logDebugChart("[[paste]]"),this.Z98&&this.Z98.pasteSourceFromClip(e,t);
},r.prototype.onAppClipboardCopy=function(e){TradingView.logDebugChart("[[copy]]"),this.Z98&&this.Z98.copySourceToClip(e||this.Z98.selectedSource())},r.prototype.onAppClipboardCut=function(e){TradingView.logDebugChart("[[cut]]"),this.Z98&&this.Z98.cutSourceToClip(e||this.Z98.selectedSource())}),r.prototype.applyOverrides=function(e){applyPropertiesOverrides(this.properties(),null,!1,e),this.Z98&&(applyPropertiesOverrides(this.Z98.model().properties(),null,!1,e),applyPropertiesOverrides(this.Z98.mainSeries().properties(),null,!1,e,"mainSeriesProperties"))},r.prototype.setActive=function(e){var t=this.actions();for(var i in t)t.hasOwnProperty(i)&&this.actions()[i].setActive(e)},r.Performance=function(e){this.chartDrawTypes=["cursor","light","full","light_partial"],this.chartDraw={},this.lastValues={},this.cma={},this.slowReports=[],this.Q1=e,this.chartDrawTypes.forEach(function(e){this.chartDraw[e]=this.emptyStatObj(),this.lastValues[e]=[]}.bind(this)),this.initialTimeout=setTimeout(function(){this.checkpointInterval=setInterval(this.performanceCheckPoint.bind(this),1e3)}.bind(this),3e3),this.cmaFilterHigh=60,this.cmaFilterLow=15,this.thresholdEmissionsRatio=3,this.maxDroppedEmissions=1},r.Performance.prototype.emptyStatObj=function(){return{totalDuration:0,totalWait:0,count:0,invalidations:0}},r.Performance.prototype.performanceCheckPoint=function(){for(var e=0;e<this.chartDrawTypes.length;e++){var t=this.chartDrawTypes[e],i=$.extend({avgDuration:this.chartDraw[t].count?this.chartDraw[t].totalDuration/this.chartDraw[t].count:0,avgWait:this.chartDraw[t].count?this.chartDraw[t].totalWait/this.chartDraw[t].count:0},this.chartDraw[t]);this.lastValues[t].unshift(i),this.lastValues[t]=this.lastValues[t].slice(0,10),i.count>0&&(this.cma[t]?i.avgDuration>this.cma[t].durationHigh*this.thresholdEmissionsRatio&&this.cma[t].droppedEmissions<this.maxDroppedEmissions?this.cma[t].droppedEmissions++:(this.cma[t].droppedEmissions=0,this.cma[t].durationHigh+=(i.avgDuration-this.cma[t].durationHigh)/this.cmaFilterHigh,this.cma[t].durationLow+=(i.avgDuration-this.cma[t].durationLow)/this.cmaFilterLow,this.cma[t].waitHigh+=(i.avgWait-this.cma[t].waitHigh)/this.cmaFilterHigh,this.cma[t].waitLow+=(i.avgWait-this.cma[t].waitLow)/this.cmaFilterLow,this.checkPerformance(t,this.cma[t],this.lastValues[t])):this.cma[t]={durationHigh:i.avgDuration,durationLow:i.avgDuration,waitHigh:i.avgWait,waitLow:i.avgWait}),this.chartDraw[t]=this.emptyStatObj()}this.flushReport(),this.draw()},r.Performance.prototype.checkPerformance=function(e,t,i){t.durationLow-t.durationHigh>Math.max(20,t.durationHigh)&&(t.slowdownDurationDetected||(this.slowReports.push({type:e,param:"duration",cma:t,cmaDifference:t.durationLow-t.durationHigh,values:i}),t.slowdownDurationDetected=!0))},r.Performance.prototype.flushReport=function(){if(this.slowReports.length){var e=this.Q1.model().undoStack().m_commands;e=e.slice(e.length-20,e.length).reduce(function(e,t){return e+t.text()+"\n"},""),TradingView.logWarn({slowReports:this.slowReports,history:e}),$71.sendReport("slow_page",{slowReports:this.slowReports,history:e},!0,!0),this.slowReports=[]}},r.Performance.prototype.newChartDraw=function(e){var t=e._invalidationLevel,i=this.textLvl(t);for(var r in e._invalidatedPanes)e._invalidatedPanes[r]>t&&(t=e._invalidatedPanes[r],i=this.textLvl(t)+"_partial");this.addStats(i,e._timeCreated,e._timeStart,e._timeEnd,e._documentHidden,e._mergeCount)},r.Performance.prototype.addStats=function(e,t,i,r,n,o){if(!n){var a=this.chartDraw[e];a.totalDuration+=r-i,a.totalWait+=i-t,a.invalidations+=1+o,a.count++}},r.Performance.prototype.draw=function(){if(TradingView.getDisplayFpsLevel()==TradingView.FPS_SHOw_FULL){if(this.fpsCanvas)this.fpsCanvas.width=360;else{if(!this.Q1._jqMainTable)return!1;this.fpsCanvas=TradingView.addCanvasTo(this.Q1._jqMainTable.parent(),new $60(360,80)),this.ctx=this.fpsCanvas.getContext("2d"),$(this.fpsCanvas).css({position:"absolute",bottom:"23px",right:"65px"})}var e=this.ctx;e.font='10px "Lucida Console", monospace';for(var t=["cursor","light","light_partial","full"],i=0,r=0;r<t.length;r++){var n=t[r],o=this.lastValues[n][0];e.fillText(n,90*i,15),e.fillText("fps "+o.count,90*i,30),e.fillText("inv "+o.invalidations,90*i,40),e.fillText("afd "+o.avgDuration.toFixed(2),90*i,50),e.fillText("afw "+o.avgWait.toFixed(2),90*i,60),this.cma[n]&&(e.fillText("dda "+(this.cma[n].durationLow-this.cma[n].durationHigh).toFixed(0)+" "+this.cma[n].durationLow.toFixed(0)+"/"+this.cma[n].durationHigh.toFixed(0),90*i,70),e.fillText("wda "+(this.cma[n].waitLow-this.cma[n].waitHigh).toFixed(0)+" "+this.cma[n].waitLow.toFixed(0)+"/"+this.cma[n].waitHigh.toFixed(0),90*i,80)),i++}}else this.fpsCanvas&&($(this.fpsCanvas).remove(),delete this.fpsCanvas,delete this.ctx)},r.Performance.prototype.textLvl=function(e){switch(e){case 1:return"cursor";case 2:return"light";case 3:return"full"}},r.Performance.prototype.destroy=function(){clearTimeout(this.initialTimeout),clearInterval(this.checkpointInterval)},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){this._chart=e,this.dialog=e.dialog,this._state=t,this._disableContextMenu=!!i,this.lhsPriceAxisWidget=new l(this,l.LHS),this.rhsPriceAxisWidget=new l(this,l.RHS),this.jqPane=$(document.createElement("td")),this.jqPane.addClass("chart-markup-table"),this.jqPane.addClass("pane"),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqPane),this.canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._zoomSelector=$("<div>"),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$("<div>"),this._tooltipSelector.addClass("tooltip tooltip-selector tooltip-selector-hidden"),this._tooltipSelector.appendTo(this._dv),this.legendWidget=new a(this,this._chart.model(),this._chart._jqMainDiv),this.jqRow=$(document.createElement("tr")),this.lhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.jqPane.appendTo(this.jqRow),this.legendWidget.$el.appendTo(this._dv),this.rhsPriceAxisWidget.jqCell.appendTo(this.jqRow),this.setCursorForTool(),TradingView.setMouseEventHandler($(this.top_canvas),this,!0);t&&!this._chart.readOnly()&&(this.paneControls=new $50(this,this._chart.model(),this._dv)),this.updateScalesVisibility(),this.actions=[],this.readonlyActions=[],this._onKeyUpListener=this._onKeyUpListener.bind(this),this._lineCancelledCallback=this._lineCancelledCallback.bind(this),$(window).on("keyup.panewidget",this._onKeyUpListener),this._chart.withModel(this,this._lineCancelledCallback),this._overlays={},this._contextMenuX=0,this._contextMenuY=0,this._lockDrawingsProperty=TradingView.drawingState.lockDrawings(),this._chart.withModel(this,function(){var e=this._chart.model();e.onSimpleZoomIn().subscribe(this,this._updateCrosshairOnZoom),e.onSimpleZoomOut().subscribe(this,this._updateCrosshairOnZoom)}),t&&Z75.enabled("move_logo_to_main_pane")&&t._isMainPane&&e.createLogo&&e.createLogo(null,this._dv,!0)}var n=i(5),o=i(74).Study,a=i(174),s=i(175),l=i(359),d=i(153),h=i(152),p=i(13).LineDataSource,c=i(61).ESDStudyBase,u=i(137),_=i(71).BarsMarksContainer,f=i(72),g=i(18).PriceDataSource,v=i(360),m=i(59),y=i(243);r.prototype.destroy=function(){$(window).off("keyup.panewidget",this._onKeyUpListener),this.legendWidget&&(this.legendWidget.$el.remove(),delete this.legendWidget),this.paneControls&&(this.paneControls.jqDiv.remove(),delete this.paneControls),this._chart.withModel({chart:this._chart,instance:this,callback:this._hideTooltip},function(){this.chart.model().lineCancelled().unsubscribe(this.instance,this.callback)});for(var e in this)delete this[e]},r.prototype.cancelZoom=function(){this._zoomSelector.css("display","none"),delete this._firstZoomPoint},r.prototype._onKeyUpListener=function(e){if(27==e.keyCode){this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine(),this._firstZoomPoint&&this.cancelZoom();var t=this._chart.model().model().crossHairSource();t.clearMeasure(),this.setCursorForTool(),this._hideTooltip()}},r.prototype._lineCancelledCallback=function(){try{this._chart.model().lineCancelled().subscribe(this,this._hideTooltip)}catch(e){}},r.prototype.backgroundColor=function(){return this._chart.properties().paneProperties.background.value()},r.prototype.priceAxisByCanvas=function(e){return e===this.lhsPriceAxisWidget.canvas||e===this.lhsPriceAxisWidget.top_canvas?this.lhsPriceAxisWidget:e===this.rhsPriceAxisWidget.canvas||e===this.rhsPriceAxisWidget.canvas?this.rhsPriceAxisWidget:null},r.prototype.updateScalesVisibility=function(){this.lhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showLeftScale.value()),this.rhsPriceAxisWidget.setVisible(this._chart.properties().scalesProperties.showRightScale.value())},r.prototype.chart=function(){return this._chart},r.prototype.state=function(){return this._state},r.prototype.setState=function(e){this._state=e},r.prototype.stretchFactor=function(){return this._state?this._state._stretchFactor:Z73.DEFAULT_STRETCH_FACTOR},r.prototype.setStretchFactor=function(e){this._state&&(this._state._stretchFactor=e)},r.prototype.mouseEnterEvent=function(e){var t=this._chart.model();t&&(t.crossHairSource().visible=!0,"function"==typeof this.onMouseEnter&&this.onMouseEnter(this))},r.prototype.isLineTool=function(e){var t=TradingView[e];return"function"==typeof t&&t.prototype instanceof p},r.prototype.hideInplaceEditor=function(){return this._inplaceEditor?(this._inplaceEditor.remove(),this._inplaceEditor=void 0,!0):!1},r.prototype._processMouseMoveWhileZoom=function(e){var t=this._state.defaultPriceScale(),i=(t.coordinateToPrice(e.localY),Math.floor(this._chart.model().timeScale().coordinateToIndex(e.localX))),r=this._chart.model().timeScale().indexToCoordinate(i)-.5*this._chart.model().timeScale().barSpacing(),n=e.localY,o=Math.abs(r-this._firstZoomPoint.x),a=Math.abs(n-this._firstZoomPoint.y);r<this._firstZoomPoint.x?this._zoomSelector.css("left",r):this._zoomSelector.css("left",this._firstZoomPoint.x),e.localY<this._firstZoomPoint.y?this._zoomSelector.css("top",e.localY):this._zoomSelector.css("top",this._firstZoomPoint.y),this._zoomSelector.width(o),this._zoomSelector.height(a)},r.prototype._finishZoom=function(e){var t=this._state.defaultPriceScale(),i=t.coordinateToPrice(e.localY),r=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX));r!==this._firstZoomPoint.index&&this._chart.model().zoomToViewport(this._firstZoomPoint.index,r,this._firstZoomPoint.price,i,this.state()),this._zoomSelector.css("display","none"),this._firstZoomPoint=null,TradingView.drawingState.resetToCursor()},r.EvironmentState=function(e){e.shiftKey&&(this.shift=!0),e.ctrlKey&&(this.control=!0)},r.prototype.checkMovepoint=function(e){return e==TradingView.HitTestResult.MOVEPOINT||e==TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any()},r.prototype.mouseDownEvent=function(e){document.activeElement!==document.body&&document.activeElement!==document.documentElement?document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus():document.getSelection?document.getSelection().removeAllRanges():document.selection&&document.selection.clear(),this._updateCommonTooltip(null);var t=this._chart.model(),i=new r.EvironmentState(e);t.mainSeries().setGotoDateResult(),this.hideInplaceEditor(),TradingView.supportTouch()&&(this._skipFirstMove=!0);var n=this._state.defaultPriceScale();if(!n.isEmpty()&&!t.timeScale().isEmpty()){var a=t.crossHairSource();TradingView.supportTouch()&&"LineToolBrush"!=TradingView.drawingState.tool.value()||t.setCurrentPosition(e.localX,e.localY,this._state);var s=a.price,l=a.index;if(a.startMeasurePoint()&&a.endMeasurePoint()&&a.clearMeasure(),i.shift&&TradingView.drawingState.toolIsCursor(TradingView.drawingState.tool.value())&&TradingView.drawingState.tool.setValue("measure"),"measure"===TradingView.drawingState.tool.value()&&!a.startMeasurePoint())return void a.startMeasuring({price:s,index:l,x:e.localX,y:e.localY},this._state);if(a.startMeasurePoint()&&!a.endMeasurePoint())return a.finishMeasure({price:s,index:l,x:e.localX,y:e.localY}),void TradingView.drawingState.resetToCursor();if(this._firstZoomPoint)return void this._finishZoom(e);if("zoom"===TradingView.drawingState.tool.value()){var d=t.timeScale().indexToCoordinate(l)-.5*t.timeScale().barSpacing();return this._firstZoomPoint={price:s,index:l,x:d,y:e.localY},this._zoomSelector.css("display","block"),this._zoomSelector.css("left",d),this._zoomSelector.css("top",e.localY),this._zoomSelector.width(0),void this._zoomSelector.height(0)}t.createUndoCheckpoint();if(this.isLineTool(TradingView.drawingState.tool.value())||t.lineBeingCreated())return void((!Z75.enabled("charting_library_base")||l>=0)&&this._mouseDownEventForLineTool(e,i,l,s));var h=this.dataSourceAtPoint(e.localX,e.localY),c=h&&h.source&&h.source.customization?h.source.customization:{};if(h.hittest&&h.hittest.result()==TradingView.HitTestResult.CUSTOM){var u=h.hittest.data().mouseDownHandler;u&&u()}if(!this._chart.readOnly()){if(h&&!c.disableSelection){var _=h.hittest&&h.hittest.result()>TradingView.HitTestResult.MOVEPOINT_BACKGROUND;_=_||h.hittest&&h.hittest.result()==TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any(),_?t.setSelectedSource(h.source,h.hittest&&h.hittest.data()):t.setSelectedSource(null)}if(h.source&&"eraser"===TradingView.drawingState.tool.value()&&!c.disableErasing&&(TradingView.isInherited(h.source.constructor,p)||TradingView.isInherited(h.source.constructor,o))){var f=h.hittest.eraseMarker();return void(e.ctrlKey&&void 0!==f&&h.source.processErase?h.source.processErase(t,f):t.removeSource(h.source))}var v=h.source&&TradingView.isInherited(h.source.constructor,p)&&h.source.isLocked(),m=this._lockDrawingsProperty.value()||v;if(!m){if(h.source&&h.source.userEditEnabled&&!h.source.userEditEnabled())return;if(h.hittest&&h.hittest.result()===TradingView.HitTestResult.CHANGEPOINT){var n=h.source.priceScale(),s=n.coordinateToPrice(e.localY);return t.startChangingLinetool(h.source,{index:l,price:s},h.hittest.data(),i),void this._updateTooltip(e.localX,e.localY)}if(h.hittest&&this.checkMovepoint(h.hittest.result())){if(h.source.isFixed&&h.source.isFixed())t.startMovingSource(h.source,new MathEx.Point(e.localX,e.localY),h.hittest.data());else{var n=h.source.priceScale(),s=n.coordinateToPrice(e.localY);t.startMovingSource(h.source,{index:l,price:s},h.hittest.data())}return}}if(h.source&&TradingView.isInherited(h.source.constructor,g))return void(this._chart.draggingSource=h.source)}h.hittest&&h.hittest.result()==TradingView.HitTestResult.REGULAR||(this._processing=!0)}},r.prototype.drawRightThere=function(e){if(this.isLineTool(e)){var t=this._chart.model(),i=t.crossHairSource();t.createLineTool(this._state,{index:i.index,price:i.price},e)}},r.prototype._finishTool=function(e){var t=this._chart.model(),i=TradingView.drawingState.tool.value();if(TradingView.drawingState.resetToCursor(),this._hideTooltip(),t.setSelectedSource(e),this._chart.isTextTool(i)){var r=t.createUndoCheckpoint(),n=new s(e,t,r);n.show(),n.focusOnText()}},r.prototype._mouseDownEventForLineTool=function(e,t,i,r){var n=this._chart.model(),o=!1,a=null,s=e.localX,l=e.localY,d=this._chart.model().model().crossHairSource(),h=TradingView.drawingState.tool.value();if(TradingView.drawingState.hideAllDrawings().setValue(!1),TradingView.drawingState.lockDrawings().setValue(!1),TradingView.supportTouch()&&this.isLineTool(h)&&"LineToolBrush"!==h&&!n.lineBeingCreated()&&(this._startTouchPoint=new MathEx.Point(s,l),this._initCrossHairPosition=d.currentPoint(),this._skipFirstMove=!0),!n.lineBeingCreated()||n.lineBeingCreated()instanceof u){if(!TradingView.supportTouch()||"LineToolBrush"==h){var p={index:i,price:r};a=n.createLineTool(this._state,p,h),n.lineBeingCreated()||(o=!0)}}else if(TradingView.supportTouch()){if(this._skipFirstMove=!0,!this._startTouchPoint){this._startTouchPoint=new MathEx.Point(s,l);var c=n.lineBeingCreated().points(),_=c[c.length-1],f=n.timeScale().indexToCoordinate(_.index),r=_.price,g=n.lineBeingCreated().priceScale();if(g.isPercent()){var v=n.lineBeingCreated().ownerSource().firstValue();r=g.priceRange().convertToPercent(r,v)}var m=g.priceToCoordinate(r);return void(this._lastDrawingPoint=new MathEx.Point(f,m))}}else{a=n.lineBeingCreated();var y=n.paneForSource(a);if(y!==this._state){var w=this._dv.offset(),s=e.localX+w.left,l=e.localY+w.top,T=this._chart.paneByState(y);w=T._dv.offset(),s-=w.left,l-=w.top;var r=a.priceScale().coordinateToPrice(l),i=Math.round(n.timeScale().coordinateToIndex(s));o=n.coninueCreatingLine({index:i,price:r},t)}else o=n.coninueCreatingLine({index:i,price:r},t)}n.setSelectedSource(a),o?this._finishTool(a):TradingView.supportTouch()&&"LineToolBrush"!=h||this._updateTooltip(e.localX,e.localY)},r.prototype._equalsCursorCache=function(e,t){return TradingView.drawingState.toolIsCursor(e.tool)?e.tool===t.tool&&e.theme===t.theme&&e.crosshair===t.crosshair:e.tool===t.tool&&e.theme===t.theme},r.prototype._setCursor=function(e){this._cursorCache&&this._equalsCursorCache(this._cursorCache,e)||(this._cursorCache=e,TradingView.drawingState.toolIsCursor(e.tool)?this.jqPane.css("cursor",e.crosshair):this.jqPane.css("cursor",TradingView.cursorCss(e.state.name,e.state.hotspot,e.theme)))},r.prototype.setCursorForTool=function(e,t){var i={_default:{name:"cursor_cross",hotspot:"11 11"},zoom:{name:"zoom",hotspot:"5 5"},pointer:{name:"cursor_pointinghand",hotspot:"13 7"},dragger:{name:"cursor_closed_hand",hotspot:"8 8"}},r=TradingView.drawingState.tool.value();TradingView.drawingState.toolIsCursor(r)&&(this._chart.draggingSource||this._isScrolling||this._chart.model()&&this._chart.model().sourceBeingMoved()?r="dragger":e&&(r="pointer")),this._chart.model()&&this._chart.model().lineBeingEdited()?r=this._chart.model().lineBeingEdited()._constructor:t==TradingView.HitTestResult.CHANGEPOINT&&(r=e._constructor);var n=i._default;r in i&&(n=i[r]);var o="light";this._setCursor({tool:r,theme:o,state:n,crosshair:this.defaultPaneCursor(o)})},r.prototype.setDragToAnotherPaneCursor=function(){var e="light";this._setCursor({tool:"dragger",theme:e,state:{name:"cursor_closed_hand_move",hotspot:"8 8"},crosshair:this.defaultPaneCursor(e)})},r.prototype.defaultPaneCursor=function(e){var t={cursor:{name:"cursor_cross",hotspot:"11 11"},dot:{name:"cursor_dot",hotspot:"11 11"},crosshair:{name:"cursor_cross",hotspot:"11 11"},eraser:{name:"cursor_eraser",hotspot:"5 5"}},i=t[TradingView.drawingState.tool.value()];return i||(i=t[TradingView.drawingState.cursorTool.value()]),i?TradingView.cursorCss(i.name,i.hotspot,e):"default"},r.prototype.gestureStartEvent=function(e){this._prev_pinch_scale=1,this._pinching=!0},r.prototype.gestureChangeEvent=function(e){var t=(e.originalEvent.pageX||e.originalEvent.offsetX)-5,i=this._chart.paneWidgets()[0].lhsPriceAxisWidget.size.w,r=this._chart.model().timeScale().width();i&&(t=Math.max(0,t-i)),t=Math.min(t,r);var n=2*(t/r-.5),o=5*(e.scale-this._prev_pinch_scale);o>0?this._chart.model().zoomIn(n,o):this._chart.model().zoomOut(n,-o),this._prev_pinch_scale=e.scale},r.prototype.gestureEndEvent=function(e){this._pinching=!1},r.prototype._updateCommonTooltip=function(e){var t=this._lastCommonTooltipData,i=null;if(e&&e.hittest&&e.hittest.result()===TradingView.HitTestResult.CUSTOM){var r=e.hittest.data();r&&(i=r.tooltip||null)}if(null!=t||null!=i){if(null==i)return this._lastCommonTooltipData=null,void TradingView.Tooltip.hide();if(!t||i.text!==t.text||i.rect.x!==t.rect.x||i.rect.y!==t.rect.y||i.rect.w!==t.rect.w||i.rect.h!==t.rect.h){this._lastCommonTooltipData=i;var n=TradingView.clone(i),o=this.jqPane.offset();n.rect.x+=o.left,n.rect.y+=o.top,TradingView.Tooltip.show(n)}}},r.prototype.mouseMoveEvent=function(e){var t=this._chart.model();if(t){var i=e.localX,n=e.localY,o=new r.EvironmentState(e);if(this._firstZoomPoint)return void this._processMouseMoveWhileZoom(e);if(!(this._chart.readOnly()||this._editDialog&&this._editDialog.isVisible())){this.setCursorForTool();var a=TradingView.drawingState.tool.value(),s=null;this._processing||!TradingView.drawingState.toolIsCursor(a)&&"eraser"!==a||(s=this.dataSourceAtPoint(e.localX,e.localY),s.hittest&&s.hittest.result()>TradingView.HitTestResult.MOVEPOINT_BACKGROUND?(this.setCursorForTool(s.source,s.hittest?s.hittest.result():null),!s.source||"eraser"===a&&s.source.constructor===TradingView.Series?t.setHoveredSource(null):t.setHoveredSource(s.source,s.hittest.data())):t.setHoveredSource(null)),this._updateCommonTooltip(s)}if(this._chart.readOnly()){var s=this.dataSourceAtPoint(e.localX,e.localY);t.hoveredSource();null!==s.source?t.setHoveredSource(s.source,s.hittest.data()):t.setHoveredSource(null,null)}if(this._chart.model().lineBeingCreated()){var l=this._chart.model().lineBeingCreated(),d=this._chart.model().paneForSource(l);if(d!==this._state){var h=this._dv.offset();i+=h.left,n+=h.top;var p=this._chart.paneByState(d);return h=p._dv.offset(),i-=h.left,n-=h.top,void t.setCurrentPosition(i,n,d)}}var a=TradingView.drawingState.tool.value();TradingView.supportTouch()&&this.isLineTool(a)||(t.setCurrentPosition(i,n,this._state,o),this._updateTooltip(i,n))}},r.prototype.pressedMouseMoveEvent=function(e){if(!this._pinching){this._skipFirstMove?(delete this._skipFirstMove,delete this._touchMove):this._touchMove=!0;var t=new r.EvironmentState(e),i=this._chart.model(),n=e.localX,o=e.localY;if(this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);var a=TradingView.drawingState.tool.value();if(TradingView.supportTouch()&&this._startTouchPoint&&this.isLineTool(a)&&"LineToolBrush"!==a&&!i.lineBeingCreated()){var s=(this._chart.model().model().crossHairSource(),this._initCrossHairPosition),l=new MathEx.Point(n,o),d=l.substract(this._startTouchPoint),h=s.add(d);return this._chart.model().setCurrentPosition(h.x,h.y,this._state),void this._updateTooltip(h.x,h.y)}if(!TradingView.supportTouch()||!i.lineBeingCreated()||i.lineBeingCreated()instanceof u){i.setCurrentPosition(n,o,this._state,t),this._updateTooltip(n,o);var c=TradingView.drawingState.tool.value();if((!this.isLineTool(c)||"LineToolBrush"===a)&&(0===e.button||Modernizr.touch)){if("LineToolBrush"===c){var _=this._state.defaultPriceScale();if(_.isEmpty())return;if(!this._chart.model().lineBeingCreated())return;var f=_.coordinateToPrice(e.localY),g=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX));return void((!Z75.enabled("charting_library_base")||g>=0)&&this._chart.model().coninueCreatingLine({index:g,price:f}))}if(this._chart.draggingSource){var v=e.target,m=this._chart.paneByCanvas(v);m&&(m!==this?m.setDragToAnotherPaneCursor():m.setCursorForTool());var y=this._chart.priceAxisByCanvas(v);y&&y.jqCell.css("cursor",TradingView.cursorCss("cursor_closed_hand","8 8"));var w=this._chart.timeAxisByCanvas(v);w&&w.jqCell.css("cursor",TradingView.cursorCss("cursor_closed_hand_move","8 8"))}if(i.timeScale().isEmpty())return;if(i.lineBeingEdited()){var g=Math.round(this._chart.model().timeScale().coordinateToIndex(n));return(!Z75.enabled("charting_library_base")||g>=0)&&i.changeLinePoint({x:n,y:o},t),this._updateTooltip(n,o),void this.setCursorForTool()}if(i.sourceBeingMoved()){var _=i.sourceBeingMoved().priceScale();if(_.isEmpty())return;var g=this._chart.model().timeScale().coordinateToIndex(e.localX),f=_.coordinateToPrice(e.localY),T=i.sourceBeingMoved();if(this.setCursorForTool(),Z75.enabled("charting_library_base")&&!i.sourceBeingMoved().onlyYMoving()){var b=T.points().reduce(function(e,t){return t.index<e.index?t:e}).index;if(b-((T._currentMovingPoint||T._startMovingPoint).index-g)<0)return}return TradingView.isInherited(T.constructor,p)&&T.isFixed()?void i.moveSource(new MathEx.Point(n,o)):void i.moveSource({index:g,price:f},t)}var _=this._state.defaultPriceScale();this._startScrollingPos||(this._startScrollingPos={x:e.clientX,y:e.clientY}),this._startScrollingPos&&(this._startScrollingPos.x===e.clientX&&this._startScrollingPos.y===e.clientY||this._isScrolling||(i.beginUndoMacro("scroll"),_.isEmpty()||i.startScrollPrice(this._state,_,e.localY),i.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool())),this._isScrolling&&(_.isEmpty()||i.scrollPriceTo(this._state,_,e.localY),i.scrollTimeTo(e.localX))}}else if(this._startTouchPoint){var S=i.lineBeingCreated(),C=e.localX-this._startTouchPoint.x,x=e.localY-this._startTouchPoint.y,P=this._lastDrawingPoint.x+C,L=this._lastDrawingPoint.y+x,E=this._chart.model().paneForSource(S);i.setCurrentPosition(P,L,E),this._updateTooltip(P,L)}}},r.prototype._processMouseUpForCustomHandler=function(e){var t=this.dataSourceAtPoint(e.localX,e.localY);if(t.hittest&&t.hittest.result()==TradingView.HitTestResult.CUSTOM){var i=t.hittest.data().mouseUpHandler;i&&i()}},r.prototype.mouseUpEvent=function(e){this._processMouseUpForCustomHandler(e);var t=this._chart.model(),i=this._touchMove;delete this._touchMove;var r=TradingView.drawingState.tool.value();if(TradingView.supportTouch()&&!i&&"LineToolBrush"!==r&&this.isLineTool(r)&&!t.lineBeingCreated()){var o=t.crossHairSource().currentPoint(),a=this._state.defaultPriceScale(),s=a.coordinateToPrice(o.y),l=Math.round(t.timeScale().coordinateToIndex(o.x)),d={index:l,price:s},h=t.createLineTool(this._state,d,r);return t.setSelectedSource(h),t.lineBeingCreated()||this._finishTool(h),this._updateTooltip(o.x,o.y),void delete this._startTouchPoint}if(t.lineBeingCreated()&&!(t.lineBeingCreated()instanceof u)&&this._startTouchPoint){var p=!1;delete this._startTouchPoint;var h;if(!i){h=t.lineBeingCreated();var c=h.points()[h.points().length-1],s=c.price,_=h.priceScale();if(_.isPercent()){var f=t.lineBeingCreated().ownerSource().firstValue();s=_.priceRange().convertToPercent(s,f)}p=t.coninueCreatingLine({index:c.index,price:s},{}),delete this._lastDrawingPoint}return void(p&&this._finishTool(h))}if(this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(0===e.button||TradingView.supportTouch()){this._processing=!1;var t=this._chart.model();if(t.lineBeingEdited())return t.endChangingLinetool(),void this._hideTooltip();if("LineToolBrush"===r){t.finishLineTool();var a=this._state.defaultPriceScale();if(a.isEmpty())return;if(!this._chart.model().lineBeingCreated())return;var s=a.coordinateToPrice(e.localY),l=Math.round(this._chart.model().timeScale().coordinateToIndex(e.localX));return void this._chart.model().coninueCreatingLine({index:l,price:s})}var g=t.sourceBeingMoved();if(g)return t.endMovingSource(),this._hideTooltip(),this.setCursorForTool(g),void t.Q18(new $21($21.UPDATE_CURSOR_ONLY));var v=this._isScrolling&&n.UndoHistory.undoStack().head()instanceof n.UndoMacroCommand;if(this._isScrolling){var a=this._state.defaultPriceScale();t.endScrollPrice(this._state,a);var m=this,y=function(){t.endScrollTime(),t.endUndoMacro(),m._startScrollingPos=void 0,m._isScrolling=!1,m.setCursorForTool()};if(TradingView.supportTouch()){var w=t.timeScale().m_scrollStartPoint,T=.05*(e.localX-w),b=null,S=function(i){null===b&&(b=i);var r=.01*Math.min(100,3*(i-b));r=Math.sqrt(r);var n=e.localX+T*r;t.scrollTimeTo(n),r>=1?y():requestAnimationFrame(S)};requestAnimationFrame(S)}else y()}if(this._chart.draggingSource){var C=e.target,x=this._chart.paneByCanvas(C);if(x&&x!=this){var P=x._state.findSuitableScale(this._chart.draggingSource);v&&(v=!1,n.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,x._state,P)}var L=this._chart.priceAxisByCanvas(C);if(L){var x=L.pane,a=L._isLeft?x._state.leftPriceScale():x._state.rightPriceScale();v&&(v=!1,n.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,x._state,a)}var E=this._chart.timeAxisByCanvas(C);E&&(v&&(v=!1,n.UndoHistory.undo()),this._chart.model().move(this._chart.draggingSource,null,null),E.jqCell.css("cursor","")),this._chart.draggingSource=null;var V=this.dataSourceAtPoint(e.localX,e.localY);this.setCursorForTool(V.source,V.hittest||null)}}delete this._touchMove},r.prototype.mouseLeaveEvent=function(e){var t=this._chart.model();t&&(TradingView.isMobile.any()||t.model().clearCurrentPosition(),t.setHoveredSource(null),this._updateCommonTooltip(null),"function"==typeof this.onMouseLeave&&this.onMouseLeave(this))},r.prototype.mouseClickEvent=function(e){this._chart.model().hoveredSource()instanceof _&&this._chart.model().hoveredSource().onClicked()},r.prototype.showEditDialogForSource=function(e){this.chart().onWidget()||e.userEditEnabled&&!e.userEditEnabled()||(this._editDialog=new s(e,this._chart.model()),this._editDialog.show())},r.prototype.mouseDoubleClickEvent=function(e){var t=!this._chart.readOnly()&&!this.isLineTool(TradingView.drawingState.tool.value())&&this.dataSourceAtPoint(e.localX,e.localY),i=t&&t.hittest&&t.source;i&&t.hittest.result()<=TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&!TradingView.isMobile.any()&&(i=null),i&&i.customization&&i.customization.disableSelection&&(i=null),i&&i._metaInfo&&"Sessions@tv-basicstudies"==i._metaInfo.id&&(i=this._chart.model().mainSeries()),i?t.source instanceof m?TradingView.alertsDispatcher.openEditDialog(t.source.alert()):this.showEditDialogForSource(i):this._chart.readOnly()||this.isLineTool(TradingView.drawingState.tool.value())||this._chart.model().lineBeingCreated()||this._chart.model().selectedSource()||this._chart.toggleMaximizePane(this)},r.prototype.showContextMenuForSource=function(e,t){e.hasContextMenu()&&(this._chart.model().setSelectedSource(e),e.constructor===TradingView.Series?this._seriesContextMenu(e).show(t):TradingView.isInherited(e.constructor,c)?this._studyEsdContextMenu(e).show(t):TradingView.isInherited(e.constructor,o)?this._studyContextMenu(e).show(t):TradingView.isInherited(e.constructor,f)?this._publishedChartsContextMenu(e).show(t):TradingView.isInherited(e.constructor,d)||TradingView.isInherited(e.constructor,h)?this._tradingDrawingsContextMenu(e).show(t):TradingView.isInherited(e.constructor,p)?this._lineContextMenu(e).show(t):TradingView.isInherited(e.constructor,m)&&!e.fake?this._alertLabelContextMenu(e).show(t):TradingView.isInherited(e.constructor,v)&&this._chartEventsContextMenu(e).show(t))},r.prototype.contextMenuEvent=function(e,t){if(Z75.enabled("pane_context_menu")){if(this._chart.model().crossHairSource().startMeasurePoint())return void this._chart.model().crossHairSource().clearMeasure();if(!this._pinching&&(this._firstZoomPoint&&this.cancelZoom(),!this.hideInplaceEditor())){if(!TradingView.drawingState.toolIsCursor(TradingView.drawingState.tool.value())){if(TradingView.isMobile.any())return;return TradingView.drawingState.resetToCursor(!0),this.setCursorForTool(),this._hideTooltip(),void(this._chart.model().lineBeingCreated()&&this._chart.model().cancelCreatingLine())}if(!this.chart().readOnly()&&!this._disableContextMenu){this._chart.model().mainSeries().createSessStudy(),this._chart.updateActions(),this._contextMenuX=e.localX,this._contextMenuY=e.localY;var i=this.dataSourceAtPoint(e.localX,e.localY),r=i?i.source:null,n=i&&i.hittest?i.hittest.result():0,o=n>=TradingView.HitTestResult.REGULAR||n>=TradingView.HitTestResult.MOVEPOINT_BACKGROUND&&TradingView.isMobile.any();
null!==r&&o?this.showContextMenuForSource(r,e):(this._contextMenu(e).show(e),this._chart.model().setSelectedSource(null)),this.paint()}}}},r.prototype._contextMenu=function(e){function t(e){return null===e.text}var i=this._initActions(e),r=this._customActions();r.remove.forEach(function(e){for(var t=0;t<i.length;t++)if(i[t].text===e){i.splice(t,1);break}});for(var n=r.top.concat(i).concat(r.bottom),o=n.length-1;o>0;o--)t(n[o])&&t(n[o-1])&&n.splice(o,1);return n.length&&t(n[0])&&n.splice(0,1),n.length&&t(n[n.length-1])&&n.splice(n.length-1,1),TradingView.ContextMenu.createMenu(n)},r.prototype.createRemoveMenu=function(){var e=this._chart.actions(),t=new TradingView.Action({text:$.t("Remove")});t.subActions||(t.subActions=[]);var i=t.subActions;return i.push(e.paneRemoveAllStudies),i.push(e.paneRemoveAllDrawingTools),i.push(e.paneRemoveAllStudiesDrawingTools),t},r.prototype.createDrawingMenu=function(){var e=this._chart.actions(),t=new TradingView.Action({text:$.t("Drawing Tools")});t.subActions||(t.subActions=[]);var i=t.subActions;return i.push(e.drawingToolbarAction),Z75.enabled("charting_library_base")||i.push(e.favoriteDrawingToolbar),i.push(new TradingView.ActionSeparator),i.push(e.magnetAction),i.push(e.stayInDrawingModeAction),Z75.enabled("support_multicharts")&&i.push(e.syncModeAction),i.push(new TradingView.ActionSeparator),i.push(e.lockDrawingsAction),i.push(e.hideAllDrawingsAction),i.push(e.paneRemoveAllDrawingTools),t},r.prototype._initActions=function(e){var t=this,i=this._chart.actions(),r=[];if(Z75.enabled("datasource_copypaste")){var n=TradingView.AppClipboard.get();if(n&&("study"===n.type||"drawing"===n.type)){var o=new TradingView.Action({text:$.t("Paste %s",$.t(n.title||n.type)),shortcut:"Ctrl-V"});o.callbacks().subscribe(null,function(){t._chart.onAppClipboardPaste(t.state())}),r.push(o)}}if(Z75.enabled("alerts")&&(r.length&&r.push(new TradingView.ActionSeparator),r.push(this._createActionAddAlert({e:e}))),!this.chart().onWidget()){var a=this.createActionTrade(e);a&&r.push(a)}i.gotoDate&&r.push(i.gotoDate),r.length&&r.push(new TradingView.ActionSeparator),r.push(i.chartReset),r.push(i.symbolSearch),r.push(i.changeInterval);var s=window.widgetbar&&(!window.widgetbar._customization||window.widgetbar._customization.watchlist);s&&r.push(i.addToWatchlist),Z75.enabled("text_notes")&&r.push(i.addToTextNotes),Z75.enabled("symbol_info")&&r.push(i.showSymbolInfoDialog),r.push(new TradingView.ActionSeparator),r.push(this._createLockTimeAxisAction(e)),r.push(new TradingView.ActionSeparator),r.push(i.paneObjectTree),r.push(i.insertIndicator),Z75.enabled("charting_library_base")||r.push(i.applyStudyTemplate),Z75.enabled("compare_symbol")&&r.push(i.compareOrAdd),r.push(this.createDrawingMenu()),Z75.enabled("charting_library_base")&&r.push(i.hideAllMarks),r.push(this.createRemoveMenu()),r.push(new TradingView.ActionSeparator);var l=this._priceAxisMenu();l&&r.push(l);var d=this._timeAxisMenu();return d&&r.push(d),Z75.enabled("charting_library_base")||r.push(i.applyColorTheme),r.push(i.chartProperties),pro.hasPackage("mtp-mtpredictor")&&this.state().containsMainSeries()&&(r.push(new TradingView.ActionSeparator),r.push(this._createMTPredictorActions())),r},r.prototype._customActions=function(){var e={top:[],bottom:[],remove:[]},t=this._chart.model(),i=t.timeScale(),r=this._state.defaultPriceScale();if(!Z75.enabled("custom_items_in_context_menu"))return e;var n=i.isEmpty()?void 0:i.indexToUserTime(i.coordinateToIndex(this._contextMenuX));return Q15.emit("onContextMenu",{unixtime:n?n/1e3:void 0,price:r.isEmpty()?void 0:r.coordinateToPrice(this._contextMenuY),callback:function(t){[].concat(t).forEach(function(t){if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{var i;"-"===t.text?i=new TradingView.ActionSeparator:(i=new TradingView.Action({text:t.text}),i.callbacks().subscribe(null,t.click)),t.position&&"top"==t.position?e.top.push(i):e.bottom.push(i)}})}}),e},r.prototype._timeAxisMenu=function(){if(this._chart.model().timeScale().isEmpty())return null;var e=this._chart.getTimeScale();return new TradingView.Action({text:$.t("Time Scale"),subActions:e.getContextMenuActions()})},r.prototype._priceAxisMenu=function(){var e=this._state.defaultPriceScale();if(e.isEmpty())return null;var t=e===this._state.leftPriceScale?this.leftPriceAxisWidget():this.rightPriceAxisWidget();return new TradingView.Action({text:$.t("Price Scale"),subActions:t.getContextMenuActions()})},r.prototype._seriesContextMenu=function(e){var t=this._chart.actions(),i=e.properties().visible.value(),r=null;if(this._chart.readOnly()){var n=[i?t.seriesHide:this.createActionShow(e),new TradingView.ActionSeparator,this.createActionShowCountdown(e),new TradingView.ActionSeparator,this.createActionScaleLeft(e),this.createActionScaleRight(e),this.createActionNoScale(e)];Z75.enabled("countdown")||n.splice(3,1),r=TradingView.ContextMenu.createMenu(n)}else{var o=this._mergeContentMenuItems(e),a=[t.showSymbolInfoDialog,t.compare,i?t.seriesHide:this.createActionShow(e),this.createVisualOrderAction(e),new TradingView.ActionSeparator,this.createActionShowCountdown(e),new TradingView.ActionSeparator];Z75.enabled("countdown")||a.splice(5,2),Z75.enabled("compare_symbol")||a.splice(1,1),Z75.enabled("symbol_info")||a.splice(0,1),this.chart().onWidget()||a.unshift(t.format),this.chart().canCreateAlertForDataSource(e)&&a.unshift(this._createActionAddAlert({series:e}));var s=this.createActionLockScale(e);if(s&&(a.push(s),a.push(new TradingView.ActionSeparator)),o.length>0){for(var l=0;l<o.length;l++)a.push(o[l]);a.push(new TradingView.ActionSeparator)}a.push(this.createActionScaleLeft(e)),a.push(this.createActionScaleRight(e)),a.push(this.createActionNoScale(e)),pro.hasPackage("mtp-mtpredictor")&&(a.push(new TradingView.ActionSeparator),a.push(this._createMTPredictorActions())),r=TradingView.ContextMenu.createMenu(a)}return r},r.prototype.toggleLockTimeAxis=function(e,t){if("boolean"!=typeof t&&(t=!TradingView.drawingState.lockTimeAxis().value()),t){var i=this._chart.model().timeScale(),r=i.coordinateToIndex(e),n=i.points().roughTime(r);TradingView.drawingState.lockTimeAxisTime.setValue(n)}TradingView.drawingState.lockTimeAxis().setValue(t)},r.prototype._createLockTimeAxisAction=function(e){var t=new TradingView.Action({text:$.t("Lock Cursor In Time"),checkable:!0}),i=TradingView.drawingState.lockTimeAxis().value();return t.setChecked(i),t.callbacks().subscribe(null,this.toggleLockTimeAxis.bind(this,e.localX,!i)),t},r.prototype._createHVLineAction=function(e,t){t="vertical"==t&&"vertical"||"horizontal";var i=new TradingView.Action({text:"vertical"==t?$.t("Create Vertical Line"):$.t("Create Horizontal Line")});return i.callbacks().subscribe(this,function(){var i=this._chart.model().timeScale().coordinateToIndex(e.localX),r=this._state.defaultPriceScale().coordinateToPrice(e.localY),n=this._chart.model().createLineTool(this._state,{index:i,price:r},"vertical"==t&&"LineToolVertLine"||"LineToolHorzLine");this._finishTool(n)}),i},r.prototype._createMTPredictorActions=function(){var e=this,t=function(t,i,r){var n=new TradingView.Action({text:t});return n.callbacks().subscribe(e,function(){var e=this._chart.model(),t=e.timeScale(),n=this._state.defaultPriceScale();if(!t.isEmpty()&&!n.isEmpty())if(r){var o=n.coordinateToPrice(this._contextMenuY),a=Math.round(t.coordinateToIndex(this._contextMenuX));e.createLineTool(this._state,{index:a,price:o},i)}else TradingView.drawingState.tool.setValue(i)}),n};return new TradingView.Action({text:$.t("MTPredictor"),subActions:[t($.t("Apply Manual Risk/Reward"),"LineStudyMtpRiskReward",!1),t($.t("Apply Manual Decision Point"),"LineStudyMtpDecisionPoint",!0),t($.t("Analyze Trade Setup"),"LineStudyMtpAnalysis",!0),new TradingView.Action({text:$.t("Apply Elliot Wave"),subActions:[t($.t("Apply Elliot Wave Intermediate"),"LineStudyMtpElliotWaveMain",!0),t($.t("Apply Elliot Wave Major"),"LineStudyMtpElliotWaveMajor",!0),t($.t("Apply Elliot Wave Minor"),"LineStudyMtpElliotWaveMinor",!0)]}),new TradingView.Action({text:$.t("Apply WPT Up Wave"),subActions:[t($.t("Up Wave 1 or A"),"LineStudyMtpUpWave1OrA",!1),t($.t("Up Wave 2 or B"),"LineStudyMtpUpWave2OrB",!1),t($.t("Up Wave C"),"LineStudyMtpUpWaveC",!1),t($.t("Up Wave 3"),"LineStudyMtpUpWave3",!1),t($.t("Up Wave 4"),"LineStudyMtpUpWave4",!1),t($.t("Up Wave 5"),"LineStudyMtpUpWave5",!1)]}),new TradingView.Action({text:$.t("Apply WPT Down Wave"),subActions:[t($.t("Down Wave 1 or A"),"LineStudyMtpDownWave1OrA",!1),t($.t("Down Wave 2 or B"),"LineStudyMtpDownWave2OrB",!1),t($.t("Down Wave C"),"LineStudyMtpDownWaveC",!1),t($.t("Down Wave 3"),"LineStudyMtpDownWave3",!1),t($.t("Down Wave 4"),"LineStudyMtpDownWave4",!1),t($.t("Down Wave 5"),"LineStudyMtpDownWave5",!1)]})]})},r.prototype.createEarningsShow=function(e){var t=this._chart.model().mainSeries().properties().esdShowEarnings,i=new TradingView.Action({checkable:!0,text:$.t("Show Earnings"),enabled:!0,checked:t.value()});return i.callbacks().subscribe(this,function(e){this._chart.model().setProperty(t,e.checked,"Show Earnings")}),i},r.prototype.createDividendsShow=function(e){var t=this._chart.model().mainSeries().properties().esdShowDividends,i=new TradingView.Action({checkable:!0,text:$.t("Show Dividends"),enabled:!0,checked:t.value()});return i.callbacks().subscribe(this,function(e){this._chart.model().setProperty(t,e.checked,"Show Dividends")}),i},r.prototype.createSplitsShow=function(e){var t=this._chart.model().mainSeries().properties().esdShowSplits,i=new TradingView.Action({checkable:!0,text:$.t("Show Splits"),enabled:!0,checked:t.value()});return i.callbacks().subscribe(this,function(e){this._chart.model().setProperty(t,e.checked,"Show Splits")}),i},r.prototype._studyEsdContextMenu=function(e){var t=[];this._chart.readOnly()||(t.push(this.createDividendsShow(e)),t.push(this.createSplitsShow(e)),t.push(this.createEarningsShow(e)));var i=TradingView.ContextMenu.createMenu(t);return i},r.prototype._studyContextMenu=function(e){var t=this._chart.actions(),i=e.properties().visible.value(),r=[],n=null;if(!e.userEditEnabled())return n=TradingView.ContextMenu.createMenu(r);var o=this._chart;if(e.properties().linkedToSeries&&e.properties().linkedToSeries.value())this._chart.readOnly()?r.push(i?t.studyHide:this.createActionShow(e)):(this._chart.canCreateAlertForDataSource(e)&&r.push(this._createActionAddAlert({series:e})),r.push(t.format),r.push(i?t.studyHide:this.createActionShow(e)),r.push(this.createVisualOrderAction(e)),r.push(new TradingView.ActionSeparator),r.push(t.studyRemove));else if(this._chart.readOnly())r=[i?t.studyHide:this.createActionShow(e),new TradingView.ActionSeparator,this.createActionScaleLeft(e),this.createActionScaleRight(e),this.createActionNoScale(e)];else{var a=[],s=e.metaInfo();s.TVScriptSourceCode&&s.scriptIdPart&&(a=[t.viewSourceCode]),r=[],r=r.concat([t.format]),r=r.concat(a),r=r.concat([i?t.studyHide:this.createActionShow(e),this.createVisualOrderAction(e),new TradingView.ActionSeparator]);var l=this._mergeContentMenuItems(e);if(l.length&&l.push(new TradingView.ActionSeparator),r=r.concat(l),r.push(this.createActionScaleLeft(e)),r.push(this.createActionScaleRight(e)),r.push(this.createActionNoScale(e)),r.push(new TradingView.ActionSeparator),Z75.enabled("datasource_copypaste")){var d=new TradingView.Action({text:$.t("Copy"),shortcut:"Ctrl-C"});d.callbacks().subscribe(null,function(){o.onAppClipboardCopy(e)}),r.push(d)}r.push(t.studyRemove),this._chart.canCreateAlertForDataSource(e)&&r.unshift(this._createActionAddAlert({series:e}))}return n=TradingView.ContextMenu.createMenu(r)},r.prototype.createLineToolTemplateAction=function(e){var t=e.properties(),i=window.lineToolPropertiesToolbar.templatesList,r=new TradingView.Action({text:$.t("Templates")});r.subActions||(r.subActions=[]);var n=r.subActions,o=new TradingView.Action({text:$.t("Save As...")});o.callbacks().subscribe(this,function(){i.showSaveDialog(e)}),n.push(o);var a=new TradingView.Action({text:$.t("Apply Default")});a.callbacks().subscribe(this,function(){t.restoreFactoryDefaults(),window.lineToolPropertiesToolbar.onSourceChanged(e)}),n.push(a);var s=$.Deferred();i.templatesLoaded().then(function(){var e=i.getData(),t=[];0!==e.length&&t.push(new TradingView.ActionSeparator),$.each(e,function(e,r){function n(e){return function(){var t=this.getTopLevelMenu();return t&&t.hide(),i.deleteAction(e),!0}}var o=new TradingView.Action({text:r});o.callbacks().subscribe(this,function(){i.loadTemplate(r)}),o.deleteButton={action:n(o.text)},t.push(o)}),s.resolve(t)});var l=new TradingView.ActionPlaceholder(s);return n.push(l),r},r.prototype._publishedChartsContextMenu=function(e){var t=this._chart.actions(),i=[];if(i.push(t.lineHide),is_authenticated){var r=new TradingView.Action({checked:e.properties().filter.value()==f.FILTER_NONE,checkable:!0,text:$.t("Suggested ideas & my ideas"),callbackContext:{target:e,value:f.FILTER_NONE}}),n=new TradingView.Action({checked:e.properties().filter.value()==f.FILTER_FOLLOWING,checkable:!0,text:$.t("Ideas of the people I follow & my ideas"),callbackContext:{target:e,value:f.FILTER_FOLLOWING}}),o=new TradingView.Action({checked:e.properties().filter.value()==f.FILTER_PRIVATE,checkable:!0,text:$.t("My ideas only"),callbackContext:{target:e,value:f.FILTER_PRIVATE}}),a=function(e){var t=e.callbackContext(),i=t.target,r=t.value;i.properties().filter.setValue(r),i.updateAllViews(),i.Z98.updateSource(i)};r.callbacks().subscribe(null,a),n.callbacks().subscribe(null,a),o.callbacks().subscribe(null,a),i.push(new TradingView.ActionSeparator),i.push(r),i.push(n),i.push(o)}var s=TradingView.ContextMenu.createMenu(i);return s},r.prototype._lineContextMenu=function(e){var t=this._chart.actions(),n=[],o=this._chart,a=i(176).hasStylesPropertyPage;if(this._chart.readOnly())n.push(t.lineHide);else if(e.userEditEnabled()){if(Z75.enabled("alerts")&&!this.chart().onWidget()&&(e.hasAlert.value()?n.push(this._createEditAlertDrawingAction(e)):e.canHasAlert()&&n.push(this._createActionAddAlert({drawing:e}))),a(e,this._chart.model())&&n.push(t.format),n.push(t.paneObjectTree),Z75.enabled("charting_library_base")||n.push(this.createLineToolTemplateAction(e)),n.push(this.createVisualOrderAction(e)),n.push(new TradingView.ActionSeparator),n.push(t.lineHide),n.push(t.lineToggleLock),e.properties().clonable&&e.properties().clonable.value()){var s=new TradingView.Action({text:$.t("Clone"),callbackContext:{target:e}});s.callbacks().subscribe(this,r.prototype.cloneLineTool.bind(this,e)),n.push(s)}if(Z75.enabled("datasource_copypaste")&&!e.properties().blockCopying){var l=new TradingView.Action({text:$.t("Copy"),shortcut:"Ctrl-C"});l.callbacks().subscribe(null,function(){o.onAppClipboardCopy(e)}),n.push(l)}if(Z75.enabled("support_multicharts")&&(e.linkKey?n.push(t.lineUnlink):n.push(t.lineCopyToCharts)),n.push(t.lineRemove),e.additionalActions){n.push(new TradingView.ActionSeparator);for(var t=e.additionalActions(this._chart.model()),d=0;d<t.length;d++)n.push(t[d])}}var h=TradingView.ContextMenu.createMenu(n);return h},r.prototype._alertLabelContextMenu=function(e){var t=e.alert(),i=[];t.get("active")?i.push(TradingView.alertsDispatcher.actionsCreators.stopAlert(t)):i.push(TradingView.alertsDispatcher.actionsCreators.restartAlert(t)),i.push(TradingView.alertsDispatcher.actionsCreators.editAlert(t)),i.push(TradingView.alertsDispatcher.actionsCreators.deleteAlert(t)),i.push(new TradingView.ActionSeparator),i.push(this._createAlertToggleHorzLineLabelAction(e)),i.push(new TradingView.ActionSeparator),i.push(this._createShowGlobalAlertPropertiesLabelAction(e));var r=TradingView.ContextMenu.createMenu(i);return r},r.prototype._tradingDrawingsContextMenu=function(e){return TradingView.ContextMenu.createMenu(e.contextMenuItems())},r.prototype._chartEventsContextMenu=function(e){var t=[],i=this._chart,r=new TradingView.Action({text:$.t("Format..."),enabled:!0});r.callbacks().subscribe(this,function(e){TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Events & Alerts")),i.showChartProperties()}),t.push(r);var n=new TradingView.Action({text:$.t("Hide Events on Chart"),enabled:!0});return n.callbacks().subscribe(this,function(t){e.properties().visible.setValue(!1)}),t.push(n),TradingView.ContextMenu.createMenu(t)},r.prototype._createAlertToggleHorzLineLabelAction=function(e){var t=e.properties().line.visible,i=new TradingView.Action({checkable:!0,text:$.t("Extend Alert Line"),enabled:!0,checked:t.value()});return i.callbacks().subscribe(this,function(e){var i=e.checked,r=i?$.t("Show alert label line"):$.t("Hide alert label line");this._chart.model().setProperty(t,i,r)}),i.setEnabled(e.globalProperties().line.visible.value()),i},r.prototype._createShowGlobalAlertPropertiesLabelAction=function(e){var t=this.chart(),i=new TradingView.Action({text:$.t("Visual settings...")});return i.callbacks().subscribe(this,function(e){t.showChartProperties({selectAlertEvent:!0})}),i},r.prototype._createEditAlertDrawingAction=function(e){if(e.hasAlert.value()){var t=new TradingView.Action({text:$.t("Edit {0} Alert...").format(e.title())});return t.callbacks().subscribe(null,function(){runOrSignIn(function(){e.editAlert()},{source:"Alert edit from pane context menu"})}),t}},r.prototype.cloneLineTool=function(e){this._chart.model().cloneLineTool(e)},r.prototype.setPriceAxisSize=function(e,t){this._priceAxisWidget(e).setSize(t)},r.prototype.setPriceAxisVisible=function(e,t){this._priceAxisWidget(e).setVisible(t),this._cachedStatus=null},r.prototype.resetPriceAxisOptimalWidth=function(e){this._priceAxisWidget(e).resetOptimalWidth(),this._cachedStatus=null},r.prototype.setSize=function(e){this.size&&this.size.equals(e)||(this.size=e,TradingView.setCanvasSize(this.canvas,e),TradingView.setCanvasSize(this.top_canvas,e),this.ctx=this.canvas.getContext("2d"),this.jqPane.width(e.w),this.jqPane.height(e.h),this._cachedStatus=null,this.jqRow.toggleClass("js-hidden",0===e.h))},r.prototype.dataSourceAtPoint=function(e,t){var i=null,r=null;if(!this._state)return null;for(var n=this._state.hitTestSources(),o=n.length;0<o--;){var a=n[o],s=a.paneViews(this._state);if(s)for(var l=s.length;0<l--;){var d=s[l].renderer();if(d&&d.hitTest){var h=d.hitTest(new MathEx.Point(e,t));if(h){var p=r?r.result():0;h.result()>p&&(r=h,i=a)}}}}if(this.containsMainSeries()){for(var c=this._chart.model().barsMarksSources(),o=0;o<c.length;++o)for(var d,u,a=c[o],s=a.paneViews(),l=0;l<s.length;l++)if(d=s[l].renderer(),u=d.hitTest(new MathEx.Point(e,t))){r=u,i=a;break}var _=this._chart.model().activeStrategySource().value(),f=_&&_._strategyOrdersPaneView;if(f){var g,v=f.renderer();v&&(g=v.hitTest(new MathEx.Point(e,t)))&&(r=g,i=_)}}return null===i&&(i=this.legendWidget.dataSourceAtPoint(e,t)),{source:i,hittest:r}},r.prototype.update=function(){this.lhsPriceAxisWidget.update(),this.rhsPriceAxisWidget.update(),this.legendWidget.update(),this.paneControls&&this.paneControls.update()},r.prototype.updateControls=function(){this.paneControls&&this.paneControls.update()},r.prototype.drawBackground=function(e,t){TradingView.clearRect(e,0,0,this.size.w,this.size.h,t)},r.prototype.drawGrid=function(e){for(var t=this._chart.model().gridSource(),i=t.paneViews(this._state),r=0;r<i.length;r++){e.save();var n=i[r].renderer();n&&n.draw(e),e.restore()}},r.prototype.drawWatermark=function(e){for(var t=this._chart.model().watermarkSource(),i=t.paneViews(this._state),r=0;r<i.length;r++){e.save();var n=i[r].renderer();n&&n.draw(e),e.restore()}},r.prototype.drawCrossHair=function(e){var t=this._chart.model().crossHairSource();!t.visible&&TradingView.drawingState.lockTimeAxis().value()&&(t.setLockedPosition(this._state),t.updateAllViews()),this._drawSource(t,e)},r.prototype._drawSource=function(e,t){var i=e.paneViews(this._state);if(i)for(var r=0;r<i.length;r++){var n=i[r].renderer();n&&(t.save(),n.draw(t),t.restore())}},r.prototype._drawSourceStrategyOrders=function(e,t){var i=e._strategyOrdersPaneView;if(i){var r=i.renderer();r&&(t.save(),r.draw(t),t.restore())}},r.prototype._drawSourceBackground=function(e,t){var i=e.paneViews(this._state);if(i)for(var r=0;r<i.length;r++){var n=i[r].renderer();n&&n.drawBackground&&(t.save(),n.drawBackground(t),t.restore())}},r.prototype.drawActiveLineTool=function(e){for(var t=[this._chart.model().lineBeingCreated(),this._chart.model().sourceBeingMoved(),this._chart.model().lineBeingEdited()],i=0;i<t.length;i++){var r=t[i];if(r){var n=this._chart.model().paneForSource(r);n===this._state&&this._drawSource(r,e)}}},r.prototype.disableDrawOnTop=function(e){return e&&e.hasOwnProperty("_metaInfo")&&"Volume@tv-basicstudies"===e._metaInfo.id},r.prototype.drawSources=function(e){var t=this._state.orderedSources(),i=this._state.model(),r=this._chart.model().hoveredSource(),n=i.crossHairSource(),o=[this._chart.model().lineBeingCreated(),this._chart.model().sourceBeingMoved(),this._chart.model().lineBeingEdited()];this.disableDrawOnTop(r)&&(r=void 0);for(var a=0;a<t.length;a++)this._drawSourceBackground(t[a],e);for(var a=0;a<t.length;a++){var s=t[a];s!==n&&s!==r&&-1===o.indexOf(s)&&this._drawSource(s,e)}r&&-1===o.indexOf(r)&&-1!==t.indexOf(r)&&this._drawSource(r,e);var l=this._chart.model().activeStrategySource().value();l&&this.containsMainSeries()&&this._drawSourceStrategyOrders(l,e)},r.prototype.recalculatePriceScale=function(){var e=this._state;e.recalculatePriceScale(e.m_rightPriceScale),e.recalculatePriceScale(e.m_leftPriceScale);for(var t=e.Q17(),i=0;i<t.length;++i){var r=t[i];e.isOverlay(r)&&(r instanceof p||e.recalculatePriceScale(r.priceScale()),r.updateAllViews())}},r.prototype.containsMainSeries=function(){return this._state.containsMainSeries()},r.prototype.drawBarsMarks=function(e,t){if(this.containsMainSeries()&&!t){var i=this._chart.model().barsMarksSources(),r=this;i.map(function(t){r._drawSource(t,e)})}},r.prototype._syncOverlays=function(){var e=this._state.orderedSources(),t={},i=this;$.each(e,function(){var e=this.paneViews(i._state);if(e)for(var r=0;r<e.length;r++){var n=e[r];n.uid&&(t[n.uid()]=n)}});for(var r in this._overlays)t[r]||(this._dv.remove(this._overlays[r]),this._overlays[r]=void 0);for(var r in t)if(!this._overlays[r]){var n=t[r].overlay();this._dv.append(n),this._overlays[r]=n}},r.prototype.paint=function(e,t){if(e&&this._chart.model())if(this.lhsPriceAxisWidget.paint(e),this.rhsPriceAxisWidget.paint(e),e===$21.FULL_UPDATE&&(this._cachedStatus=null),e===$21.UPDATE_CURSOR_ONLY)this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawCrossHair(this.top_ctx),this.drawActiveLineTool(this.top_ctx);else{var i=this.ctx;this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawBackground(i,this.backgroundColor()),this._state&&(this.recalculatePriceScale(),this.drawGrid(i),this.drawWatermark(i),this.drawSources(i),this.drawBarsMarks(i,t),this.drawCrossHair(this.top_ctx),this.drawActiveLineTool(this.top_ctx))}},r.prototype.leftPriceAxisWidget=function(){return this.lhsPriceAxisWidget},r.prototype.rightPriceAxisWidget=function(){return this.rhsPriceAxisWidget},r.prototype._priceAxisWidget=function(e){return l.isLeft(e)?this.lhsPriceAxisWidget:this.rhsPriceAxisWidget},r.prototype.statusWidget=function(){return this.legendWidget},r.prototype.onScaleLeft=function(e){var t=e.callbackContext();-1===this._state.leftPriceScale().Q17().indexOf(t)&&this.chart().model().move(t,this._state,this._state.leftPriceScale())},r.prototype.onScaleRight=function(e){var t=e.callbackContext();-1===this._state.rightPriceScale().Q17().indexOf(t)&&this.chart().model().move(t,this._state,this._state.rightPriceScale())},r.prototype.onNoScale=function(e){var t=e.callbackContext();this._state.isOverlay(t)||this.chart().model().move(t,this._state,null)},r.prototype.onRiskReward=function(e){e.callbackContext()},r.prototype.createActionTrade=function(e){if(!y.availableBrokers().length)return null;var t=this._state,i=t.Q17().filter(function(e){return e instanceof TradingView.Series})[0],r=y.chartContextMenuActions(i,e);return r&&0!==r.length?new TradingView.Action({text:$.t("Trading"),subActions:r}):null},r.prototype.createActionRiskReward=function(e){var t=new TradingView.Action({checkable:!1,text:$.t("Risk/Reward"),enabled:!0});return t.setCallbackContext(e),t.callbacks().subscribe(this,r.prototype.onRiskReward),t},r.prototype.createActionScaleLeft=function(e){var t=new TradingView.Action({checkable:!0,text:$.t("Scale Left"),enabled:!0});return t.setCallbackContext(e),t.setChecked(-1!==this._state.leftPriceScale().Q17().indexOf(e)),t.callbacks().subscribe(this,r.prototype.onScaleLeft),t},r.prototype.createActionScaleRight=function(e){var t=new TradingView.Action({checkable:!0,text:$.t("Scale Right"),enabled:!0});return t.setCallbackContext(e),t.setChecked(-1!==this._state.rightPriceScale().Q17().indexOf(e)),t.callbacks().subscribe(this,r.prototype.onScaleRight),t},r.prototype.createActionNoScale=function(e){var t=this._chart.model().paneForSource(e),i=t.actionNoScaleIsEnabled(e),n=new TradingView.Action({checkable:!0,text:$.t("Screen (No Scale)"),enabled:i});return n.setCallbackContext(e),n.setChecked(this._state.isOverlay(e)),n.callbacks().subscribe(this,r.prototype.onNoScale),n},r.prototype.createActionShowCountdown=function(e){var t=i(179).ActionBinder,r=new TradingView.Action({checkable:!0,text:$.t("Show Countdown"),enabled:!0}),n=this._chart.model().mainSeries().properties();return r._binding=new t(r,n.showCountdown,this._chart.model(),r.text),r._binding.setValue(n.showCountdown.value()),r},r.prototype.createActionLockScale=function(e){var t=i(179).ActionBinder;if(!(e instanceof TradingView.Series))return null;var r=new TradingView.Action({checkable:e.properties().lockScale.value(),text:$.t("Lock Scale"),enabled:!0}),n=function(t){this._undoModel.setLockScaleProperty(this._property,t.checked,e,this._undoText)};return r._binding=new t(r,e.properties().lockScale,this._chart.model(),r.text,n),r},r.prototype.createActionMergeUp=function(e){var t=this._chart.model().paneForSource(e),i=t!==this._chart.model().panes()[0];if(!i)return null;var n=new TradingView.Action({checkable:!1,text:$.t("Merge Up"),enabled:!0});return n.setCallbackContext(e),n.callbacks().subscribe(this,r.prototype.onMergeUp),n},r.prototype.onMergeUp=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().panes()[r-1],o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype.createActionUnmergeUp=function(e){var t=this._chart.model().paneForSource(e),i=t.Q17().filter(function(e){return TradingView.isInherited(e.constructor,g)&&e.showInObjectTree()}).length>1;if(!i)return null;var n=new TradingView.Action({checkable:!1,text:$.t("Unmerge Up"),enabled:!0});return n.setCallbackContext(e),n.callbacks().subscribe(this,r.prototype.onUnmergeUp),n},r.prototype.onUnmergeUp=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().createPane(r),o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype.createActionMergeDown=function(e){var t=this._chart.model().paneForSource(e),i=this._chart.model().panes(),n=t!==i[i.length-1];if(!n)return null;var o=new TradingView.Action({checkable:!1,text:$.t("Merge Down"),enabled:!0});return o.setCallbackContext(e),o.callbacks().subscribe(this,r.prototype.onMergeDown),o},r.prototype.onMergeDown=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().panes()[r+1],o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype.createActionUnmergeDown=function(e){var t=this._chart.model().paneForSource(e),i=t.Q17().filter(function(e){return TradingView.isInherited(e.constructor,g)&&e.showInObjectTree()}).length>1;if(!i)return null;var n=new TradingView.Action({checkable:!1,text:$.t("Unmerge Down"),enabled:!0});return n.setCallbackContext(e),n.callbacks().subscribe(this,r.prototype.onUnmergeDown),n},r.prototype.onUnmergeDown=function(e){var t=e.callbackContext(),i=this._chart.model().paneForSource(t),r=this._chart.model().panes().indexOf(i),n=this._chart.model().createPane(r+1),o=n.findSuitableScale(t);this._chart.model().move(t,n,o)},r.prototype._mergeContentMenuItems=function(e){var t=[],i=this.createActionMergeUp(e);i&&t.push(i);var i=this.createActionUnmergeUp(e);i&&t.push(i);var i=this.createActionMergeDown(e);i&&t.push(i);var i=this.createActionUnmergeDown(e);return i&&t.push(i),t},r.prototype.createActionShow=function(e){var t=i(179).ActionBinder,r=new TradingView.Action({checkable:!0,text:$.t("Show"),enabled:!0});return r._binding=new t(r,e.properties().visible,this._chart.model(),r.text),r._binding.setValue(e.properties().visible.value()),r},r.prototype.bringObjectForward=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().changeZOrder(t,1)},r.prototype.sendObjectToBack=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().sendToBack(t)},r.prototype.bringObjectToFront=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().bringToFront(t)},r.prototype.sendObjectBackward=function(e){var t=this._chart.model().selectedSource();t&&this._chart.model().changeZOrder(t,-1)},r.prototype.createVisualOrderAction=function(e){var t=new TradingView.Action({text:$.t("Visual Order")});t.subActions||(t.subActions=[]);var i=new TradingView.Action({text:$.t("Bring to Front")});i.callbacks().subscribe(this,r.prototype.bringObjectToFront),t.subActions.push(i);var n=new TradingView.Action({text:$.t("Send to Back")});n.callbacks().subscribe(this,r.prototype.sendObjectToBack),t.subActions.push(n);var o=new TradingView.Action({text:$.t("Bring Forward")});o.callbacks().subscribe(this,r.prototype.bringObjectForward),t.subActions.push(o);var a=new TradingView.Action({text:$.t("Send Backward")});a.callbacks().subscribe(this,r.prototype.sendObjectBackward),t.subActions.push(a);var s=this._chart.model().paneForSource(e),l=s.getZOrderMinMax();return n.setEnabled(!0),o.setEnabled(!0),a.setEnabled(!0),i.setEnabled(!0),e.zorder()===l.minZOrder&&(n.setEnabled(!1),a.setEnabled(!1)),e.zorder()===l.maxZOrder&&(o.setEnabled(!1),i.setEnabled(!1)),t},r.prototype._createActionAddAlert=function(e){function t(e){s.series=e}function r(e){s={drawing:e}}function n(e){void 0===e||null===e||TradingView.isNaN(e)||(l+=" ("+e+") ",s.value=e)}var a=this._chart,s={},l=$.t("Add Alert"),d=this._state;if(e.series){var h,p;if(e.series instanceof TradingView.Series)p=e.series.lastValueData(null,!0,!0);else if(e.series instanceof o){var c=e.series.metaInfo().plots[0].id;p=e.series.lastValueData(c,!0,!0)}if(p&&(h=p.price),h){var u=(e.series.priceScale()||this._state.mainDataSource().priceScale()||a.model().mainSeries().priceScale()).formatter();u.formatAsDecimal&&(h=u.formatAsDecimal(h)),n(h)}t(e.series)}else if(e.e){var _=d.defaultPriceScale(),f=_.coordinateToPrice(e.e.localY);if(_.isPercentage()){var g=this._state.mainDataSource().firstValue();f=void 0!==g?_.priceRange().convertFromPercent(f,g):null}n(this._state.mainDataSource().formatter().formatAsDecimal(f));var v=d.mainDataSource();t(v)}else e.drawing&&(l+=" "+$.t("on")+" "+$.t(e.drawing.title()),r(e.drawing));l+="...";var m=new TradingView.Action({text:l,shortcut:"Alt+A",doNotBindShortcut:!0});return m.callbacks().subscribe(null,function(){var e=i(28);runOrSignIn(function(){new e(s)},{source:"Alert add from pane context menu",sourceMeta:"Chart"})}),m},r.prototype.image=function(){var e={};return e.leftAxis=this.leftPriceAxisWidget().image(),e.rightAxis=this.rightPriceAxisWidget().image(),e.content=this.canvas.toDataURL(),e.contentWidth=this.size.w,
e.contentHeight=this.size.h,e},r.prototype._updateTooltip=function(e,t){if(!this._rafSet){var i=this;requestAnimationFrame(function(){i._updateTooltipImpl(e,t),i._rafSet=!1}),this._rafSet=!0}},r.prototype._updateTooltipImpl=function(e,t){function i(i){function n(){return TradingView.isMobile.any()?{left:e-r._tooltipSelector.outerWidth()-16,top:t-r._tooltipSelector.outerHeight()-16}:{left:e+16,top:t+16}}TradingView[a].getTooltipText&&(i=TradingView[a].getTooltipText(l)||i),r._tooltipSelector.html(i).removeClass("tooltip-selector-hidden").css(n())}if(this._chart){for(var r=this,n=this._chart.paneWidgets(),a=TradingView.drawingState.tool.value(),s=this._state.model(),l=s.lineBeingCreated(),d=n.length-1;d>=0;d--)n[d]._hideTooltip();o.isStudyLineTool(a)&&!TradingView.isMobile.any()?i($.t("Click to set a point")):TradingView.isMobile.any()&&"LineToolBrush"!=a&&r.isLineTool(a)&&!r._chart.model().lineBeingCreated()?i($.t("1. Slide your finger to select location for first anchor<br>2. Tap anywhere to place the first anchor")):TradingView.isMobile.any()&&"LineToolBrush"!=a&&r.isLineTool(a)&&i($.t("1. Slide your finger to select location for next anchor<br>2. Tap anywhere to place the next anchor"))}},r.prototype._hideTooltip=function(){this._tooltipSelector.addClass("tooltip-selector-hidden")},r.prototype._updateCrosshairOnZoom=function(){if(TradingView.drawingState.lockTimeAxis().value()){var e=this._chart.model(),t=e.crossHairSource();t.setPosition(t.index,t.price,this._state)}},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i="Change Chart Layout to "+q[t].title;o.call(this,i),this.Q3=e,this._newLayoutId=t,this._oldLayoutId=e.layout.value()}function n(e,t,i,r,n,o,s,l){this.Q2=l,this.m_model=new J(e,t,i,r,n,o,s,this,!!l._containsData),this.m_undoStack=new a,this.m_redoStack=new a,this.m_zoomStack=new a,this._onRearrangePanes=new Delegate,this._onSimpleZoomIn=new Delegate,this._onSimpleZoomOut=new Delegate}function o(e){this._text=e}function a(){this.m_commands=[],this._onChange=new Delegate}function s(e){o.call(this,e),this._subcommands=[]}function l(e,t,i,r){o.call(this,i),this._targetObj=e,this._newValue=t,this.Z98=r}function d(e,t,i,r,n){o.call(this,r),this._property=e,this._priceScale=i,this._newValue=t,this.Z98=n}function h(e,t,i,r,n){o.call(this,r),this._percentage=e,this._priceScale=i,this._newValue=t,this.Z98=n}function p(e,t,i,r,n){o.call(this,r),this._log=e,this._priceScale=i,this._newValue=t,this.Z98=n}function c(e,t,i,r,n,a){o.call(this,r),this._style=e,this._mainSeries=i,this._priceAxisProperties=i.properties().priceAxisProperties,this._newValue=t,this.Z98=n,this.Q2=a}function u(e,t,i,r,n){o.call(this,r),this._property=e,this._mainSeries=i,this._priceAxisProperties=i.properties().priceAxisProperties,this._newValue=t,this.Z98=n}function _(e,t,i,r){this.m_model=e,this.m_pane=t,this.m_priceScale=i,this.m_state=r,this.m_newPriceScaleState=null}function f(e,t,i){o.call(this,i),this.m_model=e,this.m_state=t,this.m_newTimeScaleState=null}function g(e,t,i,r){this.Z98=e,this._series=t,this._oldSymbol=t.symbol(),this._oldInterval=t.interval(),this._symbol=i,this._interval=r}function v(e,t,i,r){o.call(this,"Insert "+t.id),this.Z98=e,this._studyMetaInfo=t,this._props=i,this._isOverlay=r}function m(e,t){this.Z98=e,this.Z97=t}function y(e,t){this.Z98=e,this._linetools=t,this._statesByPaneIndexes={}}function w(e,t,i,r,n){this.Z98=e,this.Z97=t,this._scale=n,this._sources=[t].concat(this.Z98.children(t)),this._oldPane=i,this._oldPaneIndex=e.panes().indexOf(i),this._oldPaneState=this._oldPane.state(),this._oldScaleName=i.priceScaleName(t.priceScale()),this._pane=r,this._samePane=this._pane===this._oldPane}function T(e,t,i,r){o.call(this,"Create line "+t.toolname),this.Z98=e,this._line=t,this._paneIndex=e.panes().indexOf(i),this._points=[{point:r}]}function b(e,t,i,r){this.Z98=e,this.Z97=t,this._prevState=t.state(!0),this._nextState=this._prevState}function S(e,t,i,r){this.Z98=e,this.Z97=t,i instanceof MathEx.Point?this._origPoint=i.clone():this._origPoint=TradingView.clone(i),this._pointIndex=r}function C(e,t,i){o.call(this,"Change "+t.title()+" Z order"),this.Z98=e,this.Z97=t,this._shift=i}function x(e,t){o.call(this,"Change "+t.title()+" Z order"),this.Z98=e,this.Z97=t}function P(e,t){o.call(this,"Change "+t.title()+" Z order"),this.Z98=e,this.Z97=t}function L(e,t,i){o.call(this,"Remove pane"),this.Z98=e,this._index=t,this._pane=this.Z98.panes()[t],this._chart=i}function E(e,t,i,r){o.call(this,"Rearrange panes"),this.Z98=e,this._index=t,this._direction=i,this._chart=r}function V(e,t,i,r,n,o){this.Z98=e,this._startBar=t,this._endBar=i,this._startPrice=r,this._endPrice=n,this._pane=o}function I(e,t,i){this._baseCmd=e,this._zoomStack=t,this._inOut=i}function A(e,t,i,r,n){this.Z98=e,this._paneA=t,this._paneB=i,this._prevStretchA=r,this._currStretchA=n}function k(e,t){o.call(this,"Restore Defaults"),this.Z98=e,this._defaultProperty=t,this._state=t.state(t._exclusions),this.Q2=e._undoModel.Q2}function R(e,t){o.call(this,"Apply Chart Theme"),this.Z98=e,this._newChartProps=TradingView.factoryDefaults("chartproperties"),["candleStyle","hollowCandleStyle","haStyle"].forEach(function(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.paneProperties.vertGridProperties=t.chartProperties.paneProperties.vertGridProperties||t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.horzGridProperties=t.chartProperties.paneProperties.horzGridProperties||t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.legendProperties=this.Z98.properties().state().paneProperties.legendProperties,this._newChartProps=$.extend(!0,{},this._newChartProps,t.chartProperties),delete this._newChartProps.scalesProperties.showLeftScale,delete this._newChartProps.scalesProperties.showRightScale,delete this._newChartProps.scalesProperties.scaleSeriesOnly,delete this._newChartProps.scalesProperties.showSeriesLastValue,delete this._newChartProps.scalesProperties.showStudyLastValue,delete this._newChartProps.scalesProperties.showSymbolLabels,delete this._newChartProps.scalesProperties.showStudyPlotLabels,this._newSeriesProps=t.mainSourceProperties,this._newChartProps.symbolWatermarkProperties||(this._newChartProps.symbolWatermarkProperties=defaults("chartproperties.symbolWatermarkProperties"),this._newChartProps.symbolWatermarkProperties.color=this._newChartProps.scalesProperties.textColor),this._oldChartProps=e.properties().state(),delete this._oldChartProps.paneProperties.topMargin,delete this._oldChartProps.paneProperties.bottomMargin,this._oldSeriesProps=e.properties().state().mainSeriesProperties}function M(e,t){o.call(this,"Apply Drawing Template"),this.Z97=e,this._oldProps=e.properties().state();TradingView.factoryDefaults("linetoolvisibilities");this._newProps=t}function O(e,t,i,r){var r=" "+r||"",n=r+" Study template";o.call(this,n),this.Z98=e,this._oldProps=t,this._newProps=i}function D(e,t,i,r,n){this.Z98=e,this._pane=t,this._priceScale=i,this._topMargin=r,this._bottomMargin=n,this._oldTopMargin=i.topMargin(),this._oldBottomMargin=i.bottomMargin()}function B(e,t){this.Z98=e,this._range=t}function N(e,t,i,r,n){o.call(this,e),this._property=t,this._value=i,this._forceSetProperty=n,this._prevValue=t.value(),this._cw=r}function F(e,t){var i,r=t.priceScale(),n=[];r.isPercent()&&(i=t.firstValue());for(var o=0;o<e.length;o++){var a={offset:e[o].offset,time_t:e[o].time_t},s=e[o].price;r.isPercent()&&(s=r.priceRange().convertToPercent(s,i));var l=r.priceToCoordinate(s);l-=40,s=r.coordinateToPrice(l),r.isPercent()&&(s=r.priceRange().convertFromPercent(s,i)),a.price=s,n.push(a)}return n}function W(e,t){o.call(this,"clone "+t.title()),this.Z98=e,this.Z97=t,this._points=[]}function H(e,t,i){o.call(this,i),this._wv=e,this._newValue=t,this._oldValue=e.value()}function z(e,t){this.Z98=e,this.Z97=t.id(),this._linkKey=t.linkKey}function U(e,t,i){o.call(this,"Paste"),this._chartModel=e,this._sourceState=t,this._paneIndex=this._chartModel.panes().indexOf(i||this._chartModel.paneForSource(this._chartModel.mainSeries()))}function G(e,t){this._chartModel=e,this._sourceState=t}var j=i(3),q=i(2),Y=i(6),K=i(13).LineDataSource,X=i(59),J=i(49),Z=function(){function e(e){d&&t(),d=new s(e)}function t(){if(d){var e=d;d=null,e.isEmpty()||n(e)}}function i(){if(h.isEmpty())return!1;var e=h.pop();return e.undo(),p.push(e),!0}function r(){if(p.isEmpty())return!1;var e=p.pop();return e.redo(),h.push(e),!0}function n(e){return d?void d.addCommand(e):(p.clear(),void h.push(e))}function o(){var e=h.isEmpty()?null:h.head();return{lastActualCommand:e}}function l(e){for(;!h.isEmpty()&&e.lastActualCommand!==h.head();)h.pop().undo();p.clear()}var d=null,h=new a,p=new a;return{beginUndoMacro:e,endUndoMacro:t,undo:i,redo:r,pushUndoCommand:n,createUndoCheckpoint:o,undoToCheckpoint:l,undoStack:function(){return h},redoStack:function(){return p},clearStack:function(){h.clear(),p.clear()}}}();Z.setChartLayout=function(e,t){if(e.layout.value()===t)return!1;var i=new r(e,t);i.redo(),this.pushUndoCommand(i)},inherit(r,o),r.prototype.redo=function(){this.Q3.layout.setValue(this._newLayoutId)},r.prototype.undo=function(){this.Q3.layout.setValue(this._oldLayoutId)},inherit(n,EventEmitter),n.prototype.version=function(){return this.m_model._version},n.prototype.onData=function(e){switch(e.method){case"timescale_update":var t=e.params;this.m_model.updateTimeScale(t.index,t.zoffset,t.changes,t.marks,t.clear)}},n.prototype.paneForSource=function(e){return this.m_model.paneForSource(e)},n.prototype.createPane=function(e){return this.m_model.createPane(e)},n.prototype.dumpViews=function(){return this.m_model.dumpViews()},n.prototype.readOnly=function(){return this.m_model.readOnly()},n.prototype.restart=function(){this.m_model.restart()},n.prototype.disconnect=function(){this.m_model.disconnect()},n.prototype.studiesMetaData=function(){return this.m_model.studiesMetaData()},n.prototype.studyVersioning=function(){return this.m_model.studyVersioning()},n.prototype.chartModel=function(){return this.m_model},n.prototype.undoStack=Z.undoStack,n.prototype.redoStack=Z.redoStack,n.prototype.undo=Z.undo,n.prototype.redo=Z.redo,n.prototype.pushUndoCommand=Z.pushUndoCommand,n.prototype.startScalePrice=function(e,t,i){this.pushUndoCommand(new _(this.m_model,e,t,t.state())),this.chartModel().startScalePrice(e,t,i)},n.prototype.scalePriceTo=function(e,t,i){this.chartModel().scalePriceTo(e,t,i)},n.prototype.endScalePrice=function(e,t){this.chartModel().endScalePrice(e,t)},n.prototype.startScrollPrice=function(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(e,t,i))},n.prototype.scrollPriceTo=function(e,t,i){t.isAutoScale()||(this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this.pushUndoCommand(new _(this.m_model,e,t,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(e,t,i))},n.prototype.endScrollPrice=function(e,t){t.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(e,t))},n.prototype.setPriceAutoScale=function(e,t,i){this.pushUndoCommand(new _(this.m_model,e,t,t.state())),this.chartModel().setPriceAutoScale(e,t,i)},n.prototype.resetPriceScale=function(e,t){this.pushUndoCommand(new _(this.m_model,e,t,t.state())),this.chartModel().resetPriceScale(e,t)},n.prototype.startScaleTime=function(e){this.pushUndoCommand(new f(this.m_model,this.m_model.timeScale().state(),"scale time")),this.chartModel().startScaleTime(e)},n.prototype.scaleTimeTo=function(e){this.chartModel().scaleTimeTo(e)},n.prototype.endScaleTime=function(){this.chartModel().endScaleTime()},n.prototype.startScrollTime=function(e){this._initialTimeScrollState=this.m_model.timeScale().state(),this._initialTimeScrollPos=e,this.chartModel().startScrollTime(e)},n.prototype.scrollTimeTo=function(e){this._initialTimeScrollPos&&Math.abs(e-this._initialTimeScrollPos)>20&&(this.pushUndoCommand(new f(this.m_model,this._initialTimeScrollState,"scroll time")),delete this._initialTimeScrollPos,delete this._initialTimeScrollState),this.chartModel().scrollTimeTo(e)},n.prototype.endScrollTime=function(){this.chartModel().endScrollTime(),delete this._initialTimeScrollPos,delete this._initialTimeScrollState},n.prototype.resetTimeScale=function(){this.pushUndoCommand(new f(this.m_model,this.m_model.timeScale().state())),this.chartModel().resetTimeScale()},n.prototype.canZoomIn=function(){return this.chartModel().canZoomIn()},n.prototype.canZoomOut=function(){return this.chartModel().canZoomOut()},n.prototype.setWidth=function(e){this.m_model.setWidth(e)},n.prototype.setPaneHeight=function(e,t){this.m_model.setPaneHeight(e,t)},n.prototype.gridSource=function(){return this.m_model.gridSource()},n.prototype.watermarkSource=function(){return this.m_model.watermarkSource()},n.prototype.addAlertsSource=function(e){return this.m_model.addAlertsSource(e)},n.prototype.alertsSources=function(){return this.m_model.alertsSources()},n.prototype.publishedChartsTimelineSource=function(){return this.m_model.publishedChartsTimelineSource()},n.prototype.barsMarksSources=function(){return this.m_model.barsMarksSources()},n.prototype.crossHairSource=function(){return this.m_model.crossHairSource()},n.prototype.model=function(){return this.m_model},n.prototype.mainSeries=function(){return this.m_model.m_mainSeries},n.prototype.panes=function(){return this.m_model.m_panes},n.prototype.timeScale=function(){return this.m_model.timeScale()},n.prototype.setSelectedSource=function(e,t){this.m_model.setSelectedSource(e,t)},n.prototype.setHoveredSource=function(e,t){this.m_model.setHoveredSource(e,t)},n.prototype.selectedSource=function(){return this.m_model.selectedSource()},n.prototype.onSelectedSourceChanged=function(){return this.m_model.onSelectedSourceChanged()},n.prototype.hoveredSource=function(){return this.m_model.hoveredSource()},n.prototype.activeStrategySource=function(){return this.m_model.activeStrategySource()},n.prototype.Q18=function(e){this.m_model.Q18(e)},n.prototype.setCurrentPosition=function(e,t,i,r){this.m_model.setCurrentPosition(e,t,i,r)},n.prototype.modifySeries=function(e,t,i){var r=new g(this.m_model,e,t,i);this.pushUndoCommand(r),r.redo()},n.prototype.insertStudy=function(e,t,i){if(!this.model()._chartApi._chartApi.isCanCreateStudy())return void $82.showTooManyStudiesNotice();if(TradingView.Q16("indicators_limit")&&!user.is_pro&&this.m_model.countUserStudies()>=j.FREE_STUDY_LIMIT)return void $82.showGoProDialog({feature:"studyLimit"});if(TradingView.Q16("backtesting")||!e.isTVScriptStrategy){var r=new v(this.m_model,e,t,i);return this.pushUndoCommand(r),r.redo()}},n.prototype.setProperty=function(e,t,i){if(e&&e.value()!==t){var r=new l(e,t,i,this.m_model);this.pushUndoCommand(r),r.redo(),this.emitEvent("setProperty")}},n.prototype.setPercentProperty=function(e,t,i,r){if(e.value()!==t){var n=new h(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setLogProperty=function(e,t,i,r){if(e.value()!==t){var n=new p(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setAutoScaleProperty=function(e,t,i,r){if(e.value()!==t){var n=new d(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setChartStyleProperty=function(e,t,i){if(e.value()!==t){var r=new c(e,t,this.mainSeries(),i,this.m_model,this.Q2);this.pushUndoCommand(r),r.redo(),this.emitEvent("setChartStyleProperty")}},n.prototype.setLockScaleProperty=function(e,t,i,r){if(e.value()!==t){var n=new u(e,t,i,r,this.m_model);this.pushUndoCommand(n),n.redo()}},n.prototype.setScreenChartProperty=function(e,t,i,r,n){if(n||e.value()!==t){var o=new N(r,e,t,i,n);this.pushUndoCommand(o),o.redo()}},n.prototype.beginUndoMacro=Z.beginUndoMacro,n.prototype.endUndoMacro=Z.endUndoMacro,n.prototype.createUndoCheckpoint=Z.createUndoCheckpoint,n.prototype.undoToCheckpoint=Z.undoToCheckpoint,n.prototype.removeSource=function(e,t){var i=t||!1;if(e.isUserDeletable()){var r=new m(this.m_model,e);this.pushUndoCommand(r),r.redo(),i||this.emitEvent("removeSource",[e])}},n.prototype.removeSelectedSource=function(){var e=this.m_model.selectedSource();if(e&&e.isUserDeletable()){this.setSelectedSource(null);var t=new m(this.m_model,e);this.pushUndoCommand(t),t.redo(),this.emitEvent("removeSource",[e])}},n.prototype.removeLineTools=function(e){var t=new y(this.m_model,e);this.pushUndoCommand(t),t.redo()},n.prototype.move=function(e,t,i){var r=this.m_model.paneForSource(e),n=new w(this.m_model,e,r,t,i);this.pushUndoCommand(n),n.redo(),this.emitEvent("moveSource",[e])},n.prototype.createLineTool=function(e,t,i,r,n){if("LineToolRegressionTrend"==i&&!this.model()._chartApi._chartApi.isCanCreateStudy())return void $82.showTooManyStudiesNotice();var o=this.m_model.createLineTool(e,t,i,r,n);return this._createLineCommand=new T(this.m_model,o,e,t),this.m_model.lineBeingCreated()||(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),o},n.prototype.lineBeingCreated=function(){return this.m_model.lineBeingCreated()},n.prototype.paneBeingCreatedLineOn=function(){return this.m_model.paneBeingCreatedLineOn()},n.prototype.coninueCreatingLine=function(e,t,i){var r=(this.m_model.lineBeingCreated(),this.m_model.paneBeingCreatedLineOn(),this.m_model.coninueCreatingLine(e,t,i));return this._createLineCommand.coninueCreatingLine(e,t),r&&(this.pushUndoCommand(this._createLineCommand),delete this._createLineCommand),r},n.prototype.finishLineTool=function(e){this.m_model.finishLineTool(e)},n.prototype.cancelCreatingLine=function(){this.m_model.cancelCreatingLine()},n.prototype.lineCancelled=function(){return this.m_model.lineCancelled()},n.prototype.startChangingLinetool=function(e,t,i,r){this._currentLineChangeCommand=new b(this.m_model,e,i,r),this.m_model.startChangingLinetool(e,t,i,r)},n.prototype.lineBeingEdited=function(){return this.m_model.lineBeingEdited()},n.prototype.changeLinePoint=function(e,t){this._currentLineChangeCommand.setPoint(e,t),this.m_model.changeLinePoint(e,t)},n.prototype.endChangingLinetool=function(e){this.m_model.endChangingLinetool(e),this._currentLineChangeCommand.endChanging(),this.pushUndoCommand(this._currentLineChangeCommand),this._currentLineChangeCommand=null},n.prototype.startMovingSource=function(e,t,i){this._currentLineMoveCommand=new S(this.m_model,e,t,i),this.m_model.startMovingSource(e,t,i)},n.prototype.sourceBeingMoved=function(){return this.m_model.sourceBeingMoved()},n.prototype.moveSource=function(e){this._currentLineMoveCommand.setPoint(e),this.m_model.moveSource(e)},n.prototype.endMovingSource=function(e){this.m_model.endMovingSource(e),this._currentLineMoveCommand._point&&(this.pushUndoCommand(this._currentLineMoveCommand),this._currentLineChangeCommand=null)},n.prototype.Q17=function(){return this.m_model.Q17()},n.prototype.state=function(e,t){return this.m_model.state(e,t)},n.prototype.asyncState=function(e){return this.m_model.asyncState(e)},n.prototype.restoreState=function(e,t){return this.m_model.restoreState(e,t)},n.prototype.calculateDefaultTags=function(){return this.m_model.calculateDefaultTags()},n.prototype.onTagsChanged=function(){return this.m_model.onTagsChanged()},n.prototype.changeZOrder=function(e,t){var i=new C(this.m_model,e,t);this.pushUndoCommand(i),i.redo(),this.emitEvent("changeZOrder",[e,t])},n.prototype.sendToBack=function(e){var t=new x(this.m_model,e);this.pushUndoCommand(t),t.redo(),this.emitEvent("changeZOrder",[e])},n.prototype.bringToFront=function(e){var t=new P(this.m_model,e);this.pushUndoCommand(t),t.redo(),this.emitEvent("changeZOrder",[e])},n.prototype.removeAllStudies=function(){this.beginUndoMacro("remove all studies");for(var e=this.m_model.Q17(),t=0;t<e.length;t++){var i=e[t];TradingView.isInherited(i.constructor,TradingView.Study)&&i.removeByRemoveAllStudies()&&this.removeSource(i)}this.endUndoMacro()},n.prototype.removeAllDrawingTools=function(e){this.beginUndoMacro("remove all drawing tools");for(var t=this.m_model.Q17(),i=0;i<t.length;i++){var r=t[i];TradingView.isInherited(r.constructor,K)&&r.isActualSymbol()&&r.isUserDeletable()&&(e&&e!=r._constructor||this.removeSource(r))}this.endUndoMacro()},n.prototype.unlinkLine=function(e){var t=new z(this.m_model,e);this.pushUndoCommand(t),t.redo()},n.prototype.copyToOtherCharts=function(e){this.m_model.copyToOtherCharts(e)},n.prototype.moveDown=function(){try{this.beginUndoMacro("Move Down")}catch(e){return}var t=this,i=this.m_model.mainSeries(),r=this.m_model.paneForSource(i),n=r.priceScaleForSource(i);n.setAutoScale(!1);var o=n.height();TradingView.animate(o/5,function(e){t.startScrollPrice(r,n,0),t.scrollPriceTo(r,n,e),t.endScrollPrice(r,n)},function(){t.endUndoMacro()})},n.prototype.moveUp=function(){try{this.beginUndoMacro("Move Up")}catch(e){return}var t=this,i=this.m_model.mainSeries(),r=this.m_model.paneForSource(i),n=r.priceScaleForSource(i);n.setAutoScale(!1);var o=n.height();TradingView.animate(o/5,function(e){t.startScrollPrice(r,n,e),t.scrollPriceTo(r,n,0),t.endScrollPrice(r,n)},function(){t.endUndoMacro()})},n.prototype.moveLeft=function(){try{this.beginUndoMacro("Move Left")}catch(e){return}var t=this.m_model.timeScale().width(),i=this;TradingView.animate(t/5,function(e){i.startScrollTime(e),i.scrollTimeTo(0),i.endScrollTime()},function(){i.endUndoMacro()})},n.prototype.moveRight=function(){try{this.beginUndoMacro("Move Right")}catch(e){return}var t=this.m_model.timeScale().width(),i=this;TradingView.animate(t/5,function(e){i.startScrollTime(0),i.scrollTimeTo(e),i.endScrollTime()},function(){i.endUndoMacro()})},n.prototype.scrollChart=function(e){this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime()},n.prototype.scrollChartByBar=function(e){var t=e*this.m_model.timeScale().barSpacing();this.startScrollTime(0),this.scrollTimeTo(t),this.endScrollTime()},n.prototype.zoomIn=function(e,t){var i=this.m_model.timeScale().width(),r=this;if(t=t||1,this.canZoomIn())if(e){var n=t*i/10,o=n*((e+1)/2);this.startScaleTime(n),this.scaleTimeTo(0),this.endScaleTime(),this.startScrollTime(0),this.scrollTimeTo(n-o),this.endScrollTime(),this._onSimpleZoomIn.fire()}else{try{this.beginUndoMacro("Zoom In")}catch(a){return}TradingView.animate(i/5,function(e){r.startScaleTime(e),r.scaleTimeTo(0),r.endScaleTime()},function(){r.endUndoMacro(),r._onSimpleZoomIn.fire()})}},n.prototype.zoomOut=function(e,t){var i=this.m_model.timeScale().width(),r=this;if(t=t||1,this.canZoomOut())if(e)this.startScaleTime(0),this.scaleTimeTo(t*i/10),this.endScaleTime(),this.startScrollTime(t*(i/20-i/20*e)),this.scrollTimeTo(0),this.endScrollTime(),this._onSimpleZoomOut.fire();else{try{this.beginUndoMacro("Zoom Out")}catch(n){return}TradingView.animate(i/5,function(e){r.startScaleTime(0),r.scaleTimeTo(e),r.endScaleTime()},function(){r.endUndoMacro(),r._onSimpleZoomOut.fire()})}},n.prototype.resetScales=function(){this.beginUndoMacro("Reset scales"),this.resetTimeScale();for(var e=0;e<this.panes().length;e++){var t=this.panes()[e];this.resetPriceScale(t,t.leftPriceScale()),this.resetPriceScale(t,t.rightPriceScale())}this.endUndoMacro(),this.m_model.recalculateAllPanes()},n.prototype.zoomToViewport=function(e,t,i,r,n){var o=new V(this.m_model,e,t,i,r,n),a=new I(o,this.m_zoomStack,!0);a.redo(),this.pushUndoCommand(a)},n.prototype.zoomFromViewport=function(){var e=new I(this.m_zoomStack.head(),this.m_zoomStack,!1);e.redo(),this.pushUndoCommand(e)},n.prototype.zoomStack=function(){return this.m_zoomStack},n.prototype.addPaneStretchFactorUndoCommand=function(e,t,i,r){var n=new A(this.m_model,e,t,i,r);this.pushUndoCommand(n)},n.prototype.restoreFactoryDefaults=function(e){var t=new k(this.m_model,e);t.redo(),this.pushUndoCommand(t)},n.prototype.chartLoadTheme=function(e,t){var i=new R(e,t);i.redo(),this.pushUndoCommand(i)},n.prototype.drawingLoadTemplate=function(e,t){var i=new M(e,t);i.redo(),this.pushUndoCommand(i)},n.prototype.studyLoadTemplate=function(e,t,i,r){var n=new O(e,t,i,r);n.redo(),this.pushUndoCommand(n)},n.prototype.onRearrangePanes=function(){return this._onRearrangePanes},n.prototype.onSimpleZoomIn=function(){return this._onSimpleZoomIn},n.prototype.onSimpleZoomOut=function(){return this._onSimpleZoomOut},n.prototype.loadRange=function(e){e.res!==this.m_model.mainSeries().properties().interval.value()?(this.m_model.mainSeries()._pendingInterval=e.val,this.setProperty(this.m_model.mainSeries().properties().interval,e.res,"Change date range")):this.m_model.mainSeries().loadDataTo(e.val)},n.prototype.cloneLineTool=function(e){var t=new W(this.m_model,e);t.redo(),this.pushUndoCommand(t),this.emitEvent("cloneLineTool")},n.prototype._preparePriceAxisProperties=function(e,t){var i=e.lockScale.value(),r=e.style.value()==TradingView.Series.STYLE_PNF;(r||i)&&(t.log.setValue(!1),t.percentage.setValue(!1)),t.logDisabled.setValue(!(!r&&!i)),t.percentageDisabled.setValue(!(!r&&!i))},n.prototype.alertsList=function(){return this.m_model.alertsList()},n.prototype.alertsListChanged=function(){return this.m_model.alertsListChanged()},n.prototype.insertStudyStub=function(e){return this.m_model.insertStudyStub(e)},n.prototype.removeStudyStub=function(e){return this.m_model.removeStudyStub(e)},n.prototype.isJustClonedChart=function(){return this.Q2.isJustClonedChart()},n.prototype.copySourceToClip=function(e){if(e&&!e.properties().blockCopying){var t={};if(e instanceof K)t.type="drawing",t.geometry=e.geometry();else{if(!(e instanceof TradingView.Study))return!1;t.type="study"}return t.source=e.state&&e.state(),delete t.source.alertId,delete t.source.linkKey,t.source?(t.title=e.title&&e.title(),t.modelId=this.m_model._id,TradingView.AppClipboard.set(t),!0):!1}},n.prototype.cutSourceToClip=function(e){var t=this.copySourceToClip(e);return t?void this.removeSource(e):!1},n.prototype.pasteLineTool=function(e,t){var i=new U(this,t,e);this.pushUndoCommand(i),i.redo()},n.prototype.pasteStudy=function(e){var t=new G(this,e);this.pushUndoCommand(t),t.redo()},n.prototype.pasteSourceFromClip=function(e,t){var i=TradingView.AppClipboard.get();return i?(i.source.id=TradingView.guid(),"drawing"==i.type&&this.pasteLineTool(e,i),void("study"==i.type&&this.pasteStudy(i))):!1},o.prototype.text=function(){return this._text},o.prototype.undo=function(){throw"pure virtual call ;)"},o.prototype.redo=function(){throw"pure virtual call ;)"},a.prototype.onChange=function(){return this._onChange},a.prototype.isEmpty=function(){return 0===this.m_commands.length},a.prototype.clear=function(){this.m_commands.length=0,this._onChange.fire()},a.prototype.push=function(e){if(!(e instanceof o))throw new TypeError("argument must be an instance of UndoCommand");this.m_commands.push(e),this._onChange.fire()},a.prototype.pop=function(){if(this.isEmpty())return void TradingView.logDebugChart("UndoStack.pop: undo stack is empty");var e=this.m_commands.pop();return this._onChange.fire(),e},a.prototype.head=function(){return this.isEmpty()?void TradingView.logDebugChart("UndoStack.head: undo stack is empty"):this.m_commands[this.m_commands.length-1]},inherit(s,o),s.prototype.addCommand=function(e){this._subcommands.push(e)},s.prototype.isEmpty=function(){return 0===this._subcommands.length},s.prototype.redo=function(){for(var e=0;e<this._subcommands.length;e++)this._subcommands[e].redo()},s.prototype.undo=function(){for(var e=this._subcommands.length-1;e>=0;e--)this._subcommands[e].undo()},inherit(l,o),l.prototype.redo=function(){this._oldValue=this._targetObj.value(),TradingView.saveDefaultProperties(!0),this._targetObj.setValue(this._newValue),TradingView.saveDefaultProperties(!1),this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},l.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._targetObj.setValue(this._oldValue),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(d,o),d.prototype.redo=function(){this._oldValue=this._property.value(),this._oldLockScaleValue=this._priceScale.mainSource()instanceof TradingView.Series?this._priceScale.mainSource().properties().lockScale.value():void 0,TradingView.saveDefaultProperties(!0),this._property.setValue(this._newValue),this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(!1),TradingView.saveDefaultProperties(!1),this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},d.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._property.setValue(this._oldValue),this._oldLockScaleValue&&this._newValue&&this._priceScale.mainSource().properties().lockScale.setValue(this._oldLockScaleValue),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(h,o),h.prototype.redo=function(){this._oldValue=this._percentage.value(),this._oldAutoScaleValue=this._priceScale.properties().autoScale.value(),this._oldLogValue=this._priceScale.properties().log.value(),this._oldLogDisabled=this._priceScale.properties().logDisabled.value(),TradingView.saveDefaultProperties(!0),this._percentage.setValue(this._newValue),this._priceScale.properties().autoScaleDisabled.setValue(this._newValue),this._priceScale.properties().log.setValue(!1),TradingView.saveDefaultProperties(!1),this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},h.prototype.undo=function(){if(TradingView.saveDefaultProperties(!0),this._percentage.setValue(this._oldValue),this._priceScale.properties().autoScale.setValue(this._oldAutoScaleValue),this._priceScale.properties().autoScaleDisabled.setValue(this._oldValue),this._priceScale.properties().log.setValue(this._oldLogValue),!(this._oldAutoScaleValue||this._priceScale.mainSource()instanceof TradingView.Series&&this._priceScale.mainSource().isLockScale())){var e=this.Z98.timeScale().visibleBars();this._priceScale.setPriceRange(this._priceScale.priceRange().convertFromPercents(this._priceScale.mainSource().close(e.firstBar())))}TradingView.saveDefaultProperties(!1),this._oldValue=null,this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(p,o),p.prototype.redo=function(){this._oldValue=this._log.value(),this._oldPercValue=this._priceScale.properties().percentage.value(),this._oldPercDisabled=this._priceScale.properties().percentageDisabled.value(),TradingView.saveDefaultProperties(!0),this._log.setValue(this._newValue),this._priceScale.properties().percentage.setValue(!1),this._priceScale.properties().autoScaleDisabled.setValue(this._priceScale.properties().percentage.value()),TradingView.saveDefaultProperties(!1),this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},p.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._log.setValue(this._oldValue),this._priceScale.properties().percentage.setValue(this._oldPercValue),
TradingView.saveDefaultProperties(!1),this._oldValue=null,this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(c,o),c.prototype.redo=function(){var e=$.Deferred().resolve();this._mainSeries.Q0.style===this._style&&this.Z98.mainSeries().isNeedRestart(this._newValue)&&(e=this.Q2.screen.show()),e.done(function(){this._oldValue=this._style.value(),this._oldAutoScale=this._priceAxisProperties.autoScale.value(),this._oldLogValue=this._priceAxisProperties.log.value(),this._oldLogDisabled=this._priceAxisProperties.logDisabled.value(),this._oldPercentageValue=this._priceAxisProperties.percentage.value(),this._oldPercentageDisabled=this._priceAxisProperties.percentageDisabled.value(),TradingView.saveDefaultProperties(!0),this._style.setValue(this._newValue),this.Q2.model()._preparePriceAxisProperties(this._mainSeries.properties(),this._priceAxisProperties),TradingView.saveDefaultProperties(!1),this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))}.bind(this))},c.prototype.undo=function(){var e=$.Deferred().resolve();this._mainSeries.Q0.style===this._style&&this.Z98.mainSeries().isNeedRestart(this._newValue)&&(e=this.Q2.screen.show()),e.done(function(){TradingView.saveDefaultProperties(!0),this._style.setValue(this._oldValue),this._priceAxisProperties.log.setValue(this._oldLogValue),this._priceAxisProperties.logDisabled.setValue(this._oldLogDisabled),this._priceAxisProperties.percentage.setValue(this._oldPercentageValue),this._priceAxisProperties.percentageDisabled.setValue(this._oldPercentageDisabled),this._priceAxisProperties.autoScale.setValue(this._oldAutoScale),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))}.bind(this))},inherit(u,o),u.prototype.redo=function(){this._oldValue=this._property.value(),this._oldAutoScale=this._priceAxisProperties.autoScale.value(),this._oldPercentage=this._priceAxisProperties.percentage.value(),this._oldLog=this._priceAxisProperties.log.value(),TradingView.saveDefaultProperties(!0),this._newValue&&(this._priceAxisProperties.percentage.setValue(!1),this._priceAxisProperties.log.setValue(!1),this._priceAxisProperties.autoScale.setValue(!1));var e=this._mainSeries.properties().style.value();e!==TradingView.Series.STYLE_RENKO&&e!==TradingView.Series.STYLE_KAGI&&e!==TradingView.Series.STYLE_PNF&&e!==TradingView.Series.STYLE_PB&&this._mainSeries.fixBoxSize(),this._property.setValue(this._newValue),TradingView.saveDefaultProperties(!1),this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},u.prototype.undo=function(){TradingView.saveDefaultProperties(!0),this._priceAxisProperties.percentage.setValue(this._oldPercentage),this._priceAxisProperties.log.setValue(this._oldLog),this._priceAxisProperties.autoScale.setValue(this._oldAutoScale),this._property.setValue(this._oldValue),TradingView.saveDefaultProperties(!1),this._oldValue=null,this.Z98&&(this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE)))},inherit(_,o),_.prototype.undo=function(){return null!==this.m_newPriceScaleState?void TradingView.logDebugChart("PriceScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newPriceScaleState=this.m_priceScale.state(),this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_state),void this.m_priceScale.recalcLockedScale(null))},_.prototype.redo=function(){return null===this.m_newPriceScaleState?void TradingView.logDebugChart("PriceScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restorePriceScaleState(this.m_pane,this.m_priceScale,this.m_newPriceScaleState),void(this.m_newPriceScaleState=null))},inherit(f,o),f.prototype.undo=function(){return null!==this.m_newTimeScaleState?void TradingView.logDebugChart("TimeScaleChangeUndoCommand.undo: Command is already undone"):(this.m_newTimeScaleState=this.m_model.timeScale().state(),this.m_model.restoreTimeScaleState(this.m_state),void this.m_model.timeScale().recalcLockedScale())},f.prototype.redo=function(){return null===this.m_newTimeScaleState?void TradingView.logDebugChart("TimeScaleChangeUndoCommand.redo: Command is not undone"):(this.m_model.restoreTimeScaleState(this.m_newTimeScaleState),void(this.m_newTimeScaleState=null))},inherit(g,o),g.prototype.redo=function(){this.Z98.modifySeries(this._series,this._symbol,this._interval)},g.prototype.undo=function(){this.Z98.modifySeries(this._series,this._oldSymbol,this._oldInterval)},inherit(v,o),v.prototype.redo=function(){return this.Z99=this.Z98.insertStudy(this._studyMetaInfo,this._props,this._isOverlay),this.Z99},v.prototype.undo=function(){this.Z98.removeSource(this.Z99)},inherit(m,o),m.prototype.redo=function(){this._sourceState=this.Z97.state();var e=this.Z98.paneForSource(this.Z97);this._paneIndex=this.Z98.panes().indexOf(e),this._priceScaleName=e.priceScaleName(this.Z97.priceScale());var t=this.Z98.children(this.Z97);this._removeChildUndoCommands=[];for(var i=0;i<t.length;i++){var r=t[i],n=new m(this.Z98,r);this._removeChildUndoCommands.push(n),n.redo()}this._paneState=e.state(),this._restorePane=this.Z98.removeSource(this.Z97),this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.FULL_UPDATE,!0)),delete this.Z97},m.prototype.undo=function(){this.Z97=this.Z98.restoreSource(this._restorePane,this._paneIndex,this._paneState,this._sourceState,this._priceScaleName);for(var e=this._removeChildUndoCommands.length-1;e>=0;e--){var t=this._removeChildUndoCommands[e];t.undo()}this._removeChildUndoCommands.length=0},inherit(y,o),y.prototype.redo=function(){for(var e=0;e<this._linetools.length;e++){var t=this.Z98.paneForSource(this._linetools[e]),i=this.Z98.panes().indexOf(t);this._statesByPaneIndexes[i]=this._statesByPaneIndexes[i]||[],this._statesByPaneIndexes[i].push({state:this._linetools[e].state(),owner:this._linetools[e].ownerSource().id()}),t.removeDataSource(this._linetools[e])}delete this._linetools},y.prototype.undo=function(){this._linetools=[];for(var e in this._statesByPaneIndexes)for(var t=this.Z98.panes()[e],i=this._statesByPaneIndexes[e],r=0;r<i.length;r++){var n=i[r],o=this.Z98.dataSourceForId(n.owner),a=t._restoreLineTool(n.state);a.setOwnerSource(o),a.updateAllViews(),this._linetools.push(a)}this.Z98.Q18(new $21(j.LIGHT_UPDATE))},inherit(w,o),w.prototype.redo=function(){this.Z98.move(this.Z97,this._pane,this._scale)},w.prototype.undo=function(){var e=!1;if(this._samePane)this._oldPane.restoreState(this._oldPaneState);else{for(var t=0;t<this._sources.length;t++)this.Z98.detachSource(this._sources[t]);if(-1!==this.Z98.panes().indexOf(this._oldPane)){for(var i=this._oldPane.priceScaleByName(this._oldScaleName),t=0;t<this._sources.length;t++)this._oldPane.addDataSource(this._sources[t],i);this._oldPane.restoreState(this._oldPaneState)}else{this._oldPane=this.Z98.createPane(this._oldPaneIndex);for(var i=this._oldPane.priceScaleByName(this._oldScaleName),t=0;t<this._sources.length;t++)this._oldPane.addDataSource(this._sources[t],i);e=!0}}this.Z98.recalculateAllPanes(),e&&this.Z98.Q18(new $21(j.FULL_UPDATE))},inherit(T,o),T.prototype.coninueCreatingLine=function(e,t){this._points.push({point:e,envState:t})},T.prototype.undo=function(){this.Z98.removeSource(this._line)},T.prototype.redo=function(){var e=this.Z98.panes()[this._paneIndex];this._line=this.Z98.createLineTool(e,this._points[0].point,this._line.toolname);for(var t=1;t<this._points.length;t++)this.Z98.coninueCreatingLine(this._points[t].point,this._points[t].envState)},inherit(b,o),b.prototype.setPoint=function(e){this._nextState=this.Z97.state(!0)},b.prototype.endChanging=function(){this._nextState=this.Z97.state(!0)},b.prototype.undo=function(){var e=this.Z97,t=this._prevState;this.Z98.restoreLineToolState(e,t)},b.prototype.redo=function(){var e=this.Z97,t=this._nextState;this.Z98.restoreLineToolState(e,t)},inherit(S,o),S.prototype.setPoint=function(e){e instanceof MathEx.Point?this._point=e.clone():this._point=TradingView.clone(e)},S.prototype.undo=function(){this.Z98.startMovingSource(this.Z97,this._point,this._pointIndex),this.Z98.moveSource(this._origPoint),this.Z98.endMovingSource()},S.prototype.redo=function(){this.Z98.startMovingSource(this.Z97,this._origPoint,this._pointIndex),this.Z98.moveSource(this._point),this.Z98.endMovingSource()},inherit(C,o),C.prototype.undo=function(){this.Z98.changeZOrder(this.Z97,-this._shift)},C.prototype.redo=function(){this.Z98.changeZOrder(this.Z97,this._shift)},inherit(x,o),x.prototype.undo=function(){this.Z98.bringToFront(this.Z97)},x.prototype.redo=function(){this.Z98.sendToBack(this.Z97)},inherit(P,o),P.prototype.undo=function(){this.Z98.sendToBack(this.Z97)},P.prototype.redo=function(){this.Z98.bringToFront(this.Z97)},n.prototype.removePane=function(e,t){var i=new L(this,t,e);this.pushUndoCommand(i),i.redo()},inherit(L,o),L.prototype.redo=function(){this.Z98.panes().splice(this._index,1),this._chart._updateGui()},L.prototype.undo=function(){this.Z98.panes().splice(this._index,0,this._pane),this._chart._updateGui()},n.prototype.rearrangePanes=function(e,t,i){var r=new E(this,t,i,e);this.pushUndoCommand(r),r.redo(),this._onRearrangePanes.fire()},inherit(E,o),E.prototype.redo=function(){var e=this.Z98.panes()[this._index];"up"===this._direction&&this._index>0&&(this.Z98.panes().splice(this._index,1),this.Z98.panes().splice(this._index-1,0,e)),"down"===this._direction&&this._index<this.Z98.panes().length-1&&(this.Z98.panes().splice(this._index,1),this.Z98.panes().splice(this._index+1,0,e)),this.Z98.Q18(new $21($21.FULL_UPDATE))},E.prototype.undo=function(){if("up"===this._direction){var e=this.Z98.panes()[this._index-1];this.Z98.panes().splice(this._index-1,1),this.Z98.panes().splice(this._index,0,e)}if("down"===this._direction){var e=this.Z98.panes()[this._index+1];this.Z98.panes().splice(this._index+1,1),this.Z98.panes().splice(this._index,0,e)}this.Z98.Q18(new $21($21.FULL_UPDATE))},inherit(V,o),V.prototype.redo=function(){this._timeScaleState=this.Z98.timeScale().state(),this._priceScaleState=this._pane.defaultPriceScale().state(),this.Z98.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)},V.prototype.undo=function(){this.Z98.timeScale().restoreState(this._timeScaleState),this._pane.defaultPriceScale().restoreState(this._priceScaleState),this.Z98.recalculateAllPanes(),this.Z98.Q18(new $21($21.LIGHT_UPDATE))},inherit(I,o),I.prototype.undo=function(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void TradingView.logDebugChart("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}else this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)},I.prototype.redo=function(){if(this._inOut)this._baseCmd.redo(),this._zoomStack.push(this._baseCmd);else{if(this._baseCmd!==this._zoomStack.head())return void TradingView.logDebugChart("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}},inherit(A,o),A.prototype.redo=function(){var e=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._currStretchA,this._paneB._stretchFactor=e-this._currStretchA,this.Z98.Q18(new $21($21.FULL_UPDATE))},A.prototype.undo=function(){var e=this._paneA._stretchFactor+this._paneB._stretchFactor;this._paneA._stretchFactor=this._prevStretchA,this._paneB._stretchFactor=e-this._prevStretchA,this.Z98.Q18(new $21($21.FULL_UPDATE))},inherit(k,o),k.prototype.redo=function(){this.Z98.restoreFactoryDefaults(this._defaultProperty),this.Q2.adaptOnChartLogo()},k.prototype.undo=function(){this._defaultProperty.merge(this._state),this._defaultProperty.listeners().fire(this._defaultProperty),this.Z98.mainSeries().onChartStyleChanged(),this.Q2.adaptOnChartLogo()},inherit(R,o),R.prototype._merge=function(e,t){var i=this.Z98;TradingView.saveDefaultProperties(!0),e&&(i.properties().paneProperties.merge(e.paneProperties),i.properties().scalesProperties.merge(e.scalesProperties),i.properties().symbolWatermarkProperties.merge(e.symbolWatermarkProperties)),i.mainSeries().properties().merge(t),i.mainSeries().properties().saveDefaults(),i.mainSeries().J61(),i.mainSeries().invalidateBarStylesCache(),i._version=t.version,i.recalculateAllPanes(),i.Q18(new $21($21.FULL_UPDATE)),i.properties().saveDefaults(),i.properties().listeners().fire(this.Q0),i.properties().scalesProperties.textColor.listeners().fire(i.properties().scalesProperties.textColor),TradingView.saveDefaultProperties(!1)},R.prototype.undo=function(){this._merge(this._oldChartProps,this._oldSeriesProps),this.Z98.mainSeries().onChartStyleChanged(),this.Z98.updateScales()},R.prototype.redo=function(){this._merge(this._newChartProps,this._newSeriesProps),this.Z98.mainSeries().onChartStyleChanged(),this.Z98.updateScales()},inherit(M,o),M.prototype._merge=function(e){var t=this.Z97;t.properties().merge(e),t.properties().saveDefaults(),t.propertiesChanged(),t.calcIsActualSymbol(),t.updateAllViews(),t.Z98.Q18(new $21($21.LIGHT_UPDATE))},M.prototype.undo=function(){this._merge(this._oldProps)},M.prototype.redo=function(){this._merge(this._newProps)},inherit(O,o),O.prototype._merge=function(e){var t=this.Z98.model(),i=t.mainSeries();i.properties().lockScale.setValue(!1),e.interval&&i.properties().interval.setValue(e.interval);for(var r=[],n=t.panes(),o=n.length;o--;)for(var a=n[o],s=a.containsMainSeries(),l=a.Q17(),d=l.length;d--;){var h=l[d];(!s||h instanceof TradingView.Study||h instanceof X)&&(h.isRemovedByStudyTemplates()||r.push(h),t.removeSource(h))}for(var p=e.panes,c=function(e,t){return e.Q17().some(function(e){return e.alert&&e.alert().id===t.alert.id})},o=0;o<p.length;o++){for(var u=!1,_=p[o],d=0;d<_.sources.length;d++){var h=_.sources[d];"MainSeries"===h.type&&(delete h.state,u=!0)}var a=null;if(a=u?n[o]:t.createPane(o),a.restoreState(p[o],!1,e.version),u)for(var f=0;f<r.length;f++){r[f].restore&&r[f].restore();var g=r[f];g instanceof X&&!c(a,g)||a.Q17().push(g)}a.updateAlertLabelsSources()}i.priceScale().setAutoScale(!0),t._version=e.version,t.startNotStartedStudies(),t.recalculateAllPanes(),t.Q18(new $21($21.FULL_UPDATE))},O.prototype.undo=function(){this._merge(this._oldProps),this.Z98.model().mainSeries().onChartStyleChanged()},O.prototype.redo=function(){this._merge(this._newProps);var e=this.Z98.model();e.mainSeries().onChartStyleChanged();var t=this.Z98.model().mainSeries().properties(),i=this.Z98.model().mainSeries().properties().priceAxisProperties;this.Z98._preparePriceAxisProperties(t,i),e._recalcVisibleRangeStudy(e.Q17(),!0)},inherit(D,o),D.prototype.redo=function(){this._priceScale.setTopMargin(this._topMargin),this._priceScale.setBottomMargin(this._bottomMargin),this.Z98.recalculatePane(this._pane,!1)},D.prototype.undo=function(){this._priceScale.setTopMargin(this._oldTopMargin),this._priceScale.setBottomMargin(this._oldBottomMargin),this.Z98.recalculatePane(this._pane,!1)},inherit(B,o),B.prototype.redo=function(){this.Z98.mainSeries().loadDataTo(this._range)},inherit(N,o),N.prototype.redo=function(){this._cw.screen.show().done(function(){this._property.setValue(this._value,this._forceSetProperty)}.bind(this))},N.prototype.undo=function(){this._cw.screen.show().done(function(){this._property.setValue(this._prevValue,this._forceSetProperty)}.bind(this))},inherit(W,o),W.prototype.redo=function(){if(this.Z97){var e=this.Z97,t=e.priceScale(),i=(this._chart,this.Z98.paneForSource(e)),r=TradingView.className(e.constructor),n=new J50(r.toLowerCase(),e.properties().state());this._line=Y.create(r,this.Z98,n,null,e.ownerSource()),this._line.setOwnerSource(e.ownerSource()),this._line.properties().visible._value=!0,this._line._fixedPoints=this._line._fixedPoints.concat(e._fixedPoints);for(var o=0;o<this._line._fixedPoints.length;o++)this._line._fixedPoints[o]=this._line._fixedPoints[o].add(new MathEx.Point(20,20));var a=e._timePoint,s=F(a,e.ownerSource()),l=e._points,d=l;this._line.restorePoints(s,d),this._line.cloneData&&this._line.cloneData(e),i.addDataSource(this._line,t),this.Z98.updateSource(this._line),this._line.checkAlert&&this._line.checkAlert(),this._points=this._line.points(),this._paneIndex=this.Z98.panes().indexOf(i),this._toolname=e._constructor,TradingView.drawingState.drawOnAllCharts().value()&&this.Z98.copyToOtherCharts(this._line),delete this.Z97}else{var i=this.Z98.panes()[this._paneIndex];this._line=this.Z98.createLineTool(i,this._points[0],this._toolname);for(var o=1;o<this._points.length;o++)this.Z98.coninueCreatingLine(this._points[o])}},W.prototype.undo=function(){this.Z98.removeSource(this._line),this.Z98.Q18(new $21($21.LIGHT_UPDATE,!0))},Z.setWatchedValue=function(e,t,i){if(e.value()!==t){var r=new H(e,t,i);this.pushUndoCommand(r),r.redo()}},inherit(H,o),H.prototype.redo=function(){this._wv.setValue(this._newValue)},H.prototype.undo=function(){this._wv.setValue(this._oldValue)},inherit(z,o),z.prototype.redo=function(){var e=this.Z98.dataSourceForId(this.Z97);delete e.linkKey},z.prototype.undo=function(){var e=this.Z98.dataSourceForId(this.Z97);e.linkKey=this._linkKey},inherit(U,o),U.prototype.redo=function(){var e=this._chartModel.panes()[this._paneIndex],t=e.dataSourceForId(this._sourceState.ownerId)||e.mainDataSource(),i=!0,r=this._sourceState.source.state.symbol,n=this._chartModel.mainSeries().symbol(),o=r==n;o&&(t instanceof TradingView.Series&&(i=!1),t instanceof TradingView.Study&&(i=!t.metaInfo().isPriceStudy)),t.id()===this._sourceState.source.ownerSource&&this._chartModel.model()._id==this._sourceState.modelId&&(this._sourceState.source.points=F(this._sourceState.source.points,t)),delete this._sourceState.source.state.symbol;var a=TradingView.clone(this._sourceState.source);if(i){var s=this._chartModel,l=function(e){var i=e.x*s.timeScale().width(),r=e.y*t.priceScale().height();return new MathEx.Point(i,r)};a.points=this._sourceState.geometry.map(function(e){var i=l(e),r=s.timeScale().coordinateToIndex(i.x),n=s.timeScale().normalizeBarIndex(r);if(n.price=t.priceScale().coordinateToPrice(i.y),t.priceScale().isPercent()){var o=t.firstValue();n.price=t.priceScale().priceRange().convertFromPercent(n.price,o)}return n})}a.id=TradingView.guid();var d=e._restoreLineTool(a,null,!1);d.calcIsActualSymbol(),d.setOwnerSource(t),d.setPriceScale(t.priceScale()),t.priceScale().addDataSource(d),this._sourceId=d.id(),d.createServerPoints(),this._chartModel.Q18(new $21($21.LIGHT_UPDATE,!0))},U.prototype.undo=function(){var e=this._chartModel.panes()[this._paneIndex],t=e.dataSourceForId(this._sourceId);this._chartModel.removeSource(t),this._chartModel.Q18(new $21($21.LIGHT_UPDATE,!0))},inherit(G,o),G.prototype.redo=function(){var e=null,t=null;this._sourceState.source.metaInfo.is_price_study?(e=this._chartModel.paneForSource(this._chartModel.mainSeries()),t=this._chartModel.mainSeries().priceScale()):(e=this._chartModel.createPane(),t=e.defaultPriceScale());var i=e._restoreStudy(this._sourceState.source);i.start(),i.setPriceScale(t),e.move(i,t),this._sourceId=i.id()},G.prototype.undo=function(){var e=this._chartModel.panes()[this._paneIndex],t=e.dataSourceForId(this._sourceId);this._chartModel.removeSource(t),this._chartModel.Q18(new $21($21.LIGHT_UPDATE,!0))},t.UndoHistory=Z,t.ChartUndoModel=n,t.UndoMacroCommand=s},function(e,t,i){"use strict";function r(){}var n=i(7),o=i(154);r.isValid=function(e){var t=n[e]||o[e];return!!t},r.create=function(e,t,i,a,s){assert(r.isValid(e),"Unknown line tool: "+e);var l,d=n[e]||o[e];if("LineToolVbPFixed"==e)var l=new d(t,i,a,s);else if("LineToolRegressionTrend"==e)var l=new d(t,i,a);else if(["LineStudyMtpAnalysis","LineStudyMtpDecisionPoint","LineStudyMtpRiskReward","LineStudyMtpElliotWaveMain","LineStudyMtpElliotWaveMajor","LineStudyMtpElliotWaveMinor","LineStudyMtpDownWave1OrA","LineStudyMtpDownWave2OrB","LineStudyMtpDownWave3","LineStudyMtpDownWave4","LineStudyMtpDownWave5","LineStudyMtpDownWaveC","LineStudyMtpUpWave1OrA","LineStudyMtpUpWave2OrB","LineStudyMtpUpWave3","LineStudyMtpUpWave4","LineStudyMtpUpWave5","LineStudyMtpUpWaveC"].indexOf(e)>=0)var l=new d(t,i,a);else var l=new d(t,i);return l},e.exports=r},function(e,t,i){"use strict";for(var r={LineToolFibRetracement:i(8),LineToolFibChannel:i(99),LineToolFibSpeedResistanceArcs:i(100),LineToolProjection:i(101),LineToolTrendBasedFibExtension:i(103),LineToolElliott:i(96).LineToolElliott,LineToolFibCircles:i(97).LineToolFibCircles,LineToolRegressionTrend:i(81),LineToolTrading:i(104),LineToolVbPFixed:i(105),LineStudyMtp:i(106),LineToolVertLine:i(86).LineToolVertLine,LineToolBarsPattern:i(92),LineToolTrendBasedFibTime:i(107),LineToolFibTimeZone:i(108),LineToolCircleLines:i(109),LineToolDateRange:i(110),LineToolPriceRange:i(111),LineToolDateAndPriceRange:i(112),LineToolParallelChannel:i(83).LineToolParallelChannel,LineToolTrendAngle:i(94),LineToolTrendLine:i(55).LineToolTrendLine,LineToolArrowMark:i(113).LineToolArrowMark,LineToolExecution:i(57).LineToolExecution,LineToolPitchfan:i(115),LineToolGannSquare:i(117),LineToolFibSpeedResistanceFan:i(118),LineToolGannComplex:i(119),LineToolGannFan:i(120),LineToolFibWedge:i(102).LineToolFibWedge,LineToolPitchfork:i(116).LineToolPitchfork,LineToolDisjointAngle:i(121),LineToolFlatBottom:i(122),LineToolIcon:i(123),LineToolRotatedRectangle:i(124),LineToolFibSpiral:i(125),LineToolHeadAndShoulders:i(126),LineToolTriangle:i(127).LineToolTriangle,LineToolTrianglePattern:i(128),LineTool5PointsPattern:i(129).LineTool5PointsPattern,LineToolThreeDrivers:i(130),LineToolABCD:i(131),LineToolRiskReward:i(132).LineToolRiskReward,LineToolPolyline:i(133),LineToolPrediction:i(134),LineToolPriceLabel:i(135),LineToolNote:i(136).LineToolNote,LineToolNoteAbsolute:i(136).LineToolNoteAbsolute,LineToolBrush:i(137),LineToolArc:i(138),LineToolCallout:i(93),LineToolBalloon:i(139),LineToolText:i(45).LineToolText,LineToolHorzLine:i(43).LineToolHorzLine,LineToolHorzRay:i(140),LineToolRectangle:i(12).LineToolRectangle,LineToolEllipse:i(141),LineToolTimeCycles:i(142),LineToolSineLine:i(143),LineToolGhostFeed:i(95),LineToolBezierQuadro:i(144).LineToolBezierQuadro,LineToolBezierCubic:i(144).LineToolBezierCubic,LineToolArrow:i(145),LineToolRay:i(146),LineToolExtended:i(147),LineToolSchiffPitchfork:i(148),LineToolSchiffPitchfork2:i(149),LineToolInsidePitchfork:i(150),LineToolTextAbsolute:i(45).LineToolTextAbsolute,LineToolArrowMarkLeft:i(113).LineToolArrowMarkLeft,LineToolArrowMarkRight:i(113).LineToolArrowMarkRight,LineToolArrowMarkUp:i(113).LineToolArrowMarkUp,LineToolArrowMarkDown:i(113).LineToolArrowMarkDown,LineToolFlagMark:i(151),LineToolCypherPattern:i(129).LineToolCypherPattern,LineToolElliottImpulse:i(96).LineToolElliottImpulse,LineToolElliottTriangle:i(96).LineToolElliottTriangle,LineToolElliottTripleCombo:i(96).LineToolElliottTripleCombo,LineToolElliottCorrection:i(96).LineToolElliottCorrection,LineToolElliottDoubleCombo:i(96).LineToolElliottDoubleCombo,LineToolRiskRewardLong:i(132).LineToolRiskRewardLong,LineToolRiskRewardShort:i(132).LineToolRiskRewardShort,LineToolPosition:i(152),LineToolOrder:i(153)},n=Object.keys(r),o=n.length;o--;)TradingView[n[o]]=r[n[o]];e.exports=r},function(e,t,i){"use strict";function r(){l.call(this)}function n(e,t){h.call(this,e,t),this._rendererCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolFibRetracement";var i=t?t:new this.createPropertiesObject("linetoolfibretracement");d.call(this,e,new n(this,e),i),this.version=o.version,this.Q0._stateVersion=1,e._fibRetracementLabelsCache||(e._fibRetracementLabelsCache=new r)}var a=i(9),s=i(12).RectangleTransparencyRenderer,l=i(98),d=i(13).LineDataSource,h=i(44),p=i(55).TrendLineRenderer;inherit(r,l),r.prototype.levelsCount=function(){return o.LevelsCount},inherit(n,h),n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){if(h.prototype.update.call(this),this._cacheState=this.Z98._fibRetracementLabelsCache.updateSource(this.Z97),!(this.Z97.points().length<2)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this.Z97.points()[0],t=this.Z97.points()[1],i=!1,r=this.Z97.properties();r.reverse&&r.reverse.value()&&(i=r.reverse.value()),this._levels=[];var n,a=i?t.price-e.price:e.price-t.price,s=i?e.price:t.price;if(!this.Z97.priceScale().isPercent()||(n=this.Z97.ownerSource().firstValue(),null!==n))for(var l=1;l<=o.LevelsCount;l++){var d="level"+l,p=r[d];if(p.visible.value()){var c=p.coeff.value(),u=p.color.value(),_=s+c*a;this.Z97.priceScale().isPercent()&&(_=this.Z97.priceScale().priceRange().convertToPercent(_,n));var f=this.Z97.priceScale().priceToCoordinate(_);this._levels.push({color:u,y:f,linewidth:r.levelsStyle.linewidth.value(),linestyle:r.levelsStyle.linestyle.value(),index:l})}}}},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;for(var t=this._points[0],i=this._points[1],r=Math.min(t.x,i.x),n=(Math.min(t.y,i.y),Math.max(t.x,i.x)),o=(Math.max(t.y,i.y),this.Z97.properties()),a=o.fillBackground.value(),l=o.transparency.value(),h=o.extendLines.value()?this.Z98.timeScale().width():n,c=this.Z98._fibRetracementLabelsCache,u=c.canvas().get(0),_=0;_<this._levels.length;_++){if(_>0&&a){var f=this._levels[_-1],t=new MathEx.Point(r,this._levels[_].y),i=new MathEx.Point(h,f.y),g={};g.points=[t,i],g.color=this._levels[_].color,g.linewidth=0,g.backcolor=this._levels[_].color,g.fillBackground=!0,g.transparency=l,e.append(new s(g))}var t=new MathEx.Point(r,this._levels[_].y),i=new MathEx.Point(n,this._levels[_].y),v={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this._levels[_].color,linewidth:this._levels[_].linewidth,linestyle:this._levels[_].linestyle,extendleft:!1,extendright:o.extendLines.value(),leftend:d.LINEEND_NORMAL,rightend:d.LINEEND_NORMAL},m=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,this._levels[_].index);if(e.append(new p(v,m)),o.showCoeffs.value()||o.showPrices.value()){if(!this._cacheState.preparedCells)continue;var y=this._cacheState.preparedCells.cells[this._levels[_].index-1];if(!y)continue;var w;switch(o.horzLabelsAlign.value()){case"left":w=t;break;case"center":w=t.add(i).scaled(.5),w.x+=y.width/2,w.x=Math.round(w.x);break;case"right":o.extendLines.value()?w=new MathEx.Point(h-4,this._levels[_].y):(w=new MathEx.Point(h+4,this._levels[_].y),w.x+=y.width,w.x=Math.round(w.x))}var T={left:y.left,top:c.topByRow(this._cacheState.row),width:y.width,height:c.rowHeight(this._cacheState.row)},b={left:w.x-T.width,top:w.y,width:y.width,height:T.height},S=o.vertLabelsAlign.value();"middle"==S&&(b.top-=b.height/2),"bottom"==S&&(b.top-=b.height);var C=new TradingView.PaneRendererCachedImage(u,T,b);e.append(C)}}if(o.trendline.visible.value()){var v={points:[this._points[0],this._points[1]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:o.trendline.color.value(),linewidth:o.trendline.linewidth.value(),linestyle:o.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:d.LINEEND_NORMAL,rightend:d.LINEEND_NORMAL};e.append(new p(v))}return this.addAnchors(e),e},inherit(o,d),o.version=2,o.LevelsCount=24,o.prototype.stop=function(){d.prototype.stop.call(this),this.Z98._fibRetracementLabelsCache.removeSource(this.id())},o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Fib Retracement"},o.prototype.migrateVersion=function(e,t,i){1==e&&this.properties().extendLines.setValue(!0)},o.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},o.prototype.createPropertiesObject=function(e,t,i){return new a(e,t,i,{range:[1,24],names:["coeff","color","visible"]})},e.exports=o},function(e,t,i){"use strict";function r(e,t,i,r){this._map=$.extend({},this._map,r),t&&(t=this.unpackLevels(t)),J50.call(this,e,t,i)}var n=i(10).isSameType;inherit(r,J50),r.prototype.state=function(e,t){var i=Property.prototype.state.call(this,e);return t?i:this.packLevels(i)},r.prototype.merge=function(e){Property.prototype.merge.call(this,this.unpackLevels(e))},r.prototype._map={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:Object,unpack:Array}},r.prototype._packLvlTpl=function(){return[]},r.prototype._unpackLvlTpl=function(){return{}},r.prototype._packLvlFill=function(e,t,i,r){return r.push(i[t]),r},r.prototype._unpackLvlFill=function(e,t,i,r){return r[t]=i[e],r},r.prototype._iterateLevels=function(e,t){for(var i in this._map.prefixes)for(var r=(this._map.prefixes[i]||"")+"level",o=this._map.range[0];o<=this._map.range[1];o++)if(e[r+o]&&n(e[r+o],t.typecheck())){var a=t.tpl();for(var s in this._map.names)a=t.fill(s,this._map.names[s],e[r+o],a);e[r+o]=a}return e},r.prototype.packLevels=function(e){return this._iterateLevels(e,{tpl:this._packLvlTpl,fill:this._packLvlFill,typecheck:this._map.typecheck.pack})},r.prototype.unpackLevels=function(e){return this._iterateLevels(e,{tpl:this._unpackLvlTpl,fill:this._unpackLvlFill,typecheck:this._map.typecheck.unpack})},r.prototype.saveDefaults=function(){TradingView.saveDefaults(this._defaultName,this.state(this._exclusions,!0))},e.exports=r},function(e,t,i){(function(e){function t(e){return"number"==typeof e&&isFinite(e)}function i(e){return null===e||void 0===e?!1:e.constructor==Function}function r(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),e.prototype.superclass=t}var n=n||{},o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};n.isNaN=function(e){return!(0>=e||e>0)},Number.isNaN=Number.isNaN||function(e){return e!=e},n.isSameType=function(e,t){return Number.isNaN(e)||Number.isNaN(t)?Number.isNaN(e)===Number.isNaN(t):{}.toString.call(e)==={}.toString.call(t)},n.isInteger=function(e){return"number"==typeof e&&e%1===0},n.parseBool=function(e){return e===!0||"true"===e},n.isBoolean=function(e){return e===!0||e===!1},n.isString=function(e){return null===e||void 0===e?!1:e.constructor==String},n.declareClassAsPureInterface=function(e,t){for(var i in e.prototype)"function"==typeof e.prototype[i]&&e.prototype.hasOwnProperty(i)&&(e.prototype[i]=function(){throw t+"::"+i+" is an interface member declaration and must be overloaded in order to be called";
})},n.requireFullInterfaceImplementation=function(e,t,i,r){for(var n in i.prototype)if("function"==typeof i.prototype[n]&&!e.prototype[n])throw"Interface implementation assertion failed: "+t+" does not implement "+r+"::"+n+" function"},n.isInherited=function(e,t){return e===t?!0:e&&e.prototype?void 0===e.prototype.superclass||null===e.prototype.superclass?!1:e.prototype.superclass===t?!0:n.isInherited(e.prototype.superclass,t):!1},n.TypeValidator=function(e){this.m_type=e},n.TypeValidator.prototype.check=function(e){return e.constructor===this.m_type||n.isInherited(e.constructor,this.m_type)},n.PredicateValidator=function(e){this.m_predicate=e},n.PredicateValidator.prototype.check=function(e){return this.m_predicate(e)},n.clone=function(e){if(!e||"object"!=typeof e)return e;var t;t="function"==typeof e.pop?[]:{};var i,r;for(i in e)e.hasOwnProperty(i)&&(r=e[i],r&&"object"==typeof r?t[i]=n.clone(r):t[i]=r);return t},n.deepEquals=function(e,t,r){if(r||(r=""),e===t)return[!0,r];if(i(e)&&(e=void 0),i(t)&&(t=void 0),void 0===e&&void 0!==t)return[!1,r];if(void 0===t&&void 0!==e)return[!1,r];if(null===e&&null!==t)return[!1,r];if(null===t&&null!==e)return[!1,r];if(n.isString(e)&&n.isString(t))return[e===t,r];if(Array.isArray(e)&&Array.isArray(t)){var a=e.length,s=t.length;if(a!==s)return[!1,r];for(var l=0;a>l;l++){var d=n.deepEquals(e[l],t[l],r+"["+l+"]");if(!d[0])return d}return[!0,r]}if(o(e)||o(t))return[!1,r];for(var h in e){var d=n.deepEquals(e[h],t[h],r+"["+h+"]");if(!d[0])return d}return[!0,r]},n.merge=function(e,t){for(var i in t)"object"==typeof t[i]&&e.hasOwnProperty(i)?n.merge(e[i],t[i]):e[i]=t[i];return e},n.mergeObj=function(e,t){for(var i in t)t[i].constructor===Object&&e.hasOwnProperty(i)?n.mergeObj(e[i],t[i]):e[i]=t[i];return e},n.mergeWithRules=function(e,t,i,r){for(var o in t){var a=r?r+"."+o:o;i&&a in i?e[o]=i[a](e[o],t[o]):"object"==typeof t[o]&&e.hasOwnProperty(o)?n.merge(e[o],t[o],i,a):e[o]=t[o]}},n.sortMultipleFunction=function(){var e=[].slice.call(arguments),t=e.length;return function(i,r){var n,o,a,s,l,d,h;for(h=0;t>h&&(d=0,a=e[h],s="string"==typeof a?a:a.name,n=i[s],o=r[s],"function"==typeof a.fn&&(n=a.fn(n),o=a.fn(o)),l=a.reverse?-1:1,o>n&&(d=-1*l),n>o&&(d=1*l),0===d);h++);return d}},void 0!==e&&e&&e.exports&&(e.exports={inherit:r,merge:n.merge,isNumber:t,isInteger:n.isInteger,isBoolean:n.isBoolean,isString:n.isString,isNaN:n.isNaN,isSameType:n.isSameType})}).call(t,i(11)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t,i){"use strict";function r(e,t,i){this._data=e,this._hittestResult=t||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittestResult=i||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND)}function n(e,t){l.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolRectangle";var i=t?t:new J50("linetoolrectangle");s.call(this,e,new n(this,e),i)}function a(e,t,i){r.call(this,e,t,i)}var s=i(13).LineDataSource,l=i(44);r.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency)},r.prototype.draw=function(e){if(!(this._data.points.length<2)){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t=this._data.points[0],i=this._data.points[1],r=i.substract(t);e.canvas.width,e.canvas.height;e.beginPath(),e.rect(t.x,t.y,r.x,r.y),this._data.linewidth>0&&e.stroke(),this._data.fillBackground&&(e.fillStyle=this.getColor(),e.fill())}},r.prototype.hitTest=function(e){if(this._data.points.length<2||this._data.nohittest)return null;var t=3,i=this._data.points[0],r=this._data.points[1],n=new MathEx.Point(r.x,i.y),o=new MathEx.Point(i.x,r.y),a=MathEx.distanceToSegment(i,n,e);if(a.distance<=t)return this._hittestResult;if(a=MathEx.distanceToSegment(n,r,e),a.distance<=t)return this._hittestResult;if(a=MathEx.distanceToSegment(r,o,e),a.distance<=t)return this._hittestResult;if(a=MathEx.distanceToSegment(o,i,e),a.distance<=t)return this._hittestResult;if(this._data.fillBackground){var s=Math.min(i.x,r.x),l=Math.max(i.x,r.x),d=Math.min(i.y,r.y),h=Math.max(i.y,r.y);if(i=new MathEx.Point(s,d),r=new MathEx.Point(l,h),MathEx.pointInRect(e,i,r))return this._backHittestResult}return null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.Z97.properties().color.value(),e.linewidth=this.Z97.properties().linewidth.value(),e.backcolor=this.Z97.properties().backgroundColor.value(),e.fillBackground=this.Z97.properties().fillBackground.value(),e.transparency=this.Z97.properties().transparency.value(),this.isAnchorsRequired()){var t=new TradingView.CompositeRenderer;return t.append(new r(e)),this.addAnchors(t),t}return new r(e)},inherit(o,s),o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Rectangle"},inherit(a,r),a.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency,!0)},t.RectangleRenderer=r,t.RectangleTransparencyRenderer=a,t.LineToolRectangle=o},function(e,t,i){"use strict";function r(e,t){a.call(this,e,t),this._linetool=e,this._pointIndex=t,this._text="",this._coordinate=0,this._background="#5592C9",this._activeBackground="#0F6DBF",this._borderColor="#2E84A6",this._color="white",this._invalidated=!0,this.Z98=e.Z98}function n(e,t){l.call(this),this._linetool=e,this._pointindex=t,this.Z98=e.Z98,this._text="",this._coordinate=0,this._background="#5592C9",this._activeBackground="#0F6DBF",this._borderColor="#2E84A6",this._color="white",this._visible=!1,this._invalidated=!0}function o(e,t,i){h.call(this),this.Z98=e,this.Q0=i,i.visible&&i.frozen||this.Q0.merge(defaults("linetool"));var r=defaults("linetoolvisibilities");if(i.intervalsVisibilities)for(var a in r.intervalsVisibilities)this.Q0.intervalsVisibilities[a]||this.Q0.intervalsVisibilities.addProperty(a,r.intervalsVisibilities[a]);else this.Q0.merge(r);if($.isArray(t)?this._paneViews=t:this._paneViews=[t],this._points=[],this._fixedPoints=[],this._timePoint=[],!this.Q0.symbol){this.Q0.merge({symbol:e.mainSeries().symbol()});var s=e.mainSeries().symbolInfo();s&&this.Q0.merge({symbolInfo:{listed_exchange:s.listed_exchange,short_name:s.name}})}if(this.Q0.interval||this.Q0.merge({interval:e.mainSeries().interval()}),this.Q0.addExclusion&&(this.Q0.addExclusion("symbol"),this.Q0.addExclusion("symbolInfo"),this.Q0.addExclusion("points"),this.Q0.addExclusion("interval"),this.Q0.addExclusion("visible"),this.Q0.addExclusion("lastUpdateTime")),this.calcIsActualSymbol(),this.Q0.intervalsVisibilities.listeners().subscribe(this,o.prototype.calcIsActualSymbol),this.Q0.listeners().subscribe(this,o.prototype.propertiesChanged),this._createPointsProperties(),"_tooltipFieldsHash"in this&&!this.hasOwnProperty("_tooltipFieldsHash")&&(this._tooltipFieldsHash=$.extend(!0,{},this._tooltipFieldsHash)),this.m_priceAxisViews=[],this.m_timeAxisViews=[],this.pointsCount()>0)for(var l=0;l<this.pointsCount();l++)this.m_priceAxisViews.push(this.createPriceAxisView(l)),this.m_timeAxisViews.push(new n(this,l));this.Q0.visible.listeners().subscribe(this,function(e){e.value()||this.Z98.selectedSource()!=this||this.Z98.setSelectedSource(null)}),this.customization=this.customization||{forcePriceAxisLabel:!1,disableSelection:!1,disableErasing:!1,disableSave:!1},$(window).resize(function(){this.isFixed()&&this.restoreFixedPoints()}.bind(this)),this.Q0.lastUpdateTime||this.Q0.addProperty("lastUpdateTime",0)}var a=i(14),s=i(15),l=i(16),d=i(17),h=i(18).DataSource;inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype.setActive=function(e){this._active=e},r.prototype._updateImpl=function(){if(this._visible=!1,this._text="",this.Z98.timeScale()&&!this.Z98.timeScale().isEmpty()&&this._linetool.priceScale()&&!this._linetool.priceScale().isEmpty()&&(this.Z98.selectedSource()===this._linetool||this._linetool.customization.forcePriceAxisLabel)){var e=this.Z98.timeScale().visibleBars();if(!e.isEmpty()){var t=this._linetool.axisPoints();if(!(t.length<=this._pointIndex)){var i=t[this._pointIndex];if(isFinite(i.price)){var r=this._linetool.priceScale();if(r.isPercent()){var n=this._linetool.ownerSource().firstValue();if(!isNumber(n))return;i.price=r.priceRange().convertToPercent(i.price,n)}this._text=r.formatter().format(i.price),this._coordinate=r.priceToCoordinate(i.price),this._visible=!0}}}}},r.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={text:this._text,coordinate:this._coordinate,color:this._color,borderColor:this._borderColor,background:this._active?this._activeBackground:this._background,visible:this._visible};return new s(e)},r.prototype.text=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),a.prototype.text.call(this)},inherit(n,l),n.prototype.setActive=function(e){this._active=e},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(this._visible=!1,!this.Z98.timeScale().isEmpty()){var e=this._linetool.axisPoints();if(!(e.length<=this._pointindex)&&this._linetool===this.Z98.selectedSource()){this._text="";var t=e[this._pointindex].index;this._coordinate=this.Z98.timeScale().indexToCoordinate(t);var i=this.Z98.timeScale().indexToUserTime(t);i&&(this._text=new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(i)),this._visible=!0,this._invalidated=!1}}},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={text:this._text,coordinate:this._coordinate,color:this._color,background:this._active?this._activeBackground:this._background,borderColor:this._borderColor,visible:this._visible};return new d(e)},inherit(o,h),o.LINEEND_NORMAL=0,o.LINEEND_ARROW=1,o.LINEEND_CIRCLE=2,o.PointPriceProperty=function(e,t){Property.call(this),this._lineSource=e,this._pointIndex=t},inherit(o.PointPriceProperty,Property),o.prototype.enableCurrentIntervalVisibility=function(){var e=TradingView.Interval.parse(this.Z98.mainSeries().interval());if(e.kind()===TradingView.Interval.SECONDS)if(e.multiplier()<60){this.properties().intervalsVisibilities.seconds.setValue(!0);var t=Math.min(this.properties().intervalsVisibilities.secondsFrom.value(),e.multiplier());this.properties().intervalsVisibilities.secondsFrom.setValue(t);var i=Math.max(this.properties().intervalsVisibilities.secondsTo.value(),e.multiplier());this.properties().intervalsVisibilities.secondsTo.setValue(i)}else e=new TradingView.Interval(TradingView.Interval.MINUTES,e.multiplier()/60);if(e.kind()===TradingView.Interval.MINUTES)if(e.multiplier()<60){this.properties().intervalsVisibilities.minutes.setValue(!0);var t=Math.min(this.properties().intervalsVisibilities.minutesFrom.value(),e.multiplier());this.properties().intervalsVisibilities.minutesFrom.setValue(t);var i=Math.max(this.properties().intervalsVisibilities.minutesTo.value(),e.multiplier());this.properties().intervalsVisibilities.minutesTo.setValue(i)}else{var r=Math.floor(e.multiplier()/60);this.properties().intervalsVisibilities.hours.setValue(!0);var n=Math.min(this.properties().intervalsVisibilities.hoursFrom.value(),r);this.properties().intervalsVisibilities.hoursFrom.setValue(n);var o=Math.max(this.properties().intervalsVisibilities.hoursTo.value(),r);this.properties().intervalsVisibilities.hoursTo.setValue(o)}if(e.kind()===TradingView.Interval.DAYS){this.properties().intervalsVisibilities.days.setValue(!0);var a=Math.min(this.properties().intervalsVisibilities.daysFrom.value(),e.multiplier());this.properties().intervalsVisibilities.daysFrom.setValue(a);var s=Math.max(this.properties().intervalsVisibilities.daysTo.value(),e.multiplier());this.properties().intervalsVisibilities.daysTo.setValue(s)}e.kind()===TradingView.Interval.WEEKS&&this.properties().intervalsVisibilities.weeks.setValue(!0),e.kind()===TradingView.Interval.MONTHS&&this.properties().intervalsVisibilities.months.setValue(!0)},o.prototype.getType=function(){return TradingView.className(this.constructor)},o.prototype.getConstructor=function(){return this._constructor||null},o.prototype.isActualSymbol=function(){return this._isActualSymbol},o.prototype.isActualInterval=function(){return this._isActualInterval},o.prototype.isSavedInChart=function(e){return!this.customization.disableSave},o.prototype.visibilityKeyByInterval=function(e){var t=TradingView.Interval.parse(e),i=null;return o.IntervalsVisibilities.forEach(function(e){e.kind==t.kind()&&e.from<=t.multiplier()&&e.to>=t.multiplier()&&(i=e.key)}),i},o.prototype.calcIsActualSymbol=function(){var e=this.Q0,t=this.Z98.mainSeries(),i=t.symbolInfo();i&&e.symbolInfo?this._isActualSymbol=e.symbolInfo.listed_exchange.value()===i.listed_exchange&&e.symbolInfo.short_name.value()===i.name:this._isActualSymbol=e.symbol.value()===t.symbol()||e.symbol.value().split(":").slice(-1)[0]===t.symbol().split(":").slice(-1)[0],this.calcIsActualInterval()},o.prototype.calcIsActualInterval=function(){var e=this.Q0,t=this.Z98.mainSeries(),i=(t.symbolInfo(),TradingView.Interval.parse(t.interval())),r=e.intervalsVisibilities;if(this._isActualInterval=!1,i.kind()===TradingView.Interval.SECONDS){var n=r.seconds.value(),o=r.secondsFrom.value(),a=r.secondsTo.value();this._isActualInterval=n&&i.multiplier()>=o&&i.multiplier()<=a}if(i.kind()===TradingView.Interval.MINUTES&&i.multiplier()<60){var n=r.minutes.value(),o=r.minutesFrom.value(),a=r.minutesTo.value();this._isActualInterval=n&&i.multiplier()>=o&&i.multiplier()<=a}if(i.kind()===TradingView.Interval.MINUTES&&i.multiplier()>=60){var s=Math.floor(i.multiplier()/60),n=r.hours.value(),o=r.hoursFrom.value(),a=r.hoursTo.value();this._isActualInterval=n&&s>=o&&a>=s}if(i.kind()===TradingView.Interval.DAYS){var n=r.days.value(),o=r.daysFrom.value(),a=r.daysTo.value();this._isActualInterval=n&&i.multiplier()>=o&&i.multiplier()<=a}i.kind()===TradingView.Interval.WEEKS&&(this._isActualInterval=r.weeks.value()),i.kind()===TradingView.Interval.MONTHS&&(this._isActualInterval=r.months.value()),this._isActualInterval||this.Z98.selectedSource()!=this||this.Z98.setSelectedSource(null)},o.PointPriceProperty.prototype.value=function(){var e=this._lineSource.points()[this._pointIndex].price,t=this._lineSource.ownerSource().formatter(),i=t.parse(t.format(e));return i.price?i.price:i.value},o.PointPriceProperty.prototype.setValue=function(e){var t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(e);var i=this._lineSource.priceScale();if(i.isPercent()){var r=this._lineSource.ownerSource().firstValue();t.price=i.priceRange().convertToPercent(t.price,r)}this._lineSource.setPoint(this._pointIndex,t),this._lineSource.Z98.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!0),this._lineSource._syncMultichartState(),this._lineSource.Q0.lastUpdateTime.setValue((new Date).valueOf())},o.PointIndexProperty=function(e,t){Property.call(this),this._lineSource=e,this._pointIndex=t},inherit(o.PointIndexProperty,Property),o.PointIndexProperty.prototype.value=function(){return this._lineSource.points()[this._pointIndex].index},o.PointIndexProperty.prototype.setValue=function(e){var t=this._lineSource.points()[this._pointIndex];t.index=e;var i=this._lineSource.priceScale();if(i.isPercent()){var r=this._lineSource.ownerSource().firstValue();t.price=i.priceRange().convertToPercent(t.price,r)}this._lineSource.setPoint(this._pointIndex,t),this._lineSource.Z98.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging(!0),this._lineSource._syncMultichartState(),this._lineSource.Q0.lastUpdateTime.setValue((new Date).valueOf())},o.prototype._syncMultichartState=function(){var e={points:this._timePoint,interval:this.Z98.mainSeries().interval()};this.linkKey&&!this.properties().singleChartOnly&&TradingView.drawingState.finishChangingLineTool({model:this.Z98,linkKey:this.linkKey,symbol:this.Z98.mainSeries().symbol(),finalState:e})},o.prototype._createPointProperty=function(e){var t=this.Q0.points;t.addProperty(e);var i=t[e];i.addProperty("price"),i.price=new o.PointPriceProperty(this,e),i.addProperty("bar"),i.bar=new o.PointIndexProperty(this,e)},o.prototype._createPointsProperties=function(){this.Q0.addProperty("points");for(var e=0;e<this.pointsCount();e++)this._createPointProperty(e)},o.prototype.priceScale=function(){return this._ownerSource?this._ownerSource.m_priceScale:null},o.prototype.symbol=function(){return this.Q0.symbol.value()},o.prototype.properties=function(){return this.Q0},o.prototype.isSavedInStudyTemplates=function(){return!1},o.prototype.state=function(e){var t=TradingView.className(this.constructor),i={type:t,id:this.id(),state:this.properties().state(),points:this._timePoint,zorder:this.zorder(),linkKey:this.linkKey};return i.state._isActualInterval=this.isActualInterval(),delete i.state.points,e&&(i.indexes=this._points),this.ownerSource()&&(i.ownerSource=this.ownerSource().id()),this.isFixed()&&(i.positionPercents=this._positionPercents||this.calcPositionPercents()),"version"in this&&1!==this.version&&(i.version=this.version),this.hasAlert.value()&&(i.alertId=this._alertId),i},o.prototype.template=function(){var e=this.properties().state();return delete e.points,delete e.symbol,delete e.symbolInfo,e},o.prototype.restoreTemplate=function(e){delete e.symbolInfo,this.Z98._undoModel.drawingLoadTemplate(this,e)},o.prototype.clearData=function(){this._points=[]},o.prototype.currentPointsetId=function(){return"pointset_"+this._currentPointsetId},o.prototype.stop=function(){this._currentPointsetId&&(this.Z98.chartApi().removePointset(this.currentPointsetId()),this._currentPointsetId=null),this.hasAlert.value()&&TradingView.alertsDispatcher&&TradingView.alertsDispatcher.deleteAlert(this._alertId)},o.prototype.isStarted=function(){return!!this._currentPointsetId},o.prototype.restart=function(){this.isFixed()||(this._currentPointsetId=0,this.createServerPoints())},o.prototype.tryCreateServerPoints=function(){this.isFixed()||this._currentPointsetId||this.createServerPoints()},o.prototype.normalizePoint=function(e){var t=this.Z98.timeScale().normalizeBarIndex(e.index);return t.price=e.price,t},o.prototype.normalizePoints=function(){this._timePoint=[];for(var e=0;e<this._points.length;e++){var t=this.Z98.timeScale().normalizeBarIndex(this._points[e].index);if(!t.time_t){this._timePoint=[];break}t.price=this._points[e].price,this._timePoint.push(t)}},o.prototype.denormalizeTimePoints=function(){for(var e=[],t=0;t<this._timePoint.length;t++){var i=this.Z98.timeScale().denormalizeTimePoint(this._timePoint[t]);if(void 0===i){e=[];break}e.push({index:i,price:this._timePoint[t].price})}e.length>0&&(this._points=e)},o.prototype.restorePoints=function(e,t,i){this._timePoint=e,this._points=t,i||this.denormalizeTimePoints()},o.prototype.restoreExternalPoints=function(e){this.properties().interval.setValue(e.interval),this._timePoint=e.points,this.denormalizeTimePoints(),this.createServerPoints()},o.prototype.restorePositionPercents=function(e){this._positionPercents=e},o.prototype.updateAllViewsAndRedraw=function(){this.updateAllViews(),this.Z98.updateSource(this)},o.prototype.propertiesChanged=function(){if(this.calcIsActualSymbol(),this.updateAllViewsAndRedraw(),this.linkKey){var e=this.properties().state();delete e.interval,TradingView.drawingState.changeLineStyle({linkKey:this.linkKey,state:e,model:this.Z98})}},o.prototype.points=function(){for(var e=[],t=0;t<this._points.length;t++){var i=this._points[t];e.push({index:i.index,price:i.price,time:i.time})}return this._lastPoint&&e.push({index:this._lastPoint.index,price:this._lastPoint.price,time:this._lastPoint.time}),this._currentMovingPoint&&this._startMovingPoint&&this.correctPoints(e),e},o.prototype.axisPoints=function(){return this.points()},o.prototype.fixedPoints=function(){var e=[];if(this._positionPercents&&!this.priceScale().isEmpty())for(var t=0;t<this._positionPercents.length;t++){var i=this._positionPercents[t],r=this.Z98.timeScale().width()*i.x,n=this.priceScale().height()*i.y;e.push(new MathEx.Point(r,n))}else for(var t=0;t<this._fixedPoints.length;t++)e.push(this._fixedPoints[t].clone());return this._lastPoint&&e.push(this._lastPoint.clone()),this._currentMovingPoint&&this._startMovingPoint&&this.correctFixedPoints(e),e},o.prototype.addPoint=function(e,t,i){var r=$.extend({},e);t&&t.shift&&this.points().length>=2&&this.Q0.snapTo45Degrees&&this._snapPoint45Degree(r,this.points()[this.points().length-2]);var n=this.priceScale();if(n.isPercent()){var o=this.ownerSource().firstValue();r.price=n.priceRange().convertFromPercent(r.price,o)}this._points.push(r);var a=this._points.length==this.pointsCount();return a?(this._lastPoint=null,i||(this.normalizePoints(),this.createServerPoints())):this._lastPoint=r,a},o.prototype.addFixedPoint=function(e){this._fixedPoints.push(e);var t=this._fixedPoints.length==this.pointsCount();return t&&this.calcPositionPercents(),t},o.prototype.calcPositionPercents=function(){if(!this.priceScale()||this.priceScale().isEmpty())return[];this._positionPercents=[];for(var e=0;e<this._fixedPoints.length;e++){var t=this._fixedPoints[0],i=t.x/this.Z98.timeScale().width(),r=t.y/this.priceScale().height();this._positionPercents.push({x:i,y:r})}return this._positionPercents},o.prototype.restoreFixedPoints=function(){this._fixedPoints=this.fixedPoints()},o.prototype.onData=function(e){if(e.params.customId===this.currentPointsetId()&&0!==e.params.plots.length){for(var t=0;t<e.params.plots.length;t++){var i=e.params.plots[t],r=this._timePoint[i.index],n=i.value[0],o=new Date(1e3*i.value[1]),a={index:n,time:o,price:r.price};this._points.length<=i.index?this._points.push(a):this._points[i.index]=a}this.checkAlert&&this.checkAlert(),this.updateAllViewsAndRedraw()}},o.prototype.correctPricesToPercents=function(){for(var e=this.priceScale(),t=this.ownerSource().firstValue(),i=0;i<this._points.length;i++){var r=this._points[i];r.price=e.priceRange().convertFromPercent(r.price,t)}},o.prototype.startChanging=function(e,t){e<this.m_priceAxisViews.length&&this.m_priceAxisViews[e].setActive(!0),e<this.m_timeAxisViews.length&&this.m_timeAxisViews[e].setActive(!0),this.Q0.lastUpdateTime.setValue((new Date).valueOf())},o.prototype.setPoint=function(e,t,i){if(i&&i.shift&&this.Q0.snapTo45Degrees){var r=0===e?1:e-1;this._snapPoint45Degree(t,this.points()[r])}var n=this.priceScale();if(n.isPercent()){var o=this.ownerSource().firstValue();t.price=n.priceRange().convertFromPercent(t.price,o)}this._points[e]=t,this.normalizePoints()},o.prototype.startMoving=function(e){this.isFixed()&&this.restoreFixedPoints();var t=this.priceScale();if(t.isPercent()){var i=this.ownerSource().firstValue();e.price=t.priceRange().convertFromPercent(e.price,i)}this._startMovingPoint=e,this.Q0.lastUpdateTime.setValue((new Date).valueOf())},o.prototype.move=function(e){var t=this.priceScale();if(t.isPercent()){var i=this.ownerSource().firstValue();e.price=t.priceRange().convertFromPercent(e.price,i)}this._currentMovingPoint=e,this.updateAllViews()},o.prototype.correctPoints=function(e){for(var t=this._currentMovingPoint.index-this._startMovingPoint.index,i=this._currentMovingPoint.price-this._startMovingPoint.price,r=0;r<e.length;r++){var n=e[r];n.index+=t,n.price+=i,e[r]=n}},o.prototype.correctFixedPoints=function(e){for(var t=this._currentMovingPoint.substract(this._startMovingPoint),i=0;i<e.length;i++)e[i]=e[i].add(t)},o.prototype.endMoving=function(e){this.Q0.interval.setValue(this.Z98.mainSeries().interval());var t=!1,i=!1;return this._currentMovingPoint&&this._startMovingPoint&&(t=this._currentMovingPoint.index!=this._startMovingPoint.index,i=this._currentMovingPoint.price!=this._startMovingPoint.price,this.isFixed()?this.correctFixedPoints(this._fixedPoints):this.correctPoints(this._points),this._startMovingPoint=null,this._currentMovingPoint=null),this.isFixed()?(this.calcPositionPercents(),void this.updateAllViews()):(this.normalizePoints(),this.updateAllViews(),t&&!e&&this.createServerPoints(),void((i||t)&&this.synchronizeAlert(!this._alertUndoMode)))},o.prototype.endChanging=function(e,t){this.Q0.interval.setValue(this.Z98.mainSeries().interval()),t||(this.normalizePoints(),this.createServerPoints());for(var i=0;i<this.m_priceAxisViews.length;i++)this.m_priceAxisViews[i].setActive(!1);for(var i=0;i<this.m_timeAxisViews.length;i++)this.m_timeAxisViews[i].setActive(!1);this.synchronizeAlert(!e)},o.prototype.paneViews=function(e){if(!this._isActualSymbol||!this._isActualInterval)return null;if(!this.Q0.visible.value())return null;if(TradingView.drawingState.hideAllDrawings().value()&&this.userEditEnabled())return null;for(var t=[],i=this._paneViews.length-1;i>=0;--i)t.push(this._paneViews[i]);return t},o.prototype.dataWindowView=function(){return null},o.prototype.statusView=function(){return null},o.prototype.priceAxisViews=function(e,t){if(!this._isActualSymbol)return null;if(-1!==e.Q17().indexOf(this)&&t===this.priceScale()){if(this.Z98.lineBeingEdited()===this){var i=this.Z98.linePointBeingEdited();if(i<this.m_priceAxisViews.length){var r=this.m_priceAxisViews.slice(),n=r[i];return r.splice(i,1),r.push(n),r}return this.m_priceAxisViews}return this.m_priceAxisViews}return null},o.prototype.timeAxisViews=function(){if(this.Z98.lineBeingEdited()===this){var e=this.Z98.linePointBeingEdited();if(e<this.m_timeAxisViews.length){var t=this.m_timeAxisViews.slice(),i=t[e];return t.splice(e,1),t.push(i),t}return this.m_timeAxisViews}return this.m_timeAxisViews},o.prototype.updateAllViews=function(){if(!this._isActualSymbol)return null;if(!this.Q0.visible.value())return null;var e=this.paneViews();if(null!==e)for(var t=e,i=0;i<t.length;i++)t[i].update();for(var t=this.m_priceAxisViews,i=0;i<t.length;i++)t[i].update();for(var t=this.m_timeAxisViews,i=0;i<t.length;i++)t[i].update()},o.prototype.setLastPoint=function(e,t){t&&t.shift&&this.points().length>=2&&this.Q0.snapTo45Degrees&&this._snapPoint45Degree(e,this.points()[this.points().length-2]);var i=this.priceScale();if(i.isPercent()){var r=this.ownerSource().firstValue();e.price=i.priceRange().convertFromPercent(e.price,r)}this._lastPoint=e,this.updateAllViews()},o.prototype.setLastFixedPoint=function(e){this._lastFixedPoint=e,this.updateAllViews()},o.prototype.title=function(){return"Line Tool"},o._pointSetId=1,o.prototype.start=function(){this.createServerPoints()},o.prototype.createServerPoints=function(){if(!this._recursiveGuard&&this._isActualSymbol&&this.Z98.chartApi().connected()&&(this._currentPointsetId&&(this.Z98.chartApi().removePointset(this.currentPointsetId()),this._currentPointsetId=null),!this.Z98.timeScale().isEmpty()&&(0===this._timePoint.length&&this.normalizePoints(),0!==this._timePoint.length))){this._currentPointsetId=++o._pointSetId;for(var e=this.Z98.mainSeries().symbolId(),t=this.properties().interval.value(),i=[],r=0;r<this._timePoint.length;r++){var n=this._timePoint[r];i.push([n.time_t,n.offset])}var a=this;this.Z98.chartApi().createPointset(this.currentPointsetId(),"turnaround",e,t,i,function(e){a.onData(e)})}},o.prototype.isBeingEdited=function(){return this===this.Z98.lineBeingEdited()||this===this.Z98.sourceBeingMoved},o.prototype.isFixed=function(){return this.properties().locked&&this.properties().locked.value()},o.prototype.isLocked=o.prototype.isFrozen=function(){return this.properties().frozen&&this.properties().frozen.value()},o.prototype._tooltipFieldsHash={},o.prototype._tooltipFieldsOrder=["time","price","index","time0","price0","time1","price1","time2","price2","time3","price3","time4","price4","distance","term","pointsPerBar"],o.prototype._tooltipFieldsOrdered=null,o.prototype._formatTooltip=function(){this._tooltipFieldsHash,this._tooltipFieldsOrder;return null===this._tooltipFieldsOrdered&&(this._tooltipFieldsOrdered=new TradingView.OrderedHash(this._tooltipFieldsHash,TradingView.OrderedHash.byOrder(this._tooltipFieldsOrder))),this._tooltipFieldsOrdered.array.filter(function(e){return null!==e.value&&""!==e.value}).map(function(e){return"<span>"+e.title+":</span> "+e.value}).join("<br />")},o.prototype.pointToScreenPoint=function(e){var t=this.Z98.timeScale(),i=this.priceScale();if(!i||i.isEmpty()||t.isEmpty())return[new MathEx.Point(0,0),new MathEx.Point(0,0)];var r=null;if(i.isPercent()){if(!this.ownerSource())return;if(r=this.ownerSource().firstValue(),null===r||!isFinite(r))return}var n=t.indexToCoordinate(e.index,!0),o=e.price;i.isPercent()&&(o=i.priceRange().convertToPercent(o,r));var a=i.priceToCoordinate(o,!0),s=new MathEx.Point(n,a),n=t.indexToCoordinate(e.index,!1),a=i.priceToCoordinate(o,!1),l=new MathEx.Point(n,a);return[s,l]},o.prototype.screenPointToPoint=function(e){var t=this.Z98.timeScale(),i=this.priceScale(),r=t.coordinateToIndex(e.x),n=i.coordinateToPrice(e.y),o=null;if(i.isPercent()){if(!this.ownerSource())return;if(o=this.ownerSource().firstValue(),null===o||!isFinite(o))return}return i.isPercent()&&(n=i.priceRange().convertFromPercent(n,o)),{price:n,index:r}},o.prototype.tags=function(){return[this._constructor]},o.prototype._snapPoint45Degree=function(e,t,i){var r=this.Z98.timeScale(),n=r.indexToCoordinate(t.index),o=r.indexToCoordinate(e.index)-n,a=this.m_priceScale,s=t.price,l=e.price,d=this.ownerSource().firstValue();a.isPercent()&&(s=a.priceRange().convertToPercent(s,d));var h=a.priceToCoordinate(s),p=a.priceToCoordinate(l)-h,c=Math.round(Math.atan2(o,p)/Math.PI*4);if(2==Math.abs(c))i||(e.price=s);else if(0===Math.abs(c)||4==Math.abs(c))i||(e.index=t.index);else if(0===Math.abs(c)||4===Math.abs(c))i||(e.index=t.index);else{var u=Math.sqrt(o*o+p*p),_=0>o?-1:1,f=0>p?-1:1,g=Math.max(Math.abs(p),Math.abs(o)),v=g*Math.sqrt(2),m=v/u;g/=m;var y=Math.round(r.coordinateToIndex(n+g*_)),w=Math.abs(r.indexToCoordinate(y)-n),T=a.coordinateToPrice(h+w*f);e.index=y,e.price=T}},o.prototype.createPriceAxisView=function(e){return new r(this,e)},o.prototype.version=1,o.isLineTool=function(e){var t=TradingView[e];return t?TradingView.isInherited(t,o):!1},o.prototype.alertId=function(){return this._alertId},o.prototype.setAlert=function(e,t){function r(){!t.noChartSave&&window.saver?window.saver.saveChartSilently(t.success,!1,function(){$82.showGoProDialog({feature:"savedChartsForAlertLimit"}),"function"==typeof t.error&&t.error()},{noDefaultOnFail:!0}):"function"==typeof t.success&&t.success()}var n=i(19),o=this,t=t||{},a=e instanceof n?e.id:parseInt(e),s=o.Z98.hoveredSource()===o,l=o.Z98.selectedSource()===o;this.canHasAlert()&&(o._alertId=a,o.hasAlert.setValue(!0),TradingView.alertsDispatcher&&o.getAlert().done(function(e){o._processAlertHanders("unsubscribe"),o._processAlertHanders("subscribe"),e.set("hovered",s),e.set("selected",l)}).fail(function(e){o._processAlertHanders("unsubscribe"),"not_exists"===e&&o._flushAlert()}).always(function(){setTimeout(r,0)}))},o.prototype._flushAlert=function(e){delete this._alertId,delete this._alert,this.hasAlert.setValue(!1),window.saver&&window.saver.saveChartSilently(null,!1)},o.prototype._processAlertHanders=function(e){var t,i,r=this,e="subscribe"===e?"subscribe":"unsubscribe";if("unsubscribe"!==e||r._alertCallbacks){i="subscribe"===e?"on":"off",t=r.properties();var n=r._alertCallbacks||{
flush:r._flushAlert.bind(r),hovered:function(e,t){t?r.Z98.setHoveredSource(r):r.Z98.hoveredSource()===r&&r.Z98.setHoveredSource(null)}.bind(r),selected:function(e,t){t&&r.Z98.setSelectedSource(r)}.bind(r),synchronizeSilently:function(e){r.synchronizeAlert(!1)}.bind(r)};r._alertCallbacks||(r._alertCallbacks=n),r.getAlert().done(function(o){o&&(o[i]("destroy",n.flush),o[i]("change:hovered",n.hovered),o[i]("change:selected",n.selected),t.extendLeft&&t.extendLeft[e](r,n.synchronizeSilently),t.extendRight&&t.extendRight[e](r,n.synchronizeSilently))})}},o.prototype.editAlert=function(){function e(e){"not_exists"===e&&(t._flushAlert(),$82.ShowConfirm($.t("Alert"),$.t("Alert does not exist. Create new?"),function(){new r({drawing:t})}))}var t=this,r=i(28);t.hasAlert.value()&&TradingView.alertsDispatcher.openEditDialog(this.alertId(),{error:e})},o.prototype.getAlert=function(e){var t=this,e=e||{},i=$.Deferred();return TradingView.alertsDispatcher?TradingView.alertsDispatcher.requestAlert(t._alertId,{success:i.resolve.bind(i),error:i.reject.bind(i),fromCache:e.fromCache}):TradingView.logError("[Alerts] Can't get alert without alerts dispatcher"),i.promise()},o.prototype.synchronizeAlert=function(e){var t=this;t.hasAlert.value()&&setTimeout(function(){function i(){t._alertUndoMode=!0,o.undoToCheckpoint(t._undoCheckpointAlert),setTimeout(function(){t._alertUndoMode=!1,t.localAndServerAlersMismatch=!1},0)}function r(e){e.set("resolution",t.properties().interval.value()),e.get("extra").drawing(t),t.localAndServerAlersMismatch=!0}function n(e){TradingView.alertsDispatcher.restartAlert(e,{success:function(){t.localAndServerAlersMismatch=!1},error:i,complete:function(){delete t._undoCheckpointAlert}})}var o=t.Z98._undoModel;if(!t._undoCheckpointAlert&&!t._alertUndoMode){var a=o.undoStack().pop();t._undoCheckpointAlert=o.createUndoCheckpoint(),o.undoStack().push(a)}t.getAlert().done(function(t){r(t),e&&n(t)}).fail(i)},0)},o.prototype.stateForAlert=function(){if(this.canHasAlert()){var e=this.state();e.uniqueId=this.uniqueId(),e.title=this.title();var t=this._getAlertPlots();return t&&(e.plots=t),e}},o.prototype._getAlertPlots=function(){return null},o.prototype._linePointsToAlertPlot=function(e,t,i,r){if(2!==e.length)return TradingView.logError("[Drawing Alert] Wrong points"),null;var n=this.Z98.timeScale();return!n||n.isEmpty()?null:{type:"LinePlot",title:t||this.title(),timestamp:Math.round(n.indexToTimePoint(0).getTime()/1e3),offset1:e[0].index,offset2:e[1].index,price1:e[0].price,price2:e[1].price,extendBackward:i||!1,extendForward:r||!1}},o.prototype.getAlertIsActive=function(e){this.getAlert({fromCache:!0}).done(function(t){e(t?t.get("active"):!1)}).fail(function(){e(!1)})},o.prototype.geometry=function(){var e=this,t=function(t){var i=t.x/e.Z98.timeScale().width(),r=t.y/e.priceScale().height();return new MathEx.Point(i,r)},i=this.points().map(function(i){var r=e.pointToScreenPoint(i)[0];return t(r)});return i},o.prototype.onlyYMoving=function(){return!1},t.LineToolPriceAxisView=r,t.LineDataSource=o},function(e,t){"use strict";function i(){this._text="",this._background="#585858",this._coordinate=0}i.prototype.text=function(){return this._text},i.prototype.background=function(){return this._background},i.prototype.color=function(){return new TradingView.RGBColor(this._background).blackWhiteContrast()},i.prototype.coordinate=function(){return this._coordinate},i.prototype.floatCoordinate=function(){return this._floatCoordinate||this._coordinate},e.exports=i},function(e,t){"use strict";function i(e){this._data=e}i.prototype.draw=function(e,t){if(this._data.visible){var i=t.fontSize;e.font=t.font;var r=t.tickLength,n=t.borderSize,o=t.paddingTop,a=t.paddingBottom,s=t.paddingInner,l=t.paddingOuter,d=Math.ceil(t.widthCache.measureText(e,this._data.text)),h=t.baselineOffset;e.strokeStyle=this._data.borderColor,e.fillStyle=this._data.background,e.lineWidth=1;var p,c=t.fontSize+o+a,u=n+d+s+l+r,_=this._data.coordinate,f=_-Math.floor(i/2)-o-.5,g=f+c;p=t.isLeft?t.width-n-.5:.5;var v,m,y=p;if(this._data.text&&(t.isLeft?(y=p-u,v=p-r,m=y+l):(y=p+u,v=p+r,m=p+n+r+s),e.beginPath(),e.moveTo(p,f),e.lineTo(y,f),e.lineTo(y,g),e.lineTo(p,g),e.fill(),e.beginPath(),e.strokeStyle=this._data.color,e.moveTo(p,_),e.lineTo(v,_),e.stroke(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(this._data.text,m,g-a-h)),this._data.secondLine){var w=Math.ceil(t.widthCache.measureText(e,this._data.secondLine)),T=w+s+l;e.fillStyle=this._data.background,this._data.text&&(f+=c+1,g+=c+1),t.isLeft?(y=Math.min(y,t.width-r),p=y+T,m=y+l):(p=Math.max(y-T,n),y=p+T,m=p+s),e.beginPath(),e.moveTo(p,f),e.lineTo(y,f),e.lineTo(y,g),e.lineTo(p,g),e.fill(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(this._data.secondLine,m,g-a-h)}}},i.prototype.height=function(e,t){var i=e.fontSize+e.paddingTop+e.paddingBottom;return this._data.secondLine&&t?2*i+1:i},e.exports=i},function(e,t){"use strict";function i(){this._text="",this._background="#585858",this._coordinate=0}i.prototype.text=function(){return this._text},i.prototype.background=function(){return this._background},i.prototype.color=function(){return new TradingView.RGBColor(this._background).blackWhiteContrast()},i.prototype.coordinate=function(){return this._coordinate},e.exports=i},function(e,t){"use strict";function i(e){this._data=e}i.prototype.draw=function(e,t){if(this._data.visible!==!1){e.font=t.font;var i=t.paddingHorizontal,r=(t.paddingTop,t.borderSize,t.widthCache.measureText(e,this._data.text));if(!(0>=r)){var n=r+2*i,o=Math.floor(this._data.coordinate-n/2)+.5,a=o,s=a+n,l=s,d=Math.round(this._data.coordinate+1),h=d,p=.5,c=p+t.borderSize+t.tickLength+t.paddingTop+t.fontSize+t.paddingBottom,u=c,_=p,f=_,g=f+t.borderSize+t.tickLength,v=c-t.baselineOffset-t.paddingBottom;e.fillStyle=this._data.background,e.lineWidth=1,e.beginPath(),e.strokeStyle=this._data.color,e.moveTo(o,p),e.lineTo(a,c),e.lineTo(s,u),e.lineTo(l,_),e.fill(),e.beginPath(),e.moveTo(d,f),e.lineTo(h,g),e.stroke(),e.textAlign="left",e.fillStyle=this._data.color,e.fillText(this._data.text,o+i,v)}}},e.exports=i},function(e,t){"use strict";function i(){this._zorder=0,this.m_priceScale=null,this._id=TradingView.randomHashN(6),this._ownerSource=null,this._userEditEnabled=!0,this.hasAlert=new WatchedValue(!1)}function r(e){i.call(this),this._isOverlay=null,this.Z98=e}i.prototype.createPropertiesObject=function(e,t,i){return new J50(e,t,i)},i.prototype.id=function(){return this._id},i.prototype.uniqueId=function(){return this._id},i.prototype.setId=function(e){this._id=e},i.prototype.zorder=function(){return this._zorder},i.prototype.setZorder=function(e){"number"==typeof e&&this._zorder!=e&&(this._zorder=e)},i.prototype.title=function(){throw Error("Implement this fun in a subclass")},i.prototype.priceScale=function(){return this.m_priceScale},i.prototype.setPriceScale=function(e){this.m_priceScale=e},i.prototype.ownerSource=function(){return this._ownerSource},i.prototype.setOwnerSource=function(e){this._ownerSource=e,e&&this.setPriceScale(e.priceScale())},i.prototype.isSavedInChart=function(e){return!0},i.prototype.isSavedInStudyTemplates=function(){return!0},i.prototype.isRemovedByStudyTemplates=function(){return!0},i.prototype.hasContextMenu=function(){return!0},i.prototype.showInObjectTree=function(){return!0},i.prototype.setUserEditEnabled=function(e){this._userEditEnabled=e},i.prototype.userEditEnabled=function(){return this._userEditEnabled},i.prototype.isUserDeletable=function(){return this.userEditEnabled()},i.prototype.canHasAlert=function(){return!1},i.prototype.properties=function(){throw Error("Implement this fun in a subclass")},i.prototype.statusView=function(){return null},i.prototype.dataWindowView=function(){return null},i.prototype.priceAxisViews=function(e,t){return null},i.prototype.updateAllViews=function(){},i.prototype.paneViews=function(e){return null},inherit(r,i),r.prototype.isNoScale=function(){return!!this._isOverlay},r.prototype.base=function(){return 0},r.prototype.formatter=function(){return null},r.prototype.model=function(){return this.Z98},r.prototype.priceRange=function(e,t){return null},t.DataSource=i,t.PriceDataSource=r},function(e,t,i){(function(t){"use strict";function r(e){var e=parseInt(e);return"chartproperties.alertsProperties."+e}var n=i(22),o=2,a=n.extend({constructor:function(e,i){var r={};["autoDeactivation","frequency","extra","crossInterval"].forEach(function(t){e.hasOwnProperty(t)&&(r[t]=e[t],delete e[t])}),t.isEmpty(r)||(this.__delayedInitAttrs=r),e.version=e.version||this.VERSION,n.call(this,e,i)},initialize:function(){function e(e){t.set("crossInterval",!!e)}var t=this;this.on("change:autoDeactivation",function(e,t,i){var r;t?(e.set("frequency","once"),r=e.get("extra"),r&&r.frequency("once")):"once"===e.get("frequency")&&e.set("frequency","once_per_bar")}).on("change:frequency",function(e,t,i){var r=e.get("extra");"once"===t?(e.set("autoDeactivation",!0),r&&r.removeFrequency()):("once_per_bar"===t||"on_bar_close"===t||/^\d+$/.test(t))&&(e.set("autoDeactivation",!1),r&&r.frequency(t))}).on("change:extra",function(t,i,r){i&&(i.crossInterval.unsubscribe(e),i.crossInterval.subscribe(e),t.set("crossInterval",i.crossInterval.value()))}).on("change:crossInterval",function(e,t,i){var r=e.get("extra");t?e.set("resolution","1"):r&&"MainSeries"==r.mainSeries().type&&e.set("resolution",r.mainSeries().state.interval)}).on("destroy",function(){TVSettings.remove(t.TVSettingsPropertiesKey(t.id))}),this.id===TVSettings.getInt("alerts.widget.selected_alert_id",0)&&this.set("selected",!0),this.__delayedInitAttrs&&(this.set(this.__delayedInitAttrs),delete this.__delayedInitAttrs)},set:function(e,t,i){var r,i=i||{};return null==e?this:i.noPrepare?n.prototype.set.call(this,e,t,i):("object"==typeof e?(r=e,i=t):(r={})[e]=t,r=this._prepareToSet(r),n.prototype.set.call(this,r,i))},_prepareToSet_soundDuration:function(e){var e=parseInt(e);return isNaN(e)&&(e=0),e},_prepareToSet_expired:function(e){return e instanceof Date?e:new Date(1e3*e)},_prepareToSet_extra:function(e){var t=this.get("extra"),i=t&&e,r=e&&!(e instanceof TradingView.AlertExtra);return i?e=t.update(e):r?e=new TradingView.AlertExtra(e):e||(e=null),e},isPrice:function(){var e=this.get("extra")?this.get("extra").price():null;return null!==e},isDrawing:function(){return this.get("extra")&&this.get("extra").drawing()},isMoving:function(){return this.get("extra")&&"moving"===(this.get("extra").conditionData()||{}).type},isOHLC:function(){var e=this.get("extra");return e&&e.mainSeries()?"MainSeries"===e.mainSeries().type:void 0},isPine:function(){var e=this.get("extra"),t=e&&e.mainSeries(),i=t&&t.metaInfo;return!!TradingView.StudyMetaInfo.getAlerts(i)},expiredReadable:function(){return this._formatDate(this.get("expired"))},expiredUnix:function(){return Math.round(this.get("expired").getTime()/1e3)},defaultDescription:function(){var e=this.get("extra"),t=e?e.price():null,i=e&&e.conditionData()?e.conditionData().title:"",r="";return i&&t&&(r=this.shortSymbol()+" "+i+" ",r+=e.conditionData().isChannel?"(Upper Bound: "+t.upperBand+" , Lower Bound: "+t.lowerBand+")":t),r},setDefaultDescription:function(){this.set("description",this.defaultDescription())},statusTitle:function(){var e="",t=this.get("stopReason")||"",i=this.get("error");return this.get("active")?e=$.t("Active"):(e={manual:$.t("Stopped Manual"),expired:$.t("Expired"),auto:$.t("Triggered and Not Active"),error:$.t("Error"),"default":$.t("Stopped")}[t||"default"],"error"===t&&i&&(e+=i)),e},state:function(){return this.toJSON()},toJSON:function(){var e,t,i={};for(e in this.attributes)this.attributes.hasOwnProperty(e)&&(t=this.attributes[e],i[e]=t&&"function"==typeof t.toJSON?t.toJSON():t);return i.expired&&(i.expired=this.expiredUnix()),i},prepareToSend:function(){for(var e,t,i=this.toJSON(),r=["id","crossInterval","autoDeactivation","description","sendEmail","expired","extra","showPopup","resolution","script","sendSms","playSound","soundDuration","soundFile","symbol"],n={},o=r.length-1;o>=0;o--)e=r[o],t=i[e],void 0!==t&&(n[e]=t);return n.playSound||(delete n.soundDuration,delete n.soundFile),n.extra&&(n.extra=JSON.stringify(n.extra)),n},saveState:function(){this._oldState=this.state()},restoreState:function(e){var e=e||this._oldState||{};!e.extra||e.extra instanceof TradingView.AlertExtra||(e.extra=new TradingView.AlertExtra(e.extra)),this.set(e),delete this._oldState},getSavedState:function(){var e;return this._oldState&&(e=$.extend({},this._oldState),e.extra&&(e.extra=new TradingView.AlertExtra(e.extra))),e},TVSettingsPropertiesKey:function(){return r(this.id)},generateScript:function(e){function t(e){l.reject(e)}function i(e){n.translateToILAsync(e).done(r).fail(t)}function r(t){e&&o.set("script",t),l.resolve(t)}var n,o=this,a={symbol:o.get("symbol"),resolution:o.get("resolution"),extra:o.get("extra")},s=Object.keys(a),l=$.Deferred();if(!TradingView.AlertScriptGenerator)return void TradingView.logError("[Alerts] Can't generate script without TradingView.AlertScriptGenerator");for(var d=0;d<s.length;d++)if(!a[s[d]])return void TradingView.logError("[Alerts] Can't generate script without alert."+s[d]);return n=new TradingView.AlertScriptGenerator(a.symbol,a.resolution,a.extra),n.generateAsync(!1,!0).done(i).fail(t),l.pipe()}},{VERSION:o});e.exports=a}).call(t,i(20))},function(e,t,i){(function(t){e.exports=t._=i(21)}).call(t,function(){return this}())},function(e,t,i){var r,n;(function(){function i(e){function t(t,i,r,n,o,a){for(;o>=0&&a>o;o+=e){var s=n?n[o]:o;r=i(r,t[s],s,t)}return r}return function(i,r,n,o){r=S(r,o,4);var a=!I(i)&&b.keys(i),s=(a||i).length,l=e>0?0:s-1;return arguments.length<3&&(n=i[a?a[l]:l],l+=e),t(i,r,n,a,l,s)}}function o(e){return function(t,i,r){i=C(i,r);for(var n=V(t),o=e>0?0:n-1;o>=0&&n>o;o+=e)if(i(t[o],o,t))return o;return-1}}function a(e,t,i){return function(r,n,o){var a=0,s=V(r);if("number"==typeof o)e>0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(i&&o&&s)return o=i(r,n),r[o]===n?o:-1;if(n!==n)return o=t(_.call(r,a,s),b.isNaN),o>=0?o+a:-1;for(o=e>0?a:s-1;o>=0&&s>o;o+=e)if(r[o]===n)return o;return-1}}function s(e,t){var i=O.length,r=e.constructor,n=b.isFunction(r)&&r.prototype||p,o="constructor";for(b.has(e,o)&&!b.contains(t,o)&&t.push(o);i--;)o=O[i],o in e&&e[o]!==n[o]&&!b.contains(t,o)&&t.push(o)}var l=this,d=l._,h=Array.prototype,p=Object.prototype,c=Function.prototype,u=h.push,_=h.slice,f=p.toString,g=p.hasOwnProperty,v=Array.isArray,m=Object.keys,y=c.bind,w=Object.create,T=function(){},b=function(e){return e instanceof b?e:this instanceof b?void(this._wrapped=e):new b(e)};void 0!==e&&e.exports&&(t=e.exports=b),t._=b,b.VERSION="1.8.3";var S=function(e,t,i){if(void 0===t)return e;switch(null==i?3:i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,r){return e.call(t,i,r)};case 3:return function(i,r,n){return e.call(t,i,r,n)};case 4:return function(i,r,n,o){return e.call(t,i,r,n,o)}}return function(){return e.apply(t,arguments)}},C=function(e,t,i){return null==e?b.identity:b.isFunction(e)?S(e,t,i):b.isObject(e)?b.matcher(e):b.property(e)};b.iteratee=function(e,t){return C(e,t,1/0)};var x=function(e,t){return function(i){var r=arguments.length;if(2>r||null==i)return i;for(var n=1;r>n;n++)for(var o=arguments[n],a=e(o),s=a.length,l=0;s>l;l++){var d=a[l];t&&void 0!==i[d]||(i[d]=o[d])}return i}},P=function(e){if(!b.isObject(e))return{};if(w)return w(e);T.prototype=e;var t=new T;return T.prototype=null,t},L=function(e){return function(t){return null==t?void 0:t[e]}},E=Math.pow(2,53)-1,V=L("length"),I=function(e){var t=V(e);return"number"==typeof t&&t>=0&&E>=t};b.each=b.forEach=function(e,t,i){t=S(t,i);var r,n;if(I(e))for(r=0,n=e.length;n>r;r++)t(e[r],r,e);else{var o=b.keys(e);for(r=0,n=o.length;n>r;r++)t(e[o[r]],o[r],e)}return e},b.map=b.collect=function(e,t,i){t=C(t,i);for(var r=!I(e)&&b.keys(e),n=(r||e).length,o=Array(n),a=0;n>a;a++){var s=r?r[a]:a;o[a]=t(e[s],s,e)}return o},b.reduce=b.foldl=b.inject=i(1),b.reduceRight=b.foldr=i(-1),b.find=b.detect=function(e,t,i){var r;return r=I(e)?b.findIndex(e,t,i):b.findKey(e,t,i),void 0!==r&&-1!==r?e[r]:void 0},b.filter=b.select=function(e,t,i){var r=[];return t=C(t,i),b.each(e,function(e,i,n){t(e,i,n)&&r.push(e)}),r},b.reject=function(e,t,i){return b.filter(e,b.negate(C(t)),i)},b.every=b.all=function(e,t,i){t=C(t,i);for(var r=!I(e)&&b.keys(e),n=(r||e).length,o=0;n>o;o++){var a=r?r[o]:o;if(!t(e[a],a,e))return!1}return!0},b.some=b.any=function(e,t,i){t=C(t,i);for(var r=!I(e)&&b.keys(e),n=(r||e).length,o=0;n>o;o++){var a=r?r[o]:o;if(t(e[a],a,e))return!0}return!1},b.contains=b.includes=b.include=function(e,t,i,r){return I(e)||(e=b.values(e)),("number"!=typeof i||r)&&(i=0),b.indexOf(e,t,i)>=0},b.invoke=function(e,t){var i=_.call(arguments,2),r=b.isFunction(t);return b.map(e,function(e){var n=r?t:e[t];return null==n?n:n.apply(e,i)})},b.pluck=function(e,t){return b.map(e,b.property(t))},b.where=function(e,t){return b.filter(e,b.matcher(t))},b.findWhere=function(e,t){return b.find(e,b.matcher(t))},b.max=function(e,t,i){var r,n,o=-(1/0),a=-(1/0);if(null==t&&null!=e){e=I(e)?e:b.values(e);for(var s=0,l=e.length;l>s;s++)r=e[s],r>o&&(o=r)}else t=C(t,i),b.each(e,function(e,i,r){n=t(e,i,r),(n>a||n===-(1/0)&&o===-(1/0))&&(o=e,a=n)});return o},b.min=function(e,t,i){var r,n,o=1/0,a=1/0;if(null==t&&null!=e){e=I(e)?e:b.values(e);for(var s=0,l=e.length;l>s;s++)r=e[s],o>r&&(o=r)}else t=C(t,i),b.each(e,function(e,i,r){n=t(e,i,r),(a>n||n===1/0&&o===1/0)&&(o=e,a=n)});return o},b.shuffle=function(e){for(var t,i=I(e)?e:b.values(e),r=i.length,n=Array(r),o=0;r>o;o++)t=b.random(0,o),t!==o&&(n[o]=n[t]),n[t]=i[o];return n},b.sample=function(e,t,i){return null==t||i?(I(e)||(e=b.values(e)),e[b.random(e.length-1)]):b.shuffle(e).slice(0,Math.max(0,t))},b.sortBy=function(e,t,i){return t=C(t,i),b.pluck(b.map(e,function(e,i,r){return{value:e,index:i,criteria:t(e,i,r)}}).sort(function(e,t){var i=e.criteria,r=t.criteria;if(i!==r){if(i>r||void 0===i)return 1;if(r>i||void 0===r)return-1}return e.index-t.index}),"value")};var A=function(e){return function(t,i,r){var n={};return i=C(i,r),b.each(t,function(r,o){var a=i(r,o,t);e(n,r,a)}),n}};b.groupBy=A(function(e,t,i){b.has(e,i)?e[i].push(t):e[i]=[t]}),b.indexBy=A(function(e,t,i){e[i]=t}),b.countBy=A(function(e,t,i){b.has(e,i)?e[i]++:e[i]=1}),b.toArray=function(e){return e?b.isArray(e)?_.call(e):I(e)?b.map(e,b.identity):b.values(e):[]},b.size=function(e){return null==e?0:I(e)?e.length:b.keys(e).length},b.partition=function(e,t,i){t=C(t,i);var r=[],n=[];return b.each(e,function(e,i,o){(t(e,i,o)?r:n).push(e)}),[r,n]},b.first=b.head=b.take=function(e,t,i){return null!=e?null==t||i?e[0]:b.initial(e,e.length-t):void 0},b.initial=function(e,t,i){return _.call(e,0,Math.max(0,e.length-(null==t||i?1:t)))},b.last=function(e,t,i){return null!=e?null==t||i?e[e.length-1]:b.rest(e,Math.max(0,e.length-t)):void 0},b.rest=b.tail=b.drop=function(e,t,i){return _.call(e,null==t||i?1:t)},b.compact=function(e){return b.filter(e,b.identity)};var k=function(e,t,i,r){for(var n=[],o=0,a=r||0,s=V(e);s>a;a++){var l=e[a];if(I(l)&&(b.isArray(l)||b.isArguments(l))){t||(l=k(l,t,i));var d=0,h=l.length;for(n.length+=h;h>d;)n[o++]=l[d++]}else i||(n[o++]=l)}return n};b.flatten=function(e,t){return k(e,t,!1)},b.without=function(e){return b.difference(e,_.call(arguments,1))},b.uniq=b.unique=function(e,t,i,r){b.isBoolean(t)||(r=i,i=t,t=!1),null!=i&&(i=C(i,r));for(var n=[],o=[],a=0,s=V(e);s>a;a++){var l=e[a],d=i?i(l,a,e):l;t?(a&&o===d||n.push(l),o=d):i?b.contains(o,d)||(o.push(d),n.push(l)):b.contains(n,l)||n.push(l)}return n},b.union=function(){return b.uniq(k(arguments,!0,!0))},b.intersection=function(e){for(var t=[],i=arguments.length,r=0,n=V(e);n>r;r++){var o=e[r];if(!b.contains(t,o)){for(var a=1;i>a&&b.contains(arguments[a],o);a++);a===i&&t.push(o)}}return t},b.difference=function(e){var t=k(arguments,!0,!0,1);return b.filter(e,function(e){return!b.contains(t,e)})},b.zip=function(){return b.unzip(arguments)},b.unzip=function(e){for(var t=e&&b.max(e,V).length||0,i=Array(t),r=0;t>r;r++)i[r]=b.pluck(e,r);return i},b.object=function(e,t){for(var i={},r=0,n=V(e);n>r;r++)t?i[e[r]]=t[r]:i[e[r][0]]=e[r][1];return i},b.findIndex=o(1),b.findLastIndex=o(-1),b.sortedIndex=function(e,t,i,r){i=C(i,r,1);for(var n=i(t),o=0,a=V(e);a>o;){var s=Math.floor((o+a)/2);i(e[s])<n?o=s+1:a=s}return o},b.indexOf=a(1,b.findIndex,b.sortedIndex),b.lastIndexOf=a(-1,b.findLastIndex),b.range=function(e,t,i){null==t&&(t=e||0,e=0),i=i||1;for(var r=Math.max(Math.ceil((t-e)/i),0),n=Array(r),o=0;r>o;o++,e+=i)n[o]=e;return n};var R=function(e,t,i,r,n){if(!(r instanceof t))return e.apply(i,n);var o=P(e.prototype),a=e.apply(o,n);return b.isObject(a)?a:o};b.bind=function(e,t){if(y&&e.bind===y)return y.apply(e,_.call(arguments,1));if(!b.isFunction(e))throw new TypeError("Bind must be called on a function");var i=_.call(arguments,2),r=function(){return R(e,r,t,this,i.concat(_.call(arguments)))};return r},b.partial=function(e){var t=_.call(arguments,1),i=function(){for(var r=0,n=t.length,o=Array(n),a=0;n>a;a++)o[a]=t[a]===b?arguments[r++]:t[a];for(;r<arguments.length;)o.push(arguments[r++]);return R(e,i,this,this,o)};return i},b.bindAll=function(e){var t,i,r=arguments.length;if(1>=r)throw Error("bindAll must be passed function names");for(t=1;r>t;t++)i=arguments[t],e[i]=b.bind(e[i],e);return e},b.memoize=function(e,t){var i=function(r){var n=i.cache,o=""+(t?t.apply(this,arguments):r);return b.has(n,o)||(n[o]=e.apply(this,arguments)),n[o]};return i.cache={},i},b.delay=function(e,t){var i=_.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},b.defer=b.partial(b.delay,b,1),b.throttle=function(e,t,i){var r,n,o,a=null,s=0;i||(i={});var l=function(){s=i.leading===!1?0:b.now(),a=null,o=e.apply(r,n),a||(r=n=null)};return function(){var d=b.now();s||i.leading!==!1||(s=d);var h=t-(d-s);return r=this,n=arguments,0>=h||h>t?(a&&(clearTimeout(a),a=null),s=d,o=e.apply(r,n),a||(r=n=null)):a||i.trailing===!1||(a=setTimeout(l,h)),o}},b.debounce=function(e,t,i){var r,n,o,a,s,l=function(){var d=b.now()-a;t>d&&d>=0?r=setTimeout(l,t-d):(r=null,i||(s=e.apply(o,n),r||(o=n=null)))};return function(){o=this,n=arguments,a=b.now();var d=i&&!r;return r||(r=setTimeout(l,t)),d&&(s=e.apply(o,n),o=n=null),s}},b.wrap=function(e,t){return b.partial(t,e)},b.negate=function(e){return function(){return!e.apply(this,arguments)}},b.compose=function(){var e=arguments,t=e.length-1;return function(){for(var i=t,r=e[t].apply(this,arguments);i--;)r=e[i].call(this,r);return r}},b.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},b.before=function(e,t){var i;return function(){return--e>0&&(i=t.apply(this,arguments)),1>=e&&(t=null),i}},b.once=b.partial(b.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),O=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];b.keys=function(e){if(!b.isObject(e))return[];if(m)return m(e);var t=[];for(var i in e)b.has(e,i)&&t.push(i);return M&&s(e,t),t},b.allKeys=function(e){if(!b.isObject(e))return[];var t=[];for(var i in e)t.push(i);return M&&s(e,t),t},b.values=function(e){for(var t=b.keys(e),i=t.length,r=Array(i),n=0;i>n;n++)r[n]=e[t[n]];return r},b.mapObject=function(e,t,i){t=C(t,i);for(var r,n=b.keys(e),o=n.length,a={},s=0;o>s;s++)r=n[s],a[r]=t(e[r],r,e);return a},b.pairs=function(e){for(var t=b.keys(e),i=t.length,r=Array(i),n=0;i>n;n++)r[n]=[t[n],e[t[n]]];return r},b.invert=function(e){for(var t={},i=b.keys(e),r=0,n=i.length;n>r;r++)t[e[i[r]]]=i[r];return t},b.functions=b.methods=function(e){var t=[];for(var i in e)b.isFunction(e[i])&&t.push(i);return t.sort()},b.extend=x(b.allKeys),b.extendOwn=b.assign=x(b.keys),b.findKey=function(e,t,i){t=C(t,i);for(var r,n=b.keys(e),o=0,a=n.length;a>o;o++)if(r=n[o],t(e[r],r,e))return r},b.pick=function(e,t,i){var r,n,o={},a=e;if(null==a)return o;b.isFunction(t)?(n=b.allKeys(a),r=S(t,i)):(n=k(arguments,!1,!1,1),r=function(e,t,i){return t in i},a=Object(a));for(var s=0,l=n.length;l>s;s++){var d=n[s],h=a[d];r(h,d,a)&&(o[d]=h)}return o},b.omit=function(e,t,i){if(b.isFunction(t))t=b.negate(t);else{var r=b.map(k(arguments,!1,!1,1),String);t=function(e,t){return!b.contains(r,t)}}return b.pick(e,t,i)},b.defaults=x(b.allKeys,!0),b.create=function(e,t){var i=P(e);return t&&b.extendOwn(i,t),i},b.clone=function(e){return b.isObject(e)?b.isArray(e)?e.slice():b.extend({},e):e},b.tap=function(e,t){return t(e),e},b.isMatch=function(e,t){var i=b.keys(t),r=i.length;if(null==e)return!r;for(var n=Object(e),o=0;r>o;o++){var a=i[o];if(t[a]!==n[a]||!(a in n))return!1}return!0};var D=function(e,t,i,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof b&&(e=e._wrapped),t instanceof b&&(t=t._wrapped);var n=f.call(e);if(n!==f.call(t))return!1;switch(n){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===n;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!(b.isFunction(a)&&a instanceof a&&b.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}i=i||[],r=r||[];for(var l=i.length;l--;)if(i[l]===e)return r[l]===t;if(i.push(e),r.push(t),o){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!D(e[l],t[l],i,r))return!1}else{var d,h=b.keys(e);if(l=h.length,b.keys(t).length!==l)return!1;for(;l--;)if(d=h[l],!b.has(t,d)||!D(e[d],t[d],i,r))return!1}return i.pop(),r.pop(),!0};b.isEqual=function(e,t){return D(e,t)},b.isEmpty=function(e){return null==e?!0:I(e)&&(b.isArray(e)||b.isString(e)||b.isArguments(e))?0===e.length:0===b.keys(e).length},b.isElement=function(e){return!(!e||1!==e.nodeType)},b.isArray=v||function(e){return"[object Array]"===f.call(e)},b.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},b.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){b["is"+e]=function(t){return f.call(t)==="[object "+e+"]"}}),b.isArguments(arguments)||(b.isArguments=function(e){return b.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(b.isFunction=function(e){return"function"==typeof e||!1}),b.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},b.isNaN=function(e){return b.isNumber(e)&&e!==+e},b.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===f.call(e)},b.isNull=function(e){return null===e},b.isUndefined=function(e){return void 0===e},b.has=function(e,t){return null!=e&&g.call(e,t)},b.noConflict=function(){return l._=d,this},b.identity=function(e){return e},b.constant=function(e){return function(){return e}},b.noop=function(){},b.property=L,b.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},b.matcher=b.matches=function(e){return e=b.extendOwn({},e),function(t){return b.isMatch(t,e)}},b.times=function(e,t,i){var r=Array(Math.max(0,e));t=S(t,i,1);for(var n=0;e>n;n++)r[n]=t(n);return r},b.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},b.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},N=b.invert(B),F=function(e){var t=function(t){return e[t]},i="(?:"+b.keys(e).join("|")+")",r=RegExp(i),n=RegExp(i,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(n,t):e}};b.escape=F(B),b.unescape=F(N),b.result=function(e,t,i){var r=null==e?void 0:e[t];return void 0===r&&(r=i),b.isFunction(r)?r.call(e):r};var W=0;b.uniqueId=function(e){var t=++W+"";return e?e+t:t},b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},U=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+z[e]};b.template=function(e,t,i){!t&&i&&(t=i),t=b.defaults({},t,b.templateSettings);var r=RegExp([(t.escape||H).source,(t.interpolate||H).source,(t.evaluate||H).source].join("|")+"|$","g"),n=0,o="__p+='";e.replace(r,function(t,i,r,a,s){return o+=e.slice(n,s).replace(U,G),n=s+t.length,i?o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=Function(t.variable||"obj","_",o)}catch(s){throw s.source=o,s}var l=function(e){return a.call(this,e,b)},d=t.variable||"obj";return l.source="function("+d+"){\n"+o+"}",l},b.chain=function(e){var t=b(e);return t._chain=!0,t};var j=function(e,t){return e._chain?b(t).chain():t};b.mixin=function(e){b.each(b.functions(e),function(t){var i=b[t]=e[t];b.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),j(this,i.apply(b,e))}})},b.mixin(b),b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=h[e];b.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!==e&&"splice"!==e||0!==i.length||delete i[0],j(this,i)}}),b.each(["concat","join","slice"],function(e){var t=h[e];b.prototype[e]=function(){return j(this,t.apply(this._wrapped,arguments))}}),b.prototype.value=function(){return this._wrapped},b.prototype.valueOf=b.prototype.toJSON=b.prototype.value,b.prototype.toString=function(){return""+this._wrapped},r=[],n=function(){return b}.apply(t,r),!(void 0!==n&&(e.exports=n))}).call(this)},function(e,t,i){(function(t){"use strict";var r=i(26),n=t.Model.extend({constructor:function(e,i){e=this._prepareToSet(e,!0),t.Model.call(this,e,i)},_prepareToSet:function(e,t){var i,r,n;if(e)for(i in e)e.hasOwnProperty(i)&&(r=e[i],n="_prepareToSet_"+i,"function"==typeof this[n]&&(e[i]=this[n](r,e,t)));return e},destroy:function(){this.stopListening(),this.trigger("destroy",this)},save:function(){TradingView.logError("[Alerts] Use disaptcher to save")},shortSymbol:function(e){return $67?$67.shortName(e||this.get("symbol")||""):(TradingView.logWarn("[Alerts] can't get short symbol"),e)},resolutionReadable:function(e){if(!r)return TradingView.logWarn("[Alerts] can't get resolution readable"),e;var e=e||this.get("resolution");return e?r.prototype.readable(e,!1,!0):""},title:function(){return this.get("crossInterval")?this.shortSymbol():this.shortSymbol()+",&nbsp;"+this.resolutionReadable()},_formatDate:function(e){return moment(e||new Date).format("ll")}});e.exports=n}).call(t,i(23))},function(e,t,i){var r,n;(function(o){!function(a){var s="object"==typeof self&&self.self==self&&self||"object"==typeof o&&o.global==o&&o;r=[i(20),i(24),t],n=function(e,$,t){s.Backbone=a(s,t,e,$)}.apply(t,r),!(void 0!==n&&(e.exports=n))}(function(e,t,i,$){var r=e.Backbone,n=[].slice;t.VERSION="1.2.1",t.$=$,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var o=function(e,t,r){switch(e){case 1:return function(){return i[t](this[r])};case 2:return function(e){return i[t](this[r],e)};case 3:return function(e,n){return i[t](this[r],e,n)};case 4:return function(e,n,o){return i[t](this[r],e,n,o)};default:return function(){var e=n.call(arguments);return e.unshift(this[r]),i[t].apply(i,e)}}},a=function(e,t,r){i.each(t,function(t,n){i[n]&&(e.prototype[n]=o(t,n,r))})},s=t.Events={},l=/\s+/,d=function(e,t,r,n,o){var a,s=0;if(r&&"object"==typeof r){void 0!==n&&"context"in o&&void 0===o.context&&(o.context=n);for(a=i.keys(r);s<a.length;s++)t=e(t,a[s],r[a[s]],o)}else if(r&&l.test(r))for(a=r.split(l);s<a.length;s++)t=e(t,a[s],n,o);else t=e(t,r,n,o);return t};s.on=function(e,t,i){return h(this,e,t,i)};var h=function(e,t,i,r,n){if(e._events=d(p,e._events||{},t,i,{context:r,ctx:e,listening:n}),n){var o=e._listeners||(e._listeners={});o[n.id]=n}return e};s.listenTo=function(e,t,r){if(!e)return this;var n=e._listenId||(e._listenId=i.uniqueId("l")),o=this._listeningTo||(this._listeningTo={}),a=o[n];
if(!a){var s=this._listenId||(this._listenId=i.uniqueId("l"));a=o[n]={obj:e,objId:n,id:s,listeningTo:o,count:0}}return h(e,t,r,this,a),this};var p=function(e,t,i,r){if(i){var n=e[t]||(e[t]=[]),o=r.context,a=r.ctx,s=r.listening;s&&s.count++,n.push({callback:i,context:o,ctx:o||a,listening:s})}return e};s.off=function(e,t,i){return this._events?(this._events=d(c,this._events,e,t,{context:i,listeners:this._listeners}),this):this},s.stopListening=function(e,t,r){var n=this._listeningTo;if(!n)return this;for(var o=e?[e._listenId]:i.keys(n),a=0;a<o.length;a++){var s=n[o[a]];if(!s)break;s.obj.off(t,r,this)}return i.isEmpty(n)&&(this._listeningTo=void 0),this};var c=function(e,t,r,n){if(e){var o,a=0,s=n.context,l=n.listeners;if(t||r||s){for(var d=t?[t]:i.keys(e);a<d.length;a++){t=d[a];var h=e[t];if(!h)break;for(var p=[],c=0;c<h.length;c++){var u=h[c];r&&r!==u.callback&&r!==u.callback._callback||s&&s!==u.context?p.push(u):(o=u.listening,o&&0===--o.count&&(delete l[o.id],delete o.listeningTo[o.objId]))}p.length?e[t]=p:delete e[t]}return i.size(e)?e:void 0}for(var _=i.keys(l);a<_.length;a++)o=l[_[a]],delete l[o.id],delete o.listeningTo[o.objId]}};s.once=function(e,t,r){var n=d(u,{},e,t,i.bind(this.off,this));return this.on(n,void 0,r)},s.listenToOnce=function(e,t,r){var n=d(u,{},t,r,i.bind(this.stopListening,this,e));return this.listenTo(e,n)};var u=function(e,t,r,n){if(r){var o=e[t]=i.once(function(){n(t,o),r.apply(this,arguments)});o._callback=r}return e};s.trigger=function(e){if(!this._events)return this;for(var t=Math.max(0,arguments.length-1),i=Array(t),r=0;t>r;r++)i[r]=arguments[r+1];return d(_,this._events,e,void 0,i),this};var _=function(e,t,i,r){if(e){var n=e[t],o=e.all;n&&o&&(o=o.slice()),n&&f(n,r),o&&f(o,[t].concat(r))}return e},f=function(e,t){var i,r=-1,n=e.length,o=t[0],a=t[1],s=t[2];switch(t.length){case 0:for(;++r<n;)(i=e[r]).callback.call(i.ctx);return;case 1:for(;++r<n;)(i=e[r]).callback.call(i.ctx,o);return;case 2:for(;++r<n;)(i=e[r]).callback.call(i.ctx,o,a);return;case 3:for(;++r<n;)(i=e[r]).callback.call(i.ctx,o,a,s);return;default:for(;++r<n;)(i=e[r]).callback.apply(i.ctx,t);return}};s.bind=s.on,s.unbind=s.off,i.extend(t,s);var g=t.Model=function(e,t){var r=e||{};t||(t={}),this.cid=i.uniqueId(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(r=this.parse(r,t)||{}),r=i.defaults({},r,i.result(this,"defaults")),this.set(r,t),this.changed={},this.initialize.apply(this,arguments)};i.extend(g.prototype,s,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(e){return i.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return i.escape(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!i.iteratee(e,this)(this.attributes)},set:function(e,t,r){if(null==e)return this;var n;if("object"==typeof e?(n=e,r=t):(n={})[e]=t,r||(r={}),!this._validate(n,r))return!1;var o=r.unset,a=r.silent,s=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=i.clone(this.attributes),this.changed={});var d=this.attributes,h=this.changed,p=this._previousAttributes;this.idAttribute in n&&(this.id=n[this.idAttribute]);for(var c in n)t=n[c],i.isEqual(d[c],t)||s.push(c),i.isEqual(p[c],t)?delete h[c]:h[c]=t,o?delete d[c]:d[c]=t;if(!a){s.length&&(this._pending=r);for(var u=0;u<s.length;u++)this.trigger("change:"+s[u],this,d[s[u]],r)}if(l)return this;if(!a)for(;this._pending;)r=this._pending,this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,i.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var r in this.attributes)t[r]=void 0;return this.set(t,i.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!i.isEmpty(this.changed):i.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?i.clone(this.changed):!1;var t=this._changing?this._previousAttributes:this.attributes,r={};for(var n in e){var o=e[n];i.isEqual(t[n],o)||(r[n]=o)}return i.size(r)?r:!1},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(e){e=i.extend({parse:!0},e);var t=this,r=e.success;return e.success=function(i){var n=e.parse?t.parse(i,e):i;return t.set(n,e)?(r&&r.call(e.context,t,i,e),void t.trigger("sync",t,i,e)):!1},N(this,e),this.sync("read",this,e)},save:function(e,t,r){var n;null==e||"object"==typeof e?(n=e,r=t):(n={})[e]=t,r=i.extend({validate:!0,parse:!0},r);var o=r.wait;if(n&&!o){if(!this.set(n,r))return!1}else if(!this._validate(n,r))return!1;var a=this,s=r.success,l=this.attributes;r.success=function(e){a.attributes=l;var t=r.parse?a.parse(e,r):e;return o&&(t=i.extend({},n,t)),t&&!a.set(t,r)?!1:(s&&s.call(r.context,a,e,r),void a.trigger("sync",a,e,r))},N(this,r),n&&o&&(this.attributes=i.extend({},l,n));var d=this.isNew()?"create":r.patch?"patch":"update";"patch"!==d||r.attrs||(r.attrs=n);var h=this.sync(d,this,r);return this.attributes=l,h},destroy:function(e){e=e?i.clone(e):{};var t=this,r=e.success,n=e.wait,o=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(i){n&&o(),r&&r.call(e.context,t,i,e),t.isNew()||t.trigger("sync",t,i,e)};var a=!1;return this.isNew()?i.defer(e.success):(N(this,e),a=this.sync("delete",this,e)),n||o(),a},url:function(){var e=i.result(this,"urlRoot")||i.result(this.collection,"url")||B();if(this.isNew())return e;var t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},i.defaults({validate:!0},e))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=i.extend({},this.attributes,e);var r=this.validationError=this.validate(e,t)||null;return r?(this.trigger("invalid",this,r,i.extend(t,{validationError:r})),!1):!0}});var v={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};a(g,v,"attributes");var m=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,i.extend({silent:!0},t))},y={add:!0,remove:!0,merge:!0},w={add:!0,remove:!1};i.extend(m.prototype,s,{model:g,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,i.extend({merge:!1},t,w))},remove:function(e,t){t=i.extend({},t);var r=!i.isArray(e);e=r?[e]:i.clone(e);var n=this._removeModels(e,t);return!t.silent&&n&&this.trigger("update",this,t),r?n[0]:n},set:function(e,t){t=i.defaults({},t,y),t.parse&&!this._isModel(e)&&(e=this.parse(e,t));var r=!i.isArray(e);e=r?e?[e]:[]:e.slice();var n,o,a,s,l,d=t.at;null!=d&&(d=+d),0>d&&(d+=this.length+1);for(var h=this.comparator&&null==d&&t.sort!==!1,p=i.isString(this.comparator)?this.comparator:null,c=[],u=[],_={},f=t.add,g=t.merge,v=t.remove,m=!h&&f&&v?[]:!1,w=!1,T=0;T<e.length;T++){if(a=e[T],s=this.get(a))v&&(_[s.cid]=!0),g&&a!==s&&(a=this._isModel(a)?a.attributes:a,t.parse&&(a=s.parse(a,t)),s.set(a,t),h&&!l&&s.hasChanged(p)&&(l=!0)),e[T]=s;else if(f){if(o=e[T]=this._prepareModel(a,t),!o)continue;c.push(o),this._addReference(o,t)}o=s||o,o&&(n=this.modelId(o.attributes),!m||!o.isNew()&&_[n]||(m.push(o),w=w||!this.models[T]||o.cid!==this.models[T].cid),_[n]=!0)}if(v){for(var T=0;T<this.length;T++)_[(o=this.models[T]).cid]||u.push(o);u.length&&this._removeModels(u,t)}if(c.length||w)if(h&&(l=!0),this.length+=c.length,null!=d)for(var T=0;T<c.length;T++)this.models.splice(d+T,0,c[T]);else{m&&(this.models.length=0);for(var b=m||c,T=0;T<b.length;T++)this.models.push(b[T])}if(l&&this.sort({silent:!0}),!t.silent){for(var S=null!=d?i.clone(t):t,T=0;T<c.length;T++)null!=d&&(S.index=d+T),(o=c[T]).trigger("add",o,this,S);(l||w)&&this.trigger("sort",this,t),(c.length||u.length)&&this.trigger("update",this,t)}return r?e[0]:e},reset:function(e,t){t=t?i.clone(t):{};for(var r=0;r<this.models.length;r++)this._removeReference(this.models[r],t);return t.previousModels=this.models,this._reset(),e=this.add(e,i.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,i.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,i.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e)},slice:function(){return n.apply(this.models,arguments)},get:function(e){if(null!=e){var t=this.modelId(this._isModel(e)?e.attributes:e);return this._byId[e]||this._byId[t]||this._byId[e.cid]}},at:function(e){return 0>e&&(e+=this.length),this.models[e]},where:function(e,t){var r=i.matches(e);return this[t?"find":"filter"](function(e){return r(e.attributes)})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw Error("Cannot sort a set without a comparator");return e||(e={}),i.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(i.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return i.invoke(this.models,"get",e)},fetch:function(e){e=i.extend({parse:!0},e);var t=e.success,r=this;return e.success=function(i){var n=e.reset?"reset":"set";r[n](i,e),t&&t.call(e.context,r,i,e),r.trigger("sync",r,i,e)},N(this,e),this.sync("read",this,e)},create:function(e,t){t=t?i.clone(t):{};var r=t.wait;if(e=this._prepareModel(e,t),!e)return!1;r||this.add(e,t);var n=this,o=t.success;return t.success=function(e,t,i){r&&n.add(e,i),o&&o.call(i.context,e,t,i)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;t=t?i.clone(t):{},t.collection=this;var r=new this.model(e,t);return r.validationError?(this.trigger("invalid",this,r.validationError,t),!1):r},_removeModels:function(e,t){for(var i=[],r=0;r<e.length;r++){var n=this.get(e[r]);if(n){var o=this.indexOf(n);this.models.splice(o,1),this.length--,t.silent||(t.index=o,n.trigger("remove",n,this,t)),i.push(n),this._removeReference(n,t)}}return i.length?i:!1},_isModel:function(e){return e instanceof g},_addReference:function(e,t){this._byId[e.cid]=e;var i=this.modelId(e.attributes);null!=i&&(this._byId[i]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];var i=this.modelId(e.attributes);null!=i&&delete this._byId[i],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,i,r){if("add"!==e&&"remove"!==e||i===this){if("destroy"===e&&this.remove(t,r),"change"===e){var n=this.modelId(t.previousAttributes()),o=this.modelId(t.attributes);n!==o&&(null!=n&&delete this._byId[n],null!=o&&(this._byId[o]=t))}this.trigger.apply(this,arguments)}}});var T={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3};a(m,T,"models");var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(e){i[e]&&(m.prototype[e]=function(t,r){var n=i.isFunction(t)?t:function(e){return e.get(t)};return i[e](this.models,n,r)})});var S=t.View=function(e){this.cid=i.uniqueId("view"),i.extend(this,i.pick(e,x)),this._ensureElement(),this.initialize.apply(this,arguments)},C=/^(\S+)\s*(.*)$/,x=["model","collection","el","id","attributes","className","tagName","events"];i.extend(S.prototype,s,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0]},delegateEvents:function(e){if(e||(e=i.result(this,"events")),!e)return this;this.undelegateEvents();for(var t in e){var r=e[t];if(i.isFunction(r)||(r=this[r]),r){var n=t.match(C);this.delegate(n[1],n[2],i.bind(r,this))}}return this},delegate:function(e,t,i){return this.$el.on(e+".delegateEvents"+this.cid,t,i),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(e,t,i){return this.$el.off(e+".delegateEvents"+this.cid,t,i),this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(i.result(this,"el"));else{var e=i.extend({},i.result(this,"attributes"));this.id&&(e.id=i.result(this,"id")),this.className&&(e["class"]=i.result(this,"className")),this.setElement(this._createElement(i.result(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){this.$el.attr(e)}}),t.sync=function(e,r,n){var o=P[e];i.defaults(n||(n={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var a={type:o,dataType:"json"};if(n.url||(a.url=i.result(r,"url")||B()),null!=n.data||!r||"create"!==e&&"update"!==e&&"patch"!==e||(a.contentType="application/json",a.data=JSON.stringify(n.attrs||r.toJSON(n))),n.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),n.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){a.type="POST",n.emulateJSON&&(a.data._method=o);var s=n.beforeSend;n.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",o),s?s.apply(this,arguments):void 0}}"GET"===a.type||n.emulateJSON||(a.processData=!1);var l=n.error;n.error=function(e,t,i){n.textStatus=t,n.errorThrown=i,l&&l.call(n.context,e,t,i)};var d=n.xhr=t.ajax(i.extend(a,n));return r.trigger("request",r,d,n),d};var P={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var L=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},E=/\((.*?)\)/g,V=/(\(\?)?:\w+/g,I=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(L.prototype,s,{initialize:function(){},route:function(e,r,n){i.isRegExp(e)||(e=this._routeToRegExp(e)),i.isFunction(r)&&(n=r,r=""),n||(n=this[r]);var o=this;return t.history.route(e,function(i){var a=o._extractParameters(e,i);o.execute(n,a,r)!==!1&&(o.trigger.apply(o,["route:"+r].concat(a)),o.trigger("route",r,a),t.history.trigger("route",o,r,a))}),this},execute:function(e,t,i){e&&e.apply(this,t)},navigate:function(e,i){return t.history.navigate(e,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var e,t=i.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(E,"(?:$1)?").replace(V,function(e,t){return t?e:"([^/?]+)"}).replace(I,"([^?]*?)"),RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var r=e.exec(t).slice(1);return i.map(r,function(e,t){return t===r.length-1?e||null:e?decodeURIComponent(e):null})}});var k=t.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},R=/^[#\/]|\s+$/g,M=/^\/+|\/+$/g,O=/#.*$/;k.started=!1,i.extend(k.prototype,s,{interval:50,atRoot:function(){var e=this.location.pathname.replace(/[^\/]$/,"$&/");return e===this.root&&!this.getSearch()},matchRoot:function(){var e=this.decodeFragment(this.location.pathname),t=e.slice(0,this.root.length-1)+"/";return t===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){var e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){var e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(R,"")},start:function(e){if(k.started)throw Error("Backbone.history has already been started");if(k.started=!0,this.options=i.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window,this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(M,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open(),n.document.close(),n.location.hash="#"+this.fragment}var o=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};return this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),k.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();return t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment?!1:(this.iframe&&this.navigate(t),void this.loadUrl())},loadUrl:function(e){return this.matchRoot()?(e=this.fragment=this.getFragment(e),i.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})):!1},navigate:function(e,t){if(!k.started)return!1;t&&t!==!0||(t={trigger:!!t}),e=this.getFragment(e||"");var i=this.root;""!==e&&"?"!==e.charAt(0)||(i=i.slice(0,-1)||"/");var r=i+e;if(e=this.decodeFragment(e.replace(O,"")),this.fragment!==e){if(this.fragment=e,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;t.replace||(n.document.open(),n.document.close()),this._updateHash(n.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,i){if(i){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),t.history=new k;var D=function(e,t){var r,n=this;r=e&&i.has(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},i.extend(r,n,t);var o=function(){this.constructor=r};return o.prototype=n.prototype,r.prototype=new o,e&&i.extend(r.prototype,e),r.__super__=n.prototype,r};g.extend=m.extend=L.extend=S.extend=k.extend=D;var B=function(){throw Error('A "url" property or function must be specified')},N=function(e,t){var i=t.error;t.error=function(r){i&&i.call(t.context,e,r,t),e.trigger("error",e,r,t)}};return t})}).call(t,function(){return this}())},function(e,t,i){var r,n;!function(o,a){function s(e){var t,i,r=W[e]={};for(e=e.split(/\s+/),t=0,i=e.length;i>t;t++)r[e[t]]=!0;return r}function l(e,t,i){if(i===a&&1===e.nodeType){var r="data-"+t.replace(U,"-$1").toLowerCase();if(i=e.getAttribute(r),"string"==typeof i){try{i="true"===i?!0:"false"===i?!1:"null"===i?null:jQuery.isNumeric(i)?+i:z.test(i)?jQuery.parseJSON(i):i}catch(n){}jQuery.data(e,t,i)}else i=a}return i}function d(e){for(var t in e)if(("data"!==t||!jQuery.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function h(e,t,i){var r=t+"defer",n=t+"queue",o=t+"mark",a=jQuery._data(e,r);!a||"queue"!==i&&jQuery._data(e,n)||"mark"!==i&&jQuery._data(e,o)||setTimeout(function(){jQuery._data(e,n)||jQuery._data(e,o)||(jQuery.removeData(e,r,!0),a.fire())},0)}function p(){return!1}function c(){return!0}function u(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function _(e,t,i){if(t=t||0,jQuery.isFunction(t))return jQuery.grep(e,function(e,r){var n=!!t.call(e,r,e);return n===i});if(t.nodeType)return jQuery.grep(e,function(e,r){return e===t===i});if("string"==typeof t){var r=jQuery.grep(e,function(e){return 1===e.nodeType});if(fe.test(t))return jQuery.filter(t,r,!i);t=jQuery.filter(t,r)}return jQuery.grep(e,function(e,r){return jQuery.inArray(e,t)>=0===i})}function f(e){var t=ye.split("|"),i=e.createDocumentFragment();if(i.createElement)for(;t.length;)i.createElement(t.pop());return i}function g(e,t){return jQuery.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function v(e,t){if(1===t.nodeType&&jQuery.hasData(e)){var i,r,n,o=jQuery._data(e),a=jQuery._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(i in s)for(r=0,n=s[i].length;n>r;r++)jQuery.event.add(t,i,s[i][r])}a.data&&(a.data=jQuery.extend({},a.data))}}function m(e,t){var i;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),i=t.nodeName.toLowerCase(),"object"===i?t.outerHTML=e.outerHTML:"input"!==i||"checkbox"!==e.type&&"radio"!==e.type?"option"===i?t.selected=e.defaultSelected:"input"===i||"textarea"===i?t.defaultValue=e.defaultValue:"script"===i&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(jQuery.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached"))}function y(e){return a!==e.getElementsByTagName?e.getElementsByTagName("*"):a!==e.querySelectorAll?e.querySelectorAll("*"):[]}function w(e){"checkbox"!==e.type&&"radio"!==e.type||(e.defaultChecked=e.checked)}function T(e){var t=(e.nodeName||"").toLowerCase();"input"===t?w(e):"script"!==t&&a!==e.getElementsByTagName&&jQuery.grep(e.getElementsByTagName("input"),w)}function b(e){var t=B.createElement("div");return Re.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function S(e,t,i){var r="width"===t?e.offsetWidth:e.offsetHeight,n="width"===t?1:0,o=4;if(r>0){if("border"!==i)for(;o>n;n+=2)i||(r-=parseFloat(jQuery.css(e,"padding"+Ge[n]))||0),"margin"===i?r+=parseFloat(jQuery.css(e,i+Ge[n]))||0:r-=parseFloat(jQuery.css(e,"border"+Ge[n]+"Width"))||0;return r+"px"}if(r=Me(e,t),(0>r||null==r)&&(r=e.style[t]),We.test(r))return r;if(r=parseFloat(r)||0,i)for(;o>n;n+=2)r+=parseFloat(jQuery.css(e,"padding"+Ge[n]))||0,"padding"!==i&&(r+=parseFloat(jQuery.css(e,"border"+Ge[n]+"Width"))||0),"margin"===i&&(r+=parseFloat(jQuery.css(e,i+Ge[n]))||0);return r+"px"}function C(e){return function(t,i){if("string"!=typeof t&&(i=t,t="*"),jQuery.isFunction(i))for(var r,n,o,a=t.toLowerCase().split(at),s=0,l=a.length;l>s;s++)r=a[s],o=/^\+/.test(r),o&&(r=r.substr(1)||"*"),n=e[r]=e[r]||[],n[o?"unshift":"push"](i)}}function x(e,t,i,r,n,o){n=n||t.dataTypes[0],o=o||{},o[n]=!0;for(var s,l=e[n],d=0,h=l?l.length:0,p=e===ht;h>d&&(p||!s);d++)s=l[d](t,i,r),"string"==typeof s&&(!p||o[s]?s=a:(t.dataTypes.unshift(s),s=x(e,t,i,r,s,o)));return!p&&s||o["*"]||(s=x(e,t,i,r,"*",o)),s}function P(e,t){var i,r,n=jQuery.ajaxSettings.flatOptions||{};for(i in t)t[i]!==a&&((n[i]?e:r||(r={}))[i]=t[i]);r&&jQuery.extend(!0,e,r)}function L(e,t,i,r){if(jQuery.isArray(t))jQuery.each(t,function(t,n){i||Ke.test(e)?r(e,n):L(e+"["+("object"==typeof n?t:"")+"]",n,i,r)});else if(i||"object"!==jQuery.type(t))r(e,t);else for(var n in t)L(e+"["+n+"]",t[n],i,r)}function E(e,t,i){var r,n,o,s,l=e.contents,d=e.dataTypes,h=e.responseFields;for(n in h)n in i&&(t[h[n]]=i[n]);for(;"*"===d[0];)d.shift(),r===a&&(r=e.mimeType||t.getResponseHeader("content-type"));if(r)for(n in l)if(l[n]&&l[n].test(r)){d.unshift(n);break}if(d[0]in i)o=d[0];else{for(n in i){if(!d[0]||e.converters[n+" "+d[0]]){o=n;break}s||(s=n)}o=o||s}return o?(o!==d[0]&&d.unshift(o),i[o]):a}function V(e,t){e.dataFilter&&(t=e.dataFilter(t,e.dataType));var i,r,n,o,s,l,d,h,p=e.dataTypes,c={},u=p.length,_=p[0];for(i=1;u>i;i++){if(1===i)for(r in e.converters)"string"==typeof r&&(c[r.toLowerCase()]=e.converters[r]);if(o=_,_=p[i],"*"===_)_=o;else if("*"!==o&&o!==_){if(s=o+" "+_,l=c[s]||c["* "+_],!l){h=a;for(d in c)if(n=d.split(" "),(n[0]===o||"*"===n[0])&&(h=c[n[1]+" "+_])){d=c[d],d===!0?l=h:h===!0&&(l=d);break}}l||h||jQuery.error("No conversion from "+s.replace(" "," to ")),l!==!0&&(t=l?l(t):h(d(t)))}}return t}function I(){try{return new o.XMLHttpRequest}catch(e){}}function A(){try{return new o.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function k(){return setTimeout(R,0),bt=jQuery.now()}function R(){bt=a}function M(e,t){var i={};return jQuery.each(Pt.concat.apply([],Pt.slice(0,t)),function(){i[this]=e}),i}function O(e){if(!St[e]){var t=B.body,i=jQuery("<"+e+">").appendTo(t),r=i.css("display");i.remove(),"none"!==r&&""!==r||(yt||(yt=B.createElement("iframe"),yt.frameBorder=yt.width=yt.height=0),t.appendChild(yt),wt&&yt.createElement||(wt=(yt.contentWindow||yt.contentDocument).document,wt.write((jQuery.support.boxModel?"<!doctype html>":"")+"<html><body>"),wt.close()),i=wt.createElement(e),wt.body.appendChild(i),r=jQuery.css(i,"display"),t.removeChild(yt)),St[e]=r}return St[e]}function D(e){return jQuery.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var B=o.document,N=o.navigator,F=o.location,jQuery=function(){function e(){if(!jQuery.isReady){try{B.documentElement.doScroll("left")}catch(t){return setTimeout(e,1),a}jQuery.ready()}}var t,i,r,n,jQuery=function(e,i){return new jQuery.fn.init(e,i,t)},s=o.jQuery,l=o.$,d=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,h=/\S/,p=/^\s+/,c=/\s+$/,u=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,_=/^[\],:{}\s]*$/,f=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,g=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,v=/(?:^|:|,)(?:\s*\[)+/g,m=/(webkit)[ \/]([\w.]+)/,y=/(opera)(?:.*version)?[ \/]([\w.]+)/,w=/(msie) ([\w.]+)/,T=/(mozilla)(?:.*? rv:([\w.]+))?/,b=/-([a-z]|[0-9])/gi,S=/^-ms-/,C=function(e,t){return(t+"").toUpperCase()},x=N.userAgent,P=Object.prototype.toString,L=Object.prototype.hasOwnProperty,E=Array.prototype.push,V=Array.prototype.slice,I=String.prototype.trim,A=Array.prototype.indexOf,k={};return jQuery.fn=jQuery.prototype={constructor:jQuery,init:function(e,t,i){var r,n,o,s;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("body"===e&&!t&&B.body)return this.context=B,this[0]=B.body,this.selector=e,this.length=1,this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:d.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||i).find(e):this.constructor(t).find(e);if(r[1])return t=t instanceof jQuery?t[0]:t,s=t?t.ownerDocument||t:B,o=u.exec(e),o?jQuery.isPlainObject(t)?(e=[B.createElement(o[1])],jQuery.fn.attr.call(e,t,!0)):e=[s.createElement(o[1])]:(o=jQuery.buildFragment([r[1]],[s]),e=(o.cacheable?jQuery.clone(o.fragment):o.fragment).childNodes),jQuery.merge(this,e);if(n=B.getElementById(r[2]),n&&n.parentNode){if(n.id!==r[2])return i.find(e);this.length=1,this[0]=n}return this.context=B,this.selector=e,this}return jQuery.isFunction(e)?i.ready(e):(e.selector!==a&&(this.selector=e.selector,this.context=e.context),jQuery.makeArray(e,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return V.call(this,0)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,i){var r=this.constructor();return jQuery.isArray(e)?E.apply(r,e):jQuery.merge(r,e),r.prevObject=this,r.context=this.context,"find"===t?r.selector=this.selector+(this.selector?" ":"")+i:t&&(r.selector=this.selector+"."+t+"("+i+")"),r},each:function(e,t){return jQuery.each(this,e,t)},ready:function(e){return jQuery.bindReady(),r.add(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(V.apply(this,arguments),"slice",V.call(arguments).join(","))},map:function(e){return this.pushStack(jQuery.map(this,function(t,i){return e.call(t,i,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},jQuery.fn.init.prototype=jQuery.fn,jQuery.extend=jQuery.fn.extend=function(){var e,t,i,r,n,o,s=arguments[0]||{},l=1,d=arguments.length,h=!1;for("boolean"==typeof s&&(h=s,s=arguments[1]||{},l=2),"object"==typeof s||jQuery.isFunction(s)||(s={}),d===l&&(s=this,--l);d>l;l++)if(null!=(e=arguments[l]))for(t in e)i=s[t],r=e[t],s!==r&&(h&&r&&(jQuery.isPlainObject(r)||(n=jQuery.isArray(r)))?(n?(n=!1,o=i&&jQuery.isArray(i)?i:[]):o=i&&jQuery.isPlainObject(i)?i:{},s[t]=jQuery.extend(h,o,r)):r!==a&&(s[t]=r));return s},jQuery.extend({noConflict:function(e){return o.$===jQuery&&(o.$=l),e&&o.jQuery===jQuery&&(o.jQuery=s),jQuery},isReady:!1,readyWait:1,holdReady:function(e){e?jQuery.readyWait++:jQuery.ready(!0)},ready:function(e){if(e===!0&&!--jQuery.readyWait||e!==!0&&!jQuery.isReady){if(!B.body)return setTimeout(jQuery.ready,1);if(jQuery.isReady=!0,e!==!0&&--jQuery.readyWait>0)return;r.fireWith(B,[jQuery]),jQuery.fn.trigger&&jQuery(B).trigger("ready").off("ready")}},bindReady:function(){if(!r){if(r=jQuery.Callbacks("once memory"),"complete"===B.readyState)return setTimeout(jQuery.ready,1);if(B.addEventListener)B.addEventListener("DOMContentLoaded",n,!1),o.addEventListener("load",jQuery.ready,!1);else if(B.attachEvent){B.attachEvent("onreadystatechange",n),o.attachEvent("onload",jQuery.ready);var t=!1;try{t=null==o.frameElement}catch(i){}B.documentElement.doScroll&&t&&e()}}},isFunction:function(e){return"function"===jQuery.type(e)},isArray:Array.isArray||function(e){return"array"===jQuery.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":k[P.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==jQuery.type(e)||e.nodeType||jQuery.isWindow(e))return!1;try{if(e.constructor&&!L.call(e,"constructor")&&!L.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}var i;for(i in e);return i===a||L.call(e,i)},isEmptyObject:function(e){for(var t in e)return!1;return!0},error:function(e){throw Error(e)},parseJSON:function(e){return"string"==typeof e&&e?(e=jQuery.trim(e),o.JSON&&o.JSON.parse?o.JSON.parse(e):_.test(e.replace(f,"@").replace(g,"]").replace(v,""))?Function("return "+e)():(jQuery.error("Invalid JSON: "+e),a)):null},parseXML:function(e){if("string"!=typeof e||!e)return null;var t,i;try{o.DOMParser?(i=new DOMParser,t=i.parseFromString(e,"text/xml")):(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e))}catch(r){t=a}return t&&t.documentElement&&!t.getElementsByTagName("parsererror").length||jQuery.error("Invalid XML: "+e),
t},noop:function(){},globalEval:function(e){e&&h.test(e)&&(o.execScript||function(e){o.eval.call(o,e)})(e)},camelCase:function(e){return e.replace(S,"ms-").replace(b,C)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,t,i){var r,n=0,o=e.length,s=o===a||jQuery.isFunction(e);if(i)if(s){for(r in e)if(t.apply(e[r],i)===!1)break}else for(;o>n&&t.apply(e[n++],i)!==!1;);else if(s){for(r in e)if(t.call(e[r],r,e[r])===!1)break}else for(;o>n&&t.call(e[n],n,e[n++])!==!1;);return e},trim:I?function(e){return null==e?"":I.call(e)}:function(e){return null==e?"":(""+e).replace(p,"").replace(c,"")},makeArray:function(e,t){var i=t||[];if(null!=e){var r=jQuery.type(e);null==e.length||"string"===r||"function"===r||"regexp"===r||jQuery.isWindow(e)?E.call(i,e):jQuery.merge(i,e)}return i},inArray:function(e,t,i){var r;if(t){if(A)return A.call(t,e,i);for(r=t.length,i=i?0>i?Math.max(0,r+i):i:0;r>i;i++)if(i in t&&t[i]===e)return i}return-1},merge:function(e,t){var i=e.length,r=0;if("number"==typeof t.length)for(var n=t.length;n>r;r++)e[i++]=t[r];else for(;t[r]!==a;)e[i++]=t[r++];return e.length=i,e},grep:function(e,t,i){var r,n=[];i=!!i;for(var o=0,a=e.length;a>o;o++)r=!!t(e[o],o),i!==r&&n.push(e[o]);return n},map:function(e,t,i){var r,n,o=[],s=0,l=e.length,d=e instanceof jQuery||l!==a&&"number"==typeof l&&(l>0&&e[0]&&e[l-1]||0===l||jQuery.isArray(e));if(d)for(;l>s;s++)r=t(e[s],s,i),null!=r&&(o[o.length]=r);else for(n in e)r=t(e[n],n,i),null!=r&&(o[o.length]=r);return o.concat.apply([],o)},guid:1,proxy:function(e,t){if("string"==typeof t){var i=e[t];t=e,e=i}if(!jQuery.isFunction(e))return a;var r=V.call(arguments,2),n=function(){return e.apply(t,r.concat(V.call(arguments)))};return n.guid=e.guid=e.guid||n.guid||jQuery.guid++,n},access:function(e,t,i,r,n,o,s){var l,d=null==i,h=0,p=e.length;if(i&&"object"==typeof i){for(h in i)jQuery.access(e,t,h,i[h],1,o,r);n=1}else if(r!==a){if(l=s===a&&jQuery.isFunction(r),d&&(l?(l=t,t=function(e,t,i){return l.call(jQuery(e),i)}):(t.call(e,r),t=null)),t)for(;p>h;h++)t(e[h],i,l?r.call(e[h],h,t(e[h],i)):r,s);n=1}return n?e:d?t.call(e):p?t(e[0],i):o},now:function(){return(new Date).getTime()},uaMatch:function(e){e=e.toLowerCase();var t=m.exec(e)||y.exec(e)||w.exec(e)||e.indexOf("compatible")<0&&T.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},sub:function(){function e(t,i){return new e.fn.init(t,i)}jQuery.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(i,r){return r&&r instanceof jQuery&&!(r instanceof e)&&(r=e(r)),jQuery.fn.init.call(this,i,r,t)},e.fn.init.prototype=e.fn;var t=e(B);return e},browser:{}}),jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){k["[object "+t+"]"]=t.toLowerCase()}),i=jQuery.uaMatch(x),i.browser&&(jQuery.browser[i.browser]=!0,jQuery.browser.version=i.version),jQuery.browser.webkit&&(jQuery.browser.safari=!0),h.test(" ")&&(p=/^[\s\xA0]+/,c=/[\s\xA0]+$/),t=jQuery(B),B.addEventListener?n=function(){B.removeEventListener("DOMContentLoaded",n,!1),jQuery.ready()}:B.attachEvent&&(n=function(){"complete"===B.readyState&&(B.detachEvent("onreadystatechange",n),jQuery.ready())}),jQuery}(),W={};jQuery.Callbacks=function(e){e=e?W[e]||s(e):{};var t,i,r,n,o,l,d=[],h=[],p=function(t){var i,r,n,o;for(i=0,r=t.length;r>i;i++)n=t[i],o=jQuery.type(n),"array"===o?p(n):"function"===o&&(e.unique&&u.has(n)||d.push(n))},c=function(a,s){for(s=s||[],t=!e.memory||[a,s],i=!0,r=!0,l=n||0,n=0,o=d.length;d&&o>l;l++)if(d[l].apply(a,s)===!1&&e.stopOnFalse){t=!0;break}r=!1,d&&(e.once?t===!0?u.disable():d=[]:h&&h.length&&(t=h.shift(),u.fireWith(t[0],t[1])))},u={add:function(){if(d){var e=d.length;p(arguments),r?o=d.length:t&&t!==!0&&(n=e,c(t[0],t[1]))}return this},remove:function(){if(d)for(var t=arguments,i=0,n=t.length;n>i;i++)for(var a=0;a<d.length&&(t[i]!==d[a]||(r&&o>=a&&(o--,l>=a&&l--),d.splice(a--,1),!e.unique));a++);return this},has:function(e){if(d)for(var t=0,i=d.length;i>t;t++)if(e===d[t])return!0;return!1},empty:function(){return d=[],this},disable:function(){return d=h=t=a,this},disabled:function(){return!d},lock:function(){return h=a,t&&t!==!0||u.disable(),this},locked:function(){return!h},fireWith:function(i,n){return h&&(r?e.once||h.push([i,n]):e.once&&t||c(i,n)),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u};var H=[].slice;jQuery.extend({Deferred:function(e){var t,i=jQuery.Callbacks("once memory"),r=jQuery.Callbacks("once memory"),n=jQuery.Callbacks("memory"),o="pending",a={resolve:i,reject:r,notify:n},s={done:i.add,fail:r.add,progress:n.add,state:function(){return o},isResolved:i.fired,isRejected:r.fired,then:function(e,t,i){return l.done(e).fail(t).progress(i),this},always:function(){return l.done.apply(l,arguments).fail.apply(l,arguments),this},pipe:function(e,t,i){return jQuery.Deferred(function(r){jQuery.each({done:[e,"resolve"],fail:[t,"reject"],progress:[i,"notify"]},function(e,t){var i,n=t[0],o=t[1];jQuery.isFunction(n)?l[e](function(){i=n.apply(this,arguments),i&&jQuery.isFunction(i.promise)?i.promise().then(r.resolve,r.reject,r.notify):r[o+"With"](this===l?r:this,[i])}):l[e](r[o])})}).promise()},promise:function(e){if(null==e)e=s;else for(var t in s)e[t]=s[t];return e}},l=s.promise({});for(t in a)l[t]=a[t].fire,l[t+"With"]=a[t].fireWith;return l.done(function(){o="resolved"},r.disable,n.lock).fail(function(){o="rejected"},i.disable,n.lock),e&&e.call(l,l),l},when:function(e){function t(e){return function(t){r[e]=arguments.length>1?H.call(arguments,0):t,--s||l.resolveWith(l,r)}}function i(e){return function(t){a[e]=arguments.length>1?H.call(arguments,0):t,l.notifyWith(d,a)}}var r=H.call(arguments,0),n=0,o=r.length,a=Array(o),s=o,l=1>=o&&e&&jQuery.isFunction(e.promise)?e:jQuery.Deferred(),d=l.promise();if(o>1){for(;o>n;n++)r[n]&&r[n].promise&&jQuery.isFunction(r[n].promise)?r[n].promise().then(t(n),l.reject,i(n)):--s;s||l.resolveWith(l,r)}else l!==e&&l.resolveWith(l,o?[e]:[]);return d}}),jQuery.support=function(){var e,t,i,r,n,s,l,d,h,p,c,u=B.createElement("div");B.documentElement;if(u.setAttribute("className","t"),u.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",t=u.getElementsByTagName("*"),i=u.getElementsByTagName("a")[0],!t||!t.length||!i)return{};r=B.createElement("select"),n=r.appendChild(B.createElement("option")),s=u.getElementsByTagName("input")[0],e={leadingWhitespace:3===u.firstChild.nodeType,tbody:!u.getElementsByTagName("tbody").length,htmlSerialize:!!u.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:"/a"===i.getAttribute("href"),opacity:/^0.55/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:"on"===s.value,optSelected:n.selected,getSetAttribute:"t"!==u.className,enctype:!!B.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==B.createElement("nav").cloneNode(!0).outerHTML,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},jQuery.boxModel=e.boxModel="CSS1Compat"===B.compatMode,s.checked=!0,e.noCloneChecked=s.cloneNode(!0).checked,r.disabled=!0,e.optDisabled=!n.disabled;try{delete u.test}catch(_){e.deleteExpando=!1}if(!u.addEventListener&&u.attachEvent&&u.fireEvent&&(u.attachEvent("onclick",function(){e.noCloneEvent=!1}),u.cloneNode(!0).fireEvent("onclick")),s=B.createElement("input"),s.value="t",s.setAttribute("type","radio"),e.radioValue="t"===s.value,s.setAttribute("checked","checked"),s.setAttribute("name","t"),u.appendChild(s),l=B.createDocumentFragment(),l.appendChild(u.lastChild),e.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,e.appendChecked=s.checked,l.removeChild(s),l.appendChild(u),u.attachEvent)for(p in{submit:1,change:1,focusin:1})h="on"+p,c=h in u,c||(u.setAttribute(h,"return;"),c="function"==typeof u[h]),e[p+"Bubbles"]=c;return l.removeChild(u),l=r=n=u=s=null,jQuery(function(){var t,i,r,n,s,l,h,p,_,f,g,v,m=B.getElementsByTagName("body")[0];m&&(h=1,v="padding:0;margin:0;border:",f="position:absolute;top:0;left:0;width:1px;height:1px;",g=v+"0;visibility:hidden;",p="style='"+f+v+"5px solid #000;",_="<div "+p+"display:block;'><div style='"+v+"0;display:block;overflow:hidden;'></div></div><table "+p+"' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>",t=B.createElement("div"),t.style.cssText=g+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",m.insertBefore(t,m.firstChild),u=B.createElement("div"),t.appendChild(u),u.innerHTML="<table><tr><td style='"+v+"0;display:none'></td><td>t</td></tr></table>",d=u.getElementsByTagName("td"),c=0===d[0].offsetHeight,d[0].style.display="",d[1].style.display="none",e.reliableHiddenOffsets=c&&0===d[0].offsetHeight,o.getComputedStyle&&(u.innerHTML="",l=B.createElement("div"),l.style.width="0",l.style.marginRight="0",u.style.width="2px",u.appendChild(l),e.reliableMarginRight=0===(parseInt((o.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)),a!==u.style.zoom&&(u.innerHTML="",u.style.width=u.style.padding="1px",u.style.border=0,u.style.overflow="hidden",u.style.display="inline",u.style.zoom=1,e.inlineBlockNeedsLayout=3===u.offsetWidth,u.style.display="block",u.style.overflow="visible",u.innerHTML="<div style='width:5px;'></div>",e.shrinkWrapBlocks=3!==u.offsetWidth),u.style.cssText=f+g,u.innerHTML=_,i=u.firstChild,r=i.firstChild,n=i.nextSibling.firstChild.firstChild,s={doesNotAddBorder:5!==r.offsetTop,doesAddBorderForTableAndCells:5===n.offsetTop},r.style.position="fixed",r.style.top="20px",s.fixedPosition=20===r.offsetTop||15===r.offsetTop,r.style.position=r.style.top="",i.style.overflow="hidden",i.style.position="relative",s.subtractsBorderForOverflowNotVisible=-5===r.offsetTop,s.doesNotIncludeMarginInBodyOffset=m.offsetTop!==h,o.getComputedStyle&&(u.style.marginTop="1%",e.pixelMargin="1%"!==(o.getComputedStyle(u,null)||{marginTop:0}).marginTop),a!==t.style.zoom&&(t.style.zoom=1),m.removeChild(t),l=u=t=null,jQuery.extend(e,s))}),e}();var z=/^(?:\{.*\}|\[.*\])$/,U=/([A-Z])/g;jQuery.extend({cache:{},uuid:0,expando:"jQuery"+(jQuery.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?jQuery.cache[e[jQuery.expando]]:e[jQuery.expando],!!e&&!d(e)},data:function(e,t,i,r){if(jQuery.acceptData(e)){var n,o,s,l=jQuery.expando,d="string"==typeof t,h=e.nodeType,p=h?jQuery.cache:e,c=h?e[l]:e[l]&&l,u="events"===t;if(c&&p[c]&&(u||r||p[c].data)||!d||i!==a)return c||(h?e[l]=c=++jQuery.uuid:c=l),p[c]||(p[c]={},h||(p[c].toJSON=jQuery.noop)),"object"!=typeof t&&"function"!=typeof t||(r?p[c]=jQuery.extend(p[c],t):p[c].data=jQuery.extend(p[c].data,t)),n=o=p[c],r||(o.data||(o.data={}),o=o.data),i!==a&&(o[jQuery.camelCase(t)]=i),u&&!o[t]?n.events:(d?(s=o[t],null==s&&(s=o[jQuery.camelCase(t)])):s=o,s)}},removeData:function(e,t,i){if(jQuery.acceptData(e)){var r,n,o,a=jQuery.expando,s=e.nodeType,l=s?jQuery.cache:e,h=s?e[a]:a;if(l[h]){if(t&&(r=i?l[h]:l[h].data)){jQuery.isArray(t)||(t in r?t=[t]:(t=jQuery.camelCase(t),t=t in r?[t]:t.split(" ")));for(n=0,o=t.length;o>n;n++)delete r[t[n]];if(!(i?d:jQuery.isEmptyObject)(r))return}(i||(delete l[h].data,d(l[h])))&&(jQuery.support.deleteExpando||!l.setInterval?delete l[h]:l[h]=null,s&&(jQuery.support.deleteExpando?delete e[a]:e.removeAttribute?e.removeAttribute(a):e[a]=null))}}},_data:function(e,t,i){return jQuery.data(e,t,i,!0)},acceptData:function(e){if(e.nodeName){var t=jQuery.noData[e.nodeName.toLowerCase()];if(t)return!(t===!0||e.getAttribute("classid")!==t)}return!0}}),jQuery.fn.extend({data:function(e,t){var i,r,n,o,s,d=this[0],h=0,p=null;if(e===a){if(this.length&&(p=jQuery.data(d),1===d.nodeType&&!jQuery._data(d,"parsedAttrs"))){for(n=d.attributes,s=n.length;s>h;h++)o=n[h].name,0===o.indexOf("data-")&&(o=jQuery.camelCase(o.substring(5)),l(d,o,p[o]));jQuery._data(d,"parsedAttrs",!0)}return p}return"object"==typeof e?this.each(function(){jQuery.data(this,e)}):(i=e.split(".",2),i[1]=i[1]?"."+i[1]:"",r=i[1]+"!",jQuery.access(this,function(t){return t===a?(p=this.triggerHandler("getData"+r,[i[0]]),p===a&&d&&(p=jQuery.data(d,e),p=l(d,e,p)),p===a&&i[1]?this.data(i[0]):p):(i[1]=t,this.each(function(){var n=jQuery(this);n.triggerHandler("setData"+r,i),jQuery.data(this,e,t),n.triggerHandler("changeData"+r,i)}),a)},null,t,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){jQuery.removeData(this,e)})}}),jQuery.extend({_mark:function(e,t){e&&(t=(t||"fx")+"mark",jQuery._data(e,t,(jQuery._data(e,t)||0)+1))},_unmark:function(e,t,i){if(e!==!0&&(i=t,t=e,e=!1),t){i=i||"fx";var r=i+"mark",n=e?0:(jQuery._data(t,r)||1)-1;n?jQuery._data(t,r,n):(jQuery.removeData(t,r,!0),h(t,i,"mark"))}},queue:function(e,t,i){var r;return e?(t=(t||"fx")+"queue",r=jQuery._data(e,t),i&&(!r||jQuery.isArray(i)?r=jQuery._data(e,t,jQuery.makeArray(i)):r.push(i)),r||[]):a},dequeue:function(e,t){t=t||"fx";var i=jQuery.queue(e,t),r=i.shift(),n={};"inprogress"===r&&(r=i.shift()),r&&("fx"===t&&i.unshift("inprogress"),jQuery._data(e,t+".run",n),r.call(e,function(){jQuery.dequeue(e,t)},n)),i.length||(jQuery.removeData(e,t+"queue "+t+".run",!0),h(e,t,"queue"))}}),jQuery.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length<i?jQuery.queue(this[0],e):t===a?this:this.each(function(){var i=jQuery.queue(this,e,t);"fx"===e&&"inprogress"!==i[0]&&jQuery.dequeue(this,e)})},dequeue:function(e){return this.each(function(){jQuery.dequeue(this,e)})},delay:function(e,t){return e=jQuery.fx?jQuery.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,i){var r=setTimeout(t,e);i.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){function i(){--l||n.resolveWith(o,[o])}"string"!=typeof e&&(t=e,e=a),e=e||"fx";for(var r,n=jQuery.Deferred(),o=this,s=o.length,l=1,d=e+"defer",h=e+"queue",p=e+"mark";s--;)(r=jQuery.data(o[s],d,a,!0)||(jQuery.data(o[s],h,a,!0)||jQuery.data(o[s],p,a,!0))&&jQuery.data(o[s],d,jQuery.Callbacks("once memory"),!0))&&(l++,r.add(i));return i(),n.promise(t)}});var G,j,q,Y=/[\n\t\r]/g,K=/\s+/,X=/\r/g,J=/^(?:button|input)$/i,Z=/^(?:button|input|object|select|textarea)$/i,Q=/^a(?:rea)?$/i,ee=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,te=jQuery.support.getSetAttribute;jQuery.fn.extend({attr:function(e,t){return jQuery.access(this,jQuery.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){jQuery.removeAttr(this,e)})},prop:function(e,t){return jQuery.access(this,jQuery.prop,e,t,arguments.length>1)},removeProp:function(e){return e=jQuery.propFix[e]||e,this.each(function(){try{this[e]=a,delete this[e]}catch(t){}})},addClass:function(e){var t,i,r,n,o,a,s;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(K),i=0,r=this.length;r>i;i++)if(n=this[i],1===n.nodeType)if(n.className||1!==t.length){for(o=" "+n.className+" ",a=0,s=t.length;s>a;a++)~o.indexOf(" "+t[a]+" ")||(o+=t[a]+" ");n.className=jQuery.trim(o)}else n.className=e;return this},removeClass:function(e){var t,i,r,n,o,s,l;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===a)for(t=(e||"").split(K),i=0,r=this.length;r>i;i++)if(n=this[i],1===n.nodeType&&n.className)if(e){for(o=(" "+n.className+" ").replace(Y," "),s=0,l=t.length;l>s;s++)o=o.replace(" "+t[s]+" "," ");n.className=jQuery.trim(o)}else n.className="";return this},toggleClass:function(e,t){var i=typeof e,r="boolean"==typeof t;return jQuery.isFunction(e)?this.each(function(i){jQuery(this).toggleClass(e.call(this,i,this.className,t),t)}):this.each(function(){if("string"===i)for(var n,o=0,a=jQuery(this),s=t,l=e.split(K);n=l[o++];)s=r?s:!a.hasClass(n),a[s?"addClass":"removeClass"](n);else"undefined"!==i&&"boolean"!==i||(this.className&&jQuery._data(this,"__className__",this.className),this.className=this.className||e===!1?"":jQuery._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",i=0,r=this.length;r>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(Y," ").indexOf(t)>-1)return!0;return!1},val:function(e){var t,i,r,n=this[0];{if(arguments.length)return r=jQuery.isFunction(e),this.each(function(i){var n,o=jQuery(this);1===this.nodeType&&(n=r?e.call(this,i,o.val()):e,null==n?n="":"number"==typeof n?n+="":jQuery.isArray(n)&&(n=jQuery.map(n,function(e){return null==e?"":e+""})),t=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&t.set(this,n,"value")!==a||(this.value=n))});if(n)return t=jQuery.valHooks[n.type]||jQuery.valHooks[n.nodeName.toLowerCase()],t&&"get"in t&&(i=t.get(n,"value"))!==a?i:(i=n.value,"string"==typeof i?i.replace(X,""):null==i?"":i)}}}),jQuery.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,i,r,n,o=e.selectedIndex,a=[],s=e.options,l="select-one"===e.type;if(0>o)return null;for(i=l?o:0,r=l?o+1:s.length;r>i;i++)if(n=s[i],n.selected&&(jQuery.support.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!jQuery.nodeName(n.parentNode,"optgroup"))){if(t=jQuery(n).val(),l)return t;a.push(t)}return l&&!a.length&&s.length?jQuery(s[o]).val():a},set:function(e,t){var i=jQuery.makeArray(t);return jQuery(e).find("option").each(function(){this.selected=jQuery.inArray(jQuery(this).val(),i)>=0}),i.length||(e.selectedIndex=-1),i}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(e,t,i,r){var n,o,s,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return r&&t in jQuery.attrFn?jQuery(e)[t](i):a===e.getAttribute?jQuery.prop(e,t,i):(s=1!==l||!jQuery.isXMLDoc(e),s&&(t=t.toLowerCase(),o=jQuery.attrHooks[t]||(ee.test(t)?j:G)),i!==a?null===i?(jQuery.removeAttr(e,t),a):o&&"set"in o&&s&&(n=o.set(e,i,t))!==a?n:(e.setAttribute(t,""+i),i):o&&"get"in o&&s&&null!==(n=o.get(e,t))?n:(n=e.getAttribute(t),null===n?a:n))},removeAttr:function(e,t){var i,r,n,o,a,s=0;if(t&&1===e.nodeType)for(r=t.toLowerCase().split(K),o=r.length;o>s;s++)n=r[s],n&&(i=jQuery.propFix[n]||n,a=ee.test(n),a||jQuery.attr(e,n,""),e.removeAttribute(te?n:i),a&&i in e&&(e[i]=!1))},attrHooks:{type:{set:function(e,t){if(J.test(e.nodeName)&&e.parentNode)jQuery.error("type property can't be changed");else if(!jQuery.support.radioValue&&"radio"===t&&jQuery.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}},value:{get:function(e,t){return G&&jQuery.nodeName(e,"button")?G.get(e,t):t in e?e.value:null},set:function(e,t,i){return G&&jQuery.nodeName(e,"button")?G.set(e,t,i):(e.value=t,a)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,t,i){var r,n,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!jQuery.isXMLDoc(e),o&&(t=jQuery.propFix[t]||t,n=jQuery.propHooks[t]),i!==a?n&&"set"in n&&(r=n.set(e,i,t))!==a?r:e[t]=i:n&&"get"in n&&null!==(r=n.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=e.getAttributeNode("tabindex");return t&&t.specified?parseInt(t.value,10):Z.test(e.nodeName)||Q.test(e.nodeName)&&e.href?0:a}}}}),jQuery.attrHooks.tabindex=jQuery.propHooks.tabIndex,j={get:function(e,t){var i,r=jQuery.prop(e,t);return r===!0||"boolean"!=typeof r&&(i=e.getAttributeNode(t))&&i.nodeValue!==!1?t.toLowerCase():a},set:function(e,t,i){var r;return t===!1?jQuery.removeAttr(e,i):(r=jQuery.propFix[i]||i,r in e&&(e[r]=!0),e.setAttribute(i,i.toLowerCase())),i}},te||(q={name:!0,id:!0,coords:!0},G=jQuery.valHooks.button={get:function(e,t){var i;return i=e.getAttributeNode(t),i&&(q[t]?""!==i.nodeValue:i.specified)?i.nodeValue:a},set:function(e,t,i){var r=e.getAttributeNode(i);return r||(r=B.createAttribute(i),e.setAttributeNode(r)),r.nodeValue=t+""}},jQuery.attrHooks.tabindex.set=G.set,jQuery.each(["width","height"],function(e,t){jQuery.attrHooks[t]=jQuery.extend(jQuery.attrHooks[t],{set:function(e,i){return""===i?(e.setAttribute(t,"auto"),i):a}})}),jQuery.attrHooks.contenteditable={get:G.get,set:function(e,t,i){""===t&&(t="false"),G.set(e,t,i)}}),jQuery.support.hrefNormalized||jQuery.each(["href","src","width","height"],function(e,t){jQuery.attrHooks[t]=jQuery.extend(jQuery.attrHooks[t],{get:function(e){var i=e.getAttribute(t,2);return null===i?a:i}})}),jQuery.support.style||(jQuery.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||a},set:function(e,t){return e.style.cssText=""+t}}),jQuery.support.optSelected||(jQuery.propHooks.selected=jQuery.extend(jQuery.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),jQuery.support.enctype||(jQuery.propFix.enctype="encoding"),jQuery.support.checkOn||jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]=jQuery.extend(jQuery.valHooks[this],{set:function(e,t){return jQuery.isArray(t)?e.checked=jQuery.inArray(jQuery(e).val(),t)>=0:a}})});var ie=/^(?:textarea|input|select)$/i,re=/^([^\.]*)?(?:\.(.+))?$/,ne=/(?:^|\s)hover(\.\S+)?\b/,oe=/^key/,ae=/^(?:mouse|contextmenu)|click/,se=/^(?:focusinfocus|focusoutblur)$/,le=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,de=function(e){var t=le.exec(e);return t&&(t[1]=(t[1]||"").toLowerCase(),t[3]=t[3]&&RegExp("(?:^|\\s)"+t[3]+"(?:\\s|$)")),t},he=function(e,t){var i=e.attributes||{};return(!t[1]||e.nodeName.toLowerCase()===t[1])&&(!t[2]||(i.id||{}).value===t[2])&&(!t[3]||t[3].test((i["class"]||{}).value))},pe=function(e){return jQuery.event.special.hover?e:e.replace(ne,"mouseenter$1 mouseleave$1")};jQuery.event={add:function(e,t,i,r,n){var o,s,l,d,h,p,c,u,_,f,g;if(3!==e.nodeType&&8!==e.nodeType&&t&&i&&(o=jQuery._data(e))){for(i.handler&&(_=i,i=_.handler,n=_.selector),i.guid||(i.guid=jQuery.guid++),l=o.events,l||(o.events=l={}),s=o.handle,s||(o.handle=s=function(e){return a===jQuery||e&&jQuery.event.triggered===e.type?a:jQuery.event.dispatch.apply(s.elem,arguments)},s.elem=e),t=jQuery.trim(pe(t)).split(" "),d=0;d<t.length;d++)h=re.exec(t[d])||[],p=h[1],c=(h[2]||"").split(".").sort(),g=jQuery.event.special[p]||{},p=(n?g.delegateType:g.bindType)||p,g=jQuery.event.special[p]||{},u=jQuery.extend({type:p,origType:h[1],data:r,handler:i,guid:i.guid,selector:n,quick:n&&de(n),namespace:c.join(".")},_),f=l[p],f||(f=l[p]=[],f.delegateCount=0,g.setup&&g.setup.call(e,r,c,s)!==!1||(e.addEventListener?e.addEventListener(p,s,!1):e.attachEvent&&e.attachEvent("on"+p,s))),g.add&&(g.add.call(e,u),u.handler.guid||(u.handler.guid=i.guid)),n?f.splice(f.delegateCount++,0,u):f.push(u),jQuery.event.global[p]=!0;e=null}},global:{},remove:function(e,t,i,r,n){var o,a,s,l,d,h,p,c,u,_,f,g,v=jQuery.hasData(e)&&jQuery._data(e);if(v&&(c=v.events)){for(t=jQuery.trim(pe(t||"")).split(" "),o=0;o<t.length;o++)if(a=re.exec(t[o])||[],s=l=a[1],d=a[2],s){for(u=jQuery.event.special[s]||{},s=(r?u.delegateType:u.bindType)||s,f=c[s]||[],h=f.length,d=d?RegExp("(^|\\.)"+d.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null,p=0;p<f.length;p++)g=f[p],!n&&l!==g.origType||i&&i.guid!==g.guid||d&&!d.test(g.namespace)||r&&r!==g.selector&&("**"!==r||!g.selector)||(f.splice(p--,1),g.selector&&f.delegateCount--,u.remove&&u.remove.call(e,g));0===f.length&&h!==f.length&&(u.teardown&&u.teardown.call(e,d)!==!1||jQuery.removeEvent(e,s,v.handle),delete c[s])}else for(s in c)jQuery.event.remove(e,s+t[o],i,r,!0);jQuery.isEmptyObject(c)&&(_=v.handle,_&&(_.elem=null),jQuery.removeData(e,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(e,t,i,r){if(!i||3!==i.nodeType&&8!==i.nodeType){var n,s,l,d,h,p,c,u,_,f,g=e.type||e,v=[];if(!se.test(g+jQuery.event.triggered)&&(g.indexOf("!")>=0&&(g=g.slice(0,-1),s=!0),g.indexOf(".")>=0&&(v=g.split("."),g=v.shift(),v.sort()),i&&!jQuery.event.customEvent[g]||jQuery.event.global[g]))if(e="object"==typeof e?e[jQuery.expando]?e:new jQuery.Event(g,e):new jQuery.Event(g),e.type=g,e.isTrigger=!0,e.exclusive=s,e.namespace=v.join("."),e.namespace_re=e.namespace?RegExp("(^|\\.)"+v.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,p=g.indexOf(":")<0?"on"+g:"",i){if(e.result=a,e.target||(e.target=i),t=null!=t?jQuery.makeArray(t):[],t.unshift(e),c=jQuery.event.special[g]||{},!c.trigger||c.trigger.apply(i,t)!==!1){if(_=[[i,c.bindType||g]],!r&&!c.noBubble&&!jQuery.isWindow(i)){for(f=c.delegateType||g,d=se.test(f+g)?i:i.parentNode,h=null;d;d=d.parentNode)_.push([d,f]),h=d;h&&h===i.ownerDocument&&_.push([h.defaultView||h.parentWindow||o,f])}for(l=0;l<_.length&&!e.isPropagationStopped();l++)d=_[l][0],e.type=_[l][1],u=(jQuery._data(d,"events")||{})[e.type]&&jQuery._data(d,"handle"),u&&u.apply(d,t),u=p&&d[p],u&&jQuery.acceptData(d)&&u.apply(d,t)===!1&&e.preventDefault();return e.type=g,r||e.isDefaultPrevented()||c._default&&c._default.apply(i.ownerDocument,t)!==!1||"click"===g&&jQuery.nodeName(i,"a")||!jQuery.acceptData(i)||p&&i[g]&&("focus"!==g&&"blur"!==g||0!==e.target.offsetWidth)&&!jQuery.isWindow(i)&&(h=i[p],h&&(i[p]=null),jQuery.event.triggered=g,i[g](),jQuery.event.triggered=a,h&&(i[p]=h)),e.result}}else{n=jQuery.cache;for(l in n)n[l].events&&n[l].events[g]&&jQuery.event.trigger(e,t,n[l].handle.elem,!0)}}},dispatch:function(e){e=jQuery.event.fix(e||o.event);var t,i,r,n,s,l,d,h,p,c,u=(jQuery._data(this,"events")||{})[e.type]||[],_=u.delegateCount,f=[].slice.call(arguments,0),g=!e.exclusive&&!e.namespace,v=jQuery.event.special[e.type]||{},m=[];if(f[0]=e,e.delegateTarget=this,!v.preDispatch||v.preDispatch.call(this,e)!==!1){if(_&&(!e.button||"click"!==e.type))for(n=jQuery(this),n.context=this.ownerDocument||this,r=e.target;r!=this;r=r.parentNode||this)if(r.disabled!==!0){for(l={},h=[],n[0]=r,t=0;_>t;t++)p=u[t],c=p.selector,l[c]===a&&(l[c]=p.quick?he(r,p.quick):n.is(c)),l[c]&&h.push(p);h.length&&m.push({elem:r,matches:h})}for(u.length>_&&m.push({elem:this,matches:u.slice(_)}),t=0;t<m.length&&!e.isPropagationStopped();t++)for(d=m[t],e.currentTarget=d.elem,i=0;i<d.matches.length&&!e.isImmediatePropagationStopped();i++)p=d.matches[i],(g||!e.namespace&&!p.namespace||e.namespace_re&&e.namespace_re.test(p.namespace))&&(e.data=p.data,e.handleObj=p,s=((jQuery.event.special[p.origType]||{}).handle||p.handler).apply(d.elem,f),s!==a&&(e.result=s,s===!1&&(e.preventDefault(),e.stopPropagation())));return v.postDispatch&&v.postDispatch.call(this,e),e.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var i,r,n,o=t.button,s=t.fromElement;return null==e.pageX&&null!=t.clientX&&(i=e.target.ownerDocument||B,r=i.documentElement,n=i.body,e.pageX=t.clientX+(r&&r.scrollLeft||n&&n.scrollLeft||0)-(r&&r.clientLeft||n&&n.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||n&&n.scrollTop||0)-(r&&r.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?t.toElement:s),e.which||o===a||(e.which=1&o?1:2&o?3:4&o?2:0),e}},fix:function(e){if(e[jQuery.expando])return e;var t,i,r=e,n=jQuery.event.fixHooks[e.type]||{},o=n.props?this.props.concat(n.props):this.props;for(e=jQuery.Event(r),t=o.length;t;)i=o[--t],e[i]=r[i];return e.target||(e.target=r.srcElement||B),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey===a&&(e.metaKey=e.ctrlKey),n.filter?n.filter(e,r):e},special:{ready:{setup:jQuery.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,i){jQuery.isWindow(this)&&(this.onbeforeunload=i)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,i,r){var n=jQuery.extend(new jQuery.Event,i,{type:e,isSimulated:!0,originalEvent:{}});r?jQuery.event.trigger(n,null,t):jQuery.event.dispatch.call(t,n),n.isDefaultPrevented()&&i.preventDefault()}},jQuery.event.handle=jQuery.event.dispatch,jQuery.removeEvent=B.removeEventListener?function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i,!1)}:function(e,t,i){e.detachEvent&&e.detachEvent("on"+t,i)},jQuery.Event=function(e,t){return this instanceof jQuery.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?c:p):this.type=e,t&&jQuery.extend(this,t),this.timeStamp=e&&e.timeStamp||jQuery.now(),this[jQuery.expando]=!0,a):new jQuery.Event(e,t)},jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=c;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=c;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=c,this.stopPropagation()},isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p},jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){jQuery.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,r=this,n=e.relatedTarget,o=e.handleObj;o.selector;return n&&(n===r||jQuery.contains(r,n))||(e.type=o.origType,i=o.handler.apply(this,arguments),e.type=t),i}}}),jQuery.support.submitBubbles||(jQuery.event.special.submit={setup:function(){return jQuery.nodeName(this,"form")?!1:(jQuery.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,i=jQuery.nodeName(t,"input")||jQuery.nodeName(t,"button")?t.form:a;i&&!i._submit_attached&&(jQuery.event.add(i,"submit._submit",function(e){e._submit_bubble=!0}),i._submit_attached=!0)}),a)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&jQuery.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return jQuery.nodeName(this,"form")?!1:(jQuery.event.remove(this,"._submit"),a)}}),jQuery.support.changeBubbles||(jQuery.event.special.change={setup:function(){return ie.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(jQuery.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),jQuery.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1,jQuery.event.simulate("change",this,e,!0))})),!1):(jQuery.event.add(this,"beforeactivate._change",function(e){var t=e.target;ie.test(t.nodeName)&&!t._change_attached&&(jQuery.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||jQuery.event.simulate("change",this.parentNode,e,!0)}),t._change_attached=!0)}),a)},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):a},teardown:function(){return jQuery.event.remove(this,"._change"),ie.test(this.nodeName)}}),jQuery.support.focusinBubbles||jQuery.each({focus:"focusin",blur:"focusout"},function(e,t){var i=0,r=function(e){jQuery.event.simulate(t,e.target,jQuery.event.fix(e),!0)};jQuery.event.special[t]={setup:function(){0===i++&&B.addEventListener(e,r,!0)},teardown:function(){0===--i&&B.removeEventListener(e,r,!0)}}}),jQuery.fn.extend({on:function(e,t,i,r,n){
var o,s;if("object"==typeof e){"string"!=typeof t&&(i=i||t,t=a);for(s in e)this.on(s,t,i,e[s],n);return this}if(null==i&&null==r?(r=t,i=t=a):null==r&&("string"==typeof t?(r=i,i=a):(r=i,i=t,t=a)),r===!1)r=p;else if(!r)return this;return 1===n&&(o=r,r=function(e){return jQuery().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=jQuery.guid++)),this.each(function(){jQuery.event.add(this,e,r,i,t)})},one:function(e,t,i,r){return this.on(e,t,i,r,1)},off:function(e,t,i){if(e&&e.preventDefault&&e.handleObj){var r=e.handleObj;return jQuery(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this}if("object"==typeof e){for(var n in e)this.off(n,t,e[n]);return this}return t!==!1&&"function"!=typeof t||(i=t,t=a),i===!1&&(i=p),this.each(function(){jQuery.event.remove(this,e,i,t)})},bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,i){return jQuery(this.context).on(e,this.selector,t,i),this},die:function(e,t){return jQuery(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,i,r){return this.on(t,e,i,r)},undelegate:function(e,t,i){return 1==arguments.length?this.off(e,"**"):this.off(t,e,i)},trigger:function(e,t){return this.each(function(){jQuery.event.trigger(e,t,this)})},triggerHandler:function(e,t){return this[0]?jQuery.event.trigger(e,t,this[0],!0):a},toggle:function(e){var t=arguments,i=e.guid||jQuery.guid++,r=0,n=function(i){var n=(jQuery._data(this,"lastToggle"+e.guid)||0)%r;return jQuery._data(this,"lastToggle"+e.guid,n+1),i.preventDefault(),t[n].apply(this,arguments)||!1};for(n.guid=i;r<t.length;)t[r++].guid=i;return this.click(n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){jQuery.fn[t]=function(e,i){return null==i&&(i=e,e=null),arguments.length>0?this.on(t,null,e,i):this.trigger(t)},jQuery.attrFn&&(jQuery.attrFn[t]=!0),oe.test(t)&&(jQuery.event.fixHooks[t]=jQuery.event.keyHooks),ae.test(t)&&(jQuery.event.fixHooks[t]=jQuery.event.mouseHooks)}),function(){function e(e,t,i,n,o,a){for(var s=0,l=n.length;l>s;s++){var d=n[s];if(d){var h=!1;for(d=d[e];d;){if(d[r]===i){h=n[d.sizset];break}if(1!==d.nodeType||a||(d[r]=i,d.sizset=s),d.nodeName.toLowerCase()===t){h=d;break}d=d[e]}n[s]=h}}}function t(e,t,i,n,o,a){for(var s=0,l=n.length;l>s;s++){var d=n[s];if(d){var h=!1;for(d=d[e];d;){if(d[r]===i){h=n[d.sizset];break}if(1===d.nodeType)if(a||(d[r]=i,d.sizset=s),"string"!=typeof t){if(d===t){h=!0;break}}else if(c.filter(t,[d]).length>0){h=d;break}d=d[e]}n[s]=h}}}var i=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,r="sizcache"+(Math.random()+"").replace(".",""),n=0,o=Object.prototype.toString,s=!1,l=!0,d=/\\/g,h=/\r\n/g,p=/\W/;[0,0].sort(function(){return l=!1,0});var c=function(e,t,r,n){r=r||[],t=t||B;var a=t;if(1!==t.nodeType&&9!==t.nodeType)return[];if(!e||"string"!=typeof e)return r;var s,l,d,h,p,u,g,v,y=!0,w=c.isXML(t),T=[],S=e;do if(i.exec(""),s=i.exec(S),s&&(S=s[3],T.push(s[1]),s[2])){h=s[3];break}while(s);if(T.length>1&&f.exec(e))if(2===T.length&&_.relative[T[0]])l=b(T[0]+T[1],t,n);else for(l=_.relative[T[0]]?[t]:c(T.shift(),t);T.length;)e=T.shift(),_.relative[e]&&(e+=T.shift()),l=b(e,l,n);else if(!n&&T.length>1&&9===t.nodeType&&!w&&_.match.ID.test(T[0])&&!_.match.ID.test(T[T.length-1])&&(p=c.find(T.shift(),t,w),t=p.expr?c.filter(p.expr,p.set)[0]:p.set[0]),t)for(p=n?{expr:T.pop(),set:m(n)}:c.find(T.pop(),1!==T.length||"~"!==T[0]&&"+"!==T[0]||!t.parentNode?t:t.parentNode,w),l=p.expr?c.filter(p.expr,p.set):p.set,T.length>0?d=m(l):y=!1;T.length;)u=T.pop(),g=u,_.relative[u]?g=T.pop():u="",null==g&&(g=t),_.relative[u](d,g,w);else d=T=[];if(d||(d=l),d||c.error(u||e),"[object Array]"===o.call(d))if(y)if(t&&1===t.nodeType)for(v=0;null!=d[v];v++)d[v]&&(d[v]===!0||1===d[v].nodeType&&c.contains(t,d[v]))&&r.push(l[v]);else for(v=0;null!=d[v];v++)d[v]&&1===d[v].nodeType&&r.push(l[v]);else r.push.apply(r,d);else m(d,r);return h&&(c(h,a,r,n),c.uniqueSort(r)),r};c.uniqueSort=function(e){if(w&&(s=l,e.sort(w),s))for(var t=1;t<e.length;t++)e[t]===e[t-1]&&e.splice(t--,1);return e},c.matches=function(e,t){return c(e,null,null,t)},c.matchesSelector=function(e,t){return c(t,null,null,[e]).length>0},c.find=function(e,t,i){var r,n,o,s,l,h;if(!e)return[];for(n=0,o=_.order.length;o>n;n++)if(l=_.order[n],(s=_.leftMatch[l].exec(e))&&(h=s[1],s.splice(1,1),"\\"!==h.substr(h.length-1)&&(s[1]=(s[1]||"").replace(d,""),r=_.find[l](s,t,i),null!=r))){e=e.replace(_.match[l],"");break}return r||(r=a!==t.getElementsByTagName?t.getElementsByTagName("*"):[]),{set:r,expr:e}},c.filter=function(e,t,i,r){for(var n,o,s,l,d,h,p,u,f,g=e,v=[],m=t,y=t&&t[0]&&c.isXML(t[0]);e&&t.length;){for(s in _.filter)if(null!=(n=_.leftMatch[s].exec(e))&&n[2]){if(h=_.filter[s],p=n[1],o=!1,n.splice(1,1),"\\"===p.substr(p.length-1))continue;if(m===v&&(v=[]),_.preFilter[s])if(n=_.preFilter[s](n,m,i,v,r,y)){if(n===!0)continue}else o=l=!0;if(n)for(u=0;null!=(d=m[u]);u++)d&&(l=h(d,n,u,m),f=r^l,i&&null!=l?f?o=!0:m[u]=!1:f&&(v.push(d),o=!0));if(l!==a){if(i||(m=v),e=e.replace(_.match[s],""),!o)return[];break}}if(e===g){if(null!=o)break;c.error(e)}g=e}return m},c.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)};var u=c.getText=function(e){var t,i,r=e.nodeType,n="";if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;if("string"==typeof e.innerText)return e.innerText.replace(h,"");for(e=e.firstChild;e;e=e.nextSibling)n+=u(e)}else if(3===r||4===r)return e.nodeValue}else for(t=0;i=e[t];t++)8!==i.nodeType&&(n+=u(i));return n},_=c.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(e,t){var i="string"==typeof t,r=i&&!p.test(t),n=i&&!r;r&&(t=t.toLowerCase());for(var o,a=0,s=e.length;s>a;a++)if(o=e[a]){for(;(o=o.previousSibling)&&1!==o.nodeType;);e[a]=n||o&&o.nodeName.toLowerCase()===t?o||!1:o===t}n&&c.filter(t,e,!0)},">":function(e,t){var i,r="string"==typeof t,n=0,o=e.length;if(r&&!p.test(t)){for(t=t.toLowerCase();o>n;n++)if(i=e[n]){var a=i.parentNode;e[n]=a.nodeName.toLowerCase()===t?a:!1}}else{for(;o>n;n++)i=e[n],i&&(e[n]=r?i.parentNode:i.parentNode===t);r&&c.filter(t,e,!0)}},"":function(i,r,o){var a,s=n++,l=t;"string"!=typeof r||p.test(r)||(r=r.toLowerCase(),a=r,l=e),l("parentNode",r,s,i,a,o)},"~":function(i,r,o){var a,s=n++,l=t;"string"!=typeof r||p.test(r)||(r=r.toLowerCase(),a=r,l=e),l("previousSibling",r,s,i,a,o)}},find:{ID:function(e,t,i){if(a!==t.getElementById&&!i){var r=t.getElementById(e[1]);return r&&r.parentNode?[r]:[]}},NAME:function(e,t){if(a!==t.getElementsByName){for(var i=[],r=t.getElementsByName(e[1]),n=0,o=r.length;o>n;n++)r[n].getAttribute("name")===e[1]&&i.push(r[n]);return 0===i.length?null:i}},TAG:function(e,t){return a!==t.getElementsByTagName?t.getElementsByTagName(e[1]):a}},preFilter:{CLASS:function(e,t,i,r,n,o){if(e=" "+e[1].replace(d,"")+" ",o)return e;for(var a,s=0;null!=(a=t[s]);s++)a&&(n^(a.className&&(" "+a.className+" ").replace(/[\t\n\r]/g," ").indexOf(e)>=0)?i||r.push(a):i&&(t[s]=!1));return!1},ID:function(e){return e[1].replace(d,"")},TAG:function(e,t){return e[1].replace(d,"").toLowerCase()},CHILD:function(e){if("nth"===e[1]){e[2]||c.error(e[0]),e[2]=e[2].replace(/^\+|\s*/g,"");var t=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even"===e[2]&&"2n"||"odd"===e[2]&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=t[1]+(t[2]||1)-0,e[3]=t[3]-0}else e[2]&&c.error(e[0]);return e[0]=n++,e},ATTR:function(e,t,i,r,n,o){var a=e[1]=e[1].replace(d,"");return!o&&_.attrMap[a]&&(e[1]=_.attrMap[a]),e[4]=(e[4]||e[5]||"").replace(d,""),"~="===e[2]&&(e[4]=" "+e[4]+" "),e},PSEUDO:function(e,t,r,n,o){if("not"===e[1]){if(!((i.exec(e[3])||"").length>1||/^\w/.test(e[3]))){var a=c.filter(e[3],t,r,!0^o);return r||n.push.apply(n,a),!1}e[3]=c(e[3],null,null,t)}else if(_.match.POS.test(e[0])||_.match.CHILD.test(e[0]))return!0;return e},POS:function(e){return e.unshift(!0),e}},filters:{enabled:function(e){return e.disabled===!1&&"hidden"!==e.type},disabled:function(e){return e.disabled===!0},checked:function(e){return e.checked===!0},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!!e.firstChild},empty:function(e){return!e.firstChild},has:function(e,t,i){return!!c(i[3],e).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){var t=e.getAttribute("type"),i=e.type;return"input"===e.nodeName.toLowerCase()&&"text"===i&&(t===i||null===t)},radio:function(e){return"input"===e.nodeName.toLowerCase()&&"radio"===e.type},checkbox:function(e){return"input"===e.nodeName.toLowerCase()&&"checkbox"===e.type},file:function(e){return"input"===e.nodeName.toLowerCase()&&"file"===e.type},password:function(e){return"input"===e.nodeName.toLowerCase()&&"password"===e.type},submit:function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&"submit"===e.type},image:function(e){return"input"===e.nodeName.toLowerCase()&&"image"===e.type},reset:function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&"reset"===e.type},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t){return 0===t},last:function(e,t,i,r){return t===r.length-1},even:function(e,t){return t%2===0},odd:function(e,t){return t%2===1},lt:function(e,t,i){return t<i[3]-0},gt:function(e,t,i){return t>i[3]-0},nth:function(e,t,i){return i[3]-0===t},eq:function(e,t,i){return i[3]-0===t}},filter:{PSEUDO:function(e,t,i,r){var n=t[1],o=_.filters[n];if(o)return o(e,i,t,r);if("contains"===n)return(e.textContent||e.innerText||u([e])||"").indexOf(t[3])>=0;if("not"===n){for(var a=t[3],s=0,l=a.length;l>s;s++)if(a[s]===e)return!1;return!0}c.error(n)},CHILD:function(e,t){var i,n,o,a,s,l,d=t[1],h=e;switch(d){case"only":case"first":for(;h=h.previousSibling;)if(1===h.nodeType)return!1;if("first"===d)return!0;h=e;case"last":for(;h=h.nextSibling;)if(1===h.nodeType)return!1;return!0;case"nth":if(i=t[2],n=t[3],1===i&&0===n)return!0;if(o=t[0],a=e.parentNode,a&&(a[r]!==o||!e.nodeIndex)){for(s=0,h=a.firstChild;h;h=h.nextSibling)1===h.nodeType&&(h.nodeIndex=++s);a[r]=o}return l=e.nodeIndex-n,0===i?0===l:l%i===0&&l/i>=0}},ID:function(e,t){return 1===e.nodeType&&e.getAttribute("id")===t},TAG:function(e,t){return"*"===t&&1===e.nodeType||!!e.nodeName&&e.nodeName.toLowerCase()===t},CLASS:function(e,t){return(" "+(e.className||e.getAttribute("class"))+" ").indexOf(t)>-1},ATTR:function(e,t){var i=t[1],r=c.attr?c.attr(e,i):_.attrHandle[i]?_.attrHandle[i](e):null!=e[i]?e[i]:e.getAttribute(i),n=r+"",o=t[2],a=t[4];return null==r?"!="===o:!o&&c.attr?null!=r:"="===o?n===a:"*="===o?n.indexOf(a)>=0:"~="===o?(" "+n+" ").indexOf(a)>=0:a?"!="===o?n!==a:"^="===o?0===n.indexOf(a):"$="===o?n.substr(n.length-a.length)===a:"|="===o?n===a||n.substr(0,a.length+1)===a+"-":!1:n&&r!==!1},POS:function(e,t,i,r){var n=t[2],o=_.setFilters[n];return o?o(e,i,t,r):a}}},f=_.match.POS,g=function(e,t){return"\\"+(t-0+1)};for(var v in _.match)_.match[v]=RegExp(_.match[v].source+/(?![^\[]*\])(?![^\(]*\))/.source),_.leftMatch[v]=RegExp(/(^(?:.|\r|\n)*?)/.source+_.match[v].source.replace(/\\(\d+)/g,g));_.match.globalPOS=f;var m=function(e,t){return e=Array.prototype.slice.call(e,0),t?(t.push.apply(t,e),t):e};try{Array.prototype.slice.call(B.documentElement.childNodes,0)[0].nodeType}catch(y){m=function(e,t){var i=0,r=t||[];if("[object Array]"===o.call(e))Array.prototype.push.apply(r,e);else if("number"==typeof e.length)for(var n=e.length;n>i;i++)r.push(e[i]);else for(;e[i];i++)r.push(e[i]);return r}}var w,T;B.documentElement.compareDocumentPosition?w=function(e,t){return e===t?(s=!0,0):e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t)?-1:1:e.compareDocumentPosition?-1:1}:(w=function(e,t){if(e===t)return s=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var i,r,n=[],o=[],a=e.parentNode,l=t.parentNode,d=a;if(a===l)return T(e,t);if(!a)return-1;if(!l)return 1;for(;d;)n.unshift(d),d=d.parentNode;for(d=l;d;)o.unshift(d),d=d.parentNode;i=n.length,r=o.length;for(var h=0;i>h&&r>h;h++)if(n[h]!==o[h])return T(n[h],o[h]);return h===i?T(e,o[h],-1):T(n[h],t,1)},T=function(e,t,i){if(e===t)return i;for(var r=e.nextSibling;r;){if(r===t)return-1;r=r.nextSibling}return 1}),function(){var e=B.createElement("div"),t="script"+(new Date).getTime(),i=B.documentElement;e.innerHTML="<a name='"+t+"'/>",i.insertBefore(e,i.firstChild),B.getElementById(t)&&(_.find.ID=function(e,t,i){if(a!==t.getElementById&&!i){var r=t.getElementById(e[1]);return r?r.id===e[1]||a!==r.getAttributeNode&&r.getAttributeNode("id").nodeValue===e[1]?[r]:a:[]}},_.filter.ID=function(e,t){var i=a!==e.getAttributeNode&&e.getAttributeNode("id");return 1===e.nodeType&&i&&i.nodeValue===t}),i.removeChild(e),i=e=null}(),function(){var e=B.createElement("div");e.appendChild(B.createComment("")),e.getElementsByTagName("*").length>0&&(_.find.TAG=function(e,t){var i=t.getElementsByTagName(e[1]);if("*"===e[1]){for(var r=[],n=0;i[n];n++)1===i[n].nodeType&&r.push(i[n]);i=r}return i}),e.innerHTML="<a href='#'></a>",e.firstChild&&a!==e.firstChild.getAttribute&&"#"!==e.firstChild.getAttribute("href")&&(_.attrHandle.href=function(e){return e.getAttribute("href",2)}),e=null}(),B.querySelectorAll&&!function(){var e=c,t=B.createElement("div"),i="__sizzle__";if(t.innerHTML="<p class='TEST'></p>",!t.querySelectorAll||0!==t.querySelectorAll(".TEST").length){c=function(t,r,n,o){if(r=r||B,!o&&!c.isXML(r)){var a=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(t);if(a&&(1===r.nodeType||9===r.nodeType)){if(a[1])return m(r.getElementsByTagName(t),n);if(a[2]&&_.find.CLASS&&r.getElementsByClassName)return m(r.getElementsByClassName(a[2]),n)}if(9===r.nodeType){if("body"===t&&r.body)return m([r.body],n);if(a&&a[3]){var s=r.getElementById(a[3]);if(!s||!s.parentNode)return m([],n);if(s.id===a[3])return m([s],n)}try{return m(r.querySelectorAll(t),n)}catch(l){}}else if(1===r.nodeType&&"object"!==r.nodeName.toLowerCase()){var d=r,h=r.getAttribute("id"),p=h||i,u=r.parentNode,f=/^\s*[+~]/.test(t);h?p=p.replace(/'/g,"\\$&"):r.setAttribute("id",p),f&&u&&(r=r.parentNode);try{if(!f||u)return m(r.querySelectorAll("[id='"+p+"'] "+t),n)}catch(g){}finally{h||d.removeAttribute("id")}}}return e(t,r,n,o)};for(var r in e)c[r]=e[r];t=null}}(),function(){var e=B.documentElement,t=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(t){var i=!t.call(B.createElement("div"),"div"),r=!1;try{t.call(B.documentElement,"[test!='']:sizzle")}catch(n){r=!0}c.matchesSelector=function(e,n){if(n=n.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']"),!c.isXML(e))try{if(r||!_.match.PSEUDO.test(n)&&!/!=/.test(n)){var o=t.call(e,n);if(o||!i||e.document&&11!==e.document.nodeType)return o}}catch(a){}return c(n,null,null,[e]).length>0}}}(),function(){var e=B.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>",e.getElementsByClassName&&0!==e.getElementsByClassName("e").length&&(e.lastChild.className="e",1!==e.getElementsByClassName("e").length&&(_.order.splice(1,0,"CLASS"),_.find.CLASS=function(e,t,i){return a===t.getElementsByClassName||i?a:t.getElementsByClassName(e[1])},e=null))}(),B.documentElement.contains?c.contains=function(e,t){return e!==t&&(e.contains?e.contains(t):!0)}:B.documentElement.compareDocumentPosition?c.contains=function(e,t){return!!(16&e.compareDocumentPosition(t))}:c.contains=function(){return!1},c.isXML=function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?"HTML"!==t.nodeName:!1};var b=function(e,t,i){for(var r,n=[],o="",a=t.nodeType?[t]:t;r=_.match.PSEUDO.exec(e);)o+=r[0],e=e.replace(_.match.PSEUDO,"");e=_.relative[e]?e+"*":e;for(var s=0,l=a.length;l>s;s++)c(e,a[s],n,i);return c.filter(o,n)};c.attr=jQuery.attr,c.selectors.attrMap={},jQuery.find=c,jQuery.expr=c.selectors,jQuery.expr[":"]=jQuery.expr.filters,jQuery.unique=c.uniqueSort,jQuery.text=c.getText,jQuery.isXMLDoc=c.isXML,jQuery.contains=c.contains}();var ce=/Until$/,ue=/^(?:parents|prevUntil|prevAll)/,_e=/,/,fe=/^.[^:#\[\.,]*$/,ge=Array.prototype.slice,ve=jQuery.expr.match.globalPOS,me={children:!0,contents:!0,next:!0,prev:!0};jQuery.fn.extend({find:function(e){var t,i,r=this;if("string"!=typeof e)return jQuery(e).filter(function(){for(t=0,i=r.length;i>t;t++)if(jQuery.contains(r[t],this))return!0});var n,o,a,s=this.pushStack("","find",e);for(t=0,i=this.length;i>t;t++)if(n=s.length,jQuery.find(e,this[t],s),t>0)for(o=n;o<s.length;o++)for(a=0;n>a;a++)if(s[a]===s[o]){s.splice(o--,1);break}return s},has:function(e){var t=jQuery(e);return this.filter(function(){for(var e=0,i=t.length;i>e;e++)if(jQuery.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(_(this,e,!1),"not",e)},filter:function(e){return this.pushStack(_(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?ve.test(e)?jQuery(e,this.context).index(this[0])>=0:jQuery.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var i,r,n=[],o=this[0];if(jQuery.isArray(e)){for(var a=1;o&&o.ownerDocument&&o!==t;){for(i=0;i<e.length;i++)jQuery(o).is(e[i])&&n.push({selector:e[i],elem:o,level:a});o=o.parentNode,a++}return n}var s=ve.test(e)||"string"!=typeof e?jQuery(e,t||this.context):0;for(i=0,r=this.length;r>i;i++)for(o=this[i];o;){if(s?s.index(o)>-1:jQuery.find.matchesSelector(o,e)){n.push(o);break}if(o=o.parentNode,!o||!o.ownerDocument||o===t||11===o.nodeType)break}return n=n.length>1?jQuery.unique(n):n,this.pushStack(n,"closest",e)},index:function(e){return e?"string"==typeof e?jQuery.inArray(this[0],jQuery(e)):jQuery.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var i="string"==typeof e?jQuery(e,t):jQuery.makeArray(e&&e.nodeType?[e]:e),r=jQuery.merge(this.get(),i);return this.pushStack(u(i[0])||u(r[0])?r:jQuery.unique(r))},andSelf:function(){return this.add(this.prevObject)}}),jQuery.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return jQuery.dir(e,"parentNode")},parentsUntil:function(e,t,i){return jQuery.dir(e,"parentNode",i)},next:function(e){return jQuery.nth(e,2,"nextSibling")},prev:function(e){return jQuery.nth(e,2,"previousSibling")},nextAll:function(e){return jQuery.dir(e,"nextSibling")},prevAll:function(e){return jQuery.dir(e,"previousSibling")},nextUntil:function(e,t,i){return jQuery.dir(e,"nextSibling",i)},prevUntil:function(e,t,i){return jQuery.dir(e,"previousSibling",i)},siblings:function(e){return jQuery.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return jQuery.sibling(e.firstChild)},contents:function(e){return jQuery.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:jQuery.makeArray(e.childNodes)}},function(e,t){jQuery.fn[e]=function(i,r){var n=jQuery.map(this,t,i);return ce.test(e)||(r=i),r&&"string"==typeof r&&(n=jQuery.filter(r,n)),n=this.length>1&&!me[e]?jQuery.unique(n):n,(this.length>1||_e.test(r))&&ue.test(e)&&(n=n.reverse()),this.pushStack(n,e,ge.call(arguments).join(","))}}),jQuery.extend({filter:function(e,t,i){return i&&(e=":not("+e+")"),1===t.length?jQuery.find.matchesSelector(t[0],e)?[t[0]]:[]:jQuery.find.matches(e,t)},dir:function(e,t,i){for(var r=[],n=e[t];n&&9!==n.nodeType&&(i===a||1!==n.nodeType||!jQuery(n).is(i));)1===n.nodeType&&r.push(n),n=n[t];return r},nth:function(e,t,i,r){t=t||1;for(var n=0;e&&(1!==e.nodeType||++n!==t);e=e[i]);return e},sibling:function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i}});var ye="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",we=/ jQuery\d+="(?:\d+|null)"/g,Te=/^\s+/,be=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Se=/<([\w:]+)/,Ce=/<tbody/i,xe=/<|&#?\w+;/,Pe=/<(?:script|style)/i,Le=/<(?:script|object|embed|option|style)/i,Ee=RegExp("<(?:"+ye+")[\\s/>]","i"),Ve=/checked\s*(?:[^=]|=\s*.checked.)/i,Ie=/\/(java|ecma)script/i,Ae=/^\s*<!(?:\[CDATA\[|\-\-)/,ke={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Re=f(B);ke.optgroup=ke.option,ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,jQuery.support.htmlSerialize||(ke._default=[1,"div<div>","</div>"]),jQuery.fn.extend({text:function(e){return jQuery.access(this,function(e){return e===a?jQuery.text(this):this.empty().append((this[0]&&this[0].ownerDocument||B).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).wrapAll(e.call(this,t))});if(this[0]){var t=jQuery(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapInner(e.call(this,t))}):this.each(function(){var t=jQuery(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=jQuery.isFunction(e);return this.each(function(i){jQuery(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){1===this.nodeType&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){1===this.nodeType&&this.insertBefore(e,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=jQuery.clean(arguments);return e.push.apply(e,this.toArray()),this.pushStack(e,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=this.pushStack(this,"after",arguments);return e.push.apply(e,jQuery.clean(arguments)),e}},remove:function(e,t){for(var i,r=0;null!=(i=this[r]);r++)e&&!jQuery.filter(e,[i]).length||(t||1!==i.nodeType||(jQuery.cleanData(i.getElementsByTagName("*")),jQuery.cleanData([i])),i.parentNode&&i.parentNode.removeChild(i));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&jQuery.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return jQuery.clone(this,e,t)})},html:function(e){return jQuery.access(this,function(e){var t=this[0]||{},i=0,r=this.length;if(e===a)return 1===t.nodeType?t.innerHTML.replace(we,""):null;if("string"==typeof e&&!Pe.test(e)&&(jQuery.support.leadingWhitespace||!Te.test(e))&&!ke[(Se.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(be,"<$1></$2>");try{for(;r>i;i++)t=this[i]||{},1===t.nodeType&&(jQuery.cleanData(t.getElementsByTagName("*")),t.innerHTML=e);t=0}catch(n){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return this[0]&&this[0].parentNode?jQuery.isFunction(e)?this.each(function(t){var i=jQuery(this),r=i.html();i.replaceWith(e.call(this,t,r))}):("string"!=typeof e&&(e=jQuery(e).detach()),this.each(function(){var t=this.nextSibling,i=this.parentNode;jQuery(this).remove(),t?jQuery(t).before(e):jQuery(i).append(e)})):this.length?this.pushStack(jQuery(jQuery.isFunction(e)?e():e),"replaceWith",e):this},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,i){var r,n,o,s,l=e[0],d=[];if(!jQuery.support.checkClone&&3===arguments.length&&"string"==typeof l&&Ve.test(l))return this.each(function(){jQuery(this).domManip(e,t,i,!0)});if(jQuery.isFunction(l))return this.each(function(r){var n=jQuery(this);e[0]=l.call(this,r,t?n.html():a),n.domManip(e,t,i)});if(this[0]){if(s=l&&l.parentNode,r=jQuery.support.parentNode&&s&&11===s.nodeType&&s.childNodes.length===this.length?{fragment:s}:jQuery.buildFragment(e,this,d),o=r.fragment,n=1===o.childNodes.length?o=o.firstChild:o.firstChild){t=t&&jQuery.nodeName(n,"tr");for(var h=0,p=this.length,c=p-1;p>h;h++)i.call(t?g(this[h],n):this[h],r.cacheable||p>1&&c>h?jQuery.clone(o,!0,!0):o)}d.length&&jQuery.each(d,function(e,t){t.src?jQuery.ajax({type:"GET",global:!1,url:t.src,async:!1,dataType:"script"}):jQuery.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Ae,"/*$0*/")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),jQuery.buildFragment=function(e,t,i){var r,n,o,a,s=e[0];return t&&t[0]&&(a=t[0].ownerDocument||t[0]),a.createDocumentFragment||(a=B),!(1===e.length&&"string"==typeof s&&s.length<512&&a===B&&"<"===s.charAt(0))||Le.test(s)||!jQuery.support.checkClone&&Ve.test(s)||!jQuery.support.html5Clone&&Ee.test(s)||(n=!0,o=jQuery.fragments[s],o&&1!==o&&(r=o)),r||(r=a.createDocumentFragment(),jQuery.clean(e,a,r,i)),n&&(jQuery.fragments[s]=o?r:1),{fragment:r,cacheable:n}},jQuery.fragments={},jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){jQuery.fn[e]=function(i){var r=[],n=jQuery(i),o=1===this.length&&this[0].parentNode;if(o&&11===o.nodeType&&1===o.childNodes.length&&1===n.length)return n[t](this[0]),this;for(var a=0,s=n.length;s>a;a++){var l=(a>0?this.clone(!0):this).get();jQuery(n[a])[t](l),r=r.concat(l)}return this.pushStack(r,e,n.selector)}}),jQuery.extend({clone:function(e,t,i){var r,n,o,a=jQuery.support.html5Clone||jQuery.isXMLDoc(e)||!Ee.test("<"+e.nodeName+">")?e.cloneNode(!0):b(e);if(!(jQuery.support.noCloneEvent&&jQuery.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||jQuery.isXMLDoc(e)))for(m(e,a),r=y(e),n=y(a),o=0;r[o];++o)n[o]&&m(r[o],n[o]);if(t&&(v(e,a),i))for(r=y(e),n=y(a),o=0;r[o];++o)v(r[o],n[o]);return r=n=null,a},clean:function(e,t,i,r){var n,o,s,l=[];t=t||B,a===t.createElement&&(t=t.ownerDocument||t[0]&&t[0].ownerDocument||B);for(var d,h=0;null!=(d=e[h]);h++)if("number"==typeof d&&(d+=""),d){if("string"==typeof d)if(xe.test(d)){d=d.replace(be,"<$1></$2>");var p,c=(Se.exec(d)||["",""])[1].toLowerCase(),u=ke[c]||ke._default,_=u[0],g=t.createElement("div"),v=Re.childNodes;for(t===B?Re.appendChild(g):f(t).appendChild(g),g.innerHTML=u[1]+d+u[2];_--;)g=g.lastChild;if(!jQuery.support.tbody){var m=Ce.test(d),y="table"!==c||m?"<table>"!==u[1]||m?[]:g.childNodes:g.firstChild&&g.firstChild.childNodes;for(s=y.length-1;s>=0;--s)jQuery.nodeName(y[s],"tbody")&&!y[s].childNodes.length&&y[s].parentNode.removeChild(y[s])}!jQuery.support.leadingWhitespace&&Te.test(d)&&g.insertBefore(t.createTextNode(Te.exec(d)[0]),g.firstChild),d=g.childNodes,g&&(g.parentNode.removeChild(g),v.length>0&&(p=v[v.length-1],p&&p.parentNode&&p.parentNode.removeChild(p)))}else d=t.createTextNode(d);var w;if(!jQuery.support.appendChecked)if(d[0]&&"number"==typeof(w=d.length))for(s=0;w>s;s++)T(d[s]);else T(d);d.nodeType?l.push(d):l=jQuery.merge(l,d)}if(i)for(n=function(e){return!e.type||Ie.test(e.type)},h=0;l[h];h++)if(o=l[h],r&&jQuery.nodeName(o,"script")&&(!o.type||Ie.test(o.type)))r.push(o.parentNode?o.parentNode.removeChild(o):o);else{if(1===o.nodeType){var b=jQuery.grep(o.getElementsByTagName("script"),n);l.splice.apply(l,[h+1,0].concat(b))}i.appendChild(o)}return l},cleanData:function(e){for(var t,i,r,n=jQuery.cache,o=jQuery.event.special,a=jQuery.support.deleteExpando,s=0;null!=(r=e[s]);s++)if((!r.nodeName||!jQuery.noData[r.nodeName.toLowerCase()])&&(i=r[jQuery.expando])){if(t=n[i],t&&t.events){for(var l in t.events)o[l]?jQuery.event.remove(r,l):jQuery.removeEvent(r,l,t.handle);t.handle&&(t.handle.elem=null)}a?delete r[jQuery.expando]:r.removeAttribute&&r.removeAttribute(jQuery.expando),delete n[i]}}});var Me,Oe,$e,De=/alpha\([^)]*\)/i,Be=/opacity=([^)]*)/,Ne=/([A-Z]|^ms)/g,Fe=/^[\-+]?(?:\d*\.)?\d+$/i,We=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,He=/^([\-+])=([\-+.\de]+)/,ze=/^margin/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ge=["Top","Right","Bottom","Left"];jQuery.fn.css=function(e,t){return jQuery.access(this,function(e,t,i){return i!==a?jQuery.style(e,t,i):jQuery.css(e,t)},e,t,arguments.length>1)},jQuery.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=Me(e,"opacity");return""===i?"1":i}return e.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":jQuery.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,i,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var n,o,s=jQuery.camelCase(t),l=e.style,d=jQuery.cssHooks[s];if(t=jQuery.cssProps[s]||s,i===a)return d&&"get"in d&&(n=d.get(e,!1,r))!==a?n:l[t];if(o=typeof i,"string"===o&&(n=He.exec(i))&&(i=+(n[1]+1)*+n[2]+parseFloat(jQuery.css(e,t)),o="number"),!(null==i||"number"===o&&isNaN(i)||("number"!==o||jQuery.cssNumber[s]||(i+="px"),d&&"set"in d&&(i=d.set(e,i))===a)))try{l[t]=i}catch(h){}}},css:function(e,t,i){var r,n;return t=jQuery.camelCase(t),n=jQuery.cssHooks[t],t=jQuery.cssProps[t]||t,"cssFloat"===t&&(t="float"),n&&"get"in n&&(r=n.get(e,!0,i))!==a?r:Me?Me(e,t):a},swap:function(e,t,i){var r,n,o={};for(n in t)o[n]=e.style[n],e.style[n]=t[n];r=i.call(e);for(n in t)e.style[n]=o[n];return r}}),jQuery.curCSS=jQuery.css,B.defaultView&&B.defaultView.getComputedStyle&&(Oe=function(e,t){var i,r,n,o,a=e.style;return t=t.replace(Ne,"-$1").toLowerCase(),(r=e.ownerDocument.defaultView)&&(n=r.getComputedStyle(e,null))&&(i=n.getPropertyValue(t),""!==i||jQuery.contains(e.ownerDocument.documentElement,e)||(i=jQuery.style(e,t))),!jQuery.support.pixelMargin&&n&&ze.test(t)&&We.test(i)&&(o=a.width,a.width=i,i=n.width,a.width=o),i}),B.documentElement.currentStyle&&($e=function(e,t){var i,r,n,o=e.currentStyle&&e.currentStyle[t],a=e.style;return null==o&&a&&(n=a[t])&&(o=n),We.test(o)&&(i=a.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),a.left="fontSize"===t?"1em":o,o=a.pixelLeft+"px",a.left=i,r&&(e.runtimeStyle.left=r)),""===o?"auto":o}),Me=Oe||$e,jQuery.each(["height","width"],function(e,t){jQuery.cssHooks[t]={get:function(e,i,r){return i?0!==e.offsetWidth?S(e,t,r):jQuery.swap(e,Ue,function(){return S(e,t,r)}):a},set:function(e,t){return Fe.test(t)?t+"px":t}}}),jQuery.support.opacity||(jQuery.cssHooks.opacity={get:function(e,t){return Be.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?parseFloat(RegExp.$1)/100+"":t?"1":""},set:function(e,t){var i=e.style,r=e.currentStyle,n=jQuery.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||i.filter||"";i.zoom=1,t>=1&&""===jQuery.trim(o.replace(De,""))&&(i.removeAttribute("filter"),r&&!r.filter)||(i.filter=De.test(o)?o.replace(De,n):o+" "+n);
}}),jQuery(function(){jQuery.support.reliableMarginRight||(jQuery.cssHooks.marginRight={get:function(e,t){return jQuery.swap(e,{display:"inline-block"},function(){return t?Me(e,"margin-right"):e.style.marginRight})}})}),jQuery.expr&&jQuery.expr.filters&&(jQuery.expr.filters.hidden=function(e){var t=e.offsetWidth,i=e.offsetHeight;return 0===t&&0===i||!jQuery.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||jQuery.css(e,"display"))},jQuery.expr.filters.visible=function(e){return!jQuery.expr.filters.hidden(e)}),jQuery.each({margin:"",padding:"",border:"Width"},function(e,t){jQuery.cssHooks[e+t]={expand:function(i){var r,n="string"==typeof i?i.split(" "):[i],o={};for(r=0;4>r;r++)o[e+Ge[r]+t]=n[r]||n[r-2]||n[0];return o}}});var je,qe,Ye=/%20/g,Ke=/\[\]$/,Xe=/\r?\n/g,Je=/#.*$/,Ze=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Qe=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,et=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,tt=/^(?:GET|HEAD)$/,it=/^\/\//,rt=/\?/,nt=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,ot=/^(?:select|textarea)/i,at=/\s+/,st=/([?&])_=[^&]*/,lt=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,dt=jQuery.fn.load,ht={},pt={},ct=["*/"]+["*"];try{je=F.href}catch(ut){je=B.createElement("a"),je.href="",je=je.href}qe=lt.exec(je.toLowerCase())||[],jQuery.fn.extend({load:function(e,t,i){if("string"!=typeof e&&dt)return dt.apply(this,arguments);if(!this.length)return this;var r=e.indexOf(" ");if(r>=0){var n=e.slice(r,e.length);e=e.slice(0,r)}var o="GET";t&&(jQuery.isFunction(t)?(i=t,t=a):"object"==typeof t&&(t=jQuery.param(t,jQuery.ajaxSettings.traditional),o="POST"));var s=this;return jQuery.ajax({url:e,type:o,dataType:"html",data:t,complete:function(e,t,r){r=e.responseText,e.isResolved()&&(e.done(function(e){r=e}),s.html(n?jQuery("<div>").append(r.replace(nt,"")).find(n):r)),i&&s.each(i,[r,t,e])}}),this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ot.test(this.nodeName)||Qe.test(this.type))}).map(function(e,t){var i=jQuery(this).val();return null==i?null:jQuery.isArray(i)?jQuery.map(i,function(e,i){return{name:t.name,value:e.replace(Xe,"\r\n")}}):{name:t.name,value:i.replace(Xe,"\r\n")}}).get()}}),jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){jQuery.fn[t]=function(e){return this.on(t,e)}}),jQuery.each(["get","post"],function(e,t){jQuery[t]=function(e,i,r,n){return jQuery.isFunction(i)&&(n=n||r,r=i,i=a),jQuery.ajax({type:t,url:e,data:i,success:r,dataType:n})}}),jQuery.extend({getScript:function(e,t){return jQuery.get(e,a,t,"script")},getJSON:function(e,t,i){return jQuery.get(e,t,i,"json")},ajaxSetup:function(e,t){return t?P(e,jQuery.ajaxSettings):(t=e,e=jQuery.ajaxSettings),P(e,t),e},ajaxSettings:{url:je,isLocal:et.test(qe[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":ct},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":o.String,"text html":!0,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:C(ht),ajaxTransport:C(pt),ajax:function(e,t){function i(e,t,i,o){if(2!==w){w=2,l&&clearTimeout(l),s=a,n=o||"",T.readyState=e>0?4:0;var d,p,m,y,b,S=t,C=i?E(c,T,i):a;if(e>=200&&300>e||304===e)if(c.ifModified&&((y=T.getResponseHeader("Last-Modified"))&&(jQuery.lastModified[r]=y),(b=T.getResponseHeader("Etag"))&&(jQuery.etag[r]=b)),304===e)S="notmodified",d=!0;else try{p=V(c,C),S="success",d=!0}catch(x){S="parsererror",m=x}else m=S,S&&!e||(S="error",0>e&&(e=0));T.status=e,T.statusText=""+(t||S),d?f.resolveWith(u,[p,S,T]):f.rejectWith(u,[T,S,m]),T.statusCode(v),v=a,h&&_.trigger("ajax"+(d?"Success":"Error"),[T,c,d?p:m]),g.fireWith(u,[T,S]),h&&(_.trigger("ajaxComplete",[T,c]),--jQuery.active||jQuery.event.trigger("ajaxStop"))}}"object"==typeof e&&(t=e,e=a),t=t||{};var r,n,o,s,l,d,h,p,c=jQuery.ajaxSetup({},t),u=c.context||c,_=u!==c&&(u.nodeType||u instanceof jQuery)?jQuery(u):jQuery.event,f=jQuery.Deferred(),g=jQuery.Callbacks("once memory"),v=c.statusCode||{},m={},y={},w=0,T={readyState:0,setRequestHeader:function(e,t){if(!w){var i=e.toLowerCase();e=y[i]=y[i]||e,m[e]=t}return this},getAllResponseHeaders:function(){return 2===w?n:null},getResponseHeader:function(e){var t;if(2===w){if(!o)for(o={};t=Ze.exec(n);)o[t[1].toLowerCase()]=t[2];t=o[e.toLowerCase()]}return t===a?null:t},overrideMimeType:function(e){return w||(c.mimeType=e),this},abort:function(e){return e=e||"abort",s&&s.abort(e),i(0,e),this}};if(f.promise(T),T.success=T.done,T.error=T.fail,T.complete=g.add,T.statusCode=function(e){if(e){var t;if(2>w)for(t in e)v[t]=[v[t],e[t]];else t=e[T.status],T.then(t,t)}return this},c.url=((e||c.url)+"").replace(Je,"").replace(it,qe[1]+"//"),c.dataTypes=jQuery.trim(c.dataType||"*").toLowerCase().split(at),null==c.crossDomain&&(d=lt.exec(c.url.toLowerCase()),c.crossDomain=!(!d||d[1]==qe[1]&&d[2]==qe[2]&&(d[3]||("http:"===d[1]?80:443))==(qe[3]||("http:"===qe[1]?80:443)))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=jQuery.param(c.data,c.traditional)),x(ht,c,t,T),2===w)return!1;if(h=c.global,c.type=c.type.toUpperCase(),c.hasContent=!tt.test(c.type),h&&0===jQuery.active++&&jQuery.event.trigger("ajaxStart"),!c.hasContent&&(c.data&&(c.url+=(rt.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url,c.cache===!1)){var b=jQuery.now(),S=c.url.replace(st,"$1_="+b);c.url=S+(S===c.url?(rt.test(c.url)?"&":"?")+"_="+b:"")}(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,jQuery.lastModified[r]&&T.setRequestHeader("If-Modified-Since",jQuery.lastModified[r]),jQuery.etag[r]&&T.setRequestHeader("If-None-Match",jQuery.etag[r])),T.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+ct+"; q=0.01":""):c.accepts["*"]);for(p in c.headers)T.setRequestHeader(p,c.headers[p]);if(c.beforeSend&&(c.beforeSend.call(u,T,c)===!1||2===w))return T.abort(),!1;for(p in{success:1,error:1,complete:1})T[p](c[p]);if(s=x(pt,c,t,T)){T.readyState=1,h&&_.trigger("ajaxSend",[T,c]),c.async&&c.timeout>0&&(l=setTimeout(function(){T.abort("timeout")},c.timeout));try{w=1,s.send(m,i)}catch(C){if(!(2>w))throw C;i(-1,C)}}else i(-1,"No Transport");return T},param:function(e,t){var i=[],r=function(e,t){t=jQuery.isFunction(t)?t():t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===a&&(t=jQuery.ajaxSettings.traditional),jQuery.isArray(e)||e.jquery&&!jQuery.isPlainObject(e))jQuery.each(e,function(){r(this.name,this.value)});else for(var n in e)L(n,e[n],t,r);return i.join("&").replace(Ye,"+")}}),jQuery.extend({active:0,lastModified:{},etag:{}});var _t=jQuery.now(),ft=/(\=)\?(&|$)|\?\?/i;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return jQuery.expando+"_"+_t++}}),jQuery.ajaxPrefilter("json jsonp",function(e,t,i){var r="string"==typeof e.data&&/^application\/x\-www\-form\-urlencoded/.test(e.contentType);if("jsonp"===e.dataTypes[0]||e.jsonp!==!1&&(ft.test(e.url)||r&&ft.test(e.data))){var n,a=e.jsonpCallback=jQuery.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s=o[a],l=e.url,d=e.data,h="$1"+a+"$2";return e.jsonp!==!1&&(l=l.replace(ft,h),e.url===l&&(r&&(d=d.replace(ft,h)),e.data===d&&(l+=(/\?/.test(l)?"&":"?")+e.jsonp+"="+a))),e.url=l,e.data=d,o[a]=function(e){n=[e]},i.always(function(){o[a]=s,n&&jQuery.isFunction(s)&&o[a](n[0])}),e.converters["script json"]=function(){return n||jQuery.error(a+" was not called"),n[0]},e.dataTypes[0]="json","script"}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return jQuery.globalEval(e),e}}}),jQuery.ajaxPrefilter("script",function(e){e.cache===a&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),jQuery.ajaxTransport("script",function(e){if(e.crossDomain){var t,i=B.head||B.getElementsByTagName("head")[0]||B.documentElement;return{send:function(r,n){t=B.createElement("script"),t.async="async",e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,r){(r||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,i&&t.parentNode&&i.removeChild(t),t=a,r||n(200,"success"))},i.insertBefore(t,i.firstChild)},abort:function(){t&&t.onload(0,1)}}}});var gt,vt=o.ActiveXObject?function(){for(var e in gt)gt[e](0,1)}:!1,mt=0;jQuery.ajaxSettings.xhr=o.ActiveXObject?function(){return!this.isLocal&&I()||A()}:I,function(e){jQuery.extend(jQuery.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(jQuery.ajaxSettings.xhr()),jQuery.support.ajax&&jQuery.ajaxTransport(function(e){if(!e.crossDomain||jQuery.support.cors){var t;return{send:function(i,r){var n,s,l=e.xhr();if(e.username?l.open(e.type,e.url,e.async,e.username,e.password):l.open(e.type,e.url,e.async),e.xhrFields)for(s in e.xhrFields)l[s]=e.xhrFields[s];e.mimeType&&l.overrideMimeType&&l.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(d){}l.send(e.hasContent&&e.data||null),t=function(i,o){var s,d,h,p,c;try{if(t&&(o||4===l.readyState))if(t=a,n&&(l.onreadystatechange=jQuery.noop,vt&&delete gt[n]),o)4!==l.readyState&&l.abort();else{s=l.status,h=l.getAllResponseHeaders(),p={},c=l.responseXML,c&&c.documentElement&&(p.xml=c);try{p.text=l.responseText}catch(i){}try{d=l.statusText}catch(u){d=""}s||!e.isLocal||e.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(_){o||r(-1,_)}p&&r(s,d,p,h)},e.async&&4!==l.readyState?(n=++mt,vt&&(gt||(gt={},jQuery(o).unload(vt)),gt[n]=t),l.onreadystatechange=t):t()},abort:function(){t&&t(0,1)}}}});var yt,wt,Tt,bt,St={},Ct=/^(?:toggle|show|hide)$/,xt=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,Pt=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];jQuery.fn.extend({show:function(e,t,i){var r,n;if(e||0===e)return this.animate(M("show",3),e,t,i);for(var o=0,a=this.length;a>o;o++)r=this[o],r.style&&(n=r.style.display,jQuery._data(r,"olddisplay")||"none"!==n||(n=r.style.display=""),(""===n&&"none"===jQuery.css(r,"display")||!jQuery.contains(r.ownerDocument.documentElement,r))&&jQuery._data(r,"olddisplay",O(r.nodeName)));for(o=0;a>o;o++)r=this[o],r.style&&(n=r.style.display,""!==n&&"none"!==n||(r.style.display=jQuery._data(r,"olddisplay")||""));return this},hide:function(e,t,i){if(e||0===e)return this.animate(M("hide",3),e,t,i);for(var r,n,o=0,a=this.length;a>o;o++)r=this[o],r.style&&(n=jQuery.css(r,"display"),"none"===n||jQuery._data(r,"olddisplay")||jQuery._data(r,"olddisplay",n));for(o=0;a>o;o++)this[o].style&&(this[o].style.display="none");return this},_toggle:jQuery.fn.toggle,toggle:function(e,t,i){var r="boolean"==typeof e;return jQuery.isFunction(e)&&jQuery.isFunction(t)?this._toggle.apply(this,arguments):null==e||r?this.each(function(){var t=r?e:jQuery(this).is(":hidden");jQuery(this)[t?"show":"hide"]()}):this.animate(M("toggle",3),e,t,i),this},fadeTo:function(e,t,i,r){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:t},e,i,r)},animate:function(e,t,i,r){function n(){o.queue===!1&&jQuery._mark(this);var t,i,r,n,a,s,l,d,h,p,c,u=jQuery.extend({},o),_=1===this.nodeType,f=_&&jQuery(this).is(":hidden");u.animatedProperties={};for(r in e)if(t=jQuery.camelCase(r),r!==t&&(e[t]=e[r],delete e[r]),(a=jQuery.cssHooks[t])&&"expand"in a){s=a.expand(e[t]),delete e[t];for(r in s)r in e||(e[r]=s[r])}for(t in e){if(i=e[t],jQuery.isArray(i)?(u.animatedProperties[t]=i[1],i=e[t]=i[0]):u.animatedProperties[t]=u.specialEasing&&u.specialEasing[t]||u.easing||"swing","hide"===i&&f||"show"===i&&!f)return u.complete.call(this);!_||"height"!==t&&"width"!==t||(u.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],"inline"===jQuery.css(this,"display")&&"none"===jQuery.css(this,"float")&&(jQuery.support.inlineBlockNeedsLayout&&"inline"!==O(this.nodeName)?this.style.zoom=1:this.style.display="inline-block"))}null!=u.overflow&&(this.style.overflow="hidden");for(r in e)n=new jQuery.fx(this,u,r),i=e[r],Ct.test(i)?(c=jQuery._data(this,"toggle"+r)||("toggle"===i?f?"show":"hide":0),c?(jQuery._data(this,"toggle"+r,"show"===c?"hide":"show"),n[c]()):n[i]()):(l=xt.exec(i),d=n.cur(),l?(h=parseFloat(l[2]),p=l[3]||(jQuery.cssNumber[r]?"":"px"),"px"!==p&&(jQuery.style(this,r,(h||1)+p),d=(h||1)/n.cur()*d,jQuery.style(this,r,d+p)),l[1]&&(h=("-="===l[1]?-1:1)*h+d),n.custom(d,h,p)):n.custom(d,i,""));return!0}var o=jQuery.speed(t,i,r);return jQuery.isEmptyObject(e)?this.each(o.complete,[!1]):(e=jQuery.extend({},e),o.queue===!1?this.each(n):this.queue(o.queue,n))},stop:function(e,t,i){return"string"!=typeof e&&(i=t,t=e,e=a),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){function t(e,t,r){var n=t[r];jQuery.removeData(e,r,!0),n.stop(i)}var r,n=!1,o=jQuery.timers,a=jQuery._data(this);if(i||jQuery._unmark(!0,this),null==e)for(r in a)a[r]&&a[r].stop&&r.indexOf(".run")===r.length-4&&t(this,a,r);else a[r=e+".run"]&&a[r].stop&&t(this,a,r);for(r=o.length;r--;)o[r].elem!==this||null!=e&&o[r].queue!==e||(i?o[r](!0):o[r].saveState(),n=!0,o.splice(r,1));i&&n||jQuery.dequeue(this,e)})}}),jQuery.each({slideDown:M("show",1),slideUp:M("hide",1),slideToggle:M("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){jQuery.fn[e]=function(e,i,r){return this.animate(t,e,i,r)}}),jQuery.extend({speed:function(e,t,i){var r=e&&"object"==typeof e?jQuery.extend({},e):{complete:i||!i&&t||jQuery.isFunction(e)&&e,duration:e,easing:i&&t||t&&!jQuery.isFunction(t)&&t};return r.duration=jQuery.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in jQuery.fx.speeds?jQuery.fx.speeds[r.duration]:jQuery.fx.speeds._default,null!=r.queue&&r.queue!==!0||(r.queue="fx"),r.old=r.complete,r.complete=function(e){jQuery.isFunction(r.old)&&r.old.call(this),r.queue?jQuery.dequeue(this,r.queue):e!==!1&&jQuery._unmark(this)},r},easing:{linear:function(e){return e},swing:function(e){return-Math.cos(e*Math.PI)/2+.5}},timers:[],fx:function(e,t,i){this.options=t,this.elem=e,this.prop=i,t.orig=t.orig||{}}}),jQuery.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this)},cur:function(){if(null!=this.elem[this.prop]&&(!this.elem.style||null==this.elem.style[this.prop]))return this.elem[this.prop];var e,t=jQuery.css(this.elem,this.prop);return isNaN(e=parseFloat(t))?t&&"auto"!==t?t:0:e},custom:function(e,t,i){function r(e){return n.step(e)}var n=this,o=jQuery.fx;this.startTime=bt||k(),this.end=t,this.now=this.start=e,this.pos=this.state=0,this.unit=i||this.unit||(jQuery.cssNumber[this.prop]?"":"px"),r.queue=this.options.queue,r.elem=this.elem,r.saveState=function(){jQuery._data(n.elem,"fxshow"+n.prop)===a&&(n.options.hide?jQuery._data(n.elem,"fxshow"+n.prop,n.start):n.options.show&&jQuery._data(n.elem,"fxshow"+n.prop,n.end))},r()&&jQuery.timers.push(r)&&!Tt&&(Tt=setInterval(o.tick,o.interval))},show:function(){var e=jQuery._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||jQuery.style(this.elem,this.prop),this.options.show=!0,e!==a?this.custom(this.cur(),e):this.custom("width"===this.prop||"height"===this.prop?1:0,this.cur()),jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery._data(this.elem,"fxshow"+this.prop)||jQuery.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(e){var t,i,r,n=bt||k(),o=!0,a=this.elem,s=this.options;if(e||n>=s.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),s.animatedProperties[this.prop]=!0;for(t in s.animatedProperties)s.animatedProperties[t]!==!0&&(o=!1);if(o){if(null==s.overflow||jQuery.support.shrinkWrapBlocks||jQuery.each(["","X","Y"],function(e,t){a.style["overflow"+t]=s.overflow[e]}),s.hide&&jQuery(a).hide(),s.hide||s.show)for(t in s.animatedProperties)jQuery.style(a,t,s.orig[t]),jQuery.removeData(a,"fxshow"+t,!0),jQuery.removeData(a,"toggle"+t,!0);r=s.complete,r&&(s.complete=!1,r.call(a))}return!1}return s.duration==1/0?this.now=n:(i=n-this.startTime,this.state=i/s.duration,this.pos=jQuery.easing[s.animatedProperties[this.prop]](this.state,i,0,1,s.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},jQuery.extend(jQuery.fx,{tick:function(){for(var e,t=jQuery.timers,i=0;i<t.length;i++)e=t[i],e()||t[i]!==e||t.splice(i--,1);t.length||jQuery.fx.stop()},interval:13,stop:function(){clearInterval(Tt),Tt=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){jQuery.style(e.elem,"opacity",e.now)},_default:function(e){e.elem.style&&null!=e.elem.style[e.prop]?e.elem.style[e.prop]=e.now+e.unit:e.elem[e.prop]=e.now}}}),jQuery.each(Pt.concat.apply([],Pt),function(e,t){t.indexOf("margin")&&(jQuery.fx.step[t]=function(e){jQuery.style(e.elem,t,Math.max(0,e.now)+e.unit)})}),jQuery.expr&&jQuery.expr.filters&&(jQuery.expr.filters.animated=function(e){return jQuery.grep(jQuery.timers,function(t){return e===t.elem}).length});var Lt,Et=/^t(?:able|d|h)$/i,Vt=/^(?:body|html)$/i;Lt="getBoundingClientRect"in B.documentElement?function(e,t,i,r){try{r=e.getBoundingClientRect()}catch(n){}if(!r||!jQuery.contains(i,e))return r?{top:r.top,left:r.left}:{top:0,left:0};var o=t.body,a=D(t),s=i.clientTop||o.clientTop||0,l=i.clientLeft||o.clientLeft||0,d=a.pageYOffset||jQuery.support.boxModel&&i.scrollTop||o.scrollTop,h=a.pageXOffset||jQuery.support.boxModel&&i.scrollLeft||o.scrollLeft,p=r.top+d-s,c=r.left+h-l;return{top:p,left:c}}:function(e,t,i){for(var r,n=e.offsetParent,o=e,a=t.body,s=t.defaultView,l=s?s.getComputedStyle(e,null):e.currentStyle,d=e.offsetTop,h=e.offsetLeft;(e=e.parentNode)&&e!==a&&e!==i&&(!jQuery.support.fixedPosition||"fixed"!==l.position);)r=s?s.getComputedStyle(e,null):e.currentStyle,d-=e.scrollTop,h-=e.scrollLeft,e===n&&(d+=e.offsetTop,h+=e.offsetLeft,!jQuery.support.doesNotAddBorder||jQuery.support.doesAddBorderForTableAndCells&&Et.test(e.nodeName)||(d+=parseFloat(r.borderTopWidth)||0,h+=parseFloat(r.borderLeftWidth)||0),o=n,n=e.offsetParent),jQuery.support.subtractsBorderForOverflowNotVisible&&"visible"!==r.overflow&&(d+=parseFloat(r.borderTopWidth)||0,h+=parseFloat(r.borderLeftWidth)||0),l=r;return"relative"!==l.position&&"static"!==l.position||(d+=a.offsetTop,h+=a.offsetLeft),jQuery.support.fixedPosition&&"fixed"===l.position&&(d+=Math.max(i.scrollTop,a.scrollTop),h+=Math.max(i.scrollLeft,a.scrollLeft)),{top:d,left:h}},jQuery.fn.offset=function(e){if(arguments.length)return e===a?this:this.each(function(t){jQuery.offset.setOffset(this,e,t)});var t=this[0],i=t&&t.ownerDocument;return i?t===i.body?jQuery.offset.bodyOffset(t):Lt(t,i,i.documentElement):null},jQuery.offset={bodyOffset:function(e){var t=e.offsetTop,i=e.offsetLeft;return jQuery.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(jQuery.css(e,"marginTop"))||0,i+=parseFloat(jQuery.css(e,"marginLeft"))||0),{top:t,left:i}},setOffset:function(e,t,i){var r=jQuery.css(e,"position");"static"===r&&(e.style.position="relative");var n,o,a=jQuery(e),s=a.offset(),l=jQuery.css(e,"top"),d=jQuery.css(e,"left"),h=("absolute"===r||"fixed"===r)&&jQuery.inArray("auto",[l,d])>-1,p={},c={};h?(c=a.position(),n=c.top,o=c.left):(n=parseFloat(l)||0,o=parseFloat(d)||0),jQuery.isFunction(t)&&(t=t.call(e,i,s)),null!=t.top&&(p.top=t.top-s.top+n),null!=t.left&&(p.left=t.left-s.left+o),"using"in t?t.using.call(e,p):a.css(p)}},jQuery.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),i=this.offset(),r=Vt.test(t[0].nodeName)?{top:0,left:0}:t.offset();return i.top-=parseFloat(jQuery.css(e,"marginTop"))||0,i.left-=parseFloat(jQuery.css(e,"marginLeft"))||0,r.top+=parseFloat(jQuery.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(jQuery.css(t[0],"borderLeftWidth"))||0,{top:i.top-r.top,left:i.left-r.left}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||B.body;e&&!Vt.test(e.nodeName)&&"static"===jQuery.css(e,"position");)e=e.offsetParent;return e})}}),jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var i=/Y/.test(t);jQuery.fn[e]=function(r){return jQuery.access(this,function(e,r,n){var o=D(e);return n===a?o?t in o?o[t]:jQuery.support.boxModel&&o.document.documentElement[r]||o.document.body[r]:e[r]:(o?o.scrollTo(i?jQuery(o).scrollLeft():n,i?n:jQuery(o).scrollTop()):e[r]=n,a)},e,r,arguments.length,null)}}),jQuery.each({Height:"height",Width:"width"},function(e,t){var i="client"+e,r="scroll"+e,n="offset"+e;jQuery.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(jQuery.css(e,t,"padding")):this[t]():null},jQuery.fn["outer"+e]=function(e){var i=this[0];return i?i.style?parseFloat(jQuery.css(i,t,e?"margin":"border")):this[t]():null},jQuery.fn[t]=function(e){return jQuery.access(this,function(e,t,o){var s,l,d,h;return jQuery.isWindow(e)?(s=e.document,l=s.documentElement[i],jQuery.support.boxModel&&l||s.body&&s.body[i]||l):9===e.nodeType?(s=e.documentElement,s[i]>=s[r]?s[i]:Math.max(e.body[r],s[r],e.body[n],s[n])):o===a?(d=jQuery.css(e,t),h=parseFloat(d),jQuery.isNumeric(h)?h:d):(jQuery(e).css(t,o),a)},t,e,arguments.length,null)}}),o.jQuery=o.$=jQuery,i(25)&&i(25).jQuery&&(r=[],n=function(){return jQuery}.apply(t,r),!(n!==a&&(e.exports=n)))}(window),e.exports=$},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,i){"use strict";function r(e){this._options=$.extend({interval:1},e||{}),this._e=$("<div>").addClass("intervals-container favored-list-container"),this._quick=$("<div>").addClass("quick").appendTo(this._e),this._quicked={},this._main=$("<span>").text(this.shortLabel(this._options.interval)).appendTo(this._quick),this._main.data("interval",this._options.interval),Z75.enabled("header_interval_dialog_button")&&this._setIntervalDialogButton(),this._mainSub=$("<span>").addClass("submenu").attr("title",$.t("Time Interval")).append($("<i>")).appendTo(this._e),e&&"string"==typeof e.submenuBtnAddClass&&this._mainSub.addClass(e.submenuBtnAddClass),this._quick.on("click",this._selectInterval.bind(this)),this._mainSub.on("click",this._selectMenu.bind(this)),this._menu=new n(this,this._mainSub,this._options),this.onResize=new Delegate,$44.intraday.subscribe(this._fullUpdate.bind(this)),$44.supportedResolutions.subscribe(this._fullUpdate.bind(this)),e.interval&&$44.interval.setValue(e.interval),$44.interval.subscribe(this.activateInterval.bind(this),{callWithLast:!0}),TVXWindowEvents.on("intervalwidget-change",this._onChangeInAnotherTab.bind(this)),this._fullUpdate()}var n=i(27);r.prototype.forceUpdate=function(){this._fullUpdate(!0)},r.prototype._fullUpdate=function(e){this._setupIntervals(e),this._setupQuicks(e),this.reactivateInterval(),this._resize()},r.prototype._onChangeInAnotherTab=function(){this._fullUpdate(!0)},r.prototype.isDefaultInterval=function(e){return e in Q14.defaultResolutions()},r.prototype._setupIntervals=function(){this._intervals=$.extend({},Q14.defaultResolutions())},r.prototype._sorted=function(e){Array.isArray(e)||(e=Object.keys(e));var t=function(e){var t=new TradingView.Interval(e);return t.kind()!==TradingView.Interval.MINUTES?{S:1/60,D:1440,W:10080,M:43200}[t.letter()]*t.multiplier():t.multiplier()};return e.sort(function(e,i){return t(e)-t(i)})},r.prototype.setUpStarredItemsList=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=!0;this._setupQuicks(!1,t)},r.prototype._setupQuicks=function(e,t){this._options.notShowQuicks&&!t||(t=t||{},Z75.enabled("star_some_intervals_by_default")&&(t={1:!0,30:!0,60:!0}),this._quicked=TVSettings.getJSON("IntervalWidget.quicks",t,e),this._quicked=this._removeCustomIntervalQuicks(this._quicked)),this._addQuicked(this._quicked)},r.prototype._removeCustomIntervalQuicks=function(e){var t={};return Object.keys(e).forEach(function(i){this.isDefaultInterval(i)&&(t[i]=e[i])},this),t},r.prototype.element=function(){return this._e},r.prototype.mainButton=function(){return this._main},r.prototype._quicks=function(){return this._quick.find("span").slice(0,-1)},r.prototype.postfix=function(e,t){if(t){var i=" ";switch(e){case"D":i+=$.t("day",{count:t});break;case"W":i+=$.t("week",{count:t});break;case"M":i+=$.t("month",{count:t});break;case"S":i+=$.t("second",{count:t});break;case"m":i+=$.t("minute",{count:t});break;case"h":i+=$.t("hour",{count:t})}return i}switch(e){case"m":return"";case"h":return $.t("h",{context:"dates"});default:return $.t(e.toUpperCase(),{count:0})}},r.prototype.readable=function(e,t,i){function r(e){return e>=60&&!(e%60)}var e=e,n="m",t=t,o=new TradingView.Interval(e);if(!o.isValid())throw new TypeError("Wrong interval value: "+e);return o.kind()!==TradingView.Interval.MINUTES&&(n=o.letter()),e=o.multiplier(),o.kind()===TradingView.Interval.MINUTES&&r(e)&&(e=~~(e/60),n="h"),t=t?e:null,e=i&&1===e&&o.isDWM()?"":e,""+e+this.postfix(n,t)},r.prototype.shortLabel=function(e){return TradingView.translatedIntervalString(this.readable(e,!1))},r.prototype.fullLabel=function(e){return this.readable(e,!0)},r.prototype._addQuicked=function(e){e=this._sorted(e);var t=this._quicks(),i=$(),r=(this.getInterval(),!1);t.size()>e.length&&(t.slice(e.length).remove(),r=!0);for(var n=0;n<e.length;n++){var o=e[n],a=t.eq(n),s=!1;a.size()?a.data("interval")!=o&&(s=!0):(a=$("<span>"),i=i.add(a),s=!0),s&&(a.data("interval",o).text(this.shortLabel(o)),r=!0),a.toggleClass("selected",o==this.getInterval()).toggleClass("disabled",!TradingView.IntervalHelper.isAvailable(o))}this._main.before(i),r&&this._resize()},r.prototype._resize=function(){this.onResize.fire()},r.prototype.addQuick=function(e){this._quicked[e]=!0,this._addQuicked(this._quicked),this.saveSettings(),this.reactivateInterval()},r.prototype._quickWithInterval=function(e){var t=null;return this._quicks().each(function(i,r){return r=$(r),e==r.data("interval")?(t=r,!1):void 0}),t},r.prototype.inQuick=function(e){return null!=this._quickWithInterval(e)},r.prototype.removeQuick=function(e){this._quickWithInterval(e)&&(this._quickWithInterval(e).remove(),this._resize(),delete this._quicked[e],this.saveSettings(),this.reactivateInterval())},r.prototype.toggleQuick=function(e){var t=this.inQuick(e);return t?this.removeQuick(e):this.addQuick(e),!t},r.prototype.hasQuicks=function(){return!!this._quicks().length},r.prototype.deactivate=function(e){this._quick.find("span").removeClass("selected")},r.prototype.activateInterval=function(e){this.deactivate(),this.inQuick(e)?this._quickWithInterval(e).addClass("selected"):(this.hasQuicks()&&this._main.addClass("selected"),this._main.data("interval")!=e&&(this._main.text(this.shortLabel(e)),this._main.data("interval",e),this._resize()))},r.prototype.reactivateInterval=function(){this.activateInterval(this.getInterval())},r.prototype.getInterval=function(){return $44.interval.value()},r.prototype.setInterval=function(e){$44.interval.setValue(""+e)},r.prototype._selectInterval=function(e){var t=$(e.target),i=t.data("interval");this.hasQuicks()||this.getInterval()!=i?t.hasClass("disabled")||this.setInterval(i):this._selectMenu()},r.prototype._selectMenu=function(e){this._mainSub.hasClass("active")?this._menu.close():this._menu.open(this._sorted(this._intervals))},r.prototype._setIntervalDialogButton=function(){this._intervalDialogButton=$("<span>").addClass("submenu interval-dialog-button apply-common-tooltip").attr("title",$.t("Open Interval Dialog")).append($("<i>")).appendTo(this._e).click(function(){var e=new TradingView.ChangeIntervalDialog({callback:function(e){$44.interval.setValue(e)}}).show(),t=$(this);t.addClass("active"),e.on("destroy",function(){t.removeClass("active")})})},r.prototype.addInterval=function(e){},r.prototype.removeInterval=function(e){},r.prototype.saveIntervals=function(){},r.prototype.saveQuicked=function(){TVSettings.setJSON("IntervalWidget.quicks",this._quicked)},r.prototype.saveSettings=function(){this.saveQuicked(),this.saveIntervals(),TVXWindowEvents.emit("intervalwidget-change")},e.exports=r},function(e,t){"use strict";function i(e,t,i){this._options=i||{},this._w=e,this._opener=t,this._addMetric=1,this._addOpened=!1}i.prototype._interval=function(e){var t=$(e.target);t.hasClass("disabled")||(this._w.setInterval(t.data("interval")),this.close())},i.prototype._quickTitle=function(e){return e?$.t("Remove from favorites"):$.t("Add to favorites")},i.prototype._onQuick=function(e){var t=$(e.target).closest(".item"),i=this._w.toggleQuick(t.data("interval"));return t.toggleClass("quicked",i),$(e.target).closest(".to-quick").attr("title",this._quickTitle(i)),!1},i.prototype._onDelete=function(e){var t=$(e.target.parentNode);return this._w.removeInterval(t.data("interval")),this._reopen(),!1},i.prototype._showControlButtons=function(){return!0},i.prototype._append=function(e,t){var i=$("<span>").addClass("item").toggleClass("active",t==this._w.getInterval()).toggleClass("quicked",this._w.inQuick(t)).toggleClass("disabled",!TradingView.IntervalHelper.isAvailable(t)).text(this._w.fullLabel(t)).data("interval",t);this._showControlButtons()&&(this._w.isDefaultInterval(t)||i.prepend($("<span>").addClass("delete").attr("title",$.t("Remove custom interval")).click(this._onDelete.bind(this))),this._w._options.notShowQuicks||i.prepend($("<span>").addClass("to-quick").append(svgAsset("star","16x16")).attr("title",this._quickTitle(this._w.inQuick(t))).click(this._onQuick.bind(this)))),i.click(this._interval.bind(this)),e.append(i)},i.prototype._appendAdd=function(e){function t(){var e=parseInt(n.val());1>e&&n.val(1);var t={1:1440,60:24,D:364,W:52,M:12}[this._addMetric];e>t&&n.val(t)}var i=$("<span>").addClass("item-add"),r=$('<span class="item-add-wrap">').appendTo(i),n=$('<input type="text">').addClass("tv-text-input inset minutes").val(1).appendTo(r).TVTicker(),o=$("<span>").addClass("_tv-button mins").append($("<span>")).append($("<i>")).appendTo(r),a=$("<span>").addClass("_tv-button add").text($.t("Add")).appendTo(r),s={1:$.t("minute_plural"),60:$.t("hour_plural"),D:$.t("day_plural"),W:$.t("week_plural"),M:$.t("month_plural")};o.find("span").text(s[this._addMetric||1]),n.change(t.bind(this));var l=this;TradingView.bindPopupMenu(o,null,{direction:"up",event:"button-popup",addClass:"thin small-font metrics",popupSpacing:~~this._w._options.popupSpacing,onRemove:function(){l._addOpened=!1}}),o.click(function(){l._addOpened=!0,o.trigger("button-popup",[$.map(s,function(e,i){return{title:e.toUpperCase(),active:i==l._addMetric,action:function(){return l._addMetric=i,o.find("span").text(e),t.call(l),!1}}})])}),a.click(function(){TradingView.trackGoProFeature("customIntervals"),TradingView.runOrGoPro(function(){var e=parseInt(n.val());if(e==e){var t=parseInt(l._addMetric);t==t?l._addInterval(""+e*l._addMetric):l._addInterval(""+e+l._addMetric)}},{feature:"customIntervals"})}),e.append($("<div>").addClass("separator")),e.append(i)},i.prototype._addInterval=function(e){},i.prototype._open=function(e,t){e.find(".item, .item-add, .separator").remove();var i=[],r=[],n=[],o=[],a=$("<span>").addClass("separator");$.each(t,function(e,t){var a=new TradingView.Interval(t);a.isDWM()?o.push(t):a.kind()===TradingView.Interval.HOURS?n.push(t):a.kind()===TradingView.Interval.MINUTES?r.push(t):i.push(t)}.bind(this)),i.length&&i.forEach(function(t){this._append(e,t)}.bind(this)),
r.length&&(e.append(a.clone()),r.forEach(function(t){this._append(e,t)}.bind(this))),n.length&&(e.append(a.clone()),n.forEach(function(t){this._append(e,t)}.bind(this))),o.length&&(e.append(a.clone()),o.forEach(function(t){this._append(e,t)}.bind(this))),Z75.enabled("custom_resolutions_box")&&this._appendAdd(e)},i.prototype._reopen=function(e){if(this._open(this._menu,this._w._sorted(this._w._intervals)),e&&e.highlight){var t=this._menu.find(".item").filter(function(){return $(this).data("interval")==e.highlight});t.length&&t.highlight(2)}},i.prototype.open=function(e){var t=this,i=$("<div>").addClass("charts-popup-list intervals-list favored-list").toggleClass("touch",Modernizr.touch),r=this._w.mainButton().offset(),n=this._w.mainButton().outerHeight(),o=r.top+n+parseInt(t._options.popupSpacing||0),a=10;i.appendTo(document.body),i.css({top:o,left:r.left}).show(),this._menu=i,this._opener.addClass("active"),this._open(i,e);var s=Math.min($("body").height(),$(window).height())-n-o-a;this._setMaxHeight(i,s),setTimeout(function(){i.on("mousedownoutside",function(e){this.close(e)&&i.unbind("mousedownoutside")}.bind(this))}.bind(this),0)},i.prototype._setMaxHeight=function(e,t){e.height()>=t&&(e.css("max-height",t+"px"),e.width(e.width()+18))},i.prototype.close=function(e){return e&&$(e.target).parents("span.item-add, .charts-popup-list.metrics").length?!1:e&&$(e.target).hasClass("submenu")&&$(e.target).parents(".intervals-container").length?!1:(this._menu.remove(),$(document.body).off(".interval-menu"),delete this._menu,this._opener.removeClass("active"),!0)},e.exports=i},function(e,t,i){(function(t,r){"use strict";function n(e){TradingView.Environment.isLocal()&&(window._exposed_makeAlertDialog=this);var t=this,e=e||{},i=e.Q1||TradingView.alertsDispatcher.Q1();if((!i||i.model())&&(this.id=TradingView.guid(),this.Q2=i,this._options=e,this._type=this._options.alert instanceof a?this._options.type||"edit_alert":"create_alert",this._cache={},!$("#"+this._generateIdTag()).length)){if(TradingView.Q16("alerts-maintenance"))return this._onDestroy(),void $82.showAlertMaintenanceDialog();var r=i?i.model().mainSeries().status():null;if(r===o.STATUS_OFFLINE)return void $82.showNotice($.t("Alert"),"create_alert"===this._type?$.t("Can't create alert when offline"):$.t("Can't edit alert when offline"));if(r===o.STATUS_INVALID_SYMBOL)return void $82.showNotice($.t("Alert"),"create_alert"===this._type?$.t("Can't create alert on invalid symbol"):$.t("Can't edit alert on invalid symbol"));var n=[o.STYLE_RENKO,o.STYLE_KAGI,o.STYLE_PNF,o.STYLE_PB,o.STYLE_HEIKEN_ASHI];if("create_alert"===this._type&&i&&-1!==$.inArray(i.model().mainSeries().properties().style.value(),n))return void $82.showNotice($.t("Oops!"),{html:$.t('Alerts are not yet available for this chart type. Please check <a href="https://getsatisfaction.com/tradingview/topics/alerts-support-for-renko-point-figure-kagi-line-break-and-heiken-ashi-charts" target="_blank">GetSatisfaction</a> and vote for this feature to show support for it.')});var s=i?!!i.model().mainSeries().symbolInfo():null;!i||s?this._init():!function(){var e=function(r){r&&(i.model().mainSeries().onSymbolResolved().unsubscribe(null,e),t._init())};i.model().mainSeries().onSymbolResolved().subscribe(null,e)}(),TradingView.loadTVScript()}}var o=i(31),a=i(19);n.prototype._init=function(){var e=this;"create_alert"===this._type&&this._removeOthersCreateAlertDialogs(),this._symbol=e.Q2?e.Q2.model().mainSeries().actualSymbol():$44.symbol.value(),this._resolution=$44.interval.value()||"1",e._initCurrentAlert(),e._createLayuot(),e._updateLayout({positionDialog:!0}),window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.hide()},n.prototype._removeOthersCreateAlertDialogs=function(){for(var e,t=0;t<$82.dialogs.length;t++)e=$82.dialogs[t].dialog.data("model"),e instanceof n&&"create_alert"===e._type&&e.destroy()},n.prototype.destroy=function(){var e=this;$82.destroy(e.title)},n.prototype._onDestroy=function(){var e=this;e.$dialog&&e.$dialog.find("select[sb].inited").selectbox("detach"),"edit_alert"!==e._type&&"restart_alert"!==e._type||(e._onOkSucceed&&"function"==typeof e._options.onEditSuccess&&e._options.onEditSuccess(),e._onOkSucceed||e.alert.restoreState(),e._onOkSucceed||"function"!=typeof e._options.onEditCancel||e._options.onEditCancel(),"function"==typeof e._options.onEditComplete&&e._options.onEditComplete()),e.alert&&e.alert.isNew()&&TradingView.alertsDispatcher.deleteAlert(e.alert),e._soundSelector&&e._soundSelector.destroy(),"function"==typeof e._options.onDestroy&&e._options.onDestroy(),window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.refresh()},n.prototype._initCurrentAlert=function(){var e,t,i,r=this,n=r._options.alert;if(n instanceof a)e=n.get("extra"),n.saveState(),r.alert=n;else{if(!r.Q2)return void TradingView.logError("[Alerts] Can't create alert without chart widget");if(t=r.defaults({type:"alert"}),n=TradingView.alertsDispatcher.createLocalAlert(t,!0),r.alert=n,i=r.defaults({type:"extra"}),r._options.series&&(i.mainSeries=r._prepareBandForExtra(r._options.series.uniqueId())),e=new TradingView.AlertExtra(i),n.set("extra",e),e.conditionId(r.defaults({name:"conditionId"})),r._options.drawing){var o=this._getDataSourceState(this._options.drawing.uniqueId()),s=o.plots||[];o=$.extend(!0,{},o),1===s.length?e.band($.extend(!0,{plotIndex:0},o)):1<s.length&&(e.upperBand($.extend(!0,{plotIndex:0},o)),e.lowerBand($.extend(!0,{plotIndex:1},o)))}else r._options.value&&e.band({type:"Value",value:r._formatPrice(r._options.value,e.mainSeries().uniqueId)});e.setValidConditionId()}var l=n.get("extra");(r._options.generateNewDecription||"create_alert"===r._type)&&n.set("description",r.generateDescription(n.get("symbol"),n.resolutionReadable(),l)),r._options.value&&n.isPrice()&&l.band()&&l.price(r._formatPrice(r._options.value,l.mainSeries().uniqueId))},n.prototype._createLayuot=function(){var e=this;e.title=e._generateUIdialogTitle();var t=e.$dialog=$82.createDialog(e.title,{addClass:"make-alert-dialog"});"edit_alert"===e._type&&t.attr("id",e._generateIdTag()),e._fillDialogContent(t.find("._tv-dialog-content")),$82.applyHandlers(e.$dialog,{notFocusFirst:!0,beforeDestroy:e._onDestroy.bind(e)}),t.data("model",e)},n.prototype._generateIdTag=function(){var e=this._type+"-";return e+=this.alert?this.alert.id:"new-alert"},n.prototype._generateUIdialogTitle=function(){var e,i=this;return"create_alert"===i._type?e=$.t("Create Alert on __title__",{title:i.alert.title()}):"edit_alert"===i._type?e=$.t("Edit Alert __description__ on __title__",{description:i.alert.get("description"),title:i.alert.title()}):"restart_alert"===i._type&&(e=$.t("Restart Alert __description__ on __title__",{description:i.alert.get("description"),title:i.alert.title()})),t.escape(e)},n.prototype._updateUIdialogTitle=function(){if(this.title){var e=this._generateUIdialogTitle();$82.changeTitle(this.title,e),this.title=e}},n.prototype._fillDialogContent=function(e){function t(){a.append('<tr class="divider"><td></td><td></td><td></td></tr>')}var i,r=this,n=r._UIrowsOptions(),o=$('<div class="alert-dialog-content make-alert-dialog-content"></div>').appendTo(e),a=$("<table><tbody></tbody></table>").appendTo(o).find("tbody");if(n.condition.visible&&(a.append('<tr class="main-series-row"><td>'+$.t("Condition")+'</td><td class="main-series-id-container"></td><td class="main-series-plot-index-container"></td></tr>'),a.append('<tr class="condition-id-row"><td></td><td colspan="2" class="condition-id-container"></td></tr>'),a.append('<tr class="condition-options-row"></tr>')),n.condition.visible&&n.frequency.visible&&t(),n.frequency.visible&&(a.append("<tr><td>"+$.t("Frequency")+'</td><td class="frequency-container" colspan="2"></td></tr>'),r._createUIfrequency()),n.expiration.visible)if(i=$("<tr><td>"+$.t("Expiration Time")+'</td><td colspan="2"><div class="date-container"><i></i><input type="text" placeholder="yyyy-mm-dd" name="expired-date" class="_tv-dialog-text-input"></div><div class="time-container"><i></i><input type="text" placeholder="hh:mm" name="expired-time" class="_tv-dialog-text-input"></div></td></tr>').appendTo(a),n.expiration.disabled)i.find("input").prop("disabled",!0);else{var s=i.find('[name="expired-date"]');TradingView.makeInputDateOnly(s),s.datepicker({dateFormat:"yy-mm-dd",minDate:new Date,maxDate:r.defaults({name:"datepickerMaxExpired"}),showOtherMonths:!0});var l=i.find('[name="expired-time"]');TradingView.makeInputTimeOnly(l),l.clockpicker({autoclose:!0,donetext:"OK",afterShow:function(){var e=r.$dialog.css("z-index")?r.$dialog.css("z-index")+1:null;this.popover.css("z-index",e)}}),i.find("i").click(function(e){e.stopPropagation(),i.find("input").blur(),$(this).siblings("input").focus()}),l.add(s).change(function(){var e=r._getUIexpired();r._expiredIsValid(e)&&r.update({expired:e})})}if(n.actions.visible){t();var d=$("<tr><td>"+$.t("Alert Actions")+'</td><td><label for="alert-show-popup-'+r.id+'" class="checkbox"><input id="alert-show-popup-'+r.id+'" name="show-popup" type="checkbox"> '+$.t("Show Popup")+'</label></td><td></td></tr><tr><td></td><td><label for="alert-play-sound-'+r.id+'" class="checkbox"><input id="alert-play-sound-'+r.id+'" name="play-sound" type="checkbox"> '+$.t("Play Sound")+'</label></td><td></td></tr><tr class="sound-selector-row"><td></td><td class="sound-selector-container"></td><td class="sound-selector-duration-container"></td></tr><tr><td></td><td><label for="alert-send-email-'+r.id+'" class="checkbox"><input id="alert-send-email-'+r.id+'" name="send-email" type="checkbox"> '+$.t("Send E-mail")+'</label></td><td></td></tr><tr><td></td><td><label for="alert-send-sms-'+r.id+'" class="checkbox"><input id="alert-send-sms-'+r.id+'" name="send-sms" type="checkbox"> '+$.t("Send SMS")+"</label></td><td></td></tr>").appendTo(a);n.actions.disabled&&d.find("input").prop("disabled",!0),d.find('[name="show-popup"]').change(function(){r.update({showPopup:r._getUIshowPopup()})}),d.find('[name="play-sound"]').change(function(){r.update({playSound:r._getUIplaySound()})}),d.find('[name="send-email"]').change(function(){r.update({sendEmail:r._getUIsendEmail()})}),d.find('[name="send-sms"]').change(function(){r.update({sendSms:r._getUIsendSms()})})}if(n.description.visible){t();var i=$('<tr><td style="height:30px;">'+$.t("Message")+'</td><td colspan="2" rowspan="2"><textarea style="width:100%;" placeholder="'+$.t("Description")+'" name="description"></textarea></td></tr><tr><td></td></tr>').appendTo(a);n.description.disabled&&i.find("textarea").prop("disabled",!0),i.find("textarea").change(function(){r.update({description:r._getUIdescription()})})}var h=$('<div class="alert-dialog-content alert-aftertabs"></div></div>').appendTo(e),p=$('<div class="dialog-buttons"></div>').appendTo(h);"edit_alert"===r._type&&$('<a class="_tv-button delete tv-left">'+$.t("Delete")+"</a>").click(function(e){TradingView.alertsDispatcher.deleteAlert(r.alert,{showConfirm:!0,success:function(){r.destroy()},error:function(){$82.showError($.t("Alert deleting failed. Please, try again"),r.$dialog)}})}).appendTo(p),"create_alert"===r._type&&$('<a href="https://www.tradingview.com/stock-charts-support/index.php/Alerts" target="_blank" class="_tv-dialogs-label-hint apply-common-tooltip'+("edit_alert"===r._type?"":" tv-left")+'" title="'+$.t("Wiki")+'"></a>').appendTo(p);var c={edit_alert:$.t("Done"),create_alert:$.t("Create"),restart_alert:$.t("Start")}[r._type]||$.t("OK");$('<a class="_tv-button ok">'+c+"</a>").click(r._onOkClicked.bind(r)).appendTo(p),$('<a class="_tv-button cancel">'+$.t("Cancel")+"</a>").click(function(e){r.destroy()}).appendTo(p),r._UImodifyDeafaultInputs()},n.prototype._updateLayout=function(e){function t(e,t){var i=!1;if(e||t){if(e&&t)switch(e.type!==t.type&&(i=!1),e.type){case"MainSeries":case"Study":i=e.uniqueId===t.uniqueId&&e.plotIndex===t.plotIndex;break;case"Value":i=e.value===t.value}}else i=!0;return i}var i=this,e=e||{},r=i.alert;r||TradingView.logError("[Alerts] Dialog needs alert obj with data to display");var n=r.get("extra");if(n){var o=e.mainSeries||!t(n.mainSeries(),i._getUImainSeries());o&&(i._updateUIdialogTitle(),i._setUImainSeries(n.mainSeries()));var a=function(){var r=i._getUIcondition(),o=e.condition||r.id!==n.conditionId||!t(n.upperBand(),r.upperBand)||!t(n.lowerBand(),r.lowerBand)||!t(n.band(),r.band)||n.value()!==r.value||n.period()!==r.period;return o}();(o||a)&&i._setUIcondition(n.state().condition)}i._updateUIfrequency(),(e.expired||i._expiredIsValid&&i._getUIexpired(!0)!==r.expiredUnix())&&(i._updateUIexpiredLimits(),i._setUIexpired(r.expiredUnix())),(e.sendEmail||i._getUIsendEmail()!==r.get("sendEmail"))&&i._setUIsendEmail(r.get("sendEmail")),(e.sendSms||i._getUIsendSms()!==r.get("sendSms"))&&i._setUIsendSms(r.get("sendSms")),(e.showPopup||i._getUIshowPopup()!==r.get("showPopup"))&&i._setUIshowPopup(r.get("showPopup")),(e.playSound||i._getUIplaySound()!==r.get("playSound"))&&(i._setUIplaySound(r.get("playSound")),i.UItoggleSoundSelector(r.get("playSound"))),(e.soundFile||i._getUIsoundFile()!==r.get("soundFile"))&&i._setUIsoundFile(r.get("soundFile")||i.defaults({name:"soundFile"})),(e.soundDuration||i._getUIsoundDuration()!==r.get("soundDuration"))&&i._setUIsoundDuration(void 0===r.get("soundDuration")?i.defaults({name:"soundDuration"}):r.get("soundDuration")),(e.description||i._getUIdescription()!==r.get("description"))&&i._setUIdescription(r.get("description")),e.positionDialog&&$82.positionDialog(i.$dialog,{considerScroll:!0})},n.prototype._onOkClicked=function(e){function t(){n._onOkSucceed=!0,n.destroy()}function i(e){e&&TradingView.logError("[Alerts] "+e),$82.showError($.t("Alert saving failed. Please, try again"),n.$dialog)}var n=this,o=n.alert,a=$(e.target),s={success:function(e){var o=e.get("extra");if(o.drawing()&&n.Q2){var a=r.find(n.Q2.model().Q17(),function(e){return e.uniqueId&&e.uniqueId()===o.drawing().uniqueId});a&&a.setAlert(e,{success:t,error:i})}else t()},complete:function(){a.removeClass("process")},error:i};n._isValid()&&(TradingView.trackGoProFeature("alerts",this._options.trackEvent),a.addClass("process"),TVSettings.setValue("alerts.creating.send_email",!!o.get("sendEmail")),TVSettings.setValue("alerts.creating.send_sms",!!o.get("sendSms")),TVSettings.setValue("alerts.creating.show_popup",!!o.get("showPopup")),TVSettings.setValue("alerts.creating.play_sound",!!o.get("playSound")),TVSettings.setValue("alerts.creating.sound_file",o.get("soundFile")),TVSettings.setValue("alerts.creating.sound_duration",o.get("soundDuration")),"create_alert"===n._type?TradingView.alertsDispatcher.createAlert(o,s):TradingView.alertsDispatcher.restartAlert(o,s))},n.prototype.update=function(e){function t(e,t){s.set(e,t),l[e]=!0}var i,r,n,o,a=this,s=a.alert,e=e||{},l={},d=!1;if(s){if(i=s.get("extra")){r=i.conditionId(),a._cachedConditionOptions||(a._cachedConditionOptions={}),e.mainSeries&&(n=i.mainSeriesAlerts(),i.mainSeries(e.mainSeries),o=i.mainSeriesAlerts(),n||!o||e.conditionId||(e.conditionId=TradingView.AlertConditions.ordered(i)[0].id),"MainSeries"===e.mainSeries.type?s.set({symbol:e.mainSeries.state.symbol,resolution:s.get("crossInterval")?"1":e.mainSeries.state.interval}):s.set({symbol:a._symbol,resolution:s.get("crossInterval")?"1":a._resolution}),l.mainSeries=!0,d=!0);for(var h=["upperBand","lowerBand","band","value","period"],p=h.length-1;p>=0;p--){var c=h[p];i[c]()&&(a._cachedConditionOptions[c]=i[c]())}e.conditionId&&(i.conditionId(e.conditionId,!0),l.condition=!0,d=!0);var u=i.conditionData(),_=void 0!==e.conditionId||r!==i.conditionId()||void 0!==e.upperBand||void 0!==e.lowerBand||void 0!==e.band||void 0!==e.value||void 0!==e.period;if(_){switch(i.conditionOptions({},!0),u.type){case"comparison":u.isChannel?(i.upperBand(e.upperBand||a._cachedConditionOptions.upperBand||a.defaults({name:"upperBand"}),!0),i.lowerBand(e.lowerBand||a._cachedConditionOptions.lowerBand||a.defaults({name:"lowerBand"}))):i.band(e.band||a._cachedConditionOptions.band||a.defaults({name:"band"}));break;case"moving":var f=e.value;void 0===f&&(f=a._cachedConditionOptions.value),void 0===f&&(f=a.defaults({name:"value"}));var g=e.period;void 0===g&&(g=a._cachedConditionOptions.period),void 0===g&&(g=a.defaults({name:"period"})),i.value(f),i.period(g);break;case"pine_script":break;default:TradingView.logError("[Alerts] Unknown condition type")}l.condition=!0,d=!0}}for(var v,m,y=["frequency","expired","showPopup","description","playSound","soundFile","soundDuration"],p=0;p<y.length;p++)v=y[p],m=e[v],void 0!==m&&("soundDuration"===v&&(m=parseInt(m)),t(v,m));if(void 0!==e.sendSms)if(e.sendSms&&!user.sms_email)var w=$.t("E-mail for sms"),T=$82.showUpdateAccountDataDialog({title:w,html:$.t('Email-to-sms is the easiest and absolutely free way to send text message (SMS) from the internet to phones. <a href="http://www.emailtextmessages.com/" target="_blank">This site</a> aims to be the most complete and up-to-date list of email addresses that can be used to send text messages to phones.'),paramName:"sms_email",success:function(){t("sendSms",!0),$82.destroy()},error:function(e){t("sendSms",!1),$82.showError(e||$.t("Unexpected error: can't change profile data"),T)},complete:function(){a._updateLayout(l)},cancel:function(){t("sendSms",!1),a._updateLayout(l),$82.destroy()}});else t("sendSms",e.sendSms);if(void 0!==e.sendEmail)if(e.sendEmail&&!user.email)var w=$.t("E-mail"),b=$82.showUpdateAccountDataDialog({title:w,html:$.t("Please, enter your e-mail"),paramName:"email",success:function(){t("sendEmail",!0),$82.destroy()},error:function(e){t("sendEmail",!1),$82.showError(e||$.t("Unexpected error: can't change profile data"),b)},complete:function(){a._updateLayout(l)},cancel:function(){t("sendEmail",!1),a._updateLayout(l),$82.destroy()}});else t("sendEmail",e.sendEmail);if(!$.isEmptyObject(l)){if(d){var S=a.generateDescription(s.get("symbol"),s.resolutionReadable(),i);s.set("description",S)}a._updateLayout(l)}if(a.Q2){var C=new $21($21.FULL_UPDATE);a.Q2.paint(C)}}},n.prototype._getUImainSeries=function(){var e=this.$dialog.find('[name="main-series-plot-index"]').val();return void 0!==e&&(e=parseInt(e)),{id:this.$dialog.find('[name="main-series"]').val(),plotIndex:e}},n.prototype._setUImainSeries=function(e){var t=this,r=i(13).LineDataSource,n=t.$dialog.find(".main-series-id-container"),o=[];t.alert&&t.alert.get("extra").drawing()&&o.push(t.alert.get("extra").drawing().uniqueId),t.Q2&&t.Q2.model().Q17().forEach(function(e){var t=e instanceof r;t&&e.uniqueId&&o.push(e.uniqueId())});var a=t._UIcreateSeriesInput({name:"main-series",excludeIds:o});n.find("select[sb].inited").selectbox("detach"),n.empty(),n.append(a),a.val(e.uniqueId),a.change(function(){var e={mainSeries:t._prepareBandForExtra($(this).val())};setTimeout(function(){t.update(e)},0)});var s=t.$dialog.find(".main-series-plot-index-container"),l=t._UIcreatatePlotIndexInput(e,"main-series");s.find("select[sb].inited").selectbox("detach"),s.empty(),s.append(l),void 0!==e.plotIndex&&l.val(e.plotIndex),l.change(function(){var i=$.extend(!0,{},e,{plotIndex:parseInt($(this).val())});setTimeout(function(){t.update({mainSeries:i}),i=null},0)}),t._UImodifyDeafaultInputs()},n.prototype._getUIcondition=function(){function e(e){var e=e||"",r=t('[name="'+e+'band-main"]'),n=t("Value"===r?'[name="'+e+'band-additional"]':'[name="'+e+'band-additional-plot-index"]');return i._prepareBandForExtra(r,n)}function t(e){return i.$dialog.find(e).val()}var i=this,r=this.$dialog.find('[name="condition-id"]').val(),n={id:r};if(!r)return n;var o=i.alert&&i.alert.get("extra"),a=TradingView.AlertConditions.getData(r,o);return a&&("comparison"===a.type?a.isChannel?(n.upperBand=e("upper-"),n.lowerBand=e("lower-")):n.band=e():"moving"===a.type?(n.value=t('[name="moving-value"]'),n.period=t('[name="moving-period"]')):"pine_script"===a.type||TradingView.logError("[Alerts] Unknown condition type")),n},n.prototype._setUIcondition=function(e){if(this._UIrowsOptions().condition.visible){var i=this,r=i._UIcreateConditionInput();i.$dialog.find(".condition-id-container").empty().append(r),r.val(e.id);var n,o=i.$dialog.find(".condition-options-row"),a=i.alert&&i.alert.get("extra"),s=TradingView.AlertConditions.getData(e.id,a);if("comparison"===s.type)if(s.isChannel&&i.alert.isDrawing()){var l="fake-drawing-band";n=$('<tr class="condition-options-row '+l+'-row"><td class="title up faded"></td><td class="'+l+'-main-input-container"></td><td></td></tr>'),i._UIinsertInputsForBand("upperBand",n.find("."+l+"-main-input-container"),null,l,i.alert.isDrawing())}else if(s.isChannel){var d="upper-band",h="lower-band";n=$('<tr class="condition-options-row '+d+'-row"><td class="title up faded">'+$.t("Upper Bound")+'</td><td class="'+d+'-main-input-container"></td><td class="'+d+'-additional-input-container"></td></tr><tr class="condition-options-row '+h+'-row"><td class="title down faded">'+$.t("Lower Bound")+'</td><td class="'+h+'-main-input-container"></td><td class="'+h+'-additional-input-container"></td></tr>'),i._UIinsertInputsForBand("upperBand",n.find("."+d+"-main-input-container"),n.find("."+d+"-additional-input-container"),d,i.alert.isDrawing()),i._UIinsertInputsForBand("lowerBand",n.find("."+h+"-main-input-container"),n.find("."+h+"-additional-input-container"),h,i.alert.isDrawing())}else{var l="band";n=$('<tr class="condition-options-row '+l+'-row"><td class="title up faded"></td><td class="'+l+'-main-input-container"></td><td class="'+l+'-additional-input-container"></td></tr>'),i._UIinsertInputsForBand("band",n.find("."+l+"-main-input-container"),n.find("."+l+"-additional-input-container"),l,i.alert.isDrawing())}else if("moving"===s.type){n=$(t.render('<tr class="condition-options-row moving-row"><td></td><td><div class="value-input-container"><input type="text" name="moving-value" data-tv-ticker-min="{{valueMin}}" data-tv-ticker-step="{{valueStep}}"{{#valuePositive}} data-tv-ticker-positive="1"{{/valuePositive}}{{#valueInteger}} data-tv-ticker-integer="1"{{/valueInteger}} class="_tv-dialog-text-input ticker" value="{{valueStep}}"></div><div>{{movingChar}}</div></td><td><div> '+$.t("in")+' </div><div class="period-input-container"><input type="text" name="moving-period" data-tv-ticker-min="{{periodMin}}" data-tv-ticker-max="{{periodMax}}"{{#periodPositive}} data-tv-ticker-positive="1"{{/periodPositive}}{{#periodInteger}} data-tv-ticker-integer="1"{{/periodInteger}} class="_tv-dialog-text-input ticker" value="{{periodMin}}"></div><div> '+$.t("bars")+"</div></td></tr>",{movingChar:s.percents?"%":"$",valueMin:0,valueStep:i._calculatePriceStep(),valuePositive:!0,valueInteger:!1,periodMin:i._minMovingPeriod(e.mainSeries),periodMax:i._maxMovingPeriod(),periodStep:1,periodPositive:!0,periodInteger:!0}));var p=n.find('[name="moving-value"]');p.val(e.options.value),p.change(function(){i.update({value:$(this).val()})});var c=n.find('[name="moving-period"]');c.val(e.options.period);var u=function(){i.update({period:$(this).val()})};c.blur(u),c.change(u)}else"pine_script"===s.type?n=$('<tr class="condition-options-row js-hidden"><td></td><tr>'):TradingView.logError("[Alerts] Unknown condition type");o.find("select[sb].inited").selectbox("detach");for(var _=0;_<o.length;_++)0!==_&&o.eq(_).remove();var f=o.eq(0);f.replaceWith(n),i._movingIsValid(),i._conditionChannelIsValid(),i._UImodifyDeafaultInputs()}},n.prototype._getUIexpired=function(e){var t=this.$dialog.find('[name="expired-date"]').val(),i=this.$dialog.find('[name="expired-time"]').val();if(t&&i&&/(\d{4})-(\d{1,2})-(\d{1,2})/.test(t)&&/(\d{2}):(\d{2})/.test(i)){var r=new Date,n=/(\d{4})-(\d{1,2})-(\d{1,2})/.exec(t);r.setDate(1),r.setYear(parseInt(n[1])),r.setMonth(parseInt(n[2],10)-1),r.setDate(parseInt(n[3],10));var o=/(\d{2}):(\d{2})/.exec(i);return r.setHours(parseInt(o[1],10)),r.setMinutes(parseInt(o[2],10)),r.setSeconds(0),r.setMilliseconds(0),e&&(r=Math.round(r.getTime()/1e3)),r}},n.prototype._setUIexpired=function(e){var e=e||0;e instanceof Date||(e=new Date(1e3*e)),this._expiredIsValid(e);var t=TradingView.numberToStringWithLeadingZero(e.getFullYear(),4)+"-"+TradingView.numberToStringWithLeadingZero(e.getMonth()+1,2)+"-"+TradingView.numberToStringWithLeadingZero(e.getDate(),2);this.$dialog.find('[name="expired-date"]').val(t);var i=TradingView.numberToStringWithLeadingZero(e.getHours(),2)+":"+TradingView.numberToStringWithLeadingZero(e.getMinutes(),2);this.$dialog.find('[name="expired-time"]').val(i)},n.prototype._updateUIexpiredLimits=function(){this.$dialog&&this.$dialog.find('[name="expired-date"]').length&&this.$dialog.find('[name="expired-date"]').datepicker("option","maxDate",this.defaults({name:"datepickerMaxExpired"}))},n.prototype._getUIsendEmail=function(){return this.$dialog.find("#alert-send-email-"+this.id).is(":checked")},n.prototype._setUIsendEmail=function(e){return this.$dialog.find("#alert-send-email-"+this.id).prop("checked",!!e)},n.prototype._getUIsendSms=function(){return this.$dialog.find("#alert-send-sms-"+this.id).is(":checked")},n.prototype._setUIsendSms=function(e){return this.$dialog.find("#alert-send-sms-"+this.id).prop("checked",!!e)},n.prototype._getUIshowPopup=function(){return this.$dialog.find("#alert-show-popup-"+this.id).is(":checked")},n.prototype._setUIshowPopup=function(e){return this.$dialog.find("#alert-show-popup-"+this.id).prop("checked",!!e)},n.prototype._getUIplaySound=function(){return this.$dialog.find("#alert-play-sound-"+this.id).is(":checked")},n.prototype._setUIplaySound=function(e){return this.$dialog.find("#alert-play-sound-"+this.id).prop("checked",!!e)},n.prototype._getUIdescription=function(){return this.$dialog.find('[name="description"]').val()},n.prototype._setUIdescription=function(e){return this._updateUIdialogTitle(),this.$dialog.find('[name="description"]').val(e)},n.prototype._getUIfrequency=function(){return this.$dialog.find('[name="frequency"]').val()},n.prototype._setUIfrequency=function(e){this.$dialog.find('[name="frequency"]').val(e)},n.prototype._getUIsoundFile=function(){this._soundSelector&&this._soundSelector.fileName.value()},n.prototype._setUIsoundFile=function(e){this._soundSelector&&this._soundSelector.fileName.setValue(e)},n.prototype._getUIsoundDuration=function(){this._soundSelector&&this._soundSelector.duration.value()},n.prototype._setUIsoundDuration=function(e){this._soundSelector&&this._soundSelector.duration.setValue(e)},n.prototype._UIinsertInputsForBand=function(e,t,i,r,n){function o(){return s.alert.get("extra").mainSeries().uniqueId}function a(){return"MainSeries"===s.alert.get("extra").mainSeries().type}var s=this,l=s.alert.get("extra")[e](),d=[];s.alert.getSavedState()&&"MainSeries"===s.alert.getSavedState().extra.mainSeries().type&&d.push(s.alert.getSavedState().extra.mainSeries().uniqueId),s.mainSeries()&&d.push(s.mainSeries().uniqueId());var h=s._UIcreateSeriesInput({name:r+"-main",excludeIds:d,prepend:[{title:$.t("Value"),value:"Value"}].concat(s.alert.get("extra").drawing()?[{title:$.t(s.alert.get("extra").drawing().title),value:s.alert.get("extra").drawing().uniqueId}]:[]),disabled:!!n});if(h.val("Value"===l.type?"Value":l.uniqueId),h.change(function(){var t=$(this).val(),i={};if("Value"===t){var r=void 0===l.value?s._getLastValueByDataSourceId(o(),a()):l.value;r=s._formatPrice(r,o()),i[e]=s._prepareBandForExtra(t,r)}else i[e]=s._prepareBandForExtra(t);setTimeout(function(){s.update(i)},0)}),t.find("select[sb].inited").selectbox("detach"),t.empty(),t.append(h),i){var p,c=/^LineTool.*/i.test(l.type)?"LineTool":l.type;switch(c){case"Value":var u=void 0===l.value?s._getLastValueByDataSourceId(o()):l.value;u=s._formatPrice(u,o());var _=s._calculatePriceStep(u);p=$('<input name="'+r+'-additional" type="text" data-tv-ticker-step="'+_+'" class="_tv-dialog-text-input ticker">'),p.val(u),p.change(function(){var t={};t[e]=l,t[e].value=""===$(this).val()?u:parseFloat($(this).val()),setTimeout(function(){s.update(t)},0)});break;default:p=s._UIcreatatePlotIndexInput(l,r+"-additional",!!s._options.bandsDisabled),p.val(l.plotIndex),p.change(function(){var t={},i=$.extend(!0,{},l,{plotIndex:parseInt($(this).val())});t[e]=i,setTimeout(function(){s.update(t)},0)})}i.find("select[sb].inited").selectbox("detach"),i.empty(),i.append(p)}},n.prototype._UIcreatateSelectElement=function(e,i,r){return $(t.render('<select name="{{name}}"{{#disabled}} disabled="disabled"{{/disabled}}>{{#options}}{{#separator}}<option value="__separator__" disabled="disabled"></option>{{/separator}}{{^separator}}<option value="{{value}}">{{title}}</option>{{/separator}}{{/options}}</select>',{disabled:r,options:e||[],name:i||""}))},n.prototype._UIcreateSeriesInput=function(e){function t(e,t){if(t&&$.isArray(t)&&e){if(-1!==t.indexOf(e))return!0;var i=n._prepareBandForExtra(e);if(a.get("crossInterval")&&i&&"MainSeries"===i.type){var r=n._getSymbolFromSeriesUniqueId(e),o=$.map(t,function(e){return n._getSymbolFromSeriesUniqueId(e)});return-1!==o.indexOf(r)}return!1}return!1}function i(e){return t(e,$.map(o,function(e){return e.value}))}function r(i){return t(i,e.excludeIds)}var n=this,o=e.prepend?$.isArray(e.prepend)?e.prepend:[e.prepend]:[],e=e||{},a=n.alert;if(a&&a.getSavedState())for(var s=a.getSavedState().extra.bandsArray(),l=0;l<s.length;l++)!s[l]||"Value"===s[l].type||i(s[l].uniqueId)||r(s[l].uniqueId)||o.push({value:s[l].uniqueId,title:"MainSeries"===s[l].type?s[l].state.shortName+(a.get("crossInterval")?"":", "+s[l].state.interval):s[l].state.shortDescription});if(n.Q2)for(var d=n.Q2.model().Q17(),l=0;l<d.length;l++){var h=d[l];if(this.Q2.canCreateAlertForDataSource(h)){var p=h.uniqueId(),c=n._getDataSourceTitle(p,!1,a.get("crossInterval"));t(p,$.map(o,function(e){return e.value}));if(!p||!c||i(p)||r(p))continue;o.push({value:p,title:c})}}return n._UIcreatateSelectElement(o,e.name||"",e.disabled)},n.prototype._UIcreatatePlotIndexInput=function(e,t,i){var r=this._getPlotsFromDatasourceState(e);return r.length<=1?$('<input type="hidden" name="'+t+'-plot-index" value="0">'):this._UIcreatateSelectElement(r,t+"-plot-index",i)},n.prototype._availableFrequencies=function(){var e=this,t=[{title:$.t("Once"),value:"once"}],i=e.alert&&e.alert.get("crossInterval"),r=e.alert&&e.alert.get("extra").drawing()&&"LineToolVertLine"===e.alert.get("extra").drawing().type;i||r||(t.push({title:$.t("Once per bar (on condition)"),value:"once_per_bar"}),t.push({title:$.t("Once per bar (on close)"),value:"on_bar_close"}));var n=[{title:$.t("Rearm every 1 minute"),value:"60"},{title:$.t("Rearm every 5 minute"),value:"300"},{title:$.t("Rearm every 10 minute"),value:"600"},{title:$.t("Rearm every 30 minute"),value:"1800"},{title:$.t("Rearm every hour"),value:"3600"}];if(!r){var o=e.alert&&60*e.alert.get("resolution");if(TradingView.isNaN(o)||i)t=t.concat(n);else for(var a=0;a<n.length;a++)n[a].value<o&&t.push(n[a])}return t},n.prototype._UIcreateFrequencyInput=function(){var e=this,t=e._availableFrequencies();return this._UIcreatateSelectElement(t,"frequency")},n.prototype._createUIfrequency=function(){var e=this;e._UIcreateFrequencyInput().appendTo(e.$dialog.find(".frequency-container")).change(function(){setTimeout(function(){e.update({frequency:e._getUIfrequency()})},0)}),e.alert&&e.alert.get("extra")&&e.alert.get("extra").frequency()&&e._setUIfrequency(e.alert.get("extra").frequency())},n.prototype._updateUIfrequency=function(){this.$dialog&&(this.$dialog.find(".frequency-container select").selectbox("detach"),this.$dialog.find(".frequency-container").empty(),this._createUIfrequency(),this._UImodifyDeafaultInputs())},n.prototype._UIcreateConditionInput=function(){var e,t=this,i=[],r=t.alert&&t.alert.get("extra"),n=[];
n=TradingView.AlertConditions.ordered(r,{needSeparator:!0});for(var o=0;o<n.length;o++)n[o].separator?i.push({separator:!0}):i.push({value:n[o].id,title:n[o].title});return e=this._UIcreatateSelectElement(i,"condition-id"),e.change(function(){setTimeout(function(){t.update({conditionId:e.val()})},0)}),e},n.prototype._UImodifyDeafaultInputs=function(){function e(e){return t.$dialog.find(e).filter(":not(.inited)")}var t=this;e("select").each(function(e,t){var i=$(t);i.prop("disabled",i.prop("disabled")||1===i.find("option").length)}).selectbox({speed:100,classHolder:"tv-select-container dialog"}).addClass("inited"),e("input.ticker").each(function(){var e=$(this),t={},i=e.data("tv-ticker-step");i&&(t.step=i);var r=e.data("tv-ticker-min");null!==r&&void 0!==r&&(t.min=r);var n=e.data("tv-ticker-max");null!==n&&void 0!==n&&(t.max=n),e.TVTicker(t),TradingView.makeInputNumberOnly(e,{positiveOnly:!!e.data("tv-ticker-positive"),integerOnly:!!e.data("tv-ticker-integer"),minValue:r,maxValue:n}),e.addClass("inited")}),e("label._tv-button :radio").change(function(){t._UIupdateRadioButton($(this))})},n.prototype._UIupdateRadioButton=function(e){e.closest("td").find("label._tv-button").removeClass("active").children(":radio:checked").closest("label._tv-button").addClass("active")},n.prototype.UItoggleSoundSelector=function(e){var t=this;return e?(t._soundSelector||(t._soundSelector=new TradingView.SoundSelector({container:t.$dialog.find(".sound-selector-container"),durationContainer:t.$dialog.find(".sound-selector-duration-container"),file:t.alert.get("soundFile"),duration:t.alert.get("soundDuration"),onChange:function(e,i){t.update({soundFile:e,soundDuration:i})}}),t._UImodifyDeafaultInputs()),void t.$dialog.find(".sound-selector-row").slideDown()):void t.$dialog.find(".sound-selector-row").slideUp()},n.prototype.generateDescription=function(e,i,r){var n,o,a,s=this,l=r.conditionData();if("pine_script"===l.type)n=l.message;else if("comparison"===l.type)if(l.isChannel){var d=r.upperBand().uniqueId&&r.upperBand().uniqueId===r.lowerBand().uniqueId,h=2===s._getPlotsFromDatasourceState(r.upperBand()).length;o=d&&h?s._getDataSourceTitle(r.upperBand(),!1,!0):s._getDataSourceTitle(r.upperBand(),!0,!0)+", "+s._getDataSourceTitle(r.lowerBand(),!0,!0)}else o=s._getDataSourceTitle(r.band(),!0,!0);else"moving"===l.type&&(o=l.percents?r.value()+"% "+$.t("inbars",{period:r.period()}):"$"+r.value()+$.t("inbars",{period:r.period()}),a=", "+i);return n||(n=t.render("{{{series}}}{{resolution}} {{{condition}}} {{{conditionOptionsText}}}",{resolution:a||"",series:s._getDataSourceTitle(r.mainSeries(),!0,!0),condition:l.descriptionTitle||l.title,conditionOptionsText:o||""})),n},n.prototype.conditionsData=function(e){var t=this,i=t&&t.alert&&t.alert.get("extra");return TradingView.AlertConditions.get(i)},n.prototype.defaults=function(e){function t(e){return s._cache[e]}function i(e,t){return s._cache.defaults||(s._cache.defaults={}),t}function r(){var e=o(e),t=/^\d+$/.test(e);return s.alert&&(t=t&&!s.alert.get("crossInterval")),t}function n(){var e=0;if(s.mainSeries()){var t=s.mainSeries().lastValueData(TradingView.CLOSE_PLOT,!0,!0);e=t.price||0}return s._formatPrice(e,s.mainSeries())}function o(e){return l[e]?"function"==typeof l[e][1]?l[e][1]():l[e][1]:null}function a(e){for(var t,i={},r=0;r<d.length;r++)t=d[r],l[t][0]===e&&(i[t]=o(t));return i}var s=this,e=e||{},l={conditionId:["extra",function(){return TradingView.AlertConditions.ordered(s.alert&&s.alert.get("extra"))[0].id}],mainSeries:["extra",function(){return t("mainSeries")||i("mainSeries",s.mainSeries()?s.mainSeries().stateForAlert():null)}],frequency:["extra","once"],value:["extra",1],period:["extra",function(){return s._minMovingPeriod()}],band:["extra",function(){return t("band")||i("band",{type:"Value",value:s._options.value||n()})}],upperBand:["extra",function(){return t("upperBand")||i("upperBand",{type:"Value",value:s._options.value||n()})}],lowerBand:["extra",function(){return t("lowerBand")||i("lowerBand",{type:"Value",value:s._options.value||n()})}],symbol:["alert",s._symbol],resolution:["alert",s._resolution],sendEmail:["alert",TVSettings.getBool("alerts.creating.send_email",!1)&&!!user.email],sendSms:["alert",TVSettings.getBool("alerts.creating.send_sms",!1)&&!!user.sms_email],showPopup:["alert",TVSettings.getBool("alerts.creating.show_popup",!0)],playSound:["alert",TVSettings.getBool("alerts.creating.play_sound",!0)],soundFile:["alert",TVSettings.getValue("alerts.creating.sound_file",TradingView.Sound.defaults().alert)],soundDuration:["alert",TVSettings.getValue("alerts.creating.sound_duration",0)],autoDeactivation:["alert",!0],description:["alert",""],expired:["alert",function(){var e=new Date,t=new Date;return r()?e.setDate(t.getDate()+7):e.setMonth(t.getMonth()+1),e.getTime()/1e3}],script:["alert",""],datepickerMaxExpired:["dialog","+2m"],maxExpired:["dialog",function(){var e=new Date,t=new Date;return e.setMonth(t.getMonth()+2),e.setHours(23),e.setMinutes(59),e.setSeconds(59),e.setMilliseconds(999),e.getTime()/1e3}]},d=Object.keys(l);return e.name?o(e.name):e.type?a(e.type):void 0},n.prototype.mainSeries=function(){return this.Q2?this.Q2.model().mainSeries():null},n.prototype._prepareBandForExtra=function(e,t){var i=this;if(e)return"Value"===e?{type:"Value",value:t||0}:i._getDataSourceState(e,t)},n.prototype._getPlotsFromDatasourceState=function(e){function t(e,t){var i="",r={vol:$.t("Volume"),vol_ma:$.t("Volume MA")};if(-1!==n.indexOf(e.type)&&e.target&&t.ohlcPlots[e.target])switch(i=t.ohlcPlots[e.target].title,i+=" ",e.type){case TradingView.StudyConsts.PLOT_TYPE_OHLC_OPEN:i+=$.t("Open");break;case TradingView.StudyConsts.PLOT_TYPE_OHLC_HIGH:i+=$.t("High");break;case TradingView.StudyConsts.PLOT_TYPE_OHLC_LOW:i+=$.t("Low");break;case TradingView.StudyConsts.PLOT_TYPE_OHLC_CLOSE:i+=$.t("Close")}return!i&&t.styles&&t.styles[e.id]&&(i=t.styles[e.id].title),i||(i=r[e.id]||e.id),i}var i,r,n=[TradingView.StudyConsts.PLOT_TYPE_OHLC_OPEN,TradingView.StudyConsts.PLOT_TYPE_OHLC_HIGH,TradingView.StudyConsts.PLOT_TYPE_OHLC_LOW,TradingView.StudyConsts.PLOT_TYPE_OHLC_CLOSE],o=n.concat([TradingView.StudyConsts.PLOT_TYPE_LINE,TradingView.StudyConsts.PLOT_TYPE_SHAPES,TradingView.StudyConsts.PLOT_TYPE_CHARS,TradingView.StudyConsts.PLOT_TYPE_ARROWS]),a=[];if(!e)return a;if(e.plots)for(var s=0;s<e.plots.length;s++)a.push({value:s,title:e.plots[s].title||""+s});else if(e.metaInfo&&e.metaInfo.plots){i=e.metaInfo;for(var s=0;s<i.plots.length;s++)r=i.plots[s],-1!==o.indexOf(r.type)&&a.push({value:s,title:t(r,i)})}return a},n.prototype._getPlotOffsetFromState=function(e,t){if(e.data&&e.data.completePlotOffsets){var i=e.plots||e.metaInfo.plots,r=i[t].id;return e.data.completePlotOffsets[r]}},n.prototype._getDataSourceById=function(e){var t=null;return this.Q2&&(t=this.Q2.model().Q17().filter(function(t){return t.uniqueId&&t.uniqueId()===e})[0]||null),t},n.prototype._getDataSourceState=function(e,t){var i,r,n,o=this,a=null;if(!e)return null;if(o.alert&&o.alert.get("extra")){i=o.alert.getSavedState(),n=o.alert.get("extra").bandsArray(),i&&(n=n.concat(i.extra.bandsArray()||[])),r=o.alert.get("crossInterval");for(var s=0;s<n.length;s++){var l=n[s].uniqueId===e;if(!l&&r&&"MainSeries"===n[s].type&&(l=n[s].state.actualSymbol===o._getSymbolFromSeriesUniqueId(e)||n[s].state.symbol===o._getSymbolFromSeriesUniqueId(e)),l){a=$.extend(!0,{},n[s]);break}}}var d;return a||(d=this._getDataSourceById(e),a=d.stateForAlert&&d.stateForAlert()),a?("MainSeries"!==a.type&&"Value"!==a.type&&(void 0!==t?a.plotIndex=t:a.plotIndex=o._getPlotsFromDatasourceState(a)[0].value,a.plotOffset=o._getPlotOffsetFromState(a,a.plotIndex)),a):void TradingView.logError("Can't find state for datasource "+d)},n.prototype._getLastValueByDataSourceId=function(e,t){function i(e){var t=e===o?TradingView.CLOSE_PLOT:e.metaInfo().plots[0].id;return e.lastValueData(t,!0,!0).price}var r=this,n=r._getDataSourceById(e),o=r.mainSeries(),a=0;return n?a=i(n):r.alert&&(r.alert.get("crossInterval")||t)&&"MainSeries"===r.alert.get("extra").mainSeries().type&&r.alert.get("extra").mainSeries().uniqueId===e&&r.alert.get("extra").mainSeries().state.symbol===o.symbol()&&(a=i(o)),a},n.prototype._formatPrice=function(e,t){var i=this,e=e||0,r=null,n=i.mainSeries(),t=t||n||null;return"string"==typeof t&&(t=i._getDataSourceById(t)),r=t&&t.priceScale()?t.priceScale().formatter():n&&"create_alert"==i._type?n.priceScale().formatter():null,r&&r.formatAsDecimal&&(e=0>e?"-"+r.formatAsDecimal(-1*e):r.formatAsDecimal(e)),e},n.prototype._getDataSourceTitle=function(e,t,i){var r="",n=this;if("string"==typeof e){var o=e,a=n._getDataSourceById(o);a&&(r=n.mainSeries()===a?a.symbolInfo().name+(i?"":", "+a.interval()):a.title?a.title(!0):"")}else if("object"==typeof e){var s=e;switch(s.type){case"Value":r=s.value;break;case"MainSeries":r=(s.state.shortName||s.state.symbol)+(i?"":", "+s.state.interval);break;default:if(r=n._getDataSourceTitle(s.uniqueId,t,i)||s.state.shortDescription||"Study",t){var l=n._getPlotsFromDatasourceState(s);if(l.length>1){var d=$.grep(l,function(e){return e.value==s.plotIndex})[0];d&&(r+=" "+d.title)}}}}return r},n.prototype._calculatePriceStep=function(e){var t,i=this,r=1;if(void 0!==e)t=e;else if(void 0!==i._options.value)t=i._options.value;else{if(!i.alert||!i.alert.isPrice())return r;t=i.alert.get("extra").price().upperBand||i.alert.get("extra").price()}if(t=i._formatPrice(t,i.alert.get("extra").mainSeries().uniqueId),t=(""+t).replace(/^-/,""),-1!=t.indexOf(".")){var n=t.replace(/^\d+\./,"").length;r=Math.pow(10,-1*n)}return r},n.prototype._isValid=function(){var e=this._expiredIsValid(),t=this._movingIsValid(),i=this._conditionChannelIsValid();return e&&t&&i},n.prototype._expiredIsValid=function(e){if(e instanceof Date){var t=new Date,i=new Date(1e3*this.defaults({name:"maxExpired"})),r=e>t&&i>e;return this.$dialog.find('[name="expired-date"], [name="expired-time"]').toggleClass("_tv-dialog-text-input-error",!r),r}var n={},o=this.$dialog.find('[name="expired-date"]'),a=o.val();a&&/^\d{4}-\d{2}-\d{2}$/.test(a)||(n.date=!0);var s=this.$dialog.find('[name="expired-time"]'),l=s.val();l&&/^\d{2}\:\d{2}$/.test(l)||(n.time=!0),o.toggleClass("_tv-dialog-text-input-error",!!n.date),s.toggleClass("_tv-dialog-text-input-error",!!n.time);var d=!1,h=this._getUIexpired();return h instanceof Date&&(d=this._expiredIsValid(h)),!n.date&&!n.time&&d},n.prototype._conditionChannelIsValid=function(){var e=!0,t=this,i=t.alert;if(i.get("extra")&&i.get("extra").conditionData().isChannel){var r=t.$dialog.find('[name="lower-band-additional"]'),n=t.$dialog.find('[name="upper-band-additional"]');i.isPrice()&&(e=i.get("extra").price().lower<i.get("extra").price().upper),e?(r.removeClass("_tv-dialog-text-input-error"),n.removeClass("_tv-dialog-text-input-error")):(r.addClass("_tv-dialog-text-input-error"),n.addClass("_tv-dialog-text-input-error"))}return e},n.prototype._minMovingPeriod=function(e){var e=e;return e||(e=this.alert&&this.alert.get("extra")&&this.alert.get("extra").mainSeries&&this.alert.get("extra").mainSeries()),e&&"MainSeries"===e.type?1:2},n.prototype._maxMovingPeriod=function(e){return 300},n.prototype._movingIsValid=function(){var e=!0,t=this.$dialog?this.$dialog.find('[name^="moving-"]'):[];if(!t.length)return!0;var i=t.filter('[name="moving-value"]'),r=parseFloat(i.val())>0;i.toggleClass("_tv-dialog-text-input-error",!r),e=e&&r;var n=t.filter('[name="moving-period"]'),o=parseFloat(n.val()),a=TradingView.isInteger(o)&&this._minMovingPeriod()<=o&&o<=this._maxMovingPeriod();return n.toggleClass("_tv-dialog-text-input-error",!a),e=e&&a},n.prototype._getSymbolFromSeriesUniqueId=function(e){if(!e)return"";this._cache._getSymbolFromSeriesUniqueId||(this._cache._getSymbolFromSeriesUniqueId={});var t=e.split&&e.split("|")[0];return this._cache._getSymbolFromSeriesUniqueId[e]=t,t},n.prototype._UIrowsOptions=function(){var e=this,t={create_alert:{condition:{visible:!0},frequency:{visible:!0,disabled:!1},expiration:{visible:!0,disabled:!1},actions:{visible:!0,disabled:!1},description:{visible:!0,disabled:!1}},edit_alert:{condition:{visible:!0},frequency:{visible:!0,disabled:!1},expiration:{visible:!0,disabled:!1},actions:{visible:!0,disabled:!1},description:{visible:!0,disabled:!1}},restart_alert:{condition:{visible:!1},frequency:{visible:!1},expiration:{visible:!0,disabled:!1},actions:{visible:!1},description:{visible:!1}}},i=t[this._type];return i||TradingView.logError("Unknow dialog type - cant' find visible rows"),e.alert&&e.alert.get("extra")||(i.condition.visible=!1,i.frequency.visible=!1),i},TradingView.MakeAlertDialog=n,e.exports=n}).call(t,i(29),i(20))},function(e,t,i){(function(t){e.exports=t.Mustache=i(30)}).call(t,function(){return this}())},function(e,t,i){var r,n,o;!function(i,a){"object"==typeof t&&t&&"string"!=typeof t.nodeName?a(t):(n=[t],r=a,o="function"==typeof r?r.apply(t,n):r,!(void 0!==o&&(e.exports=o)))}(this,function(e){function t(e){return"function"==typeof e}function i(e){return f(e)?"array":typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function n(e,t){return null!=e&&"object"==typeof e&&t in e}function o(e,t){return g.call(e,t)}function a(e){return!o(v,e)}function s(e){return(e+"").replace(/[&<>"'`=\/]/g,function(e){return m[e]})}function l(t,i){function n(){if(v&&!m)for(;g.length;)delete _[g.pop()];else g=[];v=!1,m=!1}function o(e){if("string"==typeof e&&(e=e.split(w,2)),!f(e)||2!==e.length)throw Error("Invalid tags: "+e);s=RegExp(r(e[0])+"\\s*"),l=RegExp("\\s*"+r(e[1])),c=RegExp("\\s*"+r("}"+e[1]))}if(!t)return[];var s,l,c,u=[],_=[],g=[],v=!1,m=!1;o(i||e.tags);for(var C,x,P,L,E,V,I=new p(t);!I.eos();){if(C=I.pos,P=I.scanUntil(s))for(var A=0,k=P.length;k>A;++A)L=P.charAt(A),a(L)?g.push(_.length):m=!0,_.push(["text",L,C,C+1]),C+=1,"\n"===L&&n();if(!I.scan(s))break;if(v=!0,x=I.scan(S)||"name",I.scan(y),"="===x?(P=I.scanUntil(T),I.scan(T),I.scanUntil(l)):"{"===x?(P=I.scanUntil(c),I.scan(b),I.scanUntil(l),x="&"):P=I.scanUntil(l),!I.scan(l))throw Error("Unclosed tag at "+I.pos);if(E=[x,P,C,I.pos],_.push(E),"#"===x||"^"===x)u.push(E);else if("/"===x){if(V=u.pop(),!V)throw Error('Unopened section "'+P+'" at '+C);if(V[1]!==P)throw Error('Unclosed section "'+V[1]+'" at '+C)}else"name"===x||"{"===x||"&"===x?m=!0:"="===x&&o(P)}if(V=u.pop())throw Error('Unclosed section "'+V[1]+'" at '+I.pos);return h(d(_))}function d(e){for(var t,i,r=[],n=0,o=e.length;o>n;++n)t=e[n],t&&("text"===t[0]&&i&&"text"===i[0]?(i[1]+=t[1],i[3]=t[3]):(r.push(t),i=t));return r}function h(e){for(var t,i,r=[],n=r,o=[],a=0,s=e.length;s>a;++a)switch(t=e[a],t[0]){case"#":case"^":n.push(t),o.push(t),n=t[4]=[];break;case"/":i=o.pop(),i[5]=t[2],n=o.length>0?o[o.length-1][4]:r;break;default:n.push(t)}return r}function p(e){this.string=e,this.tail=e,this.pos=0}function c(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function u(){this.cache={}}var _=Object.prototype.toString,f=Array.isArray||function(e){return"[object Array]"===_.call(e)},g=RegExp.prototype.test,v=/\S/,m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"},y=/\s*/,w=/\s+/,T=/\s*=/,b=/\s*\}/,S=/#|\^|\/|>|\{|&|=|!/;p.prototype.eos=function(){return""===this.tail},p.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var i=t[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},p.prototype.scanUntil=function(e){var t,i=this.tail.search(e);switch(i){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=t.length,t},c.prototype.push=function(e){return new c(e,this)},c.prototype.lookup=function(e){var i,r=this.cache;if(r.hasOwnProperty(e))i=r[e];else{for(var o,a,s=this,l=!1;s;){if(e.indexOf(".")>0)for(i=s.view,o=e.split("."),a=0;null!=i&&a<o.length;)a===o.length-1&&(l=n(i,o[a])),i=i[o[a++]];else i=s.view[e],l=n(s.view,e);if(l)break;s=s.parent}r[e]=i}return t(i)&&(i=i.call(this.view)),i},u.prototype.clearCache=function(){this.cache={}},u.prototype.parse=function(e,t){var i=this.cache,r=i[e];return null==r&&(r=i[e]=l(e,t)),r},u.prototype.render=function(e,t,i){var r=this.parse(e),n=t instanceof c?t:new c(t);return this.renderTokens(r,n,i,e)},u.prototype.renderTokens=function(e,t,i,r){for(var n,o,a,s="",l=0,d=e.length;d>l;++l)a=void 0,n=e[l],o=n[0],"#"===o?a=this.renderSection(n,t,i,r):"^"===o?a=this.renderInverted(n,t,i,r):">"===o?a=this.renderPartial(n,t,i,r):"&"===o?a=this.unescapedValue(n,t):"name"===o?a=this.escapedValue(n,t):"text"===o&&(a=this.rawValue(n)),void 0!==a&&(s+=a);return s},u.prototype.renderSection=function(e,i,r,n){function o(e){return a.render(e,i,r)}var a=this,s="",l=i.lookup(e[1]);if(l){if(f(l))for(var d=0,h=l.length;h>d;++d)s+=this.renderTokens(e[4],i.push(l[d]),r,n);else if("object"==typeof l||"string"==typeof l||"number"==typeof l)s+=this.renderTokens(e[4],i.push(l),r,n);else if(t(l)){if("string"!=typeof n)throw Error("Cannot use higher-order sections without the original template");l=l.call(i.view,n.slice(e[3],e[5]),o),null!=l&&(s+=l)}else s+=this.renderTokens(e[4],i,r,n);return s}},u.prototype.renderInverted=function(e,t,i,r){var n=t.lookup(e[1]);return!n||f(n)&&0===n.length?this.renderTokens(e[4],t,i,r):void 0},u.prototype.renderPartial=function(e,i,r){if(r){var n=t(r)?r(e[1]):r[e[1]];return null!=n?this.renderTokens(this.parse(n),i,r,n):void 0}},u.prototype.unescapedValue=function(e,t){var i=t.lookup(e[1]);return null!=i?i:void 0},u.prototype.escapedValue=function(t,i){var r=i.lookup(t[1]);return null!=r?e.escape(r):void 0},u.prototype.rawValue=function(e){return e[1]},e.name="mustache.js",e.version="2.2.1",e.tags=["{{","}}"];var C=new u;e.clearCache=function(){return C.clearCache()},e.parse=function(e,t){return C.parse(e,t)},e.render=function(e,t,r){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+i(e)+'" was given as the first argument for mustache#render(template, view, partials)');return C.render(e,t,r)},e.to_html=function(i,r,n,o){var a=e.render(i,r,n);return t(o)?void o(a):a},e.escape=s,e.Scanner=p,e.Context=c,e.Writer=u})},function(e,t,i){"use strict";function r(e){this._series=e,this.Z98=e.m_model,this._points=[new MathEx.Point(0,0)],this._invalidated=!0}function n(){return{count:TradingView.DEFAULT_BAR_COUNT}}function o(e,t,h){var p=i(49);I.call(this,e),this._boxSizeChanged=new Delegate,this._tagsChanged=new Delegate,this._symbolIntervalChanged=new Delegate,this._symbolResolved=new Delegate,this._symbolError=new Delegate,this._symbolNotPermitted=new Delegate,this._extendedHoursChanged=new Delegate,this._extendedHoursNotPermitted=new Delegate,this.chartTypeNotPermitted=new Delegate,this.intradaySpreadNotPermitted=new Delegate,this.intradayExchangeNotPermitted=new Delegate,this.customIntervalNotPermitted=new Delegate,this.chartWidgetInitialized=new Delegate,this._startLoading=new Delegate,this._dataLoaded=new Delegate,this._tickmarksRangeChanged=new Delegate,this._barReceived=new Delegate,this._onChangedStyle=new Delegate,this._onCompleted=new Delegate,this._onStatusChanged=new Delegate,this._onRestarted=new Delegate,this._onSessionsStudyCreated=new Delegate,this.requestingIntradayWhenNotSupported=new Delegate,this.requestingResolutionWhenNotSupported=new Delegate,this.priceScaleChanged=new Delegate,this._requestOptions=h?h:n(),this.m_model=e,this._chartApi=e._chartApi,this.m_data=new $57(this,e),this.setProperties(t),this._prevChartStyle=t.style.value(),this.J61(),this._dataWindowView=new d(this,e),this._statusView=new a(this,e.properties()),this._priceAxisViews=[new l(this,e),new s(this,e)],this._symbolInfo=null,this._status=o.STATUS_OFFLINE;var c=this;this._turnaroundCounter=1,this._turnaround="s"+this._turnaroundCounter,this._handler=function(e){c.onData(e)},this.Q0.addExclusion&&this.Q0.addExclusion("visible"),this._base=100,this._formatter=new TradingView.PriceFormatter(this._base),this._predictBars=0,this._futureBarsPaneView=null,this.Q0.showInDataWindow.listeners().subscribe(e,p.prototype.fullUpdate),this.marketStatus=new WatchedValue,this._seriesLoaded=!1,this.properties().minTick.listeners().subscribe(this,o.prototype._recreateFormatter);var c=this;this.properties().minTick.listeners().subscribe(null,function(){c.m_model.Q18(new $21($21.FULL_UPDATE))}),this._priceLineView=new r(this),this._gotoDateView=new V(this),this.bindStyleChange(),this.bindJapChartsInputs(),this.createExtendedHoursProperty(),this.extendedHours.listeners().subscribe(this,function(){this._extendedHoursChanged.fire()}),this._extendedHoursNotPermitted.subscribe(this,function(){this.Q0.extendedHours.setValue(!1)}),this._extendedHoursChanged.subscribe(this,function(){this._status!==o.STATUS_SNAPSHOT&&this.restart()}),this._symbolIntervalChanged.subscribe(this,this.checkInterval),this.properties().showCountdown.listeners().subscribe(this,o.prototype._onChangeShowCountdown),this._onChangeShowCountdown(this.properties().showCountdown),this._recreateFormatter()}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,TradingView.SEARCH_FROM_LEFT=-1,TradingView.SEARCH_FROM_RIGHT=1;var a=i(32),s=i(34),l=i(35),d=i(37),h=i(39),p=h.SeriesAreaPaneView,c=h.SeriesLinePaneView,u=h.SeriesHollowCandlesPaneView,_=h.SeriesCandlesPaneView,f=h.SeriesBarsPaneView,g=h.SeriesHeikenAshiPaneView,v=i(40),m=v.SeriesRenkoPaneView,y=v.SeriesProjectionRenkoPaneView,w=v.SeriesPriceBreakPaneView,T=v.SeriesProjectionPriceBreakPaneView,b=v.SeriesKagiPaneView,S=v.SeriesProjectionKagiPaneView,C=v.SeriesPnFPaneView,x=v.SeriesProjectionPnFPaneView,P=i(41),L=i(42).SeriesBarColorer,E=i(43).HorzLineRenderer,V=i(46),I=i(18).PriceDataSource,A=i(47),k=i(48).J77;r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(this._visible=!1,this._series.properties().showPriceLine.value()){var e=this._series.lastValueData(TradingView.CLOSE_PLOT,!0);e.noData||(this._visible=!0,this._points=[new MathEx.Point(0,e.coordinate)],this._color=e.color)}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};return e.points=this._points,e.color=this._color,e.linewidth=this._series.properties().priceLineWidth.value(),e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.hitTestResult=TradingView.HitTestResult.REGULAR,e.visible=this._visible,new E(e)},inherit(o,I),o.prototype.endOfData=function(){return this._endOfData},o.prototype.serverTimeOffset=function(){return this._chartApi.serverTimeOffset()},o.prototype._onChangeShowCountdown=function(e){var t=this;e.value()?this._countdownUpdateTimer=this.m_model.setInterval(function(){t.isDWM()||(t._priceAxisViews[0].update(),t.m_model.Q18(new $21($21.LIGHT_UPDATE)))},500):(this.m_model.clearInterval(this._countdownUpdateTimer),delete this._countdownUpdateTimer)},o.prototype.lastValueData=function(e,t,i){var r={noData:!0};if(this.m_model.timeScale().isEmpty()||this.priceScale().isEmpty()||this.data().isEmpty())return r;var n=this.m_model.timeScale().visibleBars();if(n.isEmpty())return r;var o,a;if(t){var s=this.data().bars().last();if(null===s||void 0===s)return r;o=s.value,a=parseInt(s)}else{var l=this.data().bars().search(n.lastBar(),TradingView.SEARCH_NEAREST_LEFT);if(null===l||void 0===l)return r;o=this.data().bars().valueAt(l.index),a=l.index}var d={noData:!1},h=o[TradingView.CLOSE_PLOT];if(i&&(d.price=h),this.priceScale().properties().percentage.value()){var p=this.nearestIndex(n.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),c=(this.data().valueAt(p)[TradingView.CLOSE_PLOT],this.firstValue());h=this.priceScale().priceRange().convertToPercent(h,c)}d.text=this.priceScale().formatter().format(h);var u=this.barColorer(),_=u.barStyle(a,!1);return d.color=_.barColor,d.floatCoordinate=this.priceScale().priceToCoordinate(h,!0),d.coordinate=Math.round(d.floatCoordinate),d.index=a,d},o.prototype._prepareChartApiParams=function(){return this._requestOptions.startDate?!this._requestOptions.startDate||this._requestOptions.endDate||this._requestOptions.count?this._requestOptions.startDate&&this._requestOptions.endDate?["from_to",this._requestOptions.startDate,this._requestOptions.endDate]:["from_to",this._requestOptions.startDate,this._requestOptions.count]:["from_to",this._requestOptions.startDate]:this._requestOptions.count||TradingView.DEFAULT_BAR_COUNT},o.prototype._nextSymbolId=1,o.prototype._nextSeriesId=1,o.STYLE_BARS=0,o.STYLE_CANDLES=1,o.STYLE_LINE=2,o.STYLE_LINE_TYPE_MARKERS=0,o.STYLE_LINE_TYPE_STEP=1,o.STYLE_LINE_TYPE_SIMPLE=2,o.STYLE_AREA=3,o.STYLE_RENKO=4,o.STYLE_KAGI=5,o.STYLE_PNF=6,o.STYLE_PB=7,o.STYLE_HEIKEN_ASHI=8,o.STYLE_HOLLOW_CANDLES=9,o.STATUS_OFFLINE=0,o.STATUS_RESOLVING=1,o.STATUS_LOADING=2,o.STATUS_READY=3,o.STATUS_INVALID_SYMBOL=4,o.STATUS_SNAPSHOT=5,o.STATUS_EOD=6,o.STATUS_PULSE=7,o.STATUS_DELAYED=8,o.STATUS_DELAYED_STREAMING=9,o.STATUS_NO_BARS=10,o.PERMISSION_DENIED="permission denied",o.PD_REASON_SYMBOL="symbol",o.PD_REASON_EXTENDED_HOURS="extended_hours",o.STUDY_NOT_AUTH="study_not_auth",o.prototype.model=function(){return this.m_model},o.prototype.fixLastBar=function(e){this._futureBarsPaneView||(this._futureBarsPaneView=new k(this,this.data().bars().lastTimeIndex()+1,e))},o.prototype.clearData=function(){this.data().clear()},o.prototype.data=function(){return this.m_data},o.prototype.symbolId=function(){return this._symbolId},o.prototype.isPulse=function(){return this._symbolInfo&&this._symbolInfo.resolutions.length>0},o.prototype.onTagsChanged=function(){return this._tagsChanged},o.prototype.onSymbolIntervalChanged=function(){return this._symbolIntervalChanged},o.prototype.onSymbolResolved=function(){return this._symbolResolved},o.prototype.onSymbolError=function(){return this._symbolError},o.prototype.onSymbolNotPermitted=function(){return this._symbolNotPermitted},o.prototype.onExtendedHoursNotPermitted=function(){return this._extendedHoursNotPermitted},o.prototype.onStartLoading=function(){return this._startLoading},o.prototype.onDataLoaded=function(){return this._dataLoaded},o.prototype.onStatusChanged=function(){return this._onStatusChanged},o.prototype.onTickmarksRangeChanged=function(){return this._tickmarksRangeChanged},o.prototype.onBarReceived=function(){return this._barReceived},o.prototype.onChangedStyle=function(){return this._onChangedStyle},o.prototype.onCompleted=function(){return this._onCompleted},o.prototype.onRestarted=function(){return this._onRestarted},o.prototype.onBoxSizeChanged=function(){return this._boxSizeChanged},o.prototype.status=function(){return this._status},o.prototype.isDWM=function(){var e=new TradingView.Interval(this.Q0.interval.value());if(e.isDWM())return!0;var t=e.kind()===TradingView.Interval.SECONDS?e.multiplier():60*e.multiplier();return!(216e3>t)},o.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},o.prototype.J61=function(){this._paneView=null,this._projectionBarsPaneView=null,this._symbolLabelView=new A(this.m_model,this,TradingView.CLOSE_PLOT,"firstShortName","showSymbolLabels");var e=this.Q0.style.value();switch(e){case o.STYLE_BARS:this._paneView=new f(this,this.m_model);break;case o.STYLE_CANDLES:this._paneView=new _(this,this.m_model);break;case o.STYLE_LINE:this._paneView=new c(this,this.Q0.lineStyle.priceSource.value(),this.m_model);break;case o.STYLE_AREA:this._paneView=new p(this,this.Q0.areaStyle.priceSource.value(),this.m_model);break;case o.STYLE_RENKO:this._paneView=new m(this,this.m_model),this._projectionBarsPaneView=new y(this,this.m_model);break;case o.STYLE_PB:this._paneView=new w(this,this.m_model),this._projectionBarsPaneView=new T(this,this.m_model);break;case o.STYLE_KAGI:this._paneView=new b(this,this.m_model),this._projectionBarsPaneView=new S(this,this.m_model);break;case o.STYLE_PNF:this._paneView=new C(this,this.m_model),this._projectionBarsPaneView=new x(this,this.m_model);break;case o.STYLE_HEIKEN_ASHI:this._paneView=new g(this,this.m_model);break;case o.STYLE_HOLLOW_CANDLES:this._paneView=new u(this,this.m_model);break;default:throw"Unknown chart style assigned: "+e}},o.prototype._clearStylePlot=function(e,t){if(e.size()){var i=t||+e.first(),r=+e.last()+1;e.range(i,r).each(function(e,t){t[TradingView.STYLE_PLOT]=null})}},o.prototype.invalidateBarStylesCache=function(e){TradingView.logDebugChart("Invalidate style cache starting from "+e),this._clearStylePlot(this.m_data.m_bars,e),this._clearStylePlot(this.m_data.m_nsBars)},o.prototype.invalidateBarColorerCache=function(){delete this._barColorerCache,this.invalidateBarStylesCache()},o.prototype.barColorer=function(){if(this._barColorerCache)return this._barColorerCache;for(var e=null,t=this.m_model.Q17().length-1;t>=0;t--){var i=this.m_model.Q17()[t];if(i.metaInfo&&TradingView.isInherited(i.constructor,TradingView.Study)&&i.hasBarColorer()&&i.properties().visible.value()){var r=i.barColorer();null===e?e=r:e.pushBackBarColorer(r)}}return null===e?e=new L(this):e.pushBackBarColorer(new L(this)),this._barColorerCache=e,this._barColorerCache},o.prototype.properties=function(){return this.Q0},o.prototype._barsState=function(e){var t=e.state();return t.columns=t.columns.filter(function(e){return"style"!==e}),t.data.forEach(function(e){e.value.splice(7,1)}),t},o.prototype.state=function(e){var t=this===this.m_model.mainSeries()?"MainSeries":TradingView.className(this.constructor),i={type:t,id:this.id(),state:this.properties().state(),zorder:this.zorder()};return this._symbolInfo&&this._symbolInfo.ticker&&(i.state.symbol=this._symbolInfo.ticker),e&&(i.bars=this._barsState(this.m_data.m_bars),i.nsBars=this._barsState(this.m_data.m_nsBars),i.symbolInfo=this._symbolInfo,i.rtPrice=this.data().lastProjectionPrice),i.boxSize=this.data().boxSize,i},o.prototype.uniqueId=function(){return this.actualSymbol()+"|"+this.interval()},o.prototype.stateForAlert=function(){var e=this.state();return e.uniqueId=this.uniqueId(),e.state.actualSymbol=this.actualSymbol(),e},o.prototype.restoreData=function(e,t,i,r,n){this._status=o.STATUS_SNAPSHOT,this.m_data.m_bars.restoreState(e),this.m_data.m_nsBars.restoreState(t),this.updateSymbolInfo(i),this.m_data.lastProjectionPrice=r,this.m_data.boxSize=n,n||(this.properties().style.value()==o.STYLE_PNF?this.m_data.boxSize=this.properties().pnfStyle.inputs.boxSize.value():this.properties().style.value()==o.STYLE_RENKO&&(this.m_data.boxSize=this.properties().renkoStyle.inputs.boxSize.value()))},o.prototype.setProperties=function(e){e.timeframe||e.merge({timeframe:""}),e.shortName||e.merge({shortName:""}),this.Q0=e,this.Q0.symbol.listeners().subscribe(this,o.prototype.changeSymbol),this.Q0.interval.listeners().subscribe(this,o.prototype.changeInterval),this.Q0.timeframe.listeners().subscribe(this,o.prototype.changeTimeFrame),this.Q0.listeners().subscribe(this,o.prototype.changeProperties)},o.prototype.changeSymbol=function(){this.setSymbolIntervalDelayed(),this.m_model.checkLineToolSelection()},o.prototype.changeInterval=function(){this.setSymbolIntervalDelayed()},o.prototype.changeTimeFrame=function(){TradingView.trackEvent("GUI","Change timeframe")},o.prototype.title=function(){return this.properties().symbol.value()+", "+TradingView.translatedIntervalString(this.properties().interval.value())},o.prototype.changeProperties=function(e){e!==this.Q0.symbol&&e!==this.Q0.interval&&e!==this.Q0.timeframe&&(this._tagsChanged.fire(),this.J61(),this.updateAllViews(),this.m_model.updateSource(this))},o.prototype._makeNextSymbolId=function(){return"symbol_"+this._nextSymbolId++;
},o.prototype._makeNextSeriesId=function(){return"s"+this._nextSeriesId++},o.prototype._clearLoadingTimer=function(){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null)},o.prototype.onData=function(e){var t=this;switch(e.method){case"symbol_resolved":if(e.params[0]!==this._symbolId){TradingView.logNormalChart("command for old symbol. Expected:"+this._symbolId+", actual"+e.params[0]);break}this.updateSymbolInfo(e.params[1]),this.m_model.updateSource(this),this._symbolResolved.fire(this._symbolInfo),this.m_model.realignLineTools(),TradingView.onWidget()||TradingView.trackEvent("Symbol",e.params[1].listed_exchange,e.params[1].name);var i=this.symbolInfo().minmov/this.symbolInfo().pricescale,r=this.properties();r.style.value()==o.STYLE_RENKO&&r.renkoStyle.inputs.boxSize.value()<i?r.renkoStyle.inputs.merge({boxSize:i}):r.style.value()==o.STYLE_PNF&&r.pnfStyle.inputs.boxSize.value()<i?r.pnfStyle.inputs.merge({boxSize:i}):r.style.value()==o.STYLE_KAGI&&r.kagiStyle.inputs.reversalAmount.value()<i&&r.kagiStyle.inputs.merge({reversalAmount:i});break;case"symbol_error":if(e.params[0]!==this._symbolId){TradingView.logNormalChart("command for old symbol. Expected:"+this._symbolId+", actual"+e.params[0]);break}if(this._clearLoadingTimer(),this._setStatus(o.STATUS_INVALID_SYMBOL),this.Q0.shortName.setValue(this.Q0.symbol.value()),this.m_model.clearAllStudies(),this.updateAllViews(),this.m_model.updateSource(this),e.params[1]==o.PERMISSION_DENIED)switch(e.params[2]){case o.PD_REASON_EXTENDED_HOURS:this._extendedHoursNotPermitted.fire();break;case o.PD_REASON_SYMBOL:this._symbolNotPermitted.fire(e.params[3]);break;default:this._symbolNotPermitted.fire(e.params[2])}else this.m_model.resetTimeScale(),this._symbolError.fire(),$71.sendReport("symbol_error",{chartSession:t._chartApi._sessionid,symbol:t.getSymbolString()});this.m_model.realignLineTools();break;case"series_timeframe":if(e.params[1]!==this._turnaround)break;var n=e.params[2],a=e.params[3],s=e.params[4],l=void 0!==s&&s?a:a+10;this.m_model.setTimeViewport(n,l);break;case"series_error":var d=e.params[2];if(this._clearLoadingTimer(),delete this._loadingStartTime,Z75.enabled("charting_library_debug_mode")&&TradingView.logNormal("Error reason: "+d),d&&d.startsWith("study_not_auth:")){var h=d.split(":",2)[1].split("@",2)[0];h in{BarSetRenko:!0,BarSetPriceBreak:!0,BarSetKagi:!0,BarSetPnF:!0}?this.chartTypeNotPermitted.fire(h):"BarSetSpread"===h&&this.intradaySpreadNotPermitted.fire()}else"resolution_not_entitled"==d?this.intradayExchangeNotPermitted.fire():"custom_resolution"==d&&this.customIntervalNotPermitted.fire();this._setStatus(Z75.enabled("no_bars_status")&&this._symbolInfo?o.STATUS_NO_BARS:o.STATUS_INVALID_SYMBOL);break;case"series_loading":if(e.params[1]!==this._turnaround)break;if(e.params[0]!==this._seriesId){TradingView.logNormalChart("command for old series. Expected:"+this._seriesId+", actual"+e.params.customId);break}this._setStatus(o.STATUS_LOADING),t._loadingStartTime=(new Date).getTime(),t.loadingTimer=setTimeout(function(){var e={chartSession:t._chartApi._sessionid,symbol:t.getSymbolString(),interval:t.interval()};$71.sendReport("series_loading",e)},15e3);break;case"series_completed":if(e.params[2]!==this._turnaround)break;if(e.params[0]!==this._seriesId){TradingView.logNormalChart("command for old series. Expected:"+this._seriesId+", actual"+e.params.customId);break}var p="chartSession:"+t._chartApi._sessionid;TradingView.logDebugChart(p+", Series loading took "+((new Date).getTime()-this._loadingStartTime)+" ms, eod:"+this._endOfData),delete this._loadingStartTime;var c=e.params[1];switch("pulsed"==c&&(c="delayed"),c){case"streaming":this._setStatus(o.STATUS_READY);break;case"endofday":this._setStatus(o.STATUS_EOD);break;case"delayed":this._setStatus(o.STATUS_DELAYED);break;case"pulsed":this._setStatus(o.STATUS_PULSE)}c.match(/delayed_streaming/)&&this._setStatus(o.STATUS_DELAYED_STREAMING);var u=this.m_model.paneForSource(this);if(u.recalculatePriceScale(this.priceScale()),this.m_model.Q18(new $21($21.FULL_UPDATE)),this.m_data.size()&&this._tickmarksRangeChanged.fire({start:this.data().first().value[TradingView.TIME_PLOT],end:this.data().last().value[TradingView.TIME_PLOT]}),this.model().recalcVisibleRangeStudy(this.model().Q17(),!0),this.model().recalcStudyBasedLineTools(),this.isLockScale()&&!this.model().timeScale().isEmpty()&&!this._seriesLoaded){this.model().timeScale()._correctOffset(),this.model().timeScale().correctBarSpacing();var _=this.model().timeScale().visibleBars();this.priceScale().setPriceRange(this.priceRange(_.firstBar(),_.lastBar()))}this._seriesLoaded=!0,this._onCompleted.fire(this._endOfData),this.requestMoreData();break;case"series_deleted":break;case"data_update":if(e.params.customId!==this._seriesId){TradingView.logNormalChart("command for old series. Expected:"+this._seriesId+", actual"+e.params.customId);break}if(this.status()===o.STATUS_INVALID_SYMBOL)break;if(this._clearLoadingTimer(),e.params.plots.length>0&&(this._endOfData=!1),e.params.plots.length){var f=this.m_data.m_bars.size(),g=this.m_data.m_bars.merge(e.params.plots),v="Merge bars. Changes:{length:"+g.length+", earliestRow:"+g.earliestRow.index+"} ";v+="bars state:{firstBar:"+this.m_data.m_bars.first()+",lastBar:"+this.m_data.m_bars.last()+",size:"+this.m_data.m_bars.size()+"}",TradingView.logDebugChart(v),f!=this.bars().size()&&(this._barReceived.fire(this.m_data.m_bars.size()),this.model().recalcVisibleRangeStudy(this.model().Q17(),!0))}else this.m_data.clear(),this._startLoading.fire();var m=this.properties().style.value();if(!e.params.nonseries||m!==o.STYLE_RENKO&&m!==o.STYLE_KAGI&&m!==o.STYLE_PNF&&m!==o.STYLE_HEIKEN_ASHI&&m!==o.STYLE_PB)e.params.nonseries||(this.m_data.m_nsBars.clear(),this.m_data.lastProjectionPrice=void 0);else{var y=this.parseJapProjBars(e.params.nonseries);this.m_data.m_nsBars=y.nsBars,this.m_data.lastProjectionPrice=y.lastPrice;var w=this.m_data.boxSize!==y.boxSize;this.m_data.boxSize=y.boxSize,w&&this._boxSizeChanged.fire(this.m_data.boxSize)}var u=this.m_model.paneForSource(this);this.m_model.updateAllVolumeStudies(),this.m_model.recalculatePane(u),this.m_model.updateSource(this),this.m_model.updateLineTools(),this.m_model.updateCrossHair()}this._dataLoaded.fire(e)},o.prototype.fixBoxSize=function(){var e=this.model().timeScale(),t=this.priceScale();t.isEmpty()||e.isEmpty()||(this.m_data.boxSize=Math.abs(t.coordinateToPrice(e.barSpacing())-t.coordinateToPrice(0)))},o.prototype.parseJapProjBars=function(e){var t,i,r=new TradingView.PlotList(["time","open","high","low","close","adt","style"]),n=this.model().timeScale(),a=this.properties().style.value();if(e.d&&""!==e.d){var s=TradingView.Study.prototype._makeJSONForNSData.call(this,{params:{nonseries:e}}).data;t=s.price,i=s.boxSize;for(var l=s.bars,d=0;l&&d<l.length;d++){var h=[],p=e.indexes[l[d].time];h.push(n.points().valueAt(p)),h.push(l[d].open),h.push(l[d].high),h.push(l[d].low),h.push(l[d].close),h.push(l[d].volume),a===o.STYLE_KAGI?h.push(l[d].additionalPrice):a===o.STYLE_PNF&&h.push(l[d].factor),r.add(p,h)}}return{nsBars:r,lastPrice:t,boxSize:i}},o.prototype.disconnect=function(){this._symbolId=null,this._seriesId=null,this._predictBars=0,this._status=o.STATUS_OFFLINE},o.prototype.isStarted=function(){return!!this._symbolId},o.prototype.restart=function(){var e=i(49);this._onRestarted.fire(),this._setStatus(o.STATUS_RESOLVING),this.m_data=new $57(this,this.model()),this._prevSymbolId=this._symbolId,this._symbolId=this._makeNextSymbolId(),this._chartApi.resolveSymbol(this._symbolId,this.getSymbolString(),this._handler),this._seriesId?(this._turnaround="s"+ ++this._turnaroundCounter,this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,this.Q0.interval.value(),this._handler,this._prevSymbolId)):(this._seriesId=this._makeNextSeriesId(),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,this.Q0.interval.value(),this._prepareChartApiParams(),this._handler)),this.Q0.showInDataWindow.listeners().subscribe(this.m_model,e.prototype.fullUpdate),this.m_symbol=this.Q0.symbol.value(),this.m_interval=this.Q0.interval.value(),this._seriesLoaded=!1},o.prototype._generateTimeframe=function(e,t){var i=t.right(1),r=e;if("ytd"===t)r+=",YTD";else if("d"===i){var n=t.left(t.length-1);r+=","+n,Z75.enabled("daily_timeframe_suffix")&&(r+="D")}else if("m"===i){var n=t.left(t.length-1);r+=","+n+"M"}else"all"===t&&(r+=",ALL");return r},o.prototype.hasDelayedSymbolIntervalChange=function(){return!!this._setSymbolIntervalDelay},o.prototype.setSymbolIntervalDelayed=function(){this._setSymbolIntervalDelay&&clearTimeout(this._setSymbolIntervalDelay),this._setSymbolIntervalDelay=setTimeout(function(){delete this._setSymbolIntervalDelay,this.setSymbolInterval(this.Q0.symbol.value(),this.Q0.interval.value())}.bind(this),10)},o.prototype.setSymbolInterval=function(e,t){delete this._gotoDateResult;var i=(t+"").split(","),r=0,n=t;2==i.length&&(n=i[0],r=i[1]);var a=!this.symbolSameAsCurrent(e)||Z75.enabled("same_data_requery"),s=this.m_interval!==n||Z75.enabled("same_data_requery");this.m_timeframe!==r;if((a||s)&&(this.m_model.realignLineTools(),this.m_symbol=e,this.m_interval=n,this.m_timeframe=r,this._status!==o.STATUS_SNAPSHOT)){if(this._setStatus(o.STATUS_RESOLVING),this._symbolId&&!a||this.updateSymbolInfo(null),this._symbolIntervalChanged.fire(),this._onRestarted.fire(),this._chartApi&&this._chartApi.connected()){if(!this._symbolId||a){this._prevSymbolId=this._symbolId,this._symbolId=this._makeNextSymbolId();var l=this.getSymbolString();this._chartApi.resolveSymbol(this._symbolId,l,this._handler)}if(this._seriesId){this._modifyTimer&&clearTimeout(this._modifyTimer);var d=this;d._turnaround="s"+ ++d._turnaroundCounter,this._pendingInterval&&(t=this._generateTimeframe(t,this._pendingInterval),delete this._pendingInterval),this._modifyTimer=setTimeout(function(){d._predictBars=0,d._chartApi.modifySeries(d._seriesId,d._turnaround,d._symbolId,t,d._handler,this._prevSymbolId),d._modifyTimer=null},30)}else this._seriesId=this._makeNextSeriesId(),this._chartApi.createSeries(this._seriesId,this._turnaround,this._symbolId,t,this._prepareChartApiParams(),this._handler)}this._seriesLoaded=!1,this._haveToScroll=!0}},o.prototype.actualSymbol=function(){return this.symbolInfo()?this.symbolInfo().full_name:this.symbol()},o.prototype.proSymbol=function(){return this.symbolInfo()?this.symbolInfo().pro_name:this.symbol()},o.prototype.symbol=function(){return this.properties().symbol.value()},o.prototype.interval=function(){return this.properties().interval.value()},o.prototype.isIntradayInterval=function(){return!!/^\d*$/.test(this.interval())&&this.interval()<=1440},o.prototype.bars=function(){return this.m_data.m_bars},o.prototype.nsBars=function(){return this.m_data.m_nsBars},o.prototype.open=function(e){return this.m_data.valueAt(e)[TradingView.OPEN_PLOT]},o.prototype.high=function(e){return this.m_data.valueAt(e)[TradingView.HIGH_PLOT]},o.prototype.low=function(e){return this.m_data.valueAt(e)[TradingView.LOW_PLOT]},o.prototype.close=function(e){return this.m_data.valueAt(e)[TradingView.CLOSE_PLOT]},o.prototype.hl2=function(e){return(this.high(e)+this.low(e))/2},o.prototype.hlc3=function(e){return(this.high(e)+this.low(e)+this.close(e))/3},o.prototype.ohlc4=function(e){return(this.open(e)+this.high(e)+this.low(e)+this.close(e))/4},o.prototype.priceRange=function(e,t){if(!TradingView.isInteger(e))return TradingView.logDebugChart("Series.priceRange: incorrect startBar"),null;if(!TradingView.isInteger(t))return TradingView.logDebugChart("Series.priceRange: incorrect endBar"),null;if(this.data().isEmpty())return null;var i,r=this.data().boxSize;if(this.isLockScale()){void 0===r&&this.fixBoxSize();var n=this.priceScale().internalHeight()/(this.model().timeScale().barSpacing()/this.data().boxSize),o=this.data().search(t,TradingView.SEARCH_NEAREST_LEFT),a=(o.value[TradingView.HIGH_PLOT]+o.value[TradingView.LOW_PLOT])/2,i=new PriceRange(a-.5*n,a+.5*n),s=this.data().search(e,TradingView.SEARCH_NEAREST_RIGHT);return this.priceScale().properties().percentage.value()&&i?i.convertToPercents(s.value[TradingView.CLOSE_PLOT]):i}var l=this.data().bars().minMaxOnRange2(e,t,[{index:TradingView.LOW_PLOT,offset:0},{index:TradingView.HIGH_PLOT,offset:0}]),d=this.data().nsBars().minMaxOnRange(e,t,[{index:TradingView.LOW_PLOT,offset:0},{index:TradingView.HIGH_PLOT,offset:0}]);null!=d.min&&(l.min=Math.min(l.min,d.min)),null!=d.max&&(l.max=Math.max(l.max,d.max));var i=new PriceRange(l.min,l.max);if(i&&i.minValue()===i.maxValue()&&(i=new PriceRange(i.minValue()-.5,i.maxValue()+.5)),this.priceScale().properties().percentage.value()&&i){var s=this.data().search(e,TradingView.SEARCH_NEAREST_RIGHT);return i.convertToPercents(s.value[TradingView.CLOSE_PLOT])}return this.priceScale().isLog()&&i?new PriceRange(this.priceScale().priceToLogical(i.minValue()),this.priceScale().priceToLogical(i.maxValue())):i},o.prototype.nearestData=function(e,t){if(!TradingView.isInteger(e))return void TradingView.logDebugChart("Series.nearestData: incorrect logicalPoint");var i=this.data().search(e,t);return i?i:void 0},o.prototype.nearestIndex=function(e,t){var i=this.nearestData(e,t);return i?i.index:void 0},o.prototype.paneViews=function(e){if(!this.properties().visible.value())return null;var t=[this._paneView];return this._futureBarsPaneView&&t.push(this._futureBarsPaneView),this._projectionBarsPaneView&&t.push(this._projectionBarsPaneView),t.push(this._priceLineView),t.push(this._symbolLabelView),t.push(this._gotoDateView),t},o.prototype.dataWindowView=function(){return this._dataWindowView},o.prototype.statusView=function(){return this._statusView},o.prototype.priceAxisViews=function(e,t){return this.m_model.paneForSource(this)===e&&t===this.priceScale()&&(this.m_model.properties().scalesProperties.showSeriesLastValue.value()||this.properties().showCountdown.value())?this._priceAxisViews:null},o.prototype.base=function(){return this._base},o.prototype.formatter=function(){return this._formatter},o.prototype.purgeSymbolInfo=function(){this._symbolInfo=null},o.prototype.symbolInfo=function(){return this._symbolInfo},o.prototype._recreateFormatter=function(){if("default"==this.properties().minTick.value())this._formatter=new TradingView.PriceFormatter(this._symbolInfo?this._symbolInfo.pricescale:100,this._symbolInfo?this._symbolInfo.minmov:1,this._symbolInfo?this._symbolInfo.fractional:!1,this._symbolInfo?this._symbolInfo.minmove2:void 0);else{var e=this.properties().minTick.value().split(","),t=parseInt(e[0]),i=parseInt(e[1]),r="true"===e[2];this._formatter=new TradingView.PriceFormatter(t,i,r)}this.priceScale()&&this.priceScale().updateFormatter()},o.prototype.updateSymbolInfo=function(e){var t=this,i=e&&(e.pro_name||e.full_name||e.name);this._symbolInfo=e,e&&(this.Q0.shortName.setValue(e.name),i&&this.Q0.symbol.value().toUpperCase()!==i.toUpperCase()&&this.Q0.symbol.setValue(i)),this._base=e?e.pricescale/e.minmov:100,this._recreateFormatter(),this._statusView.update(),this.priceScale().updateFormatter(),"undefined"!=typeof quoteSessionMultiplexerInstance&&(this._quoteSessionClientId||(this._quoteSessionClientId="series-"+TradingView.guid()),this._quoteSessionSymbol&&(quoteSessionMultiplexerInstance.simple.unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=void 0),i&&(this._quoteSessionSymbol=i,quoteSessionMultiplexerInstance.simple.subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,function(e,i){t.quoteData=e&&e.values||null,i&&i.values&&i.values.current_session&&t.marketStatus.setValue(i.values.current_session)}))),this.checkInterval(),this.dataPoweredBy=TradingView.getDataVendorString(e)},o.prototype.symbolSameAsCurrent=function(e){if(this.m_symbol===e)return!0;var t=this._symbolInfo;return t&&(t.full_name===e||t.pro_name===e)},o.prototype.updateAllViews=function(){this._paneView.update(),this._dataWindowView.update(),this._statusView.update(),this._priceAxisViews[0].update(),this._priceAxisViews[1].update(),this._futureBarsPaneView&&this._futureBarsPaneView.update(),this._projectionBarsPaneView&&this._projectionBarsPaneView.update(),this._priceLineView.update(),this._gotoDateView.update(),this._symbolInfo&&this._symbolLabelView.update()},o.prototype._setStatus=function(e){this._status=e,this._statusView.update(),this.m_model.updateSource(this),this._onStatusChanged.fire()},o.prototype.requestMoreData=function(e){if((this._status===o.STATUS_READY||this._status===o.STATUS_PULSE||this._status===o.STATUS_DELAYED||this._status===o.STATUS_DELAYED_STREAMING||this._status===o.STATUS_EOD)&&!this.m_model.timeScale().isEmpty()){var t=this.m_model.timeScale().visibleBars();if(!t.isEmpty()&&0!==this.bars().size()){var i=e||t.lastBar()-this.data().last();if(this._predictBars<i&&(this._predictBars=i,this._chartApi&&this._chartApi.connected()&&this._chartApi.requestMoreTickmarks(this._seriesId,i,this._handler)),!this._endOfData){var r=this.bars()._indexAt(0),n=e||r-t.firstBar();0>=n||(this._endOfData=!0,this._chartApi&&this._chartApi.connected()&&(this._chartApi.requestMoreData(this._seriesId,n,this._handler),Z75.enabled("charting_library_base")&&(this._predictBars=0)),this._setStatus(o.STATUS_LOADING))}}}},o.prototype.bindStyleChange=function(){var e=this;["candleStyle","hollowCandleStyle","haStyle","barStyle","lineStyle","areaStyle","renkoStyle","pbStyle","kagiStyle","pnfStyle"].forEach(function(t){e.Q0[t].listeners().subscribe(e,o.prototype.invalidateBarStylesCache)})},o.prototype.bindJapChartsInputs=function(){this.Q0.style.listeners().subscribe(this,this.onChartStyleChanged),this.Q0.renkoStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged),this.Q0.renkoStyle.inputs.source.listeners().subscribe(this,this.onInputChanged),this.Q0.renkoStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this.Q0.renkoStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged),this.Q0.pbStyle.inputs.lb.listeners().subscribe(this,this.onInputChanged),this.Q0.pbStyle.inputs.source.listeners().subscribe(this,this.onInputChanged),this.Q0.kagiStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged),this.Q0.kagiStyle.inputs.source.listeners().subscribe(this,this.onInputChanged),this.Q0.pnfStyle.inputs.boxSize.listeners().subscribe(this,this.onInputChanged),this.Q0.pnfStyle.inputs.reversalAmount.listeners().subscribe(this,this.onInputChanged),this.Q0.pnfStyle.inputs.sources.listeners().subscribe(this,this.onInputChanged),this.Q0.pnfStyle.inputs.style.listeners().subscribe(this,this.onInputChanged),this.Q0.pnfStyle.inputs.atrLength.listeners().subscribe(this,this.onInputChanged);var e=this;this.Q0.lockScale.listeners().subscribe(this,function(t){t.value()&&e.model().timeScale().recalcLockedScale()})},o.prototype.createExtendedHoursProperty=function(){function e(){var e=window.user?!!user.extended_session:!1,i=t.model().readOnly(),r=t.Q0.extendedHours.value(),n=Z75.enabled("widget");!r||n||i||e||(t._extendedHoursNotPermitted.fire(),r=!1),r&&!t.isIntradayInterval()&&(r=!1),t.extendedHours.setValue(r)}var t=this;t.extendedHours=new Property,t.Q0.extendedHours.listeners().subscribe(null,e),t.Q0.interval.listeners().subscribe(null,e),t.chartWidgetInitialized.subscribe(null,e),e()},o.prototype.isNeedRestart=function(e){if(void 0===e&&(e=this.properties().style.value()),this._prevChartStyle!=e){var t=[o.STYLE_BARS,o.STYLE_CANDLES,o.STYLE_HOLLOW_CANDLES,o.STYLE_LINE,o.STYLE_AREA];if(!(t.indexOf(this._prevChartStyle)>-1&&t.indexOf(e)>-1))return!0}return!1},o.prototype.onChartStyleChanged=function(){this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.restart()),this._prevChartStyle=this.properties().style.value(),this._onChangedStyle.fire(this.properties().style.value()),this.invalidateBarStylesCache()},o.prototype.onInputChanged=function(){this.restart()},o.prototype.onExtendedHoursChanged=function(){return this._extendedHoursChanged},o.prototype.getSymbolString=function(){var e;switch(e=Z75.enabled("pay_attention_to_ticker_not_symbol")&&this._symbolInfo?this._symbolInfo.ticker:this.Q0.symbol.value(),this.extendedHours.value()&&(e={symbol:e,session:"extended"}),this.Q0.style.value()){case o.STYLE_RENKO:var t=this.Q0.renkoStyle.inputs;e={symbol:e,type:"BarSetRenko@tv-prostudies-1!",inputs:[t.source.value(),t.style.value(),t.boxSize.value(),t.atrLength.value()]};break;case o.STYLE_PB:var t=this.Q0.pbStyle.inputs;e={symbol:e,type:"BarSetPriceBreak@tv-prostudies-1!",inputs:[t.source.value(),t.lb.value()]};break;case o.STYLE_KAGI:var t=this.Q0.kagiStyle.inputs;e={symbol:e,type:"BarSetKagi@tv-prostudies-1!",inputs:[t.source.value(),t.reversalAmount.value()]};break;case o.STYLE_PNF:var t=this.Q0.pnfStyle.inputs;e={symbol:e,type:"BarSetPnF@tv-prostudies-1!",inputs:[t.sources.value(),t.style.value(),t.boxSize.value(),t.atrLength.value(),t.reversalAmount.value()]};break;case o.STYLE_HEIKEN_ASHI:e={symbol:e,type:"BarSetHeikenAshi@tv-basicstudies-1!",inputs:[]}}return"string"!=typeof e&&(e="="+JSON.stringify(e)),e},o.prototype.getStyleShortName=function(){switch(this.Q0.style.value()){case o.STYLE_BARS:return"bar";case o.STYLE_CANDLES:return"candle";case o.STYLE_HOLLOW_CANDLES:return"hollowCandle";case o.STYLE_LINE:return"line";case o.STYLE_AREA:return"area";case o.STYLE_RENKO:return"renko";case o.STYLE_PB:return"pb";case o.STYLE_KAGI:return"kagi";case o.STYLE_PNF:return"pnf";case o.STYLE_HEIKEN_ASHI:return"ha";default:throw Error("Missed short name for style "+this.Q0.style.value())}},o.prototype.getInputsProperties=function(){var e=this.Q0[this.getStyleShortName()+"Style"];return e.inputs||e.addProperty("inputs"),e.inputs},o.prototype.getRealVisibleRange=function(){var e,t,i=this.model().timeScale().visibleBars();return e=this.data().search(i.m_firstBar,TradingView.SEARCH_NEAREST_RIGHT),t=this.data().search(i.m_lastBar,TradingView.SEARCH_NEAREST_LEFT),void 0===e||void 0===t?null:new P(e.index,t.index)},o.prototype.isLockScale=function(){return this.properties().lockScale.value()},o.prototype.firstValue=function(){return this.data().firstValue()},o.prototype.firstBar=function(){return this.data().firstBar()},o.prototype.sessionsStudy=function(){if(this._sessionsStudy)return this._sessionsStudy;for(var e=this.model().paneForSource(this),t=e.Q17(),i=0;i<t.length;i++){var r=t[i];if(r instanceof TradingView.Study&&"Sessions"==r.metaInfo().shortId)return this._sessionsStudy=r,this._sessionsStudy}return!1},o.prototype.createSessStudy=function(){if(!Z75.enabled("charting_library_base")&&!this.sessionsStudy()){var e=TradingView.StudyMetaInfo.findStudyMetaInfo(this.model().studiesMetaData(),"Sessions@tv-basicstudies");this.model().insertStudy(e,!1,!0),this._onSessionsStudyCreated.fire()}},o.prototype.checkSessStudy=function(){Z75.enabled("charting_library_base")||(this.sessionsStudy()||this.createSessStudy(),this.sessionsStudy().start())},o.prototype.isSpread=function(){return"spread"===this._symbolInfo.type},o.prototype.firstSymbol=function(){return this._symbolInfo?this._symbolInfo.legs[0]:""},o.prototype.firstShortName=function(){return $67.ticker(this.firstSymbol())},o.prototype.onSessionsStudyCreated=function(){return this._onSessionsStudyCreated},o.prototype.loadDataTo=function(e){e.right(1);this._turnaround="s"+ ++this._turnaroundCounter;var t=this.Q0.interval.value();t=this._generateTimeframe(t,e),this._chartApi.modifySeries(this._seriesId,this._turnaround,this._symbolId,t,this._handler)},o.prototype.checkInterval=function(){if(this._symbolInfo&&(TradingView.Interval.kind(this.interval())!==TradingView.Interval.MINUTES||this._symbolInfo.has_intraday||this.requestingIntradayWhenNotSupported.fire(),this._symbolInfo.hasOwnProperty("supported_resolutions"))){var e=this.Q0.interval.value();-1==this._symbolInfo.supported_resolutions.indexOf(e)&&this.requestingResolutionWhenNotSupported.fire(this._symbolInfo.supported_resolutions[0])}},o.prototype.setPriceScale=function(e){this.m_priceScale!=e&&(this.m_priceScale=e,this.priceScaleChanged.fire(e))},o.prototype.setGotoDateResult=function(e){this._gotoDateResult=e},o.prototype.gotoDateResult=function(){return this._gotoDateResult},TradingView.Series=o,e.exports=o},function(e,t,i){"use strict";function r(e,t){n.call(this,t),this._series=e,this._series.onRestarted().subscribe(this,r.prototype.Q18),this._series.onSymbolResolved().subscribe(this,r.prototype.Q18),this._series.onBoxSizeChanged().subscribe(this,r.prototype.Q18)}var n=i(33);inherit(r,n),r.prototype.Q18=function(){delete this._text,this.update()},r.prototype.round=function(e,t){var i=Math.round(e*Math.pow(10,t))/Math.pow(10,t);return i?i:""},r.prototype.update=function(){if(!("_text"in this)){var e,t=this;if(this._series.symbolInfo()){if(e=this._series.symbolInfo().description,this._text=e,"QUANDL"==this._series.symbolInfo().exchange)if(2===e.split("/").length)this._text=e.split("/")[1];else{var i=e.split("'").filter(function(e){return e.length});this._text="",i.forEach(function(e){e=e&&("/"===e[0]||/\d+\/\(?/.test(e))?[e]:e.split("/").filter(function(e){return e.length}),t._text+=e[2===e.length?1:0]})}}else this._text=this._series.symbol();if(this._text+=", "+TradingView.translatedIntervalString(this._series.interval()),this._series.symbolInfo()&&this._series.symbolInfo().exchange){var r=this._series.symbolInfo().exchange;if("QUANDL"==this._series.symbolInfo().exchange){var n=/[\w_]+\/[\w_]+/.exec(e);n&&n[0]?this._text+=", "+n[0].split("/")[0]:this._text+=", "+e.split("/")[0]}this._text+=", "+r}var o=this._series.Q0;switch(o.style.value()){case TradingView.Series.STYLE_RENKO:var a=o.renkoStyle.inputs.style.value()+("ATR"===o.renkoStyle.inputs.style.value()?"("+o.renkoStyle.inputs.atrLength.value()+")":"");this._text+=", Renko ["+o.renkoStyle.inputs.source.value()+", "+a+", "+this.round(this._series.data().boxSize,4)+"]";break;case TradingView.Series.STYLE_PB:this._text+=", Line Break ["+o.pbStyle.inputs.source.value()+", "+o.pbStyle.inputs.lb.value()+"]";break;case TradingView.Series.STYLE_KAGI:this._text+=", Kagi ["+o.kagiStyle.inputs.source.value()+", "+o.kagiStyle.inputs.reversalAmount.value()+"]";break;case TradingView.Series.STYLE_PNF:var a=o.pnfStyle.inputs.style.value()+("ATR"===o.pnfStyle.inputs.style.value()?"("+o.pnfStyle.inputs.atrLength.value()+")":"");this._text+=", PnF ["+o.pnfStyle.inputs.sources.value()+", "+a+", "+this.round(this._series.data().boxSize,4)+", "+o.pnfStyle.inputs.reversalAmount.value()+"]";break;case TradingView.Series.STYLE_HEIKEN_ASHI:this._text+=", "+$.t("Heikin Ashi")}this._bold=!1,this._size="17px",this._text=this._text.replace(/\'/g,"")}},e.exports=r},function(e,t){"use strict";function i(e){this._props=e,this._text="",this._size="12px",this._bold=!1}i.prototype.text=function(){return this._text},i.prototype.setText=function(e){this._text=e},i.prototype.color=function(){return this._props?this._props.scalesProperties.textColor.value():"#444"},i.prototype.bold=function(){return this._bold},i.prototype.size=function(){return this._size},e.exports=i},function(e,t,i){"use strict";function r(e,t){n.call(this,e,t)}var n=i(35);inherit(r,n),r.prototype.lastPrice=function(){return this._series.data().lastProjectionPrice},r.prototype._updateImpl=function(e){var t=this._rendererData;if(t.visible=!1,t.text="",this.Z98.properties().scalesProperties.showSeriesLastValue.value()&&!this.Z98.timeScale().isEmpty()&&!this._series.priceScale().isEmpty()&&this.lastPrice()){var e=this.Z98.timeScale().visibleBars();if(!e.isEmpty()){var i=this._series.data().search(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT);if(void 0!==i){t.visible=!0;var r=this._series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this._series.data().valueAt(r)[TradingView.CLOSE_PLOT],o=(this._series.data().last().value,this.lastPrice());this._series.priceScale().properties().percentage.value()&&(o=100*(o-n)/n),t.text=this._series.priceScale().formatter().format(o);var a=this._series.properties().style.value()===TradingView.Series.STYLE_HEIKEN_ASHI;if(a)if(this._series.properties().haStyle.showRealLastPrice.value()){var s=this._series.lastValueData(TradingView.CLOSE_PLOT,!0);s.noData||s.color==this._background||(this._background=s.color),Z75.enabled("countdown")&&this._series.properties().showCountdown.value()&&(t.secondLine=this._countdownInfo());var l=this._series.lastValueData(TradingView.CLOSE_PLOT,!1).index,d=s.index,h=l===d;t.visible=h}else t.visible=!1;else{var p=this._series.barColorer(),c=p.barStyle(i.index,!0);this._background=c.barColor}this._background!==t.background&&(t.background=this._background,t.color=this.color()),t.coordinate=this._series.priceScale().priceToCoordinate(o)}}}},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._series=e,this.Z98=t,this._text="",this._coordinate=0,this._background="black",this._color="white",this._invalidated=!0,this._rendererData={text:"",coordinate:null,color:"#FFF",background:"#000",visible:!1,secondLine:null}}var n=i(14),o=i(15);i(36);inherit(r,n),r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(e){var t=this._rendererData;if(t.visible=!1,t.text="",this.Z98.properties().scalesProperties.showSeriesLastValue.value()){var i=this._series.lastValueData(null,Z75.enabled("price_scale_always_last_bar_value"));if(!i.noData&&i.text){var r=this._series.properties().style.value()===TradingView.Series.STYLE_HEIKEN_ASHI;if(r&&this._series.properties().haStyle.showRealLastPrice.value()){var n=this._series.lastValueData(TradingView.CLOSE_PLOT,!1).index,o=this._series.lastValueData(TradingView.CLOSE_PLOT,!0).index;if(n===o)return}if(t.visible=!0,t.text=i.text,i.color!=this._background&&(this._background=i.color,t.color=this.color(),t.background=this._background),t.coordinate=i.coordinate,this._floatCoordinate=i.floatCoordinate,this._coordinate=i.coordinate,t.secondLine=null,Z75.enabled("countdown")&&this._series.properties().showCountdown.value()){var a=[TradingView.Series.STYLE_BARS,TradingView.Series.STYLE_CANDLES,TradingView.Series.STYLE_LINE,TradingView.Series.STYLE_AREA,TradingView.Series.STYLE_HOLLOW_CANDLES,TradingView.Series.STYLE_HEIKEN_ASHI];-1!=a.indexOf(this._series.properties().style.value())&&(t.secondLine=this._countdownInfo())}}}},r.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),n.prototype.coordinate.call(this)},r.prototype.renderer=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer||(this._renderer=new o(this._rendererData)),this._renderer},r.prototype.dump=function(){return{text:this._rendererData.text,coordinate:this._rendererData.coordinate,color:this._rendererData.color,background:this._rendererData.background,visible:this._rendererData.visible}},r.prototype.text=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._rendererData.text},r.prototype._countdownInfo=function(){var e=null;if(this._series.isDWM())return e;var t=1e3*this._series.data().bars().last().value[0],i=((new Date).getTimezoneOffset(),1e3*this._series.serverTimeOffset()),r=TradingView.Interval.parse(this._series.interval()),n=r.kind()===TradingView.Interval.SECONDS?r.multiplier():60*r.multiplier(),o=t.valueOf()+1e3*n,a=(new Date).valueOf()+i,s=Math.round((o-a)/1e3);
if(s>0){s=Math.min(s,n);var l="";s>=3600&&(l=""+Math.floor(s/3600)+":"),s%=3600;var d=("0"+Math.floor(s/60)).right(2);s%=60;var h=("0"+Math.floor(s)).right(2);e=l+d+":"+h}return e},e.exports=r},function(e,t){"use strict";function i(e){this._maxSize=e||50,this.reset()}i.prototype.measureText=function(e,t){var i=(t+"").replace(this._re,"0");if(this._cache[i])return this._cache[i].width;if(this._actualSize==this._maxSize){var r=this._tick2Labels[this._oldestTick];delete this._tick2Labels[this._oldestTick],delete this._cache[r],this._oldestTick++,this._actualSize--}var n=e.measureText(i).width;return this._cache[i]={width:n,tick:this._usageTick},this._tick2Labels[this._usageTick]=i,this._actualSize++,this._usageTick++,n},i.prototype.reset=function(){this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}},i.prototype._re=/[2-9]/g,e.exports=i},function(e,t,i){"use strict";function r(e,t){o.call(this),this._series=e,this.Z98=t,this._items.push(new a($.t("Open",{context:"in_legend"}),"")),this._items.push(new a($.t("High",{context:"in_legend"}),"")),this._items.push(new a($.t("Low",{context:"in_legend"}),"")),this._items.push(new a($.t("Close",{context:"in_legend"}),"")),this._invalidated=!0,this.update()}var n=i(38),o=n.DataWindowView,a=n.DataWindowItem;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(){if(this._series.symbolInfo()?(this._header=[this._series.symbolInfo().name,TradingView.translatedIntervalString(this._series.interval()),this._series.symbolInfo().exchange].join(", "),this._title=this._series.symbolInfo().description):this._header=this._series.symbol(),this._items[0].setValue($.t("n/a")),this._items[1].setValue($.t("n/a")),this._items[2].setValue($.t("n/a")),this._items[3].setValue($.t("n/a")),!this.Z98.timeScale().isEmpty()&&0!==this._series.bars().size()){var e=this._series.barColorer(),t=this._series.data().size()-1,i=this.Z98.crossHairSource().appliedIndex(),r=isNumber(i)?this._series.nearestIndex(i,TradingView.SEARCH_NEAREST_LEFT):this._series.nearestIndex(t,TradingView.SEARCH_NEAREST_LEFT);if(void 0!==r){var n=this._series.data().valueAt(r),o=this._series.formatter();this._items[0].setValue(o.format(n[TradingView.OPEN_PLOT])),this._items[1].setValue(o.format(n[TradingView.HIGH_PLOT])),this._items[2].setValue(o.format(n[TradingView.LOW_PLOT])),this._items[3].setValue(o.format(n[TradingView.CLOSE_PLOT]));var a=e.barStyle(r,!1),s=a.barColor,l=this._series.model().paneForSource(this._series),d=l.Q0.background.value(),h=new TradingView.RGBColor(s).toHex();TradingView.colorsAreSimilar(h,d)&&(s=TradingView.invertColor(h));for(var p=0;4>p;p++)this._items[p].setColor(s)}}},r.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},r.prototype.dump=function(){return{header:this._header,items:this._items}},r.prototype.additional=function(){return this._series.dataPoweredBy?"(Data Provided by "+this._series.dataPoweredBy+")":void 0},e.exports=r},function(e,t){"use strict";function i(e,t){this.m_title=e,this.m_value=t,this._visible=!0,this._color=void 0}function r(){this._header="",this._title="",this._items=[]}i.prototype.title=function(){return this.m_title},i.prototype.text=function(){return this.m_value},i.prototype.visible=function(){return this._visible},i.prototype.color=function(){return this._color},i.prototype.setVisible=function(e){this._visible=e},i.prototype.setValue=function(e){this.m_value=e},i.prototype.setColor=function(e){this._color=e},i.prototype.value=function(){return this.m_value},r.prototype.header=function(){return this._header},r.prototype.title=function(){return this._title},r.prototype.items=function(){return this._items},r.prototype.update=function(){},t.DataWindowItem=i,t.DataWindowView=r},function(e,t){"use strict";function i(e,t){this.m_series=e,this.m_model=t,this.m_bars=[],this._invalidated=!0}function r(e,t){i.call(this,e,t)}function n(e,t){i.call(this,e,t)}function o(e,t){i.call(this,e,t)}function a(e,t){i.call(this,e,t)}function s(e,t,i){this.m_series=e,this.m_priceSource=t,this.m_model=i,this.m_items=[],this._barGetter={open:function(e){return e[TradingView.OPEN_PLOT]},high:function(e){return e[TradingView.HIGH_PLOT]},low:function(e){return e[TradingView.LOW_PLOT]},close:function(e){return e[TradingView.CLOSE_PLOT]},hl2:function(e){return(e[TradingView.HIGH_PLOT]+e[TradingView.LOW_PLOT])/2},hlc3:function(e){return(e[TradingView.HIGH_PLOT]+e[TradingView.LOW_PLOT]+e[TradingView.CLOSE_PLOT])/3},ohlc4:function(e){return(e[TradingView.OPEN_PLOT]+e[TradingView.HIGH_PLOT]+e[TradingView.LOW_PLOT]+e[TradingView.CLOSE_PLOT])/4}}[this.m_priceSource]}function l(e,t,i){s.call(this,e,t,i),this._invaidated=!0}function d(e,t,i){s.call(this,e,t,i),this._invaidated=!0}i.prototype.update=function(){this._invalidated=!0},i.prototype._updateImpl=function(){var e=this;if(this.m_bars=[],!this.m_model.timeScale().isEmpty()&&!this.m_series.priceScale().isEmpty()){var t=this.m_model.timeScale().visibleBars();if(!t.isEmpty()&&0!==this.m_series.bars().size()){for(var i=this.m_series.nearestIndex(t.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),r=this.m_series.nearestIndex(t.lastBar(),TradingView.SEARCH_NEAREST_LEFT);r>=i;i++){var n=this.m_series.bars().valueAt(i);if(void 0!==n)break}if(!(i>r)){var o,t=this.m_series.bars().range(i,r),a=(this.m_series.bars().first().close,this.m_series.priceScale()),s=a.properties().percentage.value(),l=this.m_series.barColorer(),d={};if(t.each(function(t,i){if(void 0!==i[TradingView.OPEN_PLOT]&&void 0!==i[TradingView.HIGH_PLOT]&&void 0!==i[TradingView.LOW_PLOT]&&void 0!==i[TradingView.CLOSE_PLOT]){void 0===o&&(o=i[TradingView.CLOSE_PLOT]);var r={};r.time=Math.round(t),s?(r.open=100*(i[TradingView.OPEN_PLOT]-o)/o,r.high=100*(i[TradingView.HIGH_PLOT]-o)/o,r.low=100*(i[TradingView.LOW_PLOT]-o)/o,r.close=100*(i[TradingView.CLOSE_PLOT]-o)/o):(r.open=i[TradingView.OPEN_PLOT],r.high=i[TradingView.HIGH_PLOT],r.low=i[TradingView.LOW_PLOT],r.close=i[TradingView.CLOSE_PLOT]),d.value=i;var n;n=i[TradingView.STYLE_PLOT]?i[TradingView.STYLE_PLOT]:l.barStyle(t,!1,d),i[TradingView.STYLE_PLOT]=n,d.previousValue=i,r.color=n.barColor,r.borderColor=n.barBorderColor,r.wickColor=n.barWickColor,r.hollow=n.isBarHollow,e.m_bars.push(r)}},this),a.barPricesToCoordinates(this.m_bars),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_series===this.m_model.selectedSource()){var h=TradingView.selectionIndexes(i,r);this._selectionData={points:[]},this._selectionData.hittestResult=TradingView.HitTestResult.REGULAR;for(var p=0;p<h.length;p++){var c=h[p],u=this.m_series.bars().valueAt(c);if(u){var _=.5*(u[TradingView.OPEN_PLOT]+u[TradingView.CLOSE_PLOT]);a.properties().percentage.value()&&(_=100*(_-o)/o);var f=this.m_model.timeScale().indexToCoordinate(c),g=this.m_series.priceScale().priceToCoordinate(_);this._selectionData.points.push(new MathEx.Point(f,g))}}}}}}},i.prototype.items=function(){return this.m_bars},i.prototype.dump=function(){var e={};return e.bars=this.m_bars,e},inherit(r,i),r.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value();var t=new TradingView.CompositeRenderer;return t.append(new Z54(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(n,i),n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.drawWick=this.m_series.properties().candleStyle.drawWick.value(),e.drawBorder=this.m_series.properties().candleStyle.drawBorder.value(),e.borderColor=this.m_series.properties().candleStyle.borderColor.value(),e.wickColor=this.m_series.properties().candleStyle.wickColor.value();var t=new TradingView.CompositeRenderer;return t.append(new Z55(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(o,i),o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.drawWick=this.m_series.properties().haStyle.drawWick.value(),e.drawBorder=this.m_series.properties().haStyle.drawBorder.value(),e.borderColor=this.m_series.properties().haStyle.borderColor.value(),e.wickColor=this.m_series.properties().haStyle.wickColor.value();var t=new TradingView.CompositeRenderer;return t.append(new Z55(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(a,i),a.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing(),e.drawWick=this.m_series.properties().hollowCandleStyle.drawWick.value(),e.drawBorder=this.m_series.properties().hollowCandleStyle.drawBorder.value(),e.borderColor=this.m_series.properties().hollowCandleStyle.borderColor.value(),e.wickColor=this.m_series.properties().hollowCandleStyle.wickColor.value();var t=new TradingView.CompositeRenderer;return t.append(new Z55(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},s.prototype.update=function(){if(this.m_items=[],!this.m_model.timeScale().isEmpty()&&this.m_series.priceScale()&&!this.m_series.priceScale().isEmpty()){var e=this.m_model.timeScale().visibleBars();if(!e.isEmpty()&&0!==this.m_series.bars().size()){var t=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),i=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT);e=this.m_series.bars().range(t,i);for(var r,n=(this.m_series.bars(),this),o=n.m_series.priceScale(),a=(this.m_series.barColorer(),{color:this.m_series.properties().lineStyle.color.value()}),s=o.properties().percentage.value(),l=e._start;l<e._end;++l){var d=e._indexAt(l),h=e._valueAt(l),p=this._barGetter(h);if(void 0!==p&&null!==p){void 0===r&&(r=p),s&&(p=100*(p-r)/r);var c=new MathEx.Point(d,p);c.style=a,n.m_items.push(c)}}if(o.pointsArrayToCoordinates(n.m_items),n.m_model.timeScale().indexesToCoordinates(n.m_items),this.m_series===this.m_model.selectedSource()){var u=TradingView.selectionIndexes(t,i);this._selectionData={points:[]},this._selectionData.hittestResult=TradingView.HitTestResult.REGULAR;for(var l=0;l<u.length;l++){var d=u[l],_=this.m_series.data().valueAt(d),p=this._barGetter(_);o.properties().percentage.value()&&(p=100*(p-r)/r);var f=this.m_model.timeScale().indexToCoordinate(d),g=this.m_series.priceScale().priceToCoordinate(p);this._selectionData.points.push(new MathEx.Point(f,g))}}}}},inherit(l,s),l.prototype.update=function(){this._invalidated=!0},l.prototype.renderer=function(){this._invalidated&&(s.prototype.update.call(this),this._invalidated=!1);var e,t=this.m_series.properties().lineStyle,i={barSpacing:this.m_model.timeScale().barSpacing(),items:this.m_items,lineColor:t.color.value(),lineStyle:t.linestyle.value(),withMarkers:t.styleType.value()===TradingView.Series.STYLE_LINE_TYPE_MARKERS,withSteps:t.styleType.value()===TradingView.Series.STYLE_LINE_TYPE_STEP,lineWidth:t.linewidth.value(),simpleMode:!0},r=new Z66(i);return this.m_series===this.m_model.selectedSource()?(e=new TradingView.CompositeRenderer,e.append(r),e.append(new TradingView.SelectionRenderer(this._selectionData))):e=r,e},inherit(d,s),d.prototype.update=function(){this._invalidated=!0},d.prototype.renderer=function(){this._invalidated&&(s.prototype.update.call(this),this._invalidated=!1);var e={};e.simpleMode=!1,e.barSpacing=this.m_model.timeScale().barSpacing(),e.items=this.m_items,e.lineColor=this.m_series.properties().areaStyle.linecolor.value(),e.lineStyle=this.m_series.properties().areaStyle.linestyle.value(),e.lineWidth=this.m_series.properties().areaStyle.linewidth.value();var t=this.m_series.properties().areaStyle.transparency.value();e.isSeries=!0,e.color1=TradingView.generateColor(this.m_series.properties().areaStyle.color1.value(),t),e.color2=TradingView.generateColor(this.m_series.properties().areaStyle.color2.value(),t),e.bottom=this.m_series.priceScale().height();var i=new TradingView.CompositeRenderer;return i.append(new Z51(e)),this.m_series===this.m_model.selectedSource()&&i.append(new TradingView.SelectionRenderer(this._selectionData)),i},t.SeriesBarsPaneView=r,t.SeriesCandlesPaneView=n,t.SeriesHollowCandlesPaneView=a,t.SeriesLinePaneView=l,t.SeriesAreaPaneView=d,t.SeriesHeikenAshiPaneView=o},function(e,t){"use strict";function i(e,t){this.m_series=e,this.m_model=t,this.m_bars=[],this._invalidated=!0}function r(e,t){i.call(this,e,t)}function n(e,t){i.call(this,e,t)}function o(e,t){r.call(this,e,t)}function a(e,t){n.call(this,e,t)}function s(e,t){r.call(this,e,t)}function l(e,t){n.call(this,e,t)}function d(e,t){r.call(this,e,t)}function h(e,t){n.call(this,e,t)}function p(e,t){r.call(this,e,t)}function c(e,t){n.call(this,e,t)}i.prototype.bars=function(){throw"unimplemented"},i.prototype.isProjection=function(){throw"unimplemented"},i.prototype.update=function(){this._invalidated=!0},i.prototype.nearestIndex=function(e,t){if(!TradingView.isInteger(e))return void TradingView.logDebugChart("incorrect logicalPoint");var i=this.bars().search(e,t);return i?i.index:void 0},i.prototype._updateImpl=function(){var e=this;if(this.m_bars.length=0,(this.m_series.properties().style.value()!=TradingView.Series.STYLE_PNF||this.m_series.data().boxSize)&&!this.m_model.timeScale().isEmpty()&&!this.m_series.priceScale().isEmpty()){var t=this.m_series.getRealVisibleRange();if(t&&0!==this.bars().size()){for(var i=t.m_firstBar,r=t.m_lastBar,n=this.m_series.data().search(i).value[TradingView.CLOSE_PLOT];r>=i;i++){var o=this.bars().valueAt(i);if(void 0!==o)break}if(!(i>r)){var t=this.bars().range(i,r),a=this.m_series.priceScale(),s=this.m_series.barColorer(),l={},d=e.m_series.properties().style.value(),h=d===TradingView.Series.STYLE_KAGI||d===TradingView.Series.STYLE_PNF,p=e.isProjection(),c=+e.m_series.data().bars().last();if(t.each(function(t,i){if(void 0!==i[TradingView.OPEN_PLOT]&&void 0!==i[TradingView.HIGH_PLOT]&&void 0!==i[TradingView.LOW_PLOT]&&void 0!==i[TradingView.CLOSE_PLOT]){var r={},o={O:i[TradingView.OPEN_PLOT],H:i[TradingView.HIGH_PLOT],L:i[TradingView.LOW_PLOT],C:i[TradingView.CLOSE_PLOT],Adt:h?i[TradingView.ADT_PLOT]:void 0};if(a.properties().percentage.value())for(var u in o)o[u]=100*(o[u]-n)/n;r.time=Math.round(t),r.open=o.O,r.high=o.H,r.low=o.L,r.close=o.C,l.value=i;var _=s.barStyle(t,p,l);switch(l.previousValue=i,r.color=_.barColor,r.borderColor=_.barBorderColor,r.isUp=_.isBarUp,d){case TradingView.Series.STYLE_PNF:r.low-=.5*e.m_series.data().boxSize,r.high+=.5*e.m_series.data().boxSize,r.additionalNum=Math.round(1+(i[TradingView.HIGH_PLOT]-i[TradingView.LOW_PLOT])/e.m_series.data().boxSize);break;case TradingView.Series.STYLE_KAGI:if(r.upColor=_.upColor,r.downColor=_.downColor,r.isTwoColorBar=_.isTwoColorBar,!isNumber(o.Adt))break;r.additionalPrice=o.Adt,p&&r.time==c&&(r.combinedWithProjection=!0)}e.m_bars.push(r)}},this),d==TradingView.Series.STYLE_PNF)if(a.properties().percentage.value()){var u=100*(500-n)/n,_=100*(0-n)/n;this.blockSize=(a.priceToCoordinate(_)-a.priceToCoordinate(u))/500*this.m_series.data().boxSize}else this.blockSize=(a.priceToCoordinate(0)-a.priceToCoordinate(500))/500*this.m_series.data().boxSize;if(a.barPricesToCoordinates(this.m_bars),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_series===this.m_model.selectedSource()){var f=TradingView.selectionIndexes(i,r);this._selectionData={points:[]},this._selectionData.hittestResult=TradingView.HitTestResult.REGULAR;for(var g=0;g<f.length;g++){var v=f[g],m=this.m_series.bars().valueAt(v);if(m){var y=.5*(m[TradingView.OPEN_PLOT]+m[TradingView.CLOSE_PLOT]);a.properties().percentage.value()&&(y=100*(y-n)/n);var w=this.m_model.timeScale().indexToCoordinate(v),T=this.m_series.priceScale().priceToCoordinate(y);this._selectionData.points.push(new MathEx.Point(w,T))}}}}}}},i.prototype.items=function(){return this.m_bars},i.prototype.dump=function(){var e={};return e.bars=this.m_bars,e},inherit(r,i),r.prototype.bars=function(){return this.m_series.bars()},r.prototype.isProjection=function(){return!1},inherit(n,i),n.prototype.bars=function(){return this.m_series.nsBars()},n.prototype.isProjection=function(){return!0},inherit(o,r),o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barWidth=this.m_model.timeScale().barSpacing();var t=new TradingView.CompositeRenderer;return t.append(new Z68(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(a,n),a.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};return e.bars=this.m_bars,e.barWidth=this.m_model.timeScale().barSpacing(),new Z68(e)},inherit(s,r),s.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barWidth=.9*this.m_model.timeScale().barSpacing();var t=new TradingView.CompositeRenderer;return t.append(new Z68(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(l,n),l.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};return e.bars=this.m_bars,e.barWidth=.9*this.m_model.timeScale().barSpacing(),new Z68(e)},inherit(d,r),d.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.barSpacing=this.m_model.timeScale().barSpacing();var t=new TradingView.CompositeRenderer;return t.append(new Z65(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(h,n),h.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};return e.bars=this.m_bars,e.upColor=this.upColor,e.downColor=this.downColor,e.barSpacing=this.m_model.timeScale().barSpacing(),new Z65(e)},inherit(p,r),p.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};e.bars=this.m_bars,e.blockSize=this.blockSize,e.barSpacing=this.m_model.timeScale().barSpacing();var t=new TradingView.CompositeRenderer;return t.append(new Z67(e)),this.m_series===this.m_model.selectedSource()&&t.append(new TradingView.SelectionRenderer(this._selectionData)),t},inherit(c,n),c.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};return e.bars=this.m_bars,e.blockSize=this.blockSize,e.barSpacing=this.m_model.timeScale().barSpacing(),new Z67(e)},t.SeriesRenkoPaneView=o,t.SeriesProjectionRenkoPaneView=a,t.SeriesPriceBreakPaneView=s,t.SeriesProjectionPriceBreakPaneView=l,t.SeriesKagiPaneView=d,t.SeriesProjectionKagiPaneView=h,t.SeriesPnFPaneView=p,t.SeriesProjectionPnFPaneView=c},function(e,t){"use strict";function i(e,t){return null===e||TradingView.isInteger(e)?null===t||TradingView.isInteger(t)?(this.m_firstBar=e,void(this.m_lastBar=t)):void TradingView.logDebugChart("BarsRange: incorrect lastBar"):void TradingView.logDebugChart("BarsRange: incorrect firstBar")}i.prototype.isEmpty=function(){return null===this.m_firstBar||null===this.m_lastBar},i.prototype.clone=function(){return new i(this.m_firstBar,this.m_lastBar)},i.prototype.firstBar=function(){return this.m_firstBar},i.prototype.lastBar=function(){return this.m_lastBar},i.prototype.count=function(){return this.m_lastBar-this.m_firstBar+1},i.prototype.resizeRight=function(e){return!TradingView.isInteger(e)||0>e?void TradingView.logDebugChart("BarsRange: incorrect newWidth"):void(this.m_firstBar=this.m_lastBar-e+1)},i.prototype.shift=function(e){return isNumber(e)?(this.m_firstBar=Math.round(this.m_firstBar+e),void(this.m_lastBar=Math.round(this.m_lastBar+e))):void TradingView.logDebugChart("BarsRange.shift: incorrect coeff")},i.prototype.contains=function(e){return this.m_firstBar<=e&&this.m_lastBar>=e},e.exports=i},function(e,t){"use strict";function i(){this.backColorers=[]}function r(e){i.call(this),this._series=e}function n(e,t){i.call(this),this.Z99=e,this._plotIndex=t}i.prototype.barStyle=function(e,t,i){for(var r={},n=this.backColorers.length-1;n>=0;n--)this.backColorers[n].applyBarStyle(e,t,r,i);return this.applyBarStyle(e,t,r,i),r},i.prototype.pushBackBarColorer=function(e){this.backColorers.push(e)},i.prototype.applyBarStyle=function(e,t,i){throw Error("This function is supposed to be reimplemented in a subclass")},inherit(r,i),r.prototype.applyBarStyle=function(e,t,i,r){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;var n=this._series.properties();switch(n.style.value()){case TradingView.Series.STYLE_LINE:i.barColor=n.lineStyle.color.value();break;case TradingView.Series.STYLE_AREA:i.barColor=n.areaStyle.linecolor.value();break;case TradingView.Series.STYLE_BARS:var o=n.barStyle.upColor.value(),a=n.barStyle.downColor.value(),s=o,l=a,d=this.findBar(e,!1,r);if(n.barStyle.barColorsOnPrevClose.value()){var h=this.findPrevBar(e,!1,r);i.barColor=h[TradingView.CLOSE_PLOT]<=d[TradingView.CLOSE_PLOT]?o:a,i.barBorderColor=h[TradingView.CLOSE_PLOT]<=d[TradingView.CLOSE_PLOT]?s:l}else i.barColor=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT]?o:a,i.barBorderColor=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT]?s:l;break;case TradingView.Series.STYLE_CANDLES:var p,o=n.candleStyle.upColor.value(),a=n.candleStyle.downColor.value(),s=n.candleStyle.borderUpColor?n.candleStyle.borderUpColor.value():n.candleStyle.borderColor.value(),l=n.candleStyle.borderDownColor?n.candleStyle.borderDownColor.value():n.candleStyle.borderColor.value(),c=n.candleStyle.wickUpColor?n.candleStyle.wickUpColor.value():n.candleStyle.wickColor.value(),u=n.candleStyle.wickDownColor?n.candleStyle.wickDownColor.value():n.candleStyle.wickColor.value(),d=this.findBar(e,!1,r);if(n.candleStyle.barColorsOnPrevClose.value()){var h=this.findPrevBar(e,!1,r);p=h[TradingView.CLOSE_PLOT]<=d[TradingView.CLOSE_PLOT]}else p=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT];i.barColor=p?o:a,i.barBorderColor=p?s:l,i.barWickColor=p?c:u;break;case TradingView.Series.STYLE_HOLLOW_CANDLES:var o=n.hollowCandleStyle.upColor.value(),a=n.hollowCandleStyle.downColor.value(),s=n.hollowCandleStyle.borderUpColor?n.hollowCandleStyle.borderUpColor.value():n.hollowCandleStyle.borderColor.value(),l=n.hollowCandleStyle.borderDownColor?n.hollowCandleStyle.borderDownColor.value():n.hollowCandleStyle.borderColor.value(),c=n.hollowCandleStyle.wickUpColor?n.hollowCandleStyle.wickUpColor.value():n.hollowCandleStyle.wickColor.value(),u=n.hollowCandleStyle.wickDownColor?n.hollowCandleStyle.wickDownColor.value():n.hollowCandleStyle.wickColor.value(),d=this.findBar(e,!1,r),h=this.findPrevBar(e,!1,r);h[TradingView.CLOSE_PLOT]<=d[TradingView.CLOSE_PLOT]?(i.barColor=o,i.barBorderColor=s,i.barWickColor=c):(i.barColor=a,i.barBorderColor=l,i.barWickColor=u),d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT]?i.isBarHollow=!0:i.isBarHollow=!1;break;case TradingView.Series.STYLE_HEIKEN_ASHI:var p,o=n.haStyle.upColor.value(),a=n.haStyle.downColor.value(),s=n.haStyle.borderUpColor.value(),l=n.haStyle.borderDownColor.value(),c=n.haStyle.wickUpColor.value(),u=n.haStyle.wickDownColor.value(),d=this.findBar(e,t,r);if(n.haStyle.barColorsOnPrevClose.value()){var h=this.findPrevBar(e,t,r);p=h[TradingView.CLOSE_PLOT]<=d[TradingView.CLOSE_PLOT]}else p=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT];i.barColor=p?o:a,i.barBorderColor=p?s:l,i.barWickColor=p?c:u;break;case TradingView.Series.STYLE_RENKO:var d=this.findBar(e,t,r),p=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT],o=t?n.renkoStyle.upColorProjection.value():n.renkoStyle.upColor.value(),a=t?n.renkoStyle.downColorProjection.value():n.renkoStyle.downColor.value(),s=t?n.renkoStyle.borderUpColorProjection.value():n.renkoStyle.borderUpColor.value(),l=t?n.renkoStyle.borderDownColorProjection.value():n.renkoStyle.borderDownColor.value();i.barColor=p?o:a,i.barBorderColor=p?s:l,i.isBarUp=p;break;case TradingView.Series.STYLE_PB:var d=this.findBar(e,t,r),p=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT],o=t?n.pbStyle.upColorProjection.value():n.pbStyle.upColor.value(),a=t?n.pbStyle.downColorProjection.value():n.pbStyle.downColor.value(),s=t?n.pbStyle.borderUpColorProjection.value():n.pbStyle.borderUpColor.value(),l=t?n.pbStyle.borderDownColorProjection.value():n.pbStyle.borderDownColor.value();i.barColor=p?o:a,i.barBorderColor=p?s:l,i.isBarUp=p;break;case TradingView.Series.STYLE_KAGI:i.upColor=t?n.kagiStyle.upColorProjection.value():n.kagiStyle.upColor.value(),i.downColor=t?n.kagiStyle.downColorProjection.value():n.kagiStyle.downColor.value();var _=null,d=this.findBar(e,t,r);d[TradingView.LOW_PLOT]<d[TradingView.ADT_PLOT]&&d[TradingView.ADT_PLOT]<d[TradingView.HIGH_PLOT]?(_=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT],i.isTwoColorBar=!0):(_=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT]?d[TradingView.OPEN_PLOT]==d[TradingView.ADT_PLOT]:d[TradingView.OPEN_PLOT]!=d[TradingView.ADT_PLOT],i.isTwoColorBar=!1),i.barColor=_?i.upColor:i.downColor,i.isBarUp=d[TradingView.OPEN_PLOT]<=d[TradingView.CLOSE_PLOT];break;case TradingView.Series.STYLE_PNF:var d=this.findBar(e,t,r),p=d[TradingView.ADT_PLOT]>0,o=t?n.pnfStyle.upColorProjection.value():n.pnfStyle.upColor.value(),a=t?n.pnfStyle.downColorProjection.value():n.pnfStyle.downColor.value();i.isBarUp=p,i.barColor=p?o:a}return i},r.prototype.getSeriesBars=function(e){return e?this._series.nsBars():this._series.bars()},r.prototype._findBarFieldValue=function(e,t,i){var r=this.getSeriesBars(i).valueAt(e);return void 0!==r?r[t]:void 0},r.prototype.findBar=function(e,t,i){return i?i.value:this.getSeriesBars(t).valueAt(e)||[]},r.prototype.findPrevBar=function(e,t,i){if(i&&i.previousValue)return i.previousValue;var r=this._series.bars(),n=r._search(e,TradingView.SEARCH_EXACT);return n>0?this._series.bars()._valueAt(n-1):[]},inherit(n,i),n.prototype.applyBarStyle=function(e,t,i){if(i||(i={}),t)return i;var r=this.Z99.properties();if(!r.visible.value())return i;var n=this.Z99.metaInfo(),o=this.Z99.data();if(!o||0===o.size())return i;var a=n.plots[this._plotIndex],s=r.styles[a.id];if(s.visible&&!s.visible.value())return i;var l=this.Z99.offset(a.id),d=o.valueAt(e-l);if(!d)return i;var h=d[this._plotIndex+1];if(null==h)return i;h=Math.round(h);var p=n.plots[this._plotIndex].palette,c=r.palettes,u=c[p],_=n.palettes[p].valToIndex?n.palettes[p].valToIndex[h]:h,f=u.colors[_].color.value();return i.barColor=f,i.upColor=f.color,i.downColor=f.color,i},t.SeriesBarColorer=r,t.StudyBarColorer=n},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){l.call(this,e,t),this._rendererCache={}}function o(e,t){this.Z97=e,this.Z98=t,this._text="",this._coordinate=0,this._background="black",this._color="white",this._invaildated=!0}function a(e,t){this._constructor="LineToolHorzLine";var i=t?t:new J50("linetoolhorzline");this._priceAxisView=new o(this,e),s.call(this,e,new n(this,e),i)}var s=i(13).LineDataSource,l=i(44),d=i(14),h=i(15),p=i(45).TextRenderer;r.prototype.draw=function(e){if(0===this._data.points.length)return null;if(this._data.visible!==!1){var t=this._data.points[0].y,i=e.canvas.width;e.lineCap="square",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle,CanvasEx.drawLine(e,0,t,i,t)}},r.prototype.hitTest=function(e){if(this._data.visible===!1)return null;if(0===this._data.points.length)return null;var t=3;return Math.abs(e.y-this._data.points[0].y)<=t?new TradingView.HitTestResult(this._data.hitTestResult):null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this)},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer,t={};t.points=this._points,t.color=this.Z97.properties().linecolor.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.linestyle=this.Z97.properties().linestyle.value(),t.hitTestResult=TradingView.HitTestResult.MOVEPOINT;var i=this.Z97.properties();if(e.append(new r(t)),this.Z97.properties().showLabel.value()&&1==this._points.length){var n=i.vertLabelsAlign.value(),o=i.horzLabelsAlign.value(),a=this._points[0],s=0,l=0;"left"==o?a.x=3:"right"==o?(a.x=this.Z98.timeScale().width(),l=-5):a.x=this.Z98.timeScale().width()/2,"middle"==n?s=-this.Z97.properties().fontsize.value()/6:"bottom"==n&&(s=-4);var d={points:[a],text:i.text.value(),color:i.textcolor.value(),vertAlign:n,horzAlign:o,font:i.font.value(),offsetX:l,offsetY:s,bold:this.Z97.properties().bold.value(),italic:this.Z97.properties().italic.value(),fontsize:this.Z97.properties().fontsize.value()};e.append(new p(d,this._rendererCache))}if(1==this._points.length&&this.isAnchorsRequired()){var h=new MathEx.Point(this.Z98.timeScale().width()/2,this._points[0].y);h.data=0,e.append(this.createLineAnchor({points:[h]}))}if(!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&1==this._points.length){var c=new MathEx.Point(this.Z98.timeScale().width()/2,this._points[0].y);this.Z97.getAlertIsActive(function(i){e.append(new TradingView.PaneRendererClockIcon({point1:c,color:i?t.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))})}return e},inherit(o,d),o.prototype.update=function(){this._invaildated=!0},o.prototype.updateImpl=function(){if(0!==this.Z97.points().length&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()){var e=this.Z97.properties().linecolor.value();e!=this._background&&(this._background=e,this._color=this.color());var t=this.Z97.points()[0].price;if(this.Z97.priceScale().isPercent()){var i=this.Z97.ownerSource().firstValue();if(null===i)return;t=this.Z97.priceScale().priceRange().convertToPercent(t,i)}this._floatCoordinate=this.Z97.priceScale().priceToCoordinate(t,!0),this._coordinate=Math.round(this._floatCoordinate),this.Z97.priceScale().formatter()&&(this._text=this.Z97.priceScale().formatter().format(t))}},o.prototype.renderer=function(){this._invaildated&&(this.updateImpl(),this._invaildated=!1);var e={text:this._text,coordinate:this._coordinate,color:this._color,background:this._background,visible:!0};return new h(e)},o.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),d.prototype.coordinate.call(this)},inherit(a,s),a.prototype.pointsCount=function(){return 1},a.prototype.title=function(){return"Horizontal Line"},a.prototype.priceAxisViews=function(e,t){return this.isActualSymbol()&&t===this.priceScale()&&this.properties().showPrice.value()&&this.Z98.paneForSource(this)===e?[this._priceAxisView]:null},a.prototype.updateAllViews=function(){s.prototype.updateAllViews.call(this),this._priceAxisView.update()},a.prototype.canHasAlert=function(){return!0},a.prototype._getAlertPlots=function(){return[this.points()[0].price]},t.HorzLineRenderer=r,t.LineToolHorzLine=a},function(e,t){"use strict";function i(e,t){this.Z97=e,this.Z98=t,
this._points=[],this._floatPoints=[]}i.prototype.priceToCoordinate=function(e){var t=this.Z97.priceScale();if(t.isPercent()){var i=this.Z97.ownerSource().firstValue();e=t.priceRange().convertToPercent(e,i)}return t.priceToCoordinate(e)},i.prototype.addAnchors=function(e){if(this.isAnchorsRequired()){var t=this._points;this.Z98.lineBeingCreated()==this.Z97&&(t=t.slice(0,-1)),e.append(this.createLineAnchor({points:t}))}},i.prototype.update=function(){this._points=[];var e=this.Z97.priceScale(),t=this.Z98.timeScale();if(e&&!e.isEmpty()&&!t.isEmpty()){this._floatPoints=[];for(var i=this.Z97.points(),r=0;r<i.length;r++){var n=i[r],o=this.Z97.pointToScreenPoint(n);if(!o)return;var a=o[0];a.data=r;var s=o[1];s.data=r,this._floatPoints.push(a),this._points.push(s)}}},i.prototype.currentPoint=function(){var e=this.Z98.crossHairSource();return new MathEx.Point(e.x,e.y)},i.prototype.anchorColor=function(){return this.Z97.isBeingEdited()?"#D61AD3":this.Z98.isDark()?"#FFFFFF":"#606060"},i.prototype.isHoveredSource=function(){return this.Z97===this.Z98.hoveredSource()},i.prototype.isSelectedSource=function(){return this.Z97===this.Z98.selectedSource()},i.prototype.isAnchorsRequired=function(){return(this.isHoveredSource()||this.isSelectedSource())&&!this.Z98.isSnapshot()},i.prototype.createLineAnchor=function(e){return new TradingView.LineAnchor($.extend({color:this.anchorColor(),backgroundColor:this.Z98.backgroundColor(),currentPoint:this.currentPoint(),linePointBeingEdited:this.Z98.linePointBeingEdited(),hittestResult:TradingView.HitTestResult.CHANGEPOINT,radius:(TradingView.isMobile.any()?15:7)+(this.isSelectedSource()?1:0),strokeWidth:(TradingView.isMobile.any()?3:1)+(this.isSelectedSource()?1:0)},e))},e.exports=i},function(e,t,i){"use strict";function r(e,t,i){this._textSizeCache=t,this._data=e,this._fontSize=e.fontsize?e.fontsize:e.fontSize?e.fontSize:20,e.lines=this._lines=this.wordWrap(e.text,e.wordWrapWidth),this._hittest=i?i:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}function n(e,t,i,r,n,o){s.call(this,e,t),this._offsetX=i,this._offsetY=r,this._vertAlign=n,this._horzAlign=o,this._rendererCache={},this._renderer=null,this._invalidated=!0}function o(e,t){this._constructor="LineToolText";var i=t?t:new J50("linetooltext");l.call(this,e,new n(this,e),i),this._timeScale=e.timeScale(),this._barSpacing=e.timeScale().barSpacing()}function a(e,t){var i=t?t:new J50("linetooltextabsolute");i.locked.value()||i.locked.setValue(!0),o.call(this,e,i)}var s=i(44),l=i(13).LineDataSource,d=i(18).DataSource;!function(){function e(){var e=document.createElement("canvas");e.width=0,e.height=0,t=e.getContext("2d"),e=null}var t;r.prototype.setPoints=function(e,t){this._data.points=e,this._hittest=t?t:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)},r.prototype._calcLinesWidths=function(){t||e(),t.textBaseline="alphabetic",t.font=this.fontStyle();var i,r=[];if(this._data.wordWrapWidth){i=this._data.wordWrapWidth;for(var n=0;n<this._lines.length;n++)r.push(this._data.wordWrapWidth)}else{i=0;for(var n=0;n<this._lines.length;n++){var o=t.measureText(this._lines[n]).width;r.push(o),i=Math.max(i,o)}}return{widths:r,maxWidth:i}},r.prototype.measure=function(){var e=this._fontSize,t=this._calcLinesWidths().maxWidth,i=e*this._lines.length,r=~~(e/6);return this._data.backgroundHorzInflate&&(t+=2*this._data.backgroundHorzInflate),this._data.backgroundVertInflate&&(i+=2*this._data.backgroundVertInflate),t=Math.ceil(t+2*r),i=Math.ceil(i+2*r),t%2!==0&&t++,this._data.padding&&(i+=this._data.padding),{width:t,height:i,textBgPadding:r}},r.prototype.wordWrap=function(i,r,n){t||e(),r=+r,i+="";var o=i.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);if(o[o.length-1]||o.pop(),!isFinite(r)||0>=r)return o;t.font=n||this.fontStyle();for(var a=[],s=0;s<o.length;s++){var l=o[s],d=t.measureText(l).width;if(r>=d)a.push(l);else for(var h=l.split(/([-\)\]\},.!?:;])|(\s+)/);h.length;){var p=~~(r/d*(h.length+2)/3);if(0>=p||t.measureText(h.slice(0,3*p-1).join("")).width<=r)for(;t.measureText(h.slice(0,3*(p+1)-1).join("")).width<=r;)p++;else for(;p>0&&t.measureText(h.slice(0,3*--p-1).join("")).width>r;);if(p>0)a.push(h.slice(0,3*p-1).join("")),h.splice(0,3*p);else{var c=h[0]+(h[1]||""),u=1===u?1:~~(r/t.measureText(c)*c.length);if(t.measureText(c.substr(0,u)).width<=r)for(;t.measureText(c.substr(0,u+1)).width<=r;)u++;else for(;u>1&&t.measureText(c.substr(0,--u)).width>r;);1>u&&(u=1),a.push(c.substr(0,u)),h[0]=c.substr(u),h[1]=""}var d=t.measureText(h.join("")).width;if(r>=d){a.push(h.join(""));break}}}return a}}(),r.prototype._x=function(){var e=this._data.points[0].x+this._data.offsetX;return e},r.prototype._y=function(){var e=this._fontSize*this._lines.length;this._data.scaleY&&(e*=this._data.scaleY);var t=this._data.points[0].y+this._data.offsetY+e;switch(this._data.vertAlign){case"top":break;case"bottom":t-=e;break;case"middle":t-=e/2}return t},r.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._fontSize+"px "+this._data.font},r.prototype.draw=function(e){if(0!==this._data.points.length){var t=this._x(),i=this._y(),r=this._fontSize;switch(this._data.scaleY&&(r*=this._data.scaleY),i-=r*(this._lines.length-1),e.textBaseline="alphabetic",e.font=this.fontStyle(),this._data.horzAlign){case"left":e.textAlign="start";break;case"right":e.textAlign="end";break;case"center":e.textAlign="center"}e.translate(t+.5,i+.5),t=0,i=0;var r=this._fontSize;if(this._data.scaleX&&this._data.scaleY){var n=Math.min(this._data.scaleX,this._data.scaleY);e.scale(n,n)}var o=this._calcLinesWidths(),a=o.maxWidth,s=0;if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){var l=t;switch(this._data.horzAlign){case"left":break;case"right":l-=a;break;case"center":l-=a/2}var d=r*this._lines.length,h=~~(r/6);this._data.backgroundHorzInflate&&(a+=2*this._data.backgroundHorzInflate,l-=this._data.backgroundHorzInflate),this._data.backgroundVertInflate&&(d+=2*this._data.backgroundVertInflate,i+=this._data.backgroundVertInflate);var p={x:Math.floor(l-h),y:Math.floor(i-r),w:Math.ceil(a+2*h),h:Math.ceil(d+2*h)};if(p.w%2!==0&&p.w++,this._data.padding&&(p.h+=this._data.padding,s=this._data.padding),this._data.backgroundVertInflate&&(i+=this._data.backgroundVertInflate),this._data.backgroundRoundRect){if(e.roundRect(p.x,p.y,p.w,p.h,this._data.backgroundRoundRect),this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.fill()),this._data.borderColor){var c=~~Math.max(r/12,1);e.strokeStyle=this._data.borderColor,e.lineWidth=c,e.stroke()}}else if(this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.fillRect(p.x,p.y,p.w,p.h)),this._data.borderColor){var c=~~Math.max(r/12,1);e.strokeStyle=this._data.borderColor,e.lineWidth=c,e.strokeRect(p.x-c/2,p.y-c/2,p.w+c,p.h+c)}else if(this._data.highlightBorder){e.strokeStyle=this._data.color,e.lineWidth=1,e.beginPath();var u,_,f=[3,1];e.dashedLineTo(p.x-.5,_=p.y-.5,u=p.x+p.w+.5,_,f),e.dashedLineTo(u,_,u,_=p.y+p.h+.5,f),e.dashedLineTo(u=p.x-.5,_,p.x+p.w+.5,_,f),e.dashedLineTo(u,p.y-.5,u,_,f),e.stroke()}}this._data.backgroundVertInflate&&!this._data.backgroundColor&&(i+=2*this._data.backgroundVertInflate),e.fillStyle=this._data.color;for(var g=0;g<this._lines.length;g++)e.fillText(this._lines[g],t,i),i+=r+s;this._textSizeCache&&(this._textSizeCache.widths=o.widths)}},r.prototype.hitTest=function(e){if(0===this._data.points.length)return null;var t=this._fontSize;this._data.scaleY&&(t*=this._data.scaleY);var i=this._textSizeCache.widths;if(!i)return null;for(var r=0,n=0;n<i.length;n++)r=Math.max(r,i[n]);this._data.scaleX&&(r*=this._data.scaleX);var o=this._data.points[0].x+this._data.offsetX,a=this._data.points[0].y+this._data.offsetY;"bottom"==this._data.vertAlign&&(a-=this._lines.length*this._fontSize),"middle"==this._data.vertAlign&&(a-=this._lines.length*this._fontSize/2),"right"==this._data.horzAlign?o-=r:"center"==this._data.horzAlign&&(o-=r/2);var s=this._data.backgroundColor||this._data.borderColor?~~(t/6):0,l=this._data.borderColor?~~Math.max(t/12,1):0;return e.x>=o-s-l&&e.x<=o+r+s+l&&e.y>=a-l&&e.y<=a+this._lines.length*this._fontSize+2*s+l?this._hittest:null},inherit(n,s),n.prototype.update=function(){this._renderer=null,this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){if(this._invalidated&&this.updateImpl(),this._renderer)return this._renderer;var e=this.Z97.priceScale();if(!e||e.isEmpty())return this._renderer=new TradingView.CompositeRenderer,this._renderer;var t={},i=this.Z97.properties(),n=i.locked&&i.locked.value();if(n?t.points=this.Z97.fixedPoints():t.points=this._points,t.text=i.text.value(),t.color=i.color.value(),t.font=i.font.value(),t.offsetX=this._offsetX?this._offsetX:0,t.offsetY=this._offsetY?this._offsetY:0,t.vertAlign=this._vertAlign?this._vertAlign:"top",t.horzAlign=this._horzAlign?this._horzAlign:"left",t.fontsize=i.fontsize.value(),i.fillBackground&&i.fillBackground.value()&&(t.backgroundColor=i.backgroundColor.value(),t.backgroundTransparency=1-i.backgroundTransparency.value()/100||0),i.drawBorder&&i.drawBorder.value()&&(t.borderColor=i.borderColor.value()),i.wordWrap&&i.wordWrap.value()&&(t.wordWrapWidth=i.wordWrapWidth.value()),t.bold=i.bold&&i.bold.value(),t.italic=i.italic&&i.italic.value(),t.highlightBorder=this.Z98.selectedSource()===this.Z97,!n&&i.fixedSize&&!i.fixedSize.value()){t.scaleX=this.Z97.Z98.timeScale().barSpacing()/this.Z97._barSpacing;var o=e.height()/e.priceRange().length();if(this.Z97._isPriceDencityLog&&!e.isLog()){var a=e.priceRange().minValue(),s=e.priceRange().maxValue();a=e._toLog(a),s=e._toLog(s);var l=s-a;o=e.height()/l}if(!this.Z97._isPriceDencityLog&&e.isLog()){var a=e.priceRange().minValue(),s=e.priceRange().maxValue();a=e._fromLog(a),s=e._fromLog(s);var l=s-a;o=e.height()/l}t.scaleY=o/this.Z97._priceDencity,(!isFinite(t.scaleY)||t.scaleY<=0)&&delete t.scaleY}var d=new r(t,this._rendererCache);if(this.isAnchorsRequired()&&1===t.points.length&&!this._noSelection){var h=t.points[0],p=new TradingView.CompositeRenderer;if(p.append(d),t.wordWrapWidth){var c=new MathEx.Point(h.x+t.wordWrapWidth+~~(t.fontsize/6),h.y+(t.lines?t.lines.length*t.fontsize/2+~~(t.fontsize/6):0));c.data=0,p.append(this.createLineAnchor({points:[c]}))}return this._renderer=p,this._renderer}return this._renderer=d,this._renderer},inherit(o,l),o.MIN_WIDTH=100,o.prototype.setPoint=function(e,t){var i,r=this.properties();if(0===e&&r.wordWrapWidth&&r.wordWrapWidth.value()){if(r.locked&&r.locked.value())var i=this.fixedPoints()[0].x;else var i=this._timeScale.indexToCoordinate(this.points()[0].index);var n=this._timeScale.indexToCoordinate(t.index)-i-~~(r.fontsize.value()/6);if(!isFinite(n))return;r.wordWrapWidth.setValue(Math.max(o.MIN_WIDTH,n))}},o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return $.t("Text")},o.prototype.setPriceScale=function(e){d.prototype.setPriceScale.call(this,e),e&&e.priceRange()&&(this._priceDencity=e.height()/e.priceRange().length(),this._isPriceDencityLog=e.isLog())},o.prototype.restoreSize=function(){this._barSpacing=this.Z98.timeScale().barSpacing(),this._priceDencity=this.priceScale().height()/this.priceScale().priceRange().length(),this.updateAllViews(),this.Z98.updateSource(this)},o.prototype.restoreTemplate=function(e){delete e.locked,delete e.text,l.prototype.restoreTemplate.call(this,e)},inherit(a,o),a.prototype.title=function(){return $.t("Anchored Text")},o.prototype.state=function(e){var t=l.prototype.state.call(this,e);return e&&(t.state.fixedSize=!1),t},t.TextRenderer=r,t.TextPaneView=n,t.LineToolText=o,t.LineToolTextAbsolute=a},function(e,t){"use strict";function i(e){this._data=e}function r(e){this._series=e,this._invalidated=!0}i.prototype.hittest=function(){},i.prototype.draw=function(e){var t,i,r=5,n=12,o=5,a=8,s=13,l=0;e.save(),e.setFont(s+"px Arial");var d=$.t("Last available bar");if(this._data.eod)l=e.measureText(d).width;else{var t=e.measureText(this._data.dateString||"").width,i=e.measureText(this._data.timeString||"").width;l=Math.max(t,i)}var h=this._data.timeString?2:1;e.fillStyle=this._data.eod?"#FF4040":"#58A3CD",e.translate(this._data.point.x+.5,this._data.point.y+.5);var p=Math.round(-l/2)-a,c=-(s+r)*h-r-n-o,u=Math.round(p+l+2*a),_=-n-o;if(e.beginPath(),e.moveTo(p,c),e.lineTo(u,c),e.lineTo(u,_),e.lineTo(n,_),e.lineTo(0,_+n),e.lineTo(-n,_),e.lineTo(p,_),e.fill(),e.fillStyle="#FFFFFF",e.textBaseline="top",this._data.eod)e.fillText(d,p+a,c+r);else{var f=p+a+(l-t)/2;if(e.fillText(this._data.dateString,f,c+r),this._data.timeString){var g=p+a+(l-i)/2;e.fillText(this._data.timeString,g,c+2*r+s)}}e.restore()},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){delete this._point,delete this._dateString,delete this._timeString,delete this._eod;var e=this._series.gotoDateResult();if(void 0!==e){var t=e.index,i=this._series.bars().valueAt(t);if(i){var r=this._series.priceScale().priceToCoordinate(i[TradingView.HIGH_PLOT]),n=this._series.model().timeScale().indexToCoordinate(t);if(this._point=new MathEx.Point(n,r),e.eod)this._eod=!0;else{var o=this._series.model().timeScale().indexToUserTime(t);this._dateString=(new TradingView.DateFormatter).format(o),this._series.isDWM()||(this._timeString=(new TradingView.TimeFormatter).format(o))}}}},r.prototype.renderer=function(){return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._point?new i({point:this._point,dateString:this._dateString,timeString:this._timeString,eod:this._eod}):new TradingView.CompositeRenderer},e.exports=r},function(e,t,i){"use strict";function r(e){this._data=e,this._textWidthCache=new o}function n(e,t,i,r,n){this.Z98=e,this.Z97=t,this._plotIndex=i,this._getterName=r?r:"symbol",this._propertyName=n,this._cache={},this._invalidated=!0,this._rendererData={}}var o=i(36);r.prototype.hitTest=function(e){return null},r.prototype.draw=function(e){if(this._data.visible){this._textWidthCache.font!==this._data.font&&(this._textWidthCache.reset(),this._textWidthCache.font=this._data.font),e.font=this._data.font;var t=this._data.fontSize,i=Math.floor(t/4.5),r=Math.ceil(t/4.5),n=Math.ceil(t/3),o=Math.ceil(this._textWidthCache.measureText(e,this._data.text)),a=Math.round(t/10),s=t+i+r,l=o+2*n,d=this._data.x-.5;"right"==this._data.align&&(d-=l);var h=this._data.y-Math.floor(t/2)-i-.5;e.fillStyle=this._data.backColor,e.fillRect(d,h,l,s),e.fillStyle=this._data.color,e.textAlign="left",e.fillText(this._data.text,d+n,h+i+t-a)}},n.prototype.isPropertyEnabled=function(){return this.Z98.properties().scalesProperties[this._propertyName].value()},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){var e=this._rendererData;if(e.visible=!1,e.text="",this.isPropertyEnabled()&&this.Z97.properties().visible.value()){var t=this.Z97.lastValueData(this._plotIndex,Z75.enabled("price_scale_always_last_bar_value"));if(!t.noData){var i=this.Z98.paneForSource(this.Z97),r="right";i.leftPriceScale()==this.Z97.priceScale()&&(r="left");var n=this.Z98.properties(),o=!i.leftPriceScale().mainSource()||!i.rightPriceScale().mainSource();if(o&&n.scalesProperties.showLeftScale.value()&&!n.scalesProperties.showRightScale.value()&&(r="left"),!o){if("left"==r&&!n.scalesProperties.showLeftScale.value())return new TradingView.CompositeRenderer;if("right"==r&&!n.scalesProperties.showRightScale.value())return new TradingView.CompositeRenderer}var a=t.coordinate;this.Z97.lastPriceLabelFixedCoordinate&&(a=this.Z97.lastPriceLabelFixedCoordinate(this._plotIndex)||a),e.visible=!0,t.color!==e.backColor&&(e.backColor=t.color,e.color=new TradingView.RGBColor(t.color).blackWhiteContrast()),e.text=this.Z97[this._getterName](this._plotIndex),e.align=r,"right"==r?e.x=this.Z98.timeScale().width():e.x=0,e.y=a,e.fontSize=this.Z98.properties().scalesProperties.fontSize.value(),e.font=TradingView.makeFont(e.fontSize,"Arial","")}}},n.prototype.renderer=function(){return this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._renderer||(this._renderer=new r(this._rendererData)),this._renderer},e.exports=n},function(e,t){"use strict";function i(e,t,i){for(var r=e.allLineTools(),n=r.length,o=e.timeScale(),a=(o.points(),0);n>a;++a){for(var s=r[a],l=0,d=s.points(),h=d.length,p=0;h>p;++p){var c=d[p];c.time>t&&c.time<=i&&(c.index=o.m_points.indexOf(c.time),++l)}l>0&&s.updateAllViews()}}function r(e,t){function r(i){e._currentRequest.requestFirstBarTime(i,a,function(r){var o=r.p[1];return o>l?(e._currentRequest.disconnect(),delete e._currentRequest,e._haveNoMoreData=!0,void t()):void n(i)})}function n(i){var r="series_id",n=1;e._haveNoMoreData=!0;var s=!1;e._currentRequest.createSeries(r,"turnaround",i,a,["bar_count",l-1,-c],function(i){switch(i.method){case"data_update":if(!i.params.plots.length)return;var r=i.params.plots[0].value[TradingView.TIME_PLOT],a=i.params.plots;e._haveNoMoreData=a.length<c,s=0===a.length,u=r==l,o.mainSeries().fixLastBar(e._chartDirection),o.mainSeries().bars().addTail(a,u);var d=o.mainSeries().parseJapProjBars(i.params.nonseries);o.mainSeries().m_data.m_nsBars=d.nsBars,o.mainSeries().m_data.lastProjectionPrice=d.lastPrice,o.model().recalculateAllPanes(),o.model().updateSource(o.mainSeries()),o.model().updateLineTools(),o.timeScale().scrollToOffsetAnimated(h);break;case"series_completed":n--,0===n&&(e._currentRequest.disconnect(),delete e._currentRequest,t())}});for(var d=o.Q17(),p={},_=function(i){var r=i.method;if("study_completed"===r||"study_error"===r)n--,0===n&&(e._currentRequest.disconnect(),delete e._currentRequest,t());else if("data_update"===r&&!s){var a=i.params.customId,l=p[a];l.m_data.addTail(i.params.plots,u),o.model().recalculateAllPanes(),o.model().updateSource(o.mainSeries())}},f=0;f<d.length;f++){var g=d[f];if(TradingView.isInherited(g.constructor,TradingView.Study)&&-1!==["Volume","Compare","Overlay","Sessions"].indexOf(g.metaInfo().shortId)){var v="study_"+f,m=g.metaInfo().id+"-1!";p[v]=g,n++;var y=g.inputs();if("Volume"===g.metaInfo().shortId&&1===y.length){var w=!1;y.push(w)}e._currentRequest.createStudy(v,"turnaround",r,m,y,_)}}}var o=e.model(),a=o.mainSeries().interval(),s=o.mainSeries().bars().last(),l=s.value[TradingView.TIME_PLOT];"function"!=typeof t&&(t=function(){});var d=100;if(null!=e._currentRequest)return void TradingView.logDebugChart("requestSnapshotBars: unexpected requestSnapshotBars");var h=o.timeScale().rightOffset();if(!(0>h||e._haveNoMoreData)){var p=o.mainSeries().getSymbolString(),c=Math.max(Math.ceil(h),d),u=!1,_=new TradingView.TVChartApi;e._currentRequest=new TradingView.ChartSession(_),e._currentRequest.connect(function(t){if("connected"===t.method){var n=o.model().timezone();n||(n=defaults("chartproperties").mainSeriesProperties.timezone),e._currentRequest.switchTimezone(n);var a="symbol_id",s=function(t){switch(t.method){case"symbol_error":if(t.params[1]==TradingView.Series.PERMISSION_DENIED){var i;switch(t.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:o.mainSeries().properties().extendedHours.setValue(!1),i=o.mainSeries().getSymbolString();break;case TradingView.Series.PD_REASON_SYMBOL:i=t.params[3];break;default:i=t.params[2]}i&&(a+="_re",e._currentRequest.resolveSymbol(a,i,s))}break;default:r(a)}};_.loadNewToken(),e._currentRequest.resolveSymbol(a,p,s)}else if("timescale_update"===t.method){var l=o.mainSeries().bars().last(),d=o.timeScale().indexToUserTime(l).valueOf()/1e3,h=o.timeScale().points(),c=h.lastTimePointIndex(),u=h.valueAt(c);if(t.params.changes.length>0){var f=t.params.changes[0]==u;f||(d+=1),o.timeScale().addTail(t,d,f);var g=h.lastTimePointIndex(),v=h.valueAt(g);i(o.model(),u,v)}}})}}function n(e,t){this._data=e,this._colors=this.getBackgroundColor(t)}function o(e,t,i){this._series=e,this._lastBar=t,this._direction=i}n.prototype.hitTest=function(){return null},n.prototype.getBackgroundColor=function(e){var t=[{background:"rgba(255, 158, 171, 0.3)",line:"#7E202F"},{background:"rgba(244, 255, 158, 0.3)",line:"#EBFF3F"},{background:"rgba(195, 255, 160, 0.3)",line:"#308020"}];return t[e+1]},n.prototype.draw=function(e){e.fillStyle=this._colors.background,e.fillRect(Math.max(0,this._data.x),0,this._data.width,this._data.height),e.strokeStyle=this._colors.line,e.beginPath(),e.lineWidth=1;var t=Math.round(this._data.x);e.moveTo(t,0),e.lineTo(t,this._data.height),e.stroke()},o.prototype.update=function(){this._x=this._series.m_model.timeScale().indexToCoordinate(this._lastBar)-.5*this._series.m_model.timeScale().barSpacing()+1},o.prototype.renderer=function(){var e={x:this._x,height:this._series.priceScale().height(),width:this._series.m_model.timeScale().width()},t=this._series.data().bars(),i=t.last().value[TradingView.CLOSE_PLOT]>t.valueAt(this._lastBar)[TradingView.CLOSE_PLOT]?1:-1,r=0;return 1==this._direction?r=i:2==this._direction&&(r=-1*i),new n(e,r)},t.J77=o,t.requestChartSnapshotBars=r},function(e,t,i){"use strict";var r=i(50),n=i(91),o=i(6),a=i(13).LineDataSource,s=i(85).StudyLineDataSource,l=i(92),d=i(93),h=i(74),p=h.Study,c=h.prepareStudyPropsStateForLoadChart,u=h.prepareStudyPropertiesForLoadChart,_=h.createStudy,f=i(31),g=i(59),v=i(83).LineToolParallelChannel,m=i(94),y=i(95),w=i(96).LineToolElliott,T=i(18).PriceDataSource,b=i(56);r.version=2,r.prototype.state=function(e,t){var i={};i.panes=[];for(var n=0;n<this.panes().length;n++)i.panes.push(this.panes()[n].state(!0,e,!1,t));i.timeScale=this.m_timeScale.state(e);var o=this.publishedChartsTimelineSource(),a=this.properties();return i.chartProperties={paneProperties:a.paneProperties.state(),scalesProperties:a.scalesProperties.state(),publishedChartsTimelineProperties:o?o.state(e):void 0,chartEventsSourceProperties:a.chartEventsSourceProperties.state()},a.chartEventsSourceProperties&&(i.chartProperties.chartEventsSourceProperties=a.chartEventsSourceProperties.state()),i.version=r.version,i.timezone=this.timezone(),i},r.prototype.asyncState=function(e){return this.publishedChartsTimelineSource().asyncState(e).pipe(function(e){var t={};return t.chartProperties={publishedChartsTimelineProperties:e},t})},r.prototype.chartPropertiesTransparencyMigrate=function(e){var t,i,r;e.chartProperties.paneProperties.crossHairProperties&&(r=e.chartProperties.paneProperties.crossHairProperties,TradingView.isHexColor(r.color)&&(i=r.transparency/100,t=TradingView.hexRgbDecomp(r.color),r.color=TradingView.rgbaComp(t,i))),e.chartProperties.paneProperties.dataWindowProperties&&(r=e.chartProperties.paneProperties.dataWindowProperties,TradingView.isHexColor(r.color)&&(i=r.transparency/100,t=TradingView.hexRgbDecomp(r.color),r.color=TradingView.rgbaComp(t,i)))},r.prototype.restoreState=function(e,t){var i={};if(!e.panes)return void TradingView.logDebugChart("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void TradingView.logDebugChart("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void TradingView.logDebugChart("ChartModel.restoreState: invalid state");if(e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties){var r=TradingView.factoryDefaults("chartproperties").scalesProperties;TradingView.merge(r,e.chartProperties.scalesProperties),!("showLastValue"in r)||"showSeriesLastValue"in r||"showStudyLastValue"in r||(r.showSeriesLastValueProperty=r.showLastValue,r.showStudyLastValueProperty=r.showLastValue),"showSeriesLastValue"in r&&(i.showSeriesLastValueProperty=!0),"showStudyLastValue"in r&&(i.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),this.Q0.paneProperties.merge(e.chartProperties.paneProperties),this.Q0.scalesProperties.merge(r),e.chartProperties.timezone&&this.Q0.timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this.Q0.chartEventsSourceProperties&&this.Q0.chartEventsSourceProperties.merge(e.chartProperties.chartEventsSourceProperties),this.m_timeScale.restoreState(e.timeScale,t)}e.timeScale&&this.m_timeScale.restoreState(e.timeScale,t);var n=e.panes;this.panes()[0].restoreState(n[0],t,e.version,i);for(var o=1;o<e.panes.length;o++){var s=this.panes()[o]||this.createPane();s.restoreState(e.panes[o],t,e.version,i)}e.chartProperties&&e.chartProperties.publishedChartsTimelineProperties&&this.publishedChartsTimelineSource().restoreData(e.chartProperties.publishedChartsTimelineProperties,t),this._invalidateBarColorerCaches();for(var l=this.Q17(),d=0,o=0;o<l.length;o++){var h=l[o];TradingView.isInherited(h.constructor,a)&&(d++,h.calcIsActualSymbol())}this._version=e.version,this.timeScale().recalcLockedScale(),this.recalculateAllPanes(),this.Q18(new $21($21.FULL_UPDATE)),window.saver&&window.is_authenticated&&this.isJustClonedChart()&&this.mainSeries().onSymbolResolved().subscribe(this,function(){window.saver.saveChartSilently()},!0);var p=TVLocalStorage.getItem("linetools_limit")||1e3;return window.is_authenticated&&window.user&&window.user.settings&&(p=window.user.settings.linetools_limit||p),d>p?{lines_limit_exceeded:!0,line_tools_count:d}:{}},r.prototype.restoreAxisState=function(e){if(!e.panes)return void TradingView.logDebugChart("ChartModel.restoreAxisState: invalid state");if(!Array.isArray(e.panes))return void TradingView.logDebugChart("ChartModel.restoreAxisState: invalid state");if(e.panes.length<1)return void TradingView.logDebugChart("ChartModel.restoreAxisState: invalid state");this.m_timeScale.restoreState(e.timeScale,!1,!0);for(var t=(e.panes,0);t<e.panes.length;t++){var i=this.panes()[t];i.m_leftPriceScale.restoreState(e.panes[t].leftAxisState),i.m_rightPriceScale.restoreState(e.panes[t].rightAxisState)}this.recalculateAllPanes(),this.Q18(new $21($21.FULL_UPDATE))},b.prototype.state=function(e,t,i,r){function n(e){return i&&!e.isSavedInStudyTemplates()||e instanceof g||!e.state||!e.state()||!e.isSavedInChart(t)||r&&e.isActualSymbol&&!e.isActualSymbol()}var o={};if(e){o.sources=[];for(var a=0;a<this.m_dataSources.length;a++)n(this.m_dataSources[a])||o.sources.push(this.m_dataSources[a].state(t))}o.leftAxisState=this.m_leftPriceScale.state(),o.leftAxisSources=[];for(var a=0;a<this.m_leftPriceScale.Q17().length;a++)n(this.m_leftPriceScale.Q17()[a])||o.leftAxisSources.push(this.m_leftPriceScale.Q17()[a].id());o.rightAxisState=this.m_rightPriceScale.state(),o.rightAxisSources=[];for(var a=0;a<this.m_rightPriceScale.Q17().length;a++)n(this.m_rightPriceScale.Q17()[a])||o.rightAxisSources.push(this.m_rightPriceScale.Q17()[a].id());o.overlayPriceScales={};for(var a=0;a<this.m_dataSources.length;a++){var s=this.m_dataSources[a];this.isOverlay(s)&&s.isSavedInChart(t)&&(o.overlayPriceScales[s.id()]=s.priceScale().state())}return o.stretchFactor=this._stretchFactor,this.m_mainDataSource&&(o.mainSourceId=this.m_mainDataSource.id()),o},b.prototype.sourceById=function(e){for(var t=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)return this.m_dataSources[t];return null},b.prototype.isESDStudy=function(e){return"Script$TV_EARNINGS@tv-scripting"==e.id||"Script$TV_DIVIDENDS@tv-scripting"==e.id||"Script$TV_SPLITS@tv-scripting"==e.id},b.prototype.restoreState=function(e,t,i,r){if(r=r||{},!e.leftAxisState||!e.rightAxisState)throw Error("invalid state");if(!e.leftAxisSources||!e.rightAxisSources)throw Error("invalid state");e.stretchFactor&&(this._stretchFactor=e.stretchFactor);var n={};if(e.sources){var o=-1!==this.m_dataSources.indexOf(this.Z98.mainSeries());this.clearSeries(),o&&this.m_dataSources.push(this.Z98.mainSeries());for(var s=0;s<e.sources.length;s++){var l=e.sources[s];if(Math.abs(l.zorder)>1e200){var d=-1;TradingView.logWarn("Datasource zorder has bad value: "+l.zorder+" Resetting it to "+d),l.zorder=d}var h=l.id;n[h]=l.ownerSource;var c=l.type;c&&("MainSeries"===c?this._restoreMainSeries(l,t,o,r):c.toLowerCase().startsWith("study")?this._restoreStudy(l,t,r):TradingView.isInherited(TradingView[c],a)?this._restoreLineTool(l,t):TradingView[c]&&TradingView[c].createFromState&&this._restoreSpecialSource(l,t))}}this.m_leftPriceScale.Q17().splice(0,1/0),this.m_leftPriceScale._hasSeries=!1;var u=defaults("chartproperties").paneProperties.leftAxisProperties;TradingView.merge(u,e.leftAxisState),this.m_leftPriceScale.restoreState(u);for(var s=0;s<e.leftAxisSources.length;s++){var _=this.dataSourceForId(e.leftAxisSources[s]);_&&(void 0!==u.m_showSymbolLabels&&_ instanceof f&&this.model().properties().scalesProperties.showSymbolLabels.setValue(u.m_showSymbolLabels),_.setPriceScale(this.m_leftPriceScale),this.m_leftPriceScale.addDataSource(_))}this.m_rightPriceScale.Q17().splice(0,1/0),this.m_rightPriceScale._hasSeries=!1;var u=defaults("chartproperties").paneProperties.rightAxisProperties;TradingView.merge(u,e.rightAxisState),this.m_rightPriceScale.restoreState(u);for(var s=0;s<e.rightAxisSources.length;s++){var _=this.dataSourceForId(e.rightAxisSources[s]);_&&(void 0!==u.m_showSymbolLabels&&_ instanceof f&&this.model().properties().scalesProperties.showSymbolLabels.setValue(u.m_showSymbolLabels),_.setPriceScale(this.m_rightPriceScale),this.m_rightPriceScale.addDataSource(_))}for(var s=0;s<this.m_dataSources.length;s++){var _=this.m_dataSources[s];if(-1===this.m_rightPriceScale.Q17().indexOf(_)&&-1===this.m_leftPriceScale.Q17().indexOf(_)){_._isOverlay=!0;var g=new Z74(this.Q0.overlayPropreties,this.Z98.properties().scalesProperties);if(g.setHeight(this.m_height),g.setTopMargin(this.m_rightPriceScale.topMargin()),g.setBottomMargin(this.m_rightPriceScale.bottomMargin()),g.addDataSource(_),e.overlayPriceScales&&e.overlayPriceScales[_.id()]){var u=e.overlayPriceScales[_.id()];u.m_isAutoScale=!0,u.m_isLog=!1,u.m_isPercentage=!1,g.restoreState(u)}_.setPriceScale(g)}else _._isOverlay=!1}for(var h in n){var v=n[h];if(v){var _=this.sourceById(h);_&&this.sourceById(h).setOwnerSource(this.sourceById(v))}}if(e.mainSourceId&&(this.m_mainDataSource=this.dataSourceForId(e.mainSourceId)),!this.m_mainDataSource)for(var s=0;s<this.m_dataSources.length;s++){var _=this.m_dataSources[s];if(TradingView.isInherited(_.constructor,T)){this.m_mainDataSource=_;break}}for(var s=0;s<this.m_dataSources.length;s++){var _=this.m_dataSources[s];if(TradingView.isInherited(_.constructor,a))_.ownerSource()||_.setOwnerSource(this.mainDataSource()),_.isFixed()&&_.restoreFixedPoints(),1==i&&_.priceScale().isPercent()&&!_.isFixed()&&_.correctPricesToPercents(),_.fixAfterRestorePriceAxis&&_.fixAfterRestorePriceAxis();else if(TradingView.isInherited(_.constructor,p)){var m=_.properties();m.linkedToSeries&&m.linkedToSeries.value()&&(_.ownerSource()||_.setOwnerSource(this.model().mainSeries()))}}this._updateMargins(),this._cachedOrderedSoruces=null,this._cachedHitTestSources=null},b.prototype._restoreMainSeries=function(e,t,i,r){var n=e.id,o=e.state,a=e.zorder;if(o&&["candleStyle","hollowCandleStyle","haStyle"].forEach(function(e){o[e]&&(o[e].wickUpColor=o[e].wickUpColor||o[e].wickColor,o[e].wickDownColor=o[e].wickDownColor||o[e].wickColor)}),!i){var s=this.Z98.paneForSource(this.Z98.mainSeries());s.removeDataSource(this.Z98.mainSeries()),this.m_dataSources.push(this.Z98.mainSeries())}var l=o&&o.style?o.style:void 0,d=l==f.STYLE_PNF&&o.pnfStyle.lockScale;
o&&!o.lockScale&&(o.lockScale=d),l==f.STYLE_PNF&&"ATR"==this.Z98.mainSeries().properties().pnfStyle.inputs.style.value()?this.Z98.mainSeries().properties().pnfStyle.inputs.style._value="Traditional":l==f.STYLE_RENKO&&"ATR"==this.Z98.mainSeries().properties().renkoStyle.inputs.style.value()&&(this.Z98.mainSeries().properties().renkoStyle.inputs.style._value="Traditional"),o&&!o.hasOwnProperty("showSessions")&&(o.showSessions=!1),o&&!o.extendedHours&&(o.extendedHours=!1),o&&t&&(o.showCountdown=!1),o&&(t&&!("showSeriesLastValueProperty"in r)&&"showLastValue"in o&&this.Z98.properties().scalesProperties.showSeriesLastValue.setValue(o.showLastValue),delete o.showLastValue),this.Z98.mainSeries().properties().merge(o),this.Z98.mainSeries()._prevChartStyle=this.Z98.mainSeries().properties().style.value(),this.Z98.mainSeries().J61(),this.Z98.mainSeries().setId(n),t&&this.Z98.mainSeries().restoreData(e.bars,e.nsBars,e.symbolInfo,e.rtPrice,e.boxSize),void 0!==a&&this.Z98.mainSeries().setZorder(a),this.Z98.mainSeries().properties().extendedHours.listeners().fire(this.Z98.mainSeries().properties().extendedHours);var h=this.Z98.mainSeries().symbolInfo();h&&this.Z98.mainSeries().onSymbolResolved().fire(this.Z98.mainSeries().symbolInfo())},b.prototype._restoreStudy=function(e,t,i){if(t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes)return void TradingView.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id);var r=e.id,o=e.state,a=e.zorder,s=TradingView.clone(e.metaInfo);if($.extend(s,TradingView.StudyMetaInfo.parseIdString(s.id)),(!this.isESDStudy(s)||t)&&(TradingView.Q16("backtesting")||!s.isTVScriptStrategy||t)){var l=o,d=this.Z98.studyVersioning(),h=d.patchPropsStateAndMetaInfo(l,s,{oldShowStudyLastValueProperty:t&&!i.showStudyLastValueProperty});l=h.propsState,s=h.metaInfo;var p=new n(this.Z98,e,s.shortDescription);return p.setId(r),d.updateMetaInfoAsync(s,t).done(function(i){p.setStatus("");var n=i||s;if(n.isTVScript&&!t){var o=TradingView.StudyMetaInfo.parseIdString(n.fullId||n.id),a=o.productId;pro.hasPackage(a)||(n=$56.createScriptStubNoSrc("Error: '"+n.shortDescription+"' is not authorized",n.scriptIdPart),$.extend(n,TradingView.StudyMetaInfo.parseIdString(n.id)),s=n,i=n,l={})}var h=u(s,i,l,null,d),c=_(this.Z98,h,this.Z98.mainSeries(),n);if(c.setId(r),t){var f=d.patchStudyData(s,e.data,e.nonSeriesData,e.indexes);c.restoreData(f.data,f.nsData,f.indexes)}this.Z98.replaceStudyStub(p,c)||(p=c)}.bind(this)).fail(function(e){TradingView.logError(e),p.setStatus("error: "+e)}),this.m_dataSources.push(p),delete this._cachedOrderedSoruces,delete this._cachedHitTestSources,void 0!==a&&p.setZorder(a),p}},b.prototype._restoreLineTool=function(e,t,i){i=void 0===i?!0:i,w.migrateState(e);var r=e.type,h=e.id,p=e.state,u=i?e.zorder:this._newZOrderForLineTool(),_=TradingView[r];assert(TradingView.isInherited(_,a),"invalid data source type:"+r+" (expected to be a Line Tool)");for(var f=e.points,g=!1,T=0;T<f.length;T++)if(Math.abs(f[T].offset)>1e4){g=!0;break}if(!g){var b,S,C=null,x=TradingView.factoryDefaults("linetool");if(TradingView.isInherited(_,s)){C=this.Z98.studyVersioning(),e=C.patchPointsBasedStudyState(e),TradingView.merge(x,p);var P=e.metaInfo;if($.extend(P,TradingView.StudyMetaInfo.parseIdString(P.fullId)),!t){var L=P.productId;if(!pro.hasPackage(L)){var E=new n(this.Z98,e,P.shortDescription);return E.setId(h),this.m_dataSources.push(E),void 0!==u&&E.setZorder(u),E.setStatus($.t("not authorized")),void E.setFailed(!0)}}var V=C.updateMetaInfo(P),I=V||P;x=c(I,P,x,null,C),t?TradingView.merge(x,{fixedSize:!1}):TradingView.merge(x,{fixedSize:!0}),S=new J50("study_"+I.id,x,!0),b=o.create(r,this.Z98,S,I,this.mainDataSource())}else{var A=r.toLowerCase();TradingView.merge(x,TradingView.factoryDefaults(A)),S=TradingView[r].prototype.createPropertiesObject(A,x),S.merge(p),t?S.merge({fixedSize:!1}):S.merge({fixedSize:!0}),b=new TradingView[r](this.Z98,S,!0)}b.setId(h),b.linkKey=e.linkKey;var k=e.alertId;k&&"function"==typeof b.setAlert&&Z75.enabled("alerts")&&!this.Z98.readOnly()&&!this.Z98.isJustClonedChart()&&b.setAlert(k,{noChartSave:!0});var R=e.indexes?e.indexes:[];if(R=R.slice(0,e.points.length),b.isFixed()?b.restorePositionPercents(e.positionPercents):b.restorePoints(e.points,R,t),b instanceof l||b instanceof d||b instanceof m||b instanceof y||b instanceof v)b.restoreData(e);else if(t&&b.restoreData){var M=e;C&&(M.graphics=C.patchPointsBasedStudyData(M.metaInfo,M.graphics)),b.restoreData(M)}var O=null==e.version?1:e.version,D=null==b.version?1:b.version;return O!=D&&"function"==typeof b.migrateVersion&&b.migrateVersion(O,D,{pane:this,model:this.Z98,properties:S}),this.m_dataSources.push(b),delete this._cachedOrderedSoruces,delete this._cachedHitTestSources,void 0!==u&&b.setZorder(u),b}},b.prototype._restoreSpecialSource=function(e,t){var i=TradingView[e.type];if(i&&i.createFromState){var r=i.createFromState(e,t,this.Z98);r&&(r.setId(e.id),this.m_dataSources.push(r),r.zorder&&r.setZorder(r.zorder))}},r.prototype.studyTemplate=function(e){var t={};t.panes=[];for(var i=0;i<this.panes().length;i++){var n=!0,o=!1,a=!0;t.panes.push(this.panes()[i].state(n,o,a))}return e&&(t.interval=this.mainSeries().interval()),t.version=r.version,t},r.prototype.restoreStudyTemplate=function(e,t){this._undoModel.studyLoadTemplate(this._undoModel,this.studyTemplate(),e,t)},r.prototype.theme=function(){var e={};return e.chartProperties={paneProperties:this.properties().paneProperties.state(),scalesProperties:this.properties().scalesProperties.state(),symbolWatermarkProperties:this.properties().symbolWatermarkProperties.state()},e.mainSourceProperties=this.mainSeries().state().state,delete e.mainSourceProperties.symbol,delete e.mainSourceProperties.interval,delete e.chartProperties.paneProperties.topMargin,delete e.chartProperties.paneProperties.bottomMargin,e.version=r.version,e},r.prototype.restoreTheme=function(e){var t={hollowCandle:{related:"candle"}};for(var i in t)if(!e.mainSourceProperties[i+"Style"]){var r=e.mainSourceProperties[t[i].related+"Style"];e.mainSourceProperties[i+"Style"]=TradingView.clone(r)}this._undoModel.chartLoadTheme(this,e)},e.exports=r},function(e,t,i){(function(t){"use strict";function r(e,t,i,n,o,u,g,v,m){this._version=r.version,this._readOnly=n,this._undoModel=v,this.Q0=i,this._isSnapshot=m,this._studiesMetaData=u,this._studyVersioning=new w(this._studiesMetaData,g),this.m_timeScale=new p(this),this.m_panes=[],this.m_gridSource=new d,this.m_crossHairSource=new a(this,TradingView.drawingState.properties()),this.m_width=0,this._tagsChanged=new Delegate,this._lineCancelled=new Delegate,this._magnet=new h(TradingView.drawingState.properties().magnet,this.m_timeScale,i.paneProperties.magnetSensivity);var y=new J50("chartproperties.mainSeriesProperties");y.addExclusion("lockScale"),y.addExclusion("minTick"),y.addExclusion("priceAxisProperties.percentage"),y.addExclusion("priceAxisProperties.log"),this.createPane(void 0,!1,{rightAxisProperties:y.priceAxisProperties.state(["autoScale"])}),this.m_panes[0]._stretchFactor=2*s.DEFAULT_STRETCH_FACTOR,this.m_panes[0]._isMainPane=!0,this.m_selectedSource=null,this._selectedSourceChanged=new Delegate,this._chartApi=e,this._invalidateHandler=t,this.m_hoveredSource=null,this.Q0.listeners().subscribe(this,r.prototype.propertyChangeHandler);var T=this;if(this.Q0.timezone.listeners().subscribe(null,function(){T._chartApi&&T._chartApi.connected()&&T._chartApi.switchTimezone(T.timezone())}),this.Q0.timeScale.rightOffset.listeners().subscribe(null,function(){T.m_timeScale.setOffset(T.Q0.timeScale.rightOffset.value()),T.recalculateAllPanes()}),y.merge(i.mainSeriesProperties.state()),this.m_mainSeries=new S(this,y,o),this.m_panes[0].addDataSource(this.m_mainSeries,this.m_panes[0].rightPriceScale()),this.m_mainSeries.onCompleted().subscribe(this,function(){T.clearCurrentPosition()}),n||(y.addChild("priceAxisProperties",this.m_mainSeries.m_priceScale.properties()),y.lockScale.listeners().subscribe(this,function(e){var t=e.value();t&&(y.priceAxisProperties.percentage.setValue(!1),y.priceAxisProperties.logDisabled.setValue(!1)),y.priceAxisProperties.percentageDisabled.setValue(t),y.priceAxisProperties.logDisabled.setValue(t)}),this.Q0.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,function(e){e.value()||this.Q0.paneProperties.legendProperties.showStudyArguments.setValue(!1)})),this._barsMarksSources=[],Z75.enabled("charting_library_base")){var b=new f(this);b.setOwnerSource(this.m_mainSeries),this._barsMarksSources.push(b);var C=new c(this);C.setOwnerSource(this.m_mainSeries),this._barsMarksSources.push(C)}else{var x=new _(this);x.setOwnerSource(this.m_mainSeries),this._barsMarksSources.push(x)}this.m_watermarkSource=new l(this.m_mainSeries),Z75.enabled("alerts")&&!this.readOnly()&&(this._alertsList=null,this._initAlertsList()),this.strategySources=[],this.strategySources.change=new Delegate,this._activeStrategySource=new WatchedValue(null),this._oldStartVisibleIndex=-1,this._oldEndVisibleIndex=-1,this._currentTool="",TradingView.drawingState.hideAllDrawings().subscribe(this,r.prototype.visibilityChangeHandler),this.Q0.scalesProperties.listeners().subscribe(this,r.prototype.fullUpdate),this._id=TradingView.guid()}var n=i(6),o=i(13).LineDataSource,a=i(51),s=i(56),l=i(65),d=i(66),h=i(67),p=i(68),c=i(70),u=i(71).BarsMarksContainer,_=i(72),f=i(73),g=i(74),v=g.Study,m=g.createStudy,y=g.prepareStudyProperties,w=i(80),T=i(91),b=i(85).StudyLineDataSource,S=i(31),C=i(59);r.prototype.isSnapshot=function(){return this._isSnapshot},r.prototype.currentTool=function(){return this._currentTool},r.prototype.setCurrentTool=function(e){this._currentTool=e},r.prototype.timezone=function(){return this.Q0.timezone.value()},r.prototype.version=function(){return this._version},r.prototype.initConnection=function(){this._chartApi.switchTimezone(this.timezone())},r.prototype.dumpViews=function(){var e={};e.panes=[];for(var t=0;t<this.m_panes.length;t++)e.panes.push(this.m_panes[t].dumpViews());e.dataWindow=[];for(var i=this.Q17(),t=0;t<i.length;t++){var r=i[t],n=r.dataWindowView();n&&e.dataWindow.push(n.dump())}return e},r.prototype._paneInvalidationMask=function(e,t){var i=new $21,r=this.m_panes.indexOf(e);return void 0===t&&(t=$21.LIGHT_UPDATE),i.invalidatePane(r,t),i},r.prototype.updatePane=function(e){var t=this._paneInvalidationMask(e);this.Q18(t)},r.prototype.fullUpdate=function(e){this.Q18(new $21($21.FULL_UPDATE))},r.prototype.updateSource=function(e){var t=this.paneForSource(e),i=this._paneInvalidationMask(t);this.Q18(i)},r.prototype.studiesMetaData=function(){return this._studiesMetaData},r.prototype.studyVersioning=function(){return this._studyVersioning},r.prototype.disconnect=function(){for(var e=this.Q17(),t=0;t<e.length;t++)e[t].disconnect&&e[t].disconnect()},r.prototype.restart=function(){this.initConnection(),this.m_timeScale.reset(),this.m_mainSeries.restart();for(var e,t=this.Q17(),i=0;i<t.length;i++)e=t[i],e.restart&&e!==this.m_mainSeries&&e.restart()},r.prototype.startNotStartedStudies=function(){if(!this.m_mainSeries.isStarted())throw Error("Cannot start studies: main series is not started");for(var e=this.Q17(),t=0;t<e.length;t++)e[t]instanceof v&&!e[t].isStarted()&&e[t].restart&&e[t]!==this.m_mainSeries&&e[t].restart()},r.prototype.updateLineTools=function(){for(var e=this.Q17(),t=0;t<e.length;t++)if(TradingView.isInherited(e[t].constructor,o)){var i=e[t];i.tryCreateServerPoints(),i.checkAlert&&i.checkAlert()}},r.prototype.realignLineTools=function(){for(var e=this.Q17(),t=0;t<e.length;t++)if(TradingView.isInherited(e[t].constructor,o)){var i=e[t];i.calcIsActualSymbol()}for(var t=0;t<this.m_panes.length;t++)this.m_panes[t].invalidateSourcesCache()},r.prototype.readOnly=function(){return this._readOnly},r.prototype.properties=function(){return this.Q0},r.prototype.lineCancelled=function(){return this._lineCancelled},r.prototype.crossHairMoved=function(){return this.m_crossHairSource.moved()},r.prototype.chartApi=function(){return this._chartApi},r.prototype.propertyChangeHandler=function(){this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.visibilityChangeHandler=function(){this.setSelectedSource(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.updateAllPaneViews=function(){for(var e=0;e<this.m_panes.length;e++){var t=this.m_panes[e];t.updateAllViews()}},r.prototype.mainSeries=function(){return this.m_mainSeries},r.prototype.timeScale=function(){return this.m_timeScale},r.prototype.panes=function(){return this.m_panes},r.prototype.gridSource=function(){return this.m_gridSource},r.prototype.watermarkSource=function(){return this.m_watermarkSource},r.prototype.crossHairSource=function(){return this.m_crossHairSource},r.prototype.publishedChartsTimelineSource=function(){for(var e=0;e<this._barsMarksSources.length;++e)if(this._barsMarksSources[e]instanceof _)return this._barsMarksSources[e]},r.prototype.barsMarksSources=function(){return this._barsMarksSources},r.prototype.width=function(){return this.m_width},r.prototype.setPaneHeight=function(e,t){e.setHeight(t),this.recalculateAllPanes(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.setWidth=function(e){this.m_width=e,this.m_timeScale.setWidth(this.m_width);for(var t=0;t<this.m_panes.length;++t){var i=this.m_panes[t];i.setWidth(e)}this.recalculateAllPanes()},r.prototype.createPane=function(e,t,i){this._undoModel.Q2.isMaximizedPane()&&this._undoModel.Q2.toggleMaximizePane();var n=this.Q0.paneProperties;i&&n.merge(i);var o=new s(this.m_timeScale,n,this,t);if("number"==typeof e&&isFinite(e)){if(0>e||e>this.m_panes.length)return void TradingView.logDebugChart("ChartModel.createPane: invalid index: "+e);this.m_panes.splice(e,0,o)}else this.m_panes.push(o);return o.onTagsChanged().subscribe(this,r.prototype.onPaneTagsChanged),o},r.prototype.removePane=function(e){this._undoModel.Q2.isMaximizedPane()&&this._undoModel.Q2.toggleMaximizePane(),e.destroy();var t=this.m_panes.indexOf(e);-1!==t&&this.m_panes.splice(t,1),this.Q18(new $21($21.FULL_UPDATE))},r.prototype.startScalePrice=function(e,t,i){e.startScalePrice(t,i)},r.prototype.scalePriceTo=function(e,t,i){e.scalePriceTo(t,i),this.mainSeries().properties().lockScale.value()?this.Q18(new $21($21.LIGHT_UPDATE)):this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.endScalePrice=function(e,t){e.endScalePrice(t),this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.startScrollPrice=function(e,t,i){e.startScrollPrice(t,i)},r.prototype.scrollPriceTo=function(e,t,i){e.scrollPriceTo(t,i),this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.endScrollPrice=function(e,t){e.endScrollPrice(t),this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.setPriceAutoScale=function(e,t,i){e.setPriceAutoScale(t,i),this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.restorePriceScaleState=function(e,t,i){e.restorePriceScaleState(t,i),this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.resetPriceScale=function(e,t){e.resetPriceScale(t),this.Q18(this._paneInvalidationMask(e,$21.LIGHT_UPDATE))},r.prototype.updateScales=function(e,t){this._undoModel.Q2._updateScalesActions()},r.prototype.startScaleTime=function(e){this.m_timeScale.startScale(e)},r.prototype.scaleTimeTo=function(e){this.m_timeScale.scaleTo(e),this.recalculateAllPanes(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.endScaleTime=function(){this.m_timeScale.endScale(),this.Q18(new $21($21.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.Q17())},r.prototype.startScrollTime=function(e){this.m_timeScale.startScroll(e),this._isTimeScrolling=!0},r.prototype.scrollTimeTo=function(e){this.m_timeScale.scrollTo(e),this.recalculateAllPanes(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.endScrollTime=function(){this.m_timeScale.endScroll(),this.Q18(new $21($21.LIGHT_UPDATE)),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.Q17()),this._isTimeScrolling=!1},r.prototype.recalcStudyBasedLineTools=function(){this.Q17().forEach(function(e){e instanceof b&&e.recalcStudyIfNeeded&&e.recalcStudyIfNeeded()})},r.prototype.recalcVisibleRangeStudy=function(e,t){void 0!==this._recalcVRTimerId&&clearTimeout(this._recalcVRTimerId);var i=this;this._recalcVRTimerId=setTimeout(function(){i._recalcVisibleRangeStudy(e,t)},500)},r.prototype._recalcVisibleRangeStudy=function(e,t){if(!this.timeScale().isEmpty()){var i=this.timeScale().visibleBars(),r=this.mainSeries().nearestData(i.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this.mainSeries().nearestData(i.lastBar(),TradingView.SEARCH_NEAREST_LEFT),o=r?r.index:void 0,a=n?n.index:void 0,s=o==this._oldStartVisibleIndex,l=a==this._oldEndVisibleIndex;if(!s||!l||t){this._oldStartVisibleIndex=o,this._oldEndVisibleIndex=a;for(var d=0;d<e.length;d++)if(e[d]instanceof v){for(var h=e[d],p=h.metaInfo().inputs,c=null,u=null,_=0;_<p.length;_++)if("first_visible_bar_time"==p[_].id){var f=r&&r.value?r.value[TradingView.TIME_PLOT]:0;c=1e3*Math.floor(f)}else if("last_visible_bar_time"==p[_].id){var f=n&&n.value?n.value[TradingView.TIME_PLOT]:0;u=1e3*Math.floor(f)}var g=h.properties().inputs;c&&(u?g.first_visible_bar_time.setValueSilently(c):g.first_visible_bar_time.setValue(c,!0)),u&&g.last_visible_bar_time.setValue(u,!0)}}}},r.prototype.resetTimeScale=function(){this.m_timeScale.restoreDefault(),this.recalculateAllPanes(),this.mainSeries().requestMoreData(),this.recalcVisibleRangeStudy(this.Q17()),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.restoreTimeScaleState=function(e){this.m_timeScale.restoreState(e),this.recalculateAllPanes(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.restoreFactoryDefaults=function(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudy(this.Q17(),!0),this.mainSeries().onChartStyleChanged()},r.prototype.setSelectedSource=function(e,t){if(!(this.m_selectedSource===e&&this._lastHittestData===t||e&&e.customization&&e.customization.disableSelection)){this._lastHittestData=t;var i=new $21;if(this.m_selectedSource){this.m_selectedSource.updateAllViews();this.paneForSource(this.m_selectedSource);TradingView.alertsDispatcher&&this.m_selectedSource.hasAlert.value()&&this.m_selectedSource.getAlert({fromCache:!0}).done(function(e){e&&e.set("selected",!1)})}if(this.m_selectedSource=e,this._selectedSourceChanged.fire(e),e){e.updateAllViews();this.paneForSource(e);TradingView.alertsDispatcher&&e.hasAlert.value()&&e.getAlert({fromCache:!0}).done(function(e){e&&e.set("selected",!0)})}i.force=!0,this.Q18(new $21($21.LIGHT_UPDATE)),this.setHoveredSource(e,t)}},r.prototype.checkLineToolSelection=function(){this.m_selectedSource&&this.m_selectedSource instanceof o&&(this.m_selectedSource.calcIsActualSymbol(),this.m_selectedSource.isActualSymbol()||this.setSelectedSource(null))},r.prototype.onSelectedSourceChanged=function(){return this._selectedSourceChanged},r.prototype.setHoveredSource=function(e,t){if(this.m_hoveredSource!==e||this._lastHittestData!==t){this._lastHittestData=t;var i=null;this.m_hoveredSource&&(this.m_hoveredSource.updateAllViews(),i||(i=new $21),TradingView.alertsDispatcher&&this.m_hoveredSource.hasAlert.value()&&this.m_hoveredSource.getAlert({fromCache:!0}).done(function(e){e&&e.set("hovered",!1)}),i.merge(this._paneInvalidationMask(this.paneForSource(this.m_hoveredSource),$21.LIGHT_UPDATE))),this.m_hoveredSource=e,e&&(e.updateAllViews(),i||(i=new $21),i.merge(this._paneInvalidationMask(this.paneForSource(e),$21.LIGHT_UPDATE)),TradingView.alertsDispatcher&&e.hasAlert.value()&&e.getAlert({fromCache:!0}).done(function(e){e&&e.set("hovered",!0)})),i&&this.Q18(i)}},r.prototype.selectedSource=function(){return this.m_selectedSource},r.prototype.hoveredSource=function(){return this.m_hoveredSource},r.prototype.lastHittestData=function(){return this._lastHittestData},r.prototype.Q18=function(e){this._invalidateHandler&&this._invalidateHandler(e)},r.prototype.Q17=function(){var e=[];e.push(this.m_crossHairSource);for(var t=0;t<this.m_panes.length;++t)for(var i=this.m_panes[t].Q17(),r=0;r<i.length;r++)e.push(i[r]);return e},r.prototype.dataSourceForId=function(e){for(var t,i=0;i<this.m_panes.length;++i)if(t=this.m_panes[i].dataSourceForId(e))return t;return null},r.prototype.children=function(e){for(var t=this.Q17(),i=[],r=0;r<t.length;r++){var n=t[r];n.ownerSource()===e&&i.push(n)}return i},r.prototype.setCurrentPosition=function(e,t,i,r){var n=NaN,a=Math.round(this.m_timeScale.coordinateToIndex(e));if(i){var s=i.defaultPriceScale();s.isEmpty()||(n=s.coordinateToPrice(t))}if((this._lineBeingCreated||o.isLineTool(this.currentTool()))&&(n=this._magnet.align(n,a,i)),this._isTimeScrolling)return void this.m_crossHairSource.setPosition(this.m_crossHairSource.index,n,i);this.m_crossHairSource.setPosition(a,n,i),this.m_crossHairSource.dataWindowView().update();for(var l=this.m_panes,d=l.length;d--;)for(var h=l[d].Q17(),p=h.length;p--;){var c=h[p].dataWindowView();c&&c.update()}if(this._lineBeingCreated?(this._lineBeingCreated.setLastPoint({index:a,price:n},r),this._lineBeingCreated.updateAllViews(),this.Q18(new $21($21.LIGHT_UPDATE))):this.crossHairSource().startMeasurePoint()?this.Q18(new $21($21.LIGHT_UPDATE)):this.Q18(new $21($21.UPDATE_CURSOR_ONLY)),!this._isSettingsExternalPosition){var u=this._undoModel.Q2;if(u.Q3){var _=this.m_timeScale.points().roughTime(a),f={timeStamp:_},g=i.mainDataSource();g instanceof S&&(f.price=n,f.symbol=g.symbol());var v=this._lineBeingCreated||this._linePointBeingEdited||this._sourceBeingMoved;v=v&&TradingView.drawingState.drawOnAllCharts().value(),u.Q3.syncCrosshair(f,u,v)}}},r.prototype.clearCurrentPosition=function(){var e=this.crossHairSource();e.clearPosition(),e.dataWindowView().update();for(var t=this.m_panes,i=t.length;i--;)for(var r=t[i].Q17(),n=r.length;n--;){var o=r[n].dataWindowView();o&&o.update()}this.Q18(new $21($21.UPDATE_CURSOR_ONLY));var a=this._undoModel.Q2;a.Q3&&a.Q3.syncCrosshair(NaN,a)},r.prototype.setExternalPosition=function(e){var t=this.m_timeScale.points().roughIndex(e.timeStamp),i=this.mainSeries().symbol();if(i==e.symbol){this._isSettingsExternalPosition=!0;var r=this.paneForSource(this.mainSeries()),n=this.m_timeScale.indexToCoordinate(t),o=this.mainSeries().priceScale().priceToCoordinate(e.price,!0);return this.setCurrentPosition(n,o,r,{}),void delete this._isSettingsExternalPosition}if(isFinite(t))this.crossHairSource().setPosition(t,NaN,null);else{var a=this.crossHairSource();a.clearPosition(),a.dataWindowView().update()}for(var s=this.Q17(),l=s.length;l--;){var d=s[l].dataWindowView();d&&d.update()}this.Q18(new $21($21.UPDATE_CURSOR_ONLY))},r.prototype.updateCrossHair=function(){this.m_crossHairSource.updateIndex()},r.prototype.updateTimeScale=function(e,t,i,r,n){if(n){this.m_timeScale.reset();for(var o=this.Q17(),a=0;a<o.length;a++)o[a].clearData&&o[a].clearData()}this.m_timeScale.update(e,t,i,r);var s="ChartModel.prototype.updateTimeScale("+e+","+t+","+i.length+","+r.length+","+n+")";s+="Z47: {first:"+this.m_timeScale.m_points.firstTimePointIndex()+",last:"+this.m_timeScale.m_points.lastTimePointIndex()+"}",TradingView.logDebugChart(s),this.recalculateAllPanes(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.recalculatePane=function(e){e&&e.recalculate()},r.prototype.paneForSource=function(e){for(var t=this.m_panes.length-1;t>=0;t--)if(-1!==this.m_panes[t].Q17().indexOf(e))return this.m_panes[t];return e instanceof u?this.paneForSource(this.m_mainSeries):null},r.prototype.recalculateAllPanes=function(){for(var e=0;e<this.m_panes.length;++e)this.m_panes[e].recalculate();this.timeScale().recalcLockedScale(),this.updateAllPaneViews()},r.prototype._invalidateBarColorerCaches=function(){for(var e=this.Q17(),t=0;t<e.length;++t){var i=e[t];i instanceof S&&i.invalidateBarColorerCache()}},r.prototype.addStrategySource=function(e){~this.strategySources.indexOf(e)||(this.strategySources.push(e),this.strategySources.change.fire())},r.prototype.removeStrategySource=function(e){var t=this.strategySources.indexOf(e);~t&&(this.strategySources.splice(t,1),this.strategySources.change.fire())},r.prototype.setActiveStrategySource=function(e){~this.strategySources.indexOf(e)&&this._activeStrategySource.setValue(e)},r.prototype.unsetActiveStrategySource=function(){this._activeStrategySource.setValue(null)},r.prototype.activeStrategySource=function(){return this._activeStrategySource},r.prototype.insertStudy=function(e,t,i){var r=null,n=["Script$TV_SPLITS@tv-scripting","Script$TV_DIVIDENDS@tv-scripting","Script$TV_EARNINGS@tv-scripting","Volume@tv-basicstudies","Sessions@tv-basicstudies"];-1===n.indexOf(e.id)&&TradingView.trackEvent("studies","Study_"+e.id),i||e.is_price_study?r=this.paneForSource(this.m_mainSeries):(r=this.createPane(void 0,!0),t&&t.paneSize&&r.setPaneSize(t.paneSize)),"Compare@tv-basicstudies"==e.id&&(TradingView.trackEvent("compare","symbol:"+t.inputs.symbol),this.m_mainSeries.priceScale().properties().log.setValue(!1),this.m_mainSeries.priceScale().properties().percentage.setValue(!0));var o=y(e,t,r,this.studyVersioning()),a=m(this,o,this.mainSeries(),e);a.start();var s,l=a.metaInfo().priceScale||TradingView.StudyConsts.SCALE_RIGHT;return l===TradingView.StudyConsts.SCALE_RIGHT?s=r.rightPriceScale():l===TradingView.StudyConsts.SCALE_LEFT?s=r.leftPriceScale():e.is_price_study?s=null:(TradingView.logWarn("Cannot add study "+a.metaInfo().id+" with 'No Scale' setting, because study is not a price study. Using right price scale."),s=r.rightPriceScale()),i?r.addDataSource(a,null):r.addDataSource(a,s),a.properties().linkedToSeries&&a.properties().linkedToSeries.value()&&a.setOwnerSource(this.mainSeries()),this.recalculatePane(r),this.Q18(new $21($21.FULL_UPDATE)),this._invalidateBarColorerCaches(),this.recalcVisibleRangeStudy(this.Q17(),!0),a},r.prototype.replaceStudyStub=function(e,t){var i=this.paneForSource(e);if(null===i)return!1;var r=e.isNoScale()?null:e.priceScale(),n=e.zorder(),o=e.ownerSource();return i.insertDataSource(t,r,n),t.setOwnerSource(o),this.removeSource(e),t.start(),this.recalculatePane(i),this.Q18(new $21($21.FULL_UPDATE)),!0},r.prototype.insertStudyStub=function(e){var t=this.mainSeries(),i=this.paneForSource(t),r=new T(this,null,e);return i.addDataSource(r,null),this.recalculatePane(i),this.Q18(new $21($21.FULL_UPDATE)),r},r.prototype.removeStudyStub=function(e){var t=this.dataSourceForId(e);return void 0===t?(TradingView.logNormal("StudyStub id="+e+" is not found in chart model"),!1):(this.removeSource(t),!0)},r.prototype.detachSource=function(e,t){var i=this.paneForSource(e);if(i)return i.removeDataSource(e),i.isEmpty()?(this._lineBeingCreated&&i==this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(i,t),!0):(this.Q18(new $21($21.FULL_UPDATE)),!1)},r.prototype.removeSource=function(e,t){e===this.m_selectedSource&&this.setSelectedSource(null),e===this._sourceBeingMoved&&(this._sourceBeingMoved=null,this._linePointBeingMoved=null),e.stop&&e.stop();var i=this.detachSource(e,t);if(e.metaInfo&&e.metaInfo()&&"Compare@tv-basicstudies"===e.metaInfo().id){for(var r=this.paneForSource(this.m_mainSeries),n=r.Q17(),o=0;o<n.length;o++)if(n[o].metaInfo&&"Compare@tv-basicstudies"===n[o].metaInfo().id)return;this.m_mainSeries.priceScale().properties().percentage.setValue(!1)}return this.Q18(new $21($21.FULL_UPDATE)),this._invalidateBarColorerCaches(),e.linkKey&&TradingView.drawingState.removeLineTool({model:this,linkKey:e.linkKey}),i},r.prototype.move=function(e,t,i){var r=this.children(e),n=([e].concat(r),this.paneForSource(e)),o=(this.m_panes.indexOf(n),n.state(),n.priceScaleName(e.priceScale()),this.m_panes.indexOf(t),t?t.state():null,t?t.priceScaleName(i):"right"),a=n===t;if(a){for(var s=t.priceScaleByName(o),l=0;l<r.length;l++)t.move(r[l],s);t.move(e,s)}else{for(var d=t?t:this.createPane(),h=d.priceScaleByName(o),l=0;l<r.length;l++)this.detachSource(r[l]);for(var l=0;l<r.length;l++)d.addDataSource(r[l],h);this.detachSource(e),d.addDataSource(e,h),this.Q18(new $21($21.FULL_UPDATE))}this.recalculateAllPanes()},r.prototype.isSingleInstanceLineTool=function(e){return"LineStudyMtpRiskReward"==e||"LineStudyMtpAnalysis"==e},r.prototype._externalTimeStamp=function(e){return this.m_timeScale.points().roughTime(e)},r.prototype.createLineTool=function(e,t,i,r,o){if(!n.isValid(i))return null;this.isSingleInstanceLineTool(i)&&this._undoModel.removeAllDrawingTools(i),TradingView.trackEvent("drawings","Study_Drawing_"+i);var a=n.create(i,this,r,null,e.mainDataSource()),s=!a.linkKey&&!o;TradingView.drawingState.drawOnAllCharts().value()?a.linkKey=o||TradingView.randomHash():a.linkKey=o,a.toolname=i,a.setOwnerSource(e.mainDataSource());var l=e.defaultPriceScale();e.addDataSource(a,l);var d,h=this.m_timeScale.indexToCoordinate(t.index),p=l.priceToCoordinate(t.price);if(a.isFixed())d=a.addFixedPoint(new MathEx.Point(h,p));else{var c=a.constructor;c.skipMagnetting||(t.price=this._magnet.align(t.price,t.index,e)),d=a.addPoint(t)}if(d||(this._lineBeingCreated=a,this._paneBeingCreatedLineOn=e),s&&a.enableCurrentIntervalVisibility(),this.Q18(new $21($21.FULL_UPDATE)),!o&&TradingView.drawingState.drawOnAllCharts().value()&&!a.properties().singleChartOnly){var u=this._externalTimeStamp(t.index);TradingView.drawingState.createLineTool({point:{price:t.price,timeStamp:u},linetool:i,properties:a.properties(),symbol:this.mainSeries().symbol(),model:this,linkKey:a.linkKey})}return a},r.prototype.lineBeingCreated=function(){return this._lineBeingCreated},r.prototype.paneBeingCreatedLineOn=function(){return this._paneBeingCreatedLineOn},r.prototype.coninueCreatingLine=function(e,t,i,r){
var n=this.paneForSource(this._lineBeingCreated);n.defaultPriceScale();e.price=this._magnet.align(e.price,e.index,n);var o=this._lineBeingCreated.addPoint(e,t,i),a=this._lineBeingCreated;this._lineBeingCreated.updateAllViews();var s=new $21($21.LIGHT_UPDATE),l=null;if(o&&(l={points:this._lineBeingCreated._timePoint,interval:this.mainSeries().interval()},this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,s.force=!0),this.Q18(s),!r&&TradingView.drawingState.drawOnAllCharts().value()&&!a.properties().singleChartOnly){var d=this._externalTimeStamp(e.index);TradingView.drawingState.continueLineTool({point:{price:e.price,timeStamp:d},envState:t,finalState:l,model:this})}return o},r.prototype.cancelCreatingLine=function(){if(this._lineBeingCreated){var e=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),TradingView.drawingState.drawOnAllCharts().value()&&!e.properties().singleChartOnly&&TradingView.drawingState.cancelLineTool({model:this})}},r.prototype.startChangingLinetool=function(e,t,i,r){this._lineBeingEdited=e,this._linePointBeingEdited=i,this._lineBeingEdited.startChanging(i,t);var n=this.paneForSource(e);t.price=this._magnet.align(t.price,t.index,n),this._lineBeingEdited.startDragPoint&&this._lineBeingEdited.startDragPoint(i,t),this._lineBeingEdited.setPoint(i,t,r),this._lineBeingEdited.updateAllViews();var o=this._paneInvalidationMask(n,$21.LIGHT_UPDATE);if(o.force=!0,this.Q18(o),e.linkKey&&!e.properties().singleChartOnly){var a=this._externalTimeStamp(t.index);TradingView.drawingState.startChangingLineTool({linkKey:e.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:a},pointIndex:i})}},r.prototype.lineBeingEdited=function(){return this._lineBeingEdited},r.prototype.linePointBeingEdited=function(){return this._linePointBeingEdited},r.prototype.changeLinePoint=function(e,t){var i,r,n=this.paneForSource(this._lineBeingEdited);if(void 0!==e.x&&void 0!==e.y){var o=this._lineBeingEdited.priceScale();i=o.coordinateToPrice(e.y),r=Math.round(this.timeScale().coordinateToIndex(e.x)),i=this._magnet.align(i,r,n),this._lineBeingEdited.setPoint(this._linePointBeingEdited,{price:i,index:r},t)}else this._lineBeingEdited.setPoint(this._linePointBeingEdited,e,t);if(this._lineBeingEdited.updateAllViews(),this.Q18(new $21($21.LIGHT_UPDATE)),this._lineBeingEdited.linkKey&&!this._lineBeingEdited.properties().singleChartOnly){var a=this._externalTimeStamp(r);TradingView.drawingState.changeLineTool({linkKey:this._lineBeingEdited.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:i,timeStamp:a}})}},r.prototype.endChangingLinetool=function(e){var t=(this.paneForSource(this._lineBeingEdited),this._lineBeingEdited);this._lineBeingEdited.endChanging(!1,e),this._lineBeingEdited=null,this._linePointBeingEdited=null;var i=new $21($21.LIGHT_UPDATE);i.force=!0,this.Q18(i);var r={points:t._timePoint,interval:this.mainSeries().interval()};t.linkKey&&!t.properties().singleChartOnly&&TradingView.drawingState.finishChangingLineTool({model:this,linkKey:t.linkKey,symbol:this.mainSeries().symbol(),finalState:r})},r.prototype.startMovingSource=function(e,t,i){this._sourceBeingMoved=e,this._linePointBeingMoved=i,this._sourceBeingMoved.startMoving(t,i);var r=this.paneForSource(this._sourceBeingMoved),n=this._paneInvalidationMask(r,$21.LIGHT_UPDATE);if(n.force=!0,this.Q18(n),e.linkKey&&!e.properties().singleChartOnly){var o=this._externalTimeStamp(t.index);TradingView.drawingState.startMovingLineTool({linkKey:e.linkKey,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:o}})}},r.prototype.sourceBeingMoved=function(){return this._sourceBeingMoved},r.prototype.moveSource=function(e){this._sourceBeingMoved.move(e,this._linePointBeingMoved);this.paneForSource(this._sourceBeingMoved);if(this.Q18(new $21($21.LIGHT_UPDATE)),this._sourceBeingMoved.linkKey&&!this._sourceBeingMoved.properties().singleChartOnly){var t=this._externalTimeStamp(e.index);TradingView.drawingState.moveLineTool({linkKey:this._sourceBeingMoved.linkKey,model:this,point:{price:e.price,timeStamp:t}})}},r.prototype.endMovingSource=function(e){var t=this._sourceBeingMoved,i=this.paneForSource(this._sourceBeingMoved);this._sourceBeingMoved.endMoving(e),this._sourceBeingMoved=null,this._linePointBeingMoved=null;var r=this._paneInvalidationMask(i,$21.LIGHT_UPDATE);if(r.invalidateAll($21.LIGHT_UPDATE),r.force=!0,this.Q18(r),t instanceof o){var n={points:t._timePoint,interval:this.mainSeries().interval()};t.linkKey&&!t.properties().singleChartOnly&&TradingView.drawingState.finishMovingLineTool({linkKey:t.linkKey,model:this,finalState:n})}},r.prototype.finishLineTool=function(e){var t=this.lineBeingCreated();t&&(t.finish&&t.finish(),!e&&TradingView.drawingState.drawOnAllCharts().value()&&t.linkKey&&!t.properties().singleChartOnly&&TradingView.drawingState.finishLineTool({linkKey:t.linkKey,model:this}))},r.prototype.calculateDefaultTags=function(){for(var e=[],t=this.Q17(),i=0;i<t.length;i++){var r=t[i];r.tags&&(e=e.concat(r.tags()))}return e},r.prototype.changeZOrder=function(e,t){var i=this.paneForSource(e);i.changeZOrder(e,t),this.Q18(new $21($21.FULL_UPDATE))},r.prototype.sendToBack=function(e){var t=this.paneForSource(e);t.sendToBack(e),this.Q18(new $21($21.FULL_UPDATE))},r.prototype.bringToFront=function(e){var t=this.paneForSource(e);t.bringToFront(e),this.Q18(new $21($21.FULL_UPDATE))},r.prototype.onTagsChanged=function(){return this._tagsChanged},r.prototype.onPaneTagsChanged=function(){this._tagsChanged.fire()},r.prototype.setTimeViewport=function(e,t){this.timeScale().zoomToBarsRange(e,t),this.recalculateAllPanes(),this.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.zoomToViewport=function(e,t,i,r,n){this.setTimeViewport(e,t);var o=Math.min(i,r),a=Math.max(i,r),s=n.defaultPriceScale();s.setAutoScale(!1),s.isLog()&&(o=s.priceToLogical(o),a=s.priceToLogical(a)),s.setPriceRange(new PriceRange(o,a)),this.recalculateAllPanes(),this.Q18(this._paneInvalidationMask(n,$21.LIGHT_UPDATE))},r.prototype.clearAllStudies=function(){for(var e=this.Q17(),t=0;t<e.length;t++)e[t].clearData&&e[t].clearData()},r.prototype.allLineTools=function(){for(var e=[],t=this.m_panes,i=t.length,r=0;i>r;++r)for(var n=t[r],a=n.Q17(),s=a.length,l=0;s>l;++l){var d=a[l];TradingView.isInherited(d.constructor,o)&&e.push(d)}return e},r.prototype.backgroundColor=function(){return this.Q0.paneProperties.background._value},r.prototype.backgroundCounterColor=function(){return new TradingView.RGBColor(this.backgroundColor()).blackWhiteContrast()},r.prototype.isDark=function(){return"white"===this.backgroundCounterColor()},r.prototype.canZoomIn=function(){return this.m_timeScale.canZoomIn()},r.prototype.canZoomOut=function(){return this.m_timeScale.canZoomOut()},r.prototype.updateAllVolumeStudies=function(){for(var e=this.m_panes,t=e.length;t--;)for(var i=!1,r=e[t],n=r.Q17(),o=n.length;o--;){var a=n[o];a instanceof v&&"Volume"===a.metaInfo().shortId&&(a.updateAllViews(),i||(this.updatePane(r),i=!0))}},r.prototype._initAlertsList=function(){function e(e){function t(t){var i,r;t&&(i=t.mainDataSource(),r=t.priceScaleForSource(i)||t.rightPriceScale()||t.leftPriceScale(),r&&t.addDataSource(new C(a,e),r))}if(e.isOHLC())t(a.paneForSource(a.m_mainSeries));else for(var i=a.m_panes.length-1;i>=0;i--)t(a.m_panes[i]);s.update()}function i(e){function i(e){return e.alert&&e.alert()&&e.alert().id===o}for(var r,n,o=e.id,l=a.m_panes.length-1;l>=0;l--)r=a.m_panes[l],n=t.find(r.Q17(),i),n&&r.removeDataSource&&r.removeDataSource(n);s.update()}function r(){for(var e,t=a.m_panes,i=t.length-1;i>=0;i--){e=t[i].Q17();for(var r=e.length-1;r>=0;r--)e[r]instanceof C&&t[i].removeDataSource(e[r])}}function n(){TradingView.alertsDispatcher.requestList({symbol:a.mainSeries().actualSymbol(),resolution:a.mainSeries().interval(),active:!0,success:function(){a._alertsList.syncCollections()},error:function(){a._alertsList.reset()}})}function o(e){a.mainSeries().onSymbolResolved()[e](a,n),a.mainSeries().onSymbolError()[e](a,r),a.mainSeries().properties().interval[e](a,n)}var a=this,s=a._undoModel.Q2;a._alertsList=new TradingView.CollectionObserver({observableCollection:TradingView.alertsDispatcher.alerts,syncEvents:["change:active","change:crossInterval","change:resolution","change:symbol"],validator:function(e){return(e.get("active")||e.isNew())&&(e.get("crossInterval")||e.get("resolution")===a.mainSeries().interval())&&e.get("symbol")===a.mainSeries().actualSymbol()}}),a._alertsList.on("add",e),a._alertsList.on("remove",i),a._alertsList.on("reset",function(){var t=a._alertsList.models;r();for(var i=t.length-1;i>=0;i--)e(t[i])}),a._alertsList.syncCollections(),loginStateChange.subscribe(a,function(){o(is_authenticated?"subscribe":"unsubscribe")}),is_authenticated&&(o("subscribe"),n())},r.prototype.alertsList=function(){return this._alertsList},r.prototype._modelIntervals=[],r.prototype.setInterval=function(e,t){var i=setInterval(e,t);return this._modelIntervals.push(i),i},r.prototype.clearInterval=function(e){clearInterval(e);var t=this._modelIntervals.indexOf(e);t>-1&&this._modelIntervals.splice(t,1)},r.prototype.clearIntervals=function(){for(var e=0;e<this._modelIntervals.length;e++)clearInterval(this._modelIntervals[e]);this._modelIntervals=[]},r.prototype.destroy=function(){this.clearIntervals()},r.prototype.countUserStudies=function(){for(var e=0,t=0;t<this.m_panes.length;t++)for(var i=this.m_panes[t].Q17(),r=0;r<i.length;r++){var n=i[r];n instanceof v&&n.showInObjectTree()&&e++}return e},r.prototype.isJustClonedChart=function(){return this._undoModel.isJustClonedChart()},r.prototype.copyToOtherCharts=function(e){e.linkKey=e.linkKey||TradingView.randomHash();var t=this,i=e.state();i.points=e._timePoint.map(function(e){var i=t.timeScale().timePointToIndex(e.time_t)+e.offset;return{price:e.price,time_t:e.time_t,offset:e.offset,absolute_time:t.timeScale().points().roughTime(i)}}),i.linetool=e.getType(),i.model=this,i.symbol=this.mainSeries().symbol(),TradingView.drawingState.copyLineTool(i)},r.prototype.restoreSource=function(e,t,i,r,n){var o;o=e?this.createPane(t):this.panes()[t];var a,s=r.type;a=s.toLowerCase().startsWith("study")?o._restoreStudy(r):o._restoreLineTool(r);var l=a.ownerSource()?a.ownerSource().priceScale():o.priceScaleByName(n);if(l)a.setPriceScale(l),l.addDataSource(a);else{var l=new Z74(o.Q0.overlayPropreties,this.properties().scalesProperties);l.setHeight(o.m_height);var d=a.metaInfo&&"Volume@tv-basicstudies"==a.metaInfo().id,h=d?.75:o.m_rightPriceScale.topMargin(),p=d?0:o.m_rightPriceScale.bottomMargin();l.setTopMargin(h),l.setBottomMargin(p),l.addDataSource(a),a.setPriceScale(l),a._isOverlay=!0}var c=null;return r.ownerSource&&(c=o.dataSourceForId(r.ownerSource)),a.setOwnerSource(c),a.setPriceScale(l),a.start(),a.restore&&a.restore(),e&&o.restoreState(i),this.recalculateAllPanes(),this.mainSeries().invalidateBarColorerCache(),this.Q18(new $21($21.FULL_UPDATE,!0)),a.linkKey&&TradingView.drawingState.restoreLineTool({model:this,linkKey:a.linkKey,state:{restorePane:e,paneIndex:t,paneState:i,sourceState:r,priceScaleName:n}}),a},r.prototype.restoreLineToolState=function(e,t){e.restorePoints(t.points,t.indexes||[]),e.properties().merge(t.state),e.restoreData&&e.restoreData(t),e.createServerPoints(),this.Q18(new $21($21.FULL_UPDATE)),e.linkKey&&TradingView.drawingState.restoreLineToolState({model:this,linkKey:e.linkKey,state:t})},e.exports=r}).call(t,i(20))},function(e,t,i){"use strict";function r(e,t){var i=this;_.call(this),this.Q0=t,this.Z98=e,this._dataWindowView=new d(this,e),this._priceAxisView=new l(this,e),this._startMeasurePriceAxisView=new l(this,e,"measureStartY"),this._endMeasurePriceAxisView=new l(this,e,"measureEndY"),this._timeAxisView=new h(this,e),this._startMeasureTimeAxisView=new h(this,e,"measureStartX"),this._endMeasureTimeAxisView=new h(this,e,"measureEndX"),this.visible=!0,e.readOnly()?this.areLinesVisible=!0:TradingView.drawingState.cursorTool.subscribe(function(e){i.areLinesVisible="arrow"!==e},{callWithLast:!0}),this._movedDelegate=new Delegate,this._subscribed=!1}function n(e,t){this.Z97=e,this._pane=t,this._rendererCache={}}function o(e,t,i){this.source=e,this.pane=t,this._horzVisible=i}function a(e,t,i){this.source=e,this.pane=t,this._axis=i||"x"}var s=i(13).LineDataSource,l=i(52),d=i(53),h=i(54),p=i(55).TrendLineRenderer,c=i(45).TextRenderer,u=i(12).RectangleRenderer,_=i(18).DataSource;inherit(r,_),r.prototype.index=0,r.prototype.price=NaN,r.prototype.pane=null,r.prototype.color="white",r.prototype.style="",r.prototype.properties=function(){return this.Q0},r.prototype.moved=function(){return this._movedDelegate},r.prototype.setPosition=function(e,t,i){if(this._subscribed||(this.Z98.mainSeries().onRestarted().subscribe(this,r.prototype.clearMeasure),this._subscribed=!0),this.setLockedPosition(i),this.index=e,this.x=this.Z98.timeScale().indexToCoordinate(e),i&&!i.defaultPriceScale().isEmpty()){this.price=t;var n=i.defaultPriceScale();this.y=n.priceToCoordinate(t),this.pane=i}else this.price=NaN,this.y=NaN,this.pane=null;this.visible=!0,this.updateAllViews(),this._movedDelegate.fire({time:this.Z98.timeScale().points().roughTime(e),price:this.price})},r.prototype.updateIndex=function(){var e=this.index;this.index=this.Z98.timeScale().coordinateToIndex(this.x),this.index!=e&&this.updateAllViews()},r.prototype.setLockedPosition=function(e){delete this.lockedIndex,delete this.lockedX,e!==this._measurePane&&TradingView.drawingState.lockTimeAxis().value()&&(this.lockedIndex=this.Z98.timeScale().points().roughIndex(TradingView.drawingState.lockTimeAxisTime.value()),this.lockedX=this.Z98.timeScale().indexToCoordinate(this.lockedIndex))},r.prototype.clearPosition=function(){this.visible=!1,this.index=parseInt(this.Z98.mainSeries().data().bars().last()),this.price=NaN,this.y=NaN,this.pane=null},r.prototype.measureStartY=function(){var e=this._startMeasurePoint.price,t=this._measurePane;if(t.defaultPriceScale().isPercent()){var i=t.mainDataSource().firstValue();e=t.defaultPriceScale().priceRange().convertToPercent(e,i)}return t.defaultPriceScale().priceToCoordinate(e)},r.prototype.measureStartX=function(){return this.Z98.timeScale().indexToCoordinate(this._startMeasurePoint.index)},r.prototype.measureEndY=function(){var e=this._endMeasurePoint.price,t=this._measurePane;if(t.defaultPriceScale().isPercent()){var i=t.mainDataSource().firstValue();e=t.defaultPriceScale().priceRange().convertToPercent(e,i)}return t.defaultPriceScale().priceToCoordinate(e)},r.prototype.measureEndX=function(){return this.Z98.timeScale().indexToCoordinate(this._endMeasurePoint.index)},r.prototype.paneViews=function(e){var t=[new o(this,e,e===this.pane)];return e===this._measurePane&&(this._measurePaneView||(this._measurePaneView=new n(this,e)),this._measurePaneView.update(),t.push(this._measurePaneView)),TradingView.drawingState.lockTimeAxis().value()&&t.push(this._timeLockPaneView=this._timeLockPaneView||new a(this,e)),t},r.prototype.dataWindowView=function(){return this._dataWindowView},r.prototype.priceAxisViews=function(e,t){if(!this.visible||this.pane!==e||t!==e.defaultPriceScale())return null;var i=[this._priceAxisView];return this._startMeasurePoint&&i.push(this._startMeasurePriceAxisView),this._endMeasurePoint&&i.push(this._endMeasurePriceAxisView),i},r.prototype.timeAxisView=function(){if(!this.visible&&!TradingView.drawingState.lockTimeAxis().value())return null;var e=[this._timeAxisView];return this._startMeasurePoint&&e.push(this._startMeasureTimeAxisView),this._endMeasurePoint&&e.push(this._endMeasureTimeAxisView),e},r.prototype.updateAllViews=function(){this._priceAxisView.update(),this._startMeasurePoint&&(this._startMeasurePriceAxisView.update(),this._startMeasureTimeAxisView.update()),this._endMeasurePoint&&(this._endMeasurePriceAxisView.update(),this._endMeasureTimeAxisView.update()),this._timeAxisView.update()},r.prototype.startMeasurePoint=function(){return this._startMeasurePoint},r.prototype.startMeasuring=function(e,t){if(t.defaultPriceScale().isPercent()){var i=t.mainDataSource().firstValue();e.price=t.defaultPriceScale().priceRange().convertFromPercent(e.price,i)}this._startMeasurePoint=e,this._measurePane=t},r.prototype.finishMeasure=function(e){var t=this._measurePane;if(t.defaultPriceScale().isPercent()){var i=t.mainDataSource().firstValue();e.price=t.defaultPriceScale().priceRange().convertFromPercent(e.price,i)}this._endMeasurePoint=e},r.prototype.endMeasurePoint=function(){return this._endMeasurePoint},r.prototype.clearMeasure=function(e){delete this._measurePane,delete this._startMeasurePoint,delete this._endMeasurePoint,delete this._lastValidMeasurePoint,this.Z98.Q18(new $21($21.LIGHT_UPDATE))},r.prototype.measurePoints=function(){this.updateAllViews();var e=[this._startMeasurePoint];if(this._endMeasurePoint)e.push(this._endMeasurePoint);else{this._measurePane===this.pane&&(this._lastValidMeasurePoint={x:this.x,y:this.y,rawPrice:this.price,price:this.price,index:this.index});var t=this._lastValidMeasurePoint.rawPrice,i=this._measurePane,r=i.defaultPriceScale();if(r.isPercent()&&!r.isEmpty()){var n=i.mainDataSource().firstValue();this._lastValidMeasurePoint.price=r.priceRange().convertFromPercent(t,n)}e.push(this._lastValidMeasurePoint)}return e},r.prototype.currentPoint=function(){return new MathEx.Point(this.x,this.y)},r.prototype.appliedIndex=function(){return isFinite(this.lockedIndex)&&this.lockedIndex||this.index},r.prototype.appliedX=function(){return isFinite(this.lockedX)&&this.lockedX||this.x},n.prototype.update=function(){var e,t;if(this.Z97._endMeasurePoint)e=this.Z97._endMeasurePoint.price,t=this.Z97._endMeasurePoint.index;else if(this.Z97._measurePane===this.Z97.pane)e=this.Z97.price,t=this.Z97.index;else{if(!this.Z97._lastValidMeasurePoint)return;e=this.Z97._lastValidMeasurePoint.rawPrice,t=this.Z97._lastValidMeasurePoint.index}var i=e-this.Z97._startMeasurePoint.price,r=t-this.Z97._startMeasurePoint.index,n=this.Z97._startMeasurePoint.price,o=this.Z97._measurePane;if(o.defaultPriceScale().isPercent()){var a=o.mainDataSource().firstValue();this.Z97._endMeasurePoint&&(e=o.defaultPriceScale().priceRange().convertToPercent(e,a)),n=o.defaultPriceScale().priceRange().convertToPercent(n,a)}var s=this.Z97._measurePane.defaultPriceScale().formatter().format(i);if(this.Z97._startMeasurePoint.price){var l=i/this.Z97._startMeasurePoint.price;s+=" ("+(new TradingView.PercentageFormatter).format(100*l)+")"}this._label=""+s+"\n"+$.t("{0} bars").format(r),n=this.Z97.Z98._magnet.align(n,this.Z97._startMeasurePoint.index,this.Z97._measurePane),e=this.Z97.Z98._magnet.align(e,t,this.Z97._measurePane);var d=this.Z97.Z98.timeScale().indexToCoordinate(this.Z97._startMeasurePoint.index),h=this.Z97.Z98.timeScale().indexToCoordinate(t),p=this.Z97._measurePane.defaultPriceScale().priceToCoordinate(n),c=this.Z97._measurePane.defaultPriceScale().priceToCoordinate(e);this._p1=new MathEx.Point(d,p),this._p2=new MathEx.Point(h,c);var u=this.Z97.Z98.timeScale().indexToUserTime(this.Z97._startMeasurePoint.index),_=this.Z97.Z98.timeScale().indexToUserTime(t),f=this.Z97._measurePane.mainDataSource().base();if(u&&_||f){var g=(_.valueOf()-u.valueOf())/1e3,v=Math.round(i*f);this._label=""+s+" , "+v+"\n"+$.t("{0} bars").format(r)+", "+(new TradingView.TimeSpanFormatter).format(g)}},n.prototype.renderer=function(){var e=new TradingView.CompositeRenderer,t={};t.points=[this._p1,this._p2],t.width=this.Z97.Z98.timeScale().width(),t.height=this.Z97._measurePane.defaultPriceScale().height(),t.color="#D3E7FF",t.linewidth=0,t.fillBackground=!0,t.transparency=60,t.backcolor="#BADAFF",e.append(new u(t));var i=this._p1.add(this._p2).scaled(.5),r=new MathEx.Point(this._p1.x,i.y),n=new MathEx.Point(this._p2.x,i.y),o={points:[r,n],width:t.width,height:t.height,color:"#646668",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_ARROW};e.append(new p(o));var r=new MathEx.Point(i.x,this._p1.y),n=new MathEx.Point(i.x,this._p2.y),o={points:[r,n],width:t.width,height:t.height,color:"#646668",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_ARROW};e.append(new p(o));var a={x:0,y:10},l=function(e,t){return{points:[t],text:e,color:"#FFFFFF",horzAlign:"left",vertAlign:"middle",font:"Arial",offsetX:a.x,offsetY:a.y,bold:!1,italic:!1,fontsize:12,padding:5,highlightBorder:!1,backgroundColor:TradingView.generateColor("#5b85bf",10),backgroundTransparency:10,backgroundVertInflate:5,backgroundHorzInflate:5,backgroundRoundRect:4}},d=.5*(this._p1.x+this._p2.x),h=this._p2.y,_=new MathEx.Point(d,h),f=l(this._label,_),g=new c(f,this._rendererCache),v=g.measure(),m={x:d+f.backgroundHorzInflate+v.textBgPadding-v.width/v.textBgPadding,y:this._p1.y>this._p2.y?_.y-v.height-2*v.textBgPadding-a.y>0?h-v.height-a.y+v.textBgPadding:a.y-2*v.textBgPadding:_.y+v.height+v.textBgPadding+a.y>t.height?t.height-v.height-a.y:h+v.textBgPadding};return g.setPoints([new MathEx.Point(m.x,m.y)]),e.append(g),e},o.prototype.update=function(){},o.prototype.renderer=function(){var e={},t=this.source.visible&&this.source.areLinesVisible,i=TradingView.drawingState.lockTimeAxis().value();e.horzLinesVisible=t&&this._horzVisible,e.vertLinesVisible=t||i;var r=this.pane.Z98.readOnly(),n=r?defaults("chartproperties.paneProperties.crossHairProperties"):null,o=TradingView.isMobile.any()&&s.isLineTool(this.source.Z98.currentTool()),a=o?"#a000a0":r?n.color:this.pane.Z98.properties().paneProperties.crossHairProperties.color.value(),l=r?n.transparency:this.pane.Z98.properties().paneProperties.crossHairProperties.transparency.value();return!o&&l>0&&(a=TradingView.generateColor(a,l)),e.color=a,e.lineWidth=r?n.width:this.pane.Z98.properties().paneProperties.crossHairProperties.width.value(),e.lineStyle=r?n.style:this.pane.Z98.properties().paneProperties.crossHairProperties.style.value(),e.drawCenter=o&&this.pane==this.source.pane,e.w=this.pane.width(),e.h=this.pane.height(),e.x=isFinite(this.source.lockedX)&&this.source.lockedX||this.source.x,e.y=this.source.y,new Z60(e)},a.prototype.update=function(){},a.prototype.renderer=function(){var e=this.source.visible&&this.source.areLinesVisible,t=TradingView.drawingState.lockTimeAxis().value(),i=e&&this._horzVisible,r=e||t;if(("y"!=this._axis||i)&&r){var n=9,o=11,a="y"==this._axis?this.pane.width()-n/2:this.source.lockedX+1,s="y"==this._axis?this.source.y:this.pane.height()-o/2-1;return new TradingView.PaneRendererCrossHairLock({x:a,y:s,width:n,height:o,bodyHeight:7})}},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._crossHair=e,this.Z98=t,this._rendererData={background:"#585858",color:"white",visible:!0},this._defaultFormatter=new TradingView.PriceFormatter(100)}var n=i(15),o=i(14);inherit(r,o),r.prototype.update=function(){var e=this._rendererData,t=this._crossHair.pane;if(e.coordinate=this._crossHair.y,this.text="",t&&this._crossHair.visible){var i=t.defaultPriceScale();if(!i.isEmpty()){var r,n=i.mainSource();r=n?n.formatter():this._defaultFormatter,e.text=r.format(this._crossHair.price)}}},r.prototype.renderer=function(){return this._renderer||(this._renderer=new n(this._rendererData)),this._renderer},e.exports=r},function(e,t,i){"use strict";function r(e,t){o.call(this),this._header=null,this._crossHair=e,this.Z98=t,this._items.push(new a("Date","")),this._items.push(new a("Time","")),this._items.push(new a("Price","")),this._defaultFormatter=new TradingView.PriceFormatter(100)}var n=i(38),o=n.DataWindowView,a=n.DataWindowItem;inherit(r,o),r.prototype.update=function(){var e=this.Z98.mainSeries().isDWM();if(this._items[1].setVisible(!e),this._items[0].setValue("n/a"),this._items[1].setValue("n/a"),this._items[2].setValue("n/a"),!this.Z98.timeScale().isEmpty()){var t=this._crossHair.appliedIndex(),i=this.Z98.timeScale().indexToUserTime(t);null===i?(this._items[0].setValue("n/a"),e||this._items[1].setValue("n/a")):(this._items[0].setValue((new TradingView.DateFormatter).format(i)),e||this._items[1].setValue((new TradingView.TimeFormatter).format(i)));var r=this._crossHair.pane;if(r){var n=r.defaultPriceScale();if(!n.isEmpty()){var o,a=n.mainSource();o=a?a.formatter():this._defaultFormatter,this._items[2].setValue(o.format(this._crossHair.price))}}}},e.exports=r},function(e,t,i){"use strict";function r(e,t){n.call(this),this._crosshair=e,this.Z98=t,this._rendererData={visible:!1,background:"#585858",color:"white",text:""}}var n=i(16),o=i(17);inherit(r,n),r.prototype.update=function(){var e=this._rendererData,t=this.Z98.timeScale();e.coordinate=this._crosshair.appliedX();var i=t.indexToUserTime(this._crosshair.appliedIndex());i?(e.visible=!0,e.text=new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(i)):(e.visible=!1,e.text="")},r.prototype.renderer=function(){var e=this._rendererData;return this._renderer||(this._renderer=new o(e)),this._renderer},e.exports=r},function(e,t,i){"use strict";function r(){this._registeredSources={},this._sourcesToRow={},this._rowsToSources={},this._currentSymbol="",this._actualCapacity=0,this._actualWidth=0,this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this._currentWidth=400,this._canvas.prop("width",this._currentWidth).prop("height",1).css("position","absolute").css("top",0).css("z-index",1e3).css("left",0),this._ctx=this._canvas.get(0).getContext("2d"),this._ctx.font=l.LABEL_FONTSIZE+"px"+l.LABEL_FONT;var e=l.LABEL_FONTSIZE,t=l.LABEL_LINESPACING,i=e+t,r=3;this._padding=8,this._rowHeight=i*r-t+2*this._padding+2}function n(e,t,i){this._textSizeCache=t,this._data=e,this._fontSize=e.fontsize?e.fontsize:e.fontSize?e.fontSize:12,this._lineSpacing="number"==typeof this._data.lineSpacing&&this._data.lineSpacing?this._data.lineSpacing:0,e.lines=this._lines=c.prototype.wordWrap.call(this,e.text,e.wordWrapWidth),this._hittest=i?i:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}function o(){var e=document.createElement("canvas");e.width=0,e.height=0,u=e.getContext("2d"),e=null}function a(e,t){this._data=e,this._hittest=t?t:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}function s(e,t){h.call(this,e,t),this._label=null,this._rendererCache={},this._invalidated=!0,this._labelDataInvalidated=!0,this._percentageFormatter=new TradingView.PercentageFormatter,this._numericFormatter=new TradingView.NumericFormatter}function l(e,t){this._constructor="LineToolTrendLine";var i=t?t:new J50("linetooltrendline");p.call(this,e,new s(this,e),i),e._trendLineStatsCache||(e._trendLineStatsCache=new r)}function d(e,t,i,r,n,o){var a=f;return i>e?a|=g:e>n&&(a|=v),r>t?a|=m:t>o&&(a|=y),a}var h=i(44),p=i(13).LineDataSource,c=i(45).TextRenderer;r.prototype.canvas=function(){return this._canvas},r.prototype.topByRow=function(e){return e*this._rowHeight},r.prototype.rowHeight=function(e){return this._rowHeight},r.prototype.rowWidth=function(e){var t=this._rowsToSources[e];return this._sourcesToRow[t].width},r.prototype.currentWidth=function(){return this._currentWidth},r.prototype._findEmptyRow=function(e){for(var t=0;this._rowsToSources[t];)t++;return this._rowsToSources[t]=e,t>=this._actualCapacity&&(this._actualCapacity++,TradingView.resizeCanvas(this._canvas,this._currentWidth,this._rowHeight*this._actualCapacity),this._ctx=this._canvas.get(0).getContext("2d"),TradingView.logDebugChart("TrendLineCache. Expanging cache to "+this._actualCapacity+" items")),t},r.prototype._effectiveState=function(e){var t={};t.p1=$.extend({},e.points()[0]),t.p2=$.extend({},e.points()[1]);var i=e.properties();return t.showBars=i.showBarsRange.value(),t.showTimeRange=i.showDateTimeRange.value(),t.showDistance=i.showDistance.value(),t.showPriceRange=i.showPriceRange.value(),t.showAngle=i.showAngle.value(),t.color=i.textcolor.value(),t.showAngle&&(t.priceRange=e.priceScale().priceRange().state(),t.barSpacing=e.Z98.timeScale().barSpacing()),t},r.prototype._effectiveStatesEquals=function(e,t){var i=function(e,t){return e||t?e&&!t?!0:!e&&t?!0:e.index!=t.index||e.price!=t.price:!1};if(e&&!t)return!1;if(!e&&t)return!1;if(i(e.p1,t.p1))return!1;if(i(e.p2,t.p2))return!1;if(e.color!=t.color)return!1;if(e.showBars!=t.showBars)return!1;if(e.showTimeRange!=t.showTimeRange)return!1;if(e.showDistance!=t.showDistance)return!1;if(e.showPriceRange!=t.showPriceRange)return!1;if(e.showAngle!=t.showAngle)return!1;if(e.showAngle){if(e.priceRange.min!=t.priceRange.min)return!1;if(e.priceRange.max!=t.priceRange.max)return!1;if(e.barSpacing!=t.barSpacing)return!1}return!0},r.prototype.removeSource=function(e){if(this._sourcesToRow[e]){var t=this._sourcesToRow[e].row;this._ctx.save(),this._ctx.clearRect(0,this.topByRow(t),this._currentWidth,this.rowHeight(t)),this._ctx.restore(),delete this._sourcesToRow[e],delete this._rowsToSources[t]}},r.prototype._repaintSource=function(e,t,i){this._ctx.save(),this._ctx.translate(0,this.topByRow(t)+.5),i.points[0]=new MathEx.Point(0,0),i.offsetX=0,i.offsetY=0,delete i.horzAlign,delete i.vertAlign,this._ctx.clearRect(0,0,this._currentWidth,this.rowHeight(t));var r=new n(i,{}),o=r.draw(this._ctx);this._sourcesToRow[e].width=o.width,this._ctx.restore()},r.symbolInfoDifferent=function(e,t){return e.listed_exchange.value()===t.listed_exchange&&e.short_name.value()===t.name},r.prototype.updateSource=function(e,t){var i=e.properties().symbol.value();this._currentSymbol&&!r.symbolInfoDifferent(e.properties().symbolInfo,this._currentSymbol)||(TradingView.logDebugChart("TrendLineCache. Clearing canvas because of changing symbol from "+this._currentSymbol+" to "+i),this._currentSymbol=e.properties().symbolInfo,this._sourcesToRow={},this._rowsToSources={});var n=e.id();if(!this._sourcesToRow[n]){var o=this._findEmptyRow(n);this._sourcesToRow[n]={effectiveState:null,row:o}}var a=this._sourcesToRow[e.id()].effectiveState,s=this._effectiveState(e);if(!this._effectiveStatesEquals(a,s)){var o=this._sourcesToRow[e.id()],l=t();this._repaintSource(n,o.row,l),this._sourcesToRow[n].effectiveState=s}return this._sourcesToRow[n]};var u,_={priceRange:{width:15,height:14,data:[134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255]
},barsRange:{width:16,height:15,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,136,136,136,56,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,136,136,136,56,134,134,138,255,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,136,136,136,56,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,136,136,136,56,134,134,138,255,134,134,138,255,137,137,137,74,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,137,137,137,74,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},angle:{width:14,height:12,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,130,130,134,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255,134,134,138,255]}};n.prototype._preRender=function(){if(!this._preRendered){u||o();var e=(this._data.points[0],this._data.points[0].x+(this._data.offsetX||0)),t=e,i=this._data.points[0].y+(this._data.offsetY||0),r=i,n=this._fontSize,a=this._lineSpacing,s=n+a,l=s*this._lines.length-a;u.textBaseline="top",u.font=this.fontStyle();var d,h=[];if(this._data.wordWrapWidth){d=this._data.wordWrapWidth;for(var p=0;p<this._lines.length;p++)h.push(this._data.wordWrapWidth)}else{d=0;for(var p=0;p<this._lines.length;p++){var c=u.measureText(this._lines[p]).width;h.push(c),d=Math.max(d,c)}}if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){var _={top:this._data.paddingTop||0,right:this._data.paddingRight||0,bottom:this._data.paddingBottom||0,left:this._data.paddingLeft||0},f={x:0,y:0};if(this._data.backgroundHorzInflate){var g=this._data.backgroundHorzInflate/2;_.left+=g,_.right+=g,f.x=-g}if(this._data.backgroundVertInflate){var v=this._data.backgroundVertInflate/2;_.top+=v,_.bottom+=v,f.y=-v}var m="number"==typeof this._data.padding?this._data.padding:~~(n/6);for(var p in _)_[p]||(_[p]=m);var y={x:Math.floor(e+f.x),y:Math.floor(i+f.y),w:Math.ceil(d+_.left+_.right),h:Math.ceil(l+_.top+_.bottom)};if(t+=_.left+f.x,r+=_.top+f.y,"bottom"==this._data.vertAlign||"middle"==this._data.vertAlign){var w="middle"==this._data.vertAlign?i-y.h/2:i-y.h-(y.y-i),T=w-y.y;r+=T,y.y=w}if("right"==this._data.horzAlign||"center"==this._data.horzAlign){var b="center"==this._data.horzAlign?e-y.w/2:e-y.w-(y.x-e),S=b-y.x;t+=S,y.x=b,this._data.doNotAlignText!==!0&&("right"==this._data.horzAlign?(u.textAlign="end",t+=d):(u.textAlign="center",t+=d/2))}y.w%2!==0&&y.w++,y.x+=.5,y.y+=.5,this._boundingRect=[new MathEx.Point(y.x,y.y),new MathEx.Point(y.x+y.w,y.y+y.h)],this._rect=y,this._padding=_,this._defaultPadding=m}else{"bottom"!=this._data.vertAlign&&"middle"!=this._data.vertAlign||(r-=Math.round(l*("middle"==this._data.vertAlign?.5:1)));var C=t;"right"!=this._data.horzAlign&&"center"!=this._data.horzAlign||(C-=Math.round(d*("center"==this._data.horzAlign?.5:1))),this._boundingRect=[new MathEx.Point(C,r),new MathEx.Point(C+d,r+l)]}this._textPoint={x:t,y:r},this._textSizeCache&&(this._textSizeCache.widths=h),this._preRendered=!0,this._maxWidth=d}},n.prototype._drawIcon=function(e,t,i,r){if(_.hasOwnProperty(r)){var n=_[r];if(!n.src){n.src=document.createElement("canvas"),n.src.width=n.width,n.src.height=n.height;for(var o=n.src.getContext("2d"),a=o.createImageData(n.width,n.height),s=0;s<n.data.length;s++)a.data[s]=n.data[s];o.putImageData(a,0,0)}e.drawImage(n.src,t,i)}},n.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._fontSize+"px "+this._data.font},n.prototype.draw=function(e){if(0!==this._data.points.length){this._preRender();var t=this._fontSize,i=this._lineSpacing,r=t+i;r*this._lines.length-i;e.textBaseline="top",e.font=this.fontStyle();var n=this._rect;if((this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth)&&this._rect){if("right"!=this._data.horzAlign&&"center"!=this._data.horzAlign||this._data.doNotAlignText!==!0&&(e.textAlign="right"==this._data.horzAlign?"end":"center"),this._data.backgroundRoundRect){if(e.roundRect(n.x,n.y,n.w,n.h,this._data.backgroundRoundRect),this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.globalAlpha=this._data.backgroundTransparency,e.fill(),e.globalAlpha=1),this._data.borderColor){var o="number"==typeof this._data.borderWidth?this._data.borderWidth:~~Math.max(t/12,1);e.strokeStyle=this._data.borderColor,e.lineWidth=o,e.stroke()}}else if(this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.globalAlpha=this._data.backgroundTransparency,e.fillRect(n.x,n.y,n.w,n.h),e.globalAlpha=1),this._data.borderColor){var o="number"==typeof this._data.borderWidth?this._data.borderWidth:~~Math.max(t/12,1);e.strokeStyle=this._data.borderColor,e.lineWidth=o,e.strokeRect(n.x-o/2,n.y-o/2,n.w+o,n.h+o)}else if(this._data.highlightBorder){e.strokeStyle=this._data.color,e.lineWidth=1,e.beginPath();var a,s,l=[3,1];e.dashedLineTo(n.x-.5,s=n.y-.5,a=n.x+n.w+.5,s,l),e.dashedLineTo(a,s,a,s=n.y+n.h+.5,l),e.dashedLineTo(a=n.x-.5,s,n.x+n.w+.5,s,l),e.dashedLineTo(a,n.y-.5,a,s,l),e.globalAlpha=.5,e.stroke(),e.globalAlpha=1}if(this._data.icons){this._textPoint.x,this._textPoint.y;this._data.icons.forEach(function(t,i){var o=n.x+this._defaultPadding,a=n.y+this._padding.top+r*i;this._drawIcon(e,o,a,t)},this)}}else"right"==this._data.horzAlign?e.textAlign="end":"center"==this._data.horzAlign&&(e.textAlign="center");var d=this._textPoint.x,h=this._textPoint.y;e.fillStyle=this._data.color;for(var p=0;p<this._lines.length;p++)e.fillText(this._lines[p],d,h),h+=r;return{width:n.w+2}}},n.prototype.hitTest=function(e){return 0===this._data.points.length?null:(this._preRender(),this._boundingRect&&MathEx.pointInRect(e,this._boundingRect[0],this._boundingRect[1])?this._hittest:null)},a.prototype.drawArrow=function(e,t,i,r){if(!(t.substract(e).length()<1)){var n=t.substract(e).normalized(),o=5*r,a=n.scaled(o),s=t.substract(a),l=n.transponed(),d=3*r,h=l.scaled(d),p=s.add(h),c=s.substract(h);CanvasEx.drawLine(i,Math.round(p.x),Math.round(p.y),t.x,t.y),CanvasEx.drawLine(i,Math.round(c.x),Math.round(c.y),t.x,t.y)}},a.prototype.lineClipping=function(e,t,i,r){var n=window.cohenSutherland(e.x,e.y,t.x,t.y,0,0,i,r);return n?[{x:n[0],y:n[1]},{x:n[2],y:n[3]}]:!1},a.prototype.expandPoints=function(e,t,i,r){var n=new MathEx.Point(0,0),o=new MathEx.Point(i,r);if(this._data.extendleft){var a=e.substract(t),s=MathEx.intersectRayWithRect(e,e.add(a),n,o);s&&(e=s)}if(this._data.extendright){var a=t.substract(e),s=MathEx.intersectRayWithRect(t,t.add(a),n,o);s&&(t=s)}return[e,t]},a.prototype.drawCircle=function(e,t,i,r){r=$.extend({fillStyle:"#000000"},r),t.save(),t.fillStyle=r.fillStyle,t.beginPath(),t.arc(e.x,e.y,i,0,2*Math.PI,!1),t.fill(),r.strokeWidth&&(t.lineWidth=r.strokeWidth,t.stroke()),t.restore()},a.prototype.draw=function(e){if(!(this._data.points&&this._data.points.length<2||this._data.floatPoints&&this._data.floatPoints.length<2)){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t,i=this._data.floatPoints||this._data.points,r=i[0],n=i[1];e.canvas.width,e.canvas.height;this._data.overlayLineEndings?t=[$.extend(!0,{},r),$.extend(!0,{},n)]:this.drawEnds(e,[r,n]);var o=this.expandPoints(r,n,this._data.width,this._data.height),a=this.lineClipping(o[0],o[1],this._data.width,this._data.height);a&&this._data.linewidth>0&&CanvasEx.drawLine(e,Math.round(a[0].x),Math.round(a[0].y),Math.round(a[1].x),Math.round(a[1].y)),this._data.overlayLineEndings&&this.drawEnds(e,t)}},a.prototype.drawEnds=function(e,t){var i=t[0],r=t[1];switch(this._data.leftend){case p.LINEEND_ARROW:this.drawArrow(r,i,e,e.lineWidth);break;case p.LINEEND_CIRCLE:this.drawCircle(i,e,e.lineWidth,this._data.endstyle)}switch(this._data.rightend){case p.LINEEND_ARROW:this.drawArrow(i,r,e,e.lineWidth);break;case p.LINEEND_CIRCLE:this.drawCircle(r,e,e.lineWidth,this._data.endstyle)}},a.prototype.hitTest=function(e){if(this._data.points&&this._data.points.length<2)return null;if(this._data.floatPoints&&this._data.floatPoints.length<2)return null;var t=TradingView.isMobile.any()?24:3,i=this._data.floatPoints||this._data.points,r=i[0],n=i[1],o=this.expandPoints(r,n,this._data.width,this._data.height),a=MathEx.distanceToSegment(o[0],o[1],e);return a.distance<=t?this._hittest:null},inherit(s,h),s.prototype.update=function(){this._invalidated=!0,this._labelDataInvalidated=!0},s.prototype.updateImpl=function(){var e=this.Z97.points();if(!(e.length<2)){var t=e[0],i=e[1],r=this.Z98.timeScale().visibleBars();if(void 0!==r&&!r.isEmpty()){r=r.clone();var n=this.Z97.properties();if(!(t.index<r.firstBar()&&i.index<r.firstBar())||n.extendLeft.value()||n.extendRight.value()){h.prototype.update.call(this);var o=n.showBarsRange.value(),a=n.showDateTimeRange.value(),s=n.showDistance.value(),l=n.showPriceRange.value(),d=n.showAngle.value();if(l||o||a||s||d){var p=this;this._statCache=this.Z98._trendLineStatsCache.updateSource(this.Z97,function(){return p._statLabelData()})}else this.Z98._trendLineStatsCache.removeSource(this.Z97.id()),this._label=null,this._labelData&&(this._labelData.text="",this._labelData.lines=[]);this._invalidated=!1}}}},s.prototype._statLabelData=function(){if(this._labelDataInvalidated){var e,t,i,r,n,o=this.Z97.points(),a=o[0],s=o[1],d=this.Z97.properties(),h=[],p=d.showPriceRange.value();if(p&&this.Z97.priceScale()){r=s.price-a.price;var c=r/a.price;e=this.Z97.priceScale().formatter().format(r)+" ("+this._percentageFormatter.format(100*c)+")";var u=this.Z98.mainSeries().base();if(u){var _=Math.round(r*u);e+=", "+_}h.push("priceRange")}var f=d.showBarsRange.value(),g=d.showDateTimeRange.value(),v=d.showDistance.value();if(f||g||v){if(t="",f&&(n=s.index-a.index,t+=$.t("{0} bars").format(n)),g){var m=this.Z98.timeScale().indexToUserTime(a.index),y=this.Z98.timeScale().indexToUserTime(s.index);if(m&&y){var w=(y.valueOf()-m.valueOf())/1e3,T=(new TradingView.TimeSpanFormatter).format(w);T&&(t+=f?" ("+T+")":T)}}if(v){t&&(t+=", "),void 0===r&&(r=s.price-a.price),void 0===n&&(n=s.index-a.index);var b=Math.round(1e5*Math.sqrt(r*r+n*n))/1e5;t+=$.t("distance: {0}").format(this._numericFormatter.format(b))}t&&h.push("barsRange")}var S=d.showAngle.value();if(S){var C,x=this.Z97.pointToScreenPoint(a),P=this.Z97.pointToScreenPoint(s);if(x=x instanceof Array?x[0]:x instanceof MathEx.Point?x:null,P=P instanceof Array?P[0]:P instanceof MathEx.Point?P:null,x instanceof MathEx.Point&&P instanceof MathEx.Point){var L=P.substract(x);L.length()>0&&(L=L.normalized(),C=Math.acos(L.x),L.y>0&&(C=-C))}"number"!=typeof C||TradingView.isNaN(C)||(i=Math.round(180*C/Math.PI)+"º",h.push("angle"))}this._label=[e,t,i].filter(function(e){return e}).join("\n")||null,this._icons=h,this._labelDataInvalidated=!1}var E={points:[this._points[1]],text:this._label,color:this.Z97.properties().textcolor.value(),font:l.LABEL_FONT,fontsize:l.LABEL_FONTSIZE,lineSpacing:l.LABEL_LINESPACING,backgroundColor:l.LABEL_BGCOLOR,borderColor:l.LABEL_BORDERCOLOR,borderWidth:1,padding:l.LABEL_PADDING,paddingLeft:30,doNotAlignText:!0,icons:this._icons};l.LABEL_OFFSET;return this._points[1].y<this._points[0].y&&(E.vertAlign="bottom"),this._points[1].x<this._points[0].x&&(E.horzAlign="right"),this._labelData=E,E},s.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer;if(this._invalidated)return e;if(!this.Z97.priceScale())return e;var t={};t.points=this._points,t.floatPoints=this._floatPoints,t.width=this.Z98.timeScale().width(),t.height=this.Z97.priceScale().height(),t.color=this.Z97.properties().linecolor.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.linestyle=this.Z97.properties().linestyle.value(),t.extendleft=this.Z97.properties().extendLeft.value(),t.extendright=this.Z97.properties().extendRight.value(),t.leftend=this.Z97.properties().leftEnd.value(),t.rightend=this.Z97.properties().rightEnd.value(),e.append(new a(t));var i=this.isAnchorsRequired(),r=i||this.Z97.properties().alwaysShowStats.value();if(r&&this._label&&2==this._points.length){var n=this._points[1],o={left:0,top:this.Z98._trendLineStatsCache.topByRow(this._statCache.row),width:this.Z98._trendLineStatsCache.rowWidth(this._statCache.row),height:this.Z98._trendLineStatsCache.rowHeight(this._statCache.row)},s={left:n.x,top:n.y,width:o.width,height:o.height};"right"==this._labelData.horzAlign?s.left-=l.LABEL_PADDING+s.width:s.left+=l.LABEL_PADDING,"bottom"==this._labelData.vertAlign?s.top-=l.LABEL_PADDING+s.height:s.top+=l.LABEL_PADDING;var d=this.Z98._trendLineStatsCache.canvas(),h=new TradingView.PaneRendererCachedImage(d.get(0),o,s);e.append(h)}return this.addAnchors(e),!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&t.points.length>=2&&this.Z97.getAlertIsActive(function(i){e.append(new TradingView.PaneRendererClockIcon({point1:t.points[0],point2:t.points[1],color:i?t.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),e},inherit(l,p),l.LABEL_OFFSET=8,l.LABEL_FONT="Arial",l.LABEL_FONTSIZE=12,l.LABEL_LINESPACING=10,l.LABEL_BGCOLOR="rgba(255,255,255,.8)",l.LABEL_BORDERCOLOR="#e3e3e3",l.LABEL_PADDING=8,l.prototype.stop=function(){p.prototype.stop.call(this),this.Z98._trendLineStatsCache.removeSource(this.id())},l.prototype.pointsCount=function(){return 2},l.prototype.title=function(){return"Trend Line"},l.prototype.canHasAlert=function(){return!0},l.prototype._getAlertPlots=function(){return[this._linePointsToAlertPlot(this._points,null,this.properties().extendLeft.value(),this.properties().extendRight.value())]};var f=0,g=1,v=2,m=4,y=8;window.cohenSutherland=function(e,t,i,r,n,o,a,s){for(var l,h,p,c=d(e,t,n,o,a,s),u=d(i,r,n,o,a,s),_=!1,f=0;;){if(f>1e3)throw Error("Cohen - Sutherland algorithm: infinity loop");if(f++,!(c|u)){_=!0;break}if(c&u)break;p=c?c:u,p&y?(l=e+(i-e)*(s-t)/(r-t),h=s):p&m?(l=e+(i-e)*(o-t)/(r-t),h=o):p&v?(h=t+(r-t)*(a-e)/(i-e),l=a):(h=t+(r-t)*(n-e)/(i-e),l=n),p==c?(e=l,t=h,c=d(e,t,n,o,a,s)):(i=l,r=h,u=d(i,r,n,o,a,s))}return _?[e,t,i,r]:!1},t.TrendLineStatsRenderer=n,t.LineToolTrendLine=l,t.TrendLineRenderer=a},function(e,t,i){"use strict";function r(e,t,i){this.m_timeScale=e;var n=t.rightAxisProperties.state();n.autoScale=!0,this.m_rightPriceScale=new l(new Property(n),i.properties().scalesProperties);var o=t.leftAxisProperties.state();o.autoScale=!0,this.m_leftPriceScale=new l(new Property(o),i.properties().scalesProperties),this.m_dataSources=[],this.m_height=0,this.m_width=0,this.m_mainDataSource=null,this.Q0=t,this.Z98=i,this._tagsChanged=new Delegate,t.topMargin.listeners().subscribe(this,r.prototype._updateMargins),t.bottomMargin.listeners().subscribe(this,r.prototype._updateMargins),this._updateMargins(),this._stretchFactor=r.DEFAULT_STRETCH_FACTOR}var n=i(57).ExecutionsPositionController,o=i(13).LineDataSource,a=i(18).PriceDataSource,s=i(59),l=i(60);r.DEFAULT_STRETCH_FACTOR=1e3,r.PANE_ANIMATION_DURATION=500,r.sortSourcesPreOrdered={"Volume@tv-basicstudies":0,ChartEventsSource:1,"Script$TV_DIVIDENDS@tv-scripting":2,"Script$TV_SPLITS@tv-scripting":3,"Script$TV_EARNINGS@tv-scripting":4,LineToolOrder:5,LineToolPosition:6,LineToolExecution:7},r.prototype.destroy=function(){this.Q0.topMargin.listeners().unsubscribe(this,r.prototype._updateMargins),this.Q0.bottomMargin.listeners().unsubscribe(this,r.prototype._updateMargins)},r.prototype.setPaneSize=function(e){var t={large:1,medium:.6,small:.3,tiny:.15};if(!t[e])throw"Unknown size enum value: "+e;this._stretchFactor=t[e]*r.DEFAULT_STRETCH_FACTOR},r.sortSources=function(e){return e.map(function(e){var t=e._constructor;isFunction(e.metaInfo)&&(t=e.metaInfo().id);var i,n=r.sortSourcesPreOrdered[t]||0;return i=n>0?+(1/0):0>n?-(1/0):e.zorder(),[e,n,i]}).sort(function(e,t){return e[1]-t[1]||e[2]-t[2]}).map(function(e){return e[0]})},r.prototype._updateMargins=function(){var e=.01*this.Q0.topMargin.value(),t=.01*this.Q0.bottomMargin.value();this.m_leftPriceScale.setTopMargin(e),this.m_leftPriceScale.setBottomMargin(t),this.m_rightPriceScale.setTopMargin(e),this.m_rightPriceScale.setBottomMargin(t);for(var i=0;i<this.m_dataSources.length;i++){var r=this.m_dataSources[i];r instanceof TradingView.Study&&this.isOverlay(r)&&"Volume"!==r.metaInfo().shortId&&r.priceScale()&&r.priceScale()!==this.m_leftPriceScale&&r.priceScale()==this.m_rightPriceScale&&(r.priceScale().setTopMargin(e),r.priceScale().setBottomMargin(t),this.recalculatePriceScale(r.priceScale()))}this.recalculatePriceScale(this.m_leftPriceScale),this.recalculatePriceScale(this.m_rightPriceScale),this.updateAllViews()},r.prototype.model=function(){return this.Z98},r.prototype.width=function(){return this.m_width},r.prototype.height=function(){return this.m_height},r.prototype.setWidth=function(e){this.m_width=e,this.updateAllViews()},r.prototype.setHeight=function(e){this.m_height=e,this.m_leftPriceScale.setHeight(e),this.m_rightPriceScale.setHeight(e);for(var t=0;t<this.m_dataSources.length;t++){var i=this.m_dataSources[t];this.isOverlay(i)&&i.priceScale()&&i.priceScale().setHeight(e)}this.updateAllViews()},r.prototype.leftPriceScale=function(){return this.m_leftPriceScale},r.prototype.rightPriceScale=function(){return this.m_rightPriceScale},r.prototype.timeScale=function(){return this.m_timeScale},r.prototype.Q17=function(){return this.m_dataSources},r.prototype.isOverlay=function(e){return e._isOverlay},r.prototype._processMainSourceChange=function(){var e;if(null===this.m_mainDataSource)for(var t=0;t<this.m_dataSources.length;t++){var i=this.m_dataSources[t];if(TradingView.isInherited(i.constructor,a)&&!this.isOverlay(i)&&(!i.properties().linkedToSeries||!i.properties().linkedToSeries.value())&&!(i instanceof s)){this.m_mainDataSource=i,e=!0;break}}if(this.m_mainDataSource&&e){for(var n=[],t=0;t<this.m_dataSources.length;t++){var i=this.m_dataSources[t];TradingView.isInherited(i.constructor,o)&&n.push(i)}n=r.sortSources(n);for(var t=0;t<n.length;t++)this.move(n[t],this.m_mainDataSource.priceScale(),!0)}else if(!this.m_mainDataSource)for(var t=0;t<this.m_dataSources.length;t++){var i=this.m_dataSources[t];if(TradingView.isInherited(i.constructor,a)&&this.isOverlay(i)&&i.showInObjectTree()){this.m_mainDataSource=i,this.m_rightPriceScale.addDataSource(i),i.setPriceScale(this.m_rightPriceScale);for(var l,d=this.Z98.children(i),h=0;h<d.length;h++)l=d[h],this.m_rightPriceScale.addDataSource(l),l.setPriceScale(this.m_rightPriceScale);this.recalculatePriceScale(this.m_rightPriceScale),i._isOverlay=!1;break}}},r.prototype._newZOrderForLineTool=function(){var e=this.m_dataSources.reduce(function(e,t){return t instanceof o?Math.max(e,t.zorder()):e},this.getZOrderMinMax().minZOrder-1);return this.m_dataSources.forEach(function(t){t.zorder()>e&&t.setZorder(t.zorder()+1)}),e+1},r.prototype.addDataSource=function(e,t,i){var r;r=e instanceof o&&!i?this._newZOrderForLineTool():this.getZOrderMinMax().minZOrder-1,this.insertDataSource(e,t,r)},r.prototype.insertDataSource=function(e,t,i){this.m_dataSources.push(e);var n=!1;if(null!==this.m_mainDataSource||e instanceof s||(this.m_mainDataSource=e,n=!0),e._isOverlay=!1,null===t){var o=this.m_rightPriceScale.topMargin(),d=this.m_rightPriceScale.bottomMargin();e.metaInfo&&"Volume@tv-basicstudies"==e.metaInfo().id&&(o=.75,d=0),t=new l(new Property(this.Q0.overlayPropreties.state()),this.Z98.properties().scalesProperties),t.setHeight(this.m_height),t.setTopMargin(o),t.setBottomMargin(d),e._isOverlay=!0}t.addDataSource(e),e.setPriceScale(t),e.onTagsChanged&&e.onTagsChanged().subscribe(this,r.prototype.onSourceTagsChanged),e.setZorder(i),n&&this._processMainSourceChange(),e instanceof s||this.updateAlertLabelsSources(),this._tagsChanged.fire(),TradingView.isInherited(e.constructor,a)&&this.recalculatePriceScale(t),this.invalidateSourcesCache()},r.prototype.removeDataSource=function(e,t){var i=this.m_dataSources.indexOf(e);if(-1===i)return void TradingView.logDebugChart("removeDataSource: invalid data source");e._isOverlay=!1,this.m_dataSources.splice(i,1),e!==this.m_mainDataSource||t||(this.m_mainDataSource=null);var n=null;-1!==this.m_leftPriceScale.Q17().indexOf(e)?(this.m_leftPriceScale.removeDataSource(e),n=this.m_leftPriceScale):-1!==this.m_rightPriceScale.Q17().indexOf(e)&&(this.m_rightPriceScale.removeDataSource(e),n=this.m_rightPriceScale),e.onTagsChanged&&e.onTagsChanged().unsubscribe(this,r.prototype.onSourceTagsChanged),TradingView.isInherited(e.constructor,a)&&this._processMainSourceChange(),e instanceof s||this.Z98.mainSeries()!==e||this.updateAlertLabelsSources(),this._tagsChanged.fire(),n&&TradingView.isInherited(e.constructor,a)&&this.recalculatePriceScale(n),this.invalidateSourcesCache()},r.prototype.updateAlertLabelsSources=function(){var e,t,i,r=this,n=this.containsMainSeries(),o=this.Z98.alertsList(),a=function(e){var t=r.Q17().filter(function(t){return t instanceof s?t.data==e:!1})[0];return t};if(o){e=$.map($.grep(this.Q17(),function(e){return e instanceof s}),function(e){return e.alert().id}),o=o.models;for(var l=o.length-1;l>=0;l--){if(t=o[l],i=-1!==e.indexOf(t.id),!i&&(n||!t.isOHLC())){var d=new s(this.Z98,t),h=this.rightPriceScale()||this.leftPriceScale();this.addDataSource(d,h)}if(i&&!n&&t.isOHLC()){var d=a(t);d&&this.removeDataSource(d)}}}},r.prototype.startScalePrice=function(e,t){e.startScale(t)},r.prototype.scalePriceTo=function(e,t){e.scaleTo(t),this.updateAllViews()},r.prototype.endScalePrice=function(e){e.endScale()},r.prototype.startScrollPrice=function(e,t){e.startScroll(t)},r.prototype.scrollPriceTo=function(e,t){e.scrollTo(t),this.updateAllViews()},r.prototype.endScrollPrice=function(e){e.endScroll()},r.prototype.setPriceAutoScale=function(e,t){return e.setAutoScale(t),this.timeScale().isEmpty()?void e.setPriceRange(null):void this.recalculatePriceScale(e)},r.prototype.restorePriceScaleState=function(e,t){e.restoreState(t),this.updateAllViews()},r.prototype.updateAllViews=function(){for(var e=0;e<this.m_dataSources.length;e++)this.m_dataSources[e].updateAllViews()},r.prototype.defaultPriceScale=function(){var e=this.m_mainDataSource?this.m_mainDataSource.priceScale():this.rightPriceScale();return void 0===e&&(e=new l(new Property(this.Q0.overlayPropreties.state()),this.Z98.properties().scalesProperties)),e},r.prototype._priceScaleIsPrice=function(e){var t=e.mainSource();return t?TradingView.isInherited(t.constructor,TradingView.Series)?!0:TradingView.isInherited(t.constructor,TradingView.Study)?t.metaInfo().is_price_study:!1:!1},r.prototype.findSuitableScale=function(e){if(TradingView.isInherited(e.constructor,TradingView.Study)&&"Volume@tv-basicstudies"==e.metaInfo().id)return this.m_rightPriceScale.mainSource()||this.m_leftPriceScale.mainSource()?null:this.m_rightPriceScale;var t=!1;if(TradingView.isInherited(e.constructor,TradingView.Study)?t=e.metaInfo().is_price_study:TradingView.isInherited(e.constructor,TradingView.Series)&&(t=!0),t){if(this._priceScaleIsPrice(this.m_rightPriceScale))return this.m_rightPriceScale;if(this._priceScaleIsPrice(this.m_leftPriceScale))return this.m_leftPriceScale}return this.m_rightPriceScale.mainSource()?this.m_leftPriceScale.mainSource()?null:this.m_leftPriceScale:this.m_rightPriceScale},r.prototype.mainDataSource=function(){return this.m_mainDataSource},r.prototype.recalculatePriceScale=function(e){if(e){if(e.isAutoScale()&&!this.timeScale().isEmpty()){var t=this.timeScale().visibleBars();e.recalculatePriceRange(t)}e.updatePaneViews()}},r.prototype.resetPriceScale=function(e){var t=this.timeScale().visibleBars();e.mainSource()instanceof TradingView.Series&&e.mainSource().isLockScale()||e.setAutoScale(!0),e.recalculatePriceRange(t),this.updateAllViews()},r.prototype.recalculate=function(){this.recalculatePriceScale(this.m_rightPriceScale),this.recalculatePriceScale(this.m_leftPriceScale);for(var e=0;e<this.m_dataSources.length;e++){var t=this.m_dataSources[e];!this.isOverlay(t)||t instanceof o||this.recalculatePriceScale(t.priceScale())}this.updateAllViews(),this.Z98.updatePane(this)},r.prototype.isEmpty=function(){return null===this.m_mainDataSource},r.prototype.move=function(e,t,i){var r=this.m_dataSources.slice(),n=null!==t;this.removeDataSource(e,n),this.addDataSource(e,t,i),this.m_dataSources=r,this.invalidateSourcesCache()},r.prototype.dataSourceForId=function(e){for(var t=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)return this.m_dataSources[t];return null},r.prototype.priceScaleForSource=function(e){return-1!==this.rightPriceScale().Q17().indexOf(e)?this.rightPriceScale():-1!==this.leftPriceScale().Q17().indexOf(e)?this.leftPriceScale():null},r.prototype.sourceById=function(e){for(var t=0;t<this.m_dataSources.length;t++)if(this.m_dataSources[t].id()===e)return this.m_dataSources[t];return null},r.prototype.containsMainSeries=function(){return-1!==this.m_dataSources.indexOf(this.Z98.mainSeries())},r.prototype.priceScaleByName=function(e){return"left"===e?this.m_leftPriceScale:"right"===e?this.m_rightPriceScale:null},r.prototype.priceScaleName=function(e){return e===this.m_leftPriceScale?"left":e===this.m_rightPriceScale?"right":""},r.prototype.hitTestSources=function(){if(this._cachedHitTestSources)return this._cachedHitTestSources;for(var e=this.orderedSources(),t=[],i=[],r=0;r<e.length;r++){var n=e[r];TradingView.isInherited(n.constructor,o)?t.push(n):i.push(n)}return this._cachedHitTestSources=i.concat(t),this._cachedHitTestSources},r.prototype.orderedSources=function(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;for(var e=[],t=0,i=this.m_dataSources.length;i>t;t++){var n=this.m_dataSources[t];TradingView.isInherited(n.constructor,o)&&!n.isActualSymbol()||e.push(n)}return e=r.sortSources(e),this._cachedOrderedSoruces=e,e},r.prototype.invalidateSourcesCache=function(){this._cachedOrderedSoruces=null,this._cachedHitTestSources=null,this.m_leftPriceScale.invalidateSourcesCache(),this.m_rightPriceScale.invalidateSourcesCache()},r.prototype.getZOrderMinMax=function(){var e=this.orderedSources();if(0===e.length)return{minZOrder:0,maxZOrder:0};for(var t=e[0].zorder(),i=e[0].zorder(),r=1;r<e.length;r++){var n=e[r];n.zorder()<t&&(t=n.zorder()),n.zorder()>i&&(i=n.zorder())}return{minZOrder:t,maxZOrder:i}},r.prototype.sendToBack=function(e){for(var t=this.getZOrderMinMax().minZOrder,i=Math.abs(e.zorder()-t),r=0;i>r;r++)this.changeZOrder(e,-1)},r.prototype.bringToFront=function(e){for(var t=this.getZOrderMinMax().maxZOrder,i=Math.abs(e.zorder()-t),r=0;i>r;r++)this.changeZOrder(e,1)},r.prototype.changeZOrder=function(e,t){for(var i=this.orderedSources().filter(function(e){return e.showInObjectTree()}),r=0,n=0,o=i.length;o>n;n++)if(i[n]===e){r=n;break}if(r>0&&0>t){var a=i[r-1].zorder(),s=e.zorder();i[r-1].setZorder(s),e.setZorder(a)}else if(r<i.length-1&&t>0){var l=i[r+1].zorder(),s=e.zorder();i[r+1].setZorder(s),e.setZorder(l)}this.invalidateSourcesCache()},r.prototype.onSourceTagsChanged=function(){this._tagsChanged.fire()},r.prototype.onTagsChanged=function(){return this._tagsChanged},r.prototype.dumpPriceScale=function(e){for(var t=e.Q17(),i=[],r=0;r<t.length;r++){var n=t[r].priceAxisViews(this,e);if(n)for(var o=0;o<n.length;o++)i.push(n[o].dump())}return i},r.prototype.dumpViews=function(){var e={};e.paneViews={};for(var t=this.orderedSources(),i=0;i<t.length;i++){var r=t[i];e.paneViews[i]=[];var n=r.paneViews();if(n)for(var o=0;o<n.size();o++)e.paneViews[i].push(n.item(i).dump())}return e.leftAxis=this.dumpPriceScale(this.m_leftPriceScale),e.rightAxis=this.dumpPriceScale(this.m_rightPriceScale),e},r.prototype.clearSeries=function(){for(var e=this.m_dataSources.length-1;e>=0;e--)TradingView.isInherited(this.m_dataSources[e].constructor,TradingView.Series)&&this.m_dataSources.splice(e,1)},r.prototype.actionNoScaleIsEnabled=function(e){return this.isOverlay(e)||!TradingView.isInherited(e.constructor,a)?!0:this.m_dataSources.filter(function(e){return e.properties().linkedToSeries&&e.properties().linkedToSeries.value()?!1:TradingView.isInherited(e.constructor,a)&&e.showInObjectTree()&&!e.isNoScale()}).length>1},r.prototype.executionsPositionController=function(){return this._executionsPositionController||(this._executionsPositionController=new n(this,this.Z98.timeScale())),this._executionsPositionController},e.exports=r},function(e,t,i){"use strict";
function r(e,t){this._pane=e,this._timeScale=t}function n(e){this._line=e}function o(e,t){this._data=e,this._adapter=t}function a(e,t){l.call(this,e,t),this._invalidated=!0}function s(e,t){this._adapter=new n(this),this._constructor="LineToolExecution";var i=t||new J50("linetoolexecution");this.customization={forcePriceAxisLabel:!1,disableSelection:!0,disableErasing:!0},d.call(this,e,new a(this,e),i)}var l=i(44),d=i(13).LineDataSource,h=i(58);r.prototype.getYCoordinate=function(e){var t=0,i=e.getDirection(),r=e._index,n=this._pane.mainDataSource();if(n.bars){var o="buy"==i?10:-10,a=n.bars().search(r,TradingView.SEARCH_NEAREST_LEFT);if(a){r=a.index;var l="buy"==i?a.value[TradingView.LOW_PLOT]:a.value[TradingView.HIGH_PLOT],d=n.priceScale();if(d.isPercent()){var h=n.firstValue();l=d.priceRange().convertToPercent(l,h)}t=d.priceToCoordinate(l)+o}}for(var p=this._pane.orderedSources(),c=p.length-1;c>=0;--c){var u=p[c];if(u instanceof s&&u._adapter.getDirection()==i&&u._adapter._index==r){if(u==e._line)break;t="buy"==i?t+u._adapter._height():t-u._adapter._height()}}return t},n.prototype._height=function(){var e=this.getArrowHeight(),t=this.getArrowSpacing(),i=0;this.getText()&&h.fontHeight(this.getFont());var r=10;return e+t+i+r},n.prototype.getIndex=function(){var e=this._line.Z98.timeScale(),t=e.m_points.lastTimePointIndex(),i=this._line.points()[0].index;return t-i},n.prototype.setIndex=function(e){var t=this._line.Z98.timeScale(),i=t.m_points.lastTimePointIndex(),r=i-Math.abs(e);this._line.startMoving(this._line.points()[0]);var n=TradingView.merge({},this._line.points()[0]);return n.index=r,this._line.move(n),this._line.endMoving(),this},n.prototype.getTime=function(){return this._unixtime},n.prototype.setTime=function(e){var t=this._line.Z98.mainSeries();return this._unixtime=Q14.alignTimePoint?Q14.alignTimePoint(e,t.interval(),t.symbolInfo()):e,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this},n.prototype.getPrice=function(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0},n.prototype.setPrice=function(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},n.prototype.getText=function(){return this._line.properties().text.value()},n.prototype.setText=function(e){return this._line.properties().text.setValue(e||""),this._line.updateAllViewsAndRedraw(),this},n.prototype.getArrowHeight=function(){return this._line.properties().arrowHeight.value()},n.prototype.setArrowHeight=function(e){return this._line.properties().arrowHeight.setValue(e||5),this},n.prototype.getArrowSpacing=function(){return this._line.properties().arrowSpacing.value()},n.prototype.setArrowSpacing=function(e){return this._line.properties().arrowSpacing.setValue(e||1),this},n.prototype.getDirection=function(){return this._line.properties().direction.value()},n.prototype.setDirection=function(e){return this._line.properties().direction.setValue(e||"buy"),this},n.prototype.getArrowColor=function(){return h.getColorFromProperties(this._line.properties().arrowColor,this._line.properties().arrowTransparency)},n.prototype.setArrowColor=function(e){return h.setColorToProperties(e,this._line.properties().arrowColor,this._line.properties().arrowTransparency),this},n.prototype.getTextColor=function(){return h.getColorFromProperties(this._line.properties().textColor,this._line.properties().textTransparency)},n.prototype.setTextColor=function(e){return h.setColorToProperties(e,this._line.properties().textColor,this._line.properties().textTransparency),this},n.prototype.getFont=function(){return h.getFontFromProperties(this._line.properties().fontFamily,this._line.properties().fontSize,this._line.properties().fontBold,this._line.properties().fontItalic)},n.prototype.setFont=function(e){return h.setFontToProperties(e,this._line.properties().fontFamily,this._line.properties().fontSize,this._line.properties().fontBold,this._line.properties().fontItalic),this},n.prototype.setTooltip=function(e){return null==e?e="":e+="",this._line.properties().tooltip.setValue(e),this},n.prototype.getTooltip=function(){return this._line.properties().tooltip.value()},n.prototype.remove=function(){this._line.Z98.removeSource(this._line),delete this._line},o.prototype._textWidth=function(e){if(0===this._adapter.getText().length)return 0;e.save(),e.font=this._adapter.getFont();var t=5,i=e.measureText(this._adapter.getText()).width;return e.restore(),t+i},o.prototype._drawArrow=function(e,t,i){e.save(),e.strokeStyle=this._adapter.getArrowColor(),e.fillStyle=this._adapter.getArrowColor();var r=function(e,t){CanvasEx.drawLine(e,0,0,0,t),CanvasEx.drawLine(e,-1,1,1,1),CanvasEx.drawLine(e,-2,2,2,2)},n=this._adapter.getArrowHeight(),o=this._adapter.getDirection();e.translate(t,i),"buy"!=o&&e.rotate(Math.PI),r(e,n),e.restore()},o.prototype._drawText=function(e,t,i){var r=this._adapter.getText();if(r){e.save(),e.textAlign="center",e.textBaseline="middle",e.font=this._adapter.getFont(),e.fillStyle=this._adapter.getTextColor();var n=t+this._textWidth(e)/2,o=i+h.fontHeight(this._adapter.getFont())/2;e.fillText(r,n,o-1),e.restore()}},o.prototype.draw=function(e){if(this._data.points&&!(this._data.points.length<s.POINTS_COUNT)){var t=Math.round(this._data.points[0].x+.5),i=Math.round(this._data.points[0].y);this._drawArrow(e,t,i);var r=this._textWidth(e);if(0!==r){var n=this._adapter.getArrowHeight(),o=this._adapter.getArrowSpacing(),a=h.fontHeight(this._adapter.getFont()),l=this._adapter.getDirection(),d="buy"==l?i+n+o:i-n-o-a;this._drawText(e,Math.round(t-r/2),d)}}},o.prototype.hitTest=function(e){if(this._data.points&&!(this._data.points.length<s.POINTS_COUNT)){var t,i,r=Math.round(this._data.points[0].x),n=Math.round(this._data.points[0].y),o=this._adapter.getArrowHeight();if("buy"==this._adapter.getDirection()?(t=n,i=n+o):(t=n-o,i=n),e.x>=r-2&&e.x<=r+2&&e.y>=t&&e.y<=i){var a=this._adapter.getTooltip();return new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{mouseDownHandler:function(){TradingView.TradingWidget&&TradingView.TradingWidget.journalDialog()},tooltip:""!==a?{text:a,rect:new TradingView.Rect(r,t,2,i-t)}:null})}}},inherit(a,l),a.prototype._renderer=null,a.prototype._rendererCached=!1,a.prototype.update=function(){this._invalidated=!0},a.prototype.updateImpl=function(){l.prototype.update.call(this),this._renderer=null,this._rendererCached=!1,this._invalidated=!1},a.prototype.renderer=function(){if(this._invalidated&&this.updateImpl(),this._rendererCached)return this._renderer;this._rendererCached=!0;var e=this.Z97,t=e._adapter,i=e.Z98.timeScale();if(0===e.points().length)return null;var r=e.points()[0].index,n=e.Z98.mainSeries(),a=n.bars().search(r,TradingView.SEARCH_NEAREST_LEFT);if(a&&(r=a.index),t._index=r,!isFinite(r))return this._renderer=null,null;var s=i.visibleBars();if(!s||r>s.lastBar()||r<s.firstBar())return this._renderer=null,null;var l=this.Z97.Z98.paneForSource(this.Z97).executionsPositionController(),d=i.indexToCoordinate(r),h=l.getYCoordinate(t);if(!isFinite(h))return this._renderer=null,null;var p=[new MathEx.Point(d,h)],c={points:p};return this._renderer=new o(c,t),this._renderer},inherit(s,d),s.POINTS_COUNT=1,s.skipMagnetting=!0,s.prototype.pointsCount=function(){return s.POINTS_COUNT},s.prototype.title=function(){return"Execution"},s.prototype.hasContextMenu=function(){return!1},s.prototype.state=function(){return null},s.prototype.paneViews=function(e){return TradingView.printing?null:this.Z98.properties().tradingProperties.showExecutions.value()?d.prototype.paneViews.call(this,e):null},s.prototype.userEditEnabled=function(){return!1},s.prototype.showInObjectTree=function(){return!1},t.ExecutionsPositionController=r,t.LineToolExecution=s},function(e,t){"use strict";var i={_fontHeightCache:{}};i._parseColor=function(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);return $(t).remove(),{r:i[1],g:i[2],b:i[3],a:i[4]||"1"}},i.getColorFromProperties=function(e,t){var i=1-t.value()/100,r=this._parseColor(e.value());return"rgba("+r.r+","+r.g+","+r.b+","+i+")"},i.setColorToProperties=function(e,t,i){var r=this._parseColor(e);t.setValue("rgb("+r.r+","+r.g+","+r.b+")");var n=100*(1-r.a);i.setValue(Math.max(0,Math.min(n,100)))},i._parseFont=function(e){var t=document.createElement("div");t.style.font=e;var i=t.style.fontSize.match(/(\d+)pt/),r=i&&i[0]==t.style.fontSize,n={family:t.style.fontFamily,size:r?i[1]:"",bold:"bold"==t.style.fontWeight,italic:"italic"==t.style.fontStyle};return $(t).remove(),n},i.getFontFromProperties=function(e,t,i,r){var n=i.value()?"bold":"",o=r.value()?"italic":"",a=t.value()+"pt",s=e.value();return[n,o,a,s].join(" ")},i.setFontToProperties=function(e,t,i,r,n){var o=this._parseFont(e);o.family.length>0&&t.setValue(o.family),o.size.length>0&&i.setValue(o.size),r.setValue(o.bold),n.setValue(o.italic)},i.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]},i.drawPolyHoverOrPress=function(e,t,i,r){r?(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())},i.repaint=function(e){var t=new $21($21.LIGHT_UPDATE);t.force=!0,e.Q18(t)},i.roundToMinTick=function(e,t){var i=e.mainSource().base(),r=1/i;return r*Math.round(t/r)},e.exports=i},function(e,t,i){"use strict";function r(e,t){d.call(this),this.m_model=e,this._data=t,this._paneView=new n(this,e),this._resetUserEditEnabled(),this._resetProperties(),this.hasAlert.setValue(!0),t.on("change:id",this._resetProperties.bind(this)),t.on("change:id",this._resetUserEditEnabled.bind(this)),t.on("change:extra",this._resetUserEditEnabled.bind(this))}function n(e,t){this.m_alertLabel=e,this.m_model=t,this.m_item=null,this._invalidated=!0,this.labelWidth=10,this.m_alertLabel.alert().on("fired",this.highlight.bind(this)),this.m_alertLabel.alert().on("change:hovered",this.updateHover.bind(this))}function o(e){e.items=[e.item.points[0]],TradingView.PaneRendererTriangleApexLeft.call(this,e)}function a(e){this.points=e.item.points,this.alert=e.item.alert,this.borderColor=e.color,this.cursor=e.cursor,this.labelWidth=e.width}function s(e){this.color=e.color,this.points=e.item.points,this.lineWidth=e.lineWidth,this.lineStyle=e.lineStyle}function l(e){this.item=e.item,this.height=e.height,this.width=e.width,this.color=e.color,this.horzLineWidth=e.lineWidth,this.connectingLineWidth=e.connectingLineWidth}var d=i(18).DataSource;inherit(r,d),r.prototype._resetUserEditEnabled=function(){var e=this._data;this._userEditEnabled=!e.isNew()&&e.isPrice()&&e.get("extra")},r.prototype._resetProperties=function(){var e=this._data,t=e.TVSettingsPropertiesKey(),i=TVSettings.getJSON(t,{}),r=TradingView.factoryDefaults("chartproperties.alertsProperties."+(e.isNew()?"fakeLabels":"labels"));e.isNew()||(r.color=""),r.highlightColor="",r.line.style="",r.line.width="",TradingView.merge(r,i),this.Q0=new J50(t,r,!0)},r.prototype.data=function(){return this._data},r.prototype.alert=r.prototype.data,r.prototype.alertId=function(){return this.alert().id},r.prototype.getAlert=function(){var e=$.Deferred();return e.resolve(this.alert()),e.promise()},r.prototype.state=function(){var e=this.alert().get("extra"),t=[];return e&&e.conditionData().isChannel?(t.push({price:e.price().upper}),t.push({price:e.price().lower})):t.push({price:e.price()}),{points:t}},r.prototype.restorePoints=function(e,t){var i=this.alert().get("extra");i.conditionData().isChannel?i.price({upper:e[0].price,lower:e[1].price}):i.price(e[0].price)},r.prototype.createServerPoints=function(){},r.prototype.properties=function(){return this.Q0},r.prototype.globalProperties=function(){return this.m_model.properties().alertsProperties.labels},r.prototype.paneViews=function(){return TradingView.printing?null:this.properties().visible.value()&&this.globalProperties().visible.value()?[this._paneView]:null},r.prototype.dataWindowView=function(){return null},r.prototype.priceAxisViews=function(){return null},r.prototype.statusView=function(){return null},r.prototype.updateAllViews=function(){this._paneView.update()},r.prototype.pointsCount=function(){return 0},r.prototype.title=function(){return this.alert().title()},r.prototype.startMoving=function(e,t){this._userEditEnabled=!1,this._startMovingPoint=e,this.alert().saveState()},r.prototype.move=function(e,t){var i=e.price,r=this.alert().get("extra");this.priceScale().formatter()&&this.priceScale().formatter().formatAsDecimal&&(i=this.priceScale().formatter().formatAsDecimal(i)),r.conditionData().isChannel&&(0===t?i={upper:i}:1===t&&(i={lower:i})),r.price(i),this._currentMovingPoint=e},r.prototype.endMoving=function(){function e(){setTimeout(function(){t._undoMode=!0,n.undo(),t._undoMode=!1},0)}var t=this,i=this._startMovingPoint,r=this._currentMovingPoint,n=this.m_model._undoModel;this._userEditEnabled=!0,delete this._startMovingPoint,delete this._currentMovingPoint,i&&r&&i!==r&&!this._undoMode&&TradingView.alertsDispatcher.openEditDialog(this.alert(),{onEditCancel:e,generateNewDecription:!0})},r.prototype.showInObjectTree=function(){return!1},r.prototype.isRemovedByStudyTemplates=function(){return!1},r.prototype.isUserDeletable=function(){return!1},n.prototype.update=function(){this._invalidated=!0},n.prototype.Q18=function(){this.m_model.Q18(new $21($21.FULL_UPDATE))},n.prototype.highlight=function(){var e=function(){this._highlighted=!0,this.update(),this.Q18(),setTimeout(t,500)}.bind(this),t=function(){this._highlighted=!1,this.update(),this.Q18()}.bind(this);e(),setTimeout(e,1e3)},n.prototype.updateHover=function(e,t){this._hovered=!!t,this.update(),this.Q18()},n.prototype._updateImpl=function(){var e,t,i=this,r=this.m_alertLabel.alert(),n=r.isPrice()&&(r.get("resolution")==$44.interval.value()||r.get("crossInterval")),o=[],a=-1,s=function(e){if(i.m_alertLabel.priceScale().isPercent()){var t=i.m_model.paneForSource(i.m_alertLabel).mainDataSource().firstValue();e=i.m_alertLabel.priceScale().priceRange().convertToPercent(e,t)}return i.m_alertLabel.priceScale().priceToCoordinate(e)};if(!n)return void(this.m_item=null);if(e=this.m_model.paneForSource(this.m_alertLabel).width()-this.labelWidth/2+a,t=r.get("extra").price(),r.get("extra").conditionData().isChannel){var l=s(t.upper),d=s(t.lower);o.push(new MathEx.Point(e,l)),o.push(new MathEx.Point(e,d))}else{var h=s(t);o.push(new MathEx.Point(e,h))}this.m_item={alert:r,points:o},this.m_alertLabel===this.m_model.selectedSource()?this._selectionData={points:o,hittestResult:TradingView.HitTestResult.MOVEPOINT}:this._selectionData=null},n.prototype.color=function(){var e;return e=this._highlighted?this.m_alertLabel.globalProperties().highlightColor.value():this.m_alertLabel.properties().color.value()||this.m_alertLabel.globalProperties().color.value()},n.prototype.renderer=function(){if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),this.m_item){var e=this.m_alertLabel,t=this.m_model,i=this.m_item.alert,r={};r.item=this.m_item,r.barSpacing=t.timeScale().barSpacing(),r.height=this._hovered?12:10,r.width=this._hovered?this.labelWidth+2:this.labelWidth,r.connectingLineWidth=this._hovered?3:1,r.color=this.color(),r.lineWidth=(e.properties().line.width.value()||e.globalProperties().line.width.value())+(this._hovered?2:0),r.lineStyle=e.properties().line.style.value()||e.globalProperties().line.style.value(),r.cursor=t.crossHairSource();var n=new TradingView.CompositeRenderer;i.get("extra").conditionData().isChannel?n.append(new l(r)):n.append(new o(r)),e.properties().line.visible.value()&&e.globalProperties().line.visible.value()&&n.append(new s(r));var d=e===t.hoveredSource();d&&n.append(new a(r));var h=e===t.selectedSource();return h&&n.append(new TradingView.SelectionRenderer(this._selectionData)),n}},inherit(o,TradingView.PaneRendererTriangleApexLeft),o.prototype.hitTest=function(e){return Z50.prototype.hitTest.call(this,e,TradingView.HitTestResult.MOVEPOINT)},a.prototype.draw=function(e){var t,i=1,r=(this.borderColor,"#FFFFFF"),n=12,o="#000",a=8,s=20,l=20,d=5,h=["Alert: "+this.alert.get("description")];e.font=n+"px Arial, sans-serif";var p=2*s+MathEx.max($.map(h,function(t){return e.measureText(t).width||0})),c=h.length*n+2*a+(h.length-1)*a,u=2===this.points.length;if(u){var _,f,g=this.points[0],v=this.points[1],m=this.cursor.x<g.x-this.labelWidth;m?(_=this.cursor.x,f=Math.abs(v.y-this.cursor.y)<Math.abs(g.y-this.cursor.y)?v.y:g.y):(_=g.x,f=this.cursor.y,f=Math.min(v.y,f),f=Math.max(g.y,f)),t=new MathEx.Point(_,f)}else t=new MathEx.Point(this.cursor.x,this.points[0].y);var y={x:t.x-l-d-p,y:t.y-c/2};e.lineWidth=i,e.strokeStyle=this.borderColor,e.fillStyle=r,e.translate(y.x,y.y),e.beginPath(),e.moveTo(0,0),e.lineTo(p,0),e.lineTo(p,c/2-d),e.lineTo(p+d,c/2),e.lineTo(p,c/2+d),e.lineTo(p,c),e.lineTo(0,c),e.lineTo(0,0),e.stroke(),e.fill(),e.textBaseline="bottom",e.fillStyle=o;for(var w=0,T=s,b=0;b<h.length;b++)w+=a+n,e.fillText(h[b],T,w);e.translate(-y.x,-y.y)},a.prototype.hitTest=function(){return null},s.prototype.draw=function(e){var t,i;e.lineWidth=this.lineWidth,e.strokeStyle=this.color,CanvasEx.setLineStyle(e,this.lineStyle);for(var r=0;r<this.points.length;r++)i=this.points[r].y,t=this.points[r].x,e.beginPath(),e.moveTo(t,i),e.lineTo(0,i),e.stroke()},s.prototype.hitTest=function(e){for(var t,i,r=3,n=0;n<this.points.length;n++)if(t=this.points[n].y,Math.abs(t-e.y)<=r)return i=n,new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,i);return null},l.prototype._claculateTriangleHeight=function(e,t){var i=this.height;return e.y<=t.y&&(i=Math.min(i,Math.abs(e.y-t.y)/2)),i},l.prototype.draw=function(e){var t=this.item.points[0],i=this.item.points[1],r=this._claculateTriangleHeight(t,i),n=this.width,o=this.connectingLineWidth,a=this.horzLineWidth/2;e.fillStyle=this.color,e.strokeStyle=this.color,e.lineWidth=o,e.beginPath(),e.moveTo(t.x-n/2,t.y-a),e.lineTo(t.x+n/2,t.y-a),e.lineTo(t.x+n/2,t.y+r),e.closePath(),e.fill(),e.beginPath(),e.moveTo(i.x-n/2,i.y+a),e.lineTo(i.x+n/2,i.y+a),e.lineTo(i.x+n/2,i.y-r),e.closePath(),e.fill(),i.y<t.y||(e.beginPath(),e.moveTo(i.x+n/2,i.y),e.lineTo(t.x+n/2,t.y),e.stroke())},l.prototype.hitTest=function(e){var t,i=this.item.points[0],r=this.item.points[1],n=this.width,o=this._claculateTriangleHeight(i,r),a=i.x-n/2<=e.x&&e.x<=i.x+n/2&&i.y<=e.y&&e.y<=i.y+o,s=r.x-n/2<=e.x&&e.x<=r.x+n/2&&r.y-o<=e.y&&e.y<=r.y;a?t=0:s&&(t=1);var l=3,d=Math.abs(e.x-(i.x+n/2))<=l&&i.y<=e.y&&e.y<=r.y;return void 0!==t?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,t):d?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},e.exports=r},function(e,t,i){"use strict";function r(e,t){if(this.m_base=e,this.m_integralDividers=t,this.m_fractionalDividers=[],MathEx.isBaseDecimal(this.m_base))this.m_fractionalDividers=[2,2.5,2];else for(var i=this.m_base;1!==i;){if(i%2===0)this.m_fractionalDividers.push(2),i/=2;else{if(i%5!==0)throw new RangeError("unexpected base");this.m_fractionalDividers.push(2),this.m_fractionalDividers.push(2.5),i/=5}if(this.m_fractionalDividers.length>100)throw Error("something wrong with base")}}function n(e,t,i){this.m_marks=[],this.m_base=t,this.m_priceScale=e,this._formatter=i,i&&(this._cache=new p(function(e){return i.format(e)})),this._currentFormatBase=0}function o(e){for(var t=1;e*t!==Math.round(e*t);)t*=10;return t}function a(e,t){function i(){for(var e=r.m_dataSources,t=0;t<e.length;t++){var i=e[t];i.priceScaleChanged&&i.priceScaleChanged.fire(r)}}this.Q0=e,this._scalesProperties=t,this.m_height=0,this.m_priceRange=null,this.m_dataSources=[],this.m_topMargin=0,this.m_bottomMargin=0,this._studyTopMargin=0,this._studyBottomMargin=0,this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_priceRangeSnapshot=null,this._invalidatedForRange={isValid:!0},this.m_markBuilder=new n(this,100,new TradingView.PriceFormatter(100)),this.Q0.percentage.listeners().subscribe(this,a.prototype.updateFormatter);var r=this;this.Q0.log.listeners().subscribe(null,function(e){if(r.m_priceRange){var t=r.m_priceRange;e.value()?r.m_priceRange=new PriceRange(r._toLog(t.minValue()),r._toLog(t.maxValue())):r.m_priceRange=new PriceRange(r._fromLog(t.minValue()),r._fromLog(t.maxValue()))}}),this.Q0.percentage.listeners().subscribe(null,function(){r.Q0.autoScale.setValue(!0)}),this.Q0.percentage.listeners().subscribe(null,function(){r.Q0.autoScaleDisabled.setValue(r.Q0.percentage.value());var e=r.priceRange();if(!(!r.mainSource()||r.mainSource().model().timeScale().isEmpty()||r.mainSource().data().isEmpty()||r.mainSource()instanceof _&&!r.mainSource().properties().lockScale.value())&&e){var t=r.mainSource().model().timeScale().visibleBars(),i=r.mainSource().data().search(t.firstBar(),TradingView.SEARCH_NEAREST_RIGHT).value[TradingView.CLOSE_PLOT];null!=e&&void 0!==i&&(r.Q0.percentage.value()?r.setPriceRange(e.convertToPercents(i)):r.setPriceRange(e.convertFromPercents(i)))}}),this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this._hasSeries=!1,this.Q0.percentage.listeners().subscribe(null,i),this.Q0.log.listeners().subscribe(null,i),this.Q0.listeners().subscribe(null,function(){r.mainSource()&&r.mainSource().model()&&r.mainSource().model().fullUpdate()})}var s=i(61),l=s.study_Script$TV_EARNINGS,d=s.study_Script$TV_SPLITS,h=s.study_Script$TV_DIVIDENDS,p=i(64),c=i(13).LineDataSource,u=i(18).PriceDataSource,_=i(31);r.prototype.TICK_SPAN_EPSILON=1e-9,r.prototype.tickSpan=function(e,t,i){var r,n=0===this.m_base?0:1/this.m_base,o=this.TICK_SPAN_EPSILON,a=Math.pow(10,Math.max(0,Math.ceil(MathEx.log10(e-t)))),s=0;for(s=0,r=this.m_integralDividers[0];a>n+o&&MathEx.greaterOrEqual(a,n,o)&&MathEx.greaterOrEqual(a,i*r,o)&&MathEx.greaterOrEqual(a,1,o);++s,r=this.m_integralDividers[s%this.m_integralDividers.length])a/=r;if(n+o>=a&&(a=n),a=Math.max(1,a),this.m_fractionalDividers.length>0&&MathEx.equal(a,1,o))for(s=0,r=this.m_fractionalDividers[0];a>n+o&&MathEx.greaterOrEqual(a,i*r,o);++s,r=this.m_fractionalDividers[s%this.m_fractionalDividers.length])a/=r;return a},n.prototype.TICK_DENSITY=2.5,n.prototype.base=function(){return this.m_base},n.prototype.setBase=function(e){if(0>e)throw new RangeError("base < 0");this.m_base=e},n.prototype.fontHeight=function(){return this.m_priceScale.fontSize()},n.prototype.tickSpan=function(e,t){if(t>e)throw new RangeError("high < low");var i=this.m_priceScale.height(),n=this.tickMarkHeight(),o=(e-t)*n/i,a=new r(this.m_base,[2,2.5,2]),s=new r(this.m_base,[2,2,2.5]),l=new r(this.m_base,[2.5,2,2]),d=[];d.push(a.tickSpan(e,t,o)),d.push(s.tickSpan(e,t,o)),d.push(l.tickSpan(e,t,o));var h=MathEx.min(d);return h},n.prototype.tickMarkHeight=function(){return Math.ceil(this.fontHeight()*this.TICK_DENSITY)},n.prototype.rebuildTickMarks=function(){if(null===this.m_priceScale)throw new TypeError("scale is null");if(this.m_priceScale.isEmpty())return void(this.m_marks=[]);var e=this.m_priceScale.height(),t=this.m_priceScale.coordinateToPrice(e-1),i=this.m_priceScale.coordinateToPrice(0),r=i>=t?1:-1,n=Math.max(i,t),a=Math.min(i,t);if(i=n,t=a,i!=t){var s=this.tickSpan(i,t),l=i%s;if(l+=0>l?s:0,this.m_marks=[],!this._formatter){var d=o(s);if(!this._cache||this._currentFormatBase!=d){var h=new TradingView.PriceFormatter(d);this._cache=new p(function(e){return h.format(e)})}}for(var c=null,u=i-l;u>t;u-=s){var _=this.m_priceScale.priceToCoordinate(u);null!==c&&Math.abs(_-c)<this.tickMarkHeight()||(this.m_marks.push({coord:_,label:this._cache.format(u)}),c=_,this.m_priceScale.isLog()&&(s=this.tickSpan(u*r,t)))}}},n.prototype.marks=function(){return this.m_marks},a.prototype.isLog=function(){return this.Q0.log.value()},a.prototype.isPercent=function(){return this.Q0.percentage.value()},a.prototype.properties=function(){return this.Q0},a.prototype.fontSize=function(){return this._scalesProperties.fontSize.value()},a.prototype.height=function(){return this.m_height},a.prototype.setHeight=function(e){var t=this.m_height;this.m_height=e,this._internalHeightCache=void 0,this._marksCache=null,t!=e&&this.mainSource()instanceof _&&this.mainSource().isLockScale()&&this.mainSource().model().timeScale().recalcLockedScale()},a.prototype.topMargin=function(){return Math.max(this.m_topMargin,this._studyTopMargin)},a.prototype.setTopMargin=function(e){if(!isNumber(e))throw new TypeError("invalid margin");if(0>e||e>30)throw new RangeError("invalid margin");this.m_topMargin=e,this._internalHeightCache=void 0,this._marksCache=null},a.prototype.bottomMargin=function(){return Math.max(this.m_bottomMargin,this._studyBottomMargin)},a.prototype.setBottomMargin=function(e){if(!isNumber(e))throw new TypeError("invalid margin");if(0>e||e>30)throw new RangeError("invalid margin");this.m_bottomMargin=e,this._internalHeightCache=void 0,this._marksCache=null},a.prototype.internalHeight=function(){if(this._internalHeightCache)return this._internalHeightCache;var e=this.height()*(1-this.topMargin()-this.bottomMargin());return this._internalHeightCache=e,e},a.prototype.priceRange=function(){return this.makeSureItIsValid(),this.m_priceRange},a.prototype.setPriceRange=function(e){if(!e instanceof PriceRange)throw new TypeError("incorrect price range");this.m_priceRange&&this.m_priceRange.equals(e)||(this.m_priceRange=e,this._marksCache=null)},a.prototype.isEmpty=function(){return this.makeSureItIsValid(),0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()},a.prototype.invertedCoordinate=function(e){return this.height()-1-e},a._logicalOffset=4,a._coordOffset=1e-4,a.prototype.log10=function(e){return Math.log(e)/Math.log(10)},a.prototype._toLog=function(e){var t=Math.abs(e);if(1e-6>t)return 0;var i=this.log10(t+a._coordOffset)+a._logicalOffset;return 0>e?-i:i},a.prototype.priceToLogical=function(e){return this.isLog()&&e?this._toLog(e):e},a.prototype._fromLog=function(e){var t=Math.abs(e);if(1e-6>t)return 0;var i=Math.pow(10,t-a._logicalOffset)-a._coordOffset;return 0>e?-i:i},a.prototype.logicalToPrice=function(e){return this.isLog()?this._fromLog(e):e},a.prototype.priceToCoordinate=function(e,t){if(this.makeSureItIsValid(),this.isEmpty())return 0;e=this.priceToLogical(e);var i=this.bottomMargin()*this.height()+(this.internalHeight()-1)*(e-this.priceRange().minValue())/(this.priceRange().maxValue()-this.priceRange().minValue()),r=this.invertedCoordinate(i);return t?r:Math.round(r)},a.prototype.pricesToCoordinates=function(e){this.pricesToCoordinatesEx(e,function(e){return e.y},function(e,t){e.y=t})},a.prototype.pricesToCoordinatesEx=function(e,t,i){this.makeSureItIsValid();var r=this.bottomMargin()*this.height(),n=this.priceRange().minValue(),o=this.priceRange().maxValue(),a=this.internalHeight()-1,s=a/(o-n);if(this.isLog())for(var l=0;l<e.length;l++){var d=t(e[l]);i(e[l],this.priceToLogical(d))}for(var l=0;l<e.length;l++){var d=t(e[l]);if(!TradingView.isNaN(d)&&void 0!==d&&null!==d){var h=r+s*(d-n),p=this.m_height-1-h;i(e[l],Math.round(p))}}},a.prototype.pointsArrayToCoordinates=function(e){this.makeSureItIsValid();var t=this.bottomMargin()*this.height(),i=this.priceRange().minValue(),r=this.priceRange().maxValue(),n=this.internalHeight()-1,o=n/(r-i);if(this.isLog())for(var a=0;a<e.length;a++)e[a].y=this.priceToLogical(e[a].y);for(var a=0;a<e.length;a++){var s=e[a].y;if(!TradingView.isNaN(s)&&void 0!==s&&null!==s){var l=t+o*(s-i),d=this.m_height-1-l;e[a].y=Math.round(d)}}},a.prototype.pricesArrayToCoordinates=function(e){this.makeSureItIsValid();var t=this.bottomMargin()*this.height(),i=this.priceRange().minValue(),r=this.priceRange().maxValue(),n=this.internalHeight()-1,o=n/(r-i);if(this.isLog())for(var a=0;a<e.length;a++)e[a]=this.priceToLogical(e[a]);for(var a=0;a<e.length;a++){var s=e[a];if(void 0!==s&&null!==s){var l=t+o*(s-i),d=this.m_height-1-l;e[a]=Math.round(d)}}},a.prototype.barPricesToCoordinates=function(e){this.makeSureItIsValid();var t=e,i=this.bottomMargin()*this.height(),r=this.priceRange().minValue(),n=this.priceRange().maxValue(),o=this.internalHeight()-1,a=o/(n-r);if(this.isLog())for(var s=0;s<t.length;s++)t[s]&&(t[s].open=this.priceToLogical(t[s].open),t[s].high=this.priceToLogical(t[s].high),t[s].low=this.priceToLogical(t[s].low),t[s].close=this.priceToLogical(t[s].close),t[s].additionalPrice&&(t[s].additionalPrice=this.priceToLogical(t[s].additionalPrice)));for(var s=0;s<t.length;s++){var l=t[s];if(l){var d=l.open,h=i+a*(d-r),p=this.m_height-1-h;l.open=Math.round(p);var d=l.high,h=i+a*(d-r),p=this.m_height-1-h;l.high=Math.round(p);var d=l.low,h=i+a*(d-r),p=this.m_height-1-h;l.low=Math.round(p);var d=l.close,h=i+a*(d-r),p=this.m_height-1-h;if(l.close=Math.round(p),l.additionalPrice){var d=l.additionalPrice,h=i+a*(d-r),p=this.m_height-1-h;l.additionalPrice=Math.round(p)}}}},a.prototype.coordinateToPrice=function(e){if(this.makeSureItIsValid(),this.isEmpty())return 0;var t=this.invertedCoordinate(e),i=this.priceRange().minValue()+(this.priceRange().maxValue()-this.priceRange().minValue())*((t-this.bottomMargin()*this.height())/(this.internalHeight()-1));return this.logicalToPrice(i)},a.prototype.isAutoScale=function(){return this.Q0.autoScale.value()&&!(this.mainSource()instanceof _&&this.mainSource().isLockScale())},a.prototype.isPercentage=function(){return this.Q0.percentage.value()},a.prototype.Q17=function(){return this.m_dataSources},a.prototype.orderedSources=function(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;for(var e=[],t=0;t<this.m_dataSources.length;t++){var r=this.m_dataSources[t];null==r.zorder()&&r.setZorder(t+1),e.push(r)}var n=i(56);return e=n.sortSources(e),this._cachedOrderedSoruces=e,this._cachedOrderedSoruces},a.prototype.invalidateSourcesCache=function(){this._cachedOrderedSoruces=null},a.prototype.addDataSource=function(e){if(-1===this.m_dataSources.indexOf(e)){TradingView.isInherited(e.constructor,_)&&(this._hasSeries=!0);var t=this;e.properties().visible.listeners().subscribe(null,function(){t._sourcesForAutoscale=null}),this.m_dataSources.push(e),this._mainSource=void 0,this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this.updateFormatter(),this.initScaleProperties(),this.invalidateSourcesCache()}},a.prototype.initScaleProperties=function(){var e=this.mainSource()instanceof _&&this.mainSource().properties().lockScale.value();e&&(this.properties().percentage.setValue(!1),this.properties().log.setValue(!1),this.properties().autoScale.setValue(!1)),this.properties().percentageDisabled.setValue(e),this.properties().logDisabled.setValue(e),this.properties().autoScaleDisabled.setValue(this.properties().percentage.value()),this.properties().percentage.value()&&this.properties().log.setValue(!1)},a.prototype.removeDataSource=function(e){var t=this.m_dataSources.indexOf(e);if(-1===t)throw Error("source is not attached to scale");this.m_dataSources.splice(t,1),TradingView.isInherited(e.constructor,_)&&(this._hasSeries=!1),this.mainSource()||this.setAutoScale(!0),this._mainSource=void 0,this._sourcesForAutoscale=null,this._sourcesToUpdateViews=null,this.updateFormatter(),
this.invalidateSourcesCache()},a.prototype.setAutoScale=function(e){this.Q0.autoScale.setValue(e)},a.prototype.isScaled=function(){return"number"==typeof this.m_scaleStartPoint},a.prototype.startScale=function(e){this.isPercentage()||null===this.m_scaleStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=this.m_height-e,this.m_priceRangeSnapshot=this.priceRange().clone()))},a.prototype.marks=function(){return this._marksCache?this._marksCache:(this.m_markBuilder.rebuildTickMarks(),this._marksCache=this.m_markBuilder.marks(),this._marksCache)},a.prototype.scaleTo=function(e){if(!this.isPercentage()&&(this._marksCache=null,null!==this.m_scaleStartPoint)){this.setAutoScale(!1);var t=this.m_priceRange.clone();e=this.m_height-e,0>e&&(e=0);var i=(this.m_scaleStartPoint+.2*(this.m_height-1))/(e+.2*(this.m_height-1));i=Math.max(i,.1),this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.scaleAroundCenter(i),this.recalcLockedScale(t)}},a.prototype.recalcLockedScale=function(e){if(this.mainSource()instanceof _&&this.mainSource().properties().lockScale.value()){var t=this.mainSource().model().timeScale(),i=this.mainSource().data().boxSize;if(void 0===i&&this.mainSource().fixBoxSize(),void 0===i)return;if(this.properties().percentage.value()){var r=this.mainSource().data().search(this.mainSource().getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT];i=PriceRange.prototype.convertToPercent.call(null,r+i,r)-PriceRange.prototype.convertToPercent.call(null,r,r)}var n=this.internalHeight()/this.priceRange().length()*i;.5>n||n>50?this.m_priceRange=e:(t.setBarSpacing(n),t._correctOffset()),this.mainSource().model().mainSeries().requestMoreData()}},a.prototype.endScale=function(){this.isPercentage()||null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_priceRangeSnapshot=null)},a.prototype.startScroll=function(e){this.isAutoScale()||null===this.m_scrollStartPoint&&null===this.m_priceRangeSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=e,this.m_priceRangeSnapshot=this.priceRange().clone()))},a.prototype.scrollTo=function(e){if(this._marksCache=null,!this.isAutoScale()&&null!==this.m_scrollStartPoint){var t=this.priceRange().length()/(this.height()-1),i=e-this.m_scrollStartPoint,r=i*t;this.m_priceRange=this.m_priceRangeSnapshot.clone(),this.m_priceRange.shift(r)}},a.prototype.endScroll=function(){this.isAutoScale()||null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_priceRangeSnapshot=null)},a.prototype.state=function(){var e={};return e.m_priceRange=this.priceRange()?this.priceRange().clone():null,e.m_isAutoScale=this.isAutoScale(),e.m_isPercentage=this.Q0.percentage.value(),e.m_isLog=this.Q0.log.value(),e.m_height=this.m_height,e.m_topMargin=this.m_topMargin,e.m_bottomMargin=this.m_bottomMargin,e},a.prototype.restoreState=function(e){var t=e.m_priceRange;if(void 0===t)throw new TypeError("invalid state");if(void 0===e.m_isAutoScale)throw new TypeError("invalid state");void 0!==e.m_isPercentage&&this.Q0.percentage.setValue(e.m_isPercentage),void 0!==e.m_isLog&&this.Q0.log.setValue(e.m_isLog),this.m_priceRange=t?new PriceRange(t.m_minValue,t.m_maxValue):null,void 0!==e.m_height&&(this.m_height=e.m_height),this.setAutoScale(e.m_isAutoScale),void 0!==e.m_topMargin&&(this.m_topMargin=e.m_topMargin),void 0!==e.m_bottomMargin&&(this.m_bottomMargin=e.m_bottomMargin),this._mainSource=void 0,this._scaleSeriesOnly=!1},a.prototype.mainSource=function(){if(void 0!==this._mainSource)return this._mainSource;for(var e=0;e<this.m_dataSources.length;e++)if(TradingView.isInherited(this.m_dataSources[e].constructor,u)){var t=this.m_dataSources[e];return this._mainSource=t,t}return this._mainSource=void 0,null},a.prototype.formatter=function(){return this._formatter||this.updateFormatter(),this._formatter},a.prototype.updateFormatter=function(){this._marksCache=null;var e=this.mainSource(),t=100;e&&(t=e.base()),this._formatter=null,this.properties().percentage.value()?this._formatter=new TradingView.PercentageFormatter:e?this._formatter=e.formatter():this._formatter=new TradingView.PriceFormatter(100,1),this.m_markBuilder=new n(this,t,this._formatter),this.m_markBuilder.rebuildTickMarks()},a.prototype._recalculateSourcesForAutoscale=function(){this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.scaleSeriesOnly.value());var e=this._scaleSeriesOnly&&this._hasSeries,t=function(t){return t.properties().visible.value()||t instanceof _?t instanceof h||t instanceof d||t instanceof l?!1:e?TradingView.isInherited(t.constructor,_):TradingView.isInherited(t.constructor,u):!1};this._sourcesForAutoscale=this.m_dataSources.filter(t)},a.prototype.sourcesForAutoscale=function(){return this._mainSource&&this._scaleSeriesOnly!=this._scalesProperties.scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||this._recalculateSourcesForAutoscale(),this._sourcesForAutoscale},a.prototype.recalculatePriceRange=function(e){this._invalidatedForRange={visibleBars:e,isValid:!1}},a.prototype.makeSureItIsValid=function(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this.recalculatePriceRangeImpl())},a.prototype.recalculatePriceRangeImpl=function(){var e=this._invalidatedForRange.visibleBars;if(e){for(var t=null,i=this.sourcesForAutoscale(),r=(this.mainSource(),0),n=0,o=0;o<i.length;o++){var a=i[o];if(a.properties().visible.value()){var s=e.firstBar(),l=e.lastBar(),d=a.priceRange(s,l);if(null===t&&d?t=d:d&&(t=t.merge(d)),a.margins){var h=a.margins();r=Math.max(h[0],r),n=Math.max(h[1],n)}}}(Math.abs(n-this._studyBottomMargin)>.01||Math.abs(r-this._studyTopMargin)>.01)&&(this._studyBottomMargin=n,this._studyTopMargin=r,this._marksCache=null,this._internalHeightCache=null),t?(t.minValue()==t.maxValue()&&(t=new PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.setPriceRange(t)):this.m_priceRange||this.setPriceRange(new PriceRange(-.5,.5)),this._invalidatedForRange.isValid=!0}},a.prototype.sourcesToUpdateViews=function(){if(!this._sourcesToUpdateViews){this._sourcesToUpdateViews=[];for(var e=0;e<this.m_dataSources.length;e++){var t=this.m_dataSources[e];TradingView.isInherited(t.constructor,c)&&!t.isActualSymbol()||this._sourcesToUpdateViews.push(t)}}return this._sourcesToUpdateViews},a.prototype.updatePaneViews=function(){for(var e=this.sourcesToUpdateViews(),t=0;t<e.length;t++)e[t].updateAllViews()},window.Z74=a,e.exports=a},function(e,t,i){"use strict";function r(e,t,i,r,n){this._paneView=n,TradingView.Study.call(this,e,t,i,r)}function n(e,t,i,n){r.call(this,e,t,i,n,new h(e,this))}function o(e,t,i,n){r.call(this,e,t,i,n,new p(e,this))}function a(e,t,i,n){r.call(this,e,t,i,n,new c(e,this)),this.pointSets={},this.updateEstimateHandler=this.updateEstimate.bind(this)}var s=i(62),l=i(38).DataWindowView,d=i(63),h=d.DividendsPaneView,p=d.SplitsPaneView,c=d.EarningsPaneView;inherit(r,TradingView.Study),r.prototype.createViews=function(){this._paneViews=[this._paneView],this._priceAxisViews=[],this._dataWindowView||(this._dataWindowView=new l),this._statusView||(this._statusView=new s(this,this.Z98.properties()))},r.prototype.showInObjectTree=function(){return!1},r.prototype.isSavedInStudyTemplates=function(){return!1},r.prototype.isRemovedByStudyTemplates=function(){return!1},r.prototype.removeByRemoveAllStudies=function(){return!1},r.prototype.statusView=function(){return!1},r.prototype.onData=function(e){TradingView.Study.prototype.onData.call(this,e),"study_completed"==e.method&&this._restartRequired&&(delete this._restartRequired,this.restart())},r.prototype.start=function(){TradingView.Study.prototype.start.call(this),this.Z98.mainSeries().onSymbolResolved().subscribe(this,this._initPlotStash),this._initPlotStash()},r.prototype.stop=function(){TradingView.Study.prototype.stop.call(this),this.Z98.mainSeries().onSymbolResolved().unsubscribe(this,this._initPlotStash)},r.prototype.isSavedInChart=function(e){return e},r.prototype._initPlotStash=function(){this._plotStash={}},r.prototype._updatePlotStash=function(e,t){if(!this._restartRequired&&this._plotStash){var i=e.value.slice(),r=i.shift(),n=r+"";t?this._plotStash[n]?this._plotStash[n]+""!=i+""&&(this._restartRequired=!0):this._plotStash[n]=i:this._plotStash[n]&&(this._restartRequired=!0)}},r.prototype.transformData=function(e){for(var t,i,r=e.length-1;r>=0;--r)t=e[r],i=this.isValid(t.value),this._updatePlotStash(t,i),i||e.splice(r,1)},r.prototype.isValid=function(e){throw Error("Not Implemented")},r.prototype.restoreData=function(e){this.transformData(e.data),e.end=e.data.length,TradingView.Study.prototype.restoreData.call(this,e)},inherit(n,r),n.prototype.isValid=function(e){var t=e[2];return $.isNumeric(t)},inherit(o,r),o.prototype.isValid=function(e){var t=e[3];return $.isNumeric(t)},inherit(a,r),a.pointSetCounter=1,a.pointSetsVersion="1",a.prototype.isValid=function(e){var t=e[3],i=e[4];return $.isNumeric(t)&&$.isNumeric(i)},r.getSettingsValue=function(e,t){var i=null;switch(e){case"DIVIDENDS":i=t.esdShowDividends.value();break;case"SPLITS":i=t.esdShowSplits.value();break;case"EARNINGS":i=t.esdShowEarnings.value()}return i},a.prototype.restorePointset=function(e){return{estimate:{index:e.index,value:[e.tickmark,void 0,e.estimate,$.isNumeric(e.period)?e.period:moment(e.period).unix(),$.isNumeric(e.date)?e.date:moment(e.date).unix()]}}},a.prototype.restoreData=function(e){r.prototype.restoreData.call(this,e);var t=this.currentPointsetKey();if(t)if(e.estimate)this.pointSets[t]=this.restorePointset(e.estimate);else if(e.pointSets&&null==e.pointSetsVersion){var i=t.split(":")[1].toUpperCase();e.pointSets[t]?this.pointSets[t]=this.restorePointset(e.pointSets[t]):e.pointSets[i]&&(this.pointSets[t]=this.restorePointset(e.pointSets[i]))}else e.pointSets&&"1"==e.pointSetsVersion&&(this.pointSets=e.pointSets)},a.prototype.state=function(e){var t=r.prototype.state.call(this,e);if(e){var i={};for(var n in this.pointSets)this.pointSets.hasOwnProperty(n)&&(i[n]={estimate:this.pointSets[n].estimate});t.data.pointSets=i,t.data.pointSetsVersion=a.pointSetsVersion}return t},a.prototype.stop=function(){r.prototype.stop.call(this);var e=this;Object.keys(this.pointSets).forEach(function(t){var i=e.pointSets[t];i.promise&&i.promise.always(function(){i.sessionId==e.Z98.chartApi()._chartApi.sessionid&&e.Z98.chartApi().removePointset(i.pointsetId)})}),this.pointSets={},this._estimatesCache.off("data",this.updateEstimateHandler),this._estimatesCache.destroy(),this.Z98.mainSeries().onSymbolResolved().unsubscribe(this,this.requestEstimate)},a.prototype.generatePointsetId=function(){return"pointsetEstimates_"+a.pointSetCounter++},a.prototype.getEstimate=function(){var e=this.currentPointsetKey();if(!e)return null;var t=this.pointSets[e];return t?t.estimate:null},a.prototype.currentPointsetKey=function(){var e=this._series.symbolInfo();return e?e.base_name[0].toLowerCase():null},a.prototype.createPointsetKey=function(e,t){return e.toLowerCase()+":"+t.toLowerCase()},a.prototype.updateEstimate=function(e){if(this.Z98.chartApi().connected()){var t=this;this.Z98.timeScale().isEmpty()?this.Z98.mainSeries().onDataLoaded().subscribe(null,function(i){"series_loading"!=i.method&&t.updateEstimateImpl(e)},!0):this.updateEstimateImpl(e)}},a.prototype.updateEstimateImpl=function(e){if(this.Z98.chartApi().connected()){var t=this,i=(e.modified,this.createPointsetKey(e.exchange,e.symbol)),r=this.pointSets[i];r&&r.promise&&(r.promise.always(function(){r.sessionId==t.Z98.chartApi()._chartApi.sessionid&&t.Z98.chartApi().removePointset(r.pointsetId)}),delete this.pointSets[i]),e.date&&e.period&&(e.reported||e.estimate)&&(this.pointSets[i]=this.createPointset(e))}},a.prototype.start=function(){r.prototype.start.call(this),this.pointSets={},this._estimatesCache=TradingView.createEstimatesProvider(),this._estimatesCache.on("data",this.updateEstimateHandler),this.Z98.mainSeries().onSymbolResolved().subscribe(this,this.requestEstimate),this.requestEstimate()},a.prototype.createPointset=function(e){var t=this.generatePointsetId(),i=this.Z98.mainSeries().symbolId(),r=this.Z98.mainSeries().properties().interval.value(),n=[];n.push([moment(e.date).unix(),0]);var o=$.Deferred(),a={promise:o.promise(),pointsetId:t,sessionId:this.Z98.chartApi()._chartApi.sessionid},s=this;return this.Z98.chartApi().createPointset(t,"turnaround",i,r,n,function(i){return i.params.customId!==t?o.reject():0===i.params.plots.length?o.reject():i.params.plots[0].value[0]<s.Z98.timeScale().points().lastTimePointIndex()?o.reject():(a.estimate={index:i.params.plots[0].value[0],value:[i.params.plots[0].value[1],e.reported,e.estimate,moment(e.period).unix(),moment(e.date).unix()]},o.resolve())}),a},a.prototype.requestEstimate=function(){this._estimatesCache.resetSymbol();var e=this.currentPointsetKey();if(e&&this.Z98.chartApi().connected()){var t=e.split(":")[0],i=e.split(":")[1];this._estimatesCache.setSymbol(t,i)}},t.ESDStudyBase=r,t.study_Script$TV_EARNINGS=a,t.study_Script$TV_SPLITS=o,t.study_Script$TV_DIVIDENDS=n},function(e,t,i){"use strict";function r(e,t){n.call(this,t),this.Z99=e,this._inputValueReplacements={NONE:"Default"}}var n=i(33);inherit(r,n),r.prototype.color=function(){return this.Z99._failed||this.Z99.metaInfo&&this.Z99.metaInfo().isTVScriptStub?"#ff0000":n.prototype.color.call(this)},r.prototype.update=function(){this.Z99._failed?this._text=this.Z99.title(!0,this._inputValueReplacements)+": "+this.Z99.status():this._text=this.Z99.title(!0,this._inputValueReplacements)+" "+this.Z99.status()},e.exports=r},function(e,t){"use strict";function i(e,t){this.Z98=e,this.Z99=t,this._metaInfo=t.metaInfo(),this.lollipops=[],this._textCache={},this.templatesCache={},this._invalidated=!0,this.templatesCache.hovered=this.createTemplate(this.hoveredStyle),this.templatesCache["default"]=this.createTemplate(this.defaultStyle)}function r(e){this.data=e}function n(e){this.data=e,this._hittest=new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR,e)}function o(e){this._data=e,this.textRenderer=new o.TextRenderer}function a(e,t){this.defaultStyle={strokeStyle:"#E2745B",lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:64,circleHeight:35,radius:11,lineWidth:2,fillStyle:"white",strokeStyle:"#E2745B",text:{label:"E",strokeStyle:"#E2745B",font:"normal 12px Verdana, Arial, sans-serif"}}};var r={lollipop:{fillStyle:"#E2745B",text:{strokeStyle:"white"}}};this.hoveredStyle=$.extend(!0,{},this.defaultStyle,r),i.call(this,e,t)}function s(e,t){this.defaultStyle={strokeStyle:"#58B986",lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:64,circleHeight:35,radius:11,lineWidth:2,fillStyle:"white",strokeStyle:"#58B986",text:{label:"S",strokeStyle:"#58B986",font:"normal 12px Verdana, Arial, sans-serif"}}};var r={lollipop:{fillStyle:"#58B986",text:{strokeStyle:"white"}}};this.hoveredStyle=$.extend(!0,{},this.defaultStyle,r),i.call(this,e,t)}function l(e,t){this.defaultStyle={strokeStyle:"#4E89CB",lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:64,circleHeight:35,radius:11,lineWidth:2,fillStyle:"white",strokeStyle:"#4E89CB",text:{label:"D",strokeStyle:"#4E89CB",font:"normal 12px Verdana, Arial, sans-serif"}}};var r={lollipop:{fillStyle:"#4E89CB",text:{strokeStyle:"white"}}};this.hoveredStyle=$.extend(!0,{},this.defaultStyle,r),i.call(this,e,t)}i.prototype._getY=function(){for(var e=0,t=this.Z98.panes(),i=t.length;i--;){var r=t[i];r.containsMainSeries()&&(e+=r.height())}return e},i.prototype.update=function(){this._invalidated=!0},i.prototype.updateImpl=function(){this.lollipops=[];var e=this,t=this.Z99.data(),i=this.Z98.timeScale(),r=i.visibleBars(),n=this.Z98.mainSeries().bars(),o=this.Z99.priceScale(),a=this.Z98.mainSeries(),s=a.firstBar();if(o&&!o.isEmpty()&&!i.isEmpty()&&s&&t){var l=this._getY(),d=t.range(r.firstBar(),r.lastBar());d.each(function(t,r){e.addLollipop(l,n,i,o,t,r)}),this.afterUpdate(l,n,i,o)}},i.prototype.addLollipop=function(e,t,i,r,n,o){var a=o[0],s=null,l=this.Z99.metaInfo().id+"_"+a,d=this.Z98.lastHittestData(),h=d&&d.id==l;if(h){var p=t.valueAt(n);if(p){var c=p[TradingView.LOW_PLOT];if(r.isPercent()){var u=this.Z98.mainSeries().firstValue();c=r.priceRange().convertToPercent(c,u)}s=r.priceToCoordinate(c)}}var _=$.extend({id:l,basePoint:new MathEx.Point(i.indexToCoordinate(n)+1,e),hovered:h,barY:s},this.extraData(o));this.lollipops.push(_)},i.prototype.afterUpdate=function(e,t,i){},i.prototype.extraData=function(e){throw Error("Not Implemented")},i.prototype.createText=function(e,t){throw Error("Not Implemented")},i.prototype.showBarLine=function(){return!0},i.prototype.getStyle=function(e,t){return"hovered"==e?this.hoveredStyle:this.defaultStyle},i.prototype.hasTooltip=function(e){return!0},i.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this.lollipops.length;t++){var i=this.lollipops[t],a=15,s=this.getStyle(i.hovered?"hovered":"default",i);if(i.hovered&&this.hasTooltip(i)){if(i.barY&&this.showBarLine()){var l={style:{lineStyle:s.barLine.lineStyle,strokeStyle:s.strokeStyle,lineWidth:s.lineWidth},startPoint:new MathEx.Point(i.basePoint.x,i.basePoint.y-s.lollipop.circleHeight),endPoint:new MathEx.Point(i.basePoint.x,i.barY)};e.append(new r(l))}var d=$.extend({tooltipPoint:new MathEx.Point(i.basePoint.x,i.basePoint.y-s.lollipop.circleHeight-a),style:s,createText:this.createText},i);e.append(new o(d))}var h=this.getTemplate(i.hovered?"hovered":"default",i),p={circlePoint:new MathEx.Point(i.basePoint.x,i.basePoint.y-s.lollipop.circleHeight),style:s,template:h,basePoint:i.basePoint,id:i.id};e.append(new n(p))}return e},i.prototype.getTemplate=function(e){return this.templatesCache[e]},i.prototype.createTemplate=function(e){var t=document.createElement("canvas"),i=t.getContext("2d"),r=new MathEx.Point(e.lollipop.width/2,e.lollipop.height),n=new MathEx.Point(e.lollipop.width/2,e.lollipop.height-e.lollipop.circleHeight);return this.drawStick(i,e,r,n),this.drawCircle(i,e,n),this.drawLabel(i,e,n),t},i.prototype.drawCircle=function(e,t,i){e.fillStyle=t.lollipop.fillStyle,e.lineWidth=t.lollipop.lineWidth,CanvasEx.setLineStyle(e,CanvasEx.LINESTYLE_SOLID),e.beginPath(),e.arc(i.x,i.y,t.lollipop.radius,0,2*Math.PI,!1),e.closePath(),e.stroke(),e.fill()},i.prototype.drawLabel=function(e,t,i){e.textAlign="center",e.textBaseline="middle",e.fillStyle=t.lollipop.text.strokeStyle,e.font=t.lollipop.text.font,e.fillText(t.lollipop.text.label,i.x,i.y)},i.prototype.drawStick=function(e,t,i,r){e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,CanvasEx.setLineStyle(e,CanvasEx.LINESTYLE_DASHED),CanvasEx.drawLine(e,i.x,i.y,r.x,r.y)},r.prototype.draw=function(e){e.strokeStyle=this.data.style.strokeStyle,e.lineWidth=this.data.style.lineWidth,CanvasEx.setLineStyle(e,this.data.style.lineStyle),CanvasEx.drawLine(e,this.data.startPoint.x,this.data.startPoint.y,this.data.endPoint.x,this.data.endPoint.y)},r.prototype.hitTest=function(e){return null},n.prototype.hitTest=function(e){return MathEx.isInCircle(this.data.circlePoint,this.data.style.lollipop.radius,e)?this._hittest:null},n.prototype.draw=function(e){var t=this.data.template;e.drawImage(t,this.data.basePoint.x-(.5+this.data.style.lollipop.width/2<<0)+.5,this.data.basePoint.y-this.data.style.lollipop.height+.5)},o.prototype.draw=function(e){var t=this._data.tooltipPoint;this._data.createText(this._data,this.textRenderer),this.drawFrame(e,t),this.drawTip(e,t)},o.prototype.hitTest=function(e){return null},o.prototype.drawTip=function(e,t){var i=5,r=this.calcMarginX(e,t.x,i),n=t.x+r;e.lineWidth=this._data.style.lineWidth,e.strokeStyle=this._data.style.fillStyle,e.fillStyle=this._data.style.fillStyle,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(n-i,t.y-i),e.lineTo(n+i,t.y-i),e.fill(),e.closePath(),e.stroke(),e.strokeStyle=this._data.style.strokeStyle,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(n-i,t.y-i),e.moveTo(t.x,t.y),e.lineTo(n+i,t.y-i),e.closePath(),e.stroke()},o.prototype.drawFrame=function(e,t){var i=200,r=5,n=16,o=7,a=12,s=this.textRenderer.measure()+a+o,l=this.calcMarginX(e,t.x,i/2);e.lineWidth=this._data.style.lineWidth,CanvasEx.setLineStyle(e,CanvasEx.LINESTYLE_SOLID),e.strokeStyle=this._data.style.strokeStyle,e.fillStyle=this._data.style.fillStyle,e.beginPath(),e.rect(t.x-i/2+l,t.y-r-s,i,s),e.closePath(),e.stroke(),e.fill();var d=t.x-i/2+n+l,h=t.y-r-s+o+this.textRenderer.fontHeight;this.textRenderer.draw(e,new MathEx.Point(d,h))},o.prototype.calcMarginX=function(e,t,i){var r=5,n=5,o=0,a=e.canvas.clientWidth;return r>t-i?o=Math.abs(t-(i+r)):t+i>a-n&&(o=-Math.abs(a-(i+t+n))),o},o.TextRenderer=function(){this.lines=[],this.fontHeight=12,this.font=this.fontHeight+"px Arial, sans-serif",this.lineSpacing=8,this.fillStyle="black"},o.TextRenderer.prototype.draw=function(e,t){for(var i=t.y,r=0;r<this.lines.length;r++){var n=this.lines[r];e.font=this.font,n.options.fontWeight&&(e.font=n.options.fontWeight+" "+this.font),e.fillStyle=this.fillStyle,n.renderer(e,n.line,{x:t.x,y:i}),i+=this.lineSpacing+this.fontHeight}},o.TextRenderer.prototype.measure=function(){return this.lines.length*(this.fontHeight+this.lineSpacing)-this.lineSpacing},o.TextRenderer.prototype.basicRenderer=function(e,t,i){e.fillText(t,i.x,i.y)},o.TextRenderer.prototype.addMulticolorTextLine=function(e,t){this.addTextLine(e,t,this.multicolorRenderer)},o.TextRenderer.prototype.addTextLine=function(e,t,i){i||(i=this.basicRenderer),t||(t={}),this.lines.push({line:e,renderer:i,options:t})},o.TextRenderer.prototype.multicolorRenderer=function(e,t,i){for(var r=i.x,n=0;n<t.length;++n){var o=t[n];e.fillStyle=o.color,e.fillText(o.text,r,i.y),r+=e.measureText(o.text).width}},inherit(a,i),a.prototype.extraData=function(e){var t=e[1],i=e[2],r=e[3],n=e[4];return{reported:t,estimate:i,period:r,date:n}},a.prototype.afterUpdate=function(e,t,i,r){var n=this.Z99.getEstimate();if(n){var o=n.value.slice();o[4]*=1e3,this.addLollipop(e,t,i,r,n.index,o)}},a.prototype.createText=function(e,t){if($.isNumeric(e.reported)&&t.addTextLine($.t("Earnings")+": "+accounting.formatMoney(e.reported),{fontWeight:"bold"}),$.isNumeric(e.estimate)&&($.isNumeric(e.reported)?t.addTextLine($.t("Estimate")+": "+accounting.formatMoney(e.estimate)):t.addTextLine($.t("Estimate")+": "+accounting.formatMoney(e.estimate),{fontWeight:"bold"})),$.isNumeric(e.reported)&&$.isNumeric(e.estimate)){var i=e.reported-e.estimate,r=i>0?"#238853":"#DD5538",n=100*Math.abs(i/e.estimate),o=i.toFixed(2);isFinite(n)&&(o+=" ("+n.toFixed(2)+"%)"),t.addMulticolorTextLine([{text:$.t("Surprise")+": ",color:"black"},{text:o,color:r}])}t.addTextLine($.t("Date")+": "+moment(e.date).format("l")),t.addTextLine($.t("Period Ending")+": "+moment.unix(e.period).format("M/YYYY"))},a.prototype.showBarLine=function(){var e=this.Z98.mainSeries().properties();return!e.esdShowBreaks.value()},a.prototype.renderer=function(){var e=i.prototype.renderer.call(this),t=this.Z98.mainSeries().properties();if(t.esdShowBreaks.value())for(var n=t.esdBreaksStyle.color.value(),o=t.esdBreaksStyle.style.value(),a=t.esdBreaksStyle.width.value(),s=0;s<this.lollipops.length;s++){var l=this.lollipops[s],d=this.defaultStyle;l.hovered&&(d=this.hoveredStyle);var h=$.extend({startPoint:new MathEx.Point(l.basePoint.x,l.basePoint.y-d.lollipop.circleHeight),endPoint:new MathEx.Point(l.basePoint.x,0),style:{strokeStyle:n,lineWidth:a,lineStyle:o}},l);e.insert(new r(h),0)}return e},inherit(s,i),s.prototype.extraData=function(e){var t=e[1],i=e[2],r=e[3];return{numerator:i,denominator:t,date:r}},s.prototype.createText=function(e,t){$.isNumeric(e.numerator)&&$.isNumeric(e.denominator)&&t.addTextLine($.t("Split")+": "+e.numerator+"/"+e.denominator,{fontWeight:"bold"}),t.addTextLine($.t("Date")+": "+moment(e.date).format("l"))},inherit(l,i),l.prototype.extraData=function(e){return{value:e[1],date:e[2]}},l.prototype.createText=function(e,t){$.isNumeric(e.value)&&t.addTextLine($.t("Dividends")+": "+accounting.formatMoney(e.value),{fontWeight:"bold"}),t.addTextLine($.t("Date")+": "+moment(e.date).format("l"))},t.ESDPaneView=i,t.EarningsPaneView=a,t.DividendsPaneView=l,t.SplitsPaneView=s},function(e,t){"use strict";function i(e,t){this._formatter=e,this._maxSize=t||50,this._actualSize=0,this._cache={},this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}i.prototype.format=function(e){if(this._cache[e])return this._cache[e].string;if(this._actualSize==this._maxSize){var t=this._tick2Labels[this._oldestTick];delete this._tick2Labels[this._oldestTick],delete this._cache[t],this._oldestTick++,this._actualSize--}var i=this._formatter(e);return this._cache[e]={string:i,tick:this._usageTick},this._tick2Labels[this._usageTick]=e,this._actualSize++,this._usageTick++,i},e.exports=i},function(e,t){"use strict";function i(e){function t(e,t){var i=e.font;return n.hasOwnProperty(i)||(n[i]={}),n[i].hasOwnProperty(t)||(n[i][t]=e.measureText(t).width),n[i][t]}function i(){var i=r.width(),n=r.height();return{draw:function(r){var a=e.symbolInfo();if(a){r.fillStyle=TradingView.generateColor(o.color.value(),o.transparency.value());var s=a.name;if(/QUANDL/.test(a.exchange)){var l;l=s.split(/\//),l.length&&(s=l[l.length-1])}for(var d=[{text:s?s+", "+TradingView.translatedIntervalString(e.interval()):"",font:"96px Verdana, Arial, sans-serif",lineHeight:114,baselineOffset:87},{text:a.description||"",font:"48px Verdana, Arial, sans-serif",lineHeight:57,baselineOffset:43.5}],h=0,p=0;p<d.length;p++){var c=d[p];if(c.text){r.font=c.font;var u=t(r,c.text);u>i?(c.zoom=i/u,u=i):c.zoom=1,c.offsetLeft=(i-u)/2,h+=c.lineHeight*c.zoom}}h=Math.max((n-h)/2,0);for(var p=0;p<d.length;p++){var c=d[p];c.text&&(r.save(),r.font=c.font,r.translate(c.offsetLeft,h),r.scale(c.zoom,c.zoom),r.fillText(c.text,0,c.baselineOffset),r.restore(),h+=c.lineHeight*c.zoom)}}}}}var r=null,n={},o=e.model().properties().symbolWatermarkProperties,a={renderer:i,update:function(){}};this.paneViews=function(e){return e.containsMainSeries()?(r=e,[a]):[]}}e.exports=i},function(e,t){"use strict";function i(){this.visible=!0,this.horzLinesVisible=!0,this.horzLinesColor="white",this.horzLinesStyle="",this.vertLinesVisible=!0,this.vertLinesColor="white",this.vertLinesStyle=""}function r(e,t){this.source=e,this.pane=t}function n(e){this.data=e}i.prototype.paneViews=function(e){return[new r(this,e)]},r.prototype.update=function(){},r.prototype.renderer=function(){var e={};return this.pane.defaultPriceScale().isEmpty()||this.pane.timeScale().isEmpty()?null:(e.horzLinesVisible=!0,e.vertLinesVisible=!0,e.horzLinesColor=this.pane.Z98.properties().paneProperties.horzGridProperties.color.value(),e.vertLinesColor=this.pane.Z98.properties().paneProperties.vertGridProperties.color.value(),e.horzLineStyle=this.pane.Z98.properties().paneProperties.horzGridProperties.style.value(),e.vertLineStyle=this.pane.Z98.properties().paneProperties.vertGridProperties.style.value(),e.priceMarks=this.pane.defaultPriceScale().marks(),e.timeMarks=this.pane.timeScale().marks(),e.w=this.pane.width(),e.h=this.pane.height(),new n(e))},n.prototype.draw=function(e){if(e.lineWidth=1,this.data.vertLinesVisible){e.strokeStyle=this.data.vertLinesColor,CanvasEx.setLineStyle(e,this.data.vertLineStyle),e.beginPath();for(var t=0;t<this.data.timeMarks.length;t++)e.moveTo(this.data.timeMarks[t].coord+1,0),e.lineTo(this.data.timeMarks[t].coord+1,this.data.h);e.stroke()}if(this.data.horzLinesVisible){e.strokeStyle=this.data.horzLinesColor,CanvasEx.setLineStyle(e,this.data.horzLineStyle),e.beginPath();for(var t=0;t<this.data.priceMarks.length;t++)e.moveTo(0,this.data.priceMarks[t].coord),e.lineTo(this.data.w,this.data.priceMarks[t].coord);e.stroke()}},e.exports=i},function(e,t,i){"use strict";function r(e,t,i){this._magnetProperty=e,this._timeScale=t}var n=i(31);r.prototype.align=function(e,t,i){var r=50,o=i.defaultPriceScale(),a=o.priceToCoordinate(e),s=e;if(!this._magnetProperty.value())return s;for(var l=o.Q17(),d=null,h=0;h<l.length;h++)if(l[h]instanceof n){d=l[h];break}if(d){var p=d.bars();if(p.contains(t)){var c=p.valueAt(t),u=[c[TradingView.OPEN_PLOT],c[TradingView.HIGH_PLOT],c[TradingView.LOW_PLOT],c[TradingView.CLOSE_PLOT]],o=d.priceScale();if(!o.isEmpty()){var _=[];if(o.isPercent())for(var f=d.firstValue(),h=0;h<u.length;h++)u[h]=o.priceRange().convertToPercent(u[h],f);for(var h=0;h<u.length;h++)_.push({y:o.priceToCoordinate(u[h]),price:u[h]});_.sort(function(e,t){var i=Math.abs(e.y-a),r=Math.abs(t.y-a);return i-r});var g=_[0];Math.abs(g.y-a)<r&&(s=g.price)}}}return s},e.exports=r},function(e,t,i){"use strict";function r(){return[$.t("Jan"),$.t("Feb"),$.t("Mar"),$.t("Apr"),$.t("May"),$.t("Jun"),$.t("Jul"),$.t("Aug"),$.t("Sep"),$.t("Oct"),$.t("Nov"),$.t("Dec")]}function n(e){this.Z98=e,this.Q0=e.properties().timeScale,this._scalesProperties=e.properties().scalesProperties,this.m_width=0,this._defaultRightOffset=this.Q0.rightOffset.value(),this.m_rightOffset=this.Q0.rightOffset.value(),this.m_points=new TradingView.TimeIndexes,this.m_barSpacing=this.Q0.barSpacing.value(),this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks=new s,this._locked=!1,this._formattedBySpan={}}var o=i(41),a=i(64),s=i(69);TradingView.MONTH_NAMES=null,TradingView.MINUTE_SPAN=20,TradingView.HOUR_SPAN=30,TradingView.DAY_SPAN=40,TradingView.WEEK_SPAN=50,TradingView.MONTH_SPAN=60,TradingView.YEAR_SPAN=70,TradingView.DEFAULT_BAR_SPACING=6,TradingView.MAX_BAR_SPACING=50,TradingView.MIN_BAR_SPACING=.5,TradingView.DEFAULT_RIGHT_OFFSET=5,n.prototype.tickMarks=function(){return this.m_tickmarks},n.prototype.reset=function(){this._visibleBarsCache=null,this.m_points=new TradingView.TimeIndexes,this.m_scrollStartPoint=null,this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.m_tickmarks.reset()},n.prototype.restoreDefault=function(){this._visibleBarsCache=null,this.m_barSpacing=TradingView.DEFAULT_BAR_SPACING,this.m_rightOffset=this.Q0.rightOffset.value(),this.saveDefault("barSpacing"),this._correctOffset(),this.recalcLockedScale()},n.prototype.rightOffset=function(){return this.m_rightOffset},n.prototype.scrollToRealtime=function(e){var t=this.Q0.rightOffset.value();if(e){var i=this,r=this.m_rightOffset,n=this.m_width/this.m_barSpacing-10;n>0&&t>n&&(t=n);var o=this.Z98;return void $({offset:r}).animate({offset:t},{duration:1e3,easing:"easeInOutQuint",step:function(e){i._visibleBarsCache=null,i.m_rightOffset=e,o.recalculateAllPanes(),o.Q18(new $21($21.LIGHT_UPDATE)),o.recalcVisibleRangeStudy(o.Q17())}})}this._visibleBarsCache=null,this.m_rightOffset=t,this._correctOffset()},n.prototype.points=function(){return this.m_points},n.prototype.width=function(){return this.m_width},n.prototype.barSpacing=function(){return this.m_barSpacing},n.prototype.setWidth=function(e){this._visibleBarsCache=null,!isFinite(e)||0>=e||(this._locked&&this.m_width&&(this.m_barSpacing*=e/this.m_width),this.m_width=e,this._correctOffset())},n.prototype.visibleBars=function(){if(this._visibleBarsCache)return this._visibleBarsCache;if(!this.isEmpty()){var e=Math.ceil(this.m_width/this.m_barSpacing)-1,t=Math.round(this.m_rightOffset+this.m_points.lastTimePointIndex()),i=t-e,r=new o(i,t);return this._visibleBarsCache=r,r}},n.prototype.isEmpty=function(){return 0===this.m_width||0===this.m_points.size()},n.prototype.indexToCoordinate=function(e,t){if(this.isEmpty())return 0;if(!TradingView.isInteger(e))return 0;var i=this.m_points.lastTimePointIndex()+this.m_rightOffset-e,r=this.m_width-(i+.5)*this.m_barSpacing;return t?r:Math.round(r)},n.prototype.barIndexesToCoordinates=function(e){for(var t=0;t<e.length;t++){var i=e[t].time,r=this.m_points.lastTimePointIndex()+this.m_rightOffset-i,n=this.m_width-(r+.5)*this.m_barSpacing;
e[t].time=Math.round(n),e[t].exactTime=n}},n.prototype.indexesToCoordinates=function(e){for(var t=this.m_points.lastTimePointIndex()+this.m_rightOffset,i=this.m_width-t*this.m_barSpacing-.5*this.m_barSpacing,r=0;r<e.length;r++){var n=e[r].x,o=i+n*this.m_barSpacing;e[r].x=Math.round(o)}},n.prototype.coordinateToIndex=function(e){var t=(this.m_width+1-e)/this.m_barSpacing,i=this.m_points.lastTimePointIndex(),r=i+this.m_rightOffset-t,n=Math.round(1e6*r)/1e6;return Math.ceil(n)},n.prototype.timeToCoordinate=function(e){function t(e){return 0>=e||e>=o.m_width}var i=this.m_points.closestIndexLeft(e),r=this.m_points.valueAt(i),n=this.indexToCoordinate(i,!0),o=this;if(t(n))return null;var a=this.barSpacing(),s=function(){var e=this.m_points.lastTimePointIndex();return this.m_points.valueAt(e)-this.m_points.valueAt(e-1)}.bind(this)(),l=Math.round(n+(e-r)/s*a)+1;return t(l)?null:l},n.prototype.alignCoordinate=function(e){if(this.isEmpty())return e;var t=this.coordinateToIndex(e);return this.indexToCoordinate(t)},n.prototype.timePointToIndex=function(e){return this.m_points.indexOf(e,!0)},n.prototype.indexToTimePoint=function(e){var t=this.m_points.valueAt(e);return t?new Date(1e3*t):null},n.prototype.indexToUserTime=function(e){return this.m_tickmarks.indexToTime(e)},n.prototype.marks=function(){if(this.isEmpty())return null;for(var e=this.m_barSpacing,t=this._scalesProperties.fontSize.value()||0,i=5*(t+4),r=Math.round(i/e),n=this.visibleBars(),o=Math.max(n.firstBar(),n.firstBar()-r),a=Math.max(n.lastBar(),n.lastBar()-r),s=this.m_tickmarks.build(e,i),l=[],d=0;d<s.length;++d){var h=s[d];if(o<=h.index&&h.index<=a){var p=this.m_tickmarks.indexToTime(h.index);null!==p&&l.push({coord:this.indexToCoordinate(h.index),label:this.formatLabel(p,h.span),span:h.span,major:h.label>=TradingView.DAY_SPAN?1:0})}}return l},n.prototype.state=function(e){var t={};return t.m_barSpacing=this.barSpacing(),t.m_rightOffset=this.m_rightOffset,e&&(this.m_points.size()>0&&(t.m_lastVisibleBar=this.m_points.valueAt(this.m_points.lastTimePointIndex())),t.points=this.m_points.state(),t.tickmarks=this.m_tickmarks.state(),t.width=this.m_width),t},n.prototype.restoreState=function(e,t,i){if(this._visibleBarsCache=null,void 0===e.m_barSpacing)return void TradingView.logDebugChart("Z47.restoreState: invalid state");if(void 0===e.m_rightOffset)return void TradingView.logDebugChart("Z47.restoreState: invalid state");if(this.m_barSpacing=e.m_barSpacing,this.m_rightOffset=e.m_rightOffset,this.m_restoredLastTimePoint=e.m_lastVisibleBar,i&&this.m_restoredLastTimePoint){var r=this.m_points.indexOf(this.m_restoredLastTimePoint),n=this.m_points.lastTimePointIndex(),o=n-r;this.m_rightOffset=-o+e.m_rightOffset}t&&(this.m_points.restoreState(e.points),this.m_tickmarks.restoreState(e.tickmarks),e.width&&(this._locked=!0,this.m_width>0&&(this.m_barSpacing*=this.m_width/e.width))),this._correctOffset()},n.prototype.setOffset=function(e){return this._visibleBarsCache=null,void 0===e?void TradingView.logDebugChart("Z47.setOffset: invalid state"):(this.m_rightOffset=e,void this._correctOffset())},n.prototype.setBarSpacing=function(e){return this._visibleBarsCache=null,void 0===e?void TradingView.logDebugChart("Z47.setBarSpacing: invalid state"):void(this.m_barSpacing=e)},n.prototype._correctOffset=function(){if(!this.isEmpty()){var e=this.m_width/this.m_barSpacing-10;e>0&&this.m_rightOffset>e&&(this.m_rightOffset=e,this._visibleBarsCache=null),e=this.m_points.size()-10,this.m_rightOffset<-e&&(this.m_rightOffset=-e,this._visibleBarsCache=null)}},n.prototype.maxOffset=function(){return this.m_width/this.m_barSpacing-10},n.prototype.startScale=function(e){this.m_scrollStartPoint&&this.endScroll(),null===this.m_scaleStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scaleStartPoint=e,this.m_stateSnapshot=this.state()))},n.prototype.scaleTo=function(e){if(this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_stateSnapshot){var t=MathEx.clamp(this.m_width-e,0,this.m_width),i=MathEx.clamp(this.m_width-this.m_scaleStartPoint,0,this.m_width);0!==t&&0!==i&&(this.m_barSpacing=this.m_stateSnapshot.m_barSpacing*t/i,this.m_barSpacing<TradingView.MIN_BAR_SPACING?this.m_barSpacing=TradingView.MIN_BAR_SPACING:this.m_barSpacing>TradingView.MAX_BAR_SPACING&&(this.m_barSpacing=TradingView.MAX_BAR_SPACING),this._correctOffset(),this.recalcLockedScale())}},n.prototype.endScale=function(){null!==this.m_scaleStartPoint&&(this.m_scaleStartPoint=null,this.m_stateSnapshot=null,this.saveDefault("barSpacing"))},n.prototype.saveDefault=function(e){TradingView.saveDefaultProperties(!0),this.Q0[e].setValue(this["m_"+e]),TradingView.saveDefaultProperties(!1)},n.prototype.startScroll=function(e){null===this.m_scrollStartPoint&&null===this.m_stateSnapshot&&(this.isEmpty()||(this.m_scrollStartPoint=e,this.m_stateSnapshot=this.state()))},n.prototype.scrollTo=function(e){if(this._visibleBarsCache=null,delete this.m_restoredLastTimePoint,null!==this.m_scrollStartPoint){var t=(this.m_scrollStartPoint-e)/this.barSpacing();this.m_rightOffset=this.m_stateSnapshot.m_rightOffset+t,this._correctOffset(),this.Z98.mainSeries().priceScale().properties().percentage.value()&&this.recalcLockedScale()}},n.prototype.scrollToOffsetAnimated=function(e,t){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(void 0===t&&(t=400),!isFinite(t)||0>=t)throw new RangeError("animationDuration (optional) must be finite positive number");var i=this,r=this.m_rightOffset,n=+new Date,o=this.Z98;!function a(){i._visibleBarsCache=null;var s=(new Date-n)/t;return s>=1?(i.m_rightOffset=e,i._visibleBarsCache=null,o.recalculateAllPanes(),void o.Q18(new $21($21.LIGHT_UPDATE))):(i.m_rightOffset=r+(e-r)*s,o.recalculateAllPanes(),void setTimeout(a,20))}()},n.prototype.endScroll=function(){null!==this.m_scrollStartPoint&&(this.m_scrollStartPoint=null,this.m_stateSnapshot=null)},n.prototype._currentSavedPosition=function(){if(!this.isEmpty()){var e=this.m_points.indexOf(this.m_restoredLastTimePoint,!0);if(TradingView.isInteger(e)){var t=this.m_points.lastTimePointIndex(),i=t-e;this.m_rightOffset-=i}delete this.m_restoredLastTimePoint}},n.prototype.update=function(e,t,i,r){this._visibleBarsCache=null,this.m_tickmarks.merge(r),this.m_points.merge(e,t,i),this.m_restoredLastTimePoint&&this._currentSavedPosition()},n.prototype.addTail=function(e,t,i){this.m_tickmarks.removeTail(t);for(var r=e.params,n=this.m_tickmarks.maxIndex+(i?0:1),o=0;o<r.marks.length;o++)r.marks[o].index=n+o;this.m_tickmarks.addTail(r.marks),this.m_points.addTail(r.changes,i),this.m_rightOffset-=r.changes.length},n.prototype.formatLabel=function(e,t){if(this._formattedBySpan[t])return this._formattedBySpan[t].format(e.valueOf());var i=this;return this._formattedBySpan[t]=new a(function(e){return i.formatLabelImpl(new Date(e),t)}),this._formattedBySpan[t].format(e)},n.prototype.formatLabelImpl=function(e,t){if(!(e&&e instanceof Date))return"incorrect time";var i=this.Z98.mainSeries().isDWM();return t<TradingView.MINUTE_SPAN&&!i?TradingView.numberToStringWithLeadingZero(e.getUTCHours(),2)+":"+TradingView.numberToStringWithLeadingZero(e.getUTCMinutes(),2)+":"+TradingView.numberToStringWithLeadingZero(e.getUTCSeconds(),2):t<TradingView.DAY_SPAN&&!i?TradingView.numberToStringWithLeadingZero(e.getUTCHours(),2)+":"+TradingView.numberToStringWithLeadingZero(e.getUTCMinutes(),2):t<TradingView.WEEK_SPAN?e.getUTCDate():t<TradingView.MONTH_SPAN?e.getUTCDate():t<TradingView.YEAR_SPAN?(TradingView.MONTH_NAMES||(TradingView.MONTH_NAMES=r()),TradingView.MONTH_NAMES[e.getUTCMonth()]):e.getUTCFullYear()},n.prototype.normalizeBarIndex=function(e){var t=0,i=0;return e<this.m_points.firstTimePointIndex()?(t=this.m_points.valueAt(this.m_points.firstTimePointIndex()),i=e-this.m_points.firstTimePointIndex()):e>this.m_points.lastTimePointIndex()?(t=this.m_points.valueAt(this.m_points.lastTimePointIndex()),i=e-this.m_points.lastTimePointIndex()):(t=this.m_points.valueAt(e),i=0),{time_t:t,offset:i}},n.prototype.denormalizeTimePoint=function(e){var t=Z75.enabled("charting_library_base")?this.m_points.closestIndexLeft(e.time_t):this.m_points.indexOf(e.time_t);if(void 0!==t)return t+e.offset},n.prototype.zoomToBarsRange=function(e,t){if(!(e>=t)){var i=this.m_points.lastTimePointIndex();i&&(this.m_rightOffset=t-i),this.m_barSpacing=this.width()/(t-e+1),this._visibleBarsCache=null}},n.prototype.recalcLockedScale=function(){if(this.Z98.m_mainSeries.properties().lockScale.value()&&!this.isEmpty()){var e=this.Z98.m_mainSeries.priceScale(),t=this.Z98.m_mainSeries,i=t.data().boxSize;if(i||(t.fixBoxSize(),i=t.data().boxSize),i){if(e.properties().percentage.value()){var r=t.data().search(t.getRealVisibleRange().m_firstBar).value[TradingView.CLOSE_PLOT];i=PriceRange.prototype.convertToPercent.call(null,r+i,r)-PriceRange.prototype.convertToPercent.call(null,r,r)}var n=e.internalHeight()/(this.barSpacing()/i),o=t.priceScale().priceRange();if(!o||n!=o.length()){if(!o||o.isEmpty()){var a=this.visibleBars();o=t.priceRange(a.firstBar(),a.lastBar())}else{var s=(n-o.length())/2;o.m_minValue-=s,o.m_maxValue+=s}t.priceScale().setPriceRange(o)}}}},n.prototype.correctBarSpacing=function(){this.isEmpty()||this.points().size()<this.width()/this.barSpacing()&&(this.setOffset(TradingView.DEFAULT_RIGHT_OFFSET),this.setBarSpacing(Math.min(this.width()/(this.points().size()+this.rightOffset()),TradingView.MAX_BAR_SPACING)))},n.prototype.canZoomIn=function(){return this.m_barSpacing<TradingView.MAX_BAR_SPACING},n.prototype.canZoomOut=function(){return this.m_barSpacing>TradingView.MIN_BAR_SPACING},e.exports=n},function(e,t){"use strict";function i(){this._marksByIndex={},this._marksBySpan=[],this.changed=new Delegate}i.prototype.reset=function(){this._marksByIndex={},this._marksBySpan=[],delete this.minIndex,delete this.maxIndex,delete this._cache,this.changed.fire()},i.prototype.minIndex=void 0,i.prototype.maxIndex=void 0,i.prototype.merge=function(e){for(var t=this._marksBySpan,i={},r=0;r<e.length;r++){var n=e[r],o=n.index,a=n.span,s=this._marksByIndex[n.index];if(s){if(s.index===n.index&&s.span===n.span){s.time=n.time;continue}this._removeTickmark(s)}this._marksByIndex[o]=n,this.minIndex<=o||(this.minIndex=o),this.maxIndex>=o||(this.maxIndex=o);t[a]||(t[a]=[]),t[a].push(n),i[a]=!0}for(var a=t.length;a--;)t[a]&&(t[a].length||delete t[a],i[a]&&t[a].sort(this._sortByIndexAsc));delete this._cache,this.changed.fire()},i.prototype._removeTickmark=function(e){var t=e.index;if(this._marksByIndex[t]===e){delete this._marksByIndex[t],t<=this.minIndex&&this.minIndex++,t>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(delete this.minIndex,delete this.maxIndex);var i=this._marksBySpan[e.span],r=i.indexOf(e);-1!==r&&i.splice(r,1)}},i.prototype._sortByIndexAsc=function(e,t){return e.index-t.index},i.prototype.removeTail=function(e){var t={};this.maxIndex=0;for(var i in this._marksByIndex)this._marksByIndex[i].time<e&&(t[i]=this._marksByIndex[i],this.maxIndex=Math.max(this.maxIndex,i));this._marksByIndex=t},i.prototype.addTail=function(e){for(var t=0;t<e.length;t++)e[t].index=this.maxIndex+t+1;this.merge(e)},i.prototype.indexToTime=function(e){var t=this._marksByIndex[e];return t?new Date(1e3*t.time):null},i.prototype.density=function(){var e=this.maxIndex-this.minIndex;if(0!==e){var t=this._marksByIndex[this.maxIndex].time-this._marksByIndex[this.minIndex].time,i=1e3*t/e;return i}},i.prototype.estimateLeft=function(e){var t=this.density();if(t){var i=1e3*this._marksByIndex[this.minIndex].time-e,r=i/t;return r}},i.prototype.nearestIndex=function(e){for(var t=this.minIndex,i=this.maxIndex;i-t>2;){if(1e3*this._marksByIndex[t].time==e)return t;if(1e3*this._marksByIndex[i].time==e)return i;var r=Math.round((t+i)/2);1e3*this._marksByIndex[r].time>e?i=r:t=r}return t},i.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 r=[],n=this._marksBySpan.length;n--;)if(this._marksBySpan[n]){var o=r;r=[];for(var a=o.length,s=0,l=this._marksBySpan[n],d=l.length,h=1/0,p=-(1/0),c=0;d>c;c++){for(var u=l[c],_=u.index;a>s;){var f=o[s],g=f.index;if(!(_>g)){h=g;break}s++,r.push(f),p=g,h=1/0}h-_>=i&&_-p>=i&&(r.push(u),p=_)}for(;a>s;s++)r.push(o[s])}return this._cache=r,this._cache},i.prototype.state=function(){for(var e=[],t=this._marksBySpan.length;t--;)this._marksBySpan[t]&&(e=e.concat(this._marksBySpan[t]));return e=e.map(function(e){return[e.span,e.time,e.index]}),{marks:e,version:2}},i.prototype.restoreState=function(e){if(this._marksByIndex={},this._marksBySpan=[],delete this.maxIndex,delete this.minIndex,e&&e.marks&&e.marks.length)if(2===e.version){var t=e.marks.map(function(e){return{span:e[0],time:e[1],index:e[2]}});this.merge(t)}else this.merge(e.marks)},e.exports=i},function(e,t,i){"use strict";function r(e){a.call(this,e);var t=this;TradingView.drawingState.hideMarksOnBars().subscribe(this,function(){t.Q0.visible.setValue(!TradingView.drawingState.hideMarksOnBars().value())}),this._paneView=new n(this)}function n(e,t){this.source=e,this._rendererFactory=t,this.stylesCache={},this.templatesCache={},this._createLollipops()}var o=i(63).ESDPaneView,a=i(71).BarsMarksContainer;inherit(r,a),r.prototype._initialize=function(e){this.Q0.visible.setValue(!0)},r.prototype.userEditEnabled=function(){return!1},r.prototype._constructor="UserDefinedTimescaleMarks",r.prototype._plateViewData=function(e){return{text:e.text}},r.prototype.onClicked=function(){var e=this.Z98.lastHittestData().id;Q15.emit("onTimescaleMarkClick",e)},r.prototype.clearMarks=function(){a.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},r.prototype._getData=function(e){var t=this.Z98.mainSeries().symbolInfo();if(t){var i=(this.Z98.timeScale(),this.roundRange(this._rangeDifference(e))),r=this,n=this.Z98.mainSeries().properties().interval.value();Q14.getTimescaleMarks(t,i.start,i.end,function(t){t.forEach(function(e){r._marks[e.id]=e},r),r._loadedRange=r._rangeUnion(e,r._loadedRange),r.onNeedRepaint.fire()},n)}},r.prototype.updatePlateData=function(e,t){return t.barWidth=this.barWidth(),t.text=e.text,t.tooltipMargin=-1*Math.max(e.minSize/2,.4*this.barWidth()),t},r.prototype.hasContextMenu=function(){return!1},r.prototype.paneViews=function(e){return this.Q0.visible.value()?[this._paneView]:[]},inherit(n,o),n.prototype._createLollipops=function(){this.lollipops=[];var e=this.source.Z98.timeScale(),t=o.prototype._getY.call(this.source),i=this.source.Z98.lastHittestData(),r=this;$.each(this.source._marks,function(n,o){var a={id:o.id,basePoint:new MathEx.Point(e.indexToCoordinate(e.timePointToIndex(o.tickmark))+1,t),hovered:i&&i.id==o.id,barY:null,label:o.label,color:o.color,tooltip:o.tooltip};r.lollipops.push(a)})},n.prototype.update=function(){this._createLollipops()},n.prototype.renderer=function(){return this.update(),o.prototype.renderer.call(this)},n.prototype._generateTemplateStyle=function(e,t,i){var r=e+t+i;if(!(r in this.stylesCache)){var n={strokeStyle:t,lineWidth:1,fillStyle:"white",barLine:{lineStyle:CanvasEx.LINESTYLE_DASHED},lollipop:{width:32,height:64,circleHeight:35,radius:11,lineWidth:2,fillStyle:"white",strokeStyle:"#E2745B",text:{label:i,strokeStyle:t,font:"normal 12px Verdana, Arial, sans-serif"}}},o={lollipop:{fillStyle:t,text:{strokeStyle:"white"}}};this.stylesCache[r]="default"===e?n:$.extend(!0,{},n,o)}return this.stylesCache[r]},n.prototype.getTemplate=function(e,t){var i=e+t.color+t.label;return i in this.templatesCache||(this.templatesCache[i]=this.createTemplate(this._generateTemplateStyle(e,t.color,t.label))),this.templatesCache[i]},n.prototype.getStyle=function(e,t){return this._generateTemplateStyle(e,t.color,t.label)},n.prototype.createText=function(e,t){e.tooltip.forEach(function(e){t.addTextLine(e)})},n.prototype.hasTooltip=function(e){return!!e.tooltip&&e.tooltip.length},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i=e._undoModel.Q2,r=i.onWidget(),n=!1;n=r?i._options&&!i._options.hideIdeas:TVSettings.getBool("BarsMarksContainer.visibile",!1),t?t.merge({visible:n,frozen:!1}):t=new Property({visible:n,frozen:!1});var o=this;t.visible.listeners().subscribe(null,function(e){r||i._containsData||TVSettings.setValue("BarsMarksContainer.visibile",!!e.value()),o._tooltip&&o._tooltip.removeAll()}),d.call(this,e,null,t),this.onNeedRepaint=new Delegate,this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this.Z98.mainSeries().onSymbolIntervalChanged().subscribe(this,this.clearMarks),this.Z98.mainSeries().onSymbolResolved().subscribe(this,this.clearMarks),this.Z98.mainSeries().onTickmarksRangeChanged().subscribe(this,this.getData),this._initialize(),this.pinnedTooltips={},this._tooltip=new s(this._createTooltip.bind(this),this)}function n(e,t,i){this.source=e,this.pane=t,this._rendererFactory=i}function o(e,t){this._barWidth=e.barWidth,this._plates=e.plates,this._tooltip=e.tooltip,this.Z98=t}function a(){this._layout=[],this._currentId=void 0,this.tooltipHovered=!1}function s(e,t){this.tooltips={},this.tooltipFactory=e,this.source=t}function l(e,t){this.renderer=e,this._tooltip=t,this.visible=!1}var d=i(13).LineDataSource;inherit(r,d),r.prototype._constructor="Child class must override this member",r.prototype._initialize=function(e){throw"Child class must override this member"},r.prototype.onClicked=function(){throw"Child class must override this member"},r.prototype._getData=function(e){throw"Child class must override this member"},r.prototype._createTooltip=function(){throw"Child class must override this member"},r.prototype.updateDotData=function(e,t){return t},r.prototype.updatePlateData=function(e,t){},r.prototype._plateViewData=function(e){return{}},r.prototype.pinTooltip=function(e,t){this.pinnedTooltips[e]=t},r.prototype.timeScale=function(){return this.Z98.timeScale()},r.prototype.getIntervalInTicks=function(){function e(e){if(e=parseInt(e),e!=e)throw new TypeError("Unexpected interval");return 60*e}var t=e(1440),i=7*t,r=31*t,n=this.Z98.mainSeries().properties().interval.value();switch(n){case"M":return r;case"W":return i;case"D":return t;default:return e(n)}},r.prototype._maxDate=new Date(2037,0,1),r.prototype.getVisibleTickmarksRange=function(){if(this.timeScale().isEmpty())return{start:0,end:0};var e=this.timeScale().visibleBars();if(!(e.lastBar()>this.timeScale().points().firstTimePointIndex()&&e.firstBar()<this.timeScale().points().lastTimePointIndex()))return{start:0,end:0};var t;return t=e.lastBar()<this.timeScale().points().lastTimePointIndex()?this.timeScale().indexToTimePoint(e.lastBar()):this._maxDate,e={start:this.timeScale().indexToTimePoint(Math.max(e.firstBar(),this.timeScale().points().firstTimePointIndex())),end:t},{start:e.start?e.start.getTime()/1e3:void 0,end:e.end?e.end.getTime()/1e3:void 0}},r.prototype.getVisibleRangePlates=function(){var e=[],t=this.getVisibleTickmarksRange(),i=this.getIntervalInTicks();return $.each(this._marks,function(r,n){var o=n.tickmark;o>=t.start&&o<=t.end+i&&e.push(n)}),e},r.prototype.getPublishedPlates=function(){var e={},t=this;return is_authenticated?($.each(this.getVisibleRangePlates(),function(i,r){r.is_public&&(t.pinnedTooltips[r.id]||r.user__id==user.id)&&(e[r.id]=r)}),e):e},r.prototype._maxPlatesPerBar=10,r.prototype.filterDisplayedPlates=function(e){return e=e.reduce(function(e,t){var i=this._getIndex(t.tickmark);return e[i]=e[i]||[],e[i].push(t),e}.bind(this),{}),e=Object.keys(e).reduce(function(t,i){var r=e[i];return r=r.sort(function(e,t){return t.views_count-e.views_count}),r=r.slice(0,this._maxPlatesPerBar),t.concat(r)}.bind(this),[])},r.prototype._layout=function(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"}},r.prototype._theme=function(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"}},r.prototype._offset=function(e,t){var i;switch(e){default:case"up":i=t[TradingView.HIGH_PLOT];break;case"down":i=t[TradingView.LOW_PLOT]}return this.priceScale().isPercent()&&(i=this.priceScale().priceRange().convertToPercent(i,this.ownerSource().firstValue())),this.priceScale().priceToCoordinate(i)},r.prototype._getIndex=function(e){return this.timeScale().timePointToIndex(e)},r.prototype.getViewData=function(){return{barWidth:this.barWidth(),plates:this.getPlatesViewData(),tooltip:this._tooltip}},r.prototype.barWidth=function(){return this.timeScale().barSpacing()},r.prototype.getPlatesViewData=function(){if(this.Z98.mainSeries().data().isEmpty())return[];var e=this.filterDisplayedPlates(this.getVisibleRangePlates()),t=this,i={},r=this.Z98.lastHittestData();e=e.map(function(e){var n=this._getIndex(e.tickmark),o=this._getBar(n);if(!o)return!1;var a=this._layout(e.direction),s=this._theme(e.direction),l=r&&r.id==e.id,d=this.timeScale().indexToCoordinate(n),h=this._offset(a,o),p=0;return n in i||(i[n]={up:0,down:0}),p=i[n][a]++,TradingView.merge({id:e.id,x:d,y:h,order:p,direction:a,theme:s,hovered:l,pinned:t.pinnedTooltips[e.id]===!0,user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||0},this._plateViewData(e))}.bind(this)),e=e.filter(function(e){return!!e});for(var n=e.filter(function(e){return e.hovered===!0}),o=0;o<e.length;o++)null!=n[0]&&e[o].user__id==n[0].user__id&&(e[o].highlightByAuthor=!0);return e.sort(function(e,t){return e.hovered&&!t.hovered?1:0}),e},r.prototype._getBar=function(e){return this.Z98.mainSeries().data().valueAt(e)},r.prototype.paneViews=function(e){var t=this;return this.Q0.visible.value()?[new n(this,e,function(e){return new o(e.getViewData(),t)})]:[]},r.prototype.dataWindowView=function(){return null},r.prototype.priceAxisViews=function(){return null},r.prototype.statusView=function(){return null},r.prototype.updateAllViews=function(){},r.prototype.pointsCount=function(){return 0},r.prototype.properties=function(){return this.Q0},r.prototype._rangeDifference=function(e){return e=$.extend({},e),this._loadedRange&&(e.start<this._loadedRange.start?e.end=this._loadedRange.start:e.end>this._loadedRange.end&&(e.start=this._loadedRange.end)),e},r.prototype._rangeUnion=function(e,t){return e=$.extend({},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e},r.prototype._pushGetDataStack=function(e){if(!e.end||!e.start)throw new TypeError("Wrong tickmark range");this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout(function(){this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}.bind(this),300)},r.prototype.roundRange=function(e){return{start:Math.round(e.start),end:Math.round(e.end)}},r.prototype.refreshData=function(){this.getData(this._lastRange)},r.prototype.getData=function(e){if(!e.start||!e.end)throw new TypeError("Wrong range");this._lastRange=e;var e=$.extend({},e);e.end=this._maxDate/1e3,this._pushGetDataStack(e)},r.prototype._abortAllRequests=function(){this._requests.forEach(function(e){e.abort()}),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null},r.prototype.clearMarks=function(){this._abortAllRequests(),this._marks={},this._loadedRange=null},n.prototype.update=function(){},n.prototype.renderer=function(){return this._rendererFactory(this.source)},o.prototype.draw=function(e){e.save();for(var t=0;t<this._plates.length;t++)if(this._plates[t].highlightByAuthor){this._highlightByAuthor=!0;break}this._plates.forEach(this._drawItem.bind(this,e)),this._tooltip.draw(this._plates.map(function(e){return this._plateTransform(e)}.bind(this)),e),this._tooltip.endDraw(),e.restore()},o.prototype._drawItem=function(e,t){e.save(),this._highlightByAuthor&&!t.highlightByAuthor&&(e.globalAlpha=.4);var i=this._dotTransform(t);i.mine?this._drawTriangle(e,i):this._drawDot(e,i),e.restore()},o.prototype._commonTransform=function(e){var t=Math.max(1.4*e.minSize,this._barWidth+4),i=e.y+{up:-1,down:1}[e.direction]*(t*(e.order+.6)+.25*t),r=TradingView.clone(e.overridedTheme||this.themes[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(i),pinned:e.pinned,hovered:e.hovered}},o.prototype._dotTransform=function(e){var t=this._commonTransform(e);return t.radius=Math.max(e.minSize/2,.4*this._barWidth),t.label=e.label,t.labelFontColor=e.labelFontColor,t.labelFontSize=Math.ceil(Math.max(10,Math.min(t.radius,20))),this.Z98.updateDotData(e,t)},o.prototype._plateTransform=function(e){var t=this._commonTransform(e);return this.Z98.updatePlateData(e,t)},o.THEMES=["green","red","neutral","yellow","blue"],o.prototype.themes={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"}},o.prototype._drawTriangle=function(e,t){e.strokeStyle=t.theme.border,e.fillStyle=t.theme.background,e.lineWidth=t.theme.dotBorderWidth;var i=t,r=t.radius,n=Math.cos(Math.PI/6)*r,o=Math.sin(Math.PI/6)*r;e.translate(i.x,i.y),"up"==t.direction&&e.rotate(Math.PI),t["public"]||(e.lineWidth/=2),e.beginPath(),e.moveTo(0,-r),e.lineTo(n,o),e.lineTo(-n,o),e.lineTo(0,-r),e.closePath(),e.stroke(),t["public"]&&e.fill()},o.prototype._drawDot=function(e,t){e.strokeStyle=t.theme.border,e.fillStyle=t.theme.background,e.lineWidth=t.theme.dotBorderWidth,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>6&&(e.textAlign="center",e.textBaseline="middle",e.font="bold "+t.labelFontSize+"px Arial",e.fillStyle=t.labelFontColor,e.fillText(t.label,t.x,t.y))},o.prototype.hitTest=function(e){for(var t,i=this._plates.length-1;i>=0;--i)if(t=this._hitTestDot(this._plates[i],e))return t;return null},o.prototype._hitTestDot=function(e,t){var i=this._dotTransform(e),r=new MathEx.Point(i.x,i.y);return MathEx.isInCircle(r,Math.max(i.radius,8),t)?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR,e):null},a.prototype._createLayout=function(){throw"Child class must override this member"},a.prototype._updatePlate=function(e){throw"Child class must override this member"},a.prototype._getContainer=function(e){return this._container&&this._context===e||(this._context=e,this._container=$(e.canvas).parent()),this._container},a.prototype._plateArrowSize=14,a.prototype.showPlate=function(e,t){if(this._currentId!=e.id||!this._layout||0===this._layout.length||null==this._layout[0].parentNode){this._currentId=e.id,this._createLayout(),this._getContainer(t).append(this._layout);var i=this;this._layout.hover(function(){i.tooltipHovered=!0,$(this).stop(!0).fadeTo(0,1)},function(){i.tooltipHovered=!1})}var r=Math.round(e.barWidth/2);r>15&&(r=15),10>r&&(r=10),this._updatePlate(e);var n=e.x-this._layout.outerWidth()<this._plateArrowSize,o=t.canvas.width-e.x+Math.round(e.barWidth/2+r);n&&(o-=this._layout.outerWidth()+2*this._plateArrowSize);var a=t.canvas.height,s=20,l=10;this._layout.toggleClass("right",n),this._layout.css({top:Math.min(Math.max(e.y,s),a-this._layout.outerHeight()-l),right:o,fontSize:r+"px",display:"block"})},a.prototype._removeLayout=function(){this.tooltipHovered||(this._layout.stop(!0),this._layout.remove())},a.prototype._toggleLayout=function(e){this._layout.toggle(e)},a.prototype.hide=function(e){this.tooltipHovered?this._layout.stop(!0).fadeTo(0,1):this._layout.fadeOut(400,function(){$(this).remove(),e()})},a.prototype.setSource=function(e){this.source=e},s.prototype.findOrCreateTooltip=function(e){var t=this.tooltips[e.id];return null==t&&(e.hovered||e.pinned)&&(t=this._createTooltip(),this.tooltips[e.id]=t),t},s.prototype.showPlate=function(e,t){var i=this.findOrCreateTooltip(e);null!=i&&(i._drawPlate(e,t),i.plateData=e)},s.prototype.draw=function(e,t){this.hoveredId=null;for(var i=0;i<e.length;i++)e[i].hovered&&(this.hoveredId=e[i].id);e.forEach(function(e){this.showPlate(e,t)}.bind(this))},s.prototype.endDraw=function(){var e=this;for(var t in this.tooltips)if(this.tooltips.hasOwnProperty(t)){var i=this.tooltips[t];i.toggleVisibility(),e.hoveredId&&i.plateData.id!=e.hoveredId&&!i.plateData.pinned&&(i.remove(),delete this.tooltips[t])}},s.prototype.removeAll=function(){for(var e in this.tooltips)if(this.tooltips.hasOwnProperty(e)){var t=this.tooltips[e];t.remove()}this.tooltips={}},s.prototype.removeTooltip=function(e){delete this.tooltips[e]},s.prototype._createTooltip=function(){return new l(this,this.tooltipFactory())},l.prototype._drawPlate=function(e,t){var i=this;this.visible=!0,this._tooltip.setSource(this.renderer.source),this._tooltip.showPlate(e,t),e.hovered||e.pinned||this._tooltip.hide(function(){i.renderer.removeTooltip(e.id)})},l.prototype.remove=function(){this._tooltip._removeLayout()},l.prototype.toggleVisibility=function(){this._tooltip._toggleLayout(this.visible),this.visible=!1},t.BarsMarksContainer=r,t.BarsMarksContainerRenderer=o,t.BarMarkTooltip=a},function(e,t,i){"use strict";function r(e){var t=TVSettings.getValue("PublishedChartsTimeline.filter","all");is_authenticated||(t=r.FILTER_NONE);var i=new Property({filter:t});a.call(this,e,i),this._currentRange=null,this.Q0.visible.listeners().subscribe(this,function(e){this._getData(this._currentRange)}),this.Q0.filter.listeners().subscribe(this,function(e){TVSettings.setValue("PublishedChartsTimeline.filter",e.value()),this.clearMarks(),this._getData(this._currentRange)});var n=e._undoModel.Q2;this._containsData=n._containsData,this._containsData&&this.Q0.visible.setValue(!0),this.setUserEditEnabled(!1)}function n(e){l.call(this)}var o=i(71),a=o.BarsMarksContainer,s=o.BarsMarksContainerRenderer,l=o.BarMarkTooltip;r.FILTER_NONE="all",r.FILTER_FOLLOWING="following",r.FILTER_PRIVATE="private",inherit(r,a),r.prototype._initialize=function(e){TradingView.pushStreamMultiplexer&&(TradingView.pushStreamMultiplexer.on("ideas",$.proxy(this,"_onMessage")),TradingView.pushStreamMultiplexer.on("ideas.post",$.proxy(this,"_onMessage")))},r.prototype._constructor="PublishedChartsTimeline",r.prototype._plateViewData=function(e){return{img:e.avatar,title:e.title,username:e.username,suggested:e.is_hot,mine:null!=window.user?e.user__id==window.user.id:!1,"public":e.is_public}},r.prototype.showIdea=function(e,t){var i=this._marks[e],r=this;if(!i)return void TradingView.logDebugChart("PublishedChartsTimeline.showIdea: unexpected published chart id");if(TradingView.trackEvent("GUI","View published idea"),t&&TradingView.trackEvent("GUI","Ideas navigation arrow"),TradingView.onWidget()||this._containsData){var n=i.published_chart_url||"/v/"+i.image_url+"/";return"battle"==TradingView.Environment()&&(n="https://www.tradingview.com"+n),void window.open(n)}var o=this.filterDisplayedPlates($.extend([],this._marks)).sort(TradingView.sortMultipleFunction({name:"tickmark",fn:this._getIndex.bind(this)},{name:"direction",fn:function(e){switch(this._layout(e)){default:case"up":return 0;case"down":return 1}}.bind(this)},"views_count")),a=o.indexOf(i),s=new TradingView.HistoryManager.ChartPage(i.image_url,i.name,i.published_chart_url,i.short_name);s.onOpen().subscribe(this,function(){var e=$(".fancybox-wrap");o[a-1]&&$('<a href="#" class="fancy-box-arrow left"><span>&lt;</span></a>').click(function(e){r.showIdea(o[a-1].id,!0),e.preventDefault()}).prependTo(e),o[a+1]&&$('<a href="#" class="fancy-box-arrow right"><span>&gt;</span></a>').click(function(e){r.showIdea(o[a+1].id,!0),e.preventDefault()}).appendTo(e)}),TradingView.historyManager.push(s)},r.prototype.onClicked=function(){
this.showIdea(this.Z98.lastHittestData().id)},r.prototype.state=function(e){var t={type:"BarsMarksContainer",id:this.id(),zorder:this._zOrder,pinnedTooltips:this.pinnedTooltips};return e&&(t.marks=this.getPublishedPlates()),t},r.prototype.asyncState=function(e){var t=$.Deferred(),i=this;return!this.Q0.visible.value()&&e?this._getData(this._currentRange,!0).then(function(){t.resolve(i.state(e))}):t.resolve(i.state(e)),t.promise()},r.prototype.restoreData=function(e,t){null!=this.pinnedTooltips&&(this.pinnedTooltips=e.pinnedTooltips),t&&null!=e.marks&&(this._marks=e.marks)},r.prototype._getData=function(e,t){var i=this.Z98.mainSeries().properties(),r=this.Z98.mainSeries().symbolInfo();if(this._currentRange=e,r&&(this.Q0.visible.value()||t)){var n=r.base_name.length>1?r.base_name:[r.pro_name],o=this.roundRange(this._rangeDifference(e));n=TradingView.uniq(n),n=n.sort(function(e,t){return e-t});var a={interval:i.interval.value(),legs:JSON.stringify(n),startTickmark:o.start,endTickmark:o.end,filter:this.Q0.filter.value()},s=$.ajax("/charttimeline/",{type:"POST",data:a,dataType:"json"}).done(function(t){function i(e){return new Date(1e3*e).toUTCString()}t.forEach(function(e){this._marks[e.id]=e},this),this._loadedRange=this._rangeUnion(e,this._loadedRange);var r=this._requests.indexOf(s);~r&&this._requests.splice(r,1),this.onNeedRepaint.fire();({start:i(o.start),end:i(o.end)})}.bind(this));return this._requests.push(s),s}},r.prototype._onMessage=function(e){if(!this._containsData){var t=this.Z98.mainSeries(),i=t.symbolInfo(),r=i&&i.base_name;if(r){var n=t.properties();e.interval===n.interval.value()&&~r.indexOf(e.pro_symbol)&&(this._marks[e.id]=e,this.onNeedRepaint.fire())}}},r.prototype._createTooltip=function(){return new n},r.prototype.updateDotData=function(e,t){return t.mine=e.mine,t["public"]=e["public"],t.direction=e.direction,t},r.prototype.updatePlateData=function(e,t){return t.img=e.img,t.title=e.title,t.username=e.username,t.barWidth=this.barWidth(),t},inherit(n,l),n.prototype._createLayout=function(){this._layout=$('<div class="published-charts-tooltip"></div>'),this._layout_avatar=$('<div class="avatar"><img></div>').appendTo(this._layout),this._layout_text=$('<div class="text"></div>').appendTo(this._layout),this._layout_username=$('<div class="username">'+$.t("by username",{username:"<b></b>"})+"</div>").appendTo(this._layout),this._layout_pin=$('<div class="pin"></div>').appendTo(this._layout);var e=this;this._layout_pin.click(function(){e.plateData.pinned=!e.plateData.pinned,e.source.pinTooltip(e.plateData.id,e.plateData.pinned),e._layout_pin.toggleClass("pinned",e.plateData.pinned)}),this._layout_text.click(function(){e.source.showIdea(e.plateData.id)})},n.prototype._updatePlate=function(e){this.plateData=e,this._layout.removeClass(s.THEMES.join(" ")).addClass(e.themeName),this._layout_avatar.find("img").attr("src",e.img),this._layout_avatar.find("img").attr("alt",e.username),this._layout_text.text(e.title),this._layout_username.find("b").text(e.username),this._layout_pin.toggleClass("pinned",e.pinned)},e.exports=r},function(e,t,i){"use strict";function r(e){a.call(this,e);var t=this;TradingView.drawingState.hideMarksOnBars().subscribe(this,function(){t.Q0.visible.setValue(!TradingView.drawingState.hideMarksOnBars().value())})}function n(e){s.call(this)}var o=i(71),a=o.BarsMarksContainer,s=o.BarMarkTooltip;inherit(r,a),r.prototype._initialize=function(e){this.Q0.visible.setValue(!0)},r.prototype.userEditEnabled=function(){return!1},r.prototype._constructor="UserDefinedBarsMarks",r.prototype._plateViewData=function(e){var 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},r.prototype.onClicked=function(){var e=this.Z98.lastHittestData().id;this._marks[e].onClicked()},r.prototype.clearMarks=function(){a.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},r.prototype._getData=function(e){var t=this.Z98.mainSeries().symbolInfo();if(t){var i=this.roundRange(this._rangeDifference(e)),r=this,n=this.Z98.mainSeries().properties().interval.value();Q14.getMarks(t,i.start,i.end,function(t){t.forEach(function(e){r._marks[e.id]=e},r),r._loadedRange=r._rangeUnion(e,r._loadedRange),r.onNeedRepaint.fire()},n)}},r.prototype._createTooltip=function(){return new n},r.prototype.updatePlateData=function(e,t){return t.barWidth=this.barWidth(),t.text=e.text,t.tooltipMargin=-1*Math.max(e.minSize/2,.4*this.barWidth()),t},r.prototype.hasContextMenu=function(){return!1},inherit(n,s),n.prototype._createLayout=function(){this._layout=$('<div class="bar-mark-tooltip"></div>'),this._layout_text=$('<div class="text"></div>').appendTo(this._layout)},n.prototype._updatePlate=function(e){this._currentId=e.id,this._layout.css("border-color",e.theme.border),this._layout.css("margin-top",e.tooltipMargin+"px"),this._layout_text.html(e.text),this._layout.append(this._layout_text)},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){this.Z99=e,this.m_series=t,this.m_model=i,this._plotName=r,this._visible=!1,this._points=[new MathEx.Point(0,0)],this._invalidated=!0}function n(){return{visible:!0,color:"#0496FF",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:2,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0,transparency:50,trackPrice:!1,joinPoints:!1}}function o(e,t,i,r){var n,o;return r.isTVScriptStrategy?n="StudyStrategy":(o="study_"+(r.classId||r.shortId),n=o in TradingView?o:"Study"),new TradingView[n](e,t,i,r)}function a(e,t,i,r){return s(e,t,i,r,"study_"+e.id)}function s(e,t,i,r,n){var o=h(e,t,i,r),a=new J50(n,o,!0);a.addExclusion("visible"),a.addExclusion("precision"),a.addExclusion("minTick");for(var s=0;s<e.inputs.length;++s){var l=e.inputs[s];l.isHidden&&(a.addExclusion("inputs."+s),a.addExclusion("inputs."+l.id))}return a}function l(e,t,i,r,n){return d(e,t,i,r,n,"study_"+e.id)}function d(e,t,i,r,n,o){var a=p(e,t,i,r,n),s=new J50(o,a,!0);s.addExclusion("visible"),s.addExclusion("precision"),s.addExclusion("minTick");for(var l=t||e,d=0;d<l.inputs.length;++d){var h=l.inputs[d];h.isHidden&&(s.addExclusion("inputs."+d),s.addExclusion("inputs."+h.id))}return s}function h(e,t,r,n){var o=i(80),a=TradingView.StudyMetaInfo.versionOf(e);if(1>a)throw Error("This function cannot work with metainfo of the old format version. Required format version >= 1");var s=TradingView.clone(defaults("study"));u(s,e);var l=TradingView.clone(defaults("study_"+e.id,n));e.isTVScript&&e.TVScriptSourceCode!==l.TVScriptSourceCode&&(l=TradingView.clone(TradingView.factoryDefaults("study_"+e.id,n))),TradingView.merge(s,l),t&&(assert(!(t instanceof Property),"propsState should not be an instance of Property"),TradingView.merge(s,t));var d=_(e),h={};o.mergeInputs(h,d.defaults.inputs),o.mergeInputsObjPart(h,s.inputs),o.mergeInputsArrPart(h,d.inputs),s.inputs=h,delete d.inputs,delete d.defaults.inputs;var p={};TradingView.merge(p,d.defaults),TradingView.merge(p,TradingView.factoryDefaults("study_"+d.id)),TradingView.merge(p,s),TradingView.merge(p,d),delete p.defaults,s=p;var c=f(r,e);return TradingView.merge(s,g(s,c)),t&&TradingView.merge(s.styles,t.styles),s}function p(e,t,r,n,o){var a=i(80),s=TradingView.StudyMetaInfo.versionOf(e);e.version&&r.version&&e.version!==r.version&&TradingView.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+r.version);var l=TradingView.clone(defaults("study"));if(0===s){TradingView.merge(l,TradingView.clone(e));var d=_(e);TradingView.merge(l.inputs,d.inputs)}else s>=1&&TradingView.merge(l,TradingView.clone(e.defaults));TradingView.merge(l,TradingView.factoryDefaults("study_"+e.id)),u(l,e),TradingView.merge(l,r),s>=1&&(TradingView.merge(l,TradingView.clone(e)),delete l.defaults),l=o.updateStudyState(l,e,t);var h=t||e;if(h&&TradingView.StudyMetaInfo.versionOf(h)>=1){h=_(h);var p={};a.mergeInputs(p,h.defaults.inputs),a.mergeInputs(p,l.inputs),a.mergeInputsArrPart(p,h.inputs),l.inputs=p,delete h.inputs,delete h.defaults.inputs;var c={};TradingView.merge(c,h.defaults),TradingView.merge(c,TradingView.factoryDefaults("study_"+h.id)),TradingView.merge(c,l),TradingView.merge(c,h),delete c.defaults,l=c}var v=f(n,h);return TradingView.merge(l,g(l,v)),l}function c(e,t){function i(e){if(!e)return"_none_";var e=e||{};return e=JSON.stringify(e),e=e.replace(/'/g,"\\'")}var r={};if(t.isTVScript){var n=t.defaults.inputs.text;r.text=TVScript.patchILTemplate(n,t,e)}else for(var o=Object.keys(e),a=o.length-1;a>=0;a--){var s=o[a],l=e[s]?e[s].id:null;l&&e[l]&&(r[l]=e[l])}return i(r)}function u(e,t){if(t.plots)for(var i=0;i<t.plots.length;i++){var r=t.plots[i].id,o=t.plots[i].type;if(o!==TradingView.StudyConsts.PLOT_TYPE_COLORER){var a=n();o===TradingView.StudyConsts.PLOT_TYPE_BAR_COLORER&&(a.transparency=0),a.plottype=o,a.title=r,e.styles&&r in e.styles&&TradingView.merge(a,e.styles[r]),e.styles[r]=a}}}function _(e){var t=TradingView.clone(e);if(t.inputs={},e.inputs)for(var i=0;i<e.inputs.length;i++){var r=e.inputs[i].id;t.inputs[r]=e.inputs[i].defval,t.inputs[i]=e.inputs[i]}return t}function f(e,t){var i=0;if(e)for(var r=0;r<e.Q17().length;r++){var n=e.Q17()[r];n.metaInfo&&n.metaInfo()&&n.metaInfo().id==t.id&&i++}return i}function g(e,t){if(!t)return e;var i;for(i in e.styles){var r=e.styles[i].color;r&&(e.styles[i].color=v(r,t))}return e}function v(e,t){e=new TradingView.RGBColor(e);var i=TradingView.rgbToHsl(e.r,e.g,e.b),r=i[0]+.05*t;i[0]=r-Math.floor(r);var n=TradingView.hslToRgb(i[0],i[1],i[2]);return e.r=n[0],e.g=n[1],e.b=n[2],e.toHex()}function m(e,t,r,n){var o=i(49);this._titleCache={},this._resolvedSymbols={},this._priceAxisViewsBase=[],this._paneViews=[],this._hlinesPriceAsisViews=[],this._horizlinesPriceAsisViews=[],B.call(this,e),this.m_data=new TradingView.PlotList,this._graphics=new $61(n),this._plotOffsets={},this._plotOffsetsMetaInfoOverride={},this.Z98=e,this._chartApi=e._chartApi,this._series=r,this._numericFormatter=new TradingView.NumericFormatter,this._metaInfo=n,this.Q0=t,this.Q0.listeners().subscribe(this,m.prototype.changeStyles),this.Q0.visible.listeners().subscribe(this,m.prototype.visibleChanged),this.Q0.visible.listeners().subscribe(this,this.processHibernate);for(var a in this._metaInfo.graphics)for(var s in this._metaInfo.graphics[a]){var l=this.Q0.graphics[a][s];l.visible&&l.visible.listeners().subscribe(this,m.prototype.processHibernate)}this._showStudyArgumentsProperty=this.model().properties().paneProperties.legendProperties.showStudyArguments,this._turnaroundCounter=1,this._turnaround="st"+this._turnaroundCounter,this._status="",this._plotFields=[];var d=this.metaInfo().plots;if(d)for(var h=0,p=d.length;p>h;h++){var s=d[h].id;this._plotFields.push(s)}this.clearData(),this._studyModified=!1,this._tagsChanged=new Delegate,this.createViews();var c=this;this._handler=function(e){c.onData(e)},this._createFormatter();var c=this;this.Q0.precision.listeners().subscribe(null,function(){c._createFormatter(),c.Z98.Q18(new $21($21.FULL_UPDATE))}),this._showStudyArgumentsProperty.listeners().subscribe(null,function(){c._titleCache={}}),this.Q0.description.listeners().subscribe(null,function(){c._titleCache={}}),this.Q0.shortDescription&&this.Q0.shortDescription.listeners().subscribe(null,function(){c._titleCache={}}),Z75.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().onSymbolResolved().subscribe(this,m.prototype._createFormatter);var c=this,u={};this._simplePlotsCount=n.plots.filter(function(e,t){if(c.isLinePlot(t))return!0;if(c.isOHLCSeriesPlot(t)){var i=c.metaInfo().plots[t].target;return u[i]?!1:(u[i]=i,!0)}return!1}).length,this.Q0.showInDataWindow.listeners().subscribe(e,o.prototype.fullUpdate),this.hasBarColorer()&&this.Q0.visible.listeners().subscribe(e.mainSeries(),TradingView.Series.prototype.invalidateBarStylesCache)}var y=i(42).StudyBarColorer,w=i(43).HorzLineRenderer,T=i(75),b=T.J56,S=T.J55,C=T.J82,x=i(76),P=i(77),L=P.StudyPaneView,E=P.StudyBackgroundPaneView,V=P.StudyPlotShapesPaneView,I=P.StudyPlotCharsPaneView,A=P.StudyPlotArrowsPaneView,k=P.StudyPlotBarsPaneView,R=P.StudyPlotCandlesPaneView,M=i(78),O=M.Z0,D=M.J53,B=i(18).PriceDataSource,N=i(47),F=i(79).StudyDataWindowView,W=i(62);r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){this._visible=!1;var e=this.Z99.lastValueData(this._plotName,!0);e.noData||(this._visible=!0,this._points=[new MathEx.Point(0,e.coordinate)],this._color=e.color)},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};return e.points=this._points,e.color=this._color,e.linewidth=this.Z99.properties().styles[this._plotName].linewidth.value(),e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.hitTestResult=TradingView.HitTestResult.REGULAR,e.visible=this._visible,new w(e)},inherit(m,B),TradingView.Study=m,i(88),m.prototype.lastValueData=function(e,t,i){var r={noData:!0};if(this.Z98.timeScale().isEmpty()||null==this.priceScale()||this.priceScale().isEmpty()||this.data().isEmpty())return r;var n=this.Z98.timeScale().visibleBars();if(n.isEmpty())return r;if(!this.properties().visible.value())return r;var o,a=this.properties().styles,s=this.properties().ohlcPlots;if(a&&a[e]&&(o=a[e]),s&&s[e]&&(o=s[e]),!o||!o.visible.value())return r;var l=this.offset(e),d=this.nearestIndex(n.lastBar()-l,TradingView.SEARCH_NEAREST_LEFT);if(null===d||void 0===d)return r;var h,p=this.metaInfo().plots;for(h=0;h<p.length&&!(p[h].id===e||this.isOHLCClosePlot(h)&&p[h].target===e);h++);var c=(this.data(),t?this.data().last().value:this.data().valueAt(d));if(!c||!isNumber(c[h+1]))return r;for(var u,_={noData:!1},f=null,g=null,v=0;v<p.length;v++)p[v].target===e&&(this.isSelfColorerPlot(v)||this.isOHLCColorerPlot(v))&&(f=v,g=this.metaInfo().palettes[p[v].palette],u=this.properties().palettes[p[v].palette]);var m=c[h+1];if(i&&(_.price=m),this.priceScale().properties().percentage.value()){var y=this.firstValue(!0);if(!y)return r;m=this.priceScale().priceRange().convertToPercent(m,y)}_.text=this.priceScale().formatter().format(m);var w=o.color.value();if(f&&c.length>f+1){var T=c[f+1];if(void 0!==T&&null!==T){var b=g.valToIndex?g.valToIndex[T]:T;_.color=u.colors[b].color.value()}else _.color=w}else _.color=w;return _.floatCoordinate=this.priceScale().priceToCoordinate(m,!0),_.coordinate=Math.round(_.floatCoordinate),_.item=c,_},m.prototype.series=function(){return this._series},m.prototype.model=function(){return this.Z98},m.prototype.clearData=function(){this.m_data=new TradingView.PlotList(this._plotFields),this._graphics=new $61(this._metaInfo),this._plotOffsets={}},m.prototype.onTagsChanged=function(){return this._tagsChanged},m.prototype.properties=function(){return this.Q0},m.prototype.state=function(e){var t=TradingView.className(this.constructor),i={type:t,id:this.id(),state:this.properties().state(),zorder:this.zorder()};this.metaInfo()instanceof TradingView.StudyMetaInfo?i.metaInfo=this.metaInfo().state():(i.metaInfo=$.extend({},this.metaInfo()),i.metaInfo.id=TradingView.StudyMetaInfo.parseIdString(i.metaInfo.id+(i.metaInfo.version?"-"+i.metaInfo.version:"")).fullId),e&&(i.data=this.m_data.state(),i.data.symbols=this._resolvedSymbols,i.data.graphics=this._graphics.graphics(),i.data.plotOffsets=this._plotOffsets),this.ownerSource()&&(i.ownerSource=this.ownerSource().id());for(var r=0;r<this._metaInfo.inputs.length;r++)if("bar_time"==this._metaInfo.inputs[r].type){var n=this._metaInfo.inputs[r].id,o=i.state.inputs[n];if(0>o){var a=this._rightOffsetToUnixTime(-o);i.state.inputs[n]=a&&a>=0?a:0}}return i},m.prototype.uniqueId=function(){var e=this.inputsForAlert();return e=JSON.stringify(e).replace(/\W/g,""),this.id()+"|"+e},m.prototype.stateForAlert=function(){var e=this.state();e.data=e.data||{},e.data.completePlotOffsets={},delete e.zorder;for(var t=0;t<this._metaInfo.plots.length;++t){var i=this._metaInfo.plots[t].id;e.data.completePlotOffsets[i]=this.offset(i)}return e.uniqueId=this.uniqueId(),TVScript.assert(!e.alertsData,"Attempt to rewrite alertsData field!"),e.alertsData={},e.alertsData.callStudyArgs=c(e.state.inputs,this._metaInfo),e},m.prototype.isSavedInStudyTemplates=function(){for(var e=0;e<this._metaInfo.inputs.length;e++)if("bar_time"==this._metaInfo.inputs[e].type)return!1;return!0},m.prototype.restoreData=function(e){this.m_data.restoreState(e),this._resolvedSymbols=e.symbols,this._graphics.setGraphics(e.graphics),this._postProcessGraphics(),this._plotOffsets=e.plotOffsets},m.prototype.restart=function(){this.clearData(),this._restarting=!0,Z75.enabled("stop_study_on_restart")&&this.stop(),this._clearLoadingTimer(),this.start()},m.prototype._clearLoadingTimer=function(){this.loadingTimer&&(clearTimeout(this.loadingTimer),this.loadingTimer=null)},m.prototype.stop=function(){this._clearLoadingTimer(),this._chartApi&&this._chartApi.connected()&&this._studyId&&this._chartApi.removeStudy(this._studyId,this._handler),Z75.enabled("update_study_formatter_on_symbol_resolve")&&this.Z98.mainSeries().onSymbolResolved().unsubscribe(this,m.prototype._createFormatter),this._studyId=null,this.clearData(),this._unsubscribeExtendedHours(),this.recalculate()},m.prototype._resolveSymbol=function(e){var t=function r(t,i){this._chartApi.resolveSymbol(this._makeNextSymbolId(),t,function(t){switch(t.method){case"symbol_resolved":this._resolvedSymbols[e]=t.params[1],this._titleCache={},i.resolve(e);break;case"symbol_error":if("permission denied"===t.params[1]&&t.params[2])switch(t.params[2]){case TradingView.Series.PD_REASON_EXTENDED_HOURS:break;case TradingView.Series.PD_REASON_SYMBOL:if(t.params[3])return void r(t.params[3],i);break;default:return void r(t.params[2],i)}i.reject(e)}}.bind(this))}.bind(this),i=$.Deferred();return t(e,i),i.promise()},m.prototype._allSymbolsAreResolved=function(){for(var e=$.Deferred(),t=[],i=0;i<this._metaInfo.inputs.length;i++)if("symbol"==this._metaInfo.inputs[i].type){var r=this._metaInfo.inputs[i].id,n=this.Q0.inputs[r].value();if(!this._resolvedSymbols[n]){var o=this._resolveSymbol(n);t.push(o)}}return t.length>0?$.when.apply($,t).done(function(){0!==this._studyId&&this.stop(),this.start(),e.resolve("All symbols are resolved now")}.bind(this)).fail(function(t){this._status=$.t("Invalid Symbol"),this.stop(),this.Z98.updateSource(this),e.reject("Invalid symbol, "+t)}.bind(this)):e.resolve("There are no symbols to resolve"),e.promise()},m.prototype._allInputsAreValid=function(){for(var e=0;e<this._metaInfo.inputs.length;e++)if("bar_time"==this._metaInfo.inputs[e].type){var t=this._metaInfo.inputs[e].id,i=this.Q0.inputs[t].value();if(void 0===i||null===i)return!1}return!0},m.prototype.sourceId=function(){return this._studyId},m.prototype._debugId=function(){var e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})},m.prototype.isStarted=function(){return!!this._studyId},m.prototype.isVisible=function(){if(!this.properties().visible.value())return!1;if(this._metaInfo.plots.length>0)for(var e=0;e<this._metaInfo.plots.length;e++){var t=this.properties().plots[e].visible;if(!t||t.value())return!0}for(var i in this._metaInfo.graphics)for(var r in this._metaInfo.graphics[i]){var t=this.properties().graphics[i][r];if(!t.visible||t.visible.value())return!0}return!!this._metaInfo.isTVScriptStrategy},m.prototype.start=function(){var e=TradingView.Q16("tv5176_HibernateStudies")&&!this.isVisible();this._chartApi&&this._chartApi.connected()&&!e&&this._allSymbolsAreResolved().done(function(e){this._startAfterSymbolsResolved()}.bind(this)).fail(function(e){TradingView.logNormalChart("ERROR: "+this._debugId()+" start failed, "+e)}.bind(this))},m.prototype._startAfterSymbolsResolved=function(){if((!this.isStarted()||this._restarting)&&(this._studyId=m.makeNextStudyId(),this._restarting=!1,this._allInputsAreValid())){this._inputs=this.inputs();var e=this._metaInfo.id;if("MA"===this._metaInfo.id){var t=this._inputs[2];switch(t){case"exp":e="MAExp@tv-basicstudies";break;case"simple":e="MASimple@tv-basicstudies";break;case"weighted":e="MAWeighted@tv-basicstudies";break;case"volume weighted":e="MAVolumeWeighted@tv-basicstudies"}}e+="-"+(this._metaInfo.version||"1"),e=TradingView.StudyMetaInfo.cutDollarHash(e),(e.startsWith("Script@tv-scripting")||e.startsWith("StrategyScript@tv-scripting"))&&(e+="!"),this._chartApi.createStudy(this._studyId,this._turnaround,this._series._seriesId,e,this._inputs,this._handler),this._subscribeExtendedHours()}},m._nextSymbolId=0,m.prototype._makeNextSymbolId=function(){return m._nextSymbolId++,"ss_"+m._nextSymbolId},m._nextStudyId=0,m.makeNextStudyId=function(){return m._nextStudyId++,"st"+m._nextStudyId},m.prototype._rightOffsetToUnixTime=function(e){var t=null;if(this._series.bars().size()>=e)var t=this._series.bars()._valueAt(this._series.bars().lastIndex()-e)[TradingView.TIME_PLOT];return t},m.prototype.getSymbolString=function(e){return this._series&&this._series.extendedHours.value()?"="+JSON.stringify({symbol:e,session:"extended"}):e},m.prototype.inputsForGUI=function(e){return this.inputs({symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1})},m.prototype.inputsForAlert=function(){var e=this.offset(),t=this.inputs({symbolsForDisplay:!0,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1});return e&&t.push(e),t},m.prototype.inputs=function(e){var t={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!0};return TradingView.merge(t,e),this._buildInputs(t)},m.prototype._buildInputs=function(e){assert(!!e,"options not set");var t={};try{t=this._prepareInputs(e)}catch(i){TradingView.logWarn("Failed to prepare study inputs: "+i)}if(!e.symbolsForDisplay&&this._metaInfo.isTVScript){if(0===Object.keys(t).length||this._metaInfo.isTVScriptStub)return[this._metaInfo.defaults.inputs.text];var r=this._metaInfo.defaults.inputs.text,n=TVScript.patchILTemplate(r,this._metaInfo,t);return[n]}if(e.asObject){var o={};return Object.keys(t).forEach(function(e){null!=t[e]&&(o[e]=t[e])}),o=$.isEmptyObject(o)?null:o}var o=[];return Object.keys(t).forEach(function(e){null!=t[e]&&o.push(t[e])}),o},m.prototype._prepareInputs=function(e){assert(!!e,"options not set");for(var t={},i=0;i<this._metaInfo.inputs.length;i++){var r=this._metaInfo.inputs[i];if((!r.isFake||!e.skipFakeInputs||this._metaInfo.isTVScript)&&!(r.isHidden&&e.skipHiddenInputs||"bool"==r.type&&e.skipHiddenInputs&&Z75.enabled("dont_show_boolean_study_arguments"))){var n=this._prepareInput(r,e);t[r.id]=n}}return t},m.prototype._prepareInput=function(e,t){var i=e.id;if("symbol"==e.type){var r=this.Q0.inputs[i].value();if(t&&t.symbolsForDisplay)this._resolvedSymbols&&this._resolvedSymbols[r]&&(r=this._resolvedSymbols[r].name+", "+this._resolvedSymbols[r].exchange);else{if(this._resolvedSymbols&&this._resolvedSymbols[r]){var n=this._resolvedSymbols[r];r=n.ticker||n.full_name}t&&t.symbolsForChartApi&&(r=this.getSymbolString(r))}return r}if("bar_time"==e.type){var o=this.Q0.inputs[i].value();if(0>o){var a=this._rightOffsetToUnixTime(-o);o=a&&a>=0?a:o}return o}return this.Q0.inputs[i].value()},m.prototype._changeInputs=function(e){this._studyId&&this._chartApi.connected()?(this._turnaround="st"+ ++this._turnaroundCounter,this._allInputsAreValid()?this._allSymbolsAreResolved().done(function(t){this._studyModified=!0,this._chartApi.modifyStudy(this._studyId,this._turnaround,e,this._handler)}.bind(this)).fail(function(e){TradingView.logNormalChart("ERROR: "+this._debugId()+" _changeInputs: cannot modify study, "+e)}.bind(this)):this.stop()):(this.stop(),this.start()),this._inputs=e,this._tagsChanged.fire(),this._titleCache={}},m.prototype.changeStyles=function(){if(this._inputs){for(var e=this.inputs(),t=0;t<e.length;t++)if(e[t]!==this._inputs[t]){this._changeInputs(e);break}}else this._chartApi&&this._chartApi.connected()&&this.restart();this._metaInfo.isTVScript&&(this._pinePatchProps(),this._titleCache={}),this.hasBarColorer()&&this.Z98.mainSeries().invalidateBarStylesCache(),"Overlay@tv-basicstudies"===this._metaInfo.name&&this.invalidateBarStylesCache(),this.createViews(),this.recalculate(!0),this.updateAllViews()},m.prototype._isModifiedStudyInputs=function(e){if(void 0===this._oldStudyInputs)return this._oldStudyInputs=e,!0;var t=Object.keys(this._oldStudyInputs);return assert(t.length==Object.keys(e).length,"keys quantity should be equal"),t.forEach(function(t){assert(e.hasOwnProperty(t),"key '"+t+"' should existing in studyInputs"),this._oldStudyInputs[t]!==e[t]&&(this._oldStudyInputs=e)},this),this._oldStudyInputs===e},m.prototype._pinePatchProps=function(){var e={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!0},t=this._prepareInputs(e);if(this._isModifiedStudyInputs(t)){var i=$56.patchPropertiesAsync(this.Q0,this._metaInfo,t),r=this._allSymbolsAreResolved();$.when(i,r).done(function(e,t){this.createViews(),this.recalculate(!0),this.updateAllViews()}.bind(this)).fail(function(e){TradingView.logNormalChart("ERROR: "+this._debugId()+" _pinePatchProps failed, reason: "+e)}.bind(this))}},m.prototype.visibleChanged=function(){this._series instanceof TradingView.Series&&this._series.invalidateBarColorerCache()},m.prototype.invalidateBarStylesCache=function(){var e=this.m_data;if(0!==e.size()){var t=+e.first(),i=+e.last()+1;e.range(t,i).each(function(e,t){t[TradingView.STYLE_PLOT]=null})}},m.prototype.processHibernate=function(){TradingView.Q16("tv5176_HibernateStudies")&&(!this._studyId&&this.isVisible()&&this.start(),this._studyId&&!this.isVisible()&&this.stop())},m.prototype.lastPriceLabelFixedCoordinate=function(e){var t=this._priceAxisViewsCache[e];return t._fixedCoordinate},m.prototype.priceLabelText=function(e){if(1==this._simplePlotsCount)return this._metaInfo.shortDescription;var t,i=this._metaInfo.styles,r=this._metaInfo.ohlcPlots;i&&i[e]&&(t=i[e]),r&&r[e]&&(t=r[e]);var n=t.title;return this._metaInfo.is_price_study?this._metaInfo.shortDescription+":"+n:n},m.prototype.createPlotLabels=function(e){for(var t=0;t<e.length;t++)this._paneViews.push(new N(this.Z98,this,e[t],"priceLabelText","showStudyPlotLabels"))},m.prototype.createViews=function(){this._priceAxisViewsBase=[],this._paneViews=[];var e={};this._priceAxisViewsCache={};var t=[];if(this.metaInfo().plots)for(var i=0;i<this.metaInfo().plots.length;i++)if(!(this.isSelfColorerPlot(i)||this.isBarColorerPlot(i)||this.isBarColorerPlot(i)||this.isOHLCColorerPlot(i))){var n=this.metaInfo().plots[i].id;if(this.isBgColorerPlot(i))this._paneViews.push(new E(this,this._series,this.Z98,n));else if(this.isPlotShapesPlot(i))this._paneViews.push(new V(this,this._series,this.Z98,n));else if(this.isPlotCharsPlot(i))this._paneViews.push(new I(this,this._series,this.Z98,n));else if(this.isPlotArrowsPlot(i))this._paneViews.push(new A(this,this._series,this.Z98,n));else if(this.isOHLCSeriesPlot(i)){var o=this.metaInfo().plots[i].target;if(e[o])continue;e[o]=o,this.isOHLCBarsPlot(i)?this._paneViews.push(new k(this,this._series,this.Z98,o)):this.isOHLCCandlesPlot(i)&&this._paneViews.push(new R(this,this._series,this.Z98,o));var a=new x(this,this.Z98,o);this._priceAxisViewsCache[o]=a,this._priceAxisViewsBase.push(a),t.push(o)}else{var a=new x(this,this.Z98,n);this._priceAxisViewsCache[n]=a,this._priceAxisViewsBase.push(a),this._paneViews.push(new L(this,this._series,this.Z98,n)),this.properties().styles[n].trackPrice.value()&&this._paneViews.push(new r(this,this._series,this.Z98,n)),t.push(n)}}if(this.Q0.bands)for(var i=0;i<this.Q0.bands.childCount();i++)this.Q0.bands[i].visible.value()&&this._paneViews.push(new b(this.Q0.bands[i],this));this.Q0.bandsBackground&&this._paneViews.push(new S(this));var s=[];this.metaInfo().graphics&&(s=Object.keys(this.metaInfo().graphics),s.sort(function(e,t){return m.graphicsZOrderPriority(e)-m.graphicsZOrderPriority(t)}));for(var l in s){var d=s[l],h="_paneView"+d,p="StudyPaneView_"+d;TradingView.Study[p]&&(this[h]=new TradingView.Study[p](this,this.Z98),this._paneViews.push(this[h])),this._dataWindowView||"hhists"!==d||(this._dataWindowView=new TradingView.StudyHHistsDataWindowView(this,this.Z98))}if(this.Q0.areaBackground&&this._paneViews.push(new D(this)),this.Q0.filledAreas&&this._metaInfo.filledAreas)for(var i=0;i<this._metaInfo.filledAreas.length;++i){var c=this._metaInfo.filledAreas[i],u=this.Q0.filledAreasStyle[c.id];c.type===TradingView.StudyMetaInfo.FilledArea.TYPE_PLOTS?this._paneViews.push(new O(this,c,u)):c.type===TradingView.StudyMetaInfo.FilledArea.TYPE_HLINES?this._paneViews.push(new C(this,c,u)):TradingView.logWarn("Unsupported filledArea type: "+c.type)}this.createPlotLabels(t),this._dataWindowView||(this._dataWindowView=new F(this,this.Z98)),this._statusView||(this._statusView=new W(this,this.Z98.properties())),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},m.prototype.recalculate=function(e){var t=this.Z98.paneForSource(this);this.Z98.recalculatePane(t,e),this.Z98.updateSource(this)},m.prototype.data=function(){return this.m_data},m.prototype.metaInfo=function(){return this._metaInfo},m.prototype.status=function(){return this._status},m.prototype.title=function(e,t){var i=JSON.stringify([e,t]);if(this._titleCache[i])return this._titleCache[i];var r;r=e?this._metaInfo.shortDescription||this.Q0.shortDescription&&this.Q0.shortDescription.value()||"Study":this._metaInfo.description||this.Q0.description&&this.Q0.description.value()||"Study",r=$.t(r);var n=this._showStudyArgumentsProperty.value(),o=this.inputsForGUI()||[],a=this;return t&&"object"==typeof t||(t={}),n&&o.length>0&&(o=o.map(function(e){var i=isNumber(e)?a._numericFormatter.format(e):e;return t[i]&&(i=t[i]),i}),r+=" ("+o.join(", ")+")"),this._titleCache[i]=r,r},m.prototype.graphics=function(){return this._graphics.graphics()},m.prototype._checkTurnaround=function(e){return e===this._turnaround||e===this.Z98.mainSeries()._turnaround||e===this.Z98.mainSeries()._turnaround+"_"+this._turnaround},m.prototype._makeJSONForNSData=function(e,t){var i=""!==e.params.nonseries.d?TradingView.parseJSONorNot(e.params.nonseries.d):t||"";if(i.dataCompressed){var r=new JSZip(i.dataCompressed,{base64:!0}).file("").asText();delete i.dataCompressed,i.data=TradingView.parseJSONorNot(r)}if(i.graphicsCmdsCompressed){var r=new JSZip(i.graphicsCmdsCompressed,{base64:!0}).file("").asText();delete i.graphicsCmdsCompressed,i.graphicsCmds=TradingView.parseJSONorNot(r)}return i},m.prototype.onData=function(e){var t=this;switch(e.method){case"study_loading":this._status=$.t("loading..."),this._failed=!1,this._statusView.update(),this.Z98.updateSource(this),this._clearLoadingTimer(),-1==["Plot splits","Plot earnings","Plot dividends"].indexOf(t._metaInfo.description)&&(t._loadingStartTime=(new Date).getTime(),t.loadingTimer=setTimeout(function(){var e={chartSession:t._chartApi._sessionid,studyName:t._metaInfo.description,arguments:t.inputs()};$71.sendReport("study_loading",e)},15e3));break;case"study_error":this._clearLoadingTimer(),delete this._loadingStartTime,this._failed=!0,this.clearData(),e.params[2]?this._status=$.t(e.params[2].split(":",2)[0]):this._status="",-1==["Sessions"].indexOf(t._metaInfo.description)&&$71.sendReport("study_error",{
chartSession:t._chartApi._sessionid,studyName:t._metaInfo.description,arguments:t.inputs()}),this._statusView.update(),this.Z98.updateSource(this);break;case"study_completed":if(!this._checkTurnaround(e.params[1]))return;var i="chartSession:"+t._chartApi._sessionid;TradingView.logDebugChart(i+", Study "+this._metaInfo.description+" loading took "+((new Date).getTime()-this._loadingStartTime)+" ms"),this._clearLoadingTimer(),delete this._loadingStartTime,this._status="",this._statusView.update();var r=this.Z98.paneForSource(this);this.Z98.recalculatePane(r),this._updateSources(),this.Z98.Q18(new $21($21.FULL_UPDATE));break;case"study_deleted":break;case"data_update":if(!this._checkTurnaround(e.params.turnaround))return;t._clearLoadingTimer(),this._studyModified&&(this.clearData(),this._studyModified=!1);var n=0===this.m_data.size()&&this._metaInfo.plots.length>0;assert(!!e.params.nonseries,"data.params.nonseries is missing"),e.params.nonseries.d=this._makeJSONForNSData(e),this._processPlotOffsets(e.params),this.transformData(e.params.plots);var o=this._mergeData(e.params.plots).earliestRow;this.hasBarColorer()&&(null!==o?this.Z98.mainSeries().invalidateBarStylesCache(o.index):TradingView.logNormalChart("ERROR: No earliestRow in studies plots, "+this._debugId())),this._graphics.process(e.params.nonseries),this._postProcessGraphics();var r=this.Z98.paneForSource(this);this.Z98.recalculatePane(r,n),this._updateSources()}},m.prototype.transformData=function(e){},m.prototype._updateSources=function(){this.Z98.updateSource(this),this.hasBarColorer()&&this.Z98.updateSource(this.Z98.mainSeries())},m.processPlotOffsets=function(e,t){if(!t.nonseries||"nochange"!==t.nonseries.indexes){var i=t.nonseries.d;if(!i||!i.indexes_replace)return i&&i.offsets?void(e._plotOffsets=i.offsets):void(e._plotOffsets={})}},m.prototype._processPlotOffsets=function(e){m.processPlotOffsets(this,e)},m.prototype._mergeData=function(e){return this.m_data.merge(e)},m.prototype._postProcessGraphics=function(){var e=this,t=function(t){var i,r,n=e._graphics.graphics(),o=[];if(n&&n[t]){var a=n[t];for(i=0;i<a.length;i+=1)if(a[i].data)for(r=0;r<a[i].data.length;r+=1)o.push(new m.StudyPriceAxisView_hlines(e,e.Z98,a[i].data[r],a[i].styleId,t))}return o};this._hlinesPriceAsisViews=t("hlines"),this._horizlinesPriceAsisViews=t("horizlines"),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},m.prototype.firstValue=function(e){if(this._metaInfo.is_price_study&&"Compare@tv-basicstudies"!==this._metaInfo.id)return this._series.data().firstValue();var t=this.Z98.timeScale().visibleBars(),i=t.firstBar(),r=t.lastBar();if(0===this.m_data.size())return null;var n,o=this;return this.m_data.range(i,r).each(function(t,i){for(var r=1;r<i.length;++r)if(!o.isSelfColorerPlot(r-1)){var a=o._metaInfo.plots[r-1].id,s=o.properties().styles[a];if(s.visible&&s.visible.value()&&!(e&&Math.abs(i[r])<1e-10||void 0===i[r]||null===i[r]||n))return n=i[r],!0}}),n},m.offset=function(e,t){var i=0;return e._plotOffsets&&void 0!==e._plotOffsets[t]&&(i+=e._plotOffsets[t]),void 0!==e._plotOffsetsMetaInfoOverride[t]?i+=e._plotOffsetsMetaInfoOverride[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},m.prototype.offset=function(e){return m.offset(this,e)},m.prototype.priceRange=function(e,t){if(!TradingView.isInteger(e))return void TradingView.logDebugChart("Study.priceRange: incorrect startBar");if(!TradingView.isInteger(t))return void TradingView.logDebugChart("Study.priceRange: incorrect endBar");if(0===this.m_data.size())return null;var i=null,r=this,n=r._metaInfo;if(0===n.plots.length)return null;for(var o,a,s=(n.is_price_study,[]),l=0;l<n.plots.length;++l)if(!(r.isSelfColorerPlot(l)||r.isTextColorerPlot(l)||r.isBarColorerPlot(l)||r.isBgColorerPlot(l)||r.isOHLCColorerPlot(l))){var d,h=n.plots[l].id;if(r.isOHLCSeriesPlot(l)){var p=n.plots[l].target;d=r.properties().ohlcPlots[p]}else d=r.properties().styles[h];if(d.visible.value()){if(a=null,d.location&&(a=d.location.value()),!o){var c=[CanvasEx.MARKLOC_ABSOLUTE,CanvasEx.MARKLOC_TOP,CanvasEx.MARKLOC_BOTTOM].indexOf(a)<0,u=r.isPlotShapesPlot(l)||r.isPlotCharsPlot(l);o=u&&c||r.isPlotArrowsPlot(l)}var _=r.isLinePlot(l)||(r.isPlotShapesPlot(l)||r.isPlotCharsPlot(l))&&d.location.value()==CanvasEx.MARKLOC_ABSOLUTE||r.isOHLCSeriesPlot(l);if(_){var f={index:l+1,offset:r.offset(h)},g=r.properties().styles[h].plottype.value();if(!r.properties().skipHistogramBaseOnAutoScale&&[TradingView.StudyConsts.PLOT_HISTOGRAM,TradingView.StudyConsts.PLOT_COLUMNS,TradingView.StudyConsts.PLOT_AREA].indexOf(g)>=0){var v=r.properties().styles[h].histogramBase.value();if(!isNumber(v))continue;f.baseValue=v}s.push(f)}}}var m=r.m_data.minMaxOnRange2(e,t,s);if(o){s=[{index:TradingView.LOW_PLOT,offset:0},{index:TradingView.HIGH_PLOT,offset:0}];var y=r.series().data().bars().minMaxOnRange2(e,t,s);m.min=null==m.min||void 0===m.min?y.min:Math.min(m.min,y.min),m.max=null==m.max||void 0===m.max?y.max:Math.max(m.max,y.max)}if(null!==m.min&&(i=new PriceRange(m.min,m.max)),n.bands)for(var l=0;l<n.bands.length;l++)if(r.properties().bands[l].visible.value()){var v=r.properties().bands[l].value.value();if(!isNumber(v))continue;i?i.apply(v,v):i=new PriceRange(v,v)}if(i&&i.minValue()===i.maxValue()){var w=.005*i.minValue();i=new PriceRange(i.minValue()-w,i.maxValue()+w)}var T=this.priceScale();if(T&&T.properties().percentage.value()&&i){var b=this.firstValue();return b?i.convertToPercents(b):null}return T&&T.isLog()&&i?new PriceRange(r.priceScale().priceToLogical(i.minValue()),r.priceScale().priceToLogical(i.maxValue())):i},m.prototype.paneViews=function(e){return this.properties().visible.value()?this._paneViews:null},m.prototype.dataWindowView=function(){return this._dataWindowView},m.prototype.statusView=function(){return this._statusView},m.prototype.priceAxisViews=function(e,t){return this.Z98.paneForSource(this)===e&&t===this.priceScale()&&(this.Z98.properties().scalesProperties.showStudyLastValue.value()||this.properties().oldShowLastValue&&this.properties().oldShowLastValue.value())?this._priceAxisViews:null},m.prototype.isLinePlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_LINE},m.isSelfColorerPlot=function(e,t){var i=e._metaInfo.plots[t];return i.type==TradingView.StudyConsts.PLOT_TYPE_COLORER},m.prototype.isSelfColorerPlot=function(e){return m.isSelfColorerPlot(this,e)},m.prototype.isTextColorerPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_TEXT_COLORER},m.prototype.isBarColorerPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_BAR_COLORER},m.prototype.isBgColorerPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_BG_COLORER},m.prototype.isPlotShapesPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_SHAPES},m.prototype.isPlotCharsPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_CHARS},m.prototype.isPlotArrowsPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_ARROWS},m.prototype.isOHLCBarsPlot=function(e){var t=this._metaInfo.plots[e].target,i=this.metaInfo().defaults.ohlcPlots[t];return i&&this.isOHLCSeriesPlot(e)&&i.plottype==TradingView.StudyConsts.OHLC_TYPE_BARS},m.prototype.isOHLCCandlesPlot=function(e){var t=this._metaInfo.plots[e].target,i=this.metaInfo().defaults.ohlcPlots[t];return i&&this.isOHLCSeriesPlot(e)&&i.plottype==TradingView.StudyConsts.OHLC_TYPE_CANDLES},m.prototype.isOHLCSeriesPlot=function(e){var t=this._metaInfo.plots[e].type;return t==TradingView.StudyConsts.PLOT_TYPE_OHLC_OPEN||t==TradingView.StudyConsts.PLOT_TYPE_OHLC_HIGH||t==TradingView.StudyConsts.PLOT_TYPE_OHLC_LOW||t==TradingView.StudyConsts.PLOT_TYPE_OHLC_CLOSE},m.prototype.isOHLCOpenPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_OHLC_OPEN},m.prototype.isOHLCHighPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_OHLC_HIGH},m.prototype.isOHLCLowPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_OHLC_LOW},m.prototype.isOHLCClosePlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_OHLC_CLOSE},m.prototype.isOHLCColorerPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_OHLC_COLORER},m.prototype.isDataOffsetPlot=function(e){var t=this._metaInfo.plots[e];return t.type==TradingView.StudyConsts.PLOT_TYPE_DATAOFFSET},m.prototype.hasBarColorer=function(){for(var e=0;e<this._metaInfo.plots.length;++e)if(this.isBarColorerPlot(e))return!0;return!1},m.prototype.barColorer=function(){for(var e=null,t=0;t<this._metaInfo.plots.length;++t)if(this.isBarColorerPlot(t)){var i=new y(this,t);null===e?e=i:e.pushBackBarColorer(i)}if(null===e)throw Error("Cannot create BarColorer: study doesn't have a bar_colorer plot!");return e},m.prototype.base=function(){return"Volume"===this._metaInfo.id?1:0},m.prototype._createFormatter=function(){var e;"default"==this.properties().precision.value()?this.metaInfo().defaults&&(e=parseInt(this.metaInfo().defaults.precision)):e=parseInt(this.properties().precision.value()),isFinite(e)||(e=-1!==["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(this._metaInfo.id)?0:1e4);var t=this.series().symbolInfo();if(0===e){var i=0;t&&(i=t.volume_precision?t.volume_precision:t.has_fractional_volume?2:0),this._formatter=new TradingView.VolumeFormatter(i)}else this._formatter=new TradingView.PriceFormatter(Math.pow(10,e));this.priceScale()&&this.priceScale().updateFormatter()},m.prototype.formatter=function(){return this._formatter},m.prototype.nearestIndex=function(e,t){if(!TradingView.isInteger(e))return void TradingView.logDebugChart("Study.nearestIndex: incorrect logicalPoint");var i=this._series.data().bars().search(e,t);return i?i.index:void 0},m.prototype.updateAllViews=function(){for(var e=0;e<this._paneViews.length;e++)this._paneViews[e].update();this._dataWindowView.update(),this._statusView.update();for(var e=0;e<this._priceAxisViews.length;e++)this._priceAxisViews[e].update()},m.prototype.tags=function(){return!this._metaInfo||!this._metaInfo.description||this._metaInfo.isTVScriptStub||this._metaInfo.is_hidden_study||this._metaInfo.isTVScript&&"tv-scripting"===this._metaInfo.productId?[]:[this._metaInfo.description]},m.isPointsBasedStudy=function(e){switch(e){case"VbPFixed@tv-volumebyprice":case"mtp_tsanalysis@mtp-mtpredictor":case"mtp_riskreward@mtp-mtpredictor":case"mtp_decisionpoint@mtp-mtpredictor":case"mtp_ew_main@mtp-mtpredictor":case"mtp_ew_major@mtp-mtpredictor":case"mtp_ew_minor@mtp-mtpredictor":case"mtp_wpt_down1ora@mtp-mtpredictor":case"mtp_wpt_down2orb@mtp-mtpredictor":case"mtp_wpt_down3@mtp-mtpredictor":case"mtp_wpt_down4@mtp-mtpredictor":case"mtp_wpt_down5@mtp-mtpredictor":case"mtp_wpt_downc@mtp-mtpredictor":case"mtp_wpt_up1ora@mtp-mtpredictor":case"mtp_wpt_up2orb@mtp-mtpredictor":case"mtp_wpt_up3@mtp-mtpredictor":case"mtp_wpt_up4@mtp-mtpredictor":case"mtp_wpt_up5@mtp-mtpredictor":case"mtp_wpt_upc@mtp-mtpredictor":return!0;default:return!1}},m.lineToolNameForPointsBasedStudy=function(e){switch(e){case"VbPFixed@tv-volumebyprice":return"LineToolVbPFixed";case"RegressionTrend@tv-basicstudies":return"LineToolRegressionTrend";case"mtp_tsanalysis@mtp-mtpredictor":return"LineStudyMtpAnalysis";case"mtp_riskreward@mtp-mtpredictor":return"LineStudyMtpRiskReward";case"mtp_decisionpoint@mtp-mtpredictor":return"LineStudyMtpDecisionPoint";case"mtp_ew_main@mtp-mtpredictor":return"LineStudyMtpElliotWaveMain";case"mtp_ew_major@mtp-mtpredictor":return"LineStudyMtpElliotWaveMajor";case"mtp_ew_minor@mtp-mtpredictor":return"LineStudyMtpElliotWaveMinor";case"mtp_wpt_down1ora@mtp-mtpredictor":return"LineStudyMtpDownWave1OrA";case"mtp_wpt_down2orb@mtp-mtpredictor":return"LineStudyMtpDownWave2OrB";case"mtp_wpt_down3@mtp-mtpredictor":return"LineStudyMtpDownWave3";case"mtp_wpt_down4@mtp-mtpredictor":return"LineStudyMtpDownWave4";case"mtp_wpt_down5@mtp-mtpredictor":return"LineStudyMtpDownWave5";case"mtp_wpt_downc@mtp-mtpredictor":return"LineStudyMtpDownWaveC";case"mtp_wpt_up1ora@mtp-mtpredictor":return"LineStudyMtpUpWave1OrA";case"mtp_wpt_up2orb@mtp-mtpredictor":return"LineStudyMtpUpWave2OrB";case"mtp_wpt_up3@mtp-mtpredictor":return"LineStudyMtpUpWave3";case"mtp_wpt_up4@mtp-mtpredictor":return"LineStudyMtpUpWave4";case"mtp_wpt_up5@mtp-mtpredictor":return"LineStudyMtpUpWave5";case"mtp_wpt_upc@mtp-mtpredictor":return"LineStudyMtpUpWaveC";default:throw Error("There is no line tool name, associated with study id "+e)}},m.isStudyLineTool=function(e){var t=i(85).StudyLineDataSource,r=TradingView[e];return"function"==typeof r&&r.prototype instanceof t},m.prototype.onExtendedHoursChanged=function(){this.restart()},m.prototype.hasSymbolInputs=function(){for(var e=this._metaInfo.inputs.length;e--;)if("symbol"===this._metaInfo.inputs[e].type)return!0;return!1},m.prototype._subscribeExtendedHours=function(){!this._isSubscribedToExtendedHours&&this.hasSymbolInputs()&&(this._series.extendedHours.listeners().subscribe(this,this.onExtendedHoursChanged),this._isSubscribedToExtendedHours=!0)},m.prototype._unsubscribeExtendedHours=function(){this._isSubscribedToExtendedHours&&(this._series.extendedHours.listeners().unsubscribe(this,this.onExtendedHoursChanged),delete this._isSubscribedToExtendedHours)},m.prototype.removeByRemoveAllStudies=function(){return!0},e.exports={Study:m,createStudy:o,prepareCallStudyArgs:c,prepareStudyProperties:a,prepareStudyPropertiesForLoadChart:l,prepareStudyPropsStateForLoadChart:p,shiftColor:v}},function(e,t,i){"use strict";function r(e,t){this.Z97=t,this.Q0=e,this._points=[new MathEx.Point(-1,-1)],this._invalidated=!0}function n(e){this._data=e}function o(e){this.Z97=e,this._points=[]}function a(e,t,i){this.Z97=e,this._points=[],assert(t.type===TradingView.StudyMetaInfo.FilledArea.TYPE_HLINES,"Wrong filledArea type: "+t.type),this._initBandIndexes(t.objAId,t.objBId),this._fillStyleProps=i}var s=i(43).HorzLineRenderer;r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){var e=this.Z97.priceScale();if(!e||e.isEmpty())return void(this._points[0]=new MathEx.Point(-1,-1));var t=this.Q0.value.value();isNumber(t)?this._points[0]=new MathEx.Point(-1,e.priceToCoordinate(t)):this._points[0]=new MathEx.Point(-1,NaN)},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};return e.points=this._points,e.color=this.Q0.color.value(),e.linewidth=this.Q0.linewidth.value(),e.linestyle=this.Q0.linestyle.value(),e.hitTestResult=TradingView.HitTestResult.REGULAR,new s(e)},n.prototype.draw=function(e){if(0!==this._data.points.length){var t=e.canvas.width;e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency);var i=Math.min(this._data.points[0],this._data.points[1]),r=Math.max(this._data.points[0],this._data.points[1]);e.fillRect(0,i,t,r-i)}},n.prototype.hitTest=function(e){return null},o.prototype.update=function(){this._points=[];var e=this.Z97.properties().bandsBackground;if(e.fillBackground.value()){var t=this.Z97.properties().bands[0],i=this.Z97.properties().bands[1],r=this.Z97.priceScale();r&&!r.isEmpty()&&(this._points.push(r.priceToCoordinate(t.value.value())),this._points.push(r.priceToCoordinate(i.value.value())))}},o.prototype.renderer=function(){var e={};return e.points=this._points,e.backcolor=this.Z97.properties().bandsBackground.backgroundColor.value(),e.transparency=this.Z97.properties().bandsBackground.transparency.value(),new n(e)},a.prototype._initBandIndexes=function(e,t){this._bandAKey=null,this._bandBKey=null;for(var i=0;i<this.Z97.metaInfo().bands.length;++i){var r=this.Z97.metaInfo().bands[i];null!==this._bandAKey||r.id!==e?null!==this._bandBKey||r.id!==t||(this._bandBKey=i):this._bandAKey=i}},a.prototype.update=function(){if(this._points=[],this._fillStyleProps.visible.value()){var e=this.Z97.properties().bands[this._bandAKey],t=this.Z97.properties().bands[this._bandBKey],i=this.Z97.priceScale();i&&!i.isEmpty()&&(this._points.push(i.priceToCoordinate(e.value.value())),this._points.push(i.priceToCoordinate(t.value.value())))}},a.prototype.renderer=function(){var e={};return e.points=this._points,e.backcolor=this._fillStyleProps.color.value(),e.transparency=this._fillStyleProps.transparency.value(),new n(e)},t.J56=r,t.J55=o,t.J82=a},function(e,t,i){"use strict";function r(e,t,i){this.Z99=e,this.Z98=t,this._plotIndex=i,this._text="",this._coordinate=0,this._background="black",this._color="white",this._invalidated=!0,this._cache=new n}var n=i(36),o=i(14),a=i(15);inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(){this._visible=!1,this._text="";var e=this.Z99.lastValueData(this._plotIndex);e.noData||(this._visible=!0,this._text=e.text,this._coordinate=e.coordinate,this._floatCoordinate=e.floatCoordinate,this._background!=e.color&&(this._background=e.color,this._color=this.color()))},r.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),o.prototype.coordinate.call(this)},r.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={text:this._text,coordinate:this._coordinate,color:this._color,background:this._background,visible:this._visible};return new a(e,this._cache)},r.prototype.text=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),o.prototype.text.call(this)},e.exports=r},function(e,t){"use strict";function i(e,t,i,r){this.m_study=e,this.m_series=t,this.m_model=i,this._plotName=r,this.m_items=[],this._invalidated=!0;var n=this.m_study.metaInfo().plots;this._colorer=null,this._palette=null,this._paletterProps=null,this._plotIndex=0;for(var o=0;o<n.length;o++)n[o].id===this._plotName&&(this._plotIndex=o),this.m_study.isSelfColorerPlot(o)&&n[o].target===this._plotName&&(this._colorer=o,this._palette=this.m_study.metaInfo().palettes[n[o].palette],this._paletterProps=this.m_study.properties().palettes[n[o].palette])}function r(e,t,i,r){this.Z99=e,this._series=t,this.Z98=i,this._plotName=r,this._items=[],this._invalidated=!0;for(var n=this.Z99.metaInfo().plots,o=0;o<n.length;o++)n[o].id===this._plotName&&(this._plotIndex=o,assert(this.Z99.isBgColorerPlot(o),"Plot '"+this._plotName+"' is not a background colorer!"))}function n(e,t,i,r){this.m_study=e,this.m_series=t,this.m_model=i,this.m_plotName=r,this.m_items=[],this.m_invalidated=!0,this.m_plotIndex=null;for(var n=this.m_study.metaInfo().plots,o=0;o<n.length;o++)if(n[o].id===this.m_plotName){this.m_plotIndex=o;break}var n=this.m_study.metaInfo().plots;this._colorer=null,this._textColorer=null,this._palette=null,this._textPalette=null,this._paletterProps=null,this._textPaletterProps=null,this._plotIndex=0;for(var o=0;o<n.length;o++)n[o].id===this.m_plotName&&(this._plotIndex=o),this.m_study.isSelfColorerPlot(o)&&n[o].target===this.m_plotName&&(this._colorer=o,this._palette=this.m_study.metaInfo().palettes[n[o].palette],this._paletterProps=this.m_study.properties().palettes[n[o].palette]),this.m_study.isTextColorerPlot(o)&&n[o].target===this.m_plotName&&(this._textColorer=o,this._textPalette=this.m_study.metaInfo().palettes[n[o].palette],this._textPaletterProps=this.m_study.properties().palettes[n[o].palette])}function o(e,t,i,r){n.call(this,e,t,i,r)}function a(e,t,i,r){o.call(this,e,t,i,r)}function s(e,t,i,r){n.call(this,e,t,i,r),this._maxAbsValue=0}function l(e,t,i,r){this.m_study=e,this.m_series=t,this.m_model=i,this.m_plotName=r,this.m_bars=[],this._invalidated=!0;var n=this.m_study.metaInfo().plots;this._colorer=null,this._palette=null,this._paletterProps=null,this._ohlcPlotIndexes={};for(var o=0;o<n.length;o++)n[o].target===this.m_plotName&&(this.m_study.isOHLCOpenPlot(o)&&(this._ohlcPlotIndexes[TradingView.OPEN_PLOT]=o),this.m_study.isOHLCHighPlot(o)&&(this._ohlcPlotIndexes[TradingView.HIGH_PLOT]=o),this.m_study.isOHLCLowPlot(o)&&(this._ohlcPlotIndexes[TradingView.LOW_PLOT]=o),this.m_study.isOHLCClosePlot(o)&&(this._ohlcPlotIndexes[TradingView.CLOSE_PLOT]=o),this.m_study.isOHLCColorerPlot(o)&&(this._colorer=o,this._palette=this.m_study.metaInfo().palettes[n[o].palette],this._paletterProps=this.m_study.properties().palettes[n[o].palette]))}function d(e,t,i,r){l.call(this,e,t,i,r)}function h(e,t,i,r){l.call(this,e,t,i,r)}i.isIndexValid=function(e,t){return e>=0&&e<t._length()},i.prototype.items=function(){return this.m_items},i.prototype.update=function(){this._invalidated=!0},i.prototype._updateImpl=function(){if(this._histogramBase=null,this.m_items=[],!this.m_model.timeScale().isEmpty()&&!this.m_study.priceScale().isEmpty()){var e=this.m_model.timeScale().visibleBars().clone();if(!e.isEmpty()){var t=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),r=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),n=this.m_study.offset(this._plotName);n>0?(t-=n,r+=n):(t+=n,r-=n);var o=this.m_study.properties().styles[this._plotName].plottype.value(),a=[TradingView.StudyConsts.PLOT_LINE,TradingView.StudyConsts.PLOT_AREA,TradingView.StudyConsts.PLOT_CIRCLES,TradingView.StudyConsts.PLOT_CROSS].indexOf(o)>=0,s=this.m_study.data(),l=this.m_study.firstValue();if(a&&s._length()>0){for(var d=s._bsearch(t);i.isIndexValid(d,s)&&void 0===s._valueAt(d)[this._plotIndex+1];)d-=1;t=i.isIndexValid(d,s)?s._indexAt(d):t;for(var h=s._bsearch(r);i.isIndexValid(h,s)&&void 0===s._valueAt(h)[this._plotIndex+1];)h+=1;r=i.isIndexValid(h,s)?s._indexAt(h):r}for(var p=s.range(t,r),c=this.m_study.priceScale(),u=c.properties().percentage.value(),_=this._getTranspValue(),f={},g=function(e,t){var i=e+"@"+t;return f[i]||(this._plotName&&"vol"===this._plotName?f[i]=TradingView.generateColor(e,t):f[i]=TradingView.generateColor(e,t,!0)),f[i]}.bind(this),v=p._start;v<p._end;++v){var m=p._indexAt(v);m+=n,m=Math.floor(m);var y=p._valueAt(v),w=y[this._plotIndex+1],T=void 0===w||null===w;if(w=T?NaN:w,u&&!T&&(w=100*(w-l)/l),!a||!T){var b=new MathEx.Point(m,w),S=void 0!==y[this._colorer+1]||this._palette&&this._palette.addDefaultColor;if(this._colorer&&S){var w=y[this._colorer+1];b.style={};var C,x,C,x,P=this.m_study.properties().styles[this._plotName];if(void 0!==w&&null!==w){C=this._palette.valToIndex?this._palette.valToIndex[w]:w,x=this._paletterProps.colors[C];var L=x.color.value();b.style.color=TradingView.isHexColor(L)?g(L,_):L}else{var L=P.color.value();b.style.color=g(L,100)}var E=void 0!==C?x.width.value():P.linewidth.value(),V=void 0!==C?x.style.value():P.linestyle.value();b.style.width=E,b.style.style=V}this.m_items.push(b)}}if(c.pricesToCoordinates(this.m_items),this.m_model.timeScale().indexesToCoordinates(this.m_items),this.m_study.properties().styles[this._plotName].histogramBase&&(this._histogramBase=this.m_study.priceScale().priceToCoordinate(this.m_study.properties().styles[this._plotName].histogramBase.value())),this.m_study===this.m_model.selectedSource()){var I=TradingView.selectionIndexes(t,r);this._selectionData={points:[]},this._selectionData.hittestResult=TradingView.HitTestResult.REGULAR;for(var v=0;v<I.length;v++){var m=I[v],y=this.m_study.data().valueAt(m);if(m+=n,void 0!==y){var w=y[this._plotIndex+1];c.properties().percentage.value()&&(w=100*(w-l)/l);var A=this.m_model.timeScale().indexToCoordinate(Math.floor(m)),k=this.m_study.priceScale().priceToCoordinate(w);this._selectionData.points.push(new MathEx.Point(A,k))}}}var R=this.m_study.properties().styles[this._plotName];this._lineColor=TradingView.generateColor(R.color.value(),_),this._lineWidth=R.linewidth.value();var M=R.color.value();this._colorer&&(M=this._paletterProps.colors[0].color.value(),this._lineWidth=this._paletterProps.colors[0].width.value(),this._lineColor=TradingView.generateColor(this._paletterProps.colors[0].color.value(),_)),this._color2=TradingView.generateColor(M,_),this._color1=TradingView.generateColor(i.addHueForColor(M),_)}}},i.addHueForColor=TradingView.memoize(function(e){var t=new TradingView.RGBColor(e),i=TradingView.rgbToHsl(t.r,t.g,t.b),r=i[0]+.05;i[0]=r-Math.floor(r);var n=TradingView.hslToRgb(i[0],i[1],i[2]);return t.r=n[0],t.g=n[1],t.b=n[2],t.toHex()}),i.prototype._getTranspValue=function(){var e=this.m_study.properties(),t=e.styles[this._plotName],i=0,r=0,n=this.m_study.metaInfo();return"Volume@tv-basicstudies"===n.id&&n.version<=46&&"transparency"in e?(i=e.transparency.value(),i=isNumber(i)?i:r):(t.transparency&&(i=t.transparency.value(),i=isNumber(i)?i:r),i)},i.prototype.renderer=function(){var e=this.m_study.properties().styles[this._plotName];if(e.visible.value()&&this.m_study.priceScale()){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={};this._getTranspValue(),e.color.value();t.barSpacing=this.m_model.timeScale().barSpacing(),t.items=this.m_items,t.histogramBase=this._histogramBase?this._histogramBase:this.m_study.priceScale().height(),t.lineIndex=0,t.lineStyle=e.linestyle.value(),t.lineColor=this._lineColor,t.lineWidth=this._lineWidth,t.lineWidth=isNumber(t.lineWidth)?t.lineWidth:1,t.color1=this._color1,t.color2=this._color2,t.bottom=t.histogramBase,this._colorer||(t.simpleMode=!0);var i=new TradingView.CompositeRenderer,r=e.joinPoints?e.joinPoints.value():!1;switch(e.plottype.value()){case TradingView.StudyConsts.PLOT_LINE:case TradingView.StudyConsts.PLOT_LINE_WITH_BREAKS:i.append(new Z66(t));break;case TradingView.StudyConsts.PLOT_AREA:case TradingView.StudyConsts.PLOT_AREA_WITH_BREAKS:i.append(new Z51(t));break;case TradingView.StudyConsts.PLOT_HISTOGRAM:i.append(new Z64(t));break;case TradingView.StudyConsts.PLOT_COLUMNS:i.append(new Z58(t));break;case TradingView.StudyConsts.PLOT_CROSS:if(i.append(new Z59(t)),r){var n=TradingView.merge({},t);n.lineWidth=1,n.forceLineWidth=!0,i.append(new Z66(n))}break;case TradingView.StudyConsts.PLOT_CIRCLES:if(i.append(new Z56(t)),r){var n=TradingView.merge({},t);n.lineWidth=1,n.ignorePaletteLineWidth=!0,i.append(new Z66(n))}break;default:i.append(new Z66(t))}return this.m_study===this.m_model.selectedSource()&&i.append(new TradingView.SelectionRenderer(this._selectionData)),i}},r.prototype.items=function(){return this._items},r.prototype.update=function(){this._invalidated=!0},r.prototype._scalesReady=function(){var e=this.Z98.timeScale(),t=this.Z99.priceScale();return e&&t&&!e.isEmpty()&&!t.isEmpty()},r.prototype._updateImpl=function(){this._items=[],assert(this._scalesReady(),"Scales must be ready!");var e=this.Z98.timeScale().visibleBars().clone();if(!e.isEmpty()){var t=this.Z99.metaInfo().plots,i=t[this._plotIndex].palette,r=this.Z99.properties().palettes[i],n=r.colors,o=this.Z99.metaInfo().palettes[i],a=this.Z99.properties().styles[this._plotName].transparency.value(),s=this._series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),l=this._series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),d=this.Z99.offset(this._plotName);d>0?(s-=d,l+=d):(s+=d,l-=d);for(var h=this.Z99.data(),p=h.range(s,l),c=p._start;c<p._end;++c){var u=p._indexAt(c);u+=d;var _=p._valueAt(c),f=_[this._plotIndex+1],g=new MathEx.Point(Math.floor(u)-.5),v=isNumber(a)?a:50,v=Math.min(v,100),v=Math.max(v,0);if(void 0!==f&&null!==f){var m=o.valToIndex?o.valToIndex[f]:f;g.color=TradingView.generateColor(n[m].color.value(),v)}else g.color=null;this._items.push(g)}this.Z98.timeScale().indexesToCoordinates(this._items)}},r.prototype.renderer=function(){if(this.Z99.properties().styles[this._plotName].visible&&this.Z99.properties().styles[this._plotName].visible.value()&&this._scalesReady()){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={items:this._items,y:0,h:this.Z99.priceScale().height(),w:Math.ceil(this.Z98.timeScale().barSpacing())},t=new TradingView.CompositeRenderer;return t.append(new Z53(e)),t}},n.prototype.items=function(){return this.m_items},n.prototype.update=function(){this.m_invalidated=!0},n.prototype._scalesReady=function(){var e=this.m_model.timeScale(),t=this.m_study.priceScale();return e&&t&&!e.isEmpty()&&!t.isEmpty()},n.prototype._updateImpl=function(){if(this.m_items=[],this._scalesReady()){var e=this.m_model.timeScale(),t=this.m_study.priceScale(),i=e.visibleBars().clone();if(!i.isEmpty()){var r=this.m_series.nearestIndex(i.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),n=this.m_series.nearestIndex(i.lastBar(),TradingView.SEARCH_NEAREST_LEFT),o=this.m_study.offset(this.m_plotName);o>0?(r-=o,n+=o):(r+=o,n-=o);var a=this.m_study.data(),s=this.m_study.firstValue(),l=a.range(r,n),d=t.properties().percentage.value(),h=(t.priceRange(),this._getTranspValue()),p=TradingView.selectionIndexes(r,n),c=this.m_study===this.m_model.selectedSource();c&&(this.m_selectionData={points:[],hittestResult:TradingView.HitTestResult.REGULAR,vertOffset:0});var u,_,f=this.m_series.properties().style.value(),g=f===TradingView.Series.STYLE_LINE?"lineStyle":f===TradingView.Series.STYLE_AREA?"areaStyle":null;g?(u=this.m_series.properties()[g].priceSource.value(),_=u):(u="high",_="low"),this._topCoord=t.coordinateToPrice(t.height()*t.topMargin()),this._bottomCoord=t.coordinateToPrice(t.height()*(1-t.bottomMargin()));for(var v=l._start;v<l._end;++v){var m=l._indexAt(v),y=Math.floor(m+o),w=l._valueAt(v),T=w[this.m_plotIndex+1];if(null!==T&&void 0!==T){var b=this._createItem(y,T,u,_,d,s);if(void 0!==b&&null!==b){var S=void 0!==w[this._colorer+1]||this._palette&&this._palette.addDefaultColor;if(this._colorer&&S){var T=w[this._colorer+1];b.style={};var C;if(void 0!==T&&null!==T){var x=this._palette.valToIndex?this._palette.valToIndex[T]:T;C=this._paletterProps.colors[x].color.value(),b.style.color=TradingView.generateColor(C,h)}else C=this.m_study.properties().styles[this.m_plotName].color.value(),b.style.color=TradingView.generateColor(C,100);var P=h>9?h-10:0;b.style.borderColor=TradingView.generateColor(C,P)}var L=void 0!==w[this._textColorer+1]||this._textPalette&&this._textPalette.addDefaultColor;if(this._textColorer&&L){var T=w[this._textColorer+1];b.style||(b.style={});var E;if(void 0!==T&&null!==T){var x=this._textPalette.valToIndex?this._textPalette.valToIndex[T]:T;E=this._textPaletterProps.colors[x].color.value(),b.style.textColor=TradingView.generateColor(E,h)}else E=this.m_study.properties().styles[this.m_plotName].textColor.value(),b.style.textColor=TradingView.generateColor(E,100)}this.m_model.timeScale().indexToCoordinate(Math.floor(y)),this.m_study.priceScale().priceToCoordinate(w);c&&-1!==p.indexOf(m)&&this.m_selectionData.points.push(b),this.m_items.push(b)}}}this._convertItemsToCoordinates()}}},n.prototype._getSeriesVal=function(e,t){var e=e||"close",i=null;try{i=this.m_series[e](t)}catch(r){}return i},n.prototype._getTranspValue=function(){var e=0;this.m_study.properties().transparency&&(e=this.m_study.properties().transparency.value(),e=isNumber(e)?e:50);var t=this.m_study.properties().styles[this.m_plotName];return t.transparency&&(e=t.transparency.value(),e=isNumber(e)?e:50),e},n.prototype._createItem=function(e,t,i,r,n,o){var a=this.m_study.properties().styles[this.m_plotName].location.value();if(!t&&a!=CanvasEx.MARKLOC_ABSOLUTE)return null;
switch(a){case CanvasEx.MARKLOC_ABOVEBAR:var s=this._getSeriesVal(i,e);if(void 0===s||null==s)return null;var l=s;break;case CanvasEx.MARKLOC_BELOWBAR:var d=this._getSeriesVal(r,e);if(void 0===d||null==d)return null;var l=d;break;case CanvasEx.MARKLOC_TOP:var l=this._topCoord;break;case CanvasEx.MARKLOC_BOTTOM:var l=this._bottomCoord;break;case CanvasEx.MARKLOC_ABSOLUTE:var l=t;break;default:throw Error("Bad value: "+a)}n&&a!=CanvasEx.MARKLOC_TOP&&a!=CanvasEx.MARKLOC_BOTTOM&&(l=100*(l-o)/o);var h=new MathEx.Point(e,l);return h},n.prototype._convertItemsToCoordinates=function(){var e=this.m_model.timeScale(),t=this.m_study.priceScale();e.indexesToCoordinates(this.m_items),t.pricesToCoordinatesEx(this.m_items,function(e){return e.y},function(e,t){e.y=t})},n.prototype._calculateVerticalOffset=function(e,t){var i=0;switch(e){case CanvasEx.MARKLOC_ABOVEBAR:case CanvasEx.MARKLOC_BOTTOM:i=-t;break;case CanvasEx.MARKLOC_BELOWBAR:case CanvasEx.MARKLOC_TOP:i=t}return i},n.prototype._calculateShapeHeight=function(e,t){var i=e;switch(t){case CanvasEx.SIZE_TINY:i=.3*e;break;case CanvasEx.SIZE_SMALL:i=.6*e;break;case CanvasEx.SIZE_NORMAL:i=e;break;case CanvasEx.SIZE_LARGE:i=1.5*e;break;case CanvasEx.SIZE_HUGE:i=2*e}return i},n.prototype.renderer=function(){if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady()){var e=this.m_model.timeScale();this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var t={},i=this._getTranspValue(),r=e.barSpacing(),n=this._calculateShapeHeight(r),o=this.m_study.properties().styles[this.m_plotName].location.value(),a=this._calculateVerticalOffset(o,n+n/2);t.barSpacing=r,t.items=this.m_items,t.color=TradingView.generateColor(this.m_study.properties().styles[this.m_plotName].color.value(),i),t.height=n,t.vertOffset=a;var s=this.m_study.properties().styles[this.m_plotName].plottype.value(),l=TradingView.StudyPlotShapes.Data[s];void 0===l&&TradingView.logError("Unknown style "+s);var d=new TradingView.CompositeRenderer;return d.append(new TradingView[l.paneRendererClass](t)),this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=a,d.append(new TradingView.SelectionRenderer(this.m_selectionData))),d}},inherit(o,n),o.prototype.renderer=function(){var e=this.m_study.properties().styles[this.m_plotName];if(e.visible&&e.visible.value()&&this._scalesReady()){var t=this.m_model.timeScale();this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var i,r={},n=this._getTranspValue(),o=t.barSpacing();if(e.size){var a=e.size.value();i=this._calculateShapeHeight(25,a)}else i=Math.round(o/2);var s=e.location.value(),l=TradingView.generateColor(e.color.value(),n),d=n>19?n-10:0,h=this._calculateVerticalOffset(s,Math.round(1.5*i));r.barSpacing=o,r.items=this.items(),r.color=l,r.borderColor=TradingView.generateColor(e.color.value(),d),r.height=i,r.vertOffset=h;var p=e.plottype.value(),c=TradingView.StudyPlotShapes.Data[p];void 0===c&&TradingView.logError("Unknown style "+p);var u=new TradingView.CompositeRenderer,_=e.text?e.text.value():void 0;if(void 0!==_&&""!==_.trim()){var f=_.trim().replace(/\\n/gm,"\n");f=TradingView.cleanButAmpersand(f,!0);var g=!1,v=!1,m="Arial",y=12;r.textCache=new TradingView.TextImageCache(f,g,v,m,y);var w=e.textColor?e.textColor.value():void 0;r.textColor=w?TradingView.generateColor(w,n):l}return u.append(new TradingView[c.paneRendererClass](r)),this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=h,u.append(new TradingView.SelectionRenderer(this.m_selectionData))),u}},inherit(a,o),a.prototype.renderer=function(){var e=this.m_study.properties().styles[this.m_plotName];if(e.visible&&e.visible.value()&&this._scalesReady()){var t=this.m_model.timeScale();this.m_study.priceScale();this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var i,r={},n=this._getTranspValue(),o=t.barSpacing();if(e.size){var a=e.size.value();i=this._calculateShapeHeight(50,a)}else i=Math.round(o);var s=e.location.value(),l=TradingView.generateColor(e.color.value(),n),d=this._calculateVerticalOffset(s,i);r.items=this.items(),r["char"]=e["char"].value(),r.height=i,r.vertOffset=d,r.color=l;var h=new TradingView.CompositeRenderer,p=e.text?e.text.value():void 0;if(void 0!==p&&""!==p.trim()){var c=p.trim().replace(/\\n/gm,"\n");c=TradingView.cleanButAmpersand(c,!0);var u=!1,_=!1,f="Arial",g=12;r.textCache=new TradingView.TextImageCache(c,u,_,f,g);var v=e.textColor?e.textColor.value():void 0;r.textColor=v?TradingView.generateColor(v,n):l}return h.append(new Z71(r)),this.m_study===this.m_model.selectedSource()&&(this.m_selectionData.vertOffset=d,h.append(new TradingView.SelectionRenderer(this.m_selectionData))),h}},inherit(s,n),s.prototype.renderer=function(){if(this.m_study.properties().styles[this.m_plotName].visible&&this.m_study.properties().styles[this.m_plotName].visible.value()&&this._scalesReady()){this.m_invalidated&&(this._updateImpl(),this.m_invalidated=!1);var e={},t=this._getTranspValue(),i=this.m_model.timeScale().barSpacing();e.items=this.m_items,e.barSpacing=i,e.colorup=TradingView.generateColor(this.m_study.properties().styles[this.m_plotName].colorup.value(),t),e.colordown=TradingView.generateColor(this.m_study.properties().styles[this.m_plotName].colordown.value(),t),e.colorBorder=TradingView.generateColor("#000000",t),e.minHeight=this.m_study.properties().styles[this.m_plotName].minHeight.value(),e.maxHeight=this.m_study.properties().styles[this.m_plotName].maxHeight.value();var r=new TradingView.CompositeRenderer;if(r.append(new Z52(e)),this.m_study===this.m_model.selectedSource()){var n=this.m_selectionData;n.barSpacing=i,r.append(new TradingView.SelectionRendererArrowsUpDown(n))}return r}},s.prototype._createItem=function(e,t,i,r,n,o){if(0!==t){Math.abs(t)>this._maxAbsValue&&(this._maxAbsValue=Math.abs(t));var a,s=t>0;if(s){var l=this._getSeriesVal(r,e);if(void 0===l||null==l)return null;a=l}else{var d=this._getSeriesVal(i,e);if(void 0===d||null==d)return null;a=d}n&&(a=100*(a-o)/o);var h=new TradingView.PaneRendererArrowsUpDownItem(e,a,t,s);return h}},s.prototype._convertItemsToCoordinates=function(){var e=this.m_model.timeScale(),t=this.m_study.priceScale();e.indexesToCoordinates(this.m_items),t.pricesToCoordinatesEx(this.m_items,function(e){return e.y},function(e,t){e.y=t});var i=Math.abs(this.m_study.properties().styles[this.m_plotName].minHeight.value()),r=Math.abs(this.m_study.properties().styles[this.m_plotName].maxHeight.value());if(i>r){var n=i;i=r,r=n}for(var o=r-i,a=o/this._maxAbsValue,s=this.m_items,l=0;l<s.length;l++){var d=s[l],h=Math.abs(d.height);d.height=h*a+i}},l.prototype.update=function(){this._invalidated=!0},l.prototype._updateImpl=function(){if(this.m_bars.length=0,!this.m_model.timeScale().isEmpty()&&!this.m_study.priceScale().isEmpty()){var e=this.m_model.timeScale().visibleBars().clone();if(!e.isEmpty()){for(var t=this.m_series.nearestIndex(e.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),i=this.m_series.nearestIndex(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT),r=this.m_study.data(),n=this.m_study.firstValue(),o=r.range(t,i),a=this.m_study.priceScale(),s=a.properties().percentage.value(),l=0,d=this.m_study.properties().ohlcPlots[this.m_plotName],h=(d.wickColor?d.wickColor.value():void 0,{}),p=function(e,t){var i=e+"@"+t;return h[i]||(h[i]=TradingView.generateColor(e,t)),h[i]},c=o._start;c<o._end;++c){var u=o._indexAt(c);u=Math.floor(u);for(var _=o._valueAt(c),f=!0,g={},v=TradingView.OPEN_PLOT;v<=TradingView.CLOSE_PLOT;++v){var m=_[this._ohlcPlotIndexes[v]+1];if(void 0===m||null===m){f=!1;break}g[v]=m}if(f){var y=g[TradingView.OPEN_PLOT],w=g[TradingView.CLOSE_PLOT],T=Math.max(y,g[TradingView.HIGH_PLOT],g[TradingView.LOW_PLOT],w),b=Math.min(y,g[TradingView.HIGH_PLOT],g[TradingView.LOW_PLOT],w),S={};S.time=Math.round(u),s?(S.open=100*(y-n)/n,S.high=100*(T-n)/n,S.low=100*(b-n)/n,S.close=100*(w-n)/n):(S.open=y,S.high=T,S.low=b,S.close=w);var C=d.color.value(),x=void 0!==_[this._colorer+1]||this._palette&&this._palette.addDefaultColor;if(this._colorer&&x){var m=_[this._colorer+1];if(void 0!==m&&null!==m){var P=this._palette.valToIndex?this._palette.valToIndex[m]:m,L=this._paletterProps.colors[P];C=L.color.value()}}S.color=p(C,l);var E=new TradingView.RGBColor(C),V=TradingView.rgbToHsl(E.r,E.g,E.b),I=V[2]>.25?V[2]-.26:V[2]+.75,A=TradingView.hslToRgb(V[0],V[1],I);E.r=A[0],E.g=A[1],E.b=A[2],S.borderColor=p(E.toHex(),l),S.hollow=null,this.m_bars.push(S)}}if(a.barPricesToCoordinates(this.m_bars),this.m_model.timeScale().barIndexesToCoordinates(this.m_bars),this.m_study===this.m_model.selectedSource()){var k=TradingView.selectionIndexes(t,i);this._selectionData={points:[],hittestResult:TradingView.HitTestResult.REGULAR};for(var c=0;c<k.length;c++){var u=k[c],_=this.m_study.data().valueAt(u);if(void 0!==_){var m=_[this._plotIndex+1];a.properties().percentage.value()&&(m=100*(m-n)/n);var R=this.m_model.timeScale().indexToCoordinate(Math.floor(u)),M=this.m_study.priceScale().priceToCoordinate(m);this._selectionData.points.push(new MathEx.Point(R,M))}}}}}},l.prototype.items=function(){return this.m_bars},inherit(d,l),d.prototype.renderer=function(){var e=this.m_study.properties().ohlcPlots[this.m_plotName];if(e.visible.value()){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={};t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.dontDrawOpen=this.m_series.properties().barStyle.dontDrawOpen.value();var i=new TradingView.CompositeRenderer;return i.append(new Z54(t)),this.m_series===this.m_model.selectedSource()&&i.append(new TradingView.SelectionRenderer(this._selectionData)),i}},inherit(h,l),h.prototype.renderer=function(){var e=this.m_study.properties().ohlcPlots[this.m_plotName];if(e.visible.value()){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t={};t.bars=this.m_bars,t.barSpacing=this.m_model.timeScale().barSpacing(),t.drawWick=e.drawWick.value(),t.drawBorder=e.drawBorder.value();var i=e.wickColor.value();t.borderColor=i,t.wickColor=i;var r=new TradingView.CompositeRenderer;return r.append(new Z55(t)),this.m_series===this.m_model.selectedSource()&&r.append(new TradingView.SelectionRenderer(this._selectionData)),r}},t.StudyPaneView=i,t.StudyBackgroundPaneView=r,t.StudyPlotShapesPaneView=o,t.StudyPlotCharsPaneView=a,t.StudyPlotArrowsPaneView=s,t.StudyPlotCandlesPaneView=h,t.StudyPlotBarsPaneView=d},function(e,t){"use strict";function i(e){this._data=e}function r(e){this.Z97=e,this._points1=[],this._points2=[],this._timePoints=[],this._getBarSpacing=e.model().timeScale().barSpacing.bind(e.model().timeScale()),this._invalidated=!0}function n(e){r.call(this,e)}function o(e,t,i){r.call(this,e),assert(t.type===TradingView.StudyMetaInfo.FilledArea.TYPE_PLOTS,"Wrong filledArea type: "+t.type),this._fillMetaInfo=t,this._fillStyleProps=i}i.prototype.hitTest=function(e){for(var t,i,r,n=(TradingView.selectionTolerance(this.lineWidth),1);n<this._data.points1.length;++n)if(t=this._data.points1[n],i=this._data.points2[n],r=this._data.timePoints[n],r==e.x&&(e.y>=t&&e.y<=i||e.y<=t&&e.y>=i))return new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR);return null},i.prototype.draw=function(e){if(0!==this._data.points1.length&&0!==this._data.points2.length)for(var t,i,r,n,o,a,s=this._data.timePoints,l=this._data.points1,d=this._data.points2,h=this._data.getBarSpacing()/24,p=TradingView.paneRendererCoordinateIsValid,c=isNumber(this._data.transparency)?this._data.transparency:50,c=Math.min(c,100),c=Math.max(c,0),u=TradingView.generateColor(this._data.backcolor,c),_=0;_<this._data.timePoints.length;_++)if(i=s[_],r=l[_],n=d[_],o=l[_+1],a=d[_+1],p(r)&&p(n)&&(t||(t={points1:[],points2:[],timePoints:[]}),t.points1.push(r),t.points2.push(n),t.timePoints.push(i)),t&&(!p(o)||!p(a))){1===t.timePoints.length&&(t.timePoints=[t.timePoints[0]-h,t.timePoints[0]+h],t.points1.push(t.points1[0]),t.points2.push(t.points2[0])),e.beginPath(),e.moveTo(t.timePoints[0],t.points1[0]);for(var f=1;f<t.timePoints.length;f++)e.lineTo(t.timePoints[f],t.points1[f]);t.timePoints.length>0&&t.points2.length>0&&e.lineTo(t.timePoints[t.timePoints.length-1],t.points2[t.timePoints.length-1]);for(var f=t.timePoints.length-2;f>=0;f--)e.lineTo(t.timePoints[f],t.points2[f]);e.closePath(),e.fillStyle=u,e.fill(),t=null}},r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(){if(this._points1=[],this._points2=[],this._timePoints=[],this._visible()){var e=this.Z97.priceScale(),t=this.Z97.Z98.timeScale();if(e&&!e.isEmpty()&&!this.Z97.Z98.timeScale().isEmpty()&&!this.Z97._series.bars().isEmpty()){var i=this.Z97.data()._columns.indexOf(this._plotAId())+1,r=this.Z97.data()._columns.indexOf(this._plotBId())+1,n=this.Z97.Z98.timeScale().visibleBars();if(!n.isEmpty()){var o=this.Z97._series.nearestIndex(n.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),a=this.Z97._series.nearestIndex(n.lastBar(),TradingView.SEARCH_NEAREST_LEFT),s=this.Z97.data().range(o,a);if(this.Z97.data()._items.length>0){var l=this.Z97.firstValue(),d=s._start,h=s._end,p=this.Z97.offset(this._plotAId()),c=this.Z97.offset(this._plotBId()),u=Math.max(p,c),_=Math.min(p,c),f=d+u,g=0;d>g&&(f=u>d?u:d);var v=h+_,m=s._items.length;h>m+_&&m>h&&(v=m+_),0>_&&m+_>=h&&(v=h);var y=s._indexAt(d);d>f?y+=u:f>h?y+=u:y=s._indexAt(f);for(var w=f;v>w;++w){var T=s._valueAt(w-p),b=s._valueAt(w-c),S=T[i],C=b[r];e.properties().percentage.value()&&(S=100*(S-l)/l,C=100*(C-l)/l),this._points1.push(S),this._points2.push(C),this._timePoints.push(t.indexToCoordinate(y++))}}e.pricesArrayToCoordinates(this._points1),e.pricesArrayToCoordinates(this._points2)}}}},r.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={};return e.points1=this._points1,e.points2=this._points2,e.timePoints=this._timePoints,e.getBarSpacing=this._getBarSpacing,e.backcolor=this._color(),e.transparency=this._transparency(),new i(e)},r.prototype._plotAId=function(){assert(!1,"Pure virtual call!")},r.prototype._plotBId=function(){assert(!1,"Pure virtual call!")},r.prototype._color=function(){assert(!1,"Pure virtual call!")},r.prototype._transparency=function(){assert(!1,"Pure virtual call!")},r.prototype._visible=function(){assert(!1,"Pure virtual call!")},inherit(n,r),n.prototype._plotAId=function(){var e=this.Z97.properties().area[0];return e.name.value()},n.prototype._plotBId=function(){var e=this.Z97.properties().area[1];return e.name.value()},n.prototype._color=function(){return this.Z97.properties().areaBackground.backgroundColor.value()},n.prototype._transparency=function(){return this.Z97.properties().areaBackground.transparency.value()},n.prototype._visible=function(){return this.Z97.properties().areaBackground.fillBackground.value()},inherit(o,r),o.prototype._plotAId=function(){return this._fillMetaInfo.objAId},o.prototype._plotBId=function(){return this._fillMetaInfo.objBId},o.prototype._color=function(){return this._fillStyleProps.color.value()},o.prototype._transparency=function(){return this._fillStyleProps.transparency.value()},o.prototype._visible=function(){return this._fillStyleProps.visible.value()},t.Z0=o,t.J53=n},function(e,t,i){"use strict";function r(e,t){a.call(this),this.Z99=e,this.Z98=t;var i=e.metaInfo().plots;if(i){for(var r=0;r<i.length;++r)if(!(this.Z99.isSelfColorerPlot(r)||this.Z99.isBarColorerPlot(r)||this.Z99.isBgColorerPlot(r)||this.Z99.isDataOffsetPlot(r)||this.Z99.isOHLCColorerPlot(r))){var n,o=i[r].id;if("Compare@tv-basicstudies"===this.Z99.metaInfo().id)n=new s(this.Z99.inputsForGUI()[1],"");else{var l=this.Z99.title();try{l=this.Z99.properties().styles[o].title.value()}catch(d){}n=new s(l,"")}n.plotId=o,n.plotIndex=r,this._items.push(n)}this.update(),this._invalidated=!0}}function n(e,t){r.call(this,e,t)}var o=i(38),a=o.DataWindowView,s=o.DataWindowItem;inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(){var e=!0;this._header=this.Z99.title(e),this._title=this.Z99.title();for(var t=this.Z99.isVisible()?$.t("n/a"):"",i=0;i<this._items.length;++i)this._items[i].setValue(t);if(Z75.enabled("hide_last_na_study_output")&&this._items.length&&this._items[this._items.length-1].setValue(""),!this.Z98.timeScale().isEmpty()){var r=this.Z99.metaInfo().plots,n=null,o={};if(r)for(var i=0;i<r.length;i++)(this.Z99.isSelfColorerPlot(i)||this.Z99.isOHLCColorerPlot(i))&&(o[r[i].target]={index:i},o[r[i].target].palette=this.Z99.metaInfo().palettes[r[i].palette],o[r[i].target].paletterProps=this.Z99.properties().palettes[r[i].palette]);for(var a=this.Z99.data().size()-1,s=this.Z98.crossHairSource().appliedIndex(),l=this.Z99.formatter(),i=0;i<this._items.length;++i){var d=this._items[i],h=d.plotId,p=d.plotIndex,c=this.Z99.offset(h),u=isNumber(s)?this.Z99.nearestIndex(s-c,TradingView.SEARCH_NEAREST_LEFT):a;if(void 0!==u){var _=this.Z99.data().valueAt(u)||this.Z99.data().last();if(_){var f=_[p+1];if(isNumber(f)){d.setValue(l.format(f));var g=this.Z99.properties().styles[h].color.value();if(this.Z99.isOHLCSeriesPlot(p)&&(h=r[p].target,g=this.Z99.properties().ohlcPlots[h].color.value()),o[h]&&_.length>o[h].index+1){var v=_[o[h].index+1];if(void 0!==v&&null!==v){var n=o[h].palette,m=o[h].paletterProps,y=n.valToIndex?n.valToIndex[v]:v;this._items[i].setColor(m.colors[y].color.value())}else this._items[i].setColor(g)}else this._items[i].setColor(g)}}}}}},r.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},inherit(n,r),n.prototype.additional=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._additional},n.prototype._updateImpl=function(){var e=TradingView.getDataVendorString(this.Z99.symbolInfo());return e?this._additional="(Data Provided by "+e+")":this._additional=void 0,r.prototype._updateImpl.call(this)},t.StudyDataWindowView=r,t.DataVendorStudyDataWindowView=n},function(e,t,i){"use strict";function r(e,t){if(!e)throw Error("No studies metainfo");var r=i(87);if(this._studiesMetainfo=e,!t)throw Error("No studies migrations");this._studiesMigrations=t,this._migrations={};for(var n=0;n<this._studiesMigrations.length;n++)for(var o=this._studiesMigrations[n],a=0;a<o.length;a++)for(var s=o[a],l=s.versFrom,d=s.versTo,h=0;h<s.studyMigrations.length;h++){var p=s.studyMigrations[h],c=p.studyId;if(0===p.rules.length)throw Error("Study Migration should have at least one convertion rule");var u=c in this._migrations?this._migrations[c]:new r(c);u.addMigration(l,d,p.rules),this._migrations[c]=u}this._clientMigrations=[function(e,t){if(0===this._studiesMetainfo.length||!e.isTVScript||e.version>=22)return t;for(var i={},r=0,n=0;;){var o=t[n];if(void 0===o)break;var a=t[o.id];o.isFake&&(o.id="in_"+r++),i[n]=o,i[o.id]=a,n++}return i}]}var n=i(81);r.prototype.updateMetaInfo=function(e){if(!e)return e;assert(!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<i.length;r++)if(i[r].id===e.id){t=i[r];break}return TradingView.clone(t)},r.prototype.updateMetaInfoAsync=function(e,t){var i=$.Deferred(),r=i.promise();if(!e)return i.reject("No old metaInfo was given"),r;if(t)return i.resolve(null),r;if(e.isTVScript&&void 0!==e.TVScriptSourceCode){var n=TradingView.StudyMetaInfo.versionOf(e);if(n!=TradingView.StudyMetaInfo.CURRENT_METAINFO_FORMAT_VERSION){var o=this._studiesMetainfo.length?$56.tvScriptingPkgVersion(this._studiesMetainfo):"1",a=e.scriptIdPart||TVScript.createScriptIdPart();$56.translateScriptAsync(e.TVScriptSourceCode,null,a,o).done(function(e){e=TradingView.StudyMetaInfo.addOrReplaceStudyMetaInfo(this._studiesMetainfo,e),i.resolve(e)}.bind(this)).fail(function(t){TradingView.logWarn("Could not compile Pine script (skipping): "+e.description+" "+t),i.reject(t)})}else{var s=TradingView.StudyMetaInfo.addOrReplaceStudyMetaInfo(this._studiesMetainfo,e);i.resolve(s)}}else{for(var l=null,d=this._studiesMetainfo,h=0;h<d.length;h++)if(d[h].id===e.id){l=d[h];break}l?i.resolve(TradingView.clone(l)):i.resolve(null)}return r},r.prototype.updateStudyState=function(e,t,i){if(e){e=TradingView.clone(e);var n=t.id;if(n in this._migrations){var o=this._migrations[n].updateInputs(t.version,e.inputs);e.inputs=o}for(var a=0;a<this._clientMigrations.length;++a){var o=this._clientMigrations[a].call(this,t,e.inputs);Object.keys(o).length==Object.keys(e.inputs).length?e.inputs=o:TradingView.logWarn("StudyVersioning._clientMigrations application returned bad result. Skipping it...")}}var s=i;if(s&&e){var l={};r.mergeInputs(l,s.inputs),r.mergeInputs(l,s.defaults.inputs),r.mergeInputs(l,e.inputs),e.inputs=l;var d=TradingView.StudyMetaInfo.versionOf(t);if(t.isTVScript&&t.TVScriptSourceCode&&d>=12&&26>=d){for(var h={},a=0;a<t.plots.length;++a){var p=t.plots[a],c=s.plots[a];h[p.id]=c.id}for(var u=Object.keys(e.styles),a=0;a<u.length;++a){var _=u[a],f=e.styles[_];delete e.styles[_];var g=h[_];e.styles[g]=f}for(var v=Object.keys(e.plots),a=0;a<v.length;++a){var m=v[a],_=e.plots[m].id;e.plots[m].id=h[_]}}}return e},r.prototype.patchPointsBasedStudyState=function(e){return r._fixInputsMaxValue(e.state,e.metaInfo),"LineToolRegressionTrend"===e.type&&(e=n.patchSourceState(e)),e},r.prototype.patchPointsBasedStudyData=function(e,t){if("battle"!=TradingView.Environment())return t;if(!e||!t)return t;var i=TradingView.clone(t);return"VbPFixed@tv-volumebyprice"===e.id&&e.version&&e.version<=4&&r._patchOldVolumeProfiles(0,i),i},r.prototype.patchStudyData=function(e,t,i,n){if("battle"!=TradingView.Environment())return{data:t,nsData:i,indexes:n};var o=TradingView.clone(t),a=TradingView.clone(i),s=TradingView.clone(n);"VbPVisible@tv-volumebyprice"===e.id&&e.version&&e.version<=4&&r._patchOldVolumeProfiles(0,o.graphics),"VbPSessions@tv-volumebyprice"===e.id&&e.version&&e.version<=4&&r._patchOldVolumeProfiles(0,o.graphics);var l=TradingView.StudyMetaInfo.versionOf(e);if(e.isTVScript&&e.TVScriptSourceCode&&l>=12&&26>=l){var d=o.columns;o.columns=[];for(var h=0;h<d.length;++h){var p="plot_"+h;o.columns.push(p)}}return{data:o,nsData:a,indexes:s}},r._patchOldVolumeProfiles=function(e,t){var i=t.hhists[e].data,r=[];for(var n in i)r=r.concat(i[n]);t.hhists[0].data=r},r._fixInputsOrder=function(e,t){for(var i=TradingView.StudyMetaInfo.getOrderedInputIds(t),n=r.splitInputs(e.inputs),o=n.arr,a=n.obj,s=TradingView.merge({},a),l=0;l<i.length;++l){var d=i[l],h=r.findInputKeyById(o,d);if(null!==h){var p=o[h];s[l]=p}}e.inputs=s},r.INPUT_MAX_VALUE=253370764800,r._verifyInputsMaxValue=function(e){var t=r.INPUT_MAX_VALUE;if(e.inputs)for(var i=0;i<e.inputs.length;i++){var n=e.inputs[i];"integer"===n.type&&n.max&&n.max>t&&TradingView.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description)}},r._fixInputsMaxValue=function(e,t){var i=r.INPUT_MAX_VALUE;if(t.inputs)for(var n=0;n<t.inputs.length;n++){var o=t.inputs[n];"integer"===o.type&&o.max&&o.max>i&&(o.max=i)}if(e&&e.inputs){var a=r.splitInputs(e.inputs),s=a.arr;for(var l in s){var o=s[l];"integer"===o.type&&o.max&&o.max>i&&(o.max=i)}e.inputs=TradingView.merge(a.obj,a.arr)}},r.prototype.patchPropsStateAndMetaInfo=function(e,t,i){if(r._fixInputsOrder(e,t),r._fixInputsMaxValue(e,t),t.isTVScript&&"undefined"!=typeof TVScript&&TVScript.createScriptIdPart&&(t.scriptIdPart=t.scriptIdPart||TVScript.createScriptIdPart()),t.isTVScript&&("Script$TV_EARNINGS@tv-scripting"!==t.id&&"Script$TV_DIVIDENDS@tv-scripting"!==t.id&&"Script$TV_SPLITS@tv-scripting"!==t.id||delete t.TVScriptSourceCode),"Volume"!==t.id&&"Volume@tv-basicstudies"!==t.id||0!==t.inputs.length||(t.inputs=[{id:"length",type:"integer",defval:20,min:1,max:1e3}],t.plots.push({id:"vol_ma",type:"line"})),"Volume@tv-basicstudies"===t.id&&t.version&&t.version<=46&&(e.styles.vol.transparency=e.transparency||87),"PivotPointsStandard@tv-basicstudies"===t.id&&(0===t.inputs.length?(e.inputs={kind:"Traditional",showHistoricalPivots:!0},t.inputs=[{defval:"Traditional",id:"kind",type:"text",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"]},{id:"showHistoricalPivots",type:"bool",defval:!0}]):1===t.inputs.length&&(e.inputs={kind:"Traditional"},t.inputs=[{defval:"Traditional",id:"kind",type:"text",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"]},{id:"showHistoricalPivots",type:"bool",defval:!0}]),void 0===e._hardCodedDefaultsVersion)){e._hardCodedDefaultsVersion=1;var n=e.color;delete e.color,e.levelsStyle={colors:{P:n,"S1/R1":n,"S2/R2":n,"S3/R3":n,"S4/R4":n,"S5/R5":n}}}if("CMF"===t.shortId&&2===t.inputs.length&&(e.inputs={length:e.inputs["length fast"]},t.inputs=t.inputs.splice(0,1),t.inputs[0].id="length"),t.defaults&&void 0===t.defaults.precision&&(-1!=["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(t.id)?t.defaults.precision=0:t.defaults.precision=4),"MA"===t.id){var o=new TradingView.StudyMetaInfo({id:"MAExp",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgExp",type:"line"}],palettes:{}}),a=new TradingView.StudyMetaInfo({id:"MASimple",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgSimple",type:"line"}],palettes:{}}),s=new TradingView.StudyMetaInfo({id:"MAVolumeWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgVolumeWeighted",type:"line"}],palettes:{}}),l=new TradingView.StudyMetaInfo({id:"MAWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgWeighted",type:"line"}],palettes:{}});switch(e.inputs.type){case"exp":t=o;break;case"simple":t=a;break;case"weighted":t=l;break;case"volume weighted":t=s}e.styles[t.plots[0].id]=e.styles.MovAvg,delete e.styles.MovAvg,delete e.inputs.type}return i.oldShowStudyLastValueProperty&&(e.oldShowLastValue=e.showLastValue),delete e.showLastValue,delete e.showStudyArguments,{propsState:e,metaInfo:t}},r.compareStudyVersions=function(e,t){e=""+e,t=""+t;var i=e.split("."),r=i[0];r=parseInt(r,10);var n=i.length>1?i[1]:"0";n=parseInt(n,10);var o=t.split("."),a=o[0];a=parseInt(a,10);var s=o.length>1?o[1]:"0";return s=parseInt(s,10),a>r?-1:r>a?1:s>n?-1:n>s?1:0},r.isLess=function(e,t){var i=r.compareStudyVersions(e,t);return 0>i},r.isLessOrEqual=function(e,t){var i=r.compareStudyVersions(e,t);return 0>=i},r.isEqual=function(e,t){var i=r.compareStudyVersions(e,t);return 0===i},r.isGreater=function(e,t){var i=r.compareStudyVersions(e,t);return i>0},r.isGreaterOrEqual=function(e,t){var i=r.compareStudyVersions(e,t);return i>=0},r.isVersionTesting=function(e){if(!e)return!1;e=""+e;var t=RegExp("\\d+.\\d+"),i=t.exec(e)==e;return i},r.isVersionHead=function(e){if(!e)return!1;e=""+e;var t=RegExp("\\d+"),i=t.exec(e)==e;return i},r.mergeInputs=function(e,t){r.mergeInputsArrPart(e,t),r.mergeInputsObjPart(e,t)},r.mergeInputsArrPart=function(e,t){var i=r.splitInputs(t);for(var n in i.arr){var o=r.findInputKeyById(e,i.arr[n].id);o?TradingView.merge(e[o],i.arr[n]):r.appendInputInfoToArr(e,i.arr[n])}},r.mergeInputsObjPart=function(e,t){var i=r.splitInputs(t);TradingView.merge(e,i.obj)},r.appendInputInfoToArr=function(e,t){var i=-1;for(var r in e){var n=parseInt(r,10);isNumber(n)&&n>i&&(i=n)}e[i+1]=t},r.splitInputs=function(e){var t={},i={};for(var r in e)isNumber(parseInt(r,10))?t[r]=e[r]:i[r]=e[r];return{arr:t,obj:i}},r.findInputKeyById=function(e,t){var i=null;for(var r in e)if(isNumber(parseInt(r,10))&&e[r].id==t){i=r;break}return i},r.getInputKeyById=function(e,t){var i=r.findInputKeyById(e,t);if(!i)throw Error("Cannot find input with id: "+t);return i},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){var r="RegressionTrend@tv-basicstudies",o=TradingView.Study.lineToolNameForPointsBasedStudy(r),i=i?i:TradingView.StudyMetaInfo.findStudyMetaInfo(e.studiesMetaData(),r),a=e.studyVersioning(),s=t?t:u(i,null,null,a);s.merge({blockCopying:!0}),l.call(this,e,[new n(this,e)],s,o),this._turnaroundCounter=1,this._turnaround="linreg_"+this._turnaroundCounter,this._metaInfo=i,this._graphics=new $61(i)}function n(e,t){a.call(this,e,t),this._calc=null,this._lines=[],this._pearsons=null,this._rendererCache={}}var o=i(13).LineDataSource,a=i(44),s=i(82).LinearRegressionPaneView,l=i(85).StudyLineDataSource,d=i(83).ParallelChannelRenderer,h=i(45).TextRenderer,p=i(55).TrendLineRenderer,c=i(74),u=c.prepareStudyProperties;inherit(r,l),r.prototype.version=2,r.prototype.pointsCount=function(){return 2},r.prototype.recalcStudyIfNeeded=function(){this._studyId||2!=this._points.length||this._requestStudy()},r.prototype._requestStudy=function(){var e=this.points()[0],t=this.points()[1],i=Math.min(e.index,t.index),r=Math.max(e.index,t.index);if(i===r)return void this.clearData();var n=this.Z98.mainSeries().bars().valueAt(i),o=this.Z98.mainSeries().bars().valueAt(r);if(n&&o){var a=1e3*n[TradingView.TIME_PLOT],s=1e3*o[TradingView.TIME_PLOT],l=[];l.push(this.properties().inputs["upper diviation"].value()),l.push(this.properties().inputs["lower diviation"].value()),l.push(this.properties().inputs["use upper diviation"].value()),l.push(this.properties().inputs["use lower diviation"].value()),l.push(a),l.push(s),l.push(this.properties().inputs.source.value());var d=this;this._studyId?(this._turnaround="linreg_"+ ++this._turnaroundCounter,this.Z98.chartApi().modifyStudy(this._studyId,this._turnaround,l,function(e){d.onData(e)})):(this._studyId=TradingView.Study.makeNextStudyId(),this.Z98.chartApi().createStudy(this._studyId,this._turnaround,this.Z98.mainSeries()._seriesId,this._metaInfo.id+"-1!",l,function(e){d.onData(e)}))}},r.prototype.onData=function(e){if("data_update"===e.method&&e.params.customId==="pointset_"+this._currentPointsetId&&(o.prototype.onData.call(this,e),2==this._points.length&&this._requestStudy()),"data_update"===e.method&&e.params.customId===this._studyId){if(!this._checkTurnaround(e.params.turnaround))return;var t=TradingView.Study.prototype._makeJSONForNSData.call(this,e,{});if(!t.data)return;t.indexes_replace?this._indexes=e.params.nonseries.indexes:(this._nonseriesdata=t.data,TradingView.isNaN(t.data.baseLine.startPrice)||TradingView.isNaN(t.data.baseLine.endPrice)||(this._points[0].price=this._nonseriesdata.baseLine.startPrice,this._points[1].price=this._nonseriesdata.baseLine.endPrice),this._indexes=e.params.nonseries.indexes),this.updateAllViews(),this.Z98.updateSource(this)}},r.patchSourceState=function(e){var t={palettes:{},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:$.t("Upper Deviation"),type:"integer"},{defval:-2,id:"lower diviation",max:500,min:-500,name:$.t("Lower Deviation"),type:"integer"},{defval:!0,id:"use upper diviation",name:$.t("Use Upper Deviation"),type:"bool"},{defval:!0,id:"use lower diviation",name:$.t("Use Lower Deviation"),type:"bool"},{defval:0,id:"first bar time",max:253370764800,min:0,name:$.t("First bar time"),type:"time"},{defval:0,id:"last bar time",max:253370764800,min:0,name:$.t("Last bar time"),type:"time"},{defval:"close",id:"source",name:$.t("Source"),options:["open","high","low","close","hl2","hlc3","ohlc4"],
type:"text"}],plots:[],graphics:{},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}},_metainfoVersion:6,description:"Regression Trend",id:"RegressionTrend@tv-basicstudies",is_price_study:!0,shortDescription:"Reg Trend",shortId:"RegressionTrend",version:"2",fullId:"RegressionTrend@tv-basicstudies-2",name:"RegressionTrend@tv-basicstudies"};return e.metaInfo||(e.metaInfo=t),e},inherit(n,s),n.prototype.currentPoint=function(){return a.prototype.currentPoint.call(this)},n.prototype.anchorColor=function(){return a.prototype.anchorColor.call(this)},n.prototype.getTransparencyResetLines=function(){return this._lines.map(function(e){var t=$.extend({},e);return t.color=TradingView.resetTransparency(t.color),t})},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this.Z97._nonseriesdata){for(var t=[],i=[this._lines[1],this._lines[0],this._lines[2]],r=[],n=0;n<i.length;n++)i[n]&&r.push(i[n]);for(var n=1;n<r.length;n++){var o={};o.points=[i[n].floatPoints[0],i[n].floatPoints[1],i[n-1].floatPoints[0],i[n-1].floatPoints[1]],o.color=i[n].color,o.width=this.Z98.timeScale().width(),o.height=this.Z97.priceScale().height(),o.linewidth=i[n].linewidth,o.linestyle=i[n].linestyle,o.extendleft=!1,o.extendright=i[n].extendright,o.backcolor=o.color,o.transparency=this.Z97.properties().styles.transparency.value(),o.skipLines=!0,o.fillBackground=!0,e.append(new d(o,new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)))}for(var n=0;n<r.length;n++)e.append(new p(this.getTransparencyResetLines()[n],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR))),0!==n&&(t=t.concat(this._lines[n].floatPoints));if(this._pearsons&&(this._pearsons.color=TradingView.resetTransparency(this._pearsons.color),e.append(new h(this._pearsons,this._rendererCache))),this.isAnchorsRequired()&&this._lines&&this._lines.length>=1){e.append(new TradingView.SelectionRenderer({points:t}));var a=this._lines[0].floatPoints;a[0].data=0,a[1].data=1,e.append(this.createLineAnchor({points:a}))}}return e},n.prototype.updateImpl=function(){s.prototype.updateImpl.call(this)},n.prototype.update=function(){s.prototype.update.call(this),a.prototype.update.call(this)},e.exports=r},function(e,t,i){"use strict";function r(e,t){this.Z98=e,this.Z97=t,this._lines=[],this._pearsons=null,this._rendererCache={},this._invalidated=!0}function n(e,t,i,n){d.call(this,e,t,i,n,new r(e,this))}var o=i(13).LineDataSource,a=i(44),s=i(83).ParallelChannelRenderer,l=i(45).TextRenderer,d=i(84),h=i(55).TrendLineRenderer;inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(this._lines=[],this._pearsons=null,this.Z97._nonseriesdata&&void 0!==this.Z97._nonseriesdata.startIndex&&void 0!==this.Z97._nonseriesdata.endIndex&&this.Z97.properties().visible.value()){var e=this.Z97._nonseriesdata,t=this.Z97._indexes,i=this.Z98.timeScale(),r=this.Z97.priceScale(),n=this.Z98.mainSeries(),a=n.firstBar();if(r&&!r.isEmpty()&&!i.isEmpty()&&a){for(var s=t[e.startIndex],l=t[e.endIndex],d=[e.baseLine,e.downLine,e.upLine],h=Math.round(i.indexToCoordinate(s)),p=Math.round(i.indexToCoordinate(l)),c=this.Z97.properties(),u=[c.styles.baseLine,c.styles.downLine,c.styles.upLine],_=0;_<d.length;_++)if(u[_].visible.value()){var f=d[_].startPrice,g=d[_].endPrice;r.isPercent()&&(f=r.priceRange().convertToPercent(f,a[TradingView.CLOSE_PLOT]),g=r.priceRange().convertToPercent(g,a[TradingView.CLOSE_PLOT]));var v=r.priceToCoordinate(f,!0),m=r.priceToCoordinate(g,!0),y=new MathEx.Point(h,v),w=new MathEx.Point(p,m),T=u[_].color.value(),b=u[_].linewidth.value(),S=u[_].linestyle.value(),C={floatPoints:[y,w],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:T,linewidth:b,linestyle:S,extendleft:!1,extendright:c.styles.extendLines.value(),leftend:o.LINEEND_NORMAL,rightend:o.LINEEND_NORMAL};this._lines.push(C)}if(c.styles.showPearsons.value()){var x=e.downLine.startPrice;r.isPercent()&&(x=r.priceRange().convertToPercent(x,a[TradingView.CLOSE_PLOT]));var P=r.priceToCoordinate(x),L=new MathEx.Point(h,P);this._pearsons={points:[L],text:""+e.pearsons,color:c.styles.downLine.color.value(),vertAlign:"top",horzAlign:"center",font:"Arial",offsetX:0,offsetY:4,fontsize:12}}}}},r.prototype.getTransparencyResetLines=function(){return this._lines.map(function(e){var t=$.extend({},e);return t.color=TradingView.resetTransparency(t.color),t})},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=[this._lines[1],this._lines[0],this._lines[2]],i=[],r=0;r<t.length;r++)t[r]&&i.push(t[r]);for(var r=1;r<i.length;r++){var n={};n.points=[t[r].floatPoints[0],t[r].floatPoints[1],t[r-1].floatPoints[0],t[r-1].floatPoints[1]],n.color=t[r].color,n.width=this.Z98.timeScale().width(),n.height=this.Z97.priceScale().height(),n.linewidth=t[r].linewidth,n.linestyle=t[r].linestyle,n.extendleft=!1,n.extendright=t[r].extendright,n.backcolor=n.color,n.transparency=this.Z97.properties().styles.transparency.value(),n.skipLines=!0,n.fillBackground=!0,e.append(new s(n,new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR),new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)))}for(var r=0;r<this._lines.length;r++)e.append(new h(this.getTransparencyResetLines()[r],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return this._pearsons&&(this._pearsons.color=TradingView.resetTransparency(this._pearsons.color),e.append(new l(this._pearsons,this._rendererCache))),e},inherit(n,d),n.prototype.isVisible=function(){if(!this.properties().visible.value())return!1;var e=this.properties().styles;return e.upLine.visible.value()||e.downLine.visible.value()||e.baseLine.visible.value()},t.LinearRegressionPaneView=r,t.study_LinearRegression=n},function(e,t,i){"use strict";function r(e,t,i){this._data=e,this._hittestResult=t||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittestResult=i||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND)}function n(e,t){a.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolParallelChannel";var i=t?t:new J50("linetoolparallelchannel");s.call(this,e,new n(this,e),i)}var a=i(44),s=i(13).LineDataSource,l=i(55).TrendLineRenderer;r.prototype.extendPoints=function(e,t,i,r){var n=new MathEx.Point(0,0),o=new MathEx.Point(i,r);if(this._data.extendleft){var a=e.substract(t),s=MathEx.intersectRayWithRect(e,e.add(a),n,o);s&&(e=s)}if(this._data.extendright){var a=t.substract(e),s=MathEx.intersectRayWithRect(t,t.add(a),n,o);s&&(t=s)}if(this._data.extendleft&&!MathEx.pointInRect(e,n,o)&&MathEx.pointInRect(t,n,o)){var s=MathEx.intersectRayWithRect(t,e,n,o);s&&(e=s)}if(this._data.extendright&&!MathEx.pointInRect(t,n,o)&&MathEx.pointInRect(e,n,o)){var s=MathEx.intersectRayWithRect(e,t,n,o);s&&(t=s)}return[e,t]},r.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency)},r.prototype.draw=function(e){if(!(this._data.points.length<2)){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t=this._data.points[0],i=this._data.points[1],r=this.extendPoints(t,i,this._data.width,this._data.height);if(this._data.skipLines||CanvasEx.drawLine(e,r[0].x,r[0].y,r[1].x,r[1].y),4==this._data.points.length){var n=this._data.points[2],o=this._data.points[3];if(!n||!o)return;var a=this.extendPoints(n,o,this._data.width,this._data.height);if(this._data.skipLines||this._data.skipTopLine||CanvasEx.drawLine(e,a[0].x,a[0].y,a[1].x,a[1].y),this._data.fillBackground){var s=Math.max(r[1].x,a[1].x),d=Math.max(r[1].y,a[1].y),h=Math.min(a[0].x,r[0].x),p=Math.min(a[0].y,r[0].y);if(!(isFinite(s)&&isFinite(d)&&isFinite(h)&&isFinite(p)))return;if(e.fillStyle=this.getColor(),e.beginPath(),e.moveTo(r[0].x,r[0].y),e.lineTo(r[1].x,r[1].y),this._data.extendright){var c=MathEx.optionalCorner(r[1],a[1],this._data.width,this._data.height);c&&e.lineTo(c.x,c.y)}if(e.lineTo(a[1].x,a[1].y),e.lineTo(a[0].x,a[0].y),this._data.extendleft){var u=MathEx.optionalCorner(a[0],r[0],this._data.width,this._data.height);u&&e.lineTo(u.x,u.y)}e.lineTo(r[0].x,r[0].y),e.fill()}if(this._data.showMidline&&!this._data.skipLines){e.strokeStyle=this._data.midcolor,e.lineWidth=this._data.midlinewidth,e.lineStyle=this._data.midlinestyle;var _=this._data.points[0].add(this._data.points[2]).scaled(.5),f=this._data.points[1].add(this._data.points[3]).scaled(.5),a=this.extendPoints(_,f,this._data.width,this._data.height),g=l.prototype.lineClipping(a[0],a[1],this._data.width,this._data.height);g&&CanvasEx.drawLine(e,Math.round(g[0].x),Math.round(g[0].y),Math.round(g[1].x),Math.round(g[1].y))}}}},r.prototype.hitTest=function(e){if(this._data.points.length<2)return null;var t=3,i=this._data.floatPoints||this._data.points,r=i[0],n=i[1],o=i[2],a=i[3],s=this.extendPoints(r,n,this._data.width,this._data.height),l=MathEx.distanceToSegment(s[0],s[1],e);if(l.distance<=t)return this._hittestResult;if(4==this._data.points.length&&!this._data.skipTopLine){if(!o||!a)return null;var s=this.extendPoints(o,a,this._data.width,this._data.height),l=MathEx.distanceToSegment(s[0],s[1],e);if(l.distance<=t)return this._hittestResult;if(this._data.showMidline&&!this._data.skipLines){var d=r.add(o).scaled(.5),h=n.add(a).scaled(.5),s=this.extendPoints(d,h,this._data.width,this._data.height),l=MathEx.distanceToSegment(s[0],s[1],e);if(l.distance<=t)return this._hittestResult}}if(this._data.hittestOnBackground&&this._data.fillBackground&&4==this._data.points.length){var p=(n.y-r.y)/(n.x-r.x),c=r.y+p*(e.x-r.x),u=o.y+p*(e.x-o.x),_=Math.max(c,u),f=Math.min(c,u),g=Math.min(r.x,n.x),v=Math.max(r.x,n.x);if(!this._data.extendleft&&e.x<g)return null;if(!this._data.extendright&&e.x>v)return null;if(e.y>=f&&e.y<=_)return this._backHittestResult}return null},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(a.prototype.update.call(this),this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&0!==this.Z97.points().length&&(this.Z97._priceOffset||this.Z97.calculatePriceDiff(),3===this._points.length&&this.Z97._priceOffset)){var e=this._points[0],t=this._points[1],i=this.Z97._priceOffset+this.Z97.points()[0].price,r=this.Z97._priceOffset+this.Z97.points()[1].price;this._p3=e.clone(),this._p4=t.clone();var n=this.Z97.priceScale();if(n.isLog()){var o=.5*(i+r)-this.Z97._priceOffset,s=.5*(i+r),l=this.Z97.priceScale().priceToCoordinate(o),d=this.Z97.priceScale().priceToCoordinate(s),h=d-l;this._p3.y+=h,this._p4.y+=h}else{if(n.isPercent()){var p=this.Z97.ownerSource().firstValue();i=n.priceRange().convertToPercent(i,p),r=n.priceRange().convertToPercent(r,p)}this._p3.y=this.Z97.priceScale().priceToCoordinate(i),this._p4.y=this.Z97.priceScale().priceToCoordinate(r)}}},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};e.points=[],this._points.length>1&&(e.points.push(this._points[0]),e.points.push(this._points[1])),this._points.length>2&&(e.points.push(this._p3),e.points.push(this._p4)),e.color=this.Z97.properties().linecolor.value(),e.width=this.Z98.timeScale().width(),e.height=this.Z97.priceScale().height();var t=this.Z97.properties();e.linewidth=t.linewidth.value(),e.linestyle=t.linestyle.value(),e.extendleft=t.extendLeft.value(),e.extendright=t.extendRight.value(),e.fillBackground=t.fillBackground.value(),e.backcolor=t.backgroundColor.value(),e.transparency=t.transparency.value(),e.showMidline=t.showMidline.value(),e.midlinewidth=t.midlinewidth.value(),e.midlinestyle=t.midlinestyle.value(),e.midcolor=t.midlinecolor.value(),e.fillBackground=t.fillBackground.value(),e.hittestOnBackground=!0;var i=new TradingView.CompositeRenderer;if(i.append(new r(e)),this.isAnchorsRequired()){var n=[];n.push(this._points[0]),this._points[1]&&n.push(this._points[1]),this._p3&&(n.push(this._p3.add(this._p4).scaled(.5)),n[2].data=2);var o=3==this._points.length&&!this._p3;this.Z98.lineBeingCreated()!=this.Z97||o||n.pop(),i.append(this.createLineAnchor({points:n}))}if(!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&this._points.length>=2){var a=this._points;this.Z97.getAlertIsActive(function(e){i.append(new TradingView.PaneRendererClockIcon({point1:a[0],point2:a[1],color:e?t.linecolor.value():defaults("chartproperties.alertsProperties.drawingIcon.color")}))})}return i},inherit(o,s),o.prototype.addPoint=function(e){var t=s.prototype.addPoint.call(this,e);if(t){var i=this.points()[0];this._points[2].index=i.index,this._points[2].price=i.price+this._priceOffset}return t},o.prototype.calculatePriceDiff=function(){if(3===this.points().length){var e=this.points()[0],t=this.points()[1],i=this.points()[2];if(e.index===t.index)return;var r=this.priceScale();if(null===r)return;if(r.isLog()){var n=this.Z98.timeScale();if(n.isEmpty())return;var o=n.indexToCoordinate(e.index),a=n.indexToCoordinate(t.index),s=r.priceToCoordinate(e.price),l=r.priceToCoordinate(t.price),d=n.indexToCoordinate(i.index),h=(r.priceToCoordinate(i.price),(l-s)/(a-o)),p=s+h*(d-o),c=r.priceToCoordinate(i.price),u=c-p,_=.5*(s+l),f=r.coordinateToPrice(_),g=_+u,v=r.coordinateToPrice(g);this._priceOffset=v-f}else{var h=(t.price-e.price)/(t.index-e.index),m=e.price+h*(i.index-e.index);this._priceOffset=i.price-m}}},o.prototype.setLastPoint=function(e,t){t&&t.shift&&2==this.points().length&&this._snapPoint45Degree(e,this.points()[0]),s.prototype.setLastPoint.call(this,e),this.calculatePriceDiff()},o.prototype.restorePoints=function(e,t,i){s.prototype.restorePoints.call(this,e,t,i),e&&e.length>=3&&(this._priceOffset=e[2].price-e[0].price)},o.prototype.setPoint=function(e,t,i){i&&i.shift&&2>e&&this._snapPoint45Degree(t,this.points()[1-e]),s.prototype.setPoint.call(this,e,t,i),2===e&&this.calculatePriceDiff();var r=this.points()[0];this._points[2].index=r.index,this._points[2].price=r.price+this._priceOffset},o.prototype.pointsCount=function(){return 3},o.prototype.title=function(){return"Parallel Channel"},o.prototype.addPoint=function(e,t){return t&&t.shift&&2==this.points().length&&this._snapPoint45Degree(e,this.points()[0]),s.prototype.addPoint.call(this,e,t)},o.prototype.fixAfterRestorePriceAxis=function(){this.priceScale().isLog()||delete this._priceOffset},o.prototype.cloneData=function(e){this._priceOffset=e._priceOffset},o.prototype.restoreData=function(e){e.priceOffset&&(this._priceOffset=e.priceOffset)},o.prototype.state=function(e){var t=s.prototype.state.call(this,e);return t.priceOffset=this._priceOffset,t},o.prototype.canHasAlert=function(){return!0},o.prototype._getAlertPlots=function(){function e(e,t){return e.index<=t.index?[e,t]:[t,e]}var t=[].concat(this._points).splice(0,2);t=t.concat([{price:t[0].price+this._priceOffset,time:t[0].time,index:t[0].index},{price:t[1].price+this._priceOffset,time:t[1].time,index:t[1].index}]);var i,r,n=e(t[0],t[1]),o=e(t[2],t[3]);this._priceOffset<0?(r=o,i=n):(r=n,i=o);var a,s,l=this.properties().extendLeft.value(),d=this.properties().extendRight.value();return t[0].index<=t[1].index?(a=l,s=d):(a=d,s=l),[this._linePointsToAlertPlot(i,"Upper",a,s),this._linePointsToAlertPlot(r,"Lower",a,s)]},t.LineToolParallelChannel=o,t.ParallelChannelRenderer=r},function(e,t,i){"use strict";function r(e,t,i,r,o){this._paneView=o,n.call(this,e,t,i,r)}var n=i(74).Study;inherit(r,n),r.prototype.onData=function(e){switch(e.method){case"data_update":var t=n.prototype._makeJSONForNSData.call(this,e,{});t.indexes_replace?this._indexes=e.params.nonseries.indexes:(this._nonseriesdata=t.data,this._indexes=e.params.nonseries.indexes);var i=this.Z98.paneForSource(this);this.Z98.recalculatePane(i),this.Z98.updateSource(this);break;default:return n.prototype.onData.call(this,e)}},r.prototype.updateAllViews=function(){this._paneView.update(),this._dataWindowView.update(),this._statusView.update()},r.prototype.paneViews=function(e){return[this._paneView]},r.prototype.state=function(e){var t=n.prototype.state.call(this,e);return e&&(t.nonSeriesData=this._nonseriesdata,t.indexes=this._indexes),t},r.prototype.restoreData=function(e,t,i){n.prototype.restoreData.call(this,e),this._nonseriesdata=t,this._indexes=i},r.prototype.clearData=function(){this._nonseriesdata=null,this._indexes=null},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,o){var s=new n(this,e);t.push(s),a.call(this,e,t,i),this.properties().listeners().subscribe(this,r.prototype.changeStyles),this._constructor=o,this._studyId=null,this._nonseriesdata=null,this._indexes=null,this._metaInfo=null,this._graphics=null,this._inputs=null}function n(e,t){s.call(this,e,t)}function o(e,t){s.call(this,e,t)}var a=i(13).LineDataSource,s=i(44),l=i(86).VertLineRenderer,d=i(55).TrendLineRenderer;inherit(r,a),r.prototype.pointsCount=function(){throw Error("Reimplement this in a child class")},r.prototype.title=function(){return this._metaInfo.description},r.prototype.studyId=function(){return this._metaInfo.id},r.prototype._requestStudy=function(){throw Error("Reimplement this in a child class")},r.prototype.changeStyles=function(){var e=i(80);if(this._inputs){var t=e.splitInputs(this.properties().inputs.state()),r=t.obj;for(var n in r)if(r[n]!==this._inputs[n]){this._inputs=r,this._requestStudy(),this.Q0.lastUpdateTime.setValue((new Date).valueOf());break}}else{var t=e.splitInputs(this.properties().inputs.state());this._inputs=TradingView.clone(t.obj),this._requestStudy(),this.Q0.lastUpdateTime.setValue((new Date).valueOf())}},r.prototype._checkTurnaround=function(e){return e===this._turnaround||e==this.Z98.mainSeries()._turnaround||e===this.Z98.mainSeries()._turnaround+"_"+this._turnaround},r.prototype.stop=function(){a.prototype.stop.call(this),this._studyId&&this.Z98.chartApi().removeStudy(this._studyId)},r.prototype.onData=function(e){throw Error("Reimplement this in a child class")},r.prototype._correctedPoint=function(e){var t=parseInt(this.Z98.mainSeries().bars().first(),10),i=parseInt(this.Z98.mainSeries().bars().last(),10);return e.index=Math.max(e.index,t),e.index=Math.min(e.index,i),e},r.prototype.addPoint=function(e){var t=a.prototype.addPoint.call(this,this._correctedPoint(e));return t},r.prototype.setLastPoint=function(e){return a.prototype.setLastPoint.call(this,this._correctedPoint(e))},r.prototype.move=function(e){},r.prototype.clearData=function(){void 0!==this.m_data&&(this.m_data=new TradingView.PlotList(this._plotFields)),this._nonseriesdata=null,this._indexes=null,this._graphics=new $61(this._metaInfo),this.updateAllViews()},r.prototype.state=function(e){var t=a.prototype.state.call(this,e);return e&&(void 0!==this.m_data&&(t.data=this.m_data.state()),t.nonseriesdata=this._nonseriesdata,t.nonseriesindexes=this._indexes,t.graphics=this._graphics.graphics()),this.metaInfo()instanceof TradingView.StudyMetaInfo?t.metaInfo=this.metaInfo().state():(t.metaInfo=$.extend({},this.metaInfo()),t.metaInfo.id=TradingView.StudyMetaInfo.parseIdString(t.metaInfo.id+(t.metaInfo.version?"-"+t.metaInfo.version:"")).fullId),t},r.prototype.restoreData=function(e){void 0!==this.m_data&&void 0!==e.data&&this.m_data.restoreState(e.data),this._nonseriesdata=e.nonseriesdata?e.nonseriesdata:null,this._indexes=e.nonseriesindexes?e.nonseriesindexes:null,this._graphics.setGraphics(e.graphics?e.graphics:$61.emptyGraphics())},r.prototype.setPoint=function(e,t){this._nonseriesdata=null,this._indexes=null,a.prototype.setPoint.call(this,e,this._correctedPoint(t))},r.prototype.disconnect=function(){this._studyId=0},r.prototype.graphics=function(){return this._graphics.graphics()},r.prototype.firstValue=function(){return this.Z98.mainSeries().data().firstValue()},r.prototype.formatter=function(){return this.Z98.mainSeries().data().formatter()},r.prototype.metaInfo=function(){return this._metaInfo},inherit(n,s),n.prototype.renderer=function(){var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;if(this.Z97._nonseriesdata)return e;if(this.Z97._graphics&&!this.Z97._graphics.isEmpty())return e;var t=this._points[0],i=this._points[1],r=(Math.min(t.x,i.x),Math.max(t.x,i.x),{});r.points=[t],r.color="#808080",r.linewidth=this.Z97._doNotNeedLine?0:1,r.linestyle=CanvasEx.LINESTYLE_SOLID,e.append(new l(r));var n={};n.points=[i],n.color="#808080",n.linewidth=this.Z97._doNotNeedLine?0:1,n.linestyle=CanvasEx.LINESTYLE_SOLID,e.append(new l(n));var o={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:"#808080",linewidth:this.Z97._doNotNeedLine?0:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};return e.append(new d(o)),e},inherit(o,s),o.prototype.renderer=function(){var e=new TradingView.CompositeRenderer;return this.isAnchorsRequired()&&(e.append(new TradingView.SelectionRenderer({points:this._points})),e.append(this.createLineAnchor({points:this._points}))),e},t.StudyLineDataSource=r,t.StudyLineDataSourcePaneView=o},function(e,t,i){"use strict";function r(e,t){this._data=e,this._hittest=t}function n(e,t){s.call(this,e,t),this._invalidated=!0}function o(e,t){d.call(this),this.Z97=e,this.Z98=t,this._invalidated=!0}function a(e,t){this._constructor="LineToolVertLine";var i=t?t:new J50("linetoolvertline");this._timeAxisView=new o(this,e),l.call(this,e,new n(this,e),i)}var s=i(44),l=i(13).LineDataSource,d=i(16),h=i(17);r.prototype.draw=function(e){if(0!==this._data.points.length&&!(this._data.linewidth<=0)){var t=this._data.points[0].x;e.translate(1,0);var i=e.canvas.height;e.lineCap="square",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle,CanvasEx.drawLine(e,t,0,t,i)}},r.prototype.hitTest=function(e){if(0===this._data.points.length)return null;var t=3,i=this._hittest||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT);return Math.abs(e.x-this._data.points[0].x)<=t?i:null},inherit(n,s),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};e.points=this._points,e.color=this.Z97.properties().linecolor.value(),e.linewidth=this.Z97.properties().linewidth.value(),e.linestyle=this.Z97.properties().linestyle.value();var t=new TradingView.CompositeRenderer;if(t.append(new r(e)),this.addAnchors(t),!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&1==e.points.length){var i=new MathEx.Point(this._points[0].x,this.Z97.priceScale().height()/2);this.Z97.getAlertIsActive(function(r){t.append(new TradingView.PaneRendererClockIcon({point1:i,color:r?e.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))})}return t},inherit(o,d),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){if(!this.Z98.timeScale().isEmpty()&&0!==this.Z97.points().length){this._text="",this._background=this.Z97.properties().linecolor.value();var e=this.Z97.points()[0].index;this._coordinate=this.Z98.timeScale().indexToCoordinate(e);var t=this.Z98.timeScale().indexToUserTime(e);t&&(this._text=new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(t)),this._invalidated=!1}},o.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background};return new h(e)},inherit(a,l),a.prototype.pointsCount=function(){return 1},a.prototype.title=function(){return"Vertical Line"},a.prototype.timeAxisViews=function(){return this.symbol()!==this.Z98.mainSeries().symbol()?null:this.properties().showTime.value()?[this._timeAxisView]:null},a.prototype.updateAllViews=function(){l.prototype.updateAllViews.call(this),this._timeAxisView.update()},a.prototype.canHasAlert=function(){return!0},a.prototype._getAlertPlots=function(){var e=this._points[0],t={index:e.index,price:e.price+1};return[this._linePointsToAlertPlot([e,t],null,!0,!0)]},t.VertLineRenderer=r,t.LineToolVertLine=a},function(e,t,i){"use strict";function r(e){this._studyId=e,this._maxToVers="0",this._maxFromVers="0",this._migrs=[]}var n=i(80);r.prototype.addMigration=function(e,t,i){n.isGreater(e,this._maxFromVers)&&(this._maxFromVers=e),n.isGreater(t,this._maxToVers)&&(this._maxToVers=t),this._migrs.push({fromVers:e,toVers:t,rules:i})},r.prototype.updateInputs=function(e,t){if(!t)return t;for(var i=TradingView.clone(t),r=e;n.isLess(r,this._maxToVers);){var o=this._findMigration(r);if(i=this._applyMigration(i,o),!n.isLess(r,o.toVers))throw Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");r=o.toVers,TradingView.logDebugChart("Applied migration rule to study: "+this._studyId+" from vers: "+o.fromVers+" to vers: "+o.toVers)}return i},r.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,r=0;r<this._migrs.length;r++){var o=this._migrs[r];n.isLess(o.fromVers,e)||n.isLessOrEqual(o.fromVers,i)&&(i=o.fromVers,t=r)}if(0>t)throw Error("Could not find matching migration for study: "+this._studyId+" vers: "+e);return this._migrs[t]},r.prototype._applyMigration=function(e,t){for(var i=e,r=0;r<t.rules.length;r++){var n=t.rules[r],o=this._getApplyRuleFun(n.type);i=o(i,n)}return i},r.prototype._getApplyRuleFun=function(e){if("inputRemoved"==e)return r._applyInputRemovedRule;if("inputChangedType"==e)return r._applyInputChangedTypeRule;throw Error("Unknown migration rule type: "+e)},r._applyInputRemovedRule=function(e,t){if(!(t.inputId in e))return e;var i=n.findInputKeyById(e,t.inputId);if(!i)return e;delete e[i],delete e[t.inputId];var r={},o=0;for(var a in e)isNumber(parseInt(a,10))?(r[o]=e[a],o++):r[a]=e[a];return r},r._applyInputChangedTypeRule=function(e,t){var i=n.getInputKeyById(e,t.inputId);if("resetToDefVal"!=t.action)throw Error("Unknown action "+t.action+" for rule with type "+t.type);return e[t.inputId]=t.defVal,e[i].defval=t.defVal,e[i].type=t.inputType,e},e.exports=r},function(e,t,i){"use strict";function r(e){this._data=e}function n(e){this._data=e}function o(e,t){for(var i=0,r=e.length-1;r>=i;){var n=i+r>>>1,o=e[n].y1,a=e[n].y2;if(o>t)i=n+1;else{if(!(t>a))return e[n+1]&&o==e[n+1].y1?n+1:n;r=n-1}}return-1}var a=i(45).TextRenderer,s=i(43).HorzLineRenderer,l=i(55).TrendLineRenderer,d=i(14),h=i(15),p=i(89),c=TradingView.Study,u=i(90);c.graphicsZOrderPriority=function(e){switch(e){case"polygons":return-100;case"trendchannels":return-90;default:return 0}},c.StudyPaneView_horizlines=function(e,t){this.Z99=e,this.Z98=t,this._data=[]},c.StudyPaneView_horizlines.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_horizlines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new l(this._data[t],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_horizlines.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().horizlines;if(e){var t=this.Z99.priceScale(),i=this.Z99.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s];if(l.data){var d=this.Z99.properties().graphics.horizlines[l.styleId];if(d.visible.value())for(var h=0;h<l.data.length;h++){var p=l.data[h],c=r[p.startIndex],u=r[p.endIndex];if(!(!p.extendRight&&Math.max(c,u)<o||!p.extendLeft&&Math.min(c,u)>a)){var _={},f=i.indexToCoordinate(c),g=i.indexToCoordinate(u),v=p.level;if(t.isPercent()){var m=this.Z99.firstValue();v=t.priceRange().convertToPercent(v,m)}var y=t.priceToCoordinate(v),w=new MathEx.Point(f,y),T=new MathEx.Point(g,y);_.points=[w,T],_.extendleft=p.extendLeft,_.extendright=p.extendRight,_.width=i.width(),_.height=t.height(),_.color=d.color.value(),_.linewidth=d.width.value(),_.linestyle=d.style.value(),this._data.push(_)}}}}}},c.StudyPaneView_vertlines=function(e,t){this.Z99=e,this.Z98=t,this._data=[]},c.StudyPaneView_vertlines.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_vertlines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new l(this._data[t],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_vertlines.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().vertlines;if(e){var t=this.Z99.priceScale(),i=this.Z99.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s];if(l.data){var d=this.Z99.properties().graphics.vertlines[l.styleId];if(d.visible.value())for(var h=0;h<l.data.length;h++){var p=l.data[h],c={};if(!(r[p.index]<o||r[p.index]>a)){var u,_,f=i.indexToCoordinate(r[p.index])+1,g=null;if(p.extendBottom)u=t.height();else{var v=p.startPrice;if(t.isPercent()){var g=g||this.Z99.firstValue();v=t.priceRange().convertToPercent(v,g)}u=t.priceToCoordinate(v)}if(p.extendTop)_=0;else{var m=p.endPrice;if(t.isPercent()){var g=g||this.Z99.firstValue();m=t.priceRange().convertToPercent(m,g)}_=t.priceToCoordinate(m)}var y=new MathEx.Point(f,u),w=new MathEx.Point(f,_);c.points=[y,w],c.extendleft=p.extendBottom,c.extendright=p.extendTop,c.width=i.width(),c.height=t.height(),c.color=d.color.value(),c.linewidth=d.width.value(),c.linestyle=d.style.value(),this._data.push(c)}}}}}},c.StudyPaneView_lines=function(e,t){this.Z99=e,this.Z98=t,this._data=[]},c.StudyPaneView_lines.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_lines.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new l(this._data[t],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_lines.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().lines;if(e){var t=this.Z99.priceScale(),i=this.Z99.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s];if(l.data){var d=this.Z99.properties().graphics.lines[l.styleId];if(d.visible.value())for(var h=0;h<l.data.length;h++){var p=l.data[h],c=r[p.startIndex]+(p.startOffset||0),u=r[p.endIndex]+(p.endOffset||0);if(!(!p.extendRight&&Math.max(c,u)<o||!p.extendLeft&&Math.min(c,u)>a)){var _={},f=i.indexToCoordinate(c),g=i.indexToCoordinate(u),v=p.startPrice,m=p.endPrice;if(t.isPercent()){var y=this.Z99.firstValue();v=t.priceRange().convertToPercent(v,y),m=t.priceRange().convertToPercent(m,y)}var w=t.priceToCoordinate(v),T=t.priceToCoordinate(m),b=new MathEx.Point(f,w),S=new MathEx.Point(g,T);_.points=[b,S],_.color=d.color.value(),_.linewidth=d.width.value(),_.linestyle=d.style.value(),this._data.push(_)}}}}}},c.StudyPaneView_hlines=function(e,t){this.Z99=e,this.Z98=t,this._data=[],this._textData=[],this._textRendererCache={}},c.StudyPaneView_hlines.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_hlines.prototype.renderer=function(){
this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new s(this._data[t]));for(var t=0;t<this._textData.length;t++)e.append(new a(this._textData[t],this._textRendererCache,new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_hlines.prototype._updateViewInternal=function(){this._calcHorzLinesData(),this._calcTextData()},c.StudyPaneView_hlines.prototype._calcTextData=function(){this._textData=[];var e=this.Z99.graphics().hlines;if(e){var t=this.Z99.priceScale(),i=this.Z99.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=0;r<e.length;r++){var n=e[r];if(n.data){var o=this.Z99.properties().graphics.hlines[n.styleId];if(o.enableText.value()&&o.showText.value())for(var a=0;a<n.data.length;a++){var s=n.data[a],l={};l.text=void 0===s.text?"":s.text,l.color=o.color.value(),l.font="arial",l.fontsize=o.fontSize.value();var d=s.level;if(t.isPercent()){var h=this.Z99.firstValue();d=t.priceRange().convertToPercent(d,h)}var p,c=t.priceToCoordinate(d),u=o.textPos.value();u==CanvasEx.TEXTPOS_TOPLEFT||u==CanvasEx.TEXTPOS_MIDDLELEFT||u==CanvasEx.TEXTPOS_BOTTOMLEFT?(p=4,l.horzAlign="left"):u==CanvasEx.TEXTPOS_TOPCENTER||u==CanvasEx.TEXTPOS_MIDDLECENTER||u==CanvasEx.TEXTPOS_BOTTOMCENTER?(p=i.width()/2,l.horzAlign="center"):u!=CanvasEx.TEXTPOS_TOPRIGHT&&u!=CanvasEx.TEXTPOS_MIDDLERIGHT&&u!=CanvasEx.TEXTPOS_BOTTOMRIGHT||(p=i.width(),l.horzAlign="right"),u==CanvasEx.TEXTPOS_TOPLEFT||u==CanvasEx.TEXTPOS_TOPCENTER||u==CanvasEx.TEXTPOS_TOPRIGHT?(l.vertAlign="bottom",c-=4):u==CanvasEx.TEXTPOS_MIDDLELEFT||u==CanvasEx.TEXTPOS_MIDDLECENTER||u==CanvasEx.TEXTPOS_MIDDLERIGHT?(l.vertAlign="middle",c-=2):u!=CanvasEx.TEXTPOS_BOTTOMLEFT&&u!=CanvasEx.TEXTPOS_BOTTOMCENTER&&u!=CanvasEx.TEXTPOS_BOTTOMRIGHT||(l.vertAlign="top");var _=new MathEx.Point(p,c);l.points=[_],l.offsetX=0,l.offsetY=0,this._textData.push(l)}}}}},c.StudyPaneView_hlines.prototype._calcHorzLinesData=function(){this._data=[];var e=this.Z99.graphics().hlines;if(e){var t=this.Z99.priceScale();if(t&&!t.isEmpty())for(var i=0;i<e.length;i++){var r=e[i];if(r.data){var n=this.Z99.properties().graphics.hlines[r.styleId];if(n.visible.value())for(var o=0;o<r.data.length;o++){var a=r.data[o],s={},l=0,d=a.level;if(t.isPercent()){var h=this.Z99.firstValue();d=t.priceRange().convertToPercent(d,h)}var p=t.priceToCoordinate(d);s.points=[new MathEx.Point(l,p)],s.color=n.color.value(),s.linewidth=n.width.value(),s.linestyle=n.style.value(),s.hitTestResult=TradingView.HitTestResult.REGULAR,this._data.push(s)}}}}},c.StudyPriceAxisView_hlines=function(e,t,i,r,n){this.Z99=e,this.Z98=t,this._line=i,this._styleId=r,this._data={},this._lineType=n,this._invalidated=!0},inherit(c.StudyPriceAxisView_hlines,d),c.StudyPriceAxisView_hlines.prototype.update=function(){this._invalidated=!0},c.StudyPriceAxisView_hlines.prototype.updateImpl=function(){this._data={},this._data.visible=!1;var e=this.Z99.priceScale();if(e&&!e.isEmpty()){var t=this.Z99.properties().visible.value();if(t){var i=this.Z99.properties().graphics[this._lineType][this._styleId];if(i.visible&&i.visible.value()&&i.showPrice&&i.showPrice.value()){this._data.visible=!0,this._data.color="white",this._data.background=i.color.value();var r=this._line.level;if(e.isPercent()){var n=this.Z99.firstValue();if(!isNumber(n))return;r=e.priceRange().convertToPercent(r,n)}this._data.coordinate=e.priceToCoordinate(r),this._data.text=e.formatter().format(r)}}}},c.StudyPriceAxisView_hlines.prototype.renderer=function(){return this._invalidated&&(this.updateImpl(),this._invalidated=!1),new h(this._data)},TradingView.TriangleTextMarkRenderer=function(e,t){this._data=e,this._textCache=t},TradingView.TriangleTextMarkRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font},TradingView.TriangleTextMarkRenderer.prototype.draw=function(e){if(this._data){var t="up"==this._data.direction?1:-1,i=this._data.point.x;"left"==this._data.halign?i-=this._data.size:"right"==this._data.halign&&(i+=this._data.size);var r=this._data.point.y;e.font=this.fontStyle();var n=e.measureText(this._data.text).width;this._textCache.textWidth=n;var o=this._data.fontSize,a=.65*o,s=1*o;switch(e.save(),e.translate(i+.5,r+.5),e.beginPath(),e.moveTo(0,0),this._data.direction){case"up":case"down":e.lineTo(a,s*t),e.lineTo(.5*n+a,s*t),e.lineTo(.5*n+a,(s+1.75*o)*t),e.lineTo(.5*-n-a,(s+1.75*o)*t),e.lineTo(.5*-n-a,s*t),e.lineTo(-a,s*t),e.lineTo(0,0),e.strokeStyle=this._data.borderColor,e.stroke(),e.fillStyle=this._data.color,e.fill(),e.fillStyle=this._data.fontColor,e.fillText(this._data.text,.5*-n,0>t?t*s-.5*o:s+1.25*o);break;default:throw this._data.direction+" doesn't supported by TradingView.TriangleTextMarkRenderer"}e.restore()}},TradingView.TriangleTextMarkRenderer.prototype.hitTest=function(e){var t=this._textCache.textWidth,i=this._data.fontSize;switch(this._data.direction){case"up":case"down":var r="up"==this._data.direction?1:-1,n=.65*i,o=1*i,a=this._data.point.x;"left"==this._data.halign?a-=this._data.size:"right"==this._data.halign&&(a+=this._data.size);var s=this._data.point.y,l=a-.5*t-n,d=a+.5*t+n,h=s+o*r,p=s+(o+1.75*i)*r;if(h>p){var s=h;h=p,p=s}if(MathEx.pointInRect(e,new MathEx.Point(l,h),new MathEx.Point(d,p)))return new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR);var c=[];c[0]={},c[0].x=this._data.point.x,c[0].y=this._data.point.y,c[1]={},c[1].x=this._data.point.x+.65*i,c[1].y=this._data.point.y+i*r,c[2]={},c[2].x=this._data.point.x-.65*i,c[2].y=this._data.point.y+i*r;var u=(e.x-c[0].x)*(c[1].y-c[0].y)-(e.y-c[0].y)*(c[1].x-c[0].x);if(((e.x-c[1].x)*(c[2].y-c[1].y)-(e.y-c[1].y)*(c[2].x-c[1].x))*u>0&&((e.x-c[2].x)*(c[0].y-c[2].y)-(e.y-c[2].y)*(c[0].x-c[2].x))*u>0)return new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR);break;default:throw this._data.direction+" doesn't supported by TradingView.TriangleTextMarkRenderer"}return null},TradingView.RectangleTextMarkRenderer=function(e,t){this._data=e,this._textCache=t},TradingView.RectangleTextMarkRenderer.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font},TradingView.RectangleTextMarkRenderer.prototype.draw=function(e){if(this._data){var t=this._data.point.x,i=this._data.point.y;e.font=this.fontStyle();var r=e.measureText(this._data.text).width;this._textCache.textWidth=r;this._data.fontSize;e.save(),e.translate(t+.5,i+.5),e.beginPath(),e.moveTo(0,0);var n=this._data.halign,o=this._data.valign;switch(e.textAlign=n,o){case"middle":e.textBaseline="middle";break;case"top":e.textBaseline="bottom";break;case"bottom":e.textBaseline="hanging"}e.fillStyle=this._data.fontColor,e.fillText(this._data.text,0,0),e.restore()}},TradingView.RectangleTextMarkRenderer.prototype.hitTest=function(e){var t=this._data.point.x+.5,i=this._data.point.y+.5,r=this._textCache.textWidth,n=this._data.fontSize,o=this._data.halign,a=this._data.valign;switch(a){case"middle":i-=n/2;break;case"bottom":i-=n}switch(o){case"right":t-=r;break;case"center":t-=r/2}var s=new MathEx.Point(t,i),l=new MathEx.Point(t+r,i+n);return MathEx.pointInRect(e,s,l)?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},TradingView.CircleShapeMarkRenderer=function(e,t){this._data=e,this._textCache=t},TradingView.CircleShapeMarkRenderer.prototype.draw=function(e){if(this._data){var t="down"==this._data.direction?1:"up"==this._data.direction?-1:0,i=this._data.point.x,r=this._data.point.y;e.save(),e.fillStyle=this._data.color,e.beginPath(),e.arc(i+1,r+2*this._data.size*t+.5,this._data.size,0,2*Math.PI),e.closePath(),e.fill(),e.stroke()}},TradingView.CircleShapeMarkRenderer.prototype.hitTest=function(e){var t="down"==this._data.direction?1:"up"==this._data.direction?-1:0;return Math.pow(this._data.point.x+.5-e.x,2)+Math.pow(this._data.point.y+.5+2*this._data.size*t-e.y,2)<=Math.pow(this._data.size,2)?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},TradingView.SquareShapeMarkRenderer=function(e,t){this._data=e,this._textCache=t},TradingView.SquareShapeMarkRenderer.prototype.draw=function(e){if(this._data){var t="down"==this._data.direction?1:"up"==this._data.direction?-1:0,i=parseInt(this._data.size),r=new MathEx.Point(this._data.point.x-i/2,this._data.point.y-i/2+t*i),n=new MathEx.Point(this._data.point.x+i/2,this._data.point.y+i/2+t*i),o=n.substract(r);e.canvas.width,e.canvas.height;e.beginPath(),e.fillStyle=this._data.color,e.rect(r.x,r.y,o.x,o.y),e.stroke(),e.fill()}},TradingView.SquareShapeMarkRenderer.prototype.hitTest=function(e){var t="down"==this._data.direction?1:"up"==this._data.direction?-1:0,i=parseInt(this._data.size),r=new MathEx.Point(this._data.point.x-i/2,this._data.point.y-i/2+t*i),n=new MathEx.Point(this._data.point.x+i/2,this._data.point.y+i/2+t*i),o=new MathEx.Point(Math.min(r.x,n.x),Math.min(r.y,n.y)),a=new MathEx.Point(Math.max(r.x,n.x),Math.max(r.y,n.y));return MathEx.pointInRect(e,o,a)?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},TradingView.ArrowShapeMarkRenderer=function(e,t,i){this._data=e,this._textCache=t,this._arrowDirection=i},TradingView.ArrowShapeMarkRenderer.prototype.draw=function(e){if(this._data){var t=this._arrowDirection,i=1*this._data.size,r=this._data.color,n=this._data.point.x+1,o=this._data.point.y,a=1.1*i;switch(t){case"up":o-=a;break;case"down":o+=a}var s=i/6,l=i/4,d=i/3,h=i/2,p=.6666666*i;switch(e.save(),e.fillStyle=r,e.beginPath(),t){case"up":e.moveTo(n,o),e.lineTo(n-h,o+p),e.lineTo(n-l,o+p),e.lineTo(n,o+d),e.lineTo(n+l,o+p),e.lineTo(n+h,o+p),e.lineTo(n,o);break;case"down":e.moveTo(n,o+i),e.lineTo(n-h,o+d),e.lineTo(n-l,o+d),e.lineTo(n,o+p),e.lineTo(n+l,o+d),e.lineTo(n+h,o+d),e.lineTo(n,o+i);break;case"right":e.moveTo(n+s,o),e.lineTo(n-s,o-l),e.lineTo(n-s,o+l),e.lineTo(n+s,o);break;case"left":e.moveTo(n-s,o),e.lineTo(n+s,o-l),e.lineTo(n+s,o+l),e.lineTo(n-s,o)}e.closePath(),e.fill(),e.stroke()}},TradingView.ArrowShapeMarkRenderer.prototype.hitTest=function(e){var t=this._data.point.x,i=this._data.point.y,r=this._arrowDirection,n=1*this._data.size,o=n/2,a=1.1*n;switch(r){case"up":i-=a;break;case"down":i+=a}var s=n/6,l=n/4,d=n/3,o=n/2,h=.6666666*n;switch(r){case"up":var p=new MathEx.Point(t,i),c=new MathEx.Point(t+o,i+h),u=new MathEx.Point(t-o,i+h);break;case"down":var p=new MathEx.Point(t,i+n),c=new MathEx.Point(t+o,i+d),u=new MathEx.Point(t-o,i+d);break;case"right":var p=new MathEx.Point(t+s,i),c=new MathEx.Point(t-s,i-l),u=new MathEx.Point(t-s,i+l);break;case"left":var p=new MathEx.Point(t-s,i),c=new MathEx.Point(t+s,i-l),u=new MathEx.Point(t+s,i+l)}return MathEx.pointInTriangle(p,c,u,e)?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},c.StudyPaneView_textmarks=function(e,t){this.Z99=e,this.Z98=t,this._data=[],this._textCache=[]},inherit(c.StudyPaneView_textmarks,u),c.StudyPaneView_textmarks.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_textmarks.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)switch(this._data[t].shape){case"triangle":e.append(new TradingView.TriangleTextMarkRenderer(this._data[t],this._textCache[t]));break;case"rectangle":e.append(new TradingView.RectangleTextMarkRenderer(this._data[t],this._textCache[t]))}return e},c.StudyPaneView_textmarks.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().textmarks;if(e){var t=this.Z99.priceScale(),i=this.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s];if(l.data){var d=this.Z99.properties().graphics.textmarks[l.styleId];if(d.visible.value())for(var h=l.data,p=0;p<h.length;p++){var c=h[p],u={},_=d.location.value(),f=d.shape.value(),g=r[c.time];if(!(o>g||g>a)){var v=this.Z99.series().bars().valueAt(g);if(v){g=r[c.time]+(c.offset||0),u.font=d.fontFamily.value(),u.color=TradingView.generateColor(d.color.value(),d.transparency.value()),u.bold=d.fontBold.value(),u.fontColor=TradingView.generateColor(d.fontColor.value(),d.transparency.value()),u.italic=d.fontItalic.value(),u.fontSize=d.fontSize.value(),u.text=c.text?c.text:"",u.halign=d.halign.value(),u.valign=void 0!==d.valign?d.valign.value():"middle",u.shape=d.shape.value(),u.size=.5*i.barSpacing(),u.borderColor="rgb(0, 0, 0)";var m,y,w,T=50;switch(f){case"triangle":w=this._calcCoordsForTriangleShape(_,g,T,c.price,t),u.direction=w.direction,m=Math.round(i.indexToCoordinate(g)),y=w.y;break;case"rectangle":w=this._calcCoordsForRectangleShape(_,g,c.price,t,i),m=w.x,y=w.y}u.point=new MathEx.Point(m,y),this._data.push(u),this._textCache.push({})}}}}}}},c.StudyPaneView_textmarks.prototype._calcCoordsForTriangleShape=function(e,t,i,r,n){var o,a;switch(e){case CanvasEx.MARKLOC_TOP:o=n.height()-i,a="down";break;case CanvasEx.MARKLOC_BOTTOM:o=i,a="up";break;case CanvasEx.MARKLOC_ABSOLUTEDOWN:if(n.isPercent()){var s=this.Z99.firstValue();r=n.priceRange().convertToPercent(r,s)}o=n.priceToCoordinate(r),a="down";break;case CanvasEx.MARKLOC_ABSOLUTEUP:if(n.isPercent()){var s=this.Z99.firstValue();r=n.priceRange().convertToPercent(r,s)}o=n.priceToCoordinate(r),a="up";break;case CanvasEx.MARKLOC_ABOVEBAR:o=this._locationToY(e,t),a="down";break;case CanvasEx.MARKLOC_BELOWBAR:o=this._locationToY(e,t),a="up";break;default:o=this._locationToY(e,t),a="up"}return{y:o,direction:a}},c.StudyPaneView_textmarks.prototype._calcCoordsForRectangleShape=function(e,t,i,r,n){var o,a=Math.round(n.indexToCoordinate(t));switch(e){case CanvasEx.MARKLOC_ABSOLUTEDOWN:case CanvasEx.MARKLOC_ABSOLUTEUP:case CanvasEx.MARKLOC_ABSOLUTE:if(r.isPercent()){var s=this.Z99.firstValue();i=r.priceRange().convertToPercent(i,s)}o=r.priceToCoordinate(i);break;case CanvasEx.MARKLOC_ABOVEBAR:o=this._locationToY(e,t);break;case CanvasEx.MARKLOC_BELOWBAR:o=this._locationToY(e,t);break;case CanvasEx.MARKLOC_RIGHT:if(a=n.width(),r.isPercent()){var s=this.Z99.firstValue();i=r.priceRange().convertToPercent(i,s)}o=r.priceToCoordinate(i);break;case CanvasEx.MARKLOC_LEFT:if(a=n.width(),r.isPercent()){var s=this.Z99.firstValue();i=r.priceRange().convertToPercent(i,s)}o=r.priceToCoordinate(i);break;default:o=this._locationToY(e,t)}return{x:a,y:o}},c.StudyPaneView_shapemarks=function(e,t){this.Z99=e,this.Z98=t,this._data=[],this._textCache=[]},inherit(c.StudyPaneView_shapemarks,u),c.StudyPaneView_shapemarks.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_shapemarks.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)switch(this._data[t].shape){case"circle":e.append(new TradingView.CircleShapeMarkRenderer(this._data[t],this._textCache[t]));break;case"square":e.append(new TradingView.SquareShapeMarkRenderer(this._data[t],this._textCache[t]));break;case"arrowUp":e.append(new TradingView.ArrowShapeMarkRenderer(this._data[t],this._textCache[t],"up"));break;case"arrowDown":e.append(new TradingView.ArrowShapeMarkRenderer(this._data[t],this._textCache[t],"down"));break;case"arrowRight":e.append(new TradingView.ArrowShapeMarkRenderer(this._data[t],this._textCache[t],"right"));break;case"arrowLeft":e.append(new TradingView.ArrowShapeMarkRenderer(this._data[t],this._textCache[t],"left"))}return e},c.StudyPaneView_shapemarks.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().shapemarks;if(e){var t=this.Z99.priceScale(),i=this.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s];if(l.data){var d=this.Z99.properties().graphics.shapemarks[l.styleId];if(d.visible.value())for(var h=l.data,p=0;p<h.length;p++){var c=h[p],u=r[c.time];if(!(o>u||u>a)){var _={};if(null!=c.time){var f=this.Z99.series().bars().valueAt(u);if(f){_.color=TradingView.generateColor(d.color.value(),d.transparency.value());var g=0;"left"==d.halign.value()?g-=i.barSpacing()/2+1:"right"==d.halign.value()&&(g+=i.barSpacing()/2+1),_.size=d.size.value(),_.shape=d.shape.value();var v=Math.round(i.indexToCoordinate(u))+g,m=c.price;if(t.isPercent()){var y=this.Z99.firstValue();m=t.priceRange().convertToPercent(m,y)}var w=t.priceToCoordinate(m),T=d.location.value();switch(T){case CanvasEx.MARKLOC_ABSOLUTE:_.direction="";break;case CanvasEx.MARKLOC_ABSOLUTEDOWN:_.direction="down";break;case CanvasEx.MARKLOC_ABSOLUTEUP:_.direction="up";break;case CanvasEx.MARKLOC_ABOVEBAR:w=this._locationToY(T,u,Math.floor(2*_.size/i.barSpacing())+1),_.direction="up";break;case CanvasEx.MARKLOC_BELOWBAR:w=this._locationToY(T,u,Math.floor(2*_.size/i.barSpacing())+1),_.direction="down";break;default:TradingView.logWarn("Bad location value: "+T),w=this._locationToY(CanvasEx.MARKLOC_ABSOLUTEUP,u),_.direction="up"}_.point=new MathEx.Point(v,w),this._data.push(_),this._textCache.push({})}}}}}}}},r.prototype.draw=function(e){},r.prototype.drawBackground=function(e){var t=this._data;TradingView.clearRect(e,t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,TradingView.generateColor(this._data.color,this._data.transparency))},r.prototype.hitTest=function(e){return null},c.StudyPaneView_backgrounds=function(e,t){this.Z99=e,this.Z98=t,this._data=[]},c.StudyPaneView_backgrounds.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_backgrounds.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new r(this._data[t]));return e},c.StudyPaneView_backgrounds.prototype._hideExtendedHours=function(e){return"inSession"===e||"outOfSession"===e?!this.Z99._series.properties().extendedHours.value():!1},c.StudyPaneView_backgrounds.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().backgrounds;if(e){var t=this.Z98.timeScale(),i=this.Z99.priceScale();if(i&&!i.isEmpty()&&t&&!t.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s],d=l.styleId,h=l.data,p=this.Z99.properties().graphics.backgrounds[d];if(!this._hideExtendedHours(d)&&p.visible.value())for(var c,u,_=0;_<h.length;_++){var f=h[_],g={},v=r[f.start],m=r[f.stop];if(!(o>m||v>a)&&null!=f.start&&null!=f.stop){var y=Math.ceil(t.indexToCoordinate(v,!0)-.5*t.barSpacing()),w=Math.ceil(t.indexToCoordinate(m,!0)+.5*t.barSpacing());u==v-1&&(y=c),c=w,u=m,0>y&&0>w||y>t.width()&&w>t.width()||(g.x1=y,g.x2=w,g.y1=0,g.y2=i.height(),g.color=p.color.value(),g.transparency=p.transparency.value(),this._data.push(g))}}}}},c.StudyPaneView_polygons=function(e,t){this.Z99=e,this.Z98=t,this._data=[]},c.StudyPaneView_polygons.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_polygons.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new p(this._data[t],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_polygons.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().polygons;if(e){var t=this.Z99.priceScale(),i=this.Z99.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<e.length;s++){var l=e[s];if(l.data){var d=this.Z99.properties().graphics.polygons[l.styleId];if(100!=d.transparency.value())for(var h=0;h<l.data.length;h++){for(var p=l.data[h],c=1/0,u=-(1/0),_=0;p.points&&_<p.points.length;_++){var f=r[p.points[_].index]+(p.points[_].offset||0);c=Math.min(c,f),u=Math.max(u,f)}if(!(o>u||c>a)){var g={};g.points=[];for(var _=0;p.points&&_<p.points.length;_++){var v=p.points[_],m=i.indexToCoordinate(r[v.index]+(v.offset||0)),y=v.level;if(t.isPercent()){var w=this.Z99.firstValue();y=t.priceRange().convertToPercent(y,w)}var T=t.priceToCoordinate(y),b=new MathEx.Point(m,T);b.data=_,g.points.push(b)}g.color=d.color.value(),g.backcolor=d.color.value(),g.linewidth=void 0!==d.showBorder&&d.showBorder.value()?1:0,g.linestyle=CanvasEx.LINESTYLE_SOLID,g.filled=!0,g.fillBackground=!0,g.transparency=d.transparency.value(),g.mouseTouchable=d.mouseTouchable.value(),this._data.push(g)}}}}}},c.StudyPaneView_trendchannels=function(e,t){this.Z99=e,this.Z98=t,this._data=[]},c.StudyPaneView_trendchannels.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_trendchannels.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=0;t<this._data.length;t++)e.append(new p(this._data[t],new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_trendchannels.prototype._convertToYCoord=function(e){var t=this.Z99.priceScale(),i=this.Z99.firstValue();return t.isPercent()&&(e=t.priceRange().convertToPercent(e,i)),t.priceToCoordinate(e)},c.StudyPaneView_trendchannels.prototype._updateViewInternal=function(){this._data=[];var e=this.Z99.graphics().trendchannels;if(e){var t=this.Z99.priceScale(),i=this.Z99.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var r=function(e,t,i,r,n,o){var a=new MathEx.Point(0,0),s=new MathEx.Point(i,r);if(n){var l=e.substract(t),d=MathEx.intersectRayWithRect(e,e.add(l),a,s);d?e=d:t.x=i}if(o){var l=t.substract(e),d=MathEx.intersectRayWithRect(t,t.add(l),a,s);d?t=d:t.x=i}return[e,t]},n=this.Z99.graphics().indexes,o=this.Z98.timeScale().visibleBars(),a=o.firstBar(),s=o.lastBar(),l=0;l<e.length;l++){var d=e[l];if(d.data)for(var h=this.Z99.properties().graphics.trendchannels[d.styleId],p=0;p<d.data.length;p++){var c=d.data[p],u=n[c.startIndex],_=n[c.endIndex];if(!(Math.max(u,_)<a&&!c.extendRight||Math.min(u,_)>s&&!c.extendLeft)){var f=this._convertToYCoord(c.startHighPrice),g=this._convertToYCoord(c.startLowPrice),v=this._convertToYCoord(c.endHighPrice),m=f-g,y=v-m,w=i.indexToCoordinate(u),T=i.indexToCoordinate(_),b=new MathEx.Point(w,f),S=new MathEx.Point(w,g),C=new MathEx.Point(T,v),x=new MathEx.Point(T,y),P=r(b,C,i.width(),t.height(),c.extendLeft,c.extendRight),L=r(S,x,i.width(),t.height(),c.extendLeft,c.extendRight);b=P[0],C=P[1],S=L[0],x=L[1];var E={};if(E.points=[b,S,x,C],E.color=h.color.value(),E.backcolor=h.color.value(),E.linewidth=void 0!==h.borderWidth?h.borderWidth.value():0,E.linestyle=CanvasEx.LINESTYLE_SOLID,E.filled=!0,E.fillBackground=!0,c.transparency){var V=c.transparency+h.transparency.value();E.transparency=Math.min(V,100)}else E.transparency=h.transparency.value();E.mouseTouchable=!0,this._data.push(E)}}}}},c.StudyPaneView_hhists=function(e,t){this.Z99=e,this.Z98=t,this._data=[],this._textData=[],this._textRendererCache={}},c.StudyPaneView_hhists.prototype.update=function(){this._invalidated=!0},c.StudyPaneView_hhists.prototype.renderer=function(){this._invalidated&&(this._updateViewInternal(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;for(var t in this._data)e.append(new n(this._data[t]));for(var t=0;t<this._textData.length;t++)e.append(new a(this._textData[t],this._textRendererCache,new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)));return e},c.StudyPaneView_hhists.prototype._updateViewInternal=function(){this._data=[],this._textData=[];var e=this.Z99.priceScale(),t=this.Z98.timeScale();if(e&&!e.isEmpty()&&t&&!t.isEmpty()){var i=this.Z99.graphics().hhists;if(i)for(var r=this.Z99.graphics().indexes,n=this.Z98.timeScale().visibleBars(),o=n.firstBar(),a=n.lastBar(),s=0;s<i.length;s++){var l=i[s],d=this.Z99.properties().graphics.hhists[l.styleId];if(d.visible.value()){var h=l.dataObj;for(var p in h){for(var c=h[p],u=1/0,_=-(1/0),f=c.length;f--;)u=Math.min(u,r[c[f].firstBarTime]),_=Math.max(_,r[c[f].lastBarTime]);o>_||u>a||this._updateDataForRenderers(c,d,e,t,r)}}}}},c.StudyPaneView_hhists.prototype._updateDataForRenderers=function(e,t,r,n,o){for(var a,s,l,d,h,p=[],c=this._findMaxRate(e),u=null,_=null,f=null,g={},v=i(74).shiftColor,m=function(e,t,i){if(i==CanvasEx.HHISTDIR_LEFTTORIGHT)return e+t;if(i==CanvasEx.HHISTDIR_RIGHTTOLEFT)return t+e;throw Error("Unknown direction value: "+i)},y=0;y<e.length;y++){var w=e[y];if(null===_&&(_=this._findActualRateLength(w.rate)),null===u){var T=Math.abs(n.indexToCoordinate(o[w.firstBarTime])-n.indexToCoordinate(o[w.lastBarTime]));u=t.percentWidth.value()*T/100,u-=_,u=Math.max(u,0)}for(var b,S,C=!1,x=0;_>x;x++)if(0!==w.rate[x]){if(void 0===g[x]?g[x]=w.rate[x]:g[x]+=w.rate[x],r.isPercent())var P=this.Z99.firstValue(),a=r.priceRange().convertToPercent(w.priceHigh,P),s=r.priceRange().convertToPercent(w.priceLow,P);else var a=w.priceHigh,s=w.priceLow;var L={};L.y1=r.priceToCoordinate(a)+1,L.y2=r.priceToCoordinate(s)-1,0===y&&(b=L.y2,S=L.y2-L.y1);var E=t.location.value(),V=t.direction.value();if(E==CanvasEx.HHISTLOC_ABSOLUTE&&V==CanvasEx.HHISTDIR_LEFTTORIGHT)d=n.indexToCoordinate(o[w.firstBarTime]),l=1,h="left";else if(E==CanvasEx.HHISTLOC_ABSOLUTE&&V==CanvasEx.HHISTDIR_RIGHTTOLEFT)d=n.indexToCoordinate(o[w.lastBarTime]),l=-1,h="right";else if(E==CanvasEx.HHISTLOC_RELATIVE&&V==CanvasEx.HHISTDIR_LEFTTORIGHT)d=0,l=1,h="left";else{if(E!=CanvasEx.HHISTLOC_RELATIVE||V!=CanvasEx.HHISTDIR_RIGHTTOLEFT)throw Error("Unknown location/direction values: "+E+"/"+V);d=n.width(),l=-1,h="right"}if(0===x?L.x1=d:L.x1=d+l*(u*w.rate[x-1]/c+_),L.x2=L.x1+l*(u*w.rate[x]/c),L.colorBg=t.colors[x].value(),L.transparency=t.transparencies[x].value(),L.blendedColor=TradingView.generateColor(L.colorBg,L.transparency),L.x0=d,p.push(L),f||(f=.6*(L.y2-L.y1)),!C&&t.showValues.value()&&f>=7.5){C=!0;var I={},A=this.Z99.formatter();I.text="";for(var k=0;_>k;k++)I.text=m(I.text,A.format(w.rate[k]),V),k!=_-1&&(I.text=m(I.text,"x",V));I.color=t.valuesColor.value(),I.font="arial",I.fontsize=f,I.horzAlign=h,I.vertAlign="middle";var R=new MathEx.Point(d+3*l,L.y2-.61*(L.y2-L.y1));if(I.points=[R],I.offsetX=0,I.offsetY=0,this._textData.push(I),y===e.length-1){for(var M=d+3*l,O=b+.39*S,D={text:"",color:v(t.valuesColor.value(),1.5),font:"arial",fontsize:f,horzAlign:h,vertAlign:"middle",points:[new MathEx.Point(M,O)],offsetX:0,offsetY:0},k=0;_>k;k++)D.text=m(D.text,A.format(g[k]),V),k!=_-1&&(D.text=m(D.text,"x",V));this._textData.push(D)}}}}p.length>0&&this._data.push(p)},c.StudyPaneView_hhists.prototype._findMaxRate=function(e){for(var t=0,i=0,r=0;r<e.length;r++){i=0;for(var n=0;n<e[r].rate.length;n++)i+=e[r].rate[n];t=Math.max(t,i)}return t},c.StudyPaneView_hhists.prototype._findActualRateLength=function(e){for(var t=0,i=0;i<e.length;++i){var r=e[i];if(null===r||void 0===r)break;t++}return t},n.prototype.hitTest=function(e){var t=o(this._data,e.y);if(0>t)return null;var i=Math.min(this._data[t].x0,this._data[t].x2),r=Math.max(this._data[t].x0,this._data[t].x2);return i<=e.x&&e.x<=r?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},n.prototype.draw=function(e){e.save();for(var t,i={},r=[],n=0;n<this._data.length;n++){var o=this._data[n];i[o.blendedColor]?i[o.blendedColor].push(o):(r.push(o.blendedColor),i[o.blendedColor]=[o])}for(var a=0;a<r.length;a++){var s=r[a];e.fillStyle=s,e.strokeStyle=s,e.beginPath(),t=i[s];for(var n=0;n<t.length;n++){var o=t[n];e.rect(o.x1,o.y1,o.x2-o.x1,o.y2-o.y1)}e.stroke(),e.fill()}e.restore()},e.exports=c},function(e,t,i){"use strict";function r(e,t,i){this._data=e,this._hittest=t?t:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittest=i?i:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND),this._points=e.points}var n=i(13).LineDataSource,o=i(55).TrendLineRenderer;r.prototype.draw=function(e){if(0!==this._points.length){e.beginPath(),e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t=this._points[0];e.moveTo(t.x,t.y);for(var i=0;i<this._points.length;i++){var r=this._points[i];e.lineTo(r.x,r.y)}this._data.filled&&this._data.fillBackground&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.fill()),this._data.filled&&!this._data.skipClosePath&&e.closePath(),this._data.linewidth>0&&e.stroke(),this._points.length>1&&(this._data.leftend==n.LINEEND_ARROW&&o.prototype.drawArrow(this._points[1],this._points[0],e,e.lineWidth),this._data.rightend==n.LINEEND_ARROW&&o.prototype.drawArrow(this._points[this._points.length-2],this._points[this._points.length-1],e,e.lineWidth))}},r.prototype.hitTest=function(e){if(void 0!==this._data.mouseTouchable&&!this._data.mouseTouchable)return null;for(var t=TradingView.isMobile.any()?24:3,i=1;i<this._points.length;i++){var r=this._points[i-1],n=this._points[i],o=MathEx.distanceToSegment(r,n,e);if(o.distance<=t)return this._hittest}if(this._data.filled&&this._data.fillBackground&&this._points.length>0){var r=this._points[0],n=this._points[this._points.length-1],o=MathEx.distanceToSegment(r,n,e);if(o.distance<=t)return this._hittest}return this._data.filled&&this._data.fillBackground&&MathEx.isInPolygon(this._data.points,e)?this._backHittest:null},e.exports=r},function(e,t){"use strict";function i(){}i.prototype._locationToY=function(e,t,i){i||(i=0);var r,n=[],o=this.Z99.priceScale();switch(e){case CanvasEx.MARKLOC_ABOVEBAR:r=TradingView.HIGH_PLOT;break;case CanvasEx.MARKLOC_BELOWBAR:r=TradingView.LOW_PLOT}var a=this.Z99.firstValue();i>=1&&(i-=1);for(var s=-i;i>=s;s++){var l=this.Z99.series().bars().valueAt(t+s);if(l){var d=l[r];o.isPercent()&&(d=o.priceRange().convertToPercent(d,a)),n.push(o.priceToCoordinate(d))}}switch(e){case CanvasEx.MARKLOC_ABOVEBAR:return MathEx.min(n)-15;case CanvasEx.MARKLOC_BELOWBAR:return MathEx.max(n)+15}},e.exports=i},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e),this._origState=t,this._title=i;var r={visible:!0};this.Q0=new Property(r),this._statusView=new n(this,e.properties()),this._status=$.t("compiling..."),this._statusView.setText(this._title+" "+this._status),this._formatter=new TradingView.PriceFormatter(Math.pow(10,2)),this._failed=!1}var n=i(62),o=i(18).PriceDataSource;inherit(r,o),r.prototype.properties=function(){return this.Q0},r.prototype.statusView=function(){return this._statusView},r.prototype.state=function(e){return this._origState},r.prototype.setStatus=function(e){this._status=e,this._statusView.setText(this._title+" "+this._status)},r.prototype.formatter=function(){return this._formatter},r.prototype.title=function(){return this._title},r.prototype.setFailed=function(e){this._failed=e},e.exports=r},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._invalidated=!0}function n(e,t){this._constructor="LineToolBarsPattern";var i=t?t:new J50("linetoolbarspattern");a.call(this,e,new r(this,e),i),i.mirrored.listeners().subscribe(this,n.prototype.mirror),i.flipped.listeners().subscribe(this,n.prototype.flip),i.addExclusion("mirrored"),i.addExclusion("flipped"),this._scaleCoeff=1,this.version=n.version,this._pattern=[],this.Q0.mode.listeners().subscribe(this,n.prototype.onModeChanged)}var o=i(44),a=i(13).LineDataSource,s=i(86).VertLineRenderer,l=i(12).RectangleRenderer,d=i(55).TrendLineRenderer;inherit(r,o),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._pattern&&2==this.Z97.points().length){var e=this.Z97.points()[0].index,t=this.Z97.points()[1].index,i=t>e?this._points[0]:this._points[1];if(!i)return new TradingView.CompositeRenderer;var r=Math.abs((this._points[0].x-this._points[1].x)/(this._pattern.length-1));
if(this.Z97.properties().mode.value()==n.BARS_MODE||this.Z97.properties().mode.value()==n.OPENCLOSE_MODE){for(var o=new TradingView.CompositeRenderer,h=this.Z97.properties().mode.value()==n.BARS_MODE?["high","low"]:["open","close"],p=h[0],c=h[1],u=0;u<this._pattern.length;u++){var _=Math.round(i.x+u*r+.5),f=i.y+Math.round(this._pattern[u][p]),g=i.y+Math.round(this._pattern[u][c]),v={};v.points=[new MathEx.Point(_-1,f),new MathEx.Point(_+1,g)],v.color=this.Z97.properties().color.value(),v.linewidth=1,v.backcolor=this.Z97.properties().color.value(),v.fillBackground=!0,v.transparency=10,o.append(new l(v))}return this.isAnchorsRequired()&&o.append(this.createLineAnchor({points:this._points})),o}var o=new TradingView.CompositeRenderer,v={};return v.barSpacing=r,v.items=this._pattern,v.histogramBase=0,v.lineIndex=0,v.lineColor=TradingView.generateColor(this.Z97.properties().color.value(),10),v.lineStyle=CanvasEx.LINESTYLE_SOLID,v.lineWidth=2,v.hittest=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),o.append(new Z66(v)),this.isAnchorsRequired()&&o.append(this.createLineAnchor({points:this._points})),o}var o=new TradingView.CompositeRenderer;if(this._points.length<2)return o;var m=this._points[0],y=this._points[1],w=(Math.min(m.x,y.x),Math.max(m.x,y.x),{});w.points=[m],w.color="#808080",w.linewidth=1,w.linestyle=CanvasEx.LINESTYLE_SOLID,o.append(new s(w));var T={};T.points=[y],T.color="#808080",T.linewidth=1,T.linestyle=CanvasEx.LINESTYLE_SOLID,o.append(new s(T));var b={points:[m,y],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};return o.append(new d(b)),o},r.prototype.update=function(){o.prototype.update.call(this),this._invalidated=!0},r.prototype.updateImpl=function(){if(!(!this.Z97.priceScale()||this.Z97.priceScale().isEmpty()||this._points.length<2))if(this.Z97._pattern&&this.Z97._pattern.length>0&&2==this.Z97.points().length){var e,t=this.Z97.priceScale(),i=(this.Z97._pattern,this.Z97.firstPatternPrice()),r=(this.Z97.lastPatternPrice(),this.Z97.points()[0].price,this.Z97.points()[1].price,this.Z97.pressCoeff()),t=this.Z97.priceScale(),n=this.Z97.ownerSource().firstValue(),o=t.priceRange();if(t.isPercent()){var a=o.convertToPercent(i,n);e=t.priceToCoordinate(a)}else e=t.priceToCoordinate(i);var s=function(a){var s=(a-i)*r+i;t.isPercent()&&(s=o.convertToPercent(s,n));var l=t.priceToCoordinate(s)-e;return l},l=parseInt(this.Z97.properties().mode.value()),d=this.Z97.points()[0].index,h=this.Z97.points()[1].index,p=d>h?1:0,c=this._points[p],u=c.x,_=Math.abs((this._points[0].x-this._points[1].x)/(this.Z97._pattern.length-1)),f={0:function(e){return{high:s(e[TradingView.HIGH_PLOT]),low:s(e[TradingView.LOW_PLOT])}},1:function(e,t){return new MathEx.Point(u+t*_,s(e[TradingView.CLOSE_PLOT])+c.y)},2:function(e){return{open:s(e[TradingView.OPEN_PLOT]),close:s(e[TradingView.CLOSE_PLOT])}},3:function(e,t){return new MathEx.Point(u+t*_,s(e[TradingView.OPEN_PLOT])+c.y)},4:function(e,t){return new MathEx.Point(u+t*_,s(e[TradingView.HIGH_PLOT])+c.y)},5:function(e,t){return new MathEx.Point(u+t*_,s(e[TradingView.LOW_PLOT])+c.y)},6:function(e,t){return new MathEx.Point(u+t*_,s((e[TradingView.HIGH_PLOT]+e[TradingView.LOW_PLOT])/2)+c.y)}};this._pattern=this.Z97._pattern.map(f[l])}else delete this._pattern},inherit(n,a),n.version=2,n.BARS_MODE=0,n.LINE_MODE=1,n.OPENCLOSE_MODE=2,n.LINEOPEN_MODE=3,n.LINEHIGH_MODE=4,n.LINELOW_MODE=5,n.LINEHL2_MODE=6,n.prototype.onModeChanged=function(){var e=this.patternPriceDiff();e*=this._pressCoeff,this._points[1].price=this._timePoint[1].price=this._points[0].price+e},n.prototype.additionalActions=function(e){var t=new TradingView.Action({checked:this.properties().mirrored.value(),checkable:!0,text:$.t("Mirrored"),callbackContext:{target:this}}),i=new TradingView.Action({checked:this.properties().flipped.value(),checkable:!0,text:$.t("Flipped"),callbackContext:{target:this}});t.callbacks().subscribe(null,function(t){var i=t.callbackContext(),r=i.target;e.setProperty(r.properties().mirrored,!r.properties().mirrored.value(),"Bats Pattern Mirroring"),r.updateAllViews(),r.Z98.updateSource(r)}),i.callbacks().subscribe(null,function(t){var i=t.callbackContext(),r=i.target;e.setProperty(r.properties().flipped,!r.properties().flipped.value(),"Bats Pattern Flipping"),r.updateAllViews(),r.Z98.updateSource(r)});var r=new TradingView.Action({checkable:!0,text:$.t("Restore Size")}),n=this;return r.callbacks().subscribe(null,function(t){var i=n.points()[0],r=n.patternPriceDiff(),o=i.price+r,a=i.index+n._pattern.length-1;e.startChangingLinetool(n,{price:o,index:a},1,{}),e.changeLinePoint({price:o,index:a},{}),e.endChangingLinetool()}),[t,i,r]},n.prototype.pointsCount=function(){return 2},n.prototype.state=function(e){var t=a.prototype.state.call(this,e);return t.pattern=this._pattern,t},n.prototype.restoreData=function(e){e.pattern&&(this._pattern=e.pattern)},n.prototype.title=function(){return"Bars Pattern"},n.prototype.cloneData=function(e){this._pattern=TradingView.clone(e._pattern)},n.prototype.mirror=function(){for(var e=this._pattern,t=e[0][TradingView.HIGH_PLOT],i=(e[e.length-1][TradingView.LOW_PLOT],Math.min(e[0][TradingView.LOW_PLOT],e[0][TradingView.HIGH_PLOT])),r=Math.max(e[0][TradingView.LOW_PLOT],e[0][TradingView.HIGH_PLOT]),n=1;n<e.length;n++)i=Math.min(i,e[n][TradingView.LOW_PLOT]),r=Math.max(r,e[n][TradingView.HIGH_PLOT]);if(r>i)for(var o=(i+r)/2,a=function(e){var t=e-o,i=o-t;return i},n=0;n<e.length;n++)e[n][TradingView.HIGH_PLOT]=a(e[n][TradingView.HIGH_PLOT]),e[n][TradingView.LOW_PLOT]=a(e[n][TradingView.LOW_PLOT]),e[n][TradingView.OPEN_PLOT]=a(e[n][TradingView.OPEN_PLOT]),e[n][TradingView.CLOSE_PLOT]=a(e[n][TradingView.CLOSE_PLOT]);var s=e[0][TradingView.HIGH_PLOT]-t,l=e[e.length-1][TradingView.LOW_PLOT]-e[0][TradingView.HIGH_PLOT];this._points[0].price+=s,this._points[1].price=this._points[0].price+l,this.updateAllViews()},n.prototype.flip=function(){this._points[0].price=this._points[1].price;for(var e=0;e<this._pattern.length/2;e++){var t=this._pattern[e];this._pattern[e]=this._pattern[this._pattern.length-e-1],this._pattern[this._pattern.length-e-1]=t}var i=this._pattern[this._pattern.length-1][TradingView.LOW_PLOT]-this._pattern[0][TradingView.HIGH_PLOT];this._points[1].price=this._points[0].price+i,this.updateAllViews()},n.prototype.firstPatternPrice=function(){var e=parseInt(this.properties().mode.value(),10);if(e==n.LINEHL2_MODE){var t=(this._pattern[0][TradingView.HIGH_PLOT]+this._pattern[0][TradingView.LOW_PLOT])/2;return t}var i={0:TradingView.HIGH_PLOT,1:TradingView.CLOSE_PLOT,2:TradingView.OPEN_PLOT,3:TradingView.OPEN_PLOT,4:TradingView.HIGH_PLOT,5:TradingView.LOW_PLOT},r=i[e],t=this._pattern[0][r];return t},n.prototype.lastPatternPrice=function(){var e=parseInt(this.properties().mode.value(),10);if(e==n.LINEHL2_MODE){var t=(this._pattern[this._pattern.length-1][TradingView.HIGH_PLOT]+this._pattern[this._pattern.length-1][TradingView.LOW_PLOT])/2;return t}var i={0:TradingView.LOW_PLOT,1:TradingView.CLOSE_PLOT,2:TradingView.CLOSE_PLOT,3:TradingView.OPEN_PLOT,4:TradingView.HIGH_PLOT,5:TradingView.LOW_PLOT},r=i[e],t=this._pattern[this._pattern.length-1][r];return t},n.prototype.patternPriceDiff=function(){return this.lastPatternPrice()-this.firstPatternPrice()},n.prototype.pressCoeff=function(){var e=this.patternPriceDiff(),t=this.points()[0].price,i=this.points()[1].price,r=i-t,n=r/e;return this._pressCoeff=n,n},n.prototype.addPoint=function(e,t){var i=this.Z98.mainSeries(),r=i.nearestIndex(e.index,TradingView.SEARCH_NEAREST_RIGHT);this.properties().mode.value()==n.BARS_MODE?e.price=i.bars().valueAt(r)[TradingView.HIGH_PLOT]:e.price=i.bars().valueAt(r)[TradingView.CLOSE_PLOT];var o=this.priceScale().priceRange().length();e.price+=.05*o;var s=i.priceScale();if(s.isPercent()){var l=i.firstValue();e.price=s.priceRange().convertToPercent(e.price,l)}var d=a.prototype.addPoint.call(this,e,t,!0);if(d){var h=Math.min(this.points()[0].index,this.points()[1].index),p=Math.max(this.points()[0].index,this.points()[1].index),r=this.Z98.mainSeries().nearestIndex(h,TradingView.SEARCH_NEAREST_RIGHT),c=this.Z98.mainSeries().nearestIndex(p,TradingView.SEARCH_NEAREST_LEFT);this.points()[0].index>this.points()[1].index&&(this._points[0].price=this._points[1].price),this._pattern=[];for(var u=r;c>=u;u++){var _=this.Z98.mainSeries().data().valueAt(u);this._pattern.push(TradingView.clone(_))}if(this._pattern.length>0){var f=this.patternPriceDiff();this._points[1].price=this._points[0].price+f,this._points[1].index=this._points[0].index+(c-r),this.normalizePoints(),this.createServerPoints()}}return d},n.prototype.setPoint=function(e,t,i){var r=this._points[0].price-this._points[1].price;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),a.prototype.setPoint.call(this,e,t,i),1==e?this._points[0].price=this._points[1].price+r:this._points[1].price=this._points[0].price-r},n.prototype.migrateVersion=function(e,t,i){if(1==e&&this._pattern.length>0){var r=this.patternPriceDiff();2==this._timePoint.length&&(this._timePoint[1].price=this._timePoint[0].price+r),2==this._points.length&&(this._points[1].price=this._points[0].price+r)}},e.exports=n},function(e,t,i){"use strict";function r(e,t){this._data=e,e.lines=this.wordWrap(e.text,e.wordWrapWidth),this._textSizeCache=t}function n(e,t){a.call(this,e,t),this._textSizeCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolCallout";var i=t?t:new J50("linetoolcallout");s.call(this,e,new n(this,e),i),this._barOffset=0,this._timeScale=e.timeScale()}var a=i(44),s=i(13).LineDataSource,l=i(18).DataSource;r.ROUND_RADIUS=8,r.TEXT_MARGINS=2,function(){function e(){var e=document.createElement("canvas");e.width=0,e.height=0,t=e.getContext("2d"),e=null}var t;r.prototype.wordWrap=function(i,r){t||e(),r=+r,i+="";var n=i.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);if(n[n.length-1]||n.pop(),!isFinite(r)||0>=r)return n;t.font=this.fontStyle();for(var o=[],a=0;a<n.length;a++){var s=n[a],l=t.measureText(s).width;if(r>=l)o.push(s);else for(var d=s.split(/([-\)\]\},.!?:;])|(\s+)/);d.length;){var h=~~(r/l*(d.length+2)/3);if(0>=h||t.measureText(d.slice(0,3*h-1).join("")).width<=r)for(;t.measureText(d.slice(0,3*(h+1)-1).join("")).width<=r;)h++;else for(;h>0&&t.measureText(d.slice(0,3*--h-1).join("")).width>r;);if(h>0)o.push(d.slice(0,3*h-1).join("")),d.splice(0,3*h);else{var p=d[0]+(d[1]||""),c=1===c?1:~~(r/t.measureText(p)*p.length);if(t.measureText(p.substr(0,c)).width<=r)for(;t.measureText(p.substr(0,c+1)).width<=r;)c++;else for(;c>1&&t.measureText(p.substr(0,--c)).width>r;);1>c&&(c=1),o.push(p.substr(0,c)),d[0]=p.substr(c),d[1]=""}var l=t.measureText(d.join("")).width;if(r>=l){o.push(d.join(""));break}}}return o}}(),r.prototype.hitTest=function(e){if(this._data.points.length<2)return null;var t=this._data.points[0],i=this._data.points[1],r=3;if(t.substract(e).length()<r)return new TradingView.HitTestResult(TradingView.HitTestResult.CHANGEPOINT,0);var n=i.x-this._textSizeCache.totalWidth/2,o=i.y-this._textSizeCache.totalHeight/2;return e.x>=n&&e.x<=n+this._textSizeCache.totalWidth&&e.y>=o&&e.y<=o+this._textSizeCache.totalHeight?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},r.prototype.fontStyle=function(){return(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font},r.prototype.draw=function(e){if(!(this._data.points.length<2)){var t=this._data.points[0].clone(),i=this._data.points[1].clone();e.lineCap="butt",e.strokeStyle=this._data.bordercolor,e.lineWidth=this._data.linewidth,e.textBaseline="bottom",e.font=this.fontStyle();var n=this._data.fontSize*this._data.lines.length,o=this._data.wordWrapWidth||this._data.lines.reduce(function(t,i){return Math.max(t,e.measureText(i).width)},0);this._textSizeCache.textHeight=n,this._textSizeCache.textHeight=o;var a=r.ROUND_RADIUS,s=r.TEXT_MARGINS,l=o+2*s+2*a,d=n+2*s+2*a;this._textSizeCache.totalWidth=l,this._textSizeCache.totalHeight=d;var h=i.x-l/2,p=i.y-d/2,c=0,u=o+2*s>2*a,_=n+2*s>2*a;t.x>h+l?c=20:t.x>h&&(c=10),t.y>p+d?c+=2:t.y>p&&(c+=1),e.save(),e.translate(h,p),t.x-=h,t.y-=p,i.x-=h,i.y-=p,e.beginPath(),e.moveTo(a,0),10==c?u?(e.lineTo(i.x-a,0),e.lineTo(t.x,t.y),e.lineTo(i.x+a,0),e.lineTo(l-a,0)):(e.lineTo(t.x,t.y),e.lineTo(l-a,0)):e.lineTo(l-a,0),20==c?(e.lineTo(t.x,t.y),e.lineTo(l,a)):e.arcTo(l,0,l,a,a),21==c?_?(e.lineTo(l,i.y-a),e.lineTo(t.x,t.y),e.lineTo(l,i.y+a),e.lineTo(l,d-a)):(e.lineTo(t.x,t.y),e.lineTo(l,d-a)):e.lineTo(l,d-a),22==c?(e.lineTo(t.x,t.y),e.lineTo(l-a,d)):e.arcTo(l,d,l-a,d,a),12==c?u?(e.lineTo(i.x+a,d),e.lineTo(t.x,t.y),e.lineTo(i.x-a,d),e.lineTo(a,d)):(e.lineTo(t.x,t.y),e.lineTo(a,d)):e.lineTo(a,d),2==c?(e.lineTo(t.x,t.y),e.lineTo(0,d-a)):e.arcTo(0,d,0,d-a,a),1==c?_?(e.lineTo(0,i.y+a),e.lineTo(t.x,t.y),e.lineTo(0,i.y-a),e.lineTo(0,a)):(e.lineTo(t.x,t.y),e.lineTo(0,a)):e.lineTo(0,a),0===c?(e.lineTo(t.x,t.y),e.lineTo(a,0)):e.arcTo(0,0,a,0,a),e.stroke(),e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.fill(),e.fillStyle=this._data.color,p=a+s+this._data.fontSize,h=a+s;for(var f=0;f<this._data.lines.length;f++)e.fillText(this._data.lines[f],h,p),p+=this._data.fontSize;e.restore()}},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this.Z97._calculatePoint2()},n.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),!this._points[0])return new TradingView.CompositeRenderer;if(!(this._points.length<2)){var e=this.Z97.properties(),t={};t.points=[],t.points.push(this._points[0]);var i=this._points[1].clone();i.x=this._points[0].x+this.Z97._barOffset*this.Z98.timeScale().barSpacing(),t.points.push(i),t.color=e.color.value(),t.linewidth=e.linewidth.value(),t.backcolor=e.backgroundColor.value(),t.transparency=e.transparency.value(),t.text=e.text.value(),t.font=e.font.value(),t.fontSize=e.fontsize.value(),t.bordercolor=e.bordercolor.value(),e.wordWrap&&e.wordWrap.value()&&(t.wordWrapWidth=e.wordWrapWidth.value()),t.bold=e.bold&&e.bold.value(),t.italic=e.italic&&e.italic.value();var n=new r(t,this._textSizeCache);if(this.isAnchorsRequired()){var o=new TradingView.CompositeRenderer;o.append(n);var a=t.points[1],s=[].concat(t.points);if(s.splice(s.length-1,1),o.append(this.createLineAnchor({points:s})),t.wordWrapWidth){var l=new MathEx.Point(a.x+(t.wordWrapWidth>>1)+r.ROUND_RADIUS+r.TEXT_MARGINS,a.y);l.data=1,o.append(this.createLineAnchor({points:[l]}))}return o}return n}},inherit(o,s),o.MIN_WIDTH=100,o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Callout"},o.prototype.correctPoints=function(e){var t=this._currentMovingPoint.index-this._startMovingPoint.index,i=this._currentMovingPoint.price-this._startMovingPoint.price,r=e[1];r.index+=t,r.price+=i,e[1]=r},o.prototype.addPoint=function(e){var t=s.prototype.addPoint.call(this,e);return t&&this._calculateBarOffset(),t},o.prototype._calculateBarOffset=function(){this.points().length>1&&(this._barOffset=this.points()[1].index-this.points()[0].index)},o.prototype.setLastPoint=function(e){s.prototype.setLastPoint.call(this,e),2==this.points().length&&this._calculateBarOffset()},o.prototype.setPoint=function(e,t){switch(e){case 0:s.prototype.setPoint.call(this,e,t),this._calculateBarOffset();break;case 1:var i=this.properties();if(!i.wordWrapWidth)return;var n=this._points,a=this._dragStartLeftEdgeIndex,l=Math.round((t.index-a)/2);if(isFinite(a)&&isFinite(l)){n[1]={index:a+l,price:n[1].price},this._calculateBarOffset(),this.normalizePoints();var d=this._timeScale.indexToCoordinate(a+2*l)-this._timeScale.indexToCoordinate(a)-r.ROUND_RADIUS-r.TEXT_MARGINS;if(!isFinite(d))return;i.wordWrapWidth.setValue(Math.max(o.MIN_WIDTH,d));break}n[1]=t,this._calculateBarOffset(),this.normalizePoints()}},o.prototype.startDragPoint=function(e,t){var i=this.properties();1===e&&i.wordWrap&&i.wordWrap.value()&&(this._dragStartLeftEdgeIndex=2*this.points()[1].index-t.index)},o.prototype.move=function(e){s.prototype.move.call(this,e),this._calculateBarOffset()},o.prototype.state=function(e){var t=s.prototype.state.call(this,e);return t.barOffset=this._barOffset,t},o.prototype.restoreData=function(e){e.barOffset?this._barOffset=e.barOffset:this._calculateBarOffset(),this._calculatePoint2()},o.prototype.setPriceScale=function(e){l.prototype.setPriceScale.call(this,e),e&&e.priceRange()&&this._calculatePoint2()},o.prototype._calculatePoint2=function(){if(this.Z98.lineBeingEdited()!=this&&this.Z98.sourceBeingMoved()!=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}}},e.exports=o},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){a.call(this,e,t),this._label=null,this._rendererCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolTrendAngleLine";var i=t?t:new J50("linetooltrendangle");s.call(this,e,new n(this,e),i),this.Q0.addProperty("angle"),this.Q0.angle=new o.AngleProperty(this)}var a=i(44),s=i(13).LineDataSource,l=i(55),d=l.TrendLineStatsRenderer,h=l.LineToolTrendLine,p=i(45).TextRenderer,c=i(55).TrendLineRenderer;r.prototype.hitTest=function(){return null},r.prototype.draw=function(e){e.save(),e.translate(this._data.point.x,this._data.point.y),e.strokeStyle=this._data.color;var t=[1,2];"function"==typeof e.setLineDash?e.setLineDash(t):void 0!==e.mozDash?e.mozDash=t:void 0!==e.webkitLineDash&&(e.webkitLineDash=t);var i=this._data.size;e.beginPath(),e.moveTo(0,0),e.lineTo(i,0),e.arc(0,0,i,0,-this._data.angle,this._data.angle>0),e.stroke(),e.restore()},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(a.prototype.update.call(this),this._points.length>0&&void 0!==this.Z97._angle){var e=this._points[0],t=Math.cos(this.Z97._angle),i=-Math.sin(this.Z97._angle),r=new MathEx.Point(t,i);this._secondPoint=e.addScaled(r,this.Z97._distance),this._secondPoint.data=1}if(this._label=null,!(this.Z97.points().length<2)){var n,o,e=this.Z97.points()[0],s=this.Z97.points()[1],l=[];if(this.Z97.properties().showPriceRange.value()&&this.Z97.priceScale()){var d=s.price-e.price,h=d/e.price;n=this.Z97.priceScale().formatter().format(d)+" ("+(new TradingView.PercentageFormatter).format(100*h)+")";var p=this.Z98.mainSeries().base();if(p){var c=Math.round(d*p);n+=", "+c}l.push("priceRange")}var u=this.Z97.properties().showBarsRange.value();if(u){o="";var _=s.index-e.index;o+=$.t("{0} bars").format(_),l.push("barsRange")}this._label=[n,o].filter(function(e){return e}).join("\n")||null,this._icons=l}},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer,t={},i=this.isAnchorsRequired(),n=i||this.Z97.properties().alwaysShowStats.value();if(this._secondPoint&&this._points.length>0){if(t.points=[this._points[0],this._secondPoint],t.width=this.Z98.timeScale().width(),t.height=this.Z97.priceScale().height(),t.color=this.Z97.properties().linecolor.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.linestyle=this.Z97.properties().linestyle.value(),t.extendleft=this.Z97.properties().extendLeft.value(),t.extendright=this.Z97.properties().extendRight.value(),t.leftend=s.LINEEND_NORMAL,t.rightend=s.LINEEND_NORMAL,e.append(new c(t)),n&&this._label&&2==this._points.length){var o={points:[this._secondPoint],text:this._label,color:this.Z97.properties().textcolor.value(),font:h.LABEL_FONT,fontsize:h.LABEL_FONTSIZE,lineSpacing:h.LABEL_LINESPACING,backgroundColor:h.LABEL_BGCOLOR,borderColor:h.LABEL_BORDERCOLOR,borderWidth:1,padding:h.LABEL_PADDING,paddingLeft:30,doNotAlignText:!0,icons:this._icons},a=h.LABEL_OFFSET;this._points[1].y<this._points[0].y?(o.vertAlign="bottom",o.offsetY=-a):o.offsetY=a,this._points[1].x<this._points[0].x?(o.horzAlign="right",o.offsetX=-a):o.offsetX=a,e.append(new d(o,this._rendererCache))}var l={};l.point=this._points[0],l.angle=this.Z97._angle,l.color=this.Z97.properties().linecolor.value(),l.size=50,e.append(new r(l));var u=Math.round(180*l.angle/Math.PI)+"º",_=this._points[0].clone();_.x=_.x+50;var f={points:[_],text:u,color:this.Z97.properties().textcolor.value(),horzAlign:"left",font:this.Z97.properties().font.value(),offsetX:5,offsetY:0,bold:this.Z97.properties().bold.value(),italic:this.Z97.properties().italic.value(),fontsize:this.Z97.properties().fontsize.value(),vertAlign:"middle"};e.append(new p(f,this._rendererCache))}return!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&t&&t.points&&t.points.length>=2&&this.Z97.getAlertIsActive(function(i){e.append(new TradingView.PaneRendererClockIcon({point1:t.points[0],point2:t.points[1],color:i?t.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),this._secondPoint&&this._points.length>0&&i&&e.append(this.createLineAnchor({points:[this._points[0],this._secondPoint]})),e},inherit(o,s),o.AngleProperty=function(e){Property.call(this),this._lineSource=e},inherit(o.AngleProperty,Property),o.AngleProperty.prototype.value=function(){var e=this._lineSource._angle,t=180*e/Math.PI;return Math.round(t)},o.AngleProperty.prototype.setValue=function(e){var t=e*Math.PI/180;this._lineSource._angle=t;var i=this._lineSource.pointToScreenPoint(this._lineSource.points()[0])[0],r=Math.cos(this._lineSource._angle),n=-Math.sin(this._lineSource._angle),o=new MathEx.Point(r,n),a=i.addScaled(o,this._lineSource._distance),s=this._lineSource.screenPointToPoint(a);this._lineSource._points[1]=s,this._lineSource.Z98.updateSource(this._lineSource),this._lineSource.updateAllViews(),this._lineSource.Z98.updateSource(this._lineSource)},o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Trend Angle"},o.prototype._calculateAngle=function(){var e=this.pointToScreenPoint(this.points()[0])[0],t=this.pointToScreenPoint(this.points()[1])[0],i=t.substract(e);i.length()>0?(i=i.normalized(),this._angle=Math.acos(i.x),i.y>0&&(this._angle=-this._angle),this._distance=t.substract(e).length()):delete this._angle;var r=this.properties();r.hasOwnProperty("angle")&&this.properties().angle.listeners().fire(this.properties().angle)},o.prototype.addPoint=function(e,t){var i=s.prototype.addPoint.call(this,e,t);return i&&this._calculateAngle(),i},o.prototype.setLastPoint=function(e,t){s.prototype.setLastPoint.call(this,e,t),this.points().length>1&&this._calculateAngle()},o.prototype.axisPoints=function(){var e=this.points();if(e.length<2)return[];var t=[this.points()[0]],i=this.pointToScreenPoint(this.points()[0])[1],r=Math.cos(this._angle)*this._distance,n=-Math.sin(this._angle)*this._distance,o=i.add(new MathEx.Point(r,n)),a=this.screenPointToPoint(o);return t.push(a),t},o.prototype.setPoint=function(e,t,i){s.prototype.setPoint.call(this,e,t,i),this.points().length>1&&1==e&&this._calculateAngle()},o.prototype.restoreData=function(e){this._angle=e.angle,this._distance=e.distance},o.prototype.state=function(e){var t=s.prototype.state.call(this,e);return t.angle=this._angle,t.distance=this._distance,t},o.prototype.cloneData=function(e){this._angle=e._angle,this._distance=e._distance},o.prototype.canHasAlert=function(){return!0},o.prototype._getAlertPlots=function(){return[this._linePointsToAlertPlot(this._points,null,this.properties().extendLeft.value(),this.properties().extendRight.value())]},e.exports=o},function(e,t,i){"use strict";function r(e,t){l.call(this,e,t),this._invalidated=!0}function n(e,t,i){this.Z97=e,this._index=t,this._bars=i||[]}function o(e,t,i){this.Z97=e,J50.call(this,"linetoolghostfeed",t,i)}function a(e,t,i){this._constructor="LineToolGhostFeed";var n;if(t?(n=t,n.Z97=this):n=new o(this),!i){var l=Math.round(e.mainSeries().data().calculateATR());n.averageHL.setValue(l)}s.call(this,e,new r(this,e),n),this._segments=[],n.averageHL.listeners().subscribe(this,a.prototype.regenerate),n.variance.listeners().subscribe(this,a.prototype.regenerate),n.points||n.addProperty("points"),this._currentAverageHL=this.Q0.averageHL.value(),this._currentVariance=this.Q0.variance.value(),this._currentInterval=e.mainSeries().interval()}var s=i(13).LineDataSource,l=i(44),d=i(55).TrendLineRenderer;inherit(r,l),r.prototype.update=function(){l.prototype.update.call(this),this._invalidated=!0},r.prototype.udpateImpl=function(){var e=this;this._segments=[];this.Z97.priceScale();e._points.length<2||(this._segments=this.Z97.segments().map(function(t,i){var r=e.Z97.points(),n=e._points[i].x,o=r[i].price,a=r[i+1].price,s=r[i+1].index-r[i].index,l=e.Z98.timeScale().barSpacing()*MathEx.sign(s),d=(a-o)/(t.bars().length-1),h=e.Z97.properties(),p=h.candleStyle.upColor.value(),c=h.candleStyle.downColor.value(),u=h.candleStyle.borderUpColor.value(),_=h.candleStyle.borderDownColor.value();return{bars:t.bars().map(function(t,i){var r=t.c>=t.o;return{time:n+i*l,open:e.priceToCoordinate(t.o+o+i*d),high:e.priceToCoordinate(t.h+o+i*d),low:e.priceToCoordinate(t.l+o+i*d),close:e.priceToCoordinate(t.c+o+i*d),color:r?p:c,borderColor:r?u:_,hollow:!1}})}}))},r.prototype.renderer=function(){this._invalidated&&(this.udpateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=1;t<this._points.length;t++){var i=this._points[t-1],r=this._points[t],n={points:[i,r],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL},o=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null);e.append(new d(n,o))}var a=this.Z97.properties(),l=a.candleStyle.drawWick.value(),h=a.candleStyle.drawBorder.value(),p=a.candleStyle.borderColor.value(),c=a.candleStyle.wickColor.value(),u=new TradingView.CompositeRenderer;u.setGlobalAlpha(1-a.transparency.value()/100);for(var t=0;t<this._segments.length;t++){var _={bars:this._segments[t].bars,barSpacing:this.Z98.timeScale().barSpacing(),drawWick:l,drawBorder:h,borderColor:p,wickColor:c,hittest:new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null)};u.append(new Z55(_))}return e.append(u),this.addAnchors(e),e},n.prototype.setBars=function(e){this._bars=e||[]},n.prototype.clone=function(e){return new n(e,this._index,TradingView.clone(this._bars))},n.prototype.createBar=function(){var e=this.Z97.properties().averageHL.value(),t=this.Z97.properties().variance.value()/100,i=this.Z97.Z98.mainSeries().base(),r=Math.random(),n=e*(1-2*r)*t;r=Math.random();var o=e*(1+(.5-r)*t),a=n-o/2,s=a+o,l=a+Math.random()*o,d=a+Math.random()*o,h={o:l/i,h:s/i,l:a/i,c:d/i};return h},n.prototype.generate=function(){this._bars=[];var e=this.Z97.points(),t=e[this._index],i=e[this._index+1];if(t.index!==i.index){this._avgHL=this.Z97.properties().averageHL.value(),this._variance=this.Z97.properties().variance.value()/100;for(var r=this._index?t.index+1:t.index,n=MathEx.sign(i.index-t.index),o=r;o!=i.index;o+=n)this._bars.push(this.createBar())}},n.prototype.bars=function(){return this._bars},n.prototype.setSize=function(e){if(e<this._bars.length)this._bars.splice(e,this._bars.length-e);else for(;this._bars.length<e;)this._bars.push(this.createBar())},inherit(o,J50),o.prototype.restoreFactoryDefaults=function(){J50.prototype.restoreFactoryDefaults.call(this);var e=this.Z97.Z98,t=Math.round(e.mainSeries().data().calculateATR());this.averageHL.setValue(t)},inherit(a,s),a.prototype.createPropertiesObject=function(e,t,i){return new o(null,t,i)},a.prototype.regenerate=function(){this._currentAverageHL=this.Q0.averageHL.value(),this._currentVariance=this.Q0.variance.value(),this._segments.forEach(function(e){e.generate()}),this.updateAllViews(),this.Z98.updateSource(this)},a.prototype.propertiesChanged=function(){s.prototype.propertiesChanged.call(this),this._currentAverageHL===this.Q0.averageHL.value()&&this._currentVariance===this.Q0.variance.value()||this.regenerate()},a.prototype.pointsCount=function(){return-1},a.prototype.title=function(){return"Ghost Feed"},a.prototype.segmentBars=function(e){return this._segments[e].bars()},a.prototype.segments=function(){return this._segments},a.prototype.generateBars=function(e){this._segments.length<=e&&this._segments.push(new n(this,e)),this._segments[e].generate()},a.prototype.addPoint=function(e){if(this._points.length>0){var t=this._points[this._points.length-1];if(t.index===e.index){this._lastPoint=null,this.normalizePoints(),this.createServerPoints();for(var i=0;i<this._points.length;i++)this._createPointProperty(i);return!0}}var r=s.prototype.addPoint.call(this,e);return this._finished&&(this._lastPoint=null),this._points.length>1&&this.generateBars(this._points.length-2),r||this._finished},a.prototype.finish=function(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()},a.prototype.setPoint=function(e,t,i){if(s.prototype.setPoint.call(this,e,t,i),e>0){var r=this.points()[e-1],n=t.index-r.index;this._segments[e-1].setSize(Math.abs(n))}if(e<this.points().length-1){var o=this.points()[e+1],n=o.index-t.index;this._segments[e].setSize(Math.abs(n))}},a.prototype.state=function(e){var t=s.prototype.state.call(this,e);return t.segments=this._segments.map(function(e){return{bars:e.bars()}}),t},a.prototype.restoreData=function(e){var t=this;e.segments&&(this._segments=e.segments.map(function(e,i){return new n(t,i,[].concat(e.bars))})),this._currentAverageHL=this.Q0.averageHL.value(),this._currentVariance=this.Q0.variance.value()},a.prototype.onData=function(e){if(s.prototype.onData.call(this,e),0===this.properties().points._childs.length)for(var t=0;t<this._points.length;t++)this._createPointProperty(t);this._currentInterval!=this.Z98.mainSeries().interval()&&(this.regenerate(),this._currentInterval=this.Z98.mainSeries().interval())},a.prototype.cloneData=function(e){var t=this;this._segments=e._segments.map(function(e){return e.clone(t)})},e.exports=a},function(e,t,i){"use strict";function r(e,t){f.call(this,e,t),this._rendererCache=[{},{},{},{},{},{}],this._invalidated=!0}function n(e,t){var i=t?t:new J50("linetoolelliott");_.call(this,e,new r(this,e),i)}function o(e,t){var i=t?t:new J50("linetoolelliott");_.call(this,e,new r(this,e),i),this.version=o.version}function a(e,t){this._constructor="LineToolElliottImpulse";var i=t?t:new J50("linetoolelliottimpulse");o.call(this,e,i)}function s(e,t){this._constructor="LineToolElliottTriangle";var i=t?t:new J50("linetoolelliotttriangle");o.call(this,e,i)}function l(e,t){this._constructor="LineToolElliottTripleCombo";var i=t?t:new J50("linetoolelliotttriplecombo");o.call(this,e,i)}function d(e,t){var i=t?t:new J50("linetoolelliott");_.call(this,e,new r(this,e),i),this.version=d.version}function h(e,t){this._constructor="LineToolElliottCorrection";var i=t?t:new J50("linetoolelliottcorrection");d.call(this,e,i)}function p(e,t){this._constructor="LineToolElliottLineToolElliottDoubleCombo";var i=t?t:new J50("linetoolelliottdoublecombo");d.call(this,e,i);
}var c=i(97).EllipseRendererSimple,u=i(45).TextRenderer,_=i(13).LineDataSource,f=i(44),g=i(55).TrendLineRenderer;inherit(r,f),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),!this._wave)return null;for(var e=this.isAnchorsRequired()?0:1,t=new TradingView.CompositeRenderer,i=this.Z97.properties(),r=0;r<this._wave.length;r++)t.append(new g(this._wave[r]));var n=1;if(this._points.length>2){var o=this._points[2],a=this._points[1];n=MathEx.sign(o.y-a.y)}var s=[],l=0;this.Z98.lineBeingCreated()==this.Z97&&(l=1);for(var d=new TradingView.RGBColor(this.Z98.backgroundColor()).blackWhiteContrast(),h=i.color.value(),r=0;r<this._points.length-l;r++,n=-n)if(!(e>r)){var p=this.Z97.label(r),_=p.label;if("circle"==p.decoration){var f=this._points[r].clone();1==n?f.y+=13+p.fontIncrease/2:f.y-=14+p.fontIncrease/2;var v=(12+p.fontIncrease)/2+2,o=f.substract(new MathEx.Point(v,v)),a=f.add(new MathEx.Point(v,v)),m={points:[o,a],color:new TradingView.RGBColor(h).darken("black"==d?15:-15).toHex(),linewidth:1,fillBackground:!1},y=new c(m);t.append(y)}"brackets"==p.decoration&&(_="("+_+")");var w={points:[this._points[r]],text:_,color:new TradingView.RGBColor(h).darken("black"==d?15:-15).toHex(),vertAlign:1==n?"top":"bottom",horzAlign:"center",font:"Arial",offsetX:0,offsetY:1==n?5:-10,fontsize:12+p.fontIncrease,bold:p.bold};s.push(w),""!==p&&t.append(new u(w,this._rendererCache[r],new TradingView.HitTestResult(TradingView.HitTestResult.CHANGEPOINT,r)))}if(this.isAnchorsRequired()){for(var T=[],b=0;b<s.length;b++){var S=this._points[b].clone();S.y=s[b].points[0].y,S.data=b,T.push(S)}this.Z98.lineBeingCreated()==this.Z97&&T.pop(),t.append(this.createLineAnchor({points:T}))}return t},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){f.prototype.update.call(this),this._wave=[];var e=this.Z97.properties(),t=this.Z97.priceScale(),i=this.Z98.timeScale();if(t&&!t.isEmpty()&&!i.isEmpty()){var r;this.Z97.priceScale().isPercent()&&(r=this.Z97.ownerSource().firstValue());var n=e.color.value();if(e.showWave.value())for(var o=this.Z97.points(),a=1;a<o.length;a++){var s=o[a-1],l=o[a],d=(this.Z98.mainSeries().bars().valueAt(s.index),this.Z98.mainSeries().bars().valueAt(l.index),i.indexToCoordinate(s.index)),h=i.indexToCoordinate(l.index),p=s.price,c=l.price;this.Z97.priceScale().isPercent()&&(p=this.Z97.priceScale().priceRange().convertToPercent(p,r),c=this.Z97.priceScale().priceRange().convertToPercent(c,r));var u=t.priceToCoordinate(p),g=t.priceToCoordinate(c),v={points:[new MathEx.Point(d,u),new MathEx.Point(h,g)],width:i.width(),height:t.height(),color:TradingView.generateColor(n,0),linewidth:e.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:_.LINEEND_CIRCLE,rightend:_.LINEEND_CIRCLE,endstyle:{strokeWidth:1,fillStyle:this.Z98.backgroundColor()},overlayLineEndings:!0};this._wave.push(v)}}},inherit(n,_),n.migrateState=function(e){var 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])},n.prototype.title=function(){return"Elliott Labels"},n.degrees=[$.t("Supermillennium"),$.t("Millennium"),$.t("Submillennium"),$.t("Grand Supercycle"),$.t("Supercycle"),$.t("Cycle"),$.t("Primary"),$.t("Intermediate"),$.t("Minor"),$.t("Minute"),$.t("Minuette"),$.t("Subminuette"),$.t("Micro"),$.t("Submicro"),$.t("Miniscule")],n.prototype.additionalActions=function(e){var t=new TradingView.Action({text:$.t("Degree")}),i=this;return t.subActions=n.degrees.map(function(t,r){var n=new TradingView.Action({text:t,checkable:!0,checked:i.properties().degree.value()==r});return n.callbacks().subscribe(null,function(){e.setProperty(i.properties().degree,r,"Change Elliott Degree")}),n}),[t]},n.prototype.label=function(e){var t=n.degrees.length-this.properties().degree.value()-1,i=Math.floor(t/3),r=t%3,o=4*Math.floor(i),a=!!(i%2),s=["","brackets","circle"][r],l=this.labelsGroup(),d=l[i][e];return{fontIncrease:o,bold:a,decoration:s,label:d}},inherit(o,n),o.version=3,o.prototype.pointsCount=function(){return 6},o.prototype.migrateVersion=function(e,t,i){if(1==e){var r=$.extend({},this._timePoint[0]);this._timePoint.unshift(r),this._points.length>0&&(r=$.extend({},this._points[0]),this._points.unshift(r))}},inherit(a,o),a._labelsGroups=[["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"]],a.prototype.labelsGroup=function(){return a._labelsGroups},inherit(s,o),s._labelsGroups=[["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"]],s.prototype.labelsGroup=function(){return s._labelsGroups},inherit(l,o),l._labelsGroups=[["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"]],l.prototype.labelsGroup=function(){return l._labelsGroups},inherit(d,n),d.version=3,d.prototype.pointsCount=function(){return 4},d.prototype.migrateVersion=function(e,t,i){if(1==e){var r=$.extend({},this._timePoint[0]);this._timePoint.insert(r,0),this._points.length>0&&(r=$.extend({},this._points[0]),this._points.insert(r,0))}},inherit(h,d),h._labelsGroups=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]],h.prototype.labelsGroup=function(){return h._labelsGroups},inherit(p,d),p._labelsGroups=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]],p.prototype.labelsGroup=function(){return p._labelsGroups},t.LineToolElliott=n,t.LineToolElliottImpulse=a,t.LineToolElliottTriangle=s,t.LineToolElliottTripleCombo=l,t.LineToolElliottCorrection=h,t.LineToolElliottDoubleCombo=p},function(e,t,i){"use strict";function r(){h.call(this)}function n(e,t,i){this._data=e,this._hittest=t||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittest=i||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND)}function o(e,t){s.call(this,e,t),this._rendererCache={},this._invalidated=!0,this._numericFormatter=new TradingView.NumericFormatter}function a(e,t){this._constructor="LineToolFibCircles";var i=t?t:new this.createPropertiesObject("linetoolfibcircles");l.call(this,e,new o(this,e),i),e._fibCirclesLabelsCache||(e._fibCirclesLabelsCache=new r)}var s=i(44),l=i(13).LineDataSource,d=i(9),h=i(98),p=i(55).TrendLineRenderer;inherit(r,h),r.prototype.levelsCount=function(){return a.LevelsCount},n.prototype.draw=function(e){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t=this._data.points[0],i=this._data.points[1],r=Math.abs(t.x-i.x),n=Math.abs(t.y-i.y),o=t.add(i).scaled(.5);if(!(1>r||1>n)){var a;if(this._data.wholePoints){var s=this._data.wholePoints[0],l=this._data.wholePoints[1];a=Math.abs(s.x-l.x);Math.abs(s.y-l.y)}e.save(),e.translate(o.x,o.y),e.scale(1,n/r),e.beginPath(),e.arc(0,0,r/2,0,2*Math.PI,!1),e.restore(),e.stroke(),this._data.fillBackground&&(this._data.wholePoints&&(e.translate(o.x,o.y),e.scale(1,n/r),e.arc(0,0,a/2,0,2*Math.PI,!0)),e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency,!0),e.fill())}},n.prototype.hitTest=function(e){if(this._data.points.length<2)return null;var t=this._data.points[0],i=this._data.points[1],r=.5*Math.abs(t.x-i.x),n=(.5*Math.abs(t.y-i.y),Math.abs(t.x-i.x)),o=Math.abs(t.y-i.y),a=t.add(i).scaled(.5),s=e.substract(a);if(1>n||1>o)return null;var l=(i.y-t.y)/(i.x-t.x);s.y/=l;var d=s.x*s.x+s.y*s.y,h=d-r*r;h=MathEx.sign(h)*Math.sqrt(Math.abs(h/r));var p=3;return Math.abs(h)<p?this._hittest:this._data.fillBackground&&!this._data.noHitTestOnBackground&&p>h?this._backHittest:null},inherit(o,s),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){if(s.prototype.update.call(this),this._cacheState=this.Z98._fibCirclesLabelsCache.updateSource(this.Z97),!(this.Z97.points().length<2)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this._points[0],t=this._points[1];this._center=e.add(t).scaled(.5);var i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);this._levels=[];for(var n=this.Z97.properties(),o=1;o<=a.LevelsCount;o++){var l="level"+o,d=n[l];if(d.visible.value()){var h=d.coeff.value(),p=d.color.value(),c=[];c.push(new MathEx.Point(this._center.x-.5*i*h,this._center.y-.5*r*h)),c.push(new MathEx.Point(this._center.x+.5*i*h,this._center.y+.5*r*h));var u=new MathEx.Point(this._center.x,this._center.y+.5*r*h);this._levels.push({color:p,points:c,labelPoint:u,linewidth:d.linewidth.value(),linestyle:d.linestyle.value(),index:o})}}}},o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;for(var t=(this._points[0],this._points[1],this._center,this.Z97.properties()),i=t.fillBackground.value(),r=t.transparency.value(),o=this.Z98._fibCirclesLabelsCache,a=o.canvas().get(0),s=0;s<this._levels.length;s++){var d=this._levels[s],h={};h.points=d.points,h.color=d.color,h.linewidth=d.linewidth,h.backcolor=d.color,s>0&&(h.wholePoints=this._levels[s-1].points),h.fillBackground=i,h.transparency=r;var c=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,d.index);if(e.append(new n(h,c)),t.showCoeffs.value()){var u=this._cacheState.preparedCells.cells[this._levels[s].index-1];if(!u)continue;var _={left:u.left,top:o.topByRow(this._cacheState.row),width:u.width,height:o.rowHeight(this._cacheState.row)},f={left:Math.round(d.labelPoint.x-_.width),top:Math.round(d.labelPoint.y-_.height/2),width:u.width,height:_.height},g=new TradingView.PaneRendererCachedImage(a,_,f);e.append(g)}}if(t.trendline.visible.value()){var v={points:[this._points[0],this._points[1]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t.trendline.color.value(),linewidth:t.trendline.linewidth.value(),linestyle:t.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:l.LINEEND_NORMAL,rightend:l.LINEEND_NORMAL};e.append(new p(v))}return this.addAnchors(e),e},inherit(a,l),a.LevelsCount=11,a.prototype.pointsCount=function(){return 2},a.prototype.title=function(){return"Fib Circles"},a.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},a.prototype.createPropertiesObject=function(e,t,i){return new d(e,t,i,{range:[1,11]})},t.EllipseRendererSimple=n,t.LineToolFibCircles=a},function(e,t){"use strict";function i(){this._registeredSources={},this._sourcesToRow={},this._rowsToSources={},this._currentSymbol="",this._actualCapacity=0,this._actualWidth=1,this._numericFormatter=new TradingView.NumericFormatter,this._percentageFormatter=new TradingView.PercentageFormatter}i.prototype.levelsCount=function(){return 0},i.prototype.topByRow=function(e){return e*i.ROW_HEIGHT},i.prototype.rowHeight=function(e){return i.ROW_HEIGHT},i.prototype.canvas=function(){if(!this._canvas){this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this._canvas.prop("width",100).css("position","absolute").css("top",0).css("z-index",1e3).css("left",0);var e=this._canvas.get(0).getContext("2d");e.font="12px Verdana"}return this._canvas},i.ROW_HEIGHT=14,i.prototype.points=function(e){return[e.points()[0],e.points()[1]]},i.prototype.startPoint=function(e,t){var i=t?e.points()[0]:e.points()[1];return i},i.prototype.priceRange=function(e,t){var i=this.points(e),r=i[0],n=i[1],o=t?n.price-r.price:r.price-n.price;return o},i.prototype.sourceIsReady=function(e){return e.points().length>=2},i.prototype._calculateWidth=function(e){if(!this.sourceIsReady(e))return null;var t=this.canvas().get(0).getContext("2d");t.font="12px Verdana";var i=e.properties().showPrices?e.properties().showPrices.value():!1,r=e.properties().coeffsAsPercents?e.properties().coeffsAsPercents.value():!1,n=e.properties().showCoeffs.value(),o=e.priceScale().formatter(),a=this.points(e),s=a[0],l=a[1];if(!s||!l)return null;var d=!1,h=e.properties();h.reverse&&h.reverse.value()&&(d=h.reverse.value());var p,c=this.priceRange(e,d),u=this.startPoint(e,d).price;if(e.priceScale().isPercent()&&(p=e.ownerSource().firstValue(),null===p))return 0;for(var _=0,f=[],g=1;g<=this.levelsCount();g++){var v="level"+g,m=h[v],y=m.coeff.value(),w=u+y*c;e.priceScale().isPercent()&&(w=e.priceScale().priceRange().convertToPercent(w,p));var T="";n&&(T+=r?this._percentageFormatter.format(Math.round(1e4*y)/100):this._numericFormatter.format(y)),i&&(T+="("+o.format(w)+")");var b=t.measureText(T).width,S={text:T,left:_,width:b+4};f.push(S),_+=S.width}return{totalWidth:_,cells:f}},i.prototype._effectiveState=function(e){var t={},i=e.properties();i.showPrices&&(t.showPrices=i.showPrices.value()),i.coeffsAsPercents&&(t.coeffsAsPercents=i.coeffsAsPercents.value()),t.showCoeffs=i.showCoeffs.value(),e.priceScale()&&e.priceScale().formatter().state&&(t.formatter=e.priceScale().formatter().state()),i.reverse&&(t.reverse=i.reverse.value()),t.p1=e.points()[0],t.p2=e.points()[1],3==e.points().length&&(t.p3=e.points()[2]),t.items=[];for(var r=1;r<=this.levelsCount();r++){var n="level"+r,o=i[n],a=o.coeff.value(),s=o.color.value(),l={coeff:a,color:s};t.items.push(l)}return t},i.prototype._findEmptyRow=function(e){for(var t=0;this._rowsToSources[t];)t++;if(this._rowsToSources[t]=e,t>=this._actualCapacity){this._actualCapacity++;var r=this.canvas();TradingView.resizeCanvas(r,this._actualWidth,i.ROW_HEIGHT*this._actualCapacity)}return t},i.prototype._repaintSource=function(e,t,r){var n=i.ROW_HEIGHT*r.row,o=this.canvas().get(0).getContext("2d");o.clearRect(0,n,this._actualWidth,i.ROW_HEIGHT),o.textBaseline="bottom",o.font="12px Verdana",n+=i.ROW_HEIGHT;for(var a=0;a<e.cells.length;a++){var s=e.cells[a];o.fillStyle=t.items[a].color,o.fillText(s.text,s.left,n)}},i.prototype.removeSource=function(e){if(this._sourcesToRow[e]){var t=this._sourcesToRow[e].row,r=this.canvas().get(0).getContext("2d");r.save(),r.clearRect(0,this.topByRow(t),this._actualWidth,i.ROW_HEIGHT),r.restore(),delete this._sourcesToRow[e],delete this._rowsToSources[t]}},i.prototype._effectiveStatesEquals=function(e,t){var i=function(e,t){return e||t?e&&!t?!0:!e&&t?!0:e.minMove!=t.minMove?!0:e.minMove2!=t.minMove2?!0:e.fractional!=t.fractional?!0:e.fractionalLength!=t.fractionalLength:!1},r=function(e,t){return e||t?e&&!t?!0:!e&&t?!0:e.index!=t.index||e.price!=t.price:!1},n=function(e,t){return e.coeff!=t.coeff?!0:e.color!=t.color};if(e&&!t)return!1;if(!e&&t)return!1;if(e.showPrices!=t.showPrices)return!1;if(e.coeffsAsPercents!=t.coeffsAsPercents)return!1;if(e.showCoeffs!=t.showCoeffs)return!1;if(e.reverse!=t.reverse)return!1;if(i(e.formatter,t.formatter))return!1;if(r(e.p1,t.p1))return!1;if(r(e.p2,t.p2))return!1;if(r(e.p3,t.p3))return!1;if(e.items.length!=t.items.length)return!1;for(var o=0;o<e.items.length;o++)if(n(e.items[o],t.items[o]))return!1;return!0},i.prototype.updateSource=function(e){var t=e.properties().symbol.value();if(this._currentSymbol!=t&&(this._currentSymbol=t,this._sourcesToRow={},this._rowsToSources={}),!this._sourcesToRow[e.id()]){var r=this._findEmptyRow(e.id());this._sourcesToRow[e.id()]={effectiveState:null,row:r}}var n=this._sourcesToRow[e.id()].effectiveState,o=this._effectiveState(e);if(!this._effectiveStatesEquals(n,o)){var a=this._calculateWidth(e);if(a){this._sourcesToRow[e.id()].effectiveState=o,a.totalWidth>this._actualWidth&&(TradingView.resizeCanvas(this.canvas(),a.totalWidth,i.ROW_HEIGHT*this._actualCapacity),this._actualWidth=a.totalWidth);var r=this._sourcesToRow[e.id()];this._repaintSource(a,o,r),this._sourcesToRow[e.id()].effectiveState=o,this._sourcesToRow[e.id()].preparedCells=a}else this._sourcesToRow[e.id()].effectiveState=null}return this._sourcesToRow[e.id()]},e.exports=i},function(e,t,i){"use strict";function r(){c.call(this)}function n(e,t,i){l.call(this,e,t,i)}function o(e,t){h.call(this,e,t),this._rendererCache={},this._invalidated=!0}function a(e,t){this._constructor="LineToolFibChannel";var i=t?t:this.createPropertiesObject("linetoolfibchannel");d.call(this,e,new o(this,e),i),this.version=a.version,e._fibChannelLabelsCache||(e._fibChannelLabelsCache=new r)}var s=i(8),l=i(83).ParallelChannelRenderer,d=i(13).LineDataSource,h=i(44),p=i(9),c=i(98),u=i(55).TrendLineRenderer;inherit(r,c),r.prototype.levelsCount=function(){return a.LevelsCount},inherit(n,l),n.prototype.getColor=function(){return TradingView.generateColor(this._data.backcolor,this._data.transparency,!0)},inherit(o,h),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){if(h.prototype.update.call(this),this._cacheState=this.Z98._fibChannelLabelsCache.updateSource(this.Z97),!(this._points.length<3||this.Z97.points().length<3)){this._points[0],this._points[1],this._points[2];this.norm=this._points[2].substract(this._points[0])}},o.prototype.renderer=function(){function e(e,r,n){var o;switch(i.horzLabelsAlign.value()){case"left":o=e;break;case"center":o=e.add(r).scaled(.5),o.x+=n.width/2,o.x=Math.round(o.x);break;case"right":o=r.clone(),o.x+=n.width,o.x=Math.round(o.x)}var a={left:n.left,top:l.topByRow(p._cacheState.row),width:n.width,height:l.rowHeight(p._cacheState.row)},s={left:Math.round(o.x-a.width),top:Math.round(o.y),width:n.width,height:a.height},d=i.vertLabelsAlign.value();"middle"==d&&(s.top-=s.height/2),"bottom"==d&&(s.top-=s.height);var c=new TradingView.PaneRendererCachedImage(h,a,s);t.append(c)}this._invalidated&&(this._updateImpl(),this._invalidated=!1);var t=new TradingView.CompositeRenderer;if(this._points.length<2)return this.addAnchors(t),t;var i=this.Z97.properties(),r=this._points[0],o=this._points[1];if(this._points.length<3){var a={points:[r,o],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:i.level1.color.value(),linewidth:i.levelsStyle.linewidth.value(),linestyle:i.levelsStyle.linestyle.value(),extendleft:i.extendLeft.value(),extendright:i.extendRight.value(),leftend:d.LINEEND_NORMAL,rightend:d.LINEEND_NORMAL};return t.append(new u(a)),this.addAnchors(t),t}for(var l=this.Z98._fibChannelLabelsCache,h=l.canvas().get(0),p=this,c=1;c<s.LevelsCount;c++){var _=i["level"+c];if(_.visible.value()){for(var f=null,g=c+1;g<=s.LevelsCount;g++){var v=i["level"+g];if(v.visible.value()){f=v;break}}if(!f)break;var m=this.norm.scaled(_.coeff.value()),y=r.add(m),w=o.add(m),T=this.norm.scaled(f.coeff.value()),b=r.add(T),S=o.add(T),C={};if(C.points=[y,w,b,S],C.color=_.color.value(),C.width=this.Z98.timeScale().width(),C.height=this.Z97.priceScale().height(),C.linewidth=i.levelsStyle.linewidth.value(),C.linestyle=i.levelsStyle.linestyle.value(),C.extendleft=i.extendLeft.value(),C.extendright=i.extendRight.value(),C.backcolor=_.color.value(),C.transparency=i.transparency.value(),C.skipTopLine=!0,C.fillBackground=i.fillBackground.value(),C.hittestOnBackground=!0,t.append(new n(C)),i.showCoeffs.value()||i.showPrices.value()){var x=this._cacheState.preparedCells.cells[c-1];e(y,w,x)}}}for(var P=null,c=s.LevelsCount;c>=1;c--){var _=i["level"+c];if(_.visible.value()){P=c;break}}if(null!=P){var _=i["level"+P];if(_.visible.value()){var m=this.norm.scaled(_.coeff.value()),y=r.add(m),w=o.add(m),a={points:[y,w],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:_.color.value(),linewidth:i.levelsStyle.linewidth.value(),linestyle:i.levelsStyle.linestyle.value(),extendleft:i.extendLeft.value(),extendright:i.extendRight.value(),leftend:d.LINEEND_NORMAL,rightend:d.LINEEND_NORMAL};t.append(new u(a)),(i.showCoeffs.value()||i.showPrices.value())&&e(y,w,this._cacheState.preparedCells.cells[P-1])}}return this.addAnchors(t),t},inherit(a,d),a.LevelsCount=24,a.version=2,a.prototype.migrateVersion=function(e,t,i){i.properties.removeProperty("reverse")},a.prototype.pointsCount=function(){return 3},a.prototype.title=function(){return"Fib Channel"},a.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},a.prototype.createPropertiesObject=function(e,t,i){return new p(e,t,i,{range:[1,24],names:["coeff","color","visible"]})},e.exports=a},function(e,t,i){"use strict";function r(){h.call(this)}function n(e,t,i){this._data=e,this._hittest=t||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittest=i||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND)}function o(e,t){l.call(this,e,t),this._rendererCache={},this._invalidated=!0}function a(e,t){this._constructor="LineToolFibSpeedResistanceArcs";var i=t?t:new this.createPropertiesObject("linetoolfibspeedresistancearcs");s.call(this,e,new o(this,e),i),e._fibSpeedResistanceArcsLabelsCache||(e._fibSpeedResistanceArcsLabelsCache=new r)}var s=i(13).LineDataSource,l=i(44),d=i(9),h=i(98),p=i(55).TrendLineRenderer;inherit(r,h),r.prototype.levelsCount=function(){return a.LevelsCount},n.prototype.draw=function(e){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.translate(this._data.center.x,this._data.center.y),e.beginPath(),this._data.fullCircles?e.arc(0,0,this._data.radius,2*Math.PI,0,!1):this._data.dir>0?e.arc(0,0,this._data.radius,0,Math.PI,!1):e.arc(0,0,this._data.radius,Math.PI,0,!1),e.stroke(),this._data.fillBackground&&(this._data.radius2&&(this._data.fullCircles?e.arc(0,0,this._data.radius2,2*Math.PI,0,!0):this._data.dir>0?e.arc(0,0,this._data.radius2,Math.PI,0,!0):e.arc(0,0,this._data.radius2,0,Math.PI,!0)),e.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0),e.fill())},n.prototype.hitTest=function(e){var t=MathEx.sign(e.y-this._data.center.y);if(t!==this._data.dir&&!this._data.fullCircles)return null;var i=e.substract(this._data.center),r=i.length(),n=3;return Math.abs(r-this._data.radius)<n?this._hittest:this._data.hittestOnBackground&&Math.abs(r)<=this._data.radius+n?this._backHittest:null},inherit(o,l),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){if(l.prototype.update.call(this),this._cacheState=this.Z98._fibSpeedResistanceArcsLabelsCache.updateSource(this.Z97),!(this._points.length<2)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this._points[0],t=this._points[1],i=e.substract(t).length();this._levels=[];for(var r=this.Z97.properties(),n=1;n<=a.LevelsCount;n++){var o="level"+n,s=r[o];if(s.visible.value()){var d=s.coeff.value(),h=s.color.value(),p=t.substract(e).length()*d,c=MathEx.sign(t.y-e.y),u=new MathEx.Point(e.x,e.y+c*i*d);this._levels.push({color:h,radius:p,dir:c,labelPoint:u,linewidth:s.linewidth.value(),linestyle:s.linestyle.value(),index:n})}}}},o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;for(var t=this._points[0],i=(this._points[1],this._center,this.Z97.properties()),r=i.fillBackground.value(),o=i.transparency.value(),a=this.Z98._fibSpeedResistanceArcsLabelsCache,l=a.canvas().get(0),d=0;d<this._levels.length;d++){var h=this._levels[d],c={};c.center=t,c.color=h.color,c.linewidth=h.linewidth,c.radius=h.radius,c.dir=h.dir,c.transparency=o,c.fillBackground=r,c.hittestOnBackground=!0,c.fullCircles=i.fullCircles.value(),d>0&&(c.radius2=this._levels[d-1].radius);var u=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,h.index);if(e.append(new n(c,u)),i.showCoeffs.value()){var _=this._cacheState.preparedCells.cells[this._levels[d].index-1];if(!_)continue;var f={left:_.left,top:a.topByRow(this._cacheState.row),width:_.width,height:a.rowHeight(this._cacheState.row)},g={left:Math.round(h.labelPoint.x-f.width),top:Math.round(h.labelPoint.y-f.height/2),width:_.width,height:f.height},v=new TradingView.PaneRendererCachedImage(l,f,g);e.append(v)}}if(i.trendline.visible.value()){var m={points:[this._points[0],this._points[1]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:i.trendline.color.value(),linewidth:i.trendline.linewidth.value(),linestyle:i.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};e.append(new p(m))}return this.addAnchors(e),e},inherit(a,s),a.LevelsCount=11,a.prototype.pointsCount=function(){return 2},a.prototype.title=function(){return"Fib Speed Resistance Arcs"},a.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},a.prototype.createPropertiesObject=function(e,t,i){return new d(e,t,i,{range:[1,11]})},e.exports=a},function(e,t,i){"use strict";function r(){p.call(this)}function n(e,t){d.call(this,e,t)}function o(e,t){this._constructor="LineToolProjection";var i=t?t:new this.createPropertiesObject("linetoolprojection");c.call(this,e,new n(this,e),i)}var a=i(9),s=i(102),l=s.ArcWedgeRenderer,d=s.FibWedgePaneView,h=s.LineToolFibWedge,p=i(98),c=i(13).LineDataSource,u=i(55).TrendLineRenderer;inherit(r,p),r.prototype.levelsCount=function(){return 1},inherit(n,d),n.prototype.update=function(){d.prototype.update.call(this)},n.prototype._levelsCount=function(){return 1},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t=this.Z97.properties(),i=this._points,r=i[0],n=i[1],o={points:[r,n],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t.trendline.color.value(),linewidth:t.linewidth.value(),linestyle:t.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL};if(e.append(new u(o)),this._points.length<3)return this.addAnchors(e),e;var a=i[2],s=a.data,d=n.substract(r).length(),h=(n.substract(r).normalized(),a.substract(r).normalized());a=r.add(h.scaled(d)),a.data=s,o={points:[r,a],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t.trendline.color.value(),linewidth:t.linewidth.value(),linestyle:t.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:c.LINEEND_NORMAL,rightend:c.LINEEND_NORMAL},e.append(new u(o));var p=this._levels[0],_={};return _.center=this._points[0],_.radius=p.radius,_.prevRadius=0,_.edge=this._edge,_.color=t.trendline.color.value(),_.color1=t.color1.value(),_.color2=t.color2.value(),_.linewidth=t.linewidth.value(),_.edge1=this._edge1,_.edge2=this._edge2,_.p1=p.p1,_.p2=p.p2,_.fillBackground=t.fillBackground.value(),_.transparency=t.transparency.value(),_.gradient=!0,e.append(new l(_)),this.addAnchors(e),e},inherit(o,h),o.prototype.title=function(){return"Projection"},o.prototype.getCache=function(){return this.Z98._projectionLabelsCache||(this.Z98._projectionLabelsCache=new r),this.Z98._projectionLabelsCache},o.prototype.createPropertiesObject=function(e,t,i){return new a(e,t,i,{range:[1,1]})},e.exports=o},function(e,t,i){"use strict";function r(){h.call(this)}function n(e,t,i){this._data=e,this._hittest=t||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),this._backHittest=i||new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND),this._rendererCache={}}function o(e,t){l.call(this,e,t),this._rendererCache={},this._levels=[],this._invalidated=!0}function a(e,t){this._constructor="LineToolFibSpeedResistanceArcs";var i=t?t:new this.createPropertiesObject("linetoolfibwedge");s.call(this,e,new o(this,e),i),e._fibWedgeLabelsCache||(e._fibWedgeLabelsCache=new r)}var s=i(13).LineDataSource,l=i(44),d=i(9),h=i(98),p=i(55).TrendLineRenderer;inherit(r,h),r.prototype.levelsCount=function(){return a.LevelsCount},n.prototype.draw=function(e){if(e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.beginPath(),e.arc(this._data.center.x,this._data.center.y,this._data.radius,this._data.edge1,this._data.edge2,!0),e.stroke(),this._data.fillBackground){if(e.arc(this._data.center.x,this._data.center.y,this._data.prevRadius,this._data.edge2,this._data.edge1,!1),this._data.gradient){var t=e.createRadialGradient(this._data.center.x,this._data.center.y,this._data.prevRadius,this._data.center.x,this._data.center.y,this._data.radius);t.addColorStop(0,TradingView.generateColor(this._data.color1,this._data.transparency)),t.addColorStop(1,TradingView.generateColor(this._data.color2,this._data.transparency)),e.fillStyle=t}else e.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0);e.fill()}},n.prototype.hitTest=function(e){var t=4,i=e.substract(this._data.center).length();if(Math.abs(i-this._data.radius)<=t){var r=e.substract(this._data.p1).length(),n=e.substract(this._data.p2).length(),o=Math.max(r,n),a=this._data.p1.substract(this._data.p2).length();if(a>=o)return this._hittest}if(this._data.fillBackground&&i<=this._data.radius){var s=this._data.p1.substract(this._data.center).normalized(),l=this._data.p2.substract(this._data.center).normalized(),i=e.substract(this._data.center).normalized(),d=s.dotProduct(l),h=i.dotProduct(s),p=i.dotProduct(l);if(h>=d&&p>=d)return this._backHittest}return null},inherit(o,l),o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){if(l.prototype.update.call(this),this._cacheState=this.Z97.getCache().updateSource(this.Z97),this._levels=[],!(this._points.length<3)){var e=this._points,t=e[0],i=e[1],r=e[2],n=i.substract(t).normalized(),o=r.substract(t).normalized(),a=new MathEx.Point(1,0),s=new MathEx.Point(0,1),d=Math.acos(n.dotProduct(a));n.dotProduct(s)<0&&(d=2*Math.PI-d),this._edge1=d;var h=Math.acos(o.dotProduct(a));o.dotProduct(s)<0&&(h=2*Math.PI-h),this._edge2=h,h>d&&(this._edge1=Math.max(d,h),this._edge2=Math.min(d,h)+2*Math.PI),Math.abs(d-h)>Math.PI&&(this._edge1=Math.min(d,h),this._edge2=Math.max(d,h)-2*Math.PI);for(var p=this.Z97.properties(),c=1;c<=this.Z97.getCache().levelsCount();c++){var u="level"+c,_=p[u];if(_.visible.value()){var f=_.coeff.value(),g=_.color.value(),v=i.substract(t).length()*f,m=n.add(o).scaled(.5).normalized().scaled(v),y=t.add(m);this._levels.push({coeff:f,color:g,radius:v,labelPoint:y,p1:t.add(n.scaled(v)),p2:t.add(o.scaled(v)),linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),index:c})}}}},o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t=this.Z97.properties(),i=this._points,r=i[0],o=i[1],a={points:[r,o],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t.trendline.color.value(),linewidth:t.trendline.visible.value()?t.trendline.linewidth.value():0,linestyle:t.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};if(e.append(new p(a)),this._points.length<3)return this.addAnchors(e),e;var l=i[2],d=l.data,h=o.substract(r).length(),c=(o.substract(r).normalized(),l.substract(r).normalized());l=r.add(c.scaled(h)),l.data=d,a={points:[r,l],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t.trendline.color.value(),linewidth:t.trendline.visible.value()?t.trendline.linewidth.value():0,linestyle:t.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL},e.append(new p(a));
for(var u=this.Z98._fibWedgeLabelsCache,_=u.canvas().get(0),f=this._levels.length-1;f>=0;f--){var g=this._levels[f],v={};v.center=this._points[0],v.radius=g.radius,f>0?v.prevRadius=this._levels[f-1].radius:v.prevRadius=0,v.edge=this._edge,v.color=g.color,v.linewidth=g.linewidth,v.edge1=this._edge1,v.edge2=this._edge2,v.p1=g.p1,v.p2=g.p2,v.fillBackground=t.fillBackground.value(),v.transparency=t.transparency.value();var m=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,g.index);if(e.append(new n(v,m)),t.showCoeffs.value()){var y=this._cacheState.preparedCells.cells[this._levels[f].index-1];if(!y)continue;var w={left:y.left,top:u.topByRow(this._cacheState.row),width:y.width,height:u.rowHeight(this._cacheState.row)},T={left:Math.round(g.labelPoint.x-w.width),top:Math.round(g.labelPoint.y-w.height/2),width:y.width,height:w.height},b=new TradingView.PaneRendererCachedImage(_,w,T);e.append(b)}}if(this.isAnchorsRequired()){var i=[r,o];this.Z98.lineBeingCreated()!=this.Z97&&i.push(l),e.append(this.createLineAnchor({points:i}))}return e},inherit(a,s),a.LevelsCount=11,a.prototype.getCache=function(){return this.Z98._fibWedgeLabelsCache||(this.Z98._fibWedgeLabelsCache=new r),this.Z98._fibWedgeLabelsCache},a.prototype.pointsCount=function(){return 3},a.prototype.title=function(){return"Fib Wedge"},a.prototype.setPoint=function(e,t){if(s.prototype.setPoint.call(this,e,t),!this._recursiveGuard){if(this._recursiveGuard=!0,2==e){var i=this.pointToScreenPoint(this._points[0])[0],r=this.pointToScreenPoint(this._points[1])[0],n=this.pointToScreenPoint(this._points[2])[0],o=n.substract(i).length(),a=r.substract(i).normalized();r=i.add(a.scaled(o));var l=this.screenPointToPoint(r);this.Q0.points[1].price.setValue(l.price),this.Q0.points[1].bar.setValue(l.index)}else{var i=this.pointToScreenPoint(this._points[0])[0],r=this.pointToScreenPoint(this._points[1])[0],n=this.pointToScreenPoint(this._points[2])[0],d=r.substract(i).length(),a=n.substract(i).normalized();n=i.add(a.scaled(d));var l=this.screenPointToPoint(n);this.Q0.points[2].price.setValue(l.price),this.Q0.points[2].bar.setValue(l.index)}this._recursiveGuard=!1}},a.prototype.addPoint=function(e){if(2==this._points.length){var t=this.pointToScreenPoint(this._points[0])[0],i=this.pointToScreenPoint(this._points[1])[0];if(this.priceScale().isPercent()){var r=this.ownerSource().firstValue();e.price=this.priceScale().priceRange().convertFromPercent(e.price,r)}var n=this.pointToScreenPoint(e)[0],o=i.substract(t).length(),a=n.substract(t).normalized();n=t.add(a.scaled(o));var l=this.priceScale().coordinateToPrice(n.y),d=Math.round(this.Z98.timeScale().coordinateToIndex(n.x));e={index:d,price:l}}return s.prototype.addPoint.call(this,e)},a.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},a.prototype.createPropertiesObject=function(e,t,i){return new d(e,t,i,{range:[1,11]})},t.ArcWedgeRenderer=n,t.FibWedgePaneView=o,t.LineToolFibWedge=a},function(e,t,i){"use strict";function r(){h.call(this)}function n(e,t){a.call(this,e,t),this._rendererCache={}}function o(e,t){this._constructor="LineToolTrendBasedFibExtension";var i=t?t:new this.createPropertiesObject("linetooltrendbasedfibextension");s.call(this,e,new n(this,e),i),this.version=o.version,e._trendBasedFibExtensionLabelsCache||(e._trendBasedFibExtensionLabelsCache=new r)}var a=i(44),s=i(13).LineDataSource,l=i(9),d=i(12).RectangleTransparencyRenderer,h=i(98),p=i(55).TrendLineRenderer;inherit(r,h),r.prototype.levelsCount=function(){return o.LevelsCount},r.prototype.points=function(e){return[e.points()[0],e.points()[1]]},r.prototype.startPoint=function(e,t){return e.points()[2]},r.prototype.priceRange=function(e,t){var i=this.points(e),r=i[0],n=i[1],o=t?r.price-n.price:n.price-r.price;return o},r.prototype.sourceIsReady=function(e){return e.points().length>=3},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype._updateImpl=function(){if(a.prototype.update.call(this),this._cacheState=this.Z98._trendBasedFibExtensionLabelsCache.updateSource(this.Z97),!(this.Z97.points().length<3)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this.Z97.points()[0],t=this.Z97.points()[1],i=this.Z97.points()[2],r=!1,n=this.Z97.properties();n.reverse&&n.reverse.value()&&(r=n.reverse.value()),this._levels=[];var s,l=r?e.price-t.price:t.price-e.price;this.Z97.priceScale().isPercent()&&(s=this.Z97.ownerSource().firstValue());for(var d=1;d<=o.LevelsCount;d++){var h="level"+d,p=n[h];if(p.visible.value()){var c=p.coeff.value(),u=p.color.value(),_=i.price+c*l;this.Z97.priceScale().isPercent()&&(_=this.Z97.priceScale().priceRange().convertToPercent(_,s));var f=this.Z97.priceScale().priceToCoordinate(_);this._levels.push({color:u,y:f,linewidth:n.levelsStyle.linewidth.value(),linestyle:n.levelsStyle.linestyle.value(),index:d})}}}},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t=this._points[0],i=this._points[1],r=this.Z97.properties();if(r.trendline.visible.value()){var n={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:r.trendline.color.value(),linewidth:r.trendline.linewidth.value(),linestyle:r.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};e.append(new p(n))}if(this._points.length<3)return this.addAnchors(e),e;var o=this._points[2];if(r.trendline.visible.value()){var n={points:[i,o],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:r.trendline.color.value(),linewidth:r.trendline.linewidth.value(),linestyle:r.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};e.append(new p(n))}for(var a=Math.min(o.x,i.x),l=(Math.min(t.y,i.y),Math.max(o.x,i.x)),h=(Math.max(t.y,i.y),r.fillBackground.value()),c=r.transparency.value(),u=r.extendLines.value()?this.Z98.timeScale().width():l,_=this.Z98._trendBasedFibExtensionLabelsCache,f=_.canvas().get(0),g=0;g<this._levels.length;g++){if(g>0&&h){var v=this._levels[g-1],t=new MathEx.Point(a,this._levels[g].y),i=new MathEx.Point(u,v.y),m={};m.points=[t,i],m.color=this._levels[g].color,m.linewidth=0,m.backcolor=this._levels[g].color,m.fillBackground=!0,m.transparency=c,e.append(new d(m))}var t=new MathEx.Point(a,this._levels[g].y),i=new MathEx.Point(l,this._levels[g].y),n={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this._levels[g].color,linewidth:this._levels[g].linewidth,linestyle:this._levels[g].linestyle,extendleft:!1,extendright:r.extendLines.value(),leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL},y=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,this._levels[g].index);if(e.append(new p(n,y)),r.showCoeffs.value()||r.showPrices.value()){var w=this._cacheState.preparedCells.cells[this._levels[g].index-1];if(!w)continue;var T;switch(r.horzLabelsAlign.value()){case"left":T=t;break;case"center":T=t.add(i).scaled(.5),T.x+=w.width/2,T.x=Math.round(T.x);break;case"right":r.extendLines.value()?T=new MathEx.Point(u-4,this._levels[g].y):(T=new MathEx.Point(u+4,this._levels[g].y),T.x+=w.width,T.x=Math.round(T.x))}var b={left:w.left,top:_.topByRow(this._cacheState.row),width:w.width,height:_.rowHeight(this._cacheState.row)},S={left:T.x-b.width,top:T.y,width:w.width,height:b.height},C=r.vertLabelsAlign.value();"middle"==C&&(S.top-=S.height/2),"bottom"==C&&(S.top-=S.height);var x=new TradingView.PaneRendererCachedImage(f,b,S);e.append(x)}}return this.addAnchors(e),e},inherit(o,s),o.version=2,o.LevelsCount=24,o.prototype.stop=function(){s.prototype.stop.call(this),this.Z98._trendBasedFibExtensionLabelsCache.removeSource(this.id())},o.prototype.pointsCount=function(){return 3},o.prototype.title=function(){return"Trend-Based Fib Extension"},o.prototype.migrateVersion=function(e,t,i){1==e&&this.properties().extendLines.setValue(!0)},o.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},o.prototype.createPropertiesObject=function(e,t,i){return new l(e,t,i,{range:[0,8]})},TradingView.LineToolTrendBasedFibExtension=o,e.exports=o},function(e,t,i){"use strict";function r(e,t,i){this.customization={forcePriceAxisLabel:!0,disableSelection:!0,disableErasing:!0},n.call(this,e,t,i)}var n=i(13).LineDataSource;inherit(r,n),r.POINTS_COUNT=1,r.prototype.pointsCount=function(){return r.POINTS_COUNT},r.prototype.hasContextMenu=function(){return!1},r.prototype.state=function(){return null},r.prototype.startMoving=function(){n.prototype.startMoving.apply(this,arguments),this._cursorMoved=!1},r.prototype.endMoving=function(){n.prototype.endMoving.apply(this,arguments),this._cursorMoved=!1},r.prototype.correctPoints=function(e){this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.price-this._startMovingPoint.price&&(this._cursorMoved=!0):this._cursorMoved=!1;for(var t=this.priceScale(),i=t.mainSource().base(),r=1/i,n=0;n<e.length;n++){var o=e[n];this._cursorMoved&&(o.price=this._currentMovingPoint.price),o.price=r*Math.round(o.price/r),e[n]=o}},r.prototype.userEditEnabled=function(){return!0},r.prototype.isUserDeletable=function(){return!1},r.prototype.showInObjectTree=function(){return!1},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){var n="VbPFixed@tv-volumebyprice",o=TradingView.Study.lineToolNameForPointsBasedStudy(n),i=i?i:TradingView.StudyMetaInfo.findStudyMetaInfo(e.studiesMetaData(),n),l=e.studyVersioning(),h=t?t:d(i,null,null,l);this._metaInfo=i,this.m_data=new TradingView.PlotList,this._plotOffsets={},this._plotOffsetsMetaInfoOverride={};var p=this,c=new s(p,e),u=new TradingView.Study.StudyPaneView_hhists(p,e),_=new TradingView.Study.StudyPaneView_horizlines(p,e),f=new TradingView.Study.StudyPaneView_polygons(p,e),g=[c,u,_,f];if(r=e.mainSeries(),i.plots.length>0){var v=new Z31(p,r,e,i.plots[0].id);g.push(v)}if(i.plots.length>1){var m=new Z31(p,r,e,i.plots[1].id);g.push(m)}if(i.plots.length>2){var y=new Z31(p,r,e,i.plots[2].id);g.push(y)}a.call(this,e,g,h,o),this._turnaroundCounter=1,this._turnaround="vbpfixed_"+this._turnaroundCounter,this._metaInfo=i,this._graphics=new $61(i),this._plotFields=[];var w=this.metaInfo().plots;if(w)for(var T=0,b=w.length;b>T;T++){var S=w[T].id;this._plotFields.push(S)}this.clearData(),this._formatter=new TradingView.VolumeFormatter}var n=i(85),o=i(13).LineDataSource,a=n.StudyLineDataSource,s=n.StudyLineDataSourcePaneView,l=i(74),d=l.prepareStudyProperties;inherit(r,a),r.prototype.pointsCount=function(){return 2},r.prototype._requestStudy=function(){var e=this.points()[0],t=this.points()[1],i=Math.min(e.index,t.index),r=Math.max(e.index,t.index);if(i===r)return void this.clearData();var n=this.Z98.mainSeries().bars().valueAt(i),o=this.Z98.mainSeries().bars().valueAt(r);if(n&&o){var a=1e3*n[TradingView.TIME_PLOT],s=1e3*o[TradingView.TIME_PLOT],l=[];void 0!==this.properties().inputs.rowsLayout&&l.push(this.properties().inputs.rowsLayout.value()),l.push(this.properties().inputs.rows.value()),l.push(this.properties().inputs.volume.value()),l.push(a),l.push(s),l.push(this.properties().inputs.vaVolume.value());var d=this;this._studyId?(this._turnaround="vbpfixed_"+ ++this._turnaroundCounter,this.Z98.chartApi().modifyStudy(this._studyId,this._turnaround,l,function(e){d.onData(e)})):(this._studyId=TradingView.Study.makeNextStudyId(),this.Z98.chartApi().createStudy(this._studyId,this._turnaround,this.Z98.mainSeries()._seriesId,this._metaInfo.id+"-1!",l,function(e){d.onData(e)}))}},r.prototype.onData=function(e){if("data_update"===e.method&&e.params.customId==="pointset_"+this._currentPointsetId)o.prototype.onData.call(this,e),2==this._points.length&&this._requestStudy();else if("data_update"===e.method&&e.params.customId===this._studyId){if(!this._checkTurnaround(e.params.turnaround))return;e.params.nonseries.d=TradingView.Study.prototype._makeJSONForNSData.call(this,e),this._processPlotOffsets(e.params),this._mergeData(e.params.plots),""!==e.params.nonseries.d&&(this._graphics.process(e.params.nonseries),this._correctPoints(this._graphics.graphics())),e.params.nonseries.indexes.length>0&&(this._indexes=e.params.nonseries.indexes),this.updateAllViews(),this.Z98.updateSource(this)}},r.prototype._correctPoints=function(e){if(e&&(void 0===e.indexes||0!==e.indexes.length)&&e.hhists){for(var t=e.hhists[0].data,i=null,r=null,n=0;n<t.length;++n){var o=t[n].priceLow,a=t[n].priceHigh;(!i||i>o)&&(i=o),(!r||a>r)&&(r=a)}this._points[0].price=r,this._points[1].price=i}},r.prototype.calcIsActualSymbol=function(){this._isActualSymbol=!0,this.calcIsActualInterval()},r.prototype.formatter=function(){return this._formatter},r.prototype.isSelfColorerPlot=function(e){return TradingView.Study.isSelfColorerPlot(this,e)},r.prototype.offset=function(e){return TradingView.Study.offset(this,e)},r.prototype.data=function(){return this.m_data},r.prototype._processPlotOffsets=function(e){TradingView.Study.processPlotOffsets(this,e)},r.prototype._mergeData=function(e){this.m_data.merge(e)},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){var r=this._mtpStudyId()+"@mtp-mtpredictor",n=i||TradingView.StudyMetaInfo.findStudyMetaInfo(e.studiesMetaData(),r),a=t||l(n,null,null,e.studyVersioning()),s=TradingView.Study.lineToolNameForPointsBasedStudy(r);o.call(this,e,this.createPaneViews(e),a,s),this._doNotNeedLine=!0,this._turnaroundCounter=0,this._nextTurnaround(),this._metaInfo=n,this._graphics=new $61(n),this._formatter=new TradingView.VolumeFormatter}var n=i(85),o=n.StudyLineDataSource,a=n.StudyLineDataSourcePaneView,s=i(74),l=s.prepareStudyProperties,d=i(13).LineDataSource;inherit(r,o),r.prototype.series=function(){return TradingView.isInherited(this._ownerSource.constructor,TradingView.Series)?this._ownerSource:this._ownerSource.series()},r.prototype.calcIsActualSymbol=function(){return d.prototype.calcIsActualSymbol.call(this)},r.prototype._nextTurnaround=function(){this._turnaround=this._mtpStudyId()+"_"+ ++this._turnaroundCounter},r.prototype.createPaneViews=function(e){return[new a(this,e),new TradingView.Study.StudyPaneView_textmarks(this,e),new TradingView.Study.StudyPaneView_polygons(this,e),new TradingView.Study.StudyPaneView_lines(this,e)]},r.prototype.onData=function(e){if("data_update"===e.method&&e.params.customId==="pointset_"+this._currentPointsetId)d.prototype.onData.call(this,e),this._points.length==this.pointsCount()&&this._requestStudy();else if("data_update"===e.method&&e.params.customId===this._studyId){if(!this._checkTurnaround(e.params.turnaround))return;e.params.nonseries.d=TradingView.Study.prototype._makeJSONForNSData.call(this,e),""!==e.params.nonseries.d&&this._graphics.process(e.params.nonseries),e.params.nonseries.indexes.length>0&&(this._indexes=e.params.nonseries.indexes),this.updateAllViews(),this.Z98.updateSource(this)}},r.prototype._requestStudy=function(){var e=this,t=function(t){e.onData(t)},i=this._studyInputs();i&&(this._studyId?(this._nextTurnaround(),this.Z98.chartApi().modifyStudy(this._studyId,this._turnaround,i,t)):(this._studyId=TradingView.Study.makeNextStudyId(),this.Z98.chartApi().createStudy(this._studyId,this._turnaround,this.Z98.mainSeries()._seriesId,this._metaInfo.id+"-1!",i,t)))},e.exports=r},function(e,t,i){"use strict";function r(e,t){a.call(this,e,t),this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolTrendBasedFibTime";var i=t?t:new this.createPropertiesObject("linetooltrendbasedfibtime");s.call(this,e,new r(this,e),i),this.version=n.version}var o=i(86).VertLineRenderer,a=i(44),s=i(13).LineDataSource,l=i(9),d=i(45).TextRenderer,h=i(12).RectangleTransparencyRenderer,p=i(55).TrendLineRenderer;inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(a.prototype.update.call(this),!(this.Z97.points().length<3)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this.Z97.points()[0],t=this.Z97.points()[1],i=this.Z97.points()[2];if(this._levels=[],t.index!=e.index){var r=t.index-e.index,n=this.Z97.properties(),o=i.index,s=this.Z98.timeScale().visibleBars();if(!s.isEmpty())for(var l=1;11>=l;l++){var d="level"+l,h=n[d];if(h.visible.value()){var p=h.coeff.value(),c=h.color.value(),u=Math.round(o+p*r),_=this.Z98.timeScale().indexToCoordinate(u),f={x:_,coeff:p,color:c,linewidth:h.linewidth.value(),linestyle:h.linestyle.value(),index:l};n.showCoeffs.value()&&(f.text=p,f.y=this.Z97.priceScale().height()),this._levels.push(f)}}}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t=this._points[0],i=this._points[1],r=this.Z97.properties();if(r.trendline.visible.value()){var n={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:r.trendline.color.value(),linewidth:r.trendline.linewidth.value(),linestyle:r.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};e.append(new p(n))}if(this._points.length<3)return this.addAnchors(e),e;var a=this._points[2];if(r.trendline.visible.value()){var n={points:[i,a],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:r.trendline.color.value(),linewidth:r.trendline.linewidth.value(),linestyle:r.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};e.append(new p(n))}for(var l=r.fillBackground.value(),c=r.transparency.value(),u=0;u<this._levels.length;u++){if(u>0&&l){var _=this._levels[u-1],t=new MathEx.Point(_.x,0),i=new MathEx.Point(this._levels[u].x,this.Z97.priceScale().height()),f={};f.points=[t,i],f.color=this._levels[u].color,f.linewidth=0,f.backcolor=this._levels[u].color,f.fillBackground=!0,f.transparency=c,e.append(new h(f))}if(void 0!==this._levels[u].text){var g,v,m,y=r.horzLabelsAlign.value();switch(y="left"==y?"right":"right"==y?"left":"center"){case"left":v=3;break;case"center":v=0;break;case"right":v=-3}switch(r.vertLabelsAlign.value()){case"top":g=new MathEx.Point(this._levels[u].x,0),m=5;break;case"middle":g=new MathEx.Point(this._levels[u].x,.5*this._levels[u].y),m=0;break;case"bottom":g=new MathEx.Point(this._levels[u].x,this._levels[u].y),m=-10}var w={points:[g],text:""+this._levels[u].text,color:this._levels[u].color,vertAlign:"middle",horzAlign:y,font:r.font.value(),offsetX:v,offsetY:m,fontsize:12};e.append(new d(w,this._rendererCache))}var T={};T.points=[new MathEx.Point(this._levels[u].x,0)],T.color=this._levels[u].color,T.linewidth=this._levels[u].linewidth,T.linestyle=this._levels[u].linestyle;var b=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,this._levels[u].index);e.append(new o(T,b))}return this.addAnchors(e),e},inherit(n,s),n.version=1,n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Trend-Based Fib Time"},n.prototype.migrateVersion=function(e,t,i){},n.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},n.prototype.createPropertiesObject=function(e,t,i){return new l(e,t,i,{range:[1,11]})},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._levels=[],this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolFibTimeZone";var i=t?t:new this.createPropertiesObject("linetoolfibtimezone");a.call(this,e,new r(this,e),i),this.version=n.version}var o=i(44),a=i(13).LineDataSource,s=i(86).VertLineRenderer,l=i(9),d=i(45).TextRenderer,h=i(12).RectangleTransparencyRenderer,p=i(55).TrendLineRenderer;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),!(this.Z97.points().length<1)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e,t=this.Z97.points()[0];2===this.Z97.points().length&&(e=this.Z97.points()[1]);var i=this.Z97.properties(),r=this.Z97.points()[0].index,n=this.Z98.timeScale().visibleBars();if(!n.isEmpty()){this._levels=[];for(var a=e?e.index-t.index:1,s=1;11>=s;s++){var l=i["level"+s];if(l.visible.value()){var d=Math.round(r+l.coeff.value()*a),h=this.Z98.timeScale().indexToCoordinate(d),p={index:s,x:h,color:l.color.value(),width:l.linewidth.value(),style:l.linestyle.value()};i.showLabels.value()&&(p.text=l.coeff.value(),p.y=this.Z97.priceScale().height()),this._levels.push(p)}}}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=this.Z97.properties(),i=0;i<this._levels.length;i++){var r={};r.points=[new MathEx.Point(this._levels[i].x,0)],r.color=this._levels[i].color,r.linewidth=this._levels[i].width,r.linestyle=this._levels[i].style;var n=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,this._levels[i].index);if(e.append(new s(r,n)),i>0&&t.fillBackground.value()){var o=this._levels[i-1],l=new MathEx.Point(this._levels[i].x,0),c=new MathEx.Point(o.x,this.Z97.priceScale().height()),u={};u.points=[l,c],u.color=this._levels[i].color,u.linewidth=0,u.backcolor=this._levels[i].color,u.fillBackground=!0,u.transparency=t.transparency.value(),e.append(new h(u))}if(void 0!==this._levels[i].text){var _,f,g,v=t.horzLabelsAlign.value();switch(v="left"==v?"right":"right"==v?"left":"center"){case"left":f=3;break;case"center":f=0;break;case"right":f=-3}switch(t.vertLabelsAlign.value()){case"top":_=new MathEx.Point(this._levels[i].x,0),g=5;break;case"middle":_=new MathEx.Point(this._levels[i].x,.5*this._levels[i].y),g=0;break;case"bottom":_=new MathEx.Point(this._levels[i].x,this._levels[i].y),g=-10}var m={points:[_],text:""+this._levels[i].text,color:r.color,vertAlign:"middle",horzAlign:v,font:t.font.value(),offsetX:f,offsetY:g,fontsize:12};e.append(new d(m,this._rendererCache))}}if(2===this._points.length){var y={points:[this._points[0],this._points[1]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t.trendline.color.value(),linewidth:t.trendline.linewidth.value(),linestyle:t.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};e.append(new p(y))}return this.isAnchorsRequired()&&(2===this.Z97.points().length?e.append(this.createLineAnchor({points:this._points})):this._points.length>0&&e.append(this.createLineAnchor({points:[new MathEx.Point(this._points[0].x,this.Z97.priceScale().height()/2)],hittestResult:TradingView.HitTestResult.MOVEPOINT}))),e},inherit(n,a),n.version=2,n.prototype.migrateVersion=function(e,t,i){if(1===e){i.properties.level1.color.setValue(i.properties.baselinecolor.value());for(var r=2;11>=r;r++)i.properties["level"+r].color.setValue(i.properties.linecolor.value());for(var r=1;11>=r;r++)i.properties["level"+r].linewidth.setValue(i.properties.linewidth.value()),i.properties["level"+r].linestyle.setValue(i.properties.linestyle.value())}},n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Fib Time Zone"},n.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},n.prototype.createPropertiesObject=function(e,t,i){return new l(e,t,i,{range:[1,11]})},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._lines=[],this._invalidated=!0}function n(e,t){this._constructor="LineToolCircleLines";var i=t?t:new J50("linetoolcirclelines");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(86).VertLineRenderer,l=i(55).TrendLineRenderer;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),!(this.Z97.points().length<2)){var e=this.Z98.timeScale();if(this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!e.isEmpty()){var t=this.Z97.points()[0],i=this.Z97.points()[1],r=i?i.index-t.index:1;if(this._lines=[],0!==r){var n=e.visibleBars();if(r>0)for(var a=t.index,s=a;s<=n.lastBar();s+=r)this._lines.push({x:e.indexToCoordinate(s)});else for(var a=t.index,s=a;s>=n.firstBar();s+=r)this._lines.push({x:e.indexToCoordinate(s)})}}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t=this._points[0],i=this._points[1],r=this.Z97.properties(),n={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:r.trendline.color.value(),linewidth:r.trendline.linewidth.value(),linestyle:r.trendline.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};e.append(new l(n));for(var r=this.Z97.properties(),o=0;o<this._lines.length;o++){var d={points:[new MathEx.Point(this._lines[o].x,0)],color:r.linecolor.value(),linewidth:r.linewidth.value(),linestyle:r.linestyle.value()};e.append(new s(d))}if(this.isAnchorsRequired())if(2===this.Z97.points().length){var h=[].concat(this._points);e.append(this.createLineAnchor({points:h}))}else e.append(this.createLineAnchor({points:[new MathEx.Point(this._points[0].x,this.Z97.priceScale().height()/2)],hittestResult:TradingView.HitTestResult.MOVEPOINT}));return e},inherit(n,a),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Cyclic Lines"},e.exports=n},function(e,t,i){"use strict";function r(e,t){a.call(this,e,t),this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolDateRange";var i=t?t:new J50("linetooldaterange");o.call(this,e,new r(this,e),i)}var o=i(13).LineDataSource,a=i(44),s=i(45).TextRenderer,l=i(12).RectangleRenderer,d=i(55).TrendLineRenderer;inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},r.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer;if(this._points.length<2||this.Z97.points().length<2)return e;var t=this.Z97.properties();if(t.fillBackground&&t.fillBackground.value()){var i={};i.points=this._points,i.color="white",i.linewidth=0,i.backcolor=t.backgroundColor.value(),i.fillBackground=!0,i.transparency=t.backgroundTransparency.value(),e.append(new l(i))}var r=this,n=function(t,i){var n={};n.points=[t,i],n.width=r.Z98.timeScale().width(),n.height=r.Z97.priceScale().height(),n.color=r.Z97.properties().linecolor.value(),n.linewidth=r.Z97.properties().linewidth.value(),n.linestyle=CanvasEx.LINESTYLE_SOLID,n.extendleft=!1,n.extendright=!1,n.leftend=o.LINEEND_NORMAL,n.rightend=o.LINEEND_NORMAL,e.append(new d(n))},a=this._points[0],h=this._points[1];n(a,new MathEx.Point(a.x,h.y)),n(new MathEx.Point(h.x,a.y),h);var p=(a.y+h.y)/2,c=new MathEx.Point(a.x,p),u=new MathEx.Point(h.x,p),i={};i.points=[c,u],i.width=r.Z98.timeScale().width(),i.height=r.Z97.priceScale().height(),i.color=r.Z97.properties().linecolor.value(),i.linewidth=r.Z97.properties().linewidth.value(),i.linestyle=CanvasEx.LINESTYLE_DASHED,i.extendleft=!1,i.extendright=!1,i.leftend=o.LINEEND_NORMAL,i.rightend=o.LINEEND_ARROW,e.append(new d(i));var _=this.Z97.points()[0].index,f=this.Z97.points()[1].index,g=f-_,v=this.Z98.timeScale().indexToUserTime(_),m=this.Z98.timeScale().indexToUserTime(f),y="";if(v&&m)var w=(m.valueOf()-v.valueOf())/1e3,y=", "+(new TradingView.TimeSpanFormatter).format(w);var T=$.t("{0} bars").format(g)+y,i={},b={x:0,y:10};i.text=T,i.color=t.textcolor.value(),i.height=r.Z97.priceScale().height(),i.font=t.font.value(),i.offsetX=b.x,i.offsetY=b.y,i.vertAlign="middle",i.horzAlign="center",i.fontsize=t.fontsize.value(),i.backgroundRoundRect=4,i.backgroundHorzInflate=.4*t.fontsize.value(),i.backgroundVertInflate=.2*t.fontsize.value(),t.fillLabelBackground&&t.fillLabelBackground.value()&&(i.backgroundColor=t.labelBackgroundColor.value(),i.backgroundTransparency=1-t.labelBackgroundTransparency.value()/100||0),t.drawBorder&&t.drawBorder.value()&&(i.borderColor=t.borderColor.value());var S=.5*(a.x+h.x),C=h.y,x=new MathEx.Point(S,C),P=new s(i,this._rendererCache),L=P.measure(),E={x:S+i.backgroundHorzInflate+L.textBgPadding-L.width/L.textBgPadding,y:a.y>h.y?x.y-L.height-2*L.textBgPadding-b.y>0?C-L.height-b.y-2*L.textBgPadding:b.y-2*L.textBgPadding:x.y+L.height+L.textBgPadding+b.y>i.height?i.height-L.height-b.y:C+L.textBgPadding};return P.setPoints([new MathEx.Point(S,E.y)]),e.append(P),this.addAnchors(e),e},inherit(n,o),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Date Range"},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._invalidated=!0,this._percentageFormatter=new TradingView.PercentageFormatter}function n(e,t){this._constructor="LineToolPriceRange";var i=t?t:new J50("linetoolpricerange");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(45).TextRenderer,l=i(12).RectangleRenderer,d=i(55).TrendLineRenderer;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){o.prototype.update.call(this)},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2||this.Z97.points().length<2)return e;var t,i,r=this.Z97.properties();if(r.fillBackground&&r.fillBackground.value()){var n={};n.points=this._points,n.color="white",n.linewidth=0,n.backcolor=r.backgroundColor.value(),n.fillBackground=!0,n.transparency=r.backgroundTransparency.value(),e.append(new l(n))}var t,i,o=this,h=function(t,i){var r={};r.points=[t,i],r.width=o.Z98.timeScale().width(),r.height=o.Z97.priceScale().height(),r.color=o.Z97.properties().linecolor.value(),r.linewidth=o.Z97.properties().linewidth.value(),r.linestyle=CanvasEx.LINESTYLE_SOLID,r.extendleft=!1,r.extendright=!1,r.leftend=a.LINEEND_NORMAL,r.rightend=a.LINEEND_NORMAL,e.append(new d(r))};t=this._points[0],i=this._points[1],i=new MathEx.Point(i.x,t.y),h(t,i),t=this._points[0],i=this._points[1],t=new MathEx.Point(t.x,i.y),h(t,i);var t=this._points[0],i=this._points[1],p=(t.x+i.x)/2,c=new MathEx.Point(p,t.y),u=new MathEx.Point(p,i.y),n={};n.points=[c,u],n.width=o.Z98.timeScale().width(),n.height=o.Z97.priceScale().height(),n.color=o.Z97.properties().linecolor.value(),n.linewidth=o.Z97.properties().linewidth.value(),n.linestyle=CanvasEx.LINESTYLE_DASHED,n.extendleft=!1,n.extendright=!1,n.leftend=a.LINEEND_NORMAL,n.rightend=a.LINEEND_ARROW,e.append(new d(n));var _=this.Z97.points()[0].price,f=this.Z97.points()[1].price,g=f-_,v=100*g/_,m=this.Z97.priceScale().formatter().format(g)+" ("+this._percentageFormatter.format(v)+")",n={};if(f>_){var y=i.clone();y.y-=2*r.fontsize.value(),y.x=.5*(t.x+i.x),n.points=[y]}else{var y=i.clone();y.x=.5*(t.x+i.x),y.y+=.7*r.fontsize.value(),n.points=[y]}var w={x:0,y:10};n.text=m,n.color=r.textcolor.value(),n.height=o.Z97.priceScale().height(),n.font=r.font.value(),n.offsetX=w.x,n.offsetY=w.y,n.vertAlign="middle",n.horzAlign="center",n.fontsize=r.fontsize.value(),n.backgroundRoundRect=4,n.backgroundHorzInflate=.4*r.fontsize.value(),
n.backgroundVertInflate=.2*r.fontsize.value(),r.fillLabelBackground&&r.fillLabelBackground.value()&&(n.backgroundColor=r.labelBackgroundColor.value(),n.backgroundTransparency=1-r.labelBackgroundTransparency.value()/100||0),r.drawBorder&&r.drawBorder.value()&&(n.borderColor=r.borderColor.value());var T=.5*(t.x+i.x),b=i.y,S=new MathEx.Point(T,b),C=new s(n,this._rendererCache),x=C.measure(),P={x:T+n.backgroundHorzInflate+x.textBgPadding-x.width/x.textBgPadding,y:t.y>i.y?S.y-x.height-2*x.textBgPadding-w.y>0?b-x.height-w.y-2*x.textBgPadding:w.y-2*x.textBgPadding:S.y+x.height+x.textBgPadding+w.y>n.height?n.height-x.height-w.y:b+x.textBgPadding};return C.setPoints([new MathEx.Point(T,P.y)]),e.append(C),this.addAnchors(e),e},inherit(n,a),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Price Range"},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._percentageFormatter=new TradingView.PercentageFormatter,this._invalidated=!0}function n(e,t){this._constructor="LineToolDateAndPriceRange";var i=t?t:new J50("linetooldateandpricerange");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(45).TextRenderer,l=i(12).RectangleRenderer,d=i(55).TrendLineRenderer;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){o.prototype.update.call(this),this._invalidated=!1},r.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer;if(this._points.length<2||this.Z97.points().length<2)return e;var t=this.Z97.properties();if(t.fillBackground&&t.fillBackground.value()){var i={};i.points=this._points,i.color="white",i.linewidth=0,i.backcolor=t.backgroundColor.value(),i.fillBackground=!0,i.transparency=t.backgroundTransparency.value(),e.append(new l(i))}var r=this,n=function(t,i){var n={};n.points=[t,i],n.width=r.Z98.timeScale().width(),n.height=r.Z97.priceScale().height(),n.color=r.Z97.properties().linecolor.value(),n.linewidth=r.Z97.properties().linewidth.value(),n.linestyle=CanvasEx.LINESTYLE_SOLID,n.extendleft=!1,n.extendright=!1,n.leftend=a.LINEEND_NORMAL,n.rightend=a.LINEEND_NORMAL,e.append(new d(n))},o=this._points[0],h=this._points[1];n(o,new MathEx.Point(h.x,o.y)),n(new MathEx.Point(o.x,h.y),h),n(o,new MathEx.Point(o.x,h.y)),n(new MathEx.Point(h.x,o.y),h);var p=(o.y+h.y)/2,c=new MathEx.Point(o.x,p),u=new MathEx.Point(h.x,p),i={};i.points=[c,u],i.width=r.Z98.timeScale().width(),i.height=r.Z97.priceScale().height(),i.color=r.Z97.properties().linecolor.value(),i.linewidth=r.Z97.properties().linewidth.value(),i.linestyle=CanvasEx.LINESTYLE_DASHED,i.extendleft=!1,i.extendright=!1,i.leftend=a.LINEEND_NORMAL,i.rightend=a.LINEEND_ARROW,e.append(new d(i));var o=this._points[0],h=this._points[1],_=(o.x+h.x)/2,c=new MathEx.Point(_,o.y),u=new MathEx.Point(_,h.y),i={};i.points=[c,u],i.width=r.Z98.timeScale().width(),i.height=r.Z97.priceScale().height(),i.color=r.Z97.properties().linecolor.value(),i.linewidth=r.Z97.properties().linewidth.value(),i.linestyle=CanvasEx.LINESTYLE_DASHED,i.extendleft=!1,i.extendright=!1,i.leftend=a.LINEEND_NORMAL,i.rightend=a.LINEEND_ARROW,e.append(new d(i));var f=this.Z97.points()[0].price,g=this.Z97.points()[1].price,v=g-f,m=100*v/f,y=this.Z97.points()[0].index,w=this.Z97.points()[1].index,T=w-y,b=this.Z98.timeScale().indexToUserTime(y),S=this.Z98.timeScale().indexToUserTime(w),C="";if(b&&S)var x=(S.valueOf()-b.valueOf())/1e3,C=", "+(new TradingView.TimeSpanFormatter).format(x);var P=this.Z97.priceScale().formatter().format(v)+" ("+this._percentageFormatter.format(Math.round(100*m)/100)+")\n"+$.t("{0} bars").format(T)+C,i={};if(g>f){var L=h.clone();L.y-=2*t.fontsize.value(),L.x=.5*(o.x+h.x),i.points=[L]}else{var L=h.clone();L.x=.5*(o.x+h.x),L.y+=.7*t.fontsize.value(),i.points=[L]}var E={x:0,y:10};i.text=P,i.color=t.textcolor.value(),i.height=r.Z97.priceScale().height(),i.font=t.font.value(),i.offsetX=E.x,i.offsetY=E.y,i.padding=5,i.vertAlign="middle",i.horzAlign="center",i.fontsize=t.fontsize.value(),i.backgroundRoundRect=4,i.backgroundHorzInflate=.4*t.fontsize.value(),i.backgroundVertInflate=.2*t.fontsize.value(),t.fillLabelBackground&&t.fillLabelBackground.value()&&(i.backgroundColor=t.labelBackgroundColor.value(),i.backgroundTransparency=1-t.labelBackgroundTransparency.value()/100||0),t.drawBorder&&t.drawBorder.value()&&(i.borderColor=t.borderColor.value());var V=.5*(o.x+h.x),I=h.y,A=new MathEx.Point(V,I),k=new s(i,this._rendererCache),R=k.measure(),M={x:V+i.backgroundHorzInflate+R.textBgPadding-R.width/R.textBgPadding,y:o.y>h.y?A.y-R.height-2*R.textBgPadding-E.y>0?I-R.height-E.y+R.textBgPadding:E.y-2*R.textBgPadding:A.y+R.height+R.textBgPadding+E.y>i.height?i.height-R.height-E.y:I+R.textBgPadding};return window.t1=r.Z97.priceScale().height(),window.t2=A.y+R.height+2*R.textBgPadding+E.y,k.setPoints([new MathEx.Point(V,M.y)]),e.append(k),this.addAnchors(e),e},inherit(n,a),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Date and Price Range"},e.exports=n},function(e,t,i){"use strict";function r(e,t){var i=t?t:new J50("linetoolarrowmark");l.call(this,e,new h(this,e,this.image,this.width,this.height,this.offsetX,this.offsetY),i)}function n(e,t){this._constructor="LineToolArrowMarkLeft",r.call(this,e,t),this._textPaneView=new d(this,e,22,-3,"middle","left"),this._textPaneView._noSelection=!0}function o(e,t){this._constructor="LineToolArrowMarkUp",r.call(this,e,t),this._textPaneView=new d(this,e,0,18,"top","center"),this._textPaneView._noSelection=!0}function a(e,t){this._constructor="LineToolArrowMarkRight",r.call(this,e,t),this._textPaneView=new d(this,e,-22,-3,"middle","right"),this._textPaneView._noSelection=!0}function s(e,t){this._constructor="LineToolArrowMarkDown",r.call(this,e,t),this._textPaneView=new d(this,e,0,-23,"bottom","center"),this._textPaneView._noSelection=!0}var l=i(13).LineDataSource,d=i(45).TextPaneView,h=i(114);inherit(r,l),r.prototype.width=21,r.prototype.height=21,r.prototype.offsetX=0,r.prototype.offsetY=0,r.prototype.paneViews=function(e){var t=l.prototype.paneViews.call(this,e);return null!==t&&this._textPaneView&&t.push(this._textPaneView),t},r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return"Arrow Mark"},inherit(n,r),n.prototype.image=new Image,n.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB50lEQVR4AWMgETAKKAgIAGkQ5mCgAmCWdtTWV4yxvgFkWwKxOKUGssr5Gccrx9t+Vk6w+w/kxwKxIrmGMTKIivIohFvONKsI+e/cl/ofamgGECuTYyCTqJ2mqlK01Vnr+uj/HjNy/1v1J8AMzSTHUBYZP6MgpTjb97bNsf9dpmf9N++J/W/UEQEztAiIbUEGo2EpIObE8C4oVuVDzLuBmv869aT8t5+c+t+0K/q/YXs4GGsWeIAMRscwy/yhBiO8K2ijJKcYZXXYuj7qv/u0nP/W/Yn/jTsjQYYRwliDhUXKy8BVKdbmuW1T7H+3Gdn/LXrjQN4FaSDLUBa5MItyoOAvp67k/45T0pC9S56hSrHWhY4tif9D5pUDXZjz36w7Blkx+S5VDLNoBUWMY3fKfwdExMAw+WEq7Wvkoxhn+waUhFwRSYhcQxGxL26jpqQYbX3CBpjY3aeDYj+BothHpFNxcW75cIvJpmXB/516Uv/bT0r5b9IVRUY6xQSssr6GkcAc9dGuNe6/y7RMMnMUJmCWcNTSBgbHZeuG6P+eM/P+W/VRlPcRwSGoJMgvH265yKIq/L9LfzqKoZSXp0Em6cDy9BvU0Dhyy1PM4PAwMFWKs7kFZFsBsQQDlQAjr4a0MJAWxFdHAQAcI3sGHsO1dgAAAABJRU5ErkJggg==",n.prototype.offsetX=1,n.prototype.offsetY=-10,n.prototype.title=function(){return"Arrow Mark Left"},inherit(o,r),o.prototype.image=new Image,o.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAACBklEQVR4AWMgErAoxVoXgmgGKgEWxTCLVseWxP9yYRbl1DCYSdrXyEc5we5vyLzy/0D6l5SXgStInFwDGcVt1JQU42zfOHan/HebkfPfqSv5v1KszXNBGyU5kDzpRoqLcytGW5+wbY797zA59b9Zd8x/xylp/22bYv8rRlkdBqrgINVIVvlwi8k29dH/Xadn/Tftiv5v2B4Opt1mZP+3ro/6Lx9i3k1K+DLL+hpGmpYF/3efnvPfvCcWZCAcW/TG/XeflvMfFM4yfkZBxIQvo4SjlrZSnO1Hp57U/9b9Cf+NOiKQDQXxgeKJ/516Uv4D1b0XtdNUxRu+gkqC/MBwvGzXGvffflLKf+POSISBCAwWtweGMyi8laKtzjKIivLgCUfLRdYN0f9dpmX+N+mKghiCieHh6wIMb2tguCuEW84E6ccIR7kgk3SLqvD/njPzYOFICIPVeczI/W9WEfJfzs84HmQOIhw9DEyV422/ufSn/7fqg4cjIQxWZwUMd+e+1P9A/Z+lHbX1weHLqyEtrBRncwsYm/+RsWaBBz4DwfLoehRjrG8IKAgIgOMHiK2AOA6IM6G4CKgIr6EgeZA6qPoMII4FYksgFmCA5gwJIFYEYmUotiXSUFuYHqh+cXw5TZlIQ5WxaR4mhuLBZBkqBcT+oJjFg/3B6kgAnFANyniwFEQdJgAAOuN7Bp7MBuYAAAAASUVORK5CYII=",o.prototype.offsetX=-9,o.prototype.offsetY=0,o.prototype.title=function(){return"Arrow Mark Up"},inherit(a,r),a.prototype.image=new Image,a.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB60lEQVR4AWPAAziAWJBXQ1oYSDMyUAlIALGVUpzNLQkPA1Mgm5kahioCcZxygt1/5Xjbb3JBJulAPiulhioDcSbIUJf+9P8WVeH/5cMtFwkqCfKDgoNiQ636Ev57zsz7b90Q/V8x2vqyhKOWNqHg4ARiKZAhaNgWiItAhhp1RPw374n97zIt879da9x/pTjbj7K+hpE4gwNqoD9IMzasWeDx37A9HIxNuqL+209K+e/Uk/rftCwYGBwWkxnExbkRwYHpTZBGgti4M/K/dX/Cf/fpOf9t6sHBcULcRk0JaAYT6YYiMDw4XKdn/bdtjv2vGGf7RtrXyAdoDguZhiKwaVf0f4fJqf8du1NAQfVXMcyiFWQwmYYisFl3zH+3GTn/Q+aV/3dsSfyvFGtdSLFLHaek/XfqSga59JdcmEU5yKVkh6lFbxzQhdn/bZtiga6zeS7lZeAKMpCC2E/87z4t5791fdR/xSirw4I2SnKg2CcxnSK8aw+MGKceSMTIh5h3Q0szRvJzFCQJgXLUexk/oyCQd8nP+8DE7jEjF+jd6P9K0VZnRe00VWHeJcfQDJChzn2p/80qQv4rhFvOZBAV5QF5l5LyNBZann6W8zOOp0Z5Kg7Eloox1jekHbX1qVLyQ2NVQEBBQIBU7wIAOFZ7BmG7RzYAAAAASUVORK5CYII=",a.prototype.offsetX=-19,a.prototype.offsetY=-10,a.prototype.title=function(){return"Arrow Mark Right"},inherit(s,r),s.prototype.image=new Image,s.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAB/UlEQVR4AWPAATj3Wij8J4RB6hhIAFIgTS9a8nBhmKFSpBiqDNJ0P80PF4YZqkyyobfD7HDh4WJolaKY+G5zhXvoMXva2xifoWB5dD07zeTvFKvxioDMFY6RFUgEGvzzQVk8OGafVib9v5fkhc9QkDxIHVj9vaKY/7vM5b+HS/JFA80TAhnKA8TGZSoiS057GYFiFqzhTpQTPkNB8iB1YPUnPQz+5ykKzQGaYwjE3CBDmUCuBWKHabqSZ0656oI0EY1B6idoSx4F6reDupIJFrTMQCwtxsYcvNZY5uU5T0OiDDwLdOFKI9knvMzM/kD9kmBz0AAbEKs6iHAX7zSX/3nF3xyvgZd8Tf9vM5P/ZiXAmQdNBazYEgIjEHOBwiVHXmjWcSctnAbeDLH5f8xR83+SjNBEoHo9sD4owGWwIBDb9mtJHMIVviDxDg3x3UB11kDMD9ZHADCDwkeAmdlvhZHMI2C4oRh4xl3//1IDmbvszAxeQHXiUPWEATR8lE0EubJB4QYMP7CBF31M/m82k/usy8uRCpRXAKsjEXCCwiteVqD/qIPG/+tBVv/3WCj8C5Pi7wCKawMxBwMZgBEaXlbtGuI7T7ro/G9QFdsI5JsDMR/+cCQcvuLsLAzubRoSa4FsJyAWBSdwsgEifKVBXoYmcBYGagCoQZzEGggAoyq6zKXuV5gAAAAASUVORK5CYII=",s.prototype.offsetX=-9,s.prototype.offsetY=-18,s.prototype.title=function(){return"Arrow Mark Down"},a.prototype.version=n.prototype.version=s.prototype.version=o.prototype.version=2,s.prototype.migrateVersion=function(e){1==e&&(this.version=1,this._paneViews[0]._offsetX=-10,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,21)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=-4)},o.prototype.migrateVersion=function(e){1==e&&(this.version=1,this._paneViews[0]._offsetX=-10,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,0)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=18)},a.prototype.migrateVersion=function(e){1==e&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,0)),this._textPaneView._offsetX=0,this._textPaneView._offsetY=10)},n.prototype.migrateVersion=function(e){1==e&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(0,0)),this._textPaneView._offsetX=21,this._textPaneView._offsetY=10)},t.LineToolArrowMark=r,t.LineToolArrowMarkLeft=n,t.LineToolArrowMarkRight=a,t.LineToolArrowMarkUp=o,t.LineToolArrowMarkDown=s},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t,i,r,n,a,s){o.call(this,e,t),this._image=i,this._offsetX=a||0,this._offsetY=s||0,this._width=r,this._height=n,this._invalidated=!0}var o=i(44);r.prototype.draw=function(e){if(0!==this._data.points.length){var t=this._data.points[0].x+this._data.offsetX,i=this._data.points[0].y+this._data.offsetY;e.translate(-.5,-.5),e.drawImage(this._data.image,t,i,this._data.width,this._data.height)}},r.prototype.hitTest=function(e){if(0===this._data.points.length)return null;var t=this._data.points[0].clone();return this._data.offsetX&&(t.x+=this._data.offsetX),this._data.offsetY&&(t.y+=this._data.offsetY),MathEx.pointInRect(e,t,t.add(new MathEx.Point(this._data.width,this._data.height)))?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,o),n.prototype.setAnchors=function(e){this._anchorsOffset=e},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.Z97.properties().color.value(),e.image=this._image,e.offsetX=this._offsetX,e.offsetY=this._offsetY,e.width=this._width,e.height=this._height,this.isAnchorsRequired()&&1==e.points.length){var t=new TradingView.CompositeRenderer;if(t.append(new r(e)),this._anchorsOffset){for(var i=[],n=0;n<e.points.length;n++)i.push(e.points[n].clone().add(this._anchorsOffset));t.append(new TradingView.SelectionRenderer({points:i}))}else t.append(new TradingView.SelectionRenderer({points:e.points}));return t}return new r(e)},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){o.prototype.update.call(this),this._invalidated=!1},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._invalidated=!0}function n(e,t){this._constructor="LineToolPitchfan";var i=t?t:new this.createPropertiesObject("linetoolpitchfan");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(9),l=i(116).ChannelRenderer,d=i(55).TrendLineRenderer;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){o.prototype.update.call(this),0!==this._points.length&&(3===this._points.length?(this._medianPoint=this._points[1].add(this._points[2]).scaled(.5),this._medianPoint.data=3):2===this._points.length?(this._medianPoint=this._points[1],this._medianPoint.data=3):(this._medianPoint=this._points[0],this._medianPoint.data=3))},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;if(!this._medianPoint)return e;var t={points:[this._points[0],this._medianPoint],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};if(e.append(new d(t)),this._points.length<3)return this.addAnchors(e),e;var i={points:[this._points[1],this._points[2]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};e.append(new d(i));for(var r=0,n=this._points[2].substract(this._points[1]).scaled(.5),o=this.Z97.properties().fillBackground.value(),s=this.Z97.properties().transparency.value(),h=0;8>=h;h++){var p="level"+h,c=this.Z97.properties()[p];if(c.visible.value()){var u=this._medianPoint.addScaled(n,c.coeff.value()),_=this._medianPoint.addScaled(n,-c.coeff.value());if(o){var f={};f.width=this.Z98.timeScale().width(),f.p1=this._points[0],f.p2=u,f.p3=this._points[0],f.p4=this._medianPoint.addScaled(n,r),f.color=c.color.value(),f.transparency=s,f.hittestOnBackground=!0,e.append(new l(f));var f={};f.width=this.Z98.timeScale().width(),f.p1=this._points[0],f.p2=_,f.p3=this._points[0],f.p4=this._medianPoint.addScaled(n,-r),f.color=c.color.value(),f.transparency=s,f.hittestOnBackground=!0,e.append(new l(f))}r=c.coeff.value();var g={points:[this._points[0],u],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:c.color.value(),linewidth:c.linewidth.value(),linestyle:c.linestyle.value(),extendleft:!1,extendright:!0,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},v=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,h);e.append(new d(g,v));var m={points:[this._points[0],_],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:c.color.value(),linewidth:c.linewidth.value(),linestyle:c.linestyle.value(),extendleft:!1,extendright:!0,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},v=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,h);e.append(new d(m,v))}}return this.addAnchors(e),e},inherit(n,a),n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Pitchfan"},n.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},n.prototype.createPropertiesObject=function(e,t,i){return new s(e,t,i,{range:[0,8]})},e.exports=n},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){d.call(this,e,t),this._invalidated=!0}function o(e,t){n.call(this,e,t),this._invalidated=!0}function a(e,t){o.call(this,e,t),this._invalidated=!0}function s(e,t){n.call(this,e,t),this._invalidated=!0}function l(e,t){this._constructor="LineToolPitchfork";var i=t?t:new this.createPropertiesObject("linetoolpitchfork");h.call(this,e,new n(this,e),i),this.Q0.style.listeners().subscribe(this,l.prototype._recreatePaneView),this._recreatePaneView()}var d=i(44),h=i(13).LineDataSource,p=i(9),c=i(55).TrendLineRenderer;r.prototype.extendPoints=function(e,t,i){var r=new MathEx.Point(0,-5e3),n=new MathEx.Point(i,5e3),o=t.substract(e),a=MathEx.intersectRayWithRect(t,t.add(o),r,n);if(a&&(t=a),!MathEx.pointInRect(e,r,n)&&MathEx.pointInRect(t,r,n)){var a=MathEx.intersectRayWithRect(t,e,r,n);a&&(e=a)}if(!MathEx.pointInRect(t,r,n)&&MathEx.pointInRect(e,r,n)){var a=MathEx.intersectRayWithRect(e,t,r,n);a&&(t=a)}return[e,t]},r.prototype.draw=function(e){var t=e.canvas.width,i=(e.canvas.height,this.extendPoints(this._data.p1,this._data.p2,t)),r=this.extendPoints(this._data.p3,this._data.p4,t);e.beginPath(),e.moveTo(i[0].x,i[0].y),e.lineTo(i[1].x,i[1].y),i[1].x<r[1].x&&e.lineTo(r[1].x,i[1].y),e.lineTo(r[1].x,r[1].y),e.lineTo(r[0].x,r[0].y),e.lineTo(i[0].x,i[0].y),e.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0),e.fill()},r.prototype.hitTest=function(e){if(!this._data.hittestOnBackground)return null;var t=this._data.width,i=this.extendPoints(this._data.p1,this._data.p2,t),r=this.extendPoints(this._data.p3,this._data.p4,t),n=[new MathEx.Point(i[0].x,i[0].y),new MathEx.Point(i[1].x,i[1].y)];return i[1].x<r[1].x&&n.push(new MathEx.Point(r[1].x,i[1].y)),n.push(new MathEx.Point(r[1].x,r[1].y)),n.push(new MathEx.Point(r[0].x,r[0].y)),n.push(new MathEx.Point(i[0].x,i[0].y)),MathEx.isInPolygon(n,e)?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND):null},inherit(n,d),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){d.prototype.update.call(this),0!==this._points.length&&(3===this._points.length?(this._medianPoint=this._points[1].add(this._points[2]).scaled(.5),this._medianPoint.data=3):2===this._points.length?(this._medianPoint=this._points[1],this._medianPoint.data=3):(this._medianPoint=this._points[0],this._medianPoint.data=3))},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;if(!this._medianPoint)return e;var t={points:[this._points[0],this._medianPoint],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};if(e.append(new c(t)),this._points.length<3)return this.addAnchors(e),e;var i={points:[this._points[1],this._points[2]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};e.append(new c(i));for(var n=this._points[2].substract(this._points[1]).scaled(.5),o=this._medianPoint.substract(this._points[0]),a=0,s=this.Z97.properties().fillBackground.value(),l=this.Z97.properties().transparency.value(),d=0;8>=d;d++){var p="level"+d,u=this.Z97.properties()[p];if(u.visible.value()){var _=this._medianPoint.addScaled(n,u.coeff.value()),f=_.add(o),g=this._medianPoint.addScaled(n,-u.coeff.value()),v=g.add(o);if(s){var m={};m.width=this.Z98.timeScale().width(),m.p1=_,m.p2=f,m.p3=this._medianPoint.addScaled(n,a),m.p4=m.p3.add(o),m.color=u.color.value(),m.width=this.Z98.timeScale().width(),m.transparency=l,m.hittestOnBackground=!0,e.append(new r(m));var m={};m.width=this.Z98.timeScale().width(),m.p1=g,m.p2=v,m.p3=this._medianPoint.addScaled(n,-a),m.p4=m.p3.add(o),m.color=u.color.value(),m.width=this.Z98.timeScale().width(),m.transparency=l,m.hittestOnBackground=!0,e.append(new r(m))}a=u.coeff.value();var y={points:[_,f],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:u.color.value(),linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},w=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,d);e.append(new c(y,w));var T={points:[g,v],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:u.color.value(),linewidth:u.linewidth.value(),linestyle:u.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},w=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,d);e.append(new c(T,w))}}return this.addAnchors(e),e},inherit(o,n),o.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t={points:[this._points[0],this._points[1]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};if(e.append(new c(t)),!this._medianPoint||!this._modifiedBase)return this.addAnchors(e),e;var i={points:[this._modifiedBase,this._medianPoint],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};if(e.append(new c(i)),this._points.length<3)return this.addAnchors(e),e;var n={points:[this._points[1],this._points[2]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};e.append(new c(n));for(var o=this._points[2].substract(this._points[1]).scaled(.5),a=this._medianPoint.substract(this._modifiedBase),s=0,l=this.Z97.properties().fillBackground.value(),d=this.Z97.properties().transparency.value(),p=0;8>=p;p++){var u="level"+p,_=this.Z97.properties()[u];if(_.visible.value()){var f=this._medianPoint.addScaled(o,_.coeff.value()),g=f.add(a),v=this._medianPoint.addScaled(o,-_.coeff.value()),m=v.add(a);if(l){var t={};t.p1=f,t.p2=g,t.p3=this._medianPoint.addScaled(o,s),t.p4=t.p3.add(a),t.color=_.color.value(),t.width=this.Z98.timeScale().width(),t.transparency=d,t.hittestOnBackground=!0,e.append(new r(t));var t={};t.p1=v,t.p2=m,t.p3=this._medianPoint.addScaled(o,-s),t.p4=t.p3.add(a),t.color=_.color.value(),t.width=this.Z98.timeScale().width(),t.transparency=d,t.hittestOnBackground=!0,e.append(new r(t))}s=_.coeff.value();var y={points:[f,g],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:_.color.value(),linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},w=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,p);e.append(new c(y,w));var T={points:[v,m],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:_.color.value(),linewidth:_.linewidth.value(),linestyle:_.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},w=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,p);e.append(new c(T,w))}}return this.addAnchors(e),e},o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){n.prototype.updateImpl.call(this),this._points.length>1&&(this._modifiedBase=this._points[0].add(this._points[1]).scaled(.5))},inherit(a,o),a.prototype.update=function(){this._invalidated=!0},a.prototype.updateImpl=function(){if(n.prototype.updateImpl.call(this),this._points.length>2){var e=this._points[0].x,t=.5*(this._points[0].y+this._points[1].y),i=new MathEx.Point(e,t);this._modifiedBase=i}},inherit(s,n),s.prototype.update=function(){this._invalidated=!0},s.prototype.updateImpl=function(){n.prototype.updateImpl.call(this),this._points.length>1&&(this._modifiedBase=this._points[0].add(this._points[1]).scaled(.5))},s.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;if(!this._medianPoint||!this._modifiedBase)return this.addAnchors(e),e;if(3==this._points.length){var t={points:[this._modifiedBase,this._points[2]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};e.append(new c(t))}var i={points:[this._points[0],this._points[1]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};if(e.append(new c(i)),this._points.length<3)return this.addAnchors(e),e;var n={points:[this._points[1],this._points[2]],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!1,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};e.append(new c(n));var o=this._points[2].substract(this._points[1]).scaled(.5),a=this._points[2].substract(this._modifiedBase),s=0,l=this.Z97.properties().fillBackground.value(),d=this.Z97.properties().transparency.value(),p={points:[this._medianPoint,this._medianPoint.add(a)],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this.Z97.properties().median.color.value(),linewidth:this.Z97.properties().median.linewidth.value(),linestyle:this.Z97.properties().median.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL};e.append(new c(p));for(var u=0;8>=u;u++){var _="level"+u,f=this.Z97.properties()[_];if(f.visible.value()){var g=this._medianPoint.addScaled(o,f.coeff.value()),v=g.add(a),m=this._medianPoint.addScaled(o,-f.coeff.value()),y=m.add(a);if(l){var i={};i.p1=g,i.p2=v,i.p3=this._medianPoint.addScaled(o,s),i.p4=i.p3.add(a),i.color=f.color.value(),i.width=this.Z98.timeScale().width(),i.transparency=d,i.hittestOnBackground=!0,e.append(new r(i));var i={};i.p1=m,i.p2=y,i.p3=this._medianPoint.addScaled(o,-s),i.p4=i.p3.add(a),i.color=f.color.value(),i.width=this.Z98.timeScale().width(),i.transparency=d,i.hittestOnBackground=!0,e.append(new r(i))}s=f.coeff.value();var w={points:[g,v],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:f.color.value(),linewidth:f.linewidth.value(),linestyle:f.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},T=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,u);e.append(new c(w,T));var b={points:[m,y],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:f.color.value(),linewidth:f.linewidth.value(),linestyle:f.linestyle.value(),extendleft:!1,extendright:!0,leftend:h.LINEEND_NORMAL,rightend:h.LINEEND_NORMAL},T=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,u);e.append(new c(b,T))}}return this.addAnchors(e),e},inherit(l,h),l.STYLE_ORIGINAL=0,l.STYLE_SCHIFF=1,l.STYLE_INSIDE=2,l.STYLE_SCHIFF2=3,l.prototype.additionalActions=function(){for(var e=[],t=["Original","Modified Schiff","Inside","Schiff"],i=0;4>i;i++){var r=new TradingView.Action({checked:this.properties().style.value()==i,checkable:!0,text:$.t(t[i]),callbackContext:{target:this,value:i}});r.callbacks().subscribe(null,function(e){var t=e.callbackContext(),i=t.target,r=t.value;i.properties().style.setValue(r),i.updateAllViews(),i.Z98.updateSource(i)}),e.push(r)}return[e[0],e[3],e[1],e[2]]},l.prototype._recreatePaneView=function(){this.Q0.style.value()==l.STYLE_ORIGINAL?this._paneViews=[new n(this,this.Z98)]:this.Q0.style.value()==l.STYLE_SCHIFF?this._paneViews=[new o(this,this.Z98)]:this.Q0.style.value()==l.STYLE_SCHIFF2?this._paneViews=[new a(this,this.Z98)]:this.Q0.style.value()==l.STYLE_INSIDE&&(this._paneViews=[new s(this,this.Z98)])},l.prototype.pointsCount=function(){return 3},l.prototype.title=function(){return $.t("Pitchfork")},l.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},l.prototype.createPropertiesObject=function(e,t,i){return new p(e,t,i,{range:[0,8]})},t.ChannelRenderer=r,t.LineToolPitchfork=l},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._numericFormatter=new TradingView.NumericFormatter,this._invalidated=!0}function n(e,t){this._constructor="LineToolGannSquare";var i=t?t:new this.createPropertiesObject("linetoolgannsquare");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(9),l=i(45).TextRenderer,d=i(12).RectangleTransparencyRenderer,h=i(55).TrendLineRenderer;inherit(r,o),r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return this.addAnchors(e),e;for(var t=this._points[0],i=this._points[1],r=Math.min(t.x,i.x),n=Math.min(t.y,i.y),o=Math.max(t.x,i.x),s=Math.max(t.y,i.y),p=this.Z97.properties(),c=this.Z97.properties().fillHorzBackground.value(),u=this.Z97.properties().horzTransparency.value(),_=this.Z97.properties().fillVertBackground.value(),f=this.Z97.properties().vertTransparency.value(),g=0;g<this._hlevels.length;g++){if(g>0&&c){var v=this._hlevels[g-1],t=new MathEx.Point(r,this._hlevels[g].y),i=new MathEx.Point(o,v.y),m={};m.points=[t,i],m.color=this._hlevels[g].color,m.linewidth=0,m.backcolor=this._hlevels[g].color,m.fillBackground=!0,m.transparency=u,e.append(new d(m))}var t=new MathEx.Point(r,this._hlevels[g].y),i=new MathEx.Point(o,this._hlevels[g].y),y={points:[t,i],width:this.Z98.timeScale().width(),
height:this.Z97.priceScale().height(),color:this._hlevels[g].color,linewidth:p.linewidth.value(),linestyle:p.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};if(e.append(new h(y)),p.showLeftLabels.value()){var w={points:[t],text:this._numericFormatter.format(this._hlevels[g].coeff),color:this._hlevels[g].color,vertAlign:"middle",horzAlign:"right",font:p.font.value(),offsetX:-5,offsetY:0,fontsize:12};e.append(new l(w,this._rendererCache))}if(p.showRightLabels.value()){var T={points:[i],text:this._numericFormatter.format(this._hlevels[g].coeff),color:this._hlevels[g].color,vertAlign:"middle",horzAlign:"left",font:p.font.value(),offsetX:5,offsetY:0,fontsize:12};e.append(new l(T,this._rendererCache))}}for(var g=0;g<this._vlevels.length;g++){var t=new MathEx.Point(this._vlevels[g].x,n),i=new MathEx.Point(this._vlevels[g].x,s);if(g>0&&_){var v=this._vlevels[g-1],b=new MathEx.Point(v.x,n),m={};m.points=[b,i],m.color=this._vlevels[g].color,m.linewidth=0,m.backcolor=this._vlevels[g].color,m.fillBackground=!0,m.transparency=f,e.append(new d(m))}var y={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this._vlevels[g].color,linewidth:p.linewidth.value(),linestyle:p.linestyle.value(),extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};if(e.append(new h(y)),p.showTopLabels.value()){var S={points:[t],text:this._numericFormatter.format(this._vlevels[g].coeff),color:this._vlevels[g].color,vertAlign:"bottom",horzAlign:"center",font:p.font.value(),offsetX:0,offsetY:-5,fontsize:12};e.append(new l(S,this._rendererCache))}if(p.showBottomLabels.value()){var C={points:[i],text:this._numericFormatter.format(this._vlevels[g].coeff),color:this._vlevels[g].color,vertAlign:"top",horzAlign:"center",font:p.font.value(),offsetX:0,offsetY:5,fontsize:12};e.append(new l(C,this._rendererCache))}}return this.addAnchors(e),e},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),!(this.Z97.points().length<2)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this.Z97.points()[0],t=this.Z97.points()[1];this._hlevels=[];var i,r=t.price-e.price;this.Z97.priceScale().isPercent()&&(i=this.Z97.ownerSource().firstValue());for(var n=1;7>=n;n++){var a="hlevel"+n,s=this.Z97.properties()[a];if(s.visible.value()){var l=s.coeff.value(),d=s.color.value(),h=e.price+l*r;this.Z97.priceScale().isPercent()&&(h=this.Z97.priceScale().priceRange().convertToPercent(h,i));var p=this.Z97.priceScale().priceToCoordinate(h);this._hlevels.push({coeff:l,color:d,y:p})}}this._vlevels=[];for(var c=t.index-e.index,n=1;7>=n;n++){var a="vlevel"+n,s=this.Z97.properties()[a];if(s.visible.value()){var l=s.coeff.value(),d=s.color.value(),u=Math.round(e.index+l*c),_=this.Z98.timeScale().indexToCoordinate(u);this._vlevels.push({coeff:l,color:d,x:_})}}}},inherit(n,a),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Gann Box"},n.prototype.createPropertiesObject=function(e,t,i){return new s(e,t,i,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]})},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._numericFormatter=new TradingView.NumericFormatter,this._invalidated=!0}function n(e,t){this._constructor="LineToolFibSpeedResistanceFan";var i=t?t:new this.createPropertiesObject("linetoolfibspeedresistancefan");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(9),l=i(116).ChannelRenderer,d=i(45).TextRenderer,h=i(55).TrendLineRenderer;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),!(this.Z97.points().length<2)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this.Z97.points()[0],t=this.Z97.points()[1];this._hlevels=[];var i,r=t.price-e.price;this.Z97.priceScale().isPercent()&&(i=this.Z97.ownerSource().firstValue());for(var n=1;7>=n;n++){var a="hlevel"+n,s=this.Z97.properties()[a];if(s.visible.value()){var l=s.coeff.value(),d=s.color.value(),h=e.price+l*r;this.Z97.priceScale().isPercent()&&(h=this.Z97.priceScale().priceRange().convertToPercent(h,i));var p=this.Z97.priceScale().priceToCoordinate(h);this._hlevels.push({coeff:l,color:d,y:p,index:n})}}this._vlevels=[];for(var c=t.index-e.index,n=1;7>=n;n++){var a="vlevel"+n,s=this.Z97.properties()[a];if(s.visible.value()){var l=s.coeff.value(),d=s.color.value(),u=Math.round(e.index+l*c),_=this.Z98.timeScale().indexToCoordinate(u);this._vlevels.push({coeff:l,color:d,x:_,index:n})}}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;for(var t=this._points[0],i=this._points[1],r=Math.min(t.x,i.x),n=Math.min(t.y,i.y),o=Math.max(t.x,i.x),s=Math.max(t.y,i.y),p=this.Z97.properties(),c=p.grid.color.value(),u=p.grid.linewidth.value(),_=p.grid.linestyle.value(),f=0;f<this._hlevels.length;f++){var t=new MathEx.Point(r,this._hlevels[f].y),i=new MathEx.Point(o,this._hlevels[f].y);if(p.grid.visible.value()){var g={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:c,linewidth:u,linestyle:_,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};e.append(new h(g))}if(p.showLeftLabels.value()){var v={points:[t],text:this._numericFormatter.format(this._hlevels[f].coeff),color:this._hlevels[f].color,vertAlign:"middle",horzAlign:"right",font:p.font.value(),offsetX:-5,offsetY:0,fontsize:12};e.append(new d(v,this._rendererCache))}if(p.showRightLabels.value()){var m={points:[i],text:this._numericFormatter.format(this._hlevels[f].coeff),color:this._hlevels[f].color,vertAlign:"middle",horzAlign:"left",font:p.font.value(),offsetX:5,offsetY:0,fontsize:12};e.append(new d(m,this._rendererCache))}}for(var f=0;f<this._vlevels.length;f++){var t=new MathEx.Point(this._vlevels[f].x,n),i=new MathEx.Point(this._vlevels[f].x,s);if(p.grid.visible.value()){var g={points:[t,i],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:c,linewidth:u,linestyle:_,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};e.append(new h(g))}if(p.showTopLabels.value()){var y={points:[t],text:this._numericFormatter.format(this._vlevels[f].coeff),color:this._vlevels[f].color,vertAlign:"bottom",horzAlign:"center",font:p.font.value(),offsetX:0,offsetY:-5,fontsize:12};e.append(new d(y,this._rendererCache))}if(p.showBottomLabels.value()){var w={points:[i],text:this._numericFormatter.format(this._vlevels[f].coeff),color:this._vlevels[f].color,vertAlign:"top",horzAlign:"center",font:p.font.value(),offsetX:0,offsetY:5,fontsize:12};e.append(new d(w,this._rendererCache))}}for(var T=p.fillBackground.value(),b=p.transparency.value(),t=this._points[0],i=this._points[1],f=0;f<this._hlevels.length;f++){var S=new MathEx.Point(i.x,this._hlevels[f].y);if(f>0&&T){var C=new MathEx.Point(i.x,this._hlevels[f-1].y),x={};x.width=this.Z98.timeScale().width(),x.p1=t,x.p2=S,x.p3=t,x.p4=C,x.color=this._hlevels[f].color,x.transparency=b,x.hittestOnBackground=!0,e.append(new l(x))}var g={points:[t,S],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this._hlevels[f].color,linewidth:p.linewidth.value(),linestyle:p.linestyle.value(),extendleft:!1,extendright:!0,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},P=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,{type:"h",index:this._hlevels[f].index});e.append(new h(g,P))}for(var f=0;f<this._vlevels.length;f++){var L=new MathEx.Point(this._vlevels[f].x,i.y);if(f>0&&T){var C=new MathEx.Point(this._vlevels[f-1].x,i.y),x={};x.width=this.Z98.timeScale().width(),x.p1=t,x.p2=L,x.p3=t,x.p4=C,x.color=this._vlevels[f].color,x.transparency=b,x.hittestOnBackground=!0,e.append(new l(x))}var g={points:[t,L],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this._vlevels[f].color,linewidth:p.linewidth.value(),linestyle:p.linestyle.value(),extendleft:!1,extendright:!0,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL},P=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,{type:"v",index:this._vlevels[f].index});e.append(new h(g,P))}return this.addAnchors(e),e},inherit(n,a),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Fib Speed Resistance Fan"},n.prototype.processErase=function(e,t){var i="h"==t.type?"hlevel"+t.index:"vlevel"+t.index,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},n.prototype.createPropertiesObject=function(e,t,i){return new s(e,t,i,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]})},e.exports=n},function(e,t,i){"use strict";function r(e){if(this._data=e,this._data.point.y==this._data.center.y);}function n(e,t){l.call(this,e,t),this._rendererCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolGannComplex";var i=t?t:new this.createPropertiesObject("linetoolganncomplex");s.call(this,e,new n(this,e),i)}function a(e,t,i){d.call(this,e,t,i,{names:["width","color","visible"]})}var s=i(13).LineDataSource,l=i(44),d=i(9),h=i(55).TrendLineRenderer,p=i(10).isSameType;r.prototype.draw=function(e){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.translate(this._data.center.x,this._data.center.y);var t=this._data.edge.substract(this._data.center),i=t.y/t.x,r=this._data.point.substract(this._data.center);r.y/=i;var n=r.length(),o=this._data.prevPoint.substract(this._data.center);o.y/=i;var a=o.length();e.scale(1,i),this._data.fillBack&&(this._data.point.x<this._data.center.x&&(n=-n,a=-a),e.beginPath(),e.moveTo(a,0),e.lineTo(n,0),e.arcTo(n,n,0,n,Math.abs(n)),e.lineTo(0,a),e.arcTo(a,a,a,0,Math.abs(a)),e.fillStyle=TradingView.generateColor(this._data.color,this._data.transparency,!0),e.fill()),e.beginPath(),this._data.point.x>this._data.center.x?e.arc(0,0,Math.abs(n),0,Math.PI/2,!1):e.arc(0,0,Math.abs(n),-Math.PI/2,-Math.PI,!0),e.scale(1,1/i),e.stroke()},r.prototype.hitTest=function(e){var t=e.substract(this._data.center),i=this._data.edge.substract(this._data.center),r=i.y/i.x;t.y/=r;var n=this._data.point.substract(this._data.center);n.y/=r;var o=n.length(),a=t.length(),s=this._data.prevPoint.substract(this._data.center);s.y/=r;var l=s.length();return Math.abs(a-o)<5&&i.x*t.x>=0&&i.y*t.y>=0?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):this._data.fillBack&&a>=l&&o>=a&&i.x*t.x>=0&&i.y*t.y>=0?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND):null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this),this.Z97._cornerPoint&&this._points.push(this.Z97.pointToScreenPoint(this.Z97._cornerPoint)[0])},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=this.Z97.properties(),t=new TradingView.CompositeRenderer;if(this._points.length<2)return this.addAnchors(t),t;for(var i,n,o=this._points[0],a=3==this._points.length?this._points[2]:this._points[1],l=this._points[1],d=0;6>d;d++){var p=e.levels[d];if(p.visible.value()){var c=d/5;i=o.x+c*(a.x-o.x);var u=o.y,_=a.y,f={points:[new MathEx.Point(i,u),new MathEx.Point(i,_)],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:p.color.value(),linewidth:p.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};t.append(new h(f)),n=o.y+c*(a.y-o.y);var g=o.x,v=a.x,f={points:[new MathEx.Point(g,n),new MathEx.Point(v,n)],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:p.color.value(),linewidth:p.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};t.append(new h(f))}}for(var d in e.fanlines._childs){var m=e.fanlines[d];if(m.visible.value()){var i,n,y=m.x.value(),w=m.y.value();if(y>w){i=a.x;var c=w/y;n=o.y+c*(a.y-o.y)}else{n=a.y;var c=y/w;i=o.x+c*(a.x-o.x)}var f={points:[o,new MathEx.Point(i,n)],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:m.color.value(),linewidth:m.width.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL};t.append(new h(f))}}var T=o;for(var d in e.arcs._childs){var b=e.arcs[d];if(b.visible.value()){var y=b.x.value()/5,w=b.y.value()/5,i=o.x+y*(a.x-o.x),n=o.y+w*(a.y-o.y),S=(new MathEx.Point(i,n).substract(o).length(),{center:o,point:new MathEx.Point(i,n),edge:a,color:b.color.value(),linewidth:b.width.value(),fillBack:e.arcsBackground.fillBackground.value(),transparency:e.arcsBackground.transparency.value(),prevPoint:T});t.append(new r(S)),T=S.point}}if(this.isAnchorsRequired()){var C=[o,l];this.Z98.lineBeingCreated()==this.Z97&&C.pop(),t.append(this.createLineAnchor({points:C}))}return t},inherit(o,s),o.prototype._recalcSecondPoint=function(){var e=this.Z98.mainSeries().properties().style.value(),t=this.Z98.mainSeries().interval();if(e!==this._currentStyle||t!==this._currentInterval){var i=this.pointToScreenPoint(this.points()[0])[0],r=this.pointToScreenPoint(this.points()[2])[0],n=r.substract(i),o=(n.x/n.y,i.add(n.scaled(.2/Math.sqrt(2)))),a=this.screenPointToPoint(o);this._points[1]=a}},o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Gann Square"},o.prototype._fixThirdPoint=function(e){if(!(this.points().length<2)){var t=this.pointToScreenPoint(this.points()[0])[0],i=this.pointToScreenPoint(this.points()[1])[0],r=i.substract(t);if(e){var n=(r.x/r.y,t.add(r.scaled(5*Math.sqrt(2))));this._cornerPoint=this.screenPointToPoint(n)}else{var o=r.x<0?-1:1,a=r.y<0?-1:1,s=i.substract(t).length(),n=t.add(new MathEx.Point(5*s*o,5*s*a)),l=this.screenPointToPoint(n);this._cornerPoint=l}}},o.prototype.setPoint=function(e,t,i){var r=s.prototype.setPoint.call(this,e,t,i),n=i&&i.shift;this._fixThirdPoint(n),this._points[2]=this._cornerPoint,delete this._cornerPoint;var o=this.Z98.mainSeries().properties().style.value(),a=this.Z98.mainSeries().interval();return this._currentStyle=o,this._currentInterval=a,r},o.prototype.setLastPoint=function(e,t){var i=s.prototype.setLastPoint.call(this,e,t),r=t&&t.shift;return this._fixThirdPoint(r),i},o.prototype.addPoint=function(e,t){var i=$.extend({},e),r=this.Z98.mainSeries().properties().style.value(),n=this.Z98.mainSeries().interval();this._currentStyle=r,this._currentInterval=n;var o=this.priceScale();if(o.isPercent()){var a=this.ownerSource().firstValue();i.price=o.priceRange().convertFromPercent(i.price,a)}var s=t&&t.shift;this._points.push(i),this._lastPoint=null;var l=this._points.length==this.pointsCount();return l?(this._fixThirdPoint(s),this._points.push(this._cornerPoint),delete this._cornerPoint,this.normalizePoints(),this.createServerPoints()):this._lastPoint=i,l},o.prototype.onData=function(e){s.prototype.onData.call(this,e),this._recalcSecondPoint()},inherit(a,d),a.prototype._iterateLevels=function(e,t){for(var i in e.levels)if(e.levels[i]&&p(e.levels[i],t.typecheck())){var r=t.tpl();for(var n in this._map.names)r=t.fill(n,this._map.names[n],e.levels[i],r);e.levels[i]=r}return e},o.prototype.createPropertiesObject=function(e,t,i){return new a(e,t,i)},e.exports=o},function(e,t,i){"use strict";function r(e,t){a.call(this,e,t),this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolGannFan";var i=t?t:new this.createPropertiesObject("linetoolgannfan");o.call(this,e,new r(this,e),i)}var o=i(13).LineDataSource,a=i(44),s=i(9),l=i(116).ChannelRenderer,d=i(45).TextRenderer,h=i(55).TrendLineRenderer;inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(a.prototype.update.call(this),!(this.Z97.points().length<2)&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&!this.Z98.timeScale().isEmpty()){var e=this._points[0],t=this._points[1];this._fans=[];for(var i,r,n=t.x-e.x,o=t.y-e.y,s=1;9>=s;s++){var l="level"+s,d=this.Z97.properties()[l];if(d.visible.value()){var i,r,h=d.coeff1.value(),p=d.coeff2.value(),c=h/p,u=d.color.value(),_=""+h+"/"+p;h>p?(i=t.x,r=e.y+o/c):(i=e.x+n*c,r=t.y),this._fans.push({label:_,color:u,x:i,y:r,linewidth:d.linewidth.value(),linestyle:d.linestyle.value(),index:s})}}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;for(var t=this._points[0],i=(this._points[1],this.Z97.properties()),r=this.Z97.properties().fillBackground.value(),n=this.Z97.properties().transparency.value(),a=0;a<this._fans.length;a++){var s=new MathEx.Point(this._fans[a].x,this._fans[a].y);if(r)if(this._fans[a].index<4){var p=new MathEx.Point(this._fans[a+1].x,this._fans[a+1].y),c={};c.width=this.Z98.timeScale().width(),c.p1=t,c.p2=s,c.p3=t,c.p4=p,c.color=this._fans[a].color,c.transparency=n,c.hittestOnBackground=!0,e.append(new l(c))}else if(this._fans[a].index>4&&a>0){var p=new MathEx.Point(this._fans[a-1].x,this._fans[a-1].y),c={};c.width=this.Z98.timeScale().width(),c.p1=t,c.p2=s,c.p3=t,c.p4=p,c.color=this._fans[a].color,c.transparency=n,c.hittestOnBackground=!0,e.append(new l(c))}var u={points:[t,s],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:this._fans[a].color,linewidth:this._fans[a].linewidth,linestyle:this._fans[a].linestyle,extendleft:!1,extendright:!0,leftend:o.LINEEND_NORMAL,rightend:o.LINEEND_NORMAL},_=new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,null,this._fans[a].index);if(e.append(new h(u,_)),i.showLabels.value()){var f={points:[s],text:this._fans[a].label,color:this._fans[a].color,vertAlign:"middle",horzAlign:"left",font:i.font.value(),offsetX:0,offsetY:-5,fontsize:12};e.append(new d(f,this._rendererCache))}}return this.addAnchors(e),e},inherit(n,o),n.prototype.pointsCount=function(){return 2},n.prototype.title=function(){return"Gann Fan"},n.prototype.processErase=function(e,t){var i="level"+t,r=this.properties()[i].visible;e.setProperty(r,!1,"Erase level line")},n.prototype.createPropertiesObject=function(e,t,i){return new s(e,t,i,{range:[1,9]})},e.exports=n},function(e,t,i){"use strict";function r(e,t){s.call(this,e,t),this._label=null,this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolDisjointAngle";var i=t?t:new J50("linetooldisjointangle");l.call(this,e,new r(this,e),i),this.version=n.version}var o=i(55).TrendLineRenderer,a=i(116).ChannelRenderer,s=i(44),l=i(13).LineDataSource,d=i(45).TextRenderer,h=i(89);inherit(r,s),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(s.prototype.update.call(this),this._label=null,!(this.Z97.points().length<2)&&this.Z97.priceScale()){var e=this.Z97.points()[0],t=this.Z97.points()[1];if(this._price1=this.Z97.priceScale().formatter().format(e.price),this._price2=this.Z97.priceScale().formatter().format(t.price),3==this.Z97.points().length){var i=this.Z97.points()[2];this._price3=this.Z97.priceScale().formatter().format(i.price);var r=t.price-e.price;this._price4=this.Z97.priceScale().formatter().format(i.price+r)}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t,i,r=this._points[0],n=this._points[1],s=this.Z97.properties(),l=this.Z98,p=this.Z97,s=p.properties();if(this._points.length>=3){t=this._points[2],t.x=n.x;var c=n.y-r.y;n.y-t.y;if(i=r.clone(),i.y=t.y+c,i.data=3,s.fillBackground.value()){var u={},_=l.timeScale().width(),f=(p.priceScale().height(),s.extendLeft.value()),g=s.extendRight.value();if(f||g)if(!f&&g){var v={};v.width=_,v.p1=r,v.p2=n,v.p3=i,v.p4=t,v.color=s.backgroundColor.value(),v.transparency=s.transparency.value(),v.hittestOnBackground=TradingView.isMobile.any(),e.append(new a(v))}else if(f&&!g){var v={};v.width=_,v.p1=n,v.p2=r,v.p3=t,v.p4=i,v.color=s.backgroundColor.value(),v.transparency=s.transparency.value(),v.hittestOnBackground=TradingView.isMobile.any(),e.append(new a(v))}else{var m=r.add(n).scaled(.5),y=i.add(t).scaled(.5),w={};w.width=_,w.p1=m,w.p2=n,w.p3=y,w.p4=t,w.color=s.backgroundColor.value(),w.transparency=s.transparency.value(),w.hittestOnBackground=TradingView.isMobile.any(),e.append(new a(w));var T={};T.width=_,T.p1=m,T.p2=r,T.p3=y,T.p4=i,T.color=s.backgroundColor.value(),T.transparency=s.transparency.value(),T.hittestOnBackground=TradingView.isMobile.any(),e.append(new a(T))}else u.points=[r,n,t,i],u.color="rgba(0,0,0,0)",u.linewidth=0,u.linestyle=CanvasEx.LINESTYLE_SOLID,u.filled=!0,u.backcolor=s.backgroundColor.value(),u.fillBackground=!0,u.transparency=s.transparency.value(),e.append(new h(u))}}var b=function(e,t){var i={points:[e,t],width:l.timeScale().width(),height:p.priceScale().height(),color:s.linecolor.value(),linewidth:s.linewidth.value(),linestyle:s.linestyle.value(),extendleft:s.extendLeft.value(),extendright:s.extendRight.value(),leftend:s.leftEnd.value(),rightend:s.rightEnd.value()};return i};e.append(new o(b(r,n)));var S=this,C=function(t,i,r,n){if(S.Z97.properties().showPrices.value()){var o={points:[t],text:r,color:S.Z97.properties().textcolor.value(),horzAlign:t.x>i.x?"left":"right",vertAlign:"middle",font:S.Z97.properties().font.value(),offsetX:t.x>i.x?-5:5,offsetY:-5,bold:S.Z97.properties().bold.value(),italic:S.Z97.properties().italic.value(),fontsize:S.Z97.properties().fontsize.value()};e.append(new d(o,S._rendererCache));var o={points:[i],text:n,color:S.Z97.properties().textcolor.value(),horzAlign:t.x<i.x?"left":"right",vertAlign:"middle",font:S.Z97.properties().font.value(),offsetX:t.x>i.x?-5:5,offsetY:-5,bold:S.Z97.properties().bold.value(),italic:S.Z97.properties().italic.value(),fontsize:S.Z97.properties().fontsize.value()};e.append(new d(o,S._rendererCache))}};if(e.append(new o(b(r,n))),C(r,n,this._price1,this._price2),2==this._points.length)return this.addAnchors(e),e;if(e.append(new o(b(i,t))),C(t,i,this._price3,this._price4),this.isAnchorsRequired()){var x=[r,n,t,i];this.Z98.lineBeingCreated()==this.Z97&&x.pop(),e.append(this.createLineAnchor({points:x}))}return!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&r&&n&&this.Z97.getAlertIsActive(function(t){e.append(new TradingView.PaneRendererClockIcon({point1:r,point2:n,color:t?s.linecolor.value():defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),e},inherit(n,l),n.version=1,n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Disjoint Angle"},n.prototype.addPoint=function(e,t){return t&&t.shift&&2==this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),l.prototype.addPoint.call(this,e)},n.prototype.setLastPoint=function(e,t){return t&&t.shift&&2==this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),l.prototype.setLastPoint.call(this,e)},n.prototype.setPoint=function(e,t,i){var r=.5*(this._points[1].price+this._points[2].price);if(i&&i.shift&&1==e){var n=0;this._snapPoint45Degree(t,this.points()[n])}if(3>e&&l.prototype.setPoint.call(this,e,t),0!==e&&2!==e)if(1==e){var o=this._points[1].price-r;this._points[2].price=this._points[1].price-2*o}else if(3==e){var a=this.priceScale(),s=t.price;if(a.isPercent()){var d=this.ownerSource().firstValue();s=a.priceRange().convertFromPercent(s,d)}var o=s-this._points[2].price;this._points[0].price=this._points[1].price-o,this._points[0].index=t.index}},n.prototype.canHasAlert=function(){return!0},n.prototype._getAlertPlots=function(){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 r=this._points[2];r.time=t.time,r.index=t.index;var n={price:r.price+(t.price-e.price),time:e.time,index:e.index},o=[];r.index<=n.index?(o.push(r),o.push(n)):(o.push(n),o.push(r));var a,s;i[0].price>o[0].price?(a=i,s=o):o[0].price>i[0].price?(a=o,s=i):o[1].price>i[1].price?(a=o,s=i):(a=i,s=o);var l,d,h=this.properties().extendLeft.value(),p=this.properties().extendRight.value();return e.index<=t.index?(l=h,d=p):(l=p,d=h),[this._linePointsToAlertPlot(a,"Upper",l,d),this._linePointsToAlertPlot(s,"Lower",l,d)]},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._label1=null,this._label2=null,this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolFlatBottom";var i=t?t:new J50("linetoolflatbottom");a.call(this,e,new r(this,e),i),this.version=n.version}var o=i(44),a=i(13).LineDataSource,s=i(116).ChannelRenderer,l=i(55).TrendLineRenderer,d=i(45).TextRenderer,h=i(89);inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),this._label1=null,this._label2=null,!(this.Z97.points().length<2)&&this.Z97.priceScale()){var e=this.Z97.points()[0],t=this.Z97.points()[1];if(this._price1=this.Z97.priceScale().formatter().format(e.price),this._price2=this.Z97.priceScale().formatter().format(t.price),3==this.Z97.points().length){var i=this.Z97.points()[2];this._price3=this.Z97.priceScale().formatter().format(i.price)}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t,i,r=this._points[0],n=this._points[1],o=this.Z97.properties(),a=this.Z98,p=this.Z97;if(3==this._points.length){t=this._points[2],t.x=n.x;n.y-r.y,n.y-t.y;if(i=r.clone(),i.y=t.y,i.data=3,o.fillBackground.value()){var c={},u=a.timeScale().width(),_=(p.priceScale().height(),o.extendLeft.value()),f=o.extendRight.value();if(_||f)if(!_&&f){var g={};g.width=u,g.p1=r,g.p2=n,g.p3=i,g.p4=t,g.color=o.backgroundColor.value(),g.transparency=o.transparency.value(),g.hittestOnBackground=TradingView.isMobile.any(),e.append(new s(g))}else if(_&&!f){var g={};g.width=u,g.p1=n,g.p2=r,g.p3=t,g.p4=i,g.color=o.backgroundColor.value(),g.transparency=o.transparency.value(),g.hittestOnBackground=TradingView.isMobile.any(),e.append(new s(g))}else{var v=r.add(n).scaled(.5),m=i.add(t).scaled(.5),y={};y.width=u,y.p1=v,y.p2=n,y.p3=m,y.p4=t,y.color=o.backgroundColor.value(),y.transparency=o.transparency.value(),y.hittestOnBackground=TradingView.isMobile.any(),e.append(new s(y));var w={};w.width=u,w.p1=v,w.p2=r,w.p3=m,w.p4=i,w.color=o.backgroundColor.value(),w.transparency=o.transparency.value(),w.hittestOnBackground=TradingView.isMobile.any(),e.append(new s(w))}else c.points=[r,n,t,i],c.color="rgba(0,0,0,0)",c.linewidth=0,c.linestyle=CanvasEx.LINESTYLE_SOLID,c.filled=!0,c.backcolor=o.backgroundColor.value(),c.fillBackground=!0,c.transparency=o.transparency.value(),e.append(new h(c))}}var T=function(e,t){var i={points:[e,t],width:a.timeScale().width(),height:p.priceScale().height(),color:o.linecolor.value(),linewidth:o.linewidth.value(),linestyle:o.linestyle.value(),extendleft:o.extendLeft.value(),extendright:o.extendRight.value(),leftend:o.leftEnd.value(),rightend:o.rightEnd.value()};return i};if(e.append(new l(T(r,n))),2==this._points.length)return this.addAnchors(e),e;var b=this,S=function(t,i,r,n){if(b.Z97.properties().showPrices.value()){var o={points:[t],text:r,color:b.Z97.properties().textcolor.value(),horzAlign:t.x>i.x?"left":"right",vertAlign:"middle",font:b.Z97.properties().font.value(),offsetX:t.x>i.x?-5:5,offsetY:-5,bold:b.Z97.properties().bold.value(),italic:b.Z97.properties().italic.value(),fontsize:b.Z97.properties().fontsize.value()};e.append(new d(o,b._rendererCache));var o={points:[i],text:n,color:b.Z97.properties().textcolor.value(),horzAlign:t.x<i.x?"left":"right",vertAlign:"middle",font:b.Z97.properties().font.value(),offsetX:t.x>i.x?-5:5,offsetY:-5,bold:b.Z97.properties().bold.value(),italic:b.Z97.properties().italic.value(),fontsize:b.Z97.properties().fontsize.value()};e.append(new d(o,b._rendererCache))}};if(e.append(new l(T(r,n))),S(r,n,this._price1,this._price2),2==this._points.length)return e;if(e.append(new l(T(i,t))),S(t,i,this._price3,this._price3),this.isAnchorsRequired()){var C=[r,n,t,i];this.Z98.lineBeingCreated()==this.Z97&&C.pop(),e.append(this.createLineAnchor({points:C}))}return!TradingView.printing&&this.Z97.hasAlert.value()&&!this.Z98.readOnly()&&r&&n&&this.Z97.getAlertIsActive(function(t){e.append(new TradingView.PaneRendererClockIcon({point1:r,point2:n,color:t?o.linecolor.value():defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),e},inherit(n,a),n.version=1,n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Flat Bottom"},n.prototype.addPoint=function(e,t){return t&&t.shift&&2==this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),a.prototype.addPoint.call(this,e)},n.prototype.setLastPoint=function(e,t){return t&&t.shift&&2==this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),a.prototype.setLastPoint.call(this,e)},n.prototype.setPoint=function(e,t,i){.5*(this._points[1].price+this._points[2].price);if(i&&i.shift&&1==e){var r=0;this._snapPoint45Degree(t,this.points()[r])}3>e?a.prototype.setPoint.call(this,e,t):this._points[0].index=t.index},n.prototype.canHasAlert=function(){return!0},n.prototype._getAlertPlots=function(){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 r=this._points[2];r.time=t.time,r.index=t.index;var n={price:r.price,time:e.time,index:e.index},o=[];r.index<=n.index?(o.push(r),o.push(n)):(o.push(n),o.push(r));var a,s;i[0].price>o[0].price?(a=i,s=o):o[0].price>i[0].price?(a=o,s=i):o[1].price>i[1].price?(a=o,s=i):(a=i,s=o);var l,d,h=this.properties().extendLeft.value(),p=this.properties().extendRight.value();return e.index<=t.index?(l=h,d=p):(l=p,d=h),[this._linePointsToAlertPlot(a,"Upper",l,d),this._linePointsToAlertPlot(s,"Lower",h,d)]},e.exports=n},function(e,t,i){"use strict";function r(e,t){this._data=e,this._cache=t}function n(e,t){a.call(this,e,t),this._cache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolIcon";var i=t?t:new J50("linetoolicon");i.addExclusion("angle"),i.addExclusion("scale"),s.call(this,e,new n(this,e),i),this.version=o.version}var a=i(44),s=i(13).LineDataSource,l=i(55).TrendLineRenderer;r.prototype.draw=function(e){var t=String.fromCharCode(this._data.icon);e.font=this._data.size+"px FontAwesome";var i=e.measureText(t).width;e.textBaseline="middle";var r=this._data.point;e.translate(r.x,r.y),e.rotate(this._data.angle-Math.PI/2),e.scale(this._data.scale,1);var n=65536*this._data.icon+this._data.size;this._cache[n]=i,this._data.selected&&(e.fillStyle="rgba(80, 80, 80, 0.2)",e.fillRect(-this._cache[n]/2,-this._data.size/2,this._cache[n],this._data.size)),e.fillStyle=this._data.color,e.fillText(t,-this._cache[n]/2,0)},r.prototype.hitTest=function(e){var t=65536*this._data.icon+this._data.size,i=this._cache[t]*this._data.scale,r=MathEx.Matrix.rotate(-this._data.angle),n=e.substract(this._data.point);return n=r.mult(n),Math.abs(n.y)<=i/2&&Math.abs(n.x)<=this._data.size/2?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,a),n.anchorLimit=80,n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),
this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer;if(this._points.length<1)return e;var t=this.Z97.properties(),i={point:this._points[0],color:t.color.value(),size:t.size.value(),icon:t.icon.value(),angle:t.angle.value(),scale:t.scale.value(),selected:this.isAnchorsRequired()},o=this.Z98,a=this.Z97;if(e.append(new r(i,this._cache)),this.isAnchorsRequired()){var d=65536*i.icon+i.size,h=this._cache[d],p=i.size,c=this._points[0],u=t.scale.value(),_=new MathEx.Point(Math.max(n.anchorLimit,p)/2,0),f=new MathEx.Point(0,Math.max(n.anchorLimit,u*h)/2),g=MathEx.Matrix.rotate(t.angle.value());_=g.mult(_),f=g.mult(f);var v=c.add(_);v.data=0;var m=c.substract(_);m.data=1;var y=c.add(f);y.data=2,y.square=!0;var w=c.substract(f);w.data=3,w.square=!0;var i={points:[v,m],width:o.timeScale().width(),height:a.priceScale().height(),color:"#808080",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED,extendleft:!1,extendright:!1,leftend:s.LINEEND_NORMAL,rightend:s.LINEEND_NORMAL},T=new l(i);T._hittest=null,e.append(T),e.append(this.createLineAnchor({points:[v,m,y,w]}))}return e},o._getAvailIcons=function(){var e=[];e=e.concat([61536,61537,61538,61539]),e=e.concat([61725,61726]),e=e.concat([61575,61576,61796,61797]),e=e.concat([61779,61780,61781,61782,61783,61784,61785,61786]);for(var t=e.slice(0),i=61440;61846>=i;i++)-1==$.inArray(i,e)&&(i%16==15&&61487!==i||i>=61620&&61630>=i||61718!=i&&61719!=i&&61472!=i&&61619!=i&&t.push(i));return t},o.availIcons=o._getAvailIcons(),inherit(o,s),o.version=1,o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return"Icon"},o.prototype.startChanging=function(e,t){s.prototype.startChanging.call(this,e,t);var i=this.properties(),r=65536*i.icon.value()+i.size.value();this._startChangeWidth=this._paneViews[0]._cache[r],i.size.value()<n.anchorLimit?this._sizeScale=i.size.value()/n.anchorLimit:this._sizeScale=1,this._origScale=i.scale.value(),this._startChangeWidth*this._origScale<n.anchorLimit?this._resizeRatio=this._startChangeWidth/n.anchorLimit:this._resizeRatio=1},o.prototype.endChanging=function(){s.prototype.endChanging.call(this),delete this._startChangeWidth,delete this._sizeScale,delete this._resizeRatio},o.prototype.setPoint=function(e,t,i){var r=$.extend({},t),o=this.priceScale();if(o.isPercent()){var a=this.ownerSource().firstValue();r.price=o.priceRange().convertFromPercent(r.price,a)}i&&i.shift&&this.Q0.snapTo45Degrees&&this._snapPoint45Degree(r,this.points()[0]);var s=this.pointToScreenPoint(this.points()[0])[1],l=this.pointToScreenPoint(r)[1];if(0===e||1==e){var d=l.substract(s).normalized(),h=2*l.substract(s).length();h*=this._sizeScale,this.Q0.size.setValue(h);var p=-d.x,c=(d.y,Math.acos(p));Math.asin(d.y)>0&&(c=2*Math.PI-c),0===e&&(c+=Math.PI),this.Q0.angle.setValue(c)}else{var u=this._startChangeWidth,_=l.substract(s).length();if(this._origScale*u<n.anchorLimit){var f=n.anchorLimit/2;this.Q0.scale.setValue(this._origScale*_/f)}else{var f=u/2;this.Q0.scale.setValue(_/f)}}},e.exports=o},function(e,t,i){"use strict";function r(e,t){a.call(this,e,t),this._invalidated=!0}function n(e,t){this._constructor="LineToolRotatedRectangle";var i=t?t:new J50("linetoolrotatedrectangle");o.call(this,e,new r(this,e),i)}var o=i(13).LineDataSource,a=i(44),s=i(55).TrendLineRenderer,l=i(89);inherit(r,a),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){a.prototype.update.call(this),this._distance=0,3==this._points.length&&(this._distance=MathEx.distanceToLine(this._points[0],this._points[1],this._points[2]).distance)},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e,t,i,r,n=new TradingView.CompositeRenderer,a=this.Z97.properties(),d=this._points[0],h=this._points[1];if(2==this._points.length){var p={};p.points=this._points,p.floatPoints=this._floatPoints,p.width=this.Z98.timeScale().width(),p.height=this.Z97.priceScale().height(),p.color=a.color.value(),p.linewidth=1,p.linestyle=CanvasEx.LINESTYLE_SOLID,p.extendleft=!1,p.extendright=!1,p.leftend=o.LINEEND_NORMAL,p.rightend=o.LINEEND_NORMAL,n.append(new s(p))}else if(3==this._points.length){var c=(this._points[2],h.substract(d)),u=new MathEx.Point(c.y,-c.x).normalized().scaled(this._distance),_=u.scaled(-1);e=d.add(u),t=h.add(u),i=d.add(_),r=h.add(_);var p={};p.points=[e,t,r,i],p.color=a.color.value(),p.linewidth=this.Z97.properties().linewidth.value(),p.linestyle=CanvasEx.LINESTYLE_SOLID,p.filled=!0,p.backcolor=a.backgroundColor.value(),p.fillBackground=a.fillBackground.value(),p.transparency=a.transparency.value(),n.append(new l(p))}if(this.isAnchorsRequired()){var f=[];f.push(d),this._points.length>=2&&f.push(h),3==this._points.length&&(e.data=2,i.data=2,t.data=2,r.data=2,f.push(e),f.push(i),f.push(t),f.push(r)),n.append(this.createLineAnchor({points:f}))}return n},inherit(n,o),n.prototype.startChanging=function(e,t){if(o.prototype.startChanging.call(this,e,t),0===e||1===e){var i=this._paneViews[0],r=i._points[0],n=i._points[1],a=i._points[2];this._distance=MathEx.distanceToLine(r,n,a).distance}},n.prototype.setPoint=function(e,t,i){if(o.prototype.setPoint.call(this,e,t,i),0===e||1===e){var r=this._paneViews[0];r.update();var n=r._points[0],a=r._points[1],s=a.substract(n),l=new MathEx.Point(s.y,-s.x).normalized().scaled(this._distance),d=n.add(l),h=this.screenPointToPoint(d);this._points[2]=h}},n.prototype.endChanging=function(){delete this._distance},n.prototype.pointsCount=function(){return 3},n.prototype.title=function(){return"Rotated Rectangle"},e.exports=n},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){s.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolFibSpiral";var i=t?t:new J50("linetoolfibspiral");a.call(this,e,new n(this,e),i)}var a=i(13).LineDataSource,s=i(44),l=i(55).TrendLineRenderer;r.prototype._fibNumbers=function(){return[0,1,2,3,5,8,13,21,34,55,89]},r.prototype._continiusFib=function(e){var t=this._fibNumbers(),i=Math.floor(e),r=Math.ceil(e);if(r>=t.length)return null;var n=e-i;n=Math.pow(n,1.15);var o=t[r]-t[i],a=t[i]+o*n;return a},r.prototype.hitTest=function(e){var t=this._data.points[0],i=this._data.points[1],r=i.substract(t),n=e.substract(t),o=r.normalized(),a=o.transponed(),s=n.normalized(),l=Math.acos(o.dotProduct(s)),d=Math.asin(a.dotProduct(s));0>d&&(l=2*Math.PI-l);for(var h=n.length(),p=0;4>p;p++){var c=l/(.5*Math.PI),u=this._continiusFib(c+4*p);if(u=u*r.length()/5,null!==u&&Math.abs(u-h)<5)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}return null},r.prototype.draw=function(e){e.lineCap="round",e.strokeStyle=this._data.color;var t=this._data.points[0],i=this._data.points[1];e.translate(t.x,t.y);var r=i.substract(t),n=r.length();r=r.normalized();var o=Math.acos(r.x);Math.asin(r.y)<0&&(o=2*Math.PI-o),e.rotate(o),e.scale(n/5,n/5),e.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(e,this._data.linestyle);var a=50,s=Math.PI/(2*a);e.moveTo(0,0);for(var l=0;l<(this._fibNumbers().length-1)*a;l++){var d=l*s,h=this._continiusFib(l/a),p=Math.cos(d)*h,c=Math.sin(d)*h;e.lineTo(p,c)}e.scale(5/n,5/n),e.rotate(-o),e.stroke()},inherit(n,s),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t={};t.points=this._points,t.width=this.Z98.timeScale().width(),t.height=this.Z97.priceScale().height(),t.color=this.Z97.properties().linecolor.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.linestyle=this.Z97.properties().linestyle.value(),t.extendleft=!1,t.extendright=!0,t.leftend=a.LINEEND_NORMAL,t.rightend=a.LINEEND_NORMAL,e.append(new l(t));var t={};return t.points=this._points,t.floatPoints=this._floatPoints,t.width=this.Z98.timeScale().width(),t.height=this.Z97.priceScale().height(),t.color=this.Z97.properties().linecolor.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.linestyle=this.Z97.properties().linestyle.value(),e.append(new r(t)),this.isAnchorsRequired()&&(e.append(new l(t)),this.addAnchors(e)),e},inherit(o,a),o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Fib Spiral"},e.exports=o},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolHeadAndShoulders";var i=t?t:new J50("linetoolheadandshoulders");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(55).TrendLineRenderer,l=i(127).TriangleRenderer,d=i(45).TextRenderer;inherit(r,o),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;for(var e=this.Z97.properties(),t=new TradingView.CompositeRenderer,i=this,r=function(t,r){var n={points:[t],text:$.t(r),color:e.textcolor.value(),horzAlign:"center",font:e.font.value(),offsetX:0,offsetY:0,bold:e.bold&&e.bold.value(),italic:e.italic&&e.italic.value(),fontsize:e.fontsize.value(),backgroundColor:i.Z97.properties().color.value(),backgroundRoundRect:4};return n},n=function(t,r,n,o){var s={points:[t,r],width:i.Z98.timeScale().width(),height:i.Z97.priceScale().height(),color:TradingView.generateColor(i.Z97.properties().color.value(),n),linewidth:o?o:e.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};return s},o=function(t,i,r){var n=[t,i,r],o={};return o.points=n,o.color=e.color.value(),o.linewidth=0,o.backcolor=e.backgroundColor.value(),o.fillBackground=e.fillBackground.value(),o.transparency=e.transparency.value(),o},h=1;h<this._points.length;h++){var p=n(this._points[h-1],this._points[h],0);t.append(new s(p))}if(this._points.length>=5){var c,u,_=!1,f=!1;this._intersect1?c=this._intersect1:(c=this._points[2],_=!0),this._intersect2?u=this._intersect2:(u=this._points[4],f=!0);var p=n(c,u,0);p.extendleft=_,p.extendright=f,t.append(new s(p));var g=o(this._points[2],this._points[3],this._points[4]);t.append(new l(g))}if(this._intersect1){var g=o(this._intersect1,this._points[1],this._points[2]);t.append(new l(g))}if(this._intersect2){var g=o(this._points[4],this._points[5],this._intersect2);t.append(new l(g))}if(this._points.length>=2){var v=this._points[1],m=r(v,"Left Shoulder");this._points[1].y<this._points[0].y?(m.vertAlign="bottom",m.offsetY=-10):(m.vertAlign="top",m.offsetY=5),t.append(new d(m,this._rendererCache))}if(this._points.length>=4){var v=this._points[3],m=r(v,"Head");this._points[3].y<this._points[2].y?(m.vertAlign="bottom",m.offsetY=-10):(m.vertAlign="top",m.offsetY=5),t.append(new d(m,this._rendererCache))}if(this._points.length>=6){var v=this._points[5],m=r(v,"Right Shoulder");this._points[5].y<this._points[4].y?(m.vertAlign="bottom",m.offsetY=-10):(m.vertAlign="top",m.offsetY=5),t.append(new d(m,this._rendererCache))}return this.addAnchors(t),t},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),delete this._intersect1,delete this._intersect2,this._points.length>=5){var e=this._points[0],t=this._points[1],i=this._points[2],r=(this._points[3],this._points[4]),n=MathEx.intersectSegment(i,r,e,t);if(null!==n){var a=r.substract(i);this._intersect1=i.add(a.scaled(n))}if(7==this._points.length){var s=this._points[5],l=this._points[6],n=MathEx.intersectSegment(i,r,s,l);if(null!==n){var a=r.substract(i);this._intersect2=i.add(a.scaled(n))}}}},inherit(n,a),n.prototype.pointsCount=function(){return 7},n.prototype.title=function(){return"Head & Shoulders"},e.exports=n},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){s.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolTriangle";var i=t?t:new J50("linetooltriangle");a.call(this,e,new n(this,e),i)}var a=i(13).LineDataSource,s=i(44);r.prototype.draw=function(e){if(!(this._data.points.length<2)){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t,i=this._data.points[0],r=this._data.points[1];t=2==this._data.points.length?r:this._data.points[2],e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(r.x,r.y),e.lineTo(t.x,t.y),e.lineTo(i.x,i.y),this._data.fillBackground&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.fill()),e.stroke()}},r.prototype.hitTest=function(e){if(this._data.points.length<2)return null;var t=this._data.points[0],i=this._data.points[1],r=this._data.points[2],n=3,o=MathEx.distanceToSegment(t,i,e);if(o.distance<=n)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT);var o=MathEx.distanceToSegment(i,r,e);if(o.distance<=n)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT);var o=MathEx.distanceToSegment(r,t,e);return o.distance<=n?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):this._data.fillBackground&&MathEx.pointInTriangle(t,i,r,e)?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND):null},inherit(n,s),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.Z97.properties().color.value(),e.linewidth=this.Z97.properties().linewidth.value(),e.backcolor=this.Z97.properties().backgroundColor.value(),e.fillBackground=this.Z97.properties().fillBackground.value(),e.transparency=this.Z97.properties().transparency.value(),this.isAnchorsRequired()){var t=new TradingView.CompositeRenderer;return t.append(new r(e)),this.addAnchors(t),t}return new r(e)},inherit(o,a),o.prototype.pointsCount=function(){return 3},o.prototype.title=function(){return"Triangle"},t.TriangleRenderer=r,t.LineToolTriangle=o},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._invalidated=!0}function n(e,t){this._constructor="LineToolTrianglePattern";var i=t?t:new J50("linetooltrianglepattern");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(127).TriangleRenderer,l=i(55).TrendLineRenderer,d=i(45).TextRenderer,h=i(89);inherit(r,o),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;var e=this.Z97.properties(),t=new TradingView.CompositeRenderer,i=this,r=function(t,r){var n={points:[t],text:r,color:e.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:e.font.value(),offsetX:0,offsetY:0,bold:e.bold&&e.bold.value(),italic:e.italic&&e.italic.value(),fontsize:e.fontsize.value(),backgroundColor:i.Z97.properties().color.value(),backgroundRoundRect:4};return n},n=function(t,r){var n={points:[t,r],width:i.Z98.timeScale().width(),height:i.Z97.priceScale().height(),color:i.Z97.properties().color.value(),linewidth:e.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};return n},o=n(this._points[0],this._points[1]);if(t.append(new l(o)),this._points.length>=3){var o=n(this._points[1],this._points[2]);t.append(new l(o))}if(4==this._points.length){var o=n(this._points[2],this._points[3]);if(t.append(new l(o)),this._intersectPoint){var p=[this._startPoint1,this._startPoint2,this._intersectPoint],c={};c.points=p,c.color=e.color.value(),c.linewidth=e.linewidth.value(),c.backcolor=e.backgroundColor.value(),c.fillBackground=e.fillBackground.value(),c.transparency=e.transparency.value(),t.append(new s(c))}else if(this._intersectPoint1&&this._intersectPoint2){var p=[this._startPoint1,this._startPoint2,this._intersectPoint2,this._intersectPoint1],c={};c.filled=!0,c.fillBackground=!0,c.points=p,c.color=e.color.value(),c.linewidth=e.linewidth.value(),c.backcolor=e.backgroundColor.value(),c.transparency=e.transparency.value(),t.append(new h(c))}}var u=r(this._points[0],"A");this._points[1].y>this._points[0].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),t.append(new d(u,this._rendererCache));var u=r(this._points[1],"B");if(this._points[1].y<this._points[0].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),t.append(new d(u,this._rendererCache)),this._points.length>2){var u=r(this._points[2],"C");this._points[2].y<this._points[1].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),t.append(new d(u,this._rendererCache))}if(this._points.length>3){var u=r(this._points[3],"D");this._points[3].y<this._points[2].y?(u.vertAlign="bottom",u.offsetY=-10):(u.vertAlign="top",u.offsetY=5),t.append(new d(u,this._rendererCache))}return this.addAnchors(t),t},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),this._valid=!1,delete this._intersectPoint,delete this._intersectPoint1,delete this._intersectPoint2,4==this._points.length){var e=this._points[0],t=this._points[1],i=this._points[2],r=this._points[3];if(Math.abs(i.x-e.x)<1||Math.abs(r.x-t.x)<1)return;var n=Math.min(e.x,t.x);n=Math.min(n,i.x),n=Math.min(n,r.x);var a=(i.y-e.y)/(i.x-e.x),s=e.y+(n-e.x)*a,l=(r.y-t.y)/(r.x-t.x),d=t.y+(n-t.x)*l;if(Math.abs(a-l)<1e-6)return;this._startPoint1=new MathEx.Point(n,s),this._startPoint2=new MathEx.Point(n,d);var h=(t.y-e.y+(e.x*a-t.x*l))/(a-l);if(this._valid=!0,n>h){var p=Math.max(e.x,t.x);p=Math.max(p,i.x),p=Math.max(p,r.x);var s=e.y+(p-e.x)*a,d=t.y+(p-t.x)*l;this._startPoint1=new MathEx.Point(p,s),this._startPoint2=new MathEx.Point(p,d)}var c=e.y+(h-e.x)*a;this._intersectPoint=new MathEx.Point(h,c)}},inherit(n,a),n.prototype.pointsCount=function(){return 4},n.prototype.title=function(){return"Triangle Pattern"},e.exports=n},function(e,t,i){"use strict";function r(e,t){s.call(this,e,t),this._rendererCache={},this._numericFormatter=new TradingView.NumericFormatter,this._invalidated=!0}function n(e,t){this._constructor="LineTool5PointsPattern";var i=t?t:new J50("linetool5pointspattern");l.call(this,e,new r(this,e),i)}function o(e,t){this._constructor="LineToolCypherPattern";var i=t?t:new J50("linetoolcypherpattern");l.call(this,e,new a(this,e),i)}function a(e,t){s.call(this,e,t),this._rendererCache={},this._numericFormatter=new TradingView.NumericFormatter,this._invalidated=!0}var s=i(44),l=i(13).LineDataSource,d=i(55).TrendLineRenderer,h=i(127).TriangleRenderer,p=i(45).TextRenderer;inherit(r,s),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;var e=this.Z97.properties(),t=new TradingView.CompositeRenderer,i=[this._points[0],this._points[1],this._points.length<3?this._points[1]:this._points[2]],r=this,n=function(t,i){var n={points:[t],text:i,color:e.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:e.font.value(),offsetX:0,offsetY:0,bold:e.bold&&e.bold.value(),italic:e.italic&&e.italic.value(),fontsize:e.fontsize.value(),backgroundColor:r.Z97.properties().color.value(),backgroundRoundRect:4};return n},o=function(e,t){var i={points:[e,t],width:r.Z98.timeScale().width(),height:r.Z97.priceScale().height(),color:r.Z97.properties().color.value(),linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:l.LINEEND_NORMAL,rightend:l.LINEEND_NORMAL};return i},a={};if(a.points=i,a.color=e.color.value(),a.linewidth=e.linewidth.value(),a.backcolor=e.backgroundColor.value(),a.fillBackground=e.fillBackground.value(),a.transparency=e.transparency.value(),t.append(new h(a)),this._points.length>3){var i=[this._points[2],this._points[3],5==this._points.length?this._points[4]:this._points[3]],a={};a.points=i,a.color=e.color.value(),a.linewidth=e.linewidth.value(),a.backcolor=e.backgroundColor.value(),a.fillBackground=e.fillBackground.value(),a.transparency=e.transparency.value(),t.append(new h(a))}if(this._points.length>=3){var s=this._points[0].add(this._points[2]).scaled(.5),c=n(s,this._numericFormatter.format(this._ABRetracement));t.append(new p(c,this._rendererCache))}if(this._points.length>=4){var s=this._points[1].add(this._points[3]).scaled(.5),u=o(this._points[1],this._points[3]);t.append(new d(u));var c=n(s,this._numericFormatter.format(this._BCRetracement));t.append(new p(c,this._rendererCache))}if(this._points.length>=5){var s=this._points[2].add(this._points[4]).scaled(.5),c=n(s,this._numericFormatter.format(this._CDRetracement));t.append(new p(c,this._rendererCache));var u=o(this._points[0],this._points[4]);t.append(new d(u));var s=this._points[0].add(this._points[4]).scaled(.5),c=n(s,this._numericFormatter.format(this._XDRetracement));t.append(new p(c,this._rendererCache))}var c=n(this._points[0],"X");this._points[1].y>this._points[0].y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),t.append(new p(c,this._rendererCache));var c=n(this._points[1],"A");if(this._points[1].y<this._points[0].y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),t.append(new p(c,this._rendererCache)),this._points.length>2){var c=n(this._points[2],"B");this._points[2].y<this._points[1].y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),t.append(new p(c,this._rendererCache))}if(this._points.length>3){var c=n(this._points[3],"C");this._points[3].y<this._points[2].y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),t.append(new p(c,this._rendererCache))}if(this._points.length>4){var c=n(this._points[4],"D");this._points[4].y<this._points[3].y?(c.vertAlign="bottom",c.offsetY=-10):(c.vertAlign="top",c.offsetY=5),t.append(new p(c,this._rendererCache))}return this.addAnchors(t),t},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){s.prototype.update.call(this);var e,t,i,r,n;this.Z97.points().length>=3&&(e=this.Z97.points()[0],t=this.Z97.points()[1],i=this.Z97.points()[2],this._ABRetracement=Math.round(1e3*Math.abs((i.price-t.price)/(t.price-e.price)))/1e3),this.Z97.points().length>=4&&(r=this.Z97.points()[3],this._BCRetracement=Math.round(1e3*Math.abs((r.price-i.price)/(i.price-t.price)))/1e3),this.Z97.points().length>=5&&(n=this.Z97.points()[4],this._CDRetracement=Math.round(1e3*Math.abs((n.price-r.price)/(r.price-i.price)))/1e3,this._XDRetracement=Math.round(1e3*Math.abs((n.price-t.price)/(t.price-e.price)))/1e3)},inherit(n,l),n.prototype.pointsCount=function(){return 5},n.prototype.title=function(){return"XABCD Pattern"},n.prototype._tooltipFieldsHash={time0:{title:"Date 1",value:null},price0:{title:"Price 1",value:null},time1:{title:"Date 2",value:null},price1:{title:"Price 2",value:null},time2:{title:"Date 3",value:null},price2:{title:"Price 3",value:null},time3:{title:"Date 4",value:null},price3:{title:"Price 4",value:null},time4:{title:"Date 5",value:null},price4:{title:"Price 5",value:null}},n.prototype._updateTooltip=function(){var e,t,e,i,r,n,o=this._tooltipFieldsHash,a=this.points().m_values;if(a[0]){var t=this.Z98.timeScale().indexToUserTime(a[0].index);o.time0.value=t?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(t):0,o.price0.value=this.Z98.mainSeries()._formatter.format(a[0].price)}a[1]&&(e=this.Z98.timeScale().indexToUserTime(a[1].index),o.time1.value=e?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(e):0,o.price1.value=this.Z98.mainSeries()._formatter.format(a[1].price)),a[2]&&(i=this.Z98.timeScale().indexToUserTime(a[2].index),o.time2.value=i?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(i):0,o.price2.value=this.Z98.mainSeries()._formatter.format(a[2].price)),a[3]&&(r=this.Z98.timeScale().indexToUserTime(a[3].index),o.time3.value=r?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(r):0,o.price3.value=this.Z98.mainSeries()._formatter.format(a[3].price)),a[4]&&(n=this.Z98.timeScale().indexToUserTime(a[4].index),o.time4.value=e?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(n):0,o.price4.value=this.Z98.mainSeries()._formatter.format(a[4].price))},n.prototype.tooltip=function(){return this._updateTooltip(),this._formatTooltip()},inherit(o,n),inherit(a,r),a.prototype.update=function(){this._invalidated=!0},a.prototype.updateImpl=function(){s.prototype.update.call(this);var e,t,i,r,n;this.Z97.points().length>=3&&(e=this.Z97.points()[0],t=this.Z97.points()[1],i=this.Z97.points()[2],this._ABRetracement=Math.round(1e3*Math.abs((i.price-t.price)/(t.price-e.price)))/1e3),this.Z97.points().length>=4&&(r=this.Z97.points()[3],this._BCRetracement=Math.round(1e3*Math.abs((r.price-e.price)/(t.price-e.price)))/1e3),this.Z97.points().length>=5&&(n=this.Z97.points()[4],this._CDRetracement=Math.round(1e3*Math.abs((n.price-r.price)/(r.price-i.price)))/1e3,this._XDRetracement=Math.round(1e3*Math.abs((n.price-r.price)/(e.price-r.price)))/1e3)},t.LineTool5PointsPattern=n,t.LineToolCypherPattern=o},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._numericFormatter=new TradingView.NumericFormatter,this._invalidated=!0}function n(e,t){this._constructor="LineToolThreeDrivers";var i=t?t:new J50("linetoolthreedrivers");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(55).TrendLineRenderer,l=i(45).TextRenderer;inherit(r,o),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;for(var e=this.Z97.properties(),t=new TradingView.CompositeRenderer,i=this,r=function(t,r){var n={points:[t],text:r,color:e.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:e.font.value(),offsetX:0,offsetY:0,bold:e.bold&&e.bold.value(),italic:e.italic&&e.italic.value(),fontsize:e.fontsize.value(),backgroundColor:i.Z97.properties().color.value(),backgroundRoundRect:4};return n},n=function(t,r,n,o){var s={points:[t,r],width:i.Z98.timeScale().width(),height:i.Z97.priceScale().height(),color:TradingView.generateColor(i.Z97.properties().color.value(),n),linewidth:o?o:e.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};return s},o=1;o<this._points.length;o++){var d=n(this._points[o-1],this._points[o],0);t.append(new s(d))}if(this._retrace1){var d=n(this._points[1],this._points[3],70,1);t.append(new s(d));var h=this._points[1].add(this._points[3]).scaled(.5),p=r(h,this._numericFormatter.format(this._retrace1));t.append(new l(p,this._rendererCache))}if(this._retrace2){var d=n(this._points[3],this._points[5],70,1);t.append(new s(d));var h=this._points[5].add(this._points[3]).scaled(.5),p=r(h,this._numericFormatter.format(this._retrace2));t.append(new l(p,this._rendererCache))}return this.addAnchors(t),t},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(o.prototype.update.call(this),delete this._retrace1,delete this._retrace2,this.Z97.points().length>=4){var e=this.Z97.points()[1],t=this.Z97.points()[2],i=this.Z97.points()[3];this._retrace1=Math.round(100*Math.abs((i.price-t.price)/(t.price-e.price)))/100}if(this.Z97.points().length>=6){var i=this.Z97.points()[3],r=this.Z97.points()[4],n=this.Z97.points()[5];this._retrace2=Math.round(100*Math.abs((n.price-r.price)/(r.price-i.price)))/100}},inherit(n,a),n.prototype.pointsCount=function(){return 7},n.prototype.title=function(){return"Three Drivers Pattern"},e.exports=n},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._rendererCache={},this._numericFormatter=new TradingView.NumericFormatter,this._invalidated=!0}function n(e,t){this._constructor="LineToolABCD";var i=t?t:new J50("linetoolabcd");a.call(this,e,new r(this,e),i)}var o=i(44),a=i(13).LineDataSource,s=i(55).TrendLineRenderer,l=i(45).TextRenderer;inherit(r,o),r.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),this._points.length<2)return null;var e=this.Z97.properties(),t=new TradingView.CompositeRenderer,i=this._points,r=this,n=function(t,i){var n={points:[t],text:i,color:e.textcolor.value(),vertAlign:"middle",horzAlign:"center",font:e.font.value(),offsetX:0,offsetY:0,bold:e.bold&&e.bold.value(),italic:e.italic&&e.italic.value(),fontsize:e.fontsize.value(),backgroundColor:r.Z97.properties().color.value(),backgroundRoundRect:4};return n},o=function(t,i,n,o){var s={points:[t,i],width:r.Z98.timeScale().width(),height:r.Z97.priceScale().height(),color:TradingView.generateColor(r.Z97.properties().color.value(),n),linewidth:o?o:e.linewidth.value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};return s},d=o(i[0],i[1],0);if(t.append(new s(d)),i.length>=3){var d=o(i[1],i[2],0);t.append(new s(d))}if(4==i.length){var d=o(i[2],i[3],0);t.append(new s(d))}var h=n(this._points[0],"A");this._points[1].y>this._points[0].y?(h.vertAlign="bottom",h.offsetY=-10):(h.vertAlign="top",h.offsetY=5),t.append(new l(h,this._rendererCache));var h=n(this._points[1],"B");if(this._points[1].y<this._points[0].y?(h.vertAlign="bottom",h.offsetY=-10):(h.vertAlign="top",h.offsetY=5),t.append(new l(h,this._rendererCache)),this._points.length>2){var h=n(this._points[2],"C");this._points[2].y<this._points[1].y?(h.vertAlign="bottom",h.offsetY=-10):(h.vertAlign="top",h.offsetY=5),t.append(new l(h,this._rendererCache))}if(this._points.length>3){var h=n(this._points[3],"D");this._points[3].y<this._points[2].y?(h.vertAlign="bottom",h.offsetY=-10):(h.vertAlign="top",h.offsetY=5),t.append(new l(h,this._rendererCache))}if(this._points.length>=3){var p=this._points[0].add(this._points[2]).scaled(.5),d=o(this._points[0],this._points[2],70,1);t.append(new s(d));var h=n(p,this._numericFormatter.format(this._ABRetracement));t.append(new l(h,this._rendererCache))}if(this._points.length>=4){var p=this._points[1].add(this._points[3]).scaled(.5),d=o(this._points[1],this._points[3],70,1);t.append(new s(d));var h=n(p,this._numericFormatter.format(this._CDRetracement));t.append(new l(h,this._rendererCache))}return this.addAnchors(t),t},r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){o.prototype.update.call(this);var e,t,i;if(this.Z97.points().length>=3&&(e=this.Z97.points()[0],t=this.Z97.points()[1],i=this.Z97.points()[2],this._ABRetracement=Math.round(1e3*Math.abs((i.price-t.price)/(t.price-e.price)))/1e3),4==this.Z97.points().length){var r=this.Z97.points()[3];this._CDRetracement=Math.round(1e3*Math.abs((r.price-i.price)/(i.price-t.price)))/1e3}},inherit(n,a),n.prototype.pointsCount=function(){return 4},n.prototype.title=function(){return"ABCD Pattern"},n.prototype._tooltipFieldsHash={time0:{title:"Date 1",value:null},price0:{title:"Price 1",value:null},time1:{title:"Date 2",value:null},price1:{title:"Price 2",value:null},time2:{title:"Date 3",value:null},price2:{title:"Price 3",value:null},time3:{title:"Date 4",value:null},price3:{title:"Price 4",value:null}},n.prototype._updateTooltip=function(){var e=this._tooltipFieldsHash,t=this.points().m_values;if(t[0]){var i=this.Z98.timeScale().indexToUserTime(t[0].index);e.time0.value=i?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(i):0,e.price0.value=this.Z98.mainSeries()._formatter.format(t[0].price)}if(t[1]){var r=this.Z98.timeScale().indexToUserTime(t[1].index);
e.time1.value=r?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(r):0,e.price1.value=this.Z98.mainSeries()._formatter.format(t[1].price)}if(t[2]){var n=this.Z98.timeScale().indexToUserTime(t[2].index);e.time2.value=n?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(n):0,e.price2.value=this.Z98.mainSeries()._formatter.format(t[2].price)}if(t[3]){var o=this.Z98.timeScale().indexToUserTime(t[3].index);e.time3.value=o?new TradingView.DateTimeFormatter(this.Z98.mainSeries().isDWM()).format(o):0,e.price3.value=this.Z98.mainSeries()._formatter.format(t[3].price)}},n.prototype.tooltip=function(){return this._updateTooltip(),this._formatTooltip()},e.exports=n},function(e,t,i){"use strict";function r(e,t){l.call(this,e,t),this._rendererCache={},this._invalidated=!0,this._percentageFormatter=new TradingView.PercentageFormatter,this._numericFormatter=new TradingView.NumericFormatter}function n(e,t,i,r){this.Z97=e,this.Z98=t,this._text="",this._invalidated=!0,this._coordinate=0,this._background="black",this._pricePropName=i,this._colorPropName=r}function o(e,t){var i=t?t:new J50("linetoolriskreward");if(this._entryPriceAxisView=new n(this,e,"entryPrice","linecolor"),this._stopPriceAxisView=new n(this,e,"stopPrice","stopBackground"),this._profitPriceAxisView=new n(this,e,"targetPrice","profitBackground"),d.call(this,e,new r(this,e),i),this.Q0.addExclusion&&(this.Q0.addExclusion("stopLevel"),this.Q0.addExclusion("profitLevel")),!t.stopLevel&&!t.profitLevel){var a=e.timeScale().visibleBars(),s=a.firstBar(),l=a.lastBar(),h=e.mainSeries().priceRange(s,l),p=e.mainSeries().priceScale();if(p.isLog()){var c=p.logicalToPrice(h.minValue()),u=p.logicalToPrice(h.maxValue());h=new PriceRange(c,u)}if(p.isPercent()){var _=e.mainSeries().firstValue(),c=p.priceRange().convertFromPercent(h.minValue(),_),u=p.priceRange().convertFromPercent(h.maxValue(),_);h=new PriceRange(c,u)}if(h&&!h.isEmpty()){var f=Math.round(.2*h.length()*e.mainSeries().base());i.merge({stopLevel:f,profitLevel:f})}}var g=this;i.stopLevel.listeners().subscribe(this,o.prototype.recalculate),i.stopLevel.listeners().subscribe(null,function(){g.properties().stopPrice._listeners.fire(g.properties().stopPrice)}),i.profitLevel.listeners().subscribe(this,o.prototype.recalculate),i.profitLevel.listeners().subscribe(null,function(){g.properties().targetPrice._listeners.fire(g.properties().targetPrice)}),i.addProperty("entryPrice"),i.entryPrice=new o.PriceProperty(this,0),i.addProperty("stopPrice"),i.stopPrice=new o.StopPriceProperty(this),i.addProperty("targetPrice"),i.targetPrice=new o.TargetPriceProperty(this),this.version=o.version}function a(e,t){this._constructor="LineToolRiskRewardShort";var i=t?t:new J50("linetoolriskrewardshort");o.call(this,e,i)}function s(e,t){this._constructor="LineToolRiskRewardLong";var i=t?t:new J50("linetoolriskrewardlong");o.call(this,e,i)}var l=i(44),d=i(13).LineDataSource,h=i(55).TrendLineRenderer,p=i(14),c=i(15),u=i(45).TextRenderer,_=i(12).RectangleRenderer;inherit(r,l),r.prototype.i18nCache={pnl:$.t("{0} P&L: {1}"),open:$.t("Open",{context:"line_tool_position"}),closed:$.t("Closed",{context:"line_tool_position"}),ratio:$.t("Risk/Reward Ratio: {0}"),stop:$.t("Stop: {0} ({1})"),target:$.t("Target: {0} ({1})")},r.prototype._formatInTicks=function(e){var t=this.Z98.mainSeries().base();return Math.round(e*t)},r.INDEX_ENTRY=0,r.INDEX_CLOSE=1,r.INDEX_ACTUALENTRY=2,r.INDEX_ACTUALCLOSE=3,r.prototype.isLabelVisible=function(){return this.isHoveredSource()||this.isSelectedSource()},r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(){l.prototype.update.call(this),this._stopLevel=null,this._profitLevel=null;var e=this.Z98.timeScale(),t=this.Z97.priceScale();if(t&&!t.isEmpty()&&!e.isEmpty()&&0!==this.Z97.points().length&&0!==this._points.length&&this.Z98.mainSeries().bars().last()&&!(this.Z97.points().length<2)&&0!==this.Z98.mainSeries().bars().length){this._isClosed=4==this.Z97.points().length;var i,n;if(this._isClosed){if(i=this.Z97.points()[r.INDEX_ACTUALCLOSE].price,this.Z97.points()[r.INDEX_ACTUALCLOSE].index<parseInt(this.Z97.Z98.mainSeries().bars().first()))return;n=Math.min(parseInt(this.Z97.Z98.mainSeries().bars().last()),this.Z97.points()[r.INDEX_ACTUALCLOSE].index),this._closeBar=this.Z97.Z98.timeScale().indexToCoordinate(n)}else{if(this.Z97.points()[r.INDEX_CLOSE].index<parseInt(this.Z97.Z98.mainSeries().bars().first()))return;n=Math.min(parseInt(this.Z97.Z98.mainSeries().bars().last()),this.Z97.points()[r.INDEX_CLOSE].index);var o=this.Z98.mainSeries().bars().valueAt(n);i=o[TradingView.CLOSE_PLOT],this._closeBar=this.Z97.Z98.timeScale().indexToCoordinate(n)}var a=this.Z97.priceScale(),s=this.Z97.stopPrice(),d=this.Z97.profitPrice();if(this._pl=this.Z97.points().length>1?this.Z97.calculatePL(i):0,a.isPercent()){var h=this.Z97.ownerSource().firstValue();s=a.priceRange().convertToPercent(s,h),d=a.priceRange().convertToPercent(d,h),i=a.priceRange().convertToPercent(i,h)}this._entryLevel=this._points[r.INDEX_ENTRY].y,this._stopLevel=t.priceToCoordinate(s),this._profitLevel=t.priceToCoordinate(d),this._closeLevel=t.priceToCoordinate(i),this._closeBar=this.Z97.Z98.timeScale().indexToCoordinate(n)}},r.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer;if(this._points.length<2||this.Z97.points().length<2)return e;var t=this,i=this.Z97.properties(),n=(this.Z98.timeScale(),this._points[r.INDEX_ENTRY].x),o=this._points[r.INDEX_ACTUALENTRY]?this._points[r.INDEX_ACTUALENTRY].x:this._points[r.INDEX_CLOSE].x,a=this._points[r.INDEX_ACTUALCLOSE]?this._points[r.INDEX_ACTUALCLOSE].x:this._points[r.INDEX_CLOSE].x,s=this._points[r.INDEX_CLOSE].x,l=new MathEx.Point(n,this._entryLevel),p=new MathEx.Point(s,this._stopLevel),c={};if(c.points=[l,p],c.color="white",c.linewidth=0,c.backcolor=i.stopBackground.value(),c.fillBackground=!0,c.transparency=i.stopBackgroundTransparency.value(),e.append(new _(c,new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT))),this._pl<0){var l=new MathEx.Point(o,this._entryLevel),p=new MathEx.Point(a,this._closeLevel),c={};c.points=[l,p],c.color="white",c.linewidth=0,c.backcolor=i.stopBackground.value(),c.fillBackground=!0;var f=.01*i.stopBackgroundTransparency.value(),g=100*(1-f*f*f),v=100-g;c.transparency=v,e.append(new _(c,new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)))}var l=new MathEx.Point(n,this._entryLevel),p=new MathEx.Point(s,this._profitLevel),c={};if(c.points=[l,p],c.color="white",c.linewidth=0,c.backcolor=i.profitBackground.value(),c.fillBackground=!0,c.transparency=i.profitBackgroundTransparency.value(),e.append(new _(c,new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT))),this._pl>0){var l=new MathEx.Point(o,this._entryLevel),p=new MathEx.Point(a,this._closeLevel),c={};c.points=[l,p],c.color="white",c.linewidth=0,c.backcolor=i.profitBackground.value(),c.fillBackground=!0;var f=.01*i.profitBackgroundTransparency.value(),m=100*(1-f*f*f),y=100-m;c.transparency=y,e.append(new _(c,new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT),new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)))}var w=function(i,r,n){var o={};o.points=[i,r],o.width=t.Z98.timeScale().width(),o.height=t.Z97.priceScale().height(),o.color=n?n:t.Z97.properties().linecolor.value(),o.linewidth=t.Z97.properties().linewidth.value(),o.linestyle=CanvasEx.LINESTYLE_SOLID,o.extendleft=!1,o.extendright=!1,o.leftend=d.LINEEND_NORMAL,o.rightend=d.LINEEND_NORMAL,e.append(new h(o))};if(this._points[r.INDEX_ACTUALENTRY]){var l=this._points[r.INDEX_ACTUALENTRY],p=this._isClosed?this._points[r.INDEX_ACTUALCLOSE]:new MathEx.Point(this._closeBar,this._closeLevel),c={};c.points=[l,p],c.width=t.Z98.timeScale().width(),c.height=t.Z97.priceScale().height(),c.color=t.Z97.properties().linecolor.value(),c.linewidth=1,c.linestyle=CanvasEx.LINESTYLE_DASHED,c.extendleft=!1,c.extendright=!1,c.leftend=d.LINEEND_NORMAL,c.rightend=d.LINEEND_ARROW,e.append(new h(c))}var t=this,T=function(r,n,o,a,s,l){if(t.isLabelVisible()||TradingView.printing){var d={};d.points=[r],d.text=n,d.color=i.textcolor.value(),d.font=i.font.value(),d.offsetX=3,d.offsetY=s,d.vertAlign=a,d.horzAlign="center",d.backgroundRoundRect=4,d.backgroundColor=TradingView.resetTransparency(o),d.fontsize=i.fontsize.value(),d.backgroundHorzInflate=4,d.backgroundVertInflate=2,l&&(d.borderColor=l),e.append(new u(d,t._rendererCache))}},b=this.Z97.entryPrice(),S=this.Z97.stopPrice(),C=this.Z97.profitPrice(),x=Math.abs(S-b),P=Math.round(1e4*x/b)/100,L=Math.abs(C-b),E=Math.round(1e4*L/b)/100,V=Math.abs(b-C)/Math.abs(b-S),l=new MathEx.Point(n,this._points[r.INDEX_ENTRY].y),p=new MathEx.Point(s,this._points[r.INDEX_ENTRY].y);w(l,p);var I=new MathEx.Point((n+s)/2,Math.round(this._points[0].y)+.5),A="";if(this._points[1]&&void 0!==this._pl){var k=this._isClosed?this.i18nCache.closed:this.i18nCache.open;A=this.i18nCache.pnl.format(k,this.Z97.priceScale().formatter().format(this._pl))+"\n"}A+=this.i18nCache.ratio.format(this._numericFormatter.format(Math.round(100*V)/100))+" ";var R=i.linecolor.value();this._pl<0?R=i.stopBackground.value():this._pl>0&&(R=i.profitBackground.value()),T(I,A,R,"middle",0,"white");var l=new MathEx.Point(n,this._stopLevel),p=new MathEx.Point(s,this._stopLevel);w(l,p,i.stopBackground.value());var I=new MathEx.Point((n+s)/2,this._stopLevel),A=this.i18nCache.stop.format(this.Z97.priceScale().formatter().format(x),this._percentageFormatter.format(P));T(I,A,i.stopBackground.value(),S>b?"bottom":"top",S>b?-12:-1);var l=new MathEx.Point(n,this._profitLevel),p=new MathEx.Point(s,this._profitLevel);w(l,p,i.profitBackground.value());var I=new MathEx.Point((n+s)/2,this._profitLevel),A=this.i18nCache.target.format(this.Z97.priceScale().formatter().format(L),this._percentageFormatter.format(E));if(T(I,A,i.profitBackground.value(),S>b?"top":"bottom",S>b?-1:-12),this.isAnchorsRequired()){var M=this._points[0].clone();M.data=0;var O=new MathEx.Point(n,this._stopLevel);O.data=1;var D=new MathEx.Point(n,this._profitLevel);D.data=2;var B=new MathEx.Point(s,M.y);B.data=3,e.append(this.createLineAnchor({points:[M,O,D,B]}))}return e},inherit(n,p),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(0!==this.Z97.points().length&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()){var e=this.Z97.properties()[this._pricePropName].value();this._background=this.Z97.properties()[this._colorPropName].value(),this._coordinate=this.Z97.priceScale().priceToCoordinate(e),this._text=this.Z97.priceScale()?this.Z97.priceScale().formatter().format(e):""}},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={text:this._text,coordinate:this._coordinate,color:this.color(),background:TradingView.resetTransparency(this._background),visible:!0};return new c(e)},inherit(o,d),o.version=2,o.prototype.i18nCache={title:$.t("Risk/Reward")},o.prototype.migrateVersion=function(e,t,i){if(1==e&&this._points.length>=1){var r=[];r.push(this._points[0]);var n=this._points[0];if(n={price:n.price,index:n.index+50},r.push(n),this._points[1]&&r.push(this._points[1]),this._points[2]&&r.push(this._points[2]),this._points=r,this._timePoint.length>=1){var o=[],n=this._timePoint[0];o.push(n);var a={price:n.price,time_t:n.time_t,offset:n.offset+50};o.push(a),this._timePoint[1]&&r.push(this._points[1]),this._timePoint[2]&&r.push(this._points[2]),this._timePoint=o}}},o.prototype.checkAlert=function(){this.recalculate()},o.prototype.priceAxisViews=function(e,t){return this._isActualSymbol?t!==this.priceScale()||this.Z98.paneForSource(this)!==e?null:[this._entryPriceAxisView,this._stopPriceAxisView,this._profitPriceAxisView]:null},o.prototype.updateAllViews=function(){this._isActualSymbol&&this.Q0.visible.value()&&(TradingView.drawingState.hideAllDrawings().value()&&this.userEditEnabled()||(d.prototype.updateAllViews.call(this),this._entryPriceAxisView.update(),this._stopPriceAxisView.update(),this._profitPriceAxisView.update()))},o.prototype.setPoint=function(e,t){var i,r=this.priceScale();switch(r.isPercent()&&(i=this.ownerSource().firstValue(),t.price=r.priceRange().convertFromPercent(t.price,i)),e){case 0:t.price=this._roundPrice(t.price),r.isPercent()&&(t.price=r.priceRange().convertToPercent(t.price,i)),d.prototype.setPoint.call(this,e,t),this.recalculate();break;case 1:this.properties().stopPrice.setValue(this.preparseStopPrice(t.price));break;case 2:this.properties().targetPrice.setValue(this.preparseProfitPrice(t.price));break;case 3:t.price=this._roundPrice(t.price),r.isPercent()&&(t.price=r.priceRange().convertToPercent(t.price,i)),d.prototype.setPoint.call(this,1,t),this.recalculate()}},o.PriceProperty=function(e,t){d.PointPriceProperty.call(this,e,t)},inherit(o.PriceProperty,d.PointPriceProperty),o.PriceProperty.prototype.setValue=function(e){var t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(e),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.recalculate(),this._lineSource.Z98.updateSource(this._lineSource),this._listeners.fire(this),this._lineSource.endChanging()},o.StopPriceProperty=function(e){o.PriceProperty.call(this,e,1)},inherit(o.StopPriceProperty,o.PriceProperty),o.StopPriceProperty.prototype.value=function(){var e=this._lineSource.stopPrice(),t=this._lineSource.ownerSource().formatter(),i=t.parse(t.format(e));return i.price?i.price:i.value},o.StopPriceProperty.prototype.setValue=function(e){var t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.Z98.mainSeries().base());this._lineSource.properties().stopLevel.setValue(t),this._lineSource.properties().stopLevel.listeners().fire(this._lineSource.properties().stopLevel)},o.TargetPriceProperty=function(e){o.PriceProperty.call(this,e,2)},inherit(o.TargetPriceProperty,o.PriceProperty),o.TargetPriceProperty.prototype.value=function(){var e=this._lineSource.profitPrice(),t=this._lineSource.ownerSource().formatter(),i=t.parse(t.format(e));return i.price?i.price:i.value},o.TargetPriceProperty.prototype.setValue=function(e){var t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.Z98.mainSeries().base());this._lineSource.properties().profitLevel.setValue(t),this._lineSource.properties().profitLevel.listeners().fire(this._lineSource.properties().profitLevel)},o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return this.i18nCache.title},o.prototype.addPoint=function(e){var t=$.extend({},e),i=this.priceScale();if(i.isPercent()){var r=this.ownerSource().firstValue();t.price=i.priceRange().convertFromPercent(t.price,r)}t.price=this._roundPrice(t.price),this._points.push(t);var n={price:t.price,index:t.index+50};this._points.push(n);var o=this.calculateActualEntry(t,n);if(o){this._points.push(o);var n=this.findClosePoint(o,n);n&&this._points.push(n)}return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0},o.prototype._roundPrice=function(e){var t=this.Z98.mainSeries().base(),i=Math.round(e*t);return i/t},o.prototype.recalculate=function(){if(this.properties().interval.value()==this.Z98.mainSeries().interval()&&0!==this.points().length){var e=this.properties().targetPrice.value(),t=this.properties().stopPrice.value(),i=[this._points[0],this._points[1]],r=this.calculateActualEntry(this.points()[0],this.points()[1]);if(r){i.push(r);var n=this.findClosePoint(r,this.points()[1]);n&&i.push(n)}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)}},o.prototype.startMoving=function(e){e.price=this._roundPrice(e.price),d.prototype.startMoving.call(this,e)},o.prototype.move=function(e){e.price=this._roundPrice(e.price),d.prototype.move.call(this,e),this.recalculate(),this._entryPriceAxisView.update()},o.prototype.correctPoints=function(e){d.prototype.correctPoints.call(this,[e[0],e[1]])},o.prototype.entryPrice=function(){return this.points()[0].price},o.prototype.findClosePoint=function(e,t){for(var i=this.Z98.mainSeries().bars(),r=parseInt(i.first(),10),n=Math.max(e.index,r),o=(e.price,parseInt(i.last(),10)),a=n;a<=Math.min(o,t.index);a++){var s=i.valueAt(a),l=this.checkStopPrice(s);if(null!=l)return{index:a,price:l}}return null},o.prototype.calculateActualEntry=function(e,t){for(var i=this.Z98.mainSeries().bars(),r=parseInt(i.first(),10),n=Math.max(e.index,r),o=e.price,a=parseInt(i.last(),10),s=n;s<=Math.min(a,t.index);s++){var l=i.valueAt(s);if(l[TradingView.HIGH_PLOT]>=o&&l[TradingView.LOW_PLOT]<=o)return{index:s,price:o}}return null},inherit(a,o),a.prototype.i18nCache={title:$.t("Risk/Reward short")},a.prototype.title=function(){return this.i18nCache.title},a.prototype.stopPrice=function(){return this.entryPrice()+this.properties().stopLevel.value()/this.Z98.mainSeries().base()},a.prototype.profitPrice=function(){return this.entryPrice()-this.properties().profitLevel.value()/this.Z98.mainSeries().base()},a.prototype.calculatePL=function(e){return this.entryPrice()-e},a.prototype.preparseStopPrice=function(e){e=this._roundPrice(e);var t=this.entryPrice()+1/this.Z98.mainSeries().base();return Math.max(e,t)},a.prototype.preparseProfitPrice=function(e){e=this._roundPrice(e);var t=this.entryPrice()-1/this.Z98.mainSeries().base();return Math.min(e,t)},a.prototype.checkStopPrice=function(e){var t=this.stopPrice(),i=this.profitPrice();return e[TradingView.HIGH_PLOT]>=t?this.stopPrice():e[TradingView.LOW_PLOT]<=i?this.profitPrice():null},s.prototype.i18nCache={title:$.t("Risk/Reward long")},inherit(s,o),s.prototype.stopPrice=function(){return this.entryPrice()-this.properties().stopLevel.value()/this.Z98.mainSeries().base()},s.prototype.profitPrice=function(){return this.entryPrice()+this.properties().profitLevel.value()/this.Z98.mainSeries().base()},s.prototype.calculatePL=function(e){return e-this.entryPrice()},s.prototype.preparseStopPrice=function(e){e=this._roundPrice(e);var t=this.entryPrice()-1/this.Z98.mainSeries().base();return Math.min(e,t)},s.prototype.preparseProfitPrice=function(e){e=this._roundPrice(e);var t=this.entryPrice()+1/this.Z98.mainSeries().base();return Math.max(e,t)},s.prototype.checkStopPrice=function(e){var t=this.stopPrice(),i=this.profitPrice();return e[TradingView.LOW_PLOT]<=t?this.stopPrice():e[TradingView.HIGH_PLOT]>=i?this.profitPrice():null},s.prototype.title=function(){return this.i18nCache.title},t.LineToolRiskReward=o,t.LineToolRiskRewardLong=s,t.LineToolRiskRewardShort=a},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._invalidated=!0}function n(e,t){this._constructor="LineToolPolyline";var i;t?i=t:(i=new J50("linetoolpolyline"),i.filled.setValue(!1)),a.call(this,e,new r(this,e),i),i.addExclusion("filled")}var o=i(44),a=i(13).LineDataSource,s=i(89);inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){o.prototype.update.call(this),this._invalidated=!1},r.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.Z97.properties().linecolor.value(),e.linewidth=this.Z97.properties().linewidth.value(),e.linestyle=this.Z97.properties().linestyle.value(),e.filled=this.Z97.properties().filled.value(),e.backcolor=this.Z97.properties().backgroundColor.value(),e.fillBackground=this.Z97.properties().fillBackground.value(),e.transparency=this.Z97.properties().transparency.value(),this.isAnchorsRequired()){var t=new TradingView.CompositeRenderer;return t.append(new s(e)),this.addAnchors(t),t}return new s(e)},inherit(n,a),n.prototype.pointsCount=function(){return-1},n.prototype.title=function(){return"Polyline"},n.prototype.addPoint=function(e){var t=this.Z98.timeScale().indexToCoordinate(e.index),i=e.price,r=null;this.priceScale().isPercent()&&(r=this.ownerSource().firstValue());var n=this.priceScale().priceToCoordinate(i),o=5;if(this._points.length>0){var s=this._points[this._points.length-1],l=this.Z98.timeScale().indexToCoordinate(s.index),d=s.price;this.priceScale().isPercent()&&(d=this.priceScale().priceRange().convertToPercent(d,r));var h=this.priceScale().priceToCoordinate(d),p=new MathEx.Point(t,n).substract(new MathEx.Point(l,h)).length();if(o>p)return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0;var c=this._points[0],u=this.Z98.timeScale().indexToCoordinate(c.index),_=c.price;this.priceScale().isPercent()&&(_=this.priceScale().priceRange().convertToPercent(_,r));var f=this.priceScale().priceToCoordinate(_),g=new MathEx.Point(t,n).substract(new MathEx.Point(u,f)).length();if(o>g)return this.Q0.filled.setValue(!0),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}return a.prototype.addPoint.call(this,e)},n.prototype.setPoint=function(e,t){if(a.prototype.setPoint.call(this,e,t),!(this.Z98.timeScale().isEmpty()||this.priceScale().isEmpty()||e!==this._points.length-1&&0!==e)){var i=5,r=this.Z98.timeScale().indexToCoordinate(t.index),n=this.priceScale().priceToCoordinate(t.price),o=e===this._points.length-1?this._points[0]:this._points[this._points.length-1],s=this.Z98.timeScale().indexToCoordinate(o.index),l=this.priceScale().priceToCoordinate(o.price),d=new MathEx.Point(r,n).substract(new MathEx.Point(s,l)).length();i>d&&this.Q0.filled.setValue(!0)}},e.exports=n},function(e,t,i){"use strict";function r(e){this._data=e,this._targetFontSize1=11,this._targetFontSize2=11,this._targetFontSize3=14,this._font="Arial",this._sourceFontSize1=12,this._sourceFontSize2=10}function n(e,t){a.call(this,e,t),this._clockWhite=TradingView.getImage("prediction-clock-white",TradingView.wrapUrl("images/prediction-clock-white.png")),this._clockBlack=TradingView.getImage("prediction-clock-black",TradingView.wrapUrl("images/prediction-clock-black.png")),this._successIcon=TradingView.getImage("prediction-success-white",TradingView.wrapUrl("images/prediction-success-white.png")),this._failureIcon=TradingView.getImage("prediction-failure-white",TradingView.wrapUrl("images/prediction-failure-white.png")),this._percentageFormatter=new TradingView.PercentageFormatter,this._invalidated=!0}function o(e,t){this._constructor="LineToolPrediction";var i=t?t:new J50("linetoolprediction");i.merge({status:o.ALERT_STATUS_WAITING}),s.call(this,e,new n(this,e),i)}var a=i(44),s=i(13).LineDataSource;r.prototype.drawBalloon=function(e,t,i,r,n,o){var a=6,s=5,l=5,d=o||20,h=3;if(e.beginPath(),"down"===n){var p=new MathEx.Point(t.x-d,t.y-a-l-r);return e.moveTo(p.x+h,p.y),e.lineTo(p.x+i-h,p.y),e.arcTo(p.x+i,p.y,p.x+i,p.y+h,h),e.lineTo(p.x+i,p.y+r-h),e.arcTo(p.x+i,p.y+r,p.x+i-h,p.y+r,h),e.lineTo(p.x+d+s,p.y+r),e.lineTo(p.x+d,p.y+r+l),e.lineTo(p.x+d-s,p.y+r),e.lineTo(p.x+h,p.y+r),e.arcTo(p.x,p.y+r,p.x,p.y+r-h,h),e.lineTo(p.x,p.y+h),e.arcTo(p.x,p.y,p.x+h,p.y,h),p}var c=new MathEx.Point(t.x-d,t.y+a+l+r);return e.moveTo(c.x+h,c.y),e.lineTo(c.x+i-h,c.y),e.arcTo(c.x+i,c.y,c.x+i,c.y-h,h),e.lineTo(c.x+i,c.y-r+h),e.arcTo(c.x+i,c.y-r,c.x+i-h,c.y-r,h),e.lineTo(c.x+d+s,c.y-r),e.lineTo(c.x+d,c.y-r-l),e.lineTo(c.x+d-s,c.y-r),e.lineTo(c.x+h,c.y-r),e.arcTo(c.x,c.y-r,c.x,c.y-r+h,h),e.lineTo(c.x,c.y-h),e.arcTo(c.x,c.y,c.x+h,c.y,h),new MathEx.Point(c.x,c.y-r)},r.prototype.drawTargetLabel=function(e){var t=this._data.points[1];e.save(),e.translate(.5,.5),e.font="normal "+this._targetFontSize3+"px "+this._font;var i=1.5*this._targetFontSize1+1.5*this._targetFontSize2+3,r=e.measureText(this._data.targetLine1).width,n=e.measureText(this._data.targetLine2).width;e.font="normal "+this._targetFontSize2+"px "+this._font;var a=e.measureText(this._data.targetLine3).width,s=e.measureText(this._data.targetLine4).width,l=Math.max(r+n,a+s+10)+20,d="up"===this._data.direction?"down":"up",h=t.x+l-e.canvas.width+5;h=Math.max(20,Math.min(l-15,h));var p=this.drawBalloon(e,t,l,i,d,h);e.save(),e.fillStyle=TradingView.generateColor(this._data.targetBackColor,this._data.transparency),e.fill(),e.restore(),e.save(),e.lineWidth=2,e.strokeStyle=TradingView.generateColor(this._data.targetStrokeColor,this._data.transparency),e.stroke(),e.restore();var c=3;e.beginPath(),e.arc(t.x,t.y,c,0,2*Math.PI,!1),e.fillStyle=this._data.centersColor,e.fill(),e.textAlign="left";var u=6,_=4;e.fillStyle=this._data.targetTextColor,e.font="normal "+this._targetFontSize3+"px "+this._font,e.fillText(this._data.targetLine1,p.x+u,p.y+this._targetFontSize1+_);var f=13,g=5;e.fillText(this._data.targetLine2,p.x+u+r+g,p.y+this._targetFontSize1+_),e.font="normal "+this._targetFontSize2+"px "+this._font;var v=p.y+this._targetFontSize1+2*_+this._targetFontSize2;if(e.fillText(this._data.targetLine3,p.x+u,v),e.drawImage(this._data.clockWhite,p.x+u+a+6,v-this._targetFontSize2+3),e.fillText(this._data.targetLine4,p.x+u+a+f+5,v),!this._data.status)return void e.restore();var m=this._targetFontSize1+4;e.font="bold "+this._targetFontSize1+"px "+this._font;var y,w,T,b;switch(this._data.status){case o.ALERT_STATUS_SUCCESS:y=$.t("SUCCESS"),w=TradingView.generateColor(this._data.successBackground,this._data.transparency),T=this._data.successTextColor,b=this._data.successIcon;break;case o.ALERT_STATUS_FAILURE:y=$.t("FAILURE"),w=TradingView.generateColor(this._data.failureBackground,this._data.transparency),T=this._data.failureTextColor,b=this._data.failureIcon}var S=e.measureText(y).width,C=Math.round((l-S)/2);e.fillStyle=w,"up"===this._data.direction?(e.roundRect(p.x-1,p.y-m-2,l+2,m,5),e.fill(),e.fillStyle=T,e.fillText(y,p.x+C,p.y-5),e.drawImage(b,p.x+C-13,p.y-14)):(e.roundRect(p.x-1,p.y+i+3,l+2,m,5),e.fill(),e.fillStyle=T,e.fillText(y,p.x+C,p.y+i+m-1),e.drawImage(b,p.x+C-13,p.y+i+5)),e.restore()},r.prototype.drawStartLabel=function(e){e.save(),e.translate(.5,.5),e.font="normal "+this._sourceFontSize1+"px "+this._font;var t=1.5*this._sourceFontSize1+1.5*this._sourceFontSize2,i=e.measureText(this._data.sourceLine1).width;e.font="normal "+this._fontsize2+"px "+this._font;var r=e.measureText(this._data.sourceLine2).width,n=Math.max(i,r)-5,o=this._data.points[0],a=this.drawBalloon(e,o,n,t,this._data.direction);e.fillStyle=TradingView.generateColor(this._data.sourceBackColor,this._data.transparency),e.fill(),e.lineWidth=2,e.strokeStyle=TradingView.generateColor(this._data.sourceStrokeColor,this._data.transparency),e.stroke();var s=3;e.beginPath(),e.arc(o.x,o.y,s,0,2*Math.PI,!1),e.fillStyle=this._data.centersColor,e.fill(),e.textAlign="left";var l=3,d=2;e.fillStyle=this._data.sourceTextColor,e.font="normal "+this._sourceFontSize1+"px "+this._font,e.fillText(this._data.sourceLine1,a.x+l,a.y+this._sourceFontSize1+d),e.font="normal "+this._sourceFontSize2+"px "+this._font,e.fillText(this._data.sourceLine2,a.x+l,a.y+this._sourceFontSize1+2*d+this._sourceFontSize2),e.restore()},r.prototype.draw=function(e){if(!(this._data.points.length<2)){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle;var t=this._data.points[0],i=this._data.points[1],r=(new MathEx.Point(t.y,i.x),i.substract(t));Math.abs(r.x)<1||Math.abs(r.y)<1?(e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.stroke()):(e.save(),e.beginPath(),e.translate(t.x,t.y),e.scale(1,r.y/r.x),e.moveTo(0,0),e.arcTo(r.x,0,r.x,r.x,Math.abs(r.x)),e.lineTo(r.x,r.x),e.restore(),e.stroke()),this.drawTargetLabel(e),this.drawStartLabel(e);var n=Math.max(8,4*this._data.linewidth);e.fillStyle=this._data.color;var o,a=r.y<0?1:-1;if(Math.abs(r.x)<1||Math.abs(r.y)<1)var o=Math.atan(r.x/r.y);else{var s,l,d=Math.abs(r.x),h=Math.abs(r.y),p=(Math.PI*(3*(d+h)-Math.sqrt((3*d+h)*(3*h+d))),0),c=Math.PI/2,u=(p+c)/2;if(r.length()>n)for(;;){s=d*Math.sin(u),l=h*(1-Math.cos(u));var _=Math.sqrt((s-d)*(s-d)+(l-h)*(l-h));if(Math.abs(_-n)<1)break;_>n?p=u:c=u,u=(p+c)/2}o=Math.atan((d-s)/(h-l)),r.x*r.y<0&&(o=-o)}e.save(),e.beginPath(),e.translate(i.x,i.y),e.rotate(-o),e.moveTo(0,0),e.lineTo(-n/2,a*n),e.lineTo(n/2,a*n),e.lineTo(0,0),e.restore(),e.fill()}},r.prototype.targetLabelHitTest=function(e){var t=this._data.points[1],i=1.5*this._targetFontSize1+1.5*this._targetFontSize2,r=this._targetFontSize1*this._data.targetLine1.length,n=this._targetFontSize1*this._data.targetLine2.length,o=this._targetFontSize2*this._data.targetLine3.length,a=this._targetFontSize2*this._data.targetLine4.length;this._data.status&&(i+=1.5*this._targetFontSize1);var s=Math.max(r+n,o+a)-20,l=20,d=5,h="up"===this._data.direction?-1:1,p=t.x-l,c=t.y+d*h,u=t.y+(d+i)*h,_=Math.min(c,u),f=Math.max(c,u);return e.x>=p&&e.x<=p+s&&e.y>=_&&e.y<=f?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},r.prototype.sourceLabelHitTest=function(e){var t=1.5*this._sourceFontSize1+1.5*this._sourceFontSize2,i=this._sourceFontSize1*this._data.sourceLine1.length,r=this._sourceFontSize2*this._data.sourceLine2.length,n=Math.max(i,r),o=this._data.points[0],a=20,s=5,l="up"===this._data.direction?1:-1,d=o.x-a,h=o.y+s*l,p=o.y+(s+t)*l,c=Math.min(h,p),u=Math.max(h,p);return e.x>=d&&e.x<=d+n&&e.y>=c&&e.y<=u?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},r.prototype.hitTest=function(e){if(this._data.points.length<2)return null;var t=this._data.points[0],i=this._data.points[1],r=i.substract(t),r=(new MathEx.Point(t.y,i.x),i.substract(t)),n=e.substract(t),o=Math.abs(r.x),a=Math.abs(r.y),s=MathEx.sign(r.y)*(a-a*Math.sqrt(1-n.x*n.x/(o*o))),l=3;if(Math.abs(s-n.y)<l)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT);var d=this.targetLabelHitTest(e);return d?d:this.sourceLabelHitTest(e)},inherit(n,a),n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};if(e.points=this._points,e.color=this.Z97.properties().linecolor.value(),e.linewidth=this.Z97.properties().linewidth.value(),e.targetLine1=this._targetLine1,e.targetLine2=this._targetLine2,e.targetLine3=this._targetLine3,e.targetLine4=this._targetLine4,e.status=this.Z97.properties().status.value(),e.transparency=this.Z97.properties().transparency.value(),e.targetBackColor=this.Z97.properties().targetBackColor.value(),e.targetStrokeColor=this.Z97.properties().targetStrokeColor.value(),e.targetTextColor=this.Z97.properties().targetTextColor.value(),e.sourceBackColor=this.Z97.properties().sourceBackColor.value(),e.sourceStrokeColor=this.Z97.properties().sourceStrokeColor.value(),e.sourceTextColor=this.Z97.properties().sourceTextColor.value(),e.successBackground=this.Z97.properties().successBackground.value(),e.successTextColor=this.Z97.properties().successTextColor.value(),e.failureBackground=this.Z97.properties().failureBackground.value(),e.failureTextColor=this.Z97.properties().failureTextColor.value(),e.intermediateBackColor=this.Z97.properties().intermediateBackColor.value(),e.intermediateTextColor=this.Z97.properties().intermediateTextColor.value(),e.sourceLine1=this._sourceLine1,e.sourceLine2=this._sourceLine2,e.direction=this._direction,e.clockWhite=this._clockWhite,e.clockBlack=this._clockBlack,e.successIcon=this._successIcon,e.failureIcon=this._failureIcon,e.finished=this._finished,e.centersColor=new TradingView.RGBColor(this.Z98.Q0.paneProperties.background._value).blackWhiteContrast(),
this.isAnchorsRequired()){var t=new TradingView.CompositeRenderer;return t.append(new r(e)),this.addAnchors(t),t}return new r(e)},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(a.prototype.update.call(this),this._targetLine1="",this._targetLine2="",this._targetLine3="",this._targetLine4="",!(this.Z97.points().length<2)&&this.Z97.priceScale()){var e=this.Z97.points()[1],t=this.Z97.points()[0];this._targetLine3=this.Z97.priceScale().formatter().format(e.price);var i=e.price-t.price,r=0>i?"-":"+";this._targetLine1=this.Z97.priceScale().formatter().format(Math.abs(i));var n=Math.abs(Math.round(1e4*(i/t.price))/100);this._targetLine1=r+this._targetLine1+" ("+r+this._percentageFormatter.format(n)+")";var s=this.Z98.timeScale().indexToUserTime(t.index),l=this.Z98.timeScale().indexToUserTime(e.index),d=t.time&&e.time;d&&(s=TradingView.isString(t.time)?new Date(Date.parse(t.time)):t.time,l=TradingView.isString(e.time)?new Date(Date.parse(e.time)):e.time);var h=this.Z98.mainSeries().isDWM(),p=TradingView.Interval.kind(this.Z98.mainSeries().interval())===TradingView.Interval.SECONDS;if(l&&s){this._targetLine4=(new TradingView.DateFormatter).format(l),h||(this._targetLine4=this._targetLine4+" "+new TradingView.TimeFormatter(p?"%h:%m:%s":"%h:%m").format(l));var c=(l.valueOf()-s.valueOf())/1e3;this._targetLine2=$.t("in",{context:"dates"})+" "+(new TradingView.TimeSpanFormatter).format(c)}this._sourceLine1=this.Z97.priceScale().formatter().format(t.price),this._sourceLine2="";var u=this.Z98.timeScale().indexToUserTime(t.index);u&&(this._sourceLine2=(new TradingView.DateFormatter).format(u),h||(this._sourceLine2=this._sourceLine2+" "+new TradingView.TimeFormatter(p?"%h:%m:%s":"%h:%m").format(u))),this._direction=this.Z97.direction()===o.DIRECTION_UP?"up":"down",this._finished=this.Z98.lineBeingCreated()!==this.Z97&&this.Z98.lineBeingEdited()!==this.Z97&&this.Z98.sourceBeingMoved()!==this.Z97}},o.ALERT_STATUS_WAITING=0,o.ALERT_STATUS_SUCCESS=1,o.ALERT_STATUS_FAILURE=2,o.DIRECTION_UP=1,o.DIRECTION_DOWN=2,inherit(o,s),o.prototype.status=function(){return this.Q0.status.value()},o.prototype.setStatus=function(e){return this.Q0.status.setValue(e)},o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Forecast"},o.prototype.restorePoints=function(e,t,i){s.prototype.restorePoints.call(this,e,t,i),this.checkAlert()},o.prototype.checkAlert=function(){if(!(this._points.length<2||this.Z98.mainSeries().bars().isEmpty())){var e=this._points[1];if(this.status())return void(e.index>this.Z98.timeScale().points().lastTimePointIndex()&&this.setStatus(o.ALERT_STATUS_WAITING));var t=(this.Z98.mainSeries().bars().last().value[TradingView.TIME_PLOT],this.Z98.timeScale().indexToTimePoint(e.index));if(t){var i=(t.valueOf()/1e3,this.Z98.mainSeries().bars().valueAt(e.index)),r=this.direction();if(r===o.DIRECTION_UP&&i[TradingView.HIGH_PLOT]>=e.price)this.setStatus(o.ALERT_STATUS_SUCCESS);else if(r===o.DIRECTION_DOWN&&i[TradingView.LOW_PLOT]<=e.price)this.setStatus(o.ALERT_STATUS_SUCCESS);else{var n=this.Z98.mainSeries().bars().last().value;i[TradingView.TIME_PLOT]!==n[TradingView.TIME_PLOT]&&this.setStatus(o.ALERT_STATUS_FAILURE)}}}},o.prototype.addPoint=function(e){var t=s.prototype.addPoint.call(this,e);return t&&this.checkAlert(),t},o.prototype.endChanging=function(){s.prototype.endChanging.call(this),this.setStatus(o.ALERT_STATUS_WAITING),this.checkAlert()},o.prototype.onData=function(e){s.prototype.onData.call(this,e),this.checkAlert()},o.prototype.endMoving=function(){s.prototype.endMoving.call(this),this.setStatus(o.ALERT_STATUS_WAITING),this.checkAlert()},o.prototype.direction=function(){if(this.points().length<2)return o.DIRECTION_UP;var e=this.points()[0],t=this.points()[1];return t.price>e.price?o.DIRECTION_UP:o.DIRECTION_DOWN},e.exports=o},function(e,t,i){"use strict";function r(e,t,i){this._data=e,this._measureCache=t,this._chartModel=i,this._points=e.points}function n(e,t,i){a.call(this,e,t),this._image=TradingView.getImage("price_label",TradingView.wrapUrl("images/price_label.png")),this._rendererCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolPriceLabel";var i=t||new J50("linetoolpricelabel");s.call(this,e,new n(this,e),i)}var a=i(44),s=i(13).LineDataSource;r.prototype.draw=function(e){if(0!==this._points.length){e.font=[this._data.fontWeight,this._data.fontSize+"px",this._data.fontFamily].join(" ");var t=e.measureText(this._data.label);t.height=this._data.fontSize;var i=3,r=15,n=-9,o={left:10,top:5},a=t.width+2*o.left,s=t.height+2*o.top,l=this._points[0].x-n,d=this._points[0].y-(s+r);this._measureCache&&$.extend(this._measureCache,{innerWidth:a,innerHeight:s,tailLeft:n,tailHeight:r}),e.translate(.5+l,.5+d),e.beginPath(),e.moveTo(12,s),e.lineTo(n,s+r),e.lineTo(n-1,s+r-1),e.lineTo(5,s),e.lineTo(i,s),e.arcTo(0,s,0,0,i),e.lineTo(0,i),e.arcTo(0,0,a,0,i),e.lineTo(a-i,0),e.arcTo(a,0,a,s,i),e.lineTo(a,s-i),e.arcTo(a,s,0,s,i),e.lineTo(12,s),e.fillStyle=TradingView.generateColor(this._data.backgroundColor,this._data.transparency),e.fill(),e.strokeStyle=this._data.borderColor,e.lineWidth=2,e.stroke(),e.closePath(),e.textBaseline="top",e.fillStyle=this._data.color,e.fillText(this._data.label,o.left,o.top-1),e.translate(-.5,-.5),e.beginPath(),e.arc(n,s+r,2.5,0,2*Math.PI,!1),e.fillStyle=TradingView.generateColor(this._data.borderColor,this._data.transparency),e.fill(),e.strokeStyle=this._chartModel.backgroundColor(),e.lineWidth=1,e.stroke(),e.closePath()}},r.prototype.hitTest=function(e){if(0===this._points.length)return null;var t=this._points[0].x-this._measureCache.tailLeft,i=this._points[0].y-(this._measureCache.innerHeight+this._measureCache.tailHeight);return MathEx.pointInRect(e,new MathEx.Point(t,i),new MathEx.Point(t+this._measureCache.innerWidth,i+this._measureCache.innerHeight))?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(a.prototype.update.call(this),this.Z97.points().length>0){var e=this.Z97.points()[0].price,t=this.Z97.priceScale();if(!t||t.isEmpty())return;if(t.isPercent()){var i=this.Z97.ownerSource().firstValue();e=t.priceRange().convertToPercent(e,i)}this._priceLabel=t.formatter().format(e)}},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e={};if(e.points=this._points,e.borderColor=this.Z97.properties().borderColor.value(),e.backgroundColor=this.Z97.properties().backgroundColor.value(),e.color=this.Z97.properties().color.value(),e.fontWeight=this.Z97.properties().fontWeight.value(),e.fontSize=this.Z97.properties().fontsize.value(),e.fontFamily=this.Z97.properties().font.value(),e.transparency=this.Z97.properties().transparency.value(),e.label=this._priceLabel,e.image=this._image,this.isAnchorsRequired()&&1==e.points.length){var t=new TradingView.CompositeRenderer;return t.append(new r(e,this._rendererCache,this.Z98)),t.append(new TradingView.SelectionRenderer({points:e.points})),t}return new r(e,this._rendererCache,this.Z98)},inherit(o,s),o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return"Price Label"},e.exports=o},function(e,t,i){"use strict";function r(){}function n(e,t){this.Z97=e,this._data=t}function o(e,t){l.call(this,e,t),this._rendererSource=new r,this._invalidated=!0}function a(e,t){this._constructor="LineToolNote";var i=t?t:new J50("linetoolnote");d.call(this,e,new o(this,e),i),this.version=a.version}function s(e,t){var i=t?t:new J50("linetoolnoteabsolute");i.locked.value()||i.locked.setValue(!0),a.call(this,e,i)}var l=i(44),d=i(13).LineDataSource,h=i(45).TextRenderer;r.prototype.update=function(e){this._data&&(!this._data||e.markerColor==this._data.markerColor&&e.width==this._data.width&&e.height==this._data.height)||this._createSource(e.width,e.height,e.markerColor),this._data=e},r.prototype._createSource=function(e,t,i){this._sourceCanvas=document.createElement("canvas"),this._sourceCanvas.width=e,this._sourceCanvas.height=t,this._translate=new MathEx.Point(-e/2,-t+.5),this._translate.x%1===0&&(this._translate.x+=.5);var r=this._sourceCanvas.getContext("2d"),n=.6*e;r.fillStyle=i,r.beginPath(),r.moveTo(e/2,t),r.quadraticCurveTo(e,e/1.15,e,e/2),r.arc(e/2,e/2,e/2,0,Math.PI,!0),r.quadraticCurveTo(0,e/1.15,e/2,t),r.fill(),r.globalCompositeOperation="destination-out",r.beginPath(),r.moveTo((e-n)/2,e/2),r.arc(e/2,e/2,n/2,0,2*Math.PI),r.fill()},r.prototype.drawOn=function(e){var t=new MathEx.Point(Math.round(this._data.point.x),Math.round(this._data.point.y)).add(this._translate);e.drawImage(this._sourceCanvas,t.x,t.y)},r.prototype.hasPoint=function(e){var t=this._data.point.add(this._translate),i=new MathEx.Point(this._data.point.x-this._translate.x,this._data.point.y);return MathEx.pointInRect(e,t,i)},n.prototype.draw=function(e){this.Z97.drawOn(e),this._data.tooltipVisible&&this.drawTooltipOn(e)},n.prototype.drawTooltipOn=function(e){e.save();var t=(this._data.text+"").replace(/^\s+|\s+$/g,"").replace(/[\r\n]+/g,"\n");e.font=(this._data.bold?"bold ":"")+(this._data.italic?"italic ":"")+this._data.fontSize+"px "+this._data.font;var i=a.TOOLTIP_WIDTH-2*a.TOOLTIP_PADDING,r=h.prototype.wordWrap(t,i,e.font),n=this._data.point,o=a.TOOLTIP_LINESPACING,s=a.TOOLTIP_WIDTH,l=r.length*this._data.fontSize+2*a.TOOLTIP_PADDING;r.length>1&&(l+=(r.length-1)*o);var d=Math.round(n.x-s/2),p=Math.round(n.y-this._data.height-l-8),c=n.x<20||n.x+20>this._data.vpWidth,u=c?null:"top",_=c?null:Math.round(n.x);10>p?p=n.y+13:u="bottom",10>d?d+=Math.abs(d-10):d+s+10>this._data.vpWidth&&(d-=d+s+10-this._data.vpWidth),e.fillStyle=TradingView.generateColor(this._data.backgroundColor,this._data.backgroundTransparency),e.strokeStyle=this._data.markerColor,e.lineWidth=1,e.beginPath(),e.moveTo(d,p),c||"top"!=u||(e.lineTo(_-7,p),e.lineTo(_,p-7),e.lineTo(_+7,p)),e.lineTo(d+s,p),e.lineTo(d+s,p+l),c||"bottom"!=u||(e.lineTo(_+7,p+l),e.lineTo(_,p+l+7),e.lineTo(_-7,p+l)),e.lineTo(d,p+l),e.closePath(),e.fill(),e.stroke(),e.textBaseline="middle",e.fillStyle=this._data.textColor;for(var f=d+a.TOOLTIP_PADDING,g=p+a.TOOLTIP_PADDING+this._data.fontSize/2,v=0;v<r.length;v++)e.fillText(r[v].replace(/^\s+/,""),f,g),g+=this._data.fontSize+o;e.restore()},n.prototype.hitTest=function(e){return this.Z97.hasPoint(e)?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):void 0},inherit(o,l),o.prototype.update=function(){this._invalidated=!0},o.prototype.updateImpl=function(){l.prototype.update.call(this),this._invalidated=!1},o.prototype.isLabelVisible=function(){return this.isHoveredSource()||this.isSelectedSource()},o.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer,t=this.Z97.properties(),i=t.locked&&t.locked.value(),r=i?this.Z97.fixedPoints():this._points;if(r.length<1)return e;var o=this.isLabelVisible(),a=o,s=$.extend(t.state(),{point:r[0],width:24,height:32,tooltipVisible:a,vpWidth:this.Z98.m_timeScale.m_width,vpHeight:this.Z97.m_priceScale.m_height});return this._rendererSource.update(s),e.append(new n(this._rendererSource,s)),o&&e.append(new TradingView.SelectionRenderer({points:r})),e},inherit(a,d),a.TOOLTIP_WIDTH=300,a.TOOLTIP_PADDING=10,a.TOOLTIP_LINESPACING=5,a.version=1,a.prototype.pointsCount=function(){return 1},a.prototype.title=function(){return $.t("Note")},a.prototype.restoreTemplate=function(e){delete e.locked,delete e.text,d.prototype.restoreTemplate.call(this,e)},inherit(s,a),s.prototype.title=function(){return $.t("Anchored Note")},a.prototype.state=function(e){var t=d.prototype.state.call(this,e);return e&&(t.state.fixedSize=!1),t},t.LineToolNote=a,t.LineToolNoteAbsolute=s},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this._invalidated=!0,this.Z98=t,this.Z97=e}function n(e,t){this._constructor="LineToolBrush";var i=t?t:new J50("linetoolbrush");a.call(this,e,new r(this,e),i),this._finished=!1}var o=i(44),a=i(13).LineDataSource,s=i(89);inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype._smoothArray=function(e,t){for(var i=Array(e.length),r=0;r<e.length;r++){for(var n=new MathEx.Point(0,0),o=0;t>o;o++){var a=Math.max(r-o,0),s=Math.min(r+o,e.length-1);n=n.add(e[a]),n=n.add(e[s])}i[r]=n.scaled(.5/t)}return i.push(e[e.length-1]),i},r.prototype._updateInternal=function(){o.prototype.update.call(this);var e=Math.max(1,this.Z97.properties().smooth.value()),t=this._points;if(0!==t.length){for(var i=[t[0]],r=1;r<t.length;r++){for(var n=t[r].substract(t[r-1]),a=n.length(),s=Math.max(5,Math.floor(a/e)),l=n.normalized().scaled(a/s),d=0;s-1>d;d++)i.push(t[r-1].add(l.scaled(d)));i.push(t[r])}this._points=this._smoothArray(i,e)}},r.prototype.renderer=function(){this._invalidated&&(this._updateInternal(),this._invalidated=!1);var e={},t=this.Z97.properties();if(e.points=this._points,e.color=t.linecolor.value(),e.linewidth=t.linewidth.value(),e.linestyle=t.linestyle.value(),e.skipClosePath=!0,e.leftend=this.Z97.properties().leftEnd.value(),e.rightend=this.Z97.properties().rightEnd.value(),t.fillBackground.value()&&this.Z98.lineBeingCreated()!==this.Z97&&(e.filled=!0,e.fillBackground=!0,e.backcolor=t.backgroundColor.value(),e.transparency=t.transparency.value()),this.isAnchorsRequired()&&this.Z97.finished()){var i=new TradingView.CompositeRenderer;if(i.append(new s(e)),e.points.length>0){var r=[e.points[0],e.points[e.points.length-1]];i.append(new TradingView.SelectionRenderer({points:r}))}return i}return new s(e)},inherit(n,a),n.prototype.pointsCount=function(){return-1},n.prototype.finished=function(){return this._finished},n.prototype.finish=function(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()},n.prototype.title=function(){return"Brush"},n.prototype.percentDistance=function(e,t){return Math.abs((t-e)/e)},n.prototype.addPoint=function(e){if(this._finished)return!0;if(this._lastPoint=null,this._points.length>0){var t=this._points[this._points.length-1],i=this.pointToScreenPoint(t)[1],r=this.pointToScreenPoint(e)[1],n=r.substract(i).length();if(2>n)return this._finished}return a.prototype.addPoint.call(this,e),this._finished},n.prototype.restorePoints=function(e,t,i){a.prototype.restorePoints.call(this,e,t,i),this._finished=!0},e.exports=n},function(e,t,i){"use strict";function r(e){this._data=e,this._data.angleFrom=0,this._data.angleTo=Math.PI,this._data.clockwise=!1}function n(e,t){a.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolArc";var i=t?t:new J50("linetoolarc");s.call(this,e,new n(this,e),i),this.version=o.version}var a=i(44),s=i(13).LineDataSource;r.prototype.draw=function(e){if(!(this._data.points.length<2)){var t=this._data.points[0],i=this._data.points[1];if(this._data.points.length<3)return e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),void e.stroke();var r=this._data.points[2],n=MathEx.distanceToLine(t,i,r).distance;if(1>n)return e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),void e.stroke();var o=i.substract(t),a=t.add(i).scaled(.5),s=new MathEx.Point(-o.y,o.x);s=s.normalized(),r=a.add(s.scaled(n));a.add(s.scaled(-n));e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth;var l=o.length(),d=o.x/l,h=o.y/l,p=Math.acos(d);0>h&&(p=-p);var c=this._data.points[2],u=MathEx.Matrix.translate(-a.x,-a.y);c=u.mult(c),u=MathEx.Matrix.rotate(-p),c=u.mult(c),u=MathEx.Matrix.scale(1,l/(2*n)),c=u.mult(c),c.y<0?this._data.clockwise=!0:this._data.clockwise=!1,e.save(),e.beginPath(),e.translate(t.x,t.y),e.rotate(p);var _=1-Math.sqrt(3)/2;e.scale(1,n/(l*_)),this._data.clockwise?e.arc(.5*l,l*Math.sqrt(3)/2,l,-2*Math.PI/3,-Math.PI/3,!1):e.arc(.5*l,-l*Math.sqrt(3)/2,l,Math.PI/3,2*Math.PI/3,!1),e.restore(),e.stroke(),this._data.fillBackground&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.fill())}},r.prototype.hitTest=function(e){if(this._data.points.length<3)return null;var t=5,i=this._data.points[0],r=this._data.points[1],n=this._data.points[2],o=MathEx.distanceToLine(i,r,n).distance;if(1>o)return o=MathEx.distanceToLine(i,r,e).distance,t>o?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null;var a=r.substract(i),s=a.length(),l=i.add(r).scaled(.5),d=n.substract(l);d=d.normalized(),n=l.add(d.scaled(o));var h=(l.add(d.scaled(-o)),a.x/s),p=a.y/s,c=Math.acos(h);0>p&&(c=-c);var u=MathEx.Matrix.translate(-i.x,-i.y);e=u.mult(e),u=MathEx.Matrix.rotate(-c),e=u.mult(e),d=u.mult(d);var _=1-Math.sqrt(3)/2;u=MathEx.Matrix.scale(1,s*_/o),e=u.mult(e),d=u.mult(d);var f;if(e.y*d.y<0)return null;f=e.y<0?new MathEx.Point(.5*s,s*Math.sqrt(3)/2):new MathEx.Point(.5*s,-s*Math.sqrt(3)/2);var g=e.substract(f),v=g.length();return Math.abs(v-s)<=t?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.Z97.properties().color.value(),e.linewidth=this.Z97.properties().linewidth.value(),e.backcolor=this.Z97.properties().backgroundColor.value(),e.fillBackground=this.Z97.properties().fillBackground.value(),e.transparency=this.Z97.properties().transparency.value(),this.isAnchorsRequired()){var t=new TradingView.CompositeRenderer;t.append(new r(e));var i=[],n=e.points[0],o=new MathEx.Point(n.x,n.y);if(o.data=0,i.push(o),1==e.points.length)return t;var a=e.points[1],s=new MathEx.Point(a.x,a.y);if(s.data=1,2==e.points.length)return this.addAnchors(t),t;i.push(s);var l=e.points[2],d=MathEx.distanceToLine(n,a,l).distance,h=a.substract(n),p=n.add(a).scaled(.5),c=new MathEx.Point(-h.y,h.x);c=c.normalized(),l=p.add(c.scaled(d));var u=p.add(c.scaled(-d)),_=h.length(),f=h.x/_,g=h.y/_,v=Math.acos(f);0>g&&(v=-v);var m=e.points[2],y=MathEx.Matrix.translate(-p.x,-p.y);m=y.mult(m),y=MathEx.Matrix.rotate(-v),m=y.mult(m),y=MathEx.Matrix.scale(1,_/(2*d)),m=y.mult(m);var w=m.y>=0?new MathEx.Point(l.x,l.y):new MathEx.Point(u.x,u.y);return w.data=2,i.push(w),t.append(this.createLineAnchor({points:i})),t}return new r(e)},inherit(o,s),o.prototype.startChanging=function(e,t){if(s.prototype.startChanging.call(this,e,t),0===e||1===e){var i=this.pointToScreenPoint(this._points[0])[0],r=this.pointToScreenPoint(this._points[1])[0],n=this.pointToScreenPoint(this._points[2])[0];this._dist=MathEx.distanceToLine(i,r,n).distance;var o=r.substract(i),a=new MathEx.Point(-o.y,o.x),l=i.add(r).scaled(.5),d=n.substract(l),h=d.dotProduct(a);0>h&&(this._dist=-this._dist)}},o.prototype.pointsCount=function(){return 3},o.prototype.title=function(){return"Arc"},o.prototype.setPoint=function(e,t){var i=$.extend({},t),r=this.pointToScreenPoint(this._points[0])[0],n=this.pointToScreenPoint(this._points[1])[0],o=this.pointToScreenPoint(this._points[2])[0],a=this.priceScale();if(a.isPercent()){var s=this.ownerSource().firstValue();i.price=a.priceRange().convertFromPercent(i.price,s)}switch(e){case 0:r=this.pointToScreenPoint(i)[0];var l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(this._dist)),o=this.screenPointToPoint(o),this._points[0]=i,this._points[2]=o;break;case 1:var p=MathEx.distanceToLine(r,n,o).distance;n=this.pointToScreenPoint(i)[0];var l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(this._dist)),o=this.screenPointToPoint(o),this._points[1]=i,this._points[2]=o;break;case 2:i=this.pointToScreenPoint(i)[0];var p=MathEx.distanceToLine(r,n,i).distance,l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(p));var c=d.add(h.scaled(-p)),u=l.length(),_=l.x/u,f=l.y/u,g=Math.acos(_);0>f&&(g=-g);var v=MathEx.Matrix.translate(-d.x,-d.y);i=v.mult(i);var m=v.mult(o);v=MathEx.Matrix.rotate(-g),i=v.mult(i),m=v.mult(m),v=MathEx.Matrix.scale(1,u/(2*p)),i=v.mult(i),m=v.mult(m);var y=i.y*m.y>=0?new MathEx.Point(o.x,o.y):new MathEx.Point(c.x,c.y);y=this.screenPointToPoint(y),this._points[2]=y}this.normalizePoints()},o.version=2,o.prototype.migrateVersion=function(e,t,i){if(1==e&&2==this._points.length){var r=(2*this._points[0].price+3*this._points[1].price)/5;this._points.append({price:r,index:this._points[1].index})}if(1==e&&2==this._timePoint.length){var r=(2*this._timePoint[0].price+3*this._timePoint[1].price)/5,n={price:r,offset:this._timePoint[1].offset,time_t:this._timePoint[1].time_t};this._timePoint.append(n)}},e.exports=o},function(e,t,i){"use strict";function r(e,t){this._measureCache=t,this._data=e}function n(e,t){a.call(this,e,t),this._rendererCache={},this._invalidated=!0}function o(e,t){this._constructor="LineToolBalloon";var i=t?t:new J50("linetoolballoon");s.call(this,e,new n(this,e),i)}var a=i(44),s=i(13).LineDataSource;r.prototype.draw=function(e){if(0!==this._data.points.length){e.font=[this._data.fontWeight,this._data.fontSize+"px",this._data.fontFamily].join(" ");var t=e.measureText(this._data.label);t.height=this._data.fontSize;var i=15,r={left:i,top:(2*i-t.height)/2},n=t.width+2*r.left,o=2*i,a=this._data.points[0].x-(r.left+20),s=this._data.points[0].y-(o+9);this._measureCache&&$.extend(this._measureCache,{innerWidth:n,innerHeight:o,padding:r}),e.translate(.5+a,.5+s),e.beginPath(),e.moveTo(i+9,o),e.lineTo(i,o),e.arcTo(-1e3,0,1e3,0,i),e.lineTo(n-i,0),e.arcTo(1e3,o,-1e3,o,i),e.lineTo(i+18,o),e.quadraticCurveTo(i+18,o+4,i+20,o+9),e.quadraticCurveTo(i+12,o+6,i+9,o),e.fillStyle=TradingView.generateColor(this._data.backgroundColor,this._data.transparency),e.fill(),e.strokeStyle=this._data.borderColor,e.lineWidth=2,e.stroke(),e.closePath(),e.textBaseline="top",e.fillStyle=this._data.color,e.fillText(this._data.label,r.left,r.top-1)}},r.prototype.hitTest=function(e){if(0===this._data.points.length||!this._measureCache.padding)return null;var t=this._data.points[0].x-(this._measureCache.padding.left+20),i=this._data.points[0].y-(this._measureCache.innerHeight+9);return MathEx.pointInRect(e,new MathEx.Point(t,i),new MathEx.Point(t+this._measureCache.innerWidth,i+this._measureCache.innerHeight))?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,a),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){a.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e={};if(e.points=this._points,e.color=this.Z97.properties().color.value(),e.borderColor=this.Z97.properties().borderColor.value(),e.backgroundColor=this.Z97.properties().backgroundColor.value(),e.transparency=this.Z97.properties().transparency.value(),e.fontWeight=this.Z97.properties().fontWeight.value(),e.fontSize=this.Z97.properties().fontsize.value(),e.fontFamily=this.Z97.properties().font.value(),e.label=this.Z97.properties().text.value(),this.isAnchorsRequired()&&1==e.points.length){var t=new TradingView.CompositeRenderer;return t.append(new r(e,this._rendererCache)),t.append(new TradingView.SelectionRenderer({points:e.points})),t}return new r(e,this._rendererCache)},inherit(o,s),o.prototype.pointsCount=function(){return 1},o.prototype.title=function(){return"Balloon"},e.exports=o},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){l.call(this,e,t),this._rendererCache={},this._invalidated=!0}function o(e,t){this.Z97=e,this.Z98=t,this._text="",this._coordinate=0,this._background="black"}function a(e,t){this._constructor="LineToolHorzRay";var i=t?t:new J50("linetoolhorzray");this._priceAxisView=new o(this,e),s.call(this,e,new n(this,e),i)}var s=i(13).LineDataSource,l=i(44),d=i(14),h=i(45).TextRenderer,p=i(15);r.prototype.draw=function(e){if(0===this._data.points.length)return null;var t=e.canvas.width,i=this._data.points[0].y,r=Math.max(0,this._data.points[0].x),n=Math.max(t,this._data.points[0].x);e.lineCap="square",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.lineStyle=this._data.linestyle,CanvasEx.drawLine(e,r,i,n,i)},r.prototype.hitTest=function(e){if(0===this._data.points.length)return null;if(e.x<this._data.points[0].x)return null;var t=3;return Math.abs(e.y-this._data.points[0].y)<=t?new TradingView.HitTestResult(this._data.hitTestResult):null},inherit(n,l),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){l.prototype.update.call(this)},n.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=new TradingView.CompositeRenderer,t={};t.points=this._points,t.color=this.Z97.properties().linecolor.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.linestyle=this.Z97.properties().linestyle.value(),t.hitTestResult=TradingView.HitTestResult.MOVEPOINT;var i=this.Z97.properties();if(e.append(new r(t)),this.Z97.properties().showLabel.value()&&1==this._points.length){var n=i.vertLabelsAlign.value(),o=i.horzLabelsAlign.value(),a=this._points[0].clone(),s=0,l=0;"right"==o?(a.x=this.Z98.timeScale().width(),l=-5):"center"==o&&(a.x=(a.x+this.Z98.timeScale().width())/2),"middle"==n?s=-this.Z97.properties().fontsize.value()/6:"bottom"==n&&(s=-4);var d={points:[a],text:i.text.value(),color:i.textcolor.value(),vertAlign:n,horzAlign:o,font:i.font.value(),offsetX:l,offsetY:s,bold:this.Z97.properties().bold.value(),italic:this.Z97.properties().italic.value(),fontsize:this.Z97.properties().fontsize.value()};e.append(new h(d,this._rendererCache))}return this.addAnchors(e),TradingView.printing||!this.Z97.hasAlert.value()||this.Z98.readOnly()||1!=this._points.length||this.Z97.getAlertIsActive(function(i){e.append(new TradingView.PaneRendererClockIcon({point1:t.points[0],color:i?t.color:defaults("chartproperties.alertsProperties.drawingIcon.color")}))}),e},inherit(o,d),o.prototype.update=function(){this._invaildated=!0},o.prototype.updateImpl=function(){0!==this.Z97.points().length&&this.Z97.priceScale()&&!this.Z97.priceScale().isEmpty()&&(this._background=this.Z97.properties().linecolor.value(),this._coordinate=this.Z97.priceScale().priceToCoordinate(this.Z97.points()[0].price),this._text=this.Z97.priceScale().formatter().format(this.Z97.points()[0].price))},o.prototype.renderer=function(){this._invaildated&&(this.updateImpl(),this._invaildated=!1);var e={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,visible:!0};return new p(e)},inherit(a,s),a.prototype.pointsCount=function(){return 1},a.prototype.title=function(){return"Horizontal Ray"},a.prototype.priceAxisViews=function(e,t){return this.isActualSymbol()&&t===this.priceScale()&&this.properties().showPrice.value()&&this.Z98.paneForSource(this)===e?[this._priceAxisView]:null},a.prototype.updateAllViews=function(){s.prototype.updateAllViews.call(this),this._priceAxisView.update()},a.prototype.canHasAlert=function(){return!0},a.prototype._getAlertPlots=function(){var e=this._points[0],t={index:e.index+1,price:e.price};return[this._linePointsToAlertPlot([e,t],null,!1,!0)]},e.exports=a},function(e,t,i){"use strict";function r(e){this._data=e,this._data.angleFrom=0,this._data.angleTo=2*Math.PI,this._data.clockwise=!1}function n(e,t){s.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolEllipse";var i=t?t:new J50("linetoolellipse");a.call(this,e,new n(this,e),i),this.version=o.version}var a=i(13).LineDataSource,s=i(44);r.prototype.draw=function(e){if(!(this._data.points.length<2)){var t=this._data.points[0],i=this._data.points[1];if(this._data.points.length<3)return e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),void e.stroke();var r=this._data.points[2],n=MathEx.distanceToLine(t,i,r).distance;if(1>n)return e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),void e.stroke();var o=i.substract(t),a=t.add(i).scaled(.5),s=new MathEx.Point(-o.y,o.x);s=s.normalized(),r=a.add(s.scaled(n));a.add(s.scaled(-n));e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth;var l=o.length(),d=o.x/l,h=o.y/l,p=Math.acos(d);0>h&&(p=-p);var c=this._data.points[2],u=MathEx.Matrix.translate(-a.x,-a.y);c=u.mult(c),u=MathEx.Matrix.rotate(-p),c=u.mult(c),u=MathEx.Matrix.scale(1,l/(2*n)),c=u.mult(c),c.y<0?this._data.clockwise=!0:this._data.clockwise=!1,e.save(),e.beginPath(),e.translate(a.x,a.y),e.rotate(p),e.scale(1,2*n/l),e.arc(0,0,.5*l,this._data.angleFrom,this._data.angleTo,this._data.clockwise),e.restore(),e.stroke(),this._data.fillBackground&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.fill())}},r.prototype._additionalPointTest=function(e,t){return!0},r.prototype.hitTest=function(e){if(this._data.points.length<3)return null;var t=this._data.points[0],i=this._data.points[1],r=this._data.points[2],n=MathEx.distanceToLine(t,i,r).distance,o=i.substract(t),a=t.add(i).scaled(.5),s=new MathEx.Point(-o.y,o.x);s=s.normalized(),r=a.add(s.scaled(n));var l=(a.add(s.scaled(-n)),o.length()),d=o.x/l,h=o.y/l,p=Math.acos(d);0>h&&(p=-p);var c=MathEx.Matrix.translate(-a.x,-a.y);e=c.mult(e);var u=c.mult(this._data.points[2]);c=MathEx.Matrix.rotate(-p),e=c.mult(e),u=c.mult(u),c=MathEx.Matrix.scale(1,l/(2*n)),e=c.mult(e),u=c.mult(u);var _=e.length(),f=3;return this._additionalPointTest(e,u)?Math.abs(_-.5*l)<=f?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):this._data.fillBackground&&!this._data.noHitTestOnBackground&&.5*l>=_?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT_BACKGROUND):null:null},inherit(n,s),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){this._invalidated&&this.updateImpl();var e=new TradingView.CompositeRenderer;if(this._points.length<2)return e;var t={};if(t.points=this._points,t.color=this.Z97.properties().color.value(),t.linewidth=this.Z97.properties().linewidth.value(),t.backcolor=this.Z97.properties().backgroundColor.value(),t.fillBackground=this.Z97.properties().fillBackground.value(),t.transparency=this.Z97.properties().transparency.value(),e.append(new r(t)),this.isAnchorsRequired()){var i=t.points[0],n=t.points[1];if(2==this._points.length)return this.addAnchors(e),e;var o=t.points[2],a=MathEx.distanceToLine(i,n,o).distance,s=n.substract(i),l=i.add(n).scaled(.5),d=new MathEx.Point(-s.y,s.x);d=d.normalized(),o=l.add(d.scaled(a));var h=l.add(d.scaled(-a)),p=new MathEx.Point(i.x,i.y);p.data=0;var c=new MathEx.Point(n.x,n.y);c.data=1;var u=new MathEx.Point(o.x,o.y);u.data=2;var _=new MathEx.Point(h.x,h.y);return _.data=3,e.append(this.createLineAnchor({points:[p,c,u,_]})),e}return e},inherit(o,a),o.prototype.startChanging=function(e,t){if(a.prototype.startChanging.call(this,e,t),0===e||1===e){var i=this.pointToScreenPoint(this._points[0])[0],r=this.pointToScreenPoint(this._points[1])[0],n=this.pointToScreenPoint(this._points[2])[0];this._dist=MathEx.distanceToLine(i,r,n).distance}},o.prototype.setPoint=function(e,t){var i=$.extend({},t),r=this.pointToScreenPoint(this._points[0])[0],n=this.pointToScreenPoint(this._points[1])[0],o=this.pointToScreenPoint(this._points[2])[0],a=this.priceScale();if(a.isPercent()){var s=this.ownerSource().firstValue();
i.price=a.priceRange().convertFromPercent(i.price,s)}switch(e){case 0:r=this.pointToScreenPoint(i)[0];var l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(this._dist)),o=this.screenPointToPoint(o),this._points[0]=i,this._points[2]=o;break;case 1:var p=MathEx.distanceToLine(r,n,o).distance;n=this.pointToScreenPoint(i)[0];var l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(this._dist)),o=this.screenPointToPoint(o),this._points[1]=i,this._points[2]=o;break;case 2:i=this.pointToScreenPoint(i)[0];var p=MathEx.distanceToLine(r,n,i).distance,l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(p)),o=this.screenPointToPoint(o),this._points[2]=o;break;case 3:i=this.pointToScreenPoint(i)[0];var p=MathEx.distanceToLine(r,n,i).distance,l=n.substract(r),d=r.add(n).scaled(.5),h=new MathEx.Point(-l.y,l.x);h=h.normalized(),o=d.add(h.scaled(p)),o=this.screenPointToPoint(o),this._points[2]=o}this.normalizePoints()},o.prototype.pointsCount=function(){return 3},o.prototype.title=function(){return"Ellipse"},o.version=2,o.prototype.migrateVersion=function(e,t,i){if(1==e&&2==this._points.length){var r=this._points[0].price,n=.5*(this._points[0].price+this._points[1].price);this._points[0]={price:n,index:this._points[0].index},this._points[1]={price:n,index:this._points[1].index},this._points.push({price:r,index:this._points[0].index})}if(1==e&&2==this._timePoint.length){var r=this._timePoint[0].price,n=.5*(this._timePoint[0].price+this._timePoint[1].price);this._timePoint[0].price=n,this._timePoint[1].price=n;var o={price:r,offset:this._timePoint[0].offset,time_t:this._timePoint[0].time_t};this._timePoint.push(o)}},e.exports=o},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){s.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolTimeCycles";var i;i=t?t:new J50("linetooltimecycles"),a.call(this,e,new n(this,e),i)}var a=i(13).LineDataSource,s=i(44);r.prototype.draw=function(e){e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(e,this._data.linestyle),e.save(),e.translate(this._data.point.x+1,this._data.point.y),e.scale(this._data.width,this._data.height),e.beginPath(),e.arc(.5,0,.5,Math.PI,0,!1),e.restore(),e.stroke(),this._data.fillBackground&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.fill())},r.prototype.hitTest=function(e){if(e.y>this._data.point.y)return null;if(e.x<this._data.point.x||e.x>this._data.point.x+this._data.width)return null;var t=new MathEx.Point(this._data.point.x+this._data.width/2,this._data.point.y),i=e.substract(t),r=this._data.height/this._data.width;i.y/=r;var n=i.length(),o=3;return Math.abs(n-this._data.width/2)<o?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,s),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){if(this._invalidated&&this.updateImpl(),this._points.length<2)return null;var e=this.Z97.points(),t=e[0],i=e[1],n=Math.min(t.index,i.index),o=Math.max(t.index,i.index),a=o-n,s=this._points[0],l=this._points[1],d=Math.abs(s.x-l.x),h=new TradingView.CompositeRenderer,p=this.Z97.properties(),c=this.Z98.timeScale();if(0===a)return null;for(var u=Math.min(s.x,l.x),_=[],f=n;u>-d;f-=a)u=c.indexToCoordinate(f),_.push(u);u=Math.max(s.x,l.x);for(var f=o;u<c.width();f+=a)u=c.indexToCoordinate(f),_.push(u);for(var g=0;g<_.length;g++){var v=new MathEx.Point(_[g],s.y),m={point:v,width:d,height:d,color:p.linecolor.value(),linewidth:p.linewidth.value(),linestyle:p.linestyle.value(),fillBackground:p.fillBackground.value(),backcolor:p.backgroundColor.value(),transparency:p.transparency.value()},y=new r(m);h.append(y)}return this.addAnchors(h),h},inherit(o,a),o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Time Cycles"},o.prototype.setPoint=function(e,t,i){var r=$.extend({},t),n=(r.index-this._startChangingBarIndex,this._points[0]),o=this._points[1],a=this.priceScale();if(a.isPercent()){var s=this.ownerSource().firstValue();r.price=a.priceRange().convertFromPercent(r.price,s)}n.price=r.price,o.price=r.price,this._points[e]=r,this.normalizePoints()},o.prototype.addPoint=function(e,t,i){var r=a.prototype.addPoint.call(this,e,t,!0);if(r){var n=this._points[0],o=this._points[1];o.price=n.price,i||(this.normalizePoints(),this.createServerPoints())}return r},e.exports=o},function(e,t,i){"use strict";function r(e){this._data=e}function n(e,t){s.call(this,e,t),this._invalidated=!0}function o(e,t){this._constructor="LineToolSineLine";var i;i=t?t:new J50("linetoolsineline"),a.call(this,e,new n(this,e),i)}var a=i(13).LineDataSource,s=i(44);r.prototype.draw=function(e){e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(e,this._data.linestyle),e.beginPath(),e.moveTo(this._data.point.x,this._data.point.y);for(var t=1;t<=2*this._data.width;t++){var i=t*Math.PI/this._data.width,r=Math.sin(i-Math.PI/2)*this._data.height/2;e.lineTo(this._data.point.x+t,this._data.point.y+r+this._data.height/2)}e.stroke()},r.prototype.hitTest=function(e){if(e.x<this._data.point.x||e.x>this._data.point.x+2*this._data.width)return null;var t=e.x-this._data.point.x,i=t*Math.PI/this._data.width,r=Math.sin(i-Math.PI/2)*this._data.height/2;r=this._data.point.y+r+this._data.height/2;var n=3;return Math.abs(r-e.y)<=n?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):null},inherit(n,s),n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){s.prototype.update.call(this),this._invalidated=!1},n.prototype.renderer=function(){if(this._invalidated&&this.updateImpl(),this._points.length<2)return null;var e=this.Z97.points(),t=e[0],i=e[1],n=Math.min(t.index,i.index),o=Math.max(t.index,i.index),a=2*(o-n),s=this._points[0],l=this._points[1],d=Math.abs(s.x-l.x),h=l.y-s.y,p=new TradingView.CompositeRenderer,c=this.Z97.properties(),u=this.Z98.timeScale();if(0===a)return null;for(var _=u.indexToCoordinate(n),f=[],g=n;_>-d;g-=a)_=u.indexToCoordinate(g),f.push(_);_=_=u.indexToCoordinate(n+a);for(var g=n+a;_<u.width();g+=a)_=u.indexToCoordinate(g),f.push(_);for(var v=0;v<f.length;v++){var m=new MathEx.Point(f[v],s.y),y=(new MathEx.Point(f[v]+d,l.y),{point:m,width:d,height:h,color:c.linecolor.value(),linewidth:c.linewidth.value(),linestyle:c.linestyle.value()}),w=new r(y);p.append(w)}return this.addAnchors(p),p},inherit(o,a),o.prototype.pointsCount=function(){return 2},o.prototype.title=function(){return"Sine Line"},e.exports=o},function(e,t,i){"use strict";function r(e,t,i,r){for(var n=i.substract(e).length()+i.substract(t).length(),o=3/n,a=5,s=0;1>=s;s+=o){var l=e.scaled((1-s)*(1-s)),d=i.scaled(2*s*(1-s)),h=t.scaled(s*s),p=l.add(d).add(h);if(p.substract(r).length()<a)return!0}return null}function n(e,t,i,r,n){for(var o=i.substract(e).length()+r.substract(i).length()+t.substract(r).length(),a=3/o,s=5,l=0;1>=l;l+=a){var d=e.scaled((1-l)*(1-l)*(1-l)),h=i.scaled(3*(1-l)*(1-l)*l),p=r.scaled(3*(1-l)*l*l),c=t.scaled(l*l*l),u=d.add(h).add(p).add(c);if(u.substract(n).length()<s)return!0}}function o(e,t,i,r,n){var o=i.substract(e).length()+i.substract(t).length();if(!o)return[];for(var a=3/o,s=500,l=[],d=1;s*a>=d;d+=a){var h=e.scaled((1-d)*(1-d)),p=i.scaled(2*d*(1-d)),c=t.scaled(d*d),u=h.add(p).add(c);if(l.length>0){var _=l[l.length-1],f=_.substract(u).length();2>f&&(a*=2)}l.push(u)}return l}function a(e){this._data=e}function s(e,t){u.call(this,e,t),this._invalidated=!0}function l(e,t){this._constructor="LineToolBezierQuadro";var i;i=t?t:new J50("linetoolbezierquadro"),c.call(this,e,new s(this,e),i)}function d(e){this._data=e}function h(e,t){u.call(this,e,t),this._invalidated=!0}function p(e,t){this._constructor="LineToolBezierCubic";var i;i=t?t:new J50("linetoolbeziercubic"),c.call(this,e,new h(this,e),i)}var c=i(13).LineDataSource,u=i(44),_=i(55).TrendLineRenderer;a.prototype.draw=function(e){var t=this._data.points[0],i=this._data.points[1];if(e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(e,this._data.linestyle),2==this._data.points.length)e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.stroke();else{var r=this._data.points[2],n=i.substract(t),o=r.substract(n.scaled(.25)),a=r.add(n.scaled(.25));if(this._data.fillBack&&this._data.points.length>2&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.beginPath(),e.moveTo(t.x,t.y),e.quadraticCurveTo(o.x,o.y,r.x,r.y),e.quadraticCurveTo(a.x,a.y,i.x,i.y),e.fill()),e.beginPath(),e.moveTo(t.x,t.y),this._data.extendLeftPoints.length>0){var s=this._data.extendLeftPoints[this._data.extendLeftPoints.length-1];e.moveTo(s.x,s.y);for(var l=this._data.extendLeftPoints.length-2;l>=0;l--){var d=this._data.extendLeftPoints[l];e.lineTo(d.x,d.y)}}e.quadraticCurveTo(o.x,o.y,r.x,r.y),e.quadraticCurveTo(a.x,a.y,i.x,i.y);for(var l=0;l<this._data.extendRightPoints.length;l++){var d=this._data.extendRightPoints[l];e.lineTo(d.x,d.y)}e.stroke(),this._data.leftend==c.LINEEND_ARROW&&_.prototype.drawArrow(o,t,e,e.lineWidth),this._data.rightend==c.LINEEND_ARROW&&_.prototype.drawArrow(a,i,e,e.lineWidth)}},a.prototype.hitTest=function(e){if(3==this._data.points.length){var t=this._data.points[0],i=this._data.points[1],n=this._data.points[2],o=i.substract(t),a=n.substract(o.scaled(.25)),s=n.add(o.scaled(.25)),l=r(n,t,a,e)||r(n,i,s,e);if(l)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT);for(var d=3,h=1;h<this._data.extendLeftPoints.length;h++){var t=this._data.extendLeftPoints[h-1],i=this._data.extendLeftPoints[h],p=MathEx.distanceToSegment(t,i,e).distance;if(d>p)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}for(var h=1;h<this._data.extendRightPoints.length;h++){var t=this._data.extendRightPoints[h-1],i=this._data.extendRightPoints[h],p=MathEx.distanceToSegment(t,i,e).distance;if(d>p)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}}return null},inherit(s,u),s.prototype.update=function(){u.prototype.update.call(this),this._invalidated=!0},s.prototype.updateImpl=function(){if(this._extendLeftPoints=[],this._extendRightPoints=[],!(this.Z97.points().length<3)){var e=this.Z97.pointToScreenPoint(this.Z97.points()[0])[1],t=this.Z97.pointToScreenPoint(this.Z97.points()[1])[1],i=this.Z97.pointToScreenPoint(this.Z97.points()[2])[1],r=t.substract(e),n=i.substract(r.scaled(.25)),a=i.add(r.scaled(.25)),s=this.Z98.timeScale().width(),l=this.Z97.priceScale().height();this.Z97.properties().extendLeft.value()&&(this._extendLeftPoints=o(i,e,n,s,l)),this.Z97.properties().extendRight.value()&&(this._extendRightPoints=o(i,t,a,s,l))}},s.prototype.renderer=function(){if(this._points.length<2)return new TradingView.CompositeRenderer;this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=[].concat(this._points);this.Z97._controlPoint&&e.push(this.Z97.pointToScreenPoint(this.Z97._controlPoint)[0]);var t={},i=this.Z97.properties();t.points=e,t.color=i.linecolor.value(),t.linewidth=i.linewidth.value(),t.linestyle=i.linestyle.value(),t.leftend=i.leftEnd.value(),t.rightend=i.rightEnd.value(),t.fillBack=i.fillBackground.value(),t.backcolor=i.backgroundColor.value(),t.transparency=i.transparency.value(),t.extendLeftPoints=this._extendLeftPoints,t.extendRightPoints=this._extendRightPoints;var r=new TradingView.CompositeRenderer;return r.append(new a(t)),this.addAnchors(r),r},inherit(l,c),l.prototype.pointsCount=function(){return 2},l.prototype.title=function(){return"Curve"},l.prototype.controlPoint=function(){var e=this.pointToScreenPoint(this.points()[0])[0],t=this.pointToScreenPoint(this.points()[1])[0],i=t.substract(e).scaled(.5),r=i.transponed().scaled(.3),n=e.add(t).scaled(.5),o=n.add(r),a=this.screenPointToPoint(o);return a},l.prototype.setLastPoint=function(e,t){c.prototype.setLastPoint.call(this,e,t),this._controlPoint=this.controlPoint()},l.prototype.addPoint=function(e,t,i){var r=c.prototype.addPoint.call(this,e,t,!0);if(r){var n=this.controlPoint();this._points.push(n),delete this._controlPoint,i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2)}return r},l.prototype.restorePoints=function(e,t,i){c.prototype.restorePoints.call(this,e,t,i),this._createPointProperty(2)},d.prototype.draw=function(e){e.lineCap="butt",e.strokeStyle=this._data.color,e.lineWidth=this._data.linewidth,CanvasEx.setLineStyle(e,this._data.linestyle);var t=this._data.points[0],i=this._data.points[1];if(2==this._data.points.length)e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.stroke(),this._data.leftend==c.LINEEND_ARROW&&_.prototype.drawArrow(i,t,e,e.lineWidth),this._data.rightend==c.LINEEND_ARROW&&_.prototype.drawArrow(t,i,e,e.lineWidth);else{var r=this._data.points[2],n=this._data.points[3],o=n.substract(t),a=r.substract(o.scaled(.25)),s=r.add(o.scaled(.25)),l=i.substract(r),d=n.substract(l.scaled(.25)),h=n.add(l.scaled(.25));if(this._data.fillBack&&this._data.points.length>2&&(e.fillStyle=TradingView.generateColor(this._data.backcolor,this._data.transparency),e.beginPath(),e.moveTo(t.x,t.y),e.quadraticCurveTo(a.x,a.y,r.x,r.y),e.bezierCurveTo(s.x,s.y,d.x,d.y,n.x,n.y),e.quadraticCurveTo(h.x,h.y,i.x,i.y),e.fill()),e.beginPath(),this._data.extendLeftPoints.length>0){var p=this._data.extendLeftPoints[this._data.extendLeftPoints.length-1];e.moveTo(p.x,p.y);for(var u=this._data.extendLeftPoints.length-2;u>=0;u--){var f=this._data.extendLeftPoints[u];e.lineTo(f.x,f.y)}}e.moveTo(t.x,t.y),e.quadraticCurveTo(a.x,a.y,r.x,r.y),e.bezierCurveTo(s.x,s.y,d.x,d.y,n.x,n.y),e.quadraticCurveTo(h.x,h.y,i.x,i.y);for(var u=0;u<this._data.extendRightPoints.length;u++){var f=this._data.extendRightPoints[u];e.lineTo(f.x,f.y)}e.stroke(),this._data.leftend==c.LINEEND_ARROW&&_.prototype.drawArrow(a,t,e,e.lineWidth),this._data.rightend==c.LINEEND_ARROW&&_.prototype.drawArrow(h,i,e,e.lineWidth)}},d.prototype.hitTest=function(e){if(4==this._data.points.length){var t=this._data.points[0],i=this._data.points[1],o=this._data.points[2],a=this._data.points[3],s=a.substract(t),l=o.substract(s.scaled(.25)),d=o.add(s.scaled(.25)),h=i.substract(o),p=a.substract(h.scaled(.25)),c=a.add(h.scaled(.25)),u=r(o,t,l,e)||n(o,a,d,p,e)||r(a,i,c,e);if(u)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT);for(var _=3,f=1;f<this._data.extendLeftPoints.length;f++){var t=this._data.extendLeftPoints[f-1],i=this._data.extendLeftPoints[f],g=MathEx.distanceToSegment(t,i,e).distance;if(_>g)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}for(var f=1;f<this._data.extendRightPoints.length;f++){var t=this._data.extendRightPoints[f-1],i=this._data.extendRightPoints[f],g=MathEx.distanceToSegment(t,i,e).distance;if(_>g)return new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT)}}return null},inherit(h,u),h.prototype.update=function(){u.prototype.update.call(this),this._invalidated=!0},h.prototype.updateImpl=function(){if(this._extendLeftPoints=[],this._extendRightPoints=[],!(this.Z97.points().length<4)){var e=this.Z97.pointToScreenPoint(this.Z97.points()[0])[1],t=this.Z97.pointToScreenPoint(this.Z97.points()[1])[1],i=this.Z97.pointToScreenPoint(this.Z97.points()[2])[1],r=this.Z97.pointToScreenPoint(this.Z97.points()[3])[1],n=r.substract(e),a=i.substract(n.scaled(.25)),s=(i.add(n.scaled(.25)),t.substract(i)),l=(r.substract(s.scaled(.25)),r.add(s.scaled(.25))),d=this.Z98.timeScale().width(),h=this.Z97.priceScale().height();this.Z97.properties().extendLeft.value()&&(this._extendLeftPoints=o(i,e,a,d,h)),this.Z97.properties().extendRight.value()&&(this._extendRightPoints=o(r,t,l,d,h))}},h.prototype.renderer=function(){if(this._points.length<2)return new TradingView.CompositeRenderer;this._invalidated&&(this.updateImpl(),this._invalidated=!1);var e=[].concat(this._points);this.Z97._controlPoints&&(e.push(this.Z97.pointToScreenPoint(this.Z97._controlPoints[0])[0]),e.push(this.Z97.pointToScreenPoint(this.Z97._controlPoints[1])[0]));var t={},i=this.Z97.properties();t.points=e,t.color=i.linecolor.value(),t.linewidth=i.linewidth.value(),t.linestyle=i.linestyle.value(),t.leftend=i.leftEnd.value(),t.rightend=i.rightEnd.value(),t.fillBack=i.fillBackground.value(),t.backcolor=i.backgroundColor.value(),t.transparency=i.transparency.value(),t.extendLeftPoints=this._extendLeftPoints,t.extendRightPoints=this._extendRightPoints;var r=new TradingView.CompositeRenderer;return r.append(new d(t)),this.addAnchors(r),r},inherit(p,c),p.prototype.pointsCount=function(){return 2},p.prototype.title=function(){return"Double Curve"},p.prototype.controlPoints=function(){var e=this.pointToScreenPoint(this.points()[0])[0],t=this.pointToScreenPoint(this.points()[1])[0],i=t.substract(e).scaled(.5),r=i.transponed().scaled(.3),n=e.add(t).scaled(.33),o=e.add(t).scaled(.67),a=n.add(r),s=o.substract(r);return[this.screenPointToPoint(a),this.screenPointToPoint(s)]},p.prototype.setLastPoint=function(e,t){c.prototype.setLastPoint.call(this,e,t),this._controlPoints=this.controlPoints()},p.prototype.addPoint=function(e,t,i){var r=c.prototype.addPoint.call(this,e,t,!0);if(r){var n=this.controlPoints();delete this._controlPoints,this._points.push(n[0]),this._points.push(n[1]),i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2),this._createPointProperty(3)}return r},p.prototype.restorePoints=function(e,t,i){c.prototype.restorePoints.call(this,e,t,i),this._createPointProperty(2),this._createPointProperty(3)},t.LineToolBezierQuadro=l,t.LineToolBezierCubic=p},function(e,t,i){"use strict";function r(e,t){this._constructor="LineToolArrow";var i=t?t:new J50("linetoolarrow");n.call(this,e,i)}var n=i(55).LineToolTrendLine;inherit(r,n),r.prototype.title=function(){return"Arrow"},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._constructor="LineToolRay";var i=t?t:new J50("linetoolray");n.call(this,e,i)}var n=i(55).LineToolTrendLine;inherit(r,n),r.prototype.title=function(){return"Ray"},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._constructor="LineToolExtended";var i=t?t:new J50("linetoolextended");n.call(this,e,i)}var n=i(55).LineToolTrendLine;inherit(r,n),r.prototype.title=function(){return"Extended Line"},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i=t?t:new this.createPropertiesObject("linetoolschiffpitchfork");o.call(this,e,i),this._constructor="LineToolSchiffPitchfork"}var n=i(9),o=i(116).LineToolPitchfork;inherit(r,o),r.prototype.title=function(){return $.t("Modified Schiff Pitchfork")},r.prototype.createPropertiesObject=function(e,t,i){return new n(e,t,i,{range:[0,8]})},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i=t?t:new this.createPropertiesObject("linetoolschiffpitchfork2");o.call(this,e,i),this._constructor="LineToolSchiffPitchfork2"}var n=i(9),o=i(116).LineToolPitchfork;inherit(r,o),r.prototype.title=function(){return $.t("Schiff Pitchfork")},r.prototype.createPropertiesObject=function(e,t,i){return new n(e,t,i,{range:[0,8]})},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i=t?t:new this.createPropertiesObject("linetoolinsidepitchfork");o.call(this,e,i),this._constructor="LineToolInsidePitchfork"}var n=i(9),o=i(116).LineToolPitchfork;inherit(r,o),r.prototype.title=function(){return $.t("Inside Pitchfork")},r.prototype.createPropertiesObject=function(e,t,i){return new n(e,t,i,{range:[0,8]})},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._constructor="LineToolFlagMark";var i=t?t:new J50("linetoolflagmark");n.call(this,e,new o(this,e,this.image,25,25,-8,-21),i),this._paneViews[0].setAnchors(new MathEx.Point(0,0))}var n=i(13).LineDataSource,o=i(114);inherit(r,n),r.prototype.image=new Image,r.prototype.image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAsElEQVR4AWMYWcDExOS/YUd4hWF7+H90bNAePpO2liDwJTxyi2htyVXLvlBOWlry2bAtVIumwWXQERFF4zgJ20iPiP8JDCpLeqSuJ6ZdoRJ0SMIRx7QbQtmItgSXnGFbRCzMEnIzK8ISWgL6WzJqibGxsYaFhYUC7SxBWMQPNMjazMxMjebBZWhoKAq00NHc3FyL5nFiaWkpDTTYz8jISI/mEW9qaqoExGFgS+gFRgEAaE0hWxrw50oAAAAASUVORK5CYII=",r.prototype.pointsCount=function(){return 1},r.prototype.title=function(){return"Flag Mark"},r.prototype.version=2,r.prototype.migrateVersion=function(e){1==e&&(this.version=1,this._paneViews[0]._offsetX=0,this._paneViews[0]._offsetY=0,this._paneViews[0].setAnchors(new MathEx.Point(9,21)))},e.exports=r},function(e,t,i){"use strict";function r(e){this._line=e,this._data={bodyText:"position",quantityText:"0"}}function n(e,t){h.call(this,e,t)}function o(e,t){d.call(this,e,t),this._rendererCache={}}function a(e,t){this._adapter=new r(this),this._constructor="LineToolPosition";var i=t||new J50("linetoolposition");s.call(this,e,new o(this,e),i)}var s=i(104),l=i(13).LineDataSource,d=i(44),h=i(13).LineToolPriceAxisView,p=i(58);r.prototype.getPrice=function(){return this._line.points()[0].price},r.prototype.setPrice=function(e){var t=this._line.points()[0];return t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw(),this},r.prototype.getText=function(){return this._data.bodyText},r.prototype.setText=function(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this},r.prototype.setTooltip=function(e){return null==e?e="":e+="",this._line.properties().tooltip.setValue(e),this},r.prototype.getTooltip=function(){return this._line.properties().tooltip.value()},r.prototype.getQuantity=function(){return this._data.quantityText},r.prototype.setQuantity=function(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this},r.prototype.getExtendLeft=function(){var e=this._line.properties().extendLeft.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.extendLeft.value():e},r.prototype.setExtendLeft=function(e){return this._line.properties().extendLeft.setValue(e),this},r.prototype.getLineLength=function(){var e=this._line.properties().lineLength.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.lineLength.value():e},r.prototype.setLineLength=function(e){return this._line.properties().lineLength.setValue(Math.max(0,Math.min(e,100))),this},r.prototype.getLineColor=function(){return p.getColorFromProperties(this._line.properties().lineColor,this._line.properties().lineTransparency)},r.prototype.setLineColor=function(e){return p.setColorToProperties(e,this._line.properties().lineColor,this._line.properties().lineTransparency),this},r.prototype.getLineStyle=function(){var e=this._line.properties().lineStyle.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.lineStyle.value():e},r.prototype.setLineStyle=function(e){return this._line.properties().lineStyle.setValue(e),this},r.prototype.getLineWidth=function(){var e=this._line.properties().lineWidth.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.lineWidth.value():e},r.prototype.setLineWidth=function(e){return this._line.properties().lineWidth.setValue(e),this},r.prototype.getBodyBorderColor=function(){return p.getColorFromProperties(this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency)},r.prototype.setBodyBorderColor=function(e){return p.setColorToProperties(e,this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency),this},r.prototype.getBodyBackgroundColor=function(){return p.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)},r.prototype.setBodyBackgroundColor=function(e){return p.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this},r.prototype.getBodyTextColor=function(){return p.getColorFromProperties(this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency)},r.prototype.setBodyTextColor=function(e){return p.setColorToProperties(e,this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency),this},r.prototype.getBodyFont=function(){return p.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)},r.prototype.setBodyFont=function(e){return p.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this},r.prototype.getQuantityBorderColor=function(){return p.getColorFromProperties(this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency)},r.prototype.setQuantityBorderColor=function(e){return p.setColorToProperties(e,this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency),this},r.prototype.getQuantityBackgroundColor=function(){return p.getColorFromProperties(this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency)},r.prototype.setQuantityBackgroundColor=function(e){return p.setColorToProperties(e,this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency),this},r.prototype.getQuantityTextColor=function(){return p.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)},r.prototype.setQuantityTextColor=function(e){return p.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this},r.prototype.getQuantityFont=function(){return p.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)},r.prototype.setQuantityFont=function(e){return p.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this},r.prototype.getReverseButtonBorderColor=function(){return p.getColorFromProperties(this._line.properties().reverseButtonBorderColor,this._line.properties().reverseButtonBorderTransparency)},r.prototype.setReverseButtonBorderColor=function(e){return p.setColorToProperties(e,this._line.properties().reverseButtonBorderColor,this._line.properties().reverseButtonBorderTransparency),this},r.prototype.getReverseButtonBackgroundColor=function(){return p.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)},r.prototype.setReverseButtonBackgroundColor=function(e){return p.setColorToProperties(e,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this},r.prototype.getReverseButtonIconColor=function(){return p.getColorFromProperties(this._line.properties().reverseButtonIconColor,this._line.properties().reverseButtonIconTransparency)},r.prototype.setReverseButtonIconColor=function(e){return p.setColorToProperties(e,this._line.properties().reverseButtonIconColor,this._line.properties().reverseButtonIconTransparency),this},r.prototype.getCloseButtonBorderColor=function(){return p.getColorFromProperties(this._line.properties().closeButtonBorderColor,this._line.properties().closeButtonBorderTransparency)},r.prototype.setCloseButtonBorderColor=function(e){return p.setColorToProperties(e,this._line.properties().closeButtonBorderColor,this._line.properties().closeButtonBorderTransparency),this},r.prototype.getCloseButtonBackgroundColor=function(){return p.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)},r.prototype.setCloseButtonBackgroundColor=function(e){return p.setColorToProperties(e,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this},r.prototype.getCloseButtonIconColor=function(){return p.getColorFromProperties(this._line.properties().closeButtonIconColor,this._line.properties().closeButtonIconTransparency)},r.prototype.setCloseButtonIconColor=function(e){return p.setColorToProperties(e,this._line.properties().closeButtonIconColor,this._line.properties().closeButtonIconTransparency),this},r.prototype.block=function(){this._blocked=!0},r.prototype.unblock=function(){this._blocked=!1},r.prototype.isFunction=function(e){return"function"==typeof e},r.prototype.onReverse=function(e,t){return t?this.isFunction(t)&&(this._onReverseData=e,this._onReverseCallback=t):this.isFunction(e)&&(this._onReverseCallback=e),this},r.prototype.callOnReverse=function(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)},r.prototype.isOnReverseCallbackPresent=function(){return this.isFunction(this._onReverseCallback)},r.prototype.onClose=function(e,t){return t?this.isFunction(t)&&(this._onCloseData=e,this._onCloseCallback=t):this.isFunction(e)&&(this._onCloseCallback=e),this},r.prototype.callOnClose=function(){this.isFunction(this._onCloseCallback)&&this._onCloseCallback.call(this,this._onCloseData)},r.prototype.isOnCloseCallbackPresent=function(){return this.isFunction(this._onCloseCallback)},r.prototype.onModify=function(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this},r.prototype.callOnModify=function(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)},r.prototype.onContextMenu=function(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this},r.prototype.callOnContextMenu=function(){return this.isFunction(this._onContextMenuCallback)?this._onContextMenuCallback.call(this,this._onContextMenuData):void 0},r.prototype.remove=function(){this._line.Z98.removeSource(this._line),delete this._line},TradingView.PositionRenderer=function(e,t,i){this._data=e,this._cache=t,this._adapter=i},TradingView.PositionRenderer.prototype._height=function(){var e=1;return Math.max(20,e+Math.max(p.fontHeight(this._adapter.getBodyFont()),p.fontHeight(this._adapter.getQuantityFont())))},TradingView.PositionRenderer.prototype._bodyWidth=function(e){if(0===this._adapter.getText().length)return 0;e.save(),e.font=this._adapter.getBodyFont();var t=10,i=e.measureText(this._adapter.getText()).width;return e.restore(),Math.round(t+i)},TradingView.PositionRenderer.prototype._quantityWidth=function(e){if(0===this._adapter.getQuantity().length)return 0;e.save(),e.font=this._adapter.getQuantityFont();var t=10,i=e.measureText(this._adapter.getQuantity()).width;return e.restore(),Math.round(Math.max(this._height(),t+i))},TradingView.PositionRenderer.prototype._reverseButtonWidth=function(){return this._adapter.isOnReverseCallbackPresent()?this._height():0},TradingView.PositionRenderer.prototype._closeButtonWidth=function(){return this._adapter.isOnCloseCallbackPresent()?this._height():0},TradingView.PositionRenderer.prototype._drawLines=function(e,t,i,r,n){e.save(),e.strokeStyle=this._adapter.getLineColor(),e.lineStyle=this._adapter.getLineStyle(),e.lineWidth=this._adapter.getLineWidth(),CanvasEx.drawLine(e,i,r,n,r),this._adapter.getExtendLeft()&&CanvasEx.drawLine(e,0,r,t,r),e.restore()},TradingView.PositionRenderer.prototype._drawBody=function(e,t,i){
e.strokeStyle=this._adapter.getBodyBorderColor(),e.fillStyle=this._adapter.getBodyBackgroundColor();var r=this._bodyWidth(e),n=this._height();e.fillRect(t+.5,i+.5,r-1,n-1),e.strokeRect(t,i,r,n)},TradingView.PositionRenderer.prototype._drawBodyText=function(e,t,i){e.save(),e.textAlign="center",e.textBaseline="middle",e.font=this._adapter.getBodyFont(),e.fillStyle=this._adapter.getBodyTextColor();var r=t+this._bodyWidth(e)/2,n=i+this._height()/2;e.fillText(this._adapter.getText(),r,n),e.restore()},TradingView.PositionRenderer.prototype._drawQuantity=function(e,t,i){e.strokeStyle=this._adapter.getQuantityBorderColor(),e.fillStyle=this._adapter.getQuantityBackgroundColor();var r=this._quantityWidth(e),n=this._height();e.fillRect(t+.5,i+.5,r-1,n-1),e.strokeRect(t,i,r,n)},TradingView.PositionRenderer.prototype._drawQuantityText=function(e,t,i){e.save(),e.textAlign="center",e.textBaseline="middle",e.font=this._adapter.getQuantityFont(),e.fillStyle=this._adapter.getQuantityTextColor();var r=t+this._quantityWidth(e)/2,n=i+this._height()/2;e.fillText(this._adapter.getQuantity(),r,n),e.restore()},TradingView.PositionRenderer.prototype._drawReverseButton=function(e,t,i){e.save(),e.strokeStyle=this._adapter.getReverseButtonBorderColor(),e.fillStyle=this._adapter.getReverseButtonBackgroundColor();var r=this._reverseButtonWidth(),n=this._height();e.fillRect(t+.5,i+.5,r-1,n-1),e.strokeRect(t,i,r,n);e.strokeStyle=this._adapter.getReverseButtonIconColor();var o=function(e,t){CanvasEx.drawLine(e,0,0,0,t),CanvasEx.drawLine(e,-1,1,1,1),CanvasEx.drawLine(e,-2,2,2,2)},a=6,s=10,l=t+Math.round((this._reverseButtonWidth()-a)/2),d=i+5;e.save(),e.translate(l,d),o(e,s),e.translate(a,s),e.rotate(Math.PI),o(e,s),e.restore(),this._adapter._blocked&&(e.fillStyle="rgba(140, 140, 140, 0.75)",e.fillRect(t+.5,i+.5,r-1,n-1)),e.restore()},TradingView.PositionRenderer.prototype._drawCloseButton=function(e,t,i){e.save(),e.strokeStyle=this._adapter.getCloseButtonBorderColor(),e.fillStyle=this._adapter.getCloseButtonBackgroundColor();var r=this._closeButtonWidth(),n=this._height();e.fillRect(t+.5,i+.5,r-1,n-1),e.strokeRect(t,i,r,n);var o=t+r,a=i+n;e.strokeStyle=this._adapter.getCloseButtonIconColor();var s=8,l=(this._closeButtonWidth()-s)/2,d=(this._height()-s)/2;CanvasEx.drawPoly(e,[{x:t+l,y:i+d},{x:o-l,y:a-d}],!0),CanvasEx.drawPoly(e,[{x:o-l,y:i+d},{x:t+l,y:a-d}],!0),this._adapter._blocked&&(e.fillStyle="rgba(140, 140, 140, 0.75)",e.fillRect(t+.5,i+.5,r-1,n-1)),e.restore()},TradingView.PositionRenderer.prototype.draw=function(e){if(this._data.points&&!(this._data.points.length<1)){var t=this._data.width,i=this._bodyWidth(e),r=this._quantityWidth(e),n=this._reverseButtonWidth(e),o=i+r+n+this._closeButtonWidth(),a=t-o,s=Math.max(this._adapter.getLineLength()/100*t,1),l=Math.round(t-Math.min(a,s)),d=l-o,h=Math.round(this._data.points[0].y),p=Math.round(h-(this._height()+1)/2);this._cache.bodyRight=d+i,this._cache.quantityRight=this._cache.bodyRight+r,this._cache.reverseButtonRight=this._cache.quantityRight+n,this._cache.top=p,this._cache.bottom=p+this._height(),this._cache.left=d,this._cache.right=l,this._drawLines(e,d,l,h,t),0!==i&&(this._drawBody(e,d,p),this._drawBodyText(e,d,p)),0!==r&&(this._drawQuantity(e,this._cache.bodyRight,p),this._drawQuantityText(e,this._cache.bodyRight,p)),0!==n&&this._drawReverseButton(e,this._cache.quantityRight,p),0!==this._closeButtonWidth()&&this._drawCloseButton(e,this._cache.reverseButtonRight,p)}},TradingView.PositionRenderer.prototype.hitTest=function(e){return 0===this._data.points.length?null:e.y<this._cache.top||e.y>this._cache.bottom||e.x<this._cache.left||this._cache.right<e.x?null:this._adapter._blocked?new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{tooltip:{text:$.t("Position is being changed"),rect:new TradingView.Rect(this._cache.bodyRight,this._cache.top,this._cache.quantityRight-this._cache.bodyRight,this._cache.bottom-this._cache.top)}}):e.x>=this._cache.bodyRight&&e.x<this._cache.quantityRight&&this._adapter._onModifyCallback?new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{mouseDownHandler:this._adapter.callOnModify.bind(this._adapter),tooltip:{text:$.t("Edit Position"),rect:new TradingView.Rect(this._cache.bodyRight,this._cache.top,this._cache.quantityRight-this._cache.bodyRight,this._cache.bottom-this._cache.top)}}):e.x>=this._cache.quantityRight&&e.x<this._cache.reverseButtonRight?new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{mouseDownHandler:this._adapter.callOnReverse.bind(this._adapter),tooltip:{text:$.t("Reverse Position"),rect:new TradingView.Rect(this._cache.quantityRight,this._cache.top,this._cache.reverseButtonRight-this._cache.quantityRight,this._cache.bottom-this._cache.top)}}):e.x>=this._cache.reverseButtonRight&&e.x<this._cache.right?new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{mouseDownHandler:this._adapter.callOnClose.bind(this._adapter),tooltip:{text:$.t("Close Position"),rect:new TradingView.Rect(this._cache.reverseButtonRight,this._cache.top,this._cache.right-this._cache.reverseButtonRight,this._cache.bottom-this._cache.top)}}):new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR,{mouseDownHandler:function(){}})},inherit(n,h),n.prototype._updateImpl=function(){h.prototype._updateImpl.call(this),this._background=this._linetool.properties().lineColor.value()},inherit(o,d),o.prototype.renderer=function(){var e={points:this._points,width:this.Z98.timeScale().width()};return new TradingView.PositionRenderer(e,this._rendererCache,this.Z97._adapter)},inherit(a,s),a.prototype.setPoint=function(e,t,i){this._points[e]=t,this.normalizePoints()},a.prototype.addPoint=function(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0},a.skipMagnetting=!0,a.prototype.title=function(){return"Position"},a.prototype.createPriceAxisView=function(e){return this._priceAxisView=new n(this,e),this._priceAxisView},a.prototype.paneViews=function(e){return TradingView.printing?null:this.Z98.properties().tradingProperties.showPositions.value()?l.prototype.paneViews.call(this,e):null},a.prototype.priceAxisViews=function(e,t){return TradingView.printing?null:this.Z98.properties().tradingProperties.showPositions.value()?l.prototype.priceAxisViews.call(this,e,t):null},a.prototype.hasContextMenu=function(){return!0},a.prototype.contextMenuItems=function(){return this._adapter.callOnContextMenu()},e.exports=a},function(e,t,i){"use strict";function r(e){this._line=e,this._data={bodyText:"order",quantityText:"0"}}function n(e,t,i){this._data=e,this._cache=t,this._adapter=i}function o(e,t){d.call(this,e,t)}function a(e,t){c.call(this,e,t),this._rendererCache={}}function s(e,t){this._adapter=new r(this),this._constructor="LineToolOrder";var i=t||new J50("linetoolorder");l.call(this,e,new a(this,e),i)}var l=i(104),d=i(13).LineToolPriceAxisView,h=i(58),p=i(13).LineDataSource,c=i(44);r.prototype.getPrice=function(){return this._line.points()[0].price},r.prototype.setPrice=function(e){var t=this._line.points()[0];return t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw(),this},r.prototype.getText=function(){return this._data.bodyText},r.prototype.setText=function(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this},r.prototype.setTooltip=function(e){return null==e?e="":e+="",this._line.properties().tooltip.setValue(e),this},r.prototype.getTooltip=function(){return this._line.properties().tooltip.value()},r.prototype.getQuantity=function(){return this._data.quantityText},r.prototype.setQuantity=function(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this},r.prototype.getExtendLeft=function(){var e=this._line.properties().extendLeft.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.extendLeft.value():e},r.prototype.setExtendLeft=function(e){return this._line.properties().extendLeft.setValue(e),this},r.prototype.getLineLength=function(){var e=this._line.properties().lineLength.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.lineLength.value():e},r.prototype.setLineLength=function(e){return this._line.properties().lineLength.setValue(Math.max(0,Math.min(e,100))),this},r.prototype.getLineColor=function(){return h.getColorFromProperties(this._line.properties().lineColor,this._line.properties().lineTransparency)},r.prototype.setLineColor=function(e){return h.setColorToProperties(e,this._line.properties().lineColor,this._line.properties().lineTransparency),this},r.prototype.getLineStyle=function(){var e=this._line.properties().lineStyle.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.lineStyle.value():e},r.prototype.setLineStyle=function(e){return this._line.properties().lineStyle.setValue(e),this},r.prototype.getLineWidth=function(){var e=this._line.properties().lineWidth.value();return"inherit"==e?this._line.Z98.properties().tradingProperties.lineWidth.value():e},r.prototype.setLineWidth=function(e){return this._line.properties().lineWidth.setValue(e),this},r.prototype.getBodyBorderColor=function(){return h.getColorFromProperties(this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency)},r.prototype.setBodyBorderColor=function(e){return h.setColorToProperties(e,this._line.properties().bodyBorderColor,this._line.properties().bodyBorderTransparency),this},r.prototype.getBodyBackgroundColor=function(){return h.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)},r.prototype.setBodyBackgroundColor=function(e){return h.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this},r.prototype.getBodyTextColor=function(){return h.getColorFromProperties(this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency)},r.prototype.setBodyTextColor=function(e){return h.setColorToProperties(e,this._line.properties().bodyTextColor,this._line.properties().bodyTextTransparency),this},r.prototype.getBodyFont=function(){return h.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)},r.prototype.setBodyFont=function(e){return h.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this},r.prototype.getQuantityBorderColor=function(){return h.getColorFromProperties(this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency)},r.prototype.setQuantityBorderColor=function(e){return h.setColorToProperties(e,this._line.properties().quantityBorderColor,this._line.properties().quantityBorderTransparency),this},r.prototype.getQuantityBackgroundColor=function(){return h.getColorFromProperties(this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency)},r.prototype.setQuantityBackgroundColor=function(e){return h.setColorToProperties(e,this._line.properties().quantityBackgroundColor,this._line.properties().quantityBackgroundTransparency),this},r.prototype.getQuantityTextColor=function(){return h.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)},r.prototype.setQuantityTextColor=function(e){return h.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this},r.prototype.getQuantityFont=function(){return h.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)},r.prototype.setQuantityFont=function(e){return h.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this},r.prototype.getCancelButtonBorderColor=function(){return h.getColorFromProperties(this._line.properties().cancelButtonBorderColor,this._line.properties().cancelButtonBorderTransparency)},r.prototype.setCancelButtonBorderColor=function(e){return h.setColorToProperties(e,this._line.properties().cancelButtonBorderColor,this._line.properties().cancelButtonBorderTransparency),this},r.prototype.getCancelButtonBackgroundColor=function(){return h.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)},r.prototype.setCancelButtonBackgroundColor=function(e){return h.setColorToProperties(e,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this},r.prototype.getCancelButtonIconColor=function(){return h.getColorFromProperties(this._line.properties().cancelButtonIconColor,this._line.properties().cancelButtonIconTransparency)},r.prototype.setCancelButtonIconColor=function(e){return h.setColorToProperties(e,this._line.properties().cancelButtonIconColor,this._line.properties().cancelButtonIconTransparency),this},r.prototype.isFunction=function(e){return"function"==typeof e},r.prototype.onCancel=function(e,t){return t?this.isFunction(t)&&(this._onCancelData=e,this._onCancelCallback=t):this.isFunction(e)&&(this._onCancelCallback=e),this},r.prototype.callOnCancel=function(){this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)},r.prototype.isOnCancelCallbackPresent=function(){return this.isFunction(this._onCancelCallback)},r.prototype.onModify=function(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this},r.prototype.callOnModify=function(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)},r.prototype.onMove=function(e,t){return t?this.isFunction(t)&&(this._onMoveData=e,this._onMoveCallback=t):this.isFunction(e)&&(this._onMoveCallback=e),this},r.prototype.callOnMove=function(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)},r.prototype.onContextMenu=function(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this},r.prototype.callOnContextMenu=function(){return this.isFunction(this._onContextMenuCallback)?this._onContextMenuCallback.call(this,this._onContextMenuData):void 0},r.prototype.remove=function(){this._line.Z98.removeSource(this._line),delete this._line},n.prototype._height=function(){var e=1;return Math.max(20,e+Math.max(h.fontHeight(this._adapter.getBodyFont()),h.fontHeight(this._adapter.getQuantityFont())))},n.prototype._bodyWidth=function(e){if(0===this._adapter.getText().length)return 0;e.save(),e.font=this._adapter.getBodyFont();var t=10,i=10,r=e.measureText(this._adapter.getText()).width;return e.restore(),Math.round(t+i+r)},n.prototype._quantityWidth=function(e){if(0===this._adapter.getQuantity().length)return 0;e.save(),e.font=this._adapter.getQuantityFont();var t=10,i=e.measureText(this._adapter.getQuantity()).width;return e.restore(),Math.round(Math.max(this._height(),t+i))},n.prototype._cancelButtonWidth=function(){return this._adapter.isOnCancelCallbackPresent()?this._height():0},n.prototype._drawLines=function(e,t,i,r,n){e.save(),e.strokeStyle=this._adapter.getLineColor(),e.lineStyle=this._adapter.getLineStyle(),e.lineWidth=this._adapter.getLineWidth(),CanvasEx.drawLine(e,i,r,n,r),this._adapter.getExtendLeft()&&CanvasEx.drawLine(e,0,r,t,r),e.restore()},n.prototype._drawMovePoints=function(e,t,i){e.save(),e.strokeStyle=this._adapter.getBodyBorderColor(),e.fillStyle=this._adapter.getBodyBorderColor();for(var r=2,n=4,o=5,a=t+n,s=a+r,l=Math.floor((this._height()-2*o)/2)+1,d=0;l>d;++d){var h=i+o+2*d;CanvasEx.drawLine(e,a,h,s,h)}e.restore()},n.prototype._drawBody=function(e,t,i){e.strokeStyle=this._adapter.getBodyBorderColor(),e.fillStyle=this._adapter.getBodyBackgroundColor();var r=this._bodyWidth(e),n=this._height();e.fillRect(t+.5,i+.5,r-1,n-1),e.strokeRect(t,i,r,n)},n.prototype._drawBodyText=function(e,t,i){e.textAlign="center",e.textBaseline="middle",e.font=this._adapter.getBodyFont(),e.fillStyle=this._adapter.getBodyTextColor();var r=5,n=t+this._bodyWidth(e)/2,o=i+this._height()/2;e.fillText(this._adapter.getText(),r+n-2,o)},n.prototype._drawQuantity=function(e,t,i,r){e.save(),e.strokeStyle=this._adapter.getQuantityBorderColor(),e.fillStyle=this._adapter.getQuantityBackgroundColor();var n=this._quantityWidth(e),o=this._height();e.fillRect(t+.5,i+.5,n-1,o-1),r&&e.clip&&(e.beginPath(),e.rect(t+.5,i-.5,n+1,o+1),e.clip()),e.strokeRect(t,i,n,o),e.restore()},n.prototype._drawQuantityText=function(e,t,i){e.save(),e.textAlign="center",e.textBaseline="middle",e.font=this._adapter.getQuantityFont(),e.fillStyle=this._adapter.getQuantityTextColor();var r=t+this._quantityWidth(e)/2,n=i+this._height()/2;e.fillText(this._adapter.getQuantity(),r,n),e.restore()},n.prototype._drawCancelButton=function(e,t,i,r){e.strokeStyle=this._adapter.getCancelButtonBorderColor(),e.fillStyle=this._adapter.getCancelButtonBackgroundColor();var n=this._cancelButtonWidth(),o=this._height();e.fillRect(t+.5,i+.5,n-1,o-1),e.save(),r&&e.clip&&(e.beginPath(),e.rect(t+.5,i-.5,n+1,o+1),e.clip()),e.strokeRect(t,i,n,o),e.restore();var a=t+n,s=i+o;e.strokeStyle=this._adapter.getCancelButtonIconColor();var l=8,d=(this._cancelButtonWidth()-l)/2,h=(this._height()-l)/2;CanvasEx.drawPoly(e,[{x:t+d,y:i+h},{x:a-d,y:s-h}],!0),CanvasEx.drawPoly(e,[{x:a-d,y:i+h},{x:t+d,y:s-h}],!0)},n.prototype.draw=function(e){if(this._data.points&&!(this._data.points.length<1)){var t=this._data.width,i=this._bodyWidth(e),r=this._quantityWidth(e),n=i+r+this._cancelButtonWidth(),o=t-n,a=Math.max(this._adapter.getLineLength()/100*t,1),s=Math.round(t-Math.min(o,a)),l=s-n,d=Math.round(this._data.points[0].y),h=Math.round(d-(this._height()+1)/2);this._cache.bodyRight=l+i,this._cache.quantityRight=l+i+r,this._cache.top=h,this._cache.bottom=h+this._height(),this._cache.left=l,this._cache.right=s,this._drawLines(e,l,s,d,t);var p=!1;0!==i&&(this._drawBody(e,l,h),this._drawMovePoints(e,l,h),this._drawBodyText(e,l,h),p=!0),0!==r&&(this._drawQuantity(e,l+i,h,p),this._drawQuantityText(e,l+i,h),p=!0),0!==this._cancelButtonWidth()&&this._drawCancelButton(e,l+i+r,h,p)}},n.prototype.hitTest=function(e){return 0===this._data.points.length?null:e.y<this._cache.top||e.y>this._cache.bottom?null:e.x>=this._cache.left&&e.x<this._cache.bodyRight?0===this._adapter.getTooltip().length?new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT):new TradingView.HitTestResult(TradingView.HitTestResult.MOVEPOINT,{tooltip:{text:this._adapter.getTooltip(),rect:new TradingView.Rect(this._cache.left,this._cache.top,this._cache.bodyRight-this._cache.left,this._cache.bottom-this._cache.top)}}):e.x>=this._cache.bodyRight&&e.x<this._cache.quantityRight?new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{mouseDownHandler:this._adapter.callOnModify.bind(this._adapter),tooltip:{text:$.t("Edit Order"),rect:new TradingView.Rect(this._cache.bodyRight,this._cache.top,this._cache.quantityRight-this._cache.bodyRight,this._cache.bottom-this._cache.top)}}):e.x>=this._cache.quantityRight&&e.x<this._cache.right?new TradingView.HitTestResult(TradingView.HitTestResult.CUSTOM,{mouseDownHandler:this._adapter.callOnCancel.bind(this._adapter),tooltip:{text:$.t("Cancel Order"),rect:new TradingView.Rect(this._cache.quantityRight,this._cache.top,this._cache.right-this._cache.quantityRight,this._cache.bottom-this._cache.top)}}):null},inherit(o,d),o.prototype._updateImpl=function(){d.prototype._updateImpl.call(this),this._background=this._linetool.properties().lineColor.value()},inherit(a,c),a.prototype.renderer=function(){var e={points:this._points,width:this.Z98.timeScale().width()};return new n(e,this._rendererCache,this.Z97._adapter)},inherit(s,l),s.skipMagnetting=!0,s.prototype.setPoint=function(e,t,i){this._points[e]=t,this.normalizePoints()},s.prototype.addPoint=function(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0},s.prototype.title=function(){return"Order"},s.prototype.endMoving=function(e){var t=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.price!=this._currentMovingPoint.price;l.prototype.endMoving.call(this),!e&&t&&this._adapter.callOnMove()},s.prototype.createPriceAxisView=function(e){return this._priceAxisView=new o(this,e),this._priceAxisView},s.prototype.paneViews=function(e){return TradingView.printing?null:this.Z98.properties().tradingProperties.showOrders.value()?p.prototype.paneViews.call(this,e):null},s.prototype.priceAxisViews=function(e,t){return TradingView.printing?null:this.Z98.properties().tradingProperties.showOrders.value()?p.prototype.priceAxisViews.call(this,e,t):null},s.prototype.hasContextMenu=function(){return!0},s.prototype.contextMenuItems=function(){return this._adapter.callOnContextMenu()},s.prototype.onlyYMoving=function(){return!0},e.exports=s},function(e,t,i){"use strict";for(var r={ESDStudyBase:i(61).ESDStudyBase,StudyStrategy:i(155),StatusView:i(62),StudyLineDataSource:i(85).StudyLineDataSource,StudyLineDataSourcePaneView:i(85).StudyLineDataSourcePaneView,StudyVersioning:i(80),StudyMigration:i(87),StudyHHistsDataWindowView:i(157),study_Script$TV_EARNINGS:i(61).study_Script$TV_EARNINGS,study_Script$TV_SPLITS:i(61).study_Script$TV_SPLITS,study_Script$TV_DIVIDENDS:i(61).study_Script$TV_DIVIDENDS,study_Sessions:i(158),study_Overlay:i(159).study_Overlay,study_PivotPointsStandard:i(160),study_Compare:i(161),study_ElliottWave:i(162),study_PivotPointsHighLow:i(163),study_ZigZag:i(164),study_LinearRegression:i(82).study_LinearRegression,study_VbPVisible:i(165),study_VbPSessions:i(166),study_Edgr:i(167),study_ScriptWithDataOffset:i(168),StudyPaneView:i(77).StudyPaneView,StudyBackgroundPaneView:i(77).StudyBackgroundPaneView,StudyPlotShapesPaneView:i(77).StudyPlotShapesPaneView,StudyPlotCharsPaneView:i(77).StudyPlotCharsPaneView,StudyPlotArrowsPaneView:i(77).StudyPlotArrowsPaneView,StudyPlotCandlesPaneView:i(77).StudyPlotCandlesPaneView,StudyStrategyOrdersPaneView:i(156),StudyPriceAxisView:i(76),StudyDataWindowView:i(79).StudyDataWindowView,DataVendorStudyDataWindowView:i(79).DataVendorStudyDataWindowView,LineStudyMtpAnalysis:i(169),LineStudyMtpDecisionPoint:i(170),LineStudyMtpRiskReward:i(171),LineStudyMtpElliotWaveMain:i(172).LineStudyMtpElliotWaveMain,LineStudyMtpElliotWaveMajor:i(172).LineStudyMtpElliotWaveMajor,LineStudyMtpElliotWaveMinor:i(172).LineStudyMtpElliotWaveMinor,LineStudyMtpDownWave1OrA:i(173).LineStudyMtpDownWave1OrA,LineStudyMtpDownWave2OrB:i(173).LineStudyMtpDownWave2OrB,LineStudyMtpDownWave3:i(173).LineStudyMtpDownWave3,LineStudyMtpDownWave4:i(173).LineStudyMtpDownWave4,LineStudyMtpDownWave5:i(173).LineStudyMtpDownWave5,LineStudyMtpDownWaveC:i(173).LineStudyMtpDownWaveC,LineStudyMtpUpWave1OrA:i(173).LineStudyMtpUpWave1OrA,LineStudyMtpUpWave2OrB:i(173).LineStudyMtpUpWave2OrB,LineStudyMtpUpWave3:i(173).LineStudyMtpUpWave3,LineStudyMtpUpWave4:i(173).LineStudyMtpUpWave4,LineStudyMtpUpWave5:i(173).LineStudyMtpUpWave5,LineStudyMtpUpWaveC:i(173).LineStudyMtpUpWaveC},n=Object.keys(r),o=n.length;o--;)TradingView[n[o]]=r[n[o]];e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){n.call(this,e,t,i,r),this._barsIndexes=[],this._reportDataBuffer=this._reportData=null,this.watchedData=new WatchedValue,this.model().addStrategySource(this)}var n=i(74).Study,o=i(156);inherit(r,n),r.prototype.stop=function(){return n.prototype.stop.call(this),this._avoidRemoveStrategySource?void delete this._avoidRemoveStrategySource:void this.model().removeStrategySource(this)},r.prototype.processHibernate=function(){this._studyId&&!this.isVisible()&&(this._avoidRemoveStrategySource=!0),n.prototype.processHibernate.call(this)},r.prototype.onData=function(e){if(n.prototype.onData.call(this,e),e.method&&"data_update"==e.method){var t=e.params&&e.params.nonseries&&e.params.nonseries.d,i=t&&t.data&&t.data.report;if(i)t.isUpdate&&this._reportDataBuffer&&(i=$.extend(this._reportDataBuffer,i)),this._reportDataBuffer=this._reportData=$.extend(this._reportDataBuffer||{},i);else{var r=$.extend({},e);$.extend(!0,r,{params:{nonseries:{d:{data:{report:this._reportDataBuffer}}}}}),e=r}var o=e.params&&e.params.nonseries&&e.params.nonseries.indexes;"nochange"!=o&&o instanceof Array&&o.length&&this._collateBarsIndexes(o)}this.watchedData.setValue(e)},r.prototype._collateBarsIndexes=function(e){if(Array.isArray(e)){var t=this._reportData&&this._reportData.filledOrders;if(t&&t.length){this._barsIndexes.length=0;for(var i=0;i<t.length;i++)this._barsIndexes[i]=e[t[i].tm]}}},r.prototype.reportData=function(){return this._reportData},r.prototype.ordersData=function(){return this._reportData&&this._reportData.filledOrders},r.prototype.barsIndexes=function(){return this._barsIndexes},r.prototype.clearData=function(){n.prototype.clearData.call(this),this._strategyOrdersPaneView&&this._strategyOrdersPaneView.clearItems()},r.prototype.restoreData=function(e){n.prototype.restoreData.apply(this,arguments),this.model().addStrategySource(this),e.reportData&&e.barsIndexes&&(this._reportData=e.reportData,this._barsIndexes=e.barsIndexes,this.watchedData.setValue({method:"data_update",params:{nonseries:{d:{data:{report:this._reportData}}}}})),e.activeState&&(this._activeState=!0)},r.prototype.activeState=function(){return this._activeState},r.prototype.updateAllViews=function(){n.prototype.updateAllViews.call(this),this._strategyOrdersPaneView&&this._strategyOrdersPaneView.update()},r.prototype.createViews=function(){n.prototype.createViews.call(this),this._strategyOrdersPaneView=new o(this,this._series,this.Z98)},r.prototype.state=function(e){var t=n.prototype.state.apply(this,arguments);return e&&this._reportData&&this._barsIndexes&&(t.data||(t.data={}),t.data.reportData=this._reportData,t.data.barsIndexes=this._barsIndexes,t.data.activeState=this.model().activeStrategySource().value()==this),t},e.exports=r},function(e,t){"use strict";function i(e,t,r){this.Z99=e,this._series=t,this.Z98=r,this._invalidated=!0,this._orderArrow={vMargin:i.DEFAULT_ORDER_ARROW_VMARGIN,width:i.DEFAULT_ORDER_ARROW_WIDTH,height:i.DEFAULT_ORDER_ARROW_HEIGHT},this._exitLineWidth=i.DEFAULT_ORDER_ARROW_EXIT_LINE_WIDTH,this._priceArrow={width:i.DEFAULT_PRICE_ARROW_WIDTH,height:i.DEFAULT_PRICE_ARROW_HEIGHT},this._text={vMargin:i.DEFAULT_TEXT_VMARGIN,font:i.DEFAULT_FONT,fontSize:i.DEFAULT_FONT_SIZE},this._checkHideTextIfBarSpacingLT=i.DEFAULT_CHECK_HIDE_TEXT_IF_BARSPACING_LT,this._textIsVisible=!0,this._colors={entryBuy:i.DEFAULT_ENTRY_BUY_COLOR,entrySell:i.DEFAULT_ENTRY_SELL_COLOR,exit:i.DEFAULT_EXIT_COLOR},this._items={entryBuy:[],entrySell:[],exit:[]},this._textWidths={},this.Z99.properties().strategy.orders.subscribe(this,this.update)}i.DEFAULT_ORDER_ARROW_VMARGIN=7,i.DEFAULT_ORDER_ARROW_WIDTH=9,i.DEFAULT_ORDER_ARROW_HEIGHT=11,i.DEFAULT_ORDER_ARROW_EXIT_LINE_WIDTH=2,i.DEFAULT_PRICE_ARROW_WIDTH=5,i.DEFAULT_PRICE_ARROW_HEIGHT=9,i.DEFAULT_TEXT_VMARGIN=2,i.DEFAULT_FONT="Arial",i.DEFAULT_FONT_SIZE=10,i.DEFAULT_CHECK_HIDE_TEXT_IF_BARSPACING_LT=10,i.DEFAULT_ENTRY_BUY_COLOR="#008fff",i.DEFAULT_ENTRY_SELL_COLOR="#f00",i.DEFAULT_EXIT_COLOR="#cc47ed",i.prototype._updateImpl=function(){this.clearItems();var e=this.Z99.ordersData();if(e&&e.length){var t=this.Z98.timeScale(),i=this._series.priceScale();if(!(!t||!i||t&&t.isEmpty()||i&&i.isEmpty())){var r=t.visibleBars().clone();if(!r.isEmpty()){for(var n,o,a=this.Z99.barsIndexes(),s=this._series.nearestIndex(r.firstBar(),TradingView.SEARCH_NEAREST_RIGHT),l=this._series.nearestIndex(r.lastBar(),TradingView.SEARCH_NEAREST_LEFT),d=s,h=[],p=[];l>=d;d++)for(n=-1;-1!=(n=a.indexOf(d,n+1));)o=e[n],o&&(h.push(o),p.push(d));var c=this.Z99.properties(),u=c.strategy.orders.showLabels.value(),_=c.strategy.orders.showQty.value(),f=u||_;f&&t.barSpacing()<this._checkHideTextIfBarSpacingLT&&this._orderArrow.width*h.length*2>t.width()&&(f=!1);for(var g,v,m,y,w,T,b=f&&this._text.fontSize+this._text.vMargin||0,S=b&&b*(u+_),C=0,x={upper:[],lower:[]};C<h.length;C++)o=h[C],n=p[C],g=t.indexToCoordinate(n,!0),v=i.priceToCoordinate(this._series[o.b?"low":"high"](n),!0),m=o.b?"lower":"upper",y="number"==typeof x[m][n]&&x[m][n]||0,v+=o.b?y:-y,"number"!=typeof x[m][n]&&(x[m][n]=0),x[m][n]+=(o.e?0:this._exitLineWidth)+this._orderArrow.vMargin+this._orderArrow.height+S,w=i.priceToCoordinate(o.p,!0),T=o.e?!o.b&&o.e?"entrySell":"entryBuy":"exit",this._items[T].push({orderPoint:new MathEx.Point(g,v),pricePoint:new MathEx.Point(g,w),label:u&&(o.c||o.id||"Untitled")||null,qty:_&&(o.b?"+":"-")+~~o.q||null,pos:m});this._textLabelIsVisible=u,this._textQtyIsVisible=_,this._textIsVisible=f}}}},i.prototype.update=function(){this._invalidated=!0},i.prototype.clearItems=function(){this._items.entryBuy.length=this._items.entrySell.length=this._items.exit.length=0},i.prototype.renderer=function(){var e=this.Z99.properties();if(e.visible.value()&&e.strategy.orders.visible.value()){var t=this._series.priceScale();if((this._invalidated||t&&t.isScaled())&&(this._updateImpl(),this._invalidated=!1),this._items.entryBuy.length||this._items.entrySell.length||this._items.exit.length){var i=new TradingView.CompositeRenderer;for(var r in this._items)this._items[r].length&&i.append(new TradingView.PaneRendererStudyStrategyOrders({items:this._items[r],color:this._colors[r],orderArrow:this._orderArrow,exitLineWidth:"exit"==r&&this._exitLineWidth||0,priceArrow:this._priceArrow,text:this._textIsVisible&&this._text||null},this._textWidths));return i}}},e.exports=i},function(e,t,i){"use strict";function r(e,t){o.call(this),this.Z99=e,this.Z98=t;var i=e.metaInfo().graphics.hhists;if(i){var r=0;for(var n in i){for(var s=i[n],l=0;l<s.titles.length;l++){var d=new a(this.Z99.title(),"");d.histElemIndex=l,d.histIndex=r,d.histId=n,this._items.push(d)}r++}this.update(),this._invalidated=!0}}var n=i(38),o=n.DataWindowView,a=n.DataWindowItem;inherit(r,o),r.prototype.update=function(){this._invalidated=!0},r.prototype._updateImpl=function(){this._header=this.Z99.title();for(var e=0;e<this._items.length;++e)this._items[e].setValue("n/a");var t=this.Z99.priceScale(),i=this.Z98.timeScale();if(t&&!t.isEmpty()&&i&&!i.isEmpty())for(var n=this.Z98.crossHairSource(),o=n.appliedIndex(),a=n.price,s=this.Z99.formatter(),e=0;e<this._items.length;++e){var l=this._items[e].histId,d=this._items[e].histIndex,h=this._items[e].histElemIndex,p=this.Z99.graphics().hhists;if(!p)return;var c=p[d].dataObj;if(c){var u=r._findHistogramBar(c,o,a);if(u){var _=u.rate[h];this._items[e].setValue(isNumber(_)?s.format(_):"");var f=this.Z99.properties().graphics.hhists[l].colors[h].value();this._items[e].setColor(f)}}}},r._findHistogramBar=function(e,t,i){if(0===e.length)return null;var r=this._findHistogramKey(e,t),n=e[r];if(!n||0===n.length)return null;var o=this._findBar(n,i);return n[o]},r._findHistogramKey=function(e,t){var i=Object.keys(e),r=[];for(var n in i)i[n]<=t&&r.push(parseInt(i[n],10));if(0===r.length)return null;for(var o=null,n=0;n<r.length;++n)(null===o||r[n]>o)&&(o=r[n]);return o},r._findBar=function(e,t){for(var i=0,r=e.length-1;r>=i;){var n=i+r>>>1,o=e[n].priceHigh,a=e[n].priceLow;if(t>o)i=n+1;else{if(!(a>t))return n;r=n-1}}return null},r.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){n.call(this,e,t,i,r)}var n=i(74).Study;inherit(r,n),r.prototype.hasContextMenu=function(){return!1},r.prototype.showInObjectTree=function(){
return!1},r.prototype.isSavedInStudyTemplates=function(){return!1},r.prototype.isRemovedByStudyTemplates=function(){return!1},r.prototype.removeByRemoveAllStudies=function(){return!1},r.prototype.isUserDeletable=function(){return!1},r.prototype.statusView=function(){return!1},e.exports=r},function(e,t,i){"use strict";function r(e,t){this.Z97=e,this.Z98=t,this._points=[new MathEx.Point(0,0)]}function n(e,t){this.Z97=e,this.Z98=t,this._invalidated=!0,this._text="",this._coordinate=0,this._background="black",this._color="white"}function o(e,t){y.call(this),this.Z99=e,this.Z98=t,this._items.push(new w("Open","")),this._items.push(new w("High","")),this._items.push(new w("Low","")),this._items.push(new w("Close","")),this._invalidated=!0,this.update()}function a(e,t,i,r){this._symbolLabelView=new S(e,this,"close","symbol","showSymbolLabels"),l.call(this,e,t,i,r),this._formatter=null,this._paneView=null;var n=this;this.properties().minTick.listeners().subscribe(null,function(){n._createFormatter(),n.updateAllViews(),n.Z98.Q18(new $21($21.FULL_UPDATE))})}var s=i(31),l=i(74).Study,d=i(14),h=i(15),p=i(39),c=p.SeriesAreaPaneView,u=p.SeriesLinePaneView,_=p.SeriesHollowCandlesPaneView,f=p.SeriesCandlesPaneView,g=p.SeriesBarsPaneView,v=i(62),m=i(38),y=m.DataWindowView,w=m.DataWindowItem,T=i(42).SeriesBarColorer,b=i(43).HorzLineRenderer,S=i(47);r.prototype.update=function(){if(this._visible=!1,this.Z97.properties().showPriceLine.value()){var e=this.Z97.lastValueData("close",!0);e.noData||(this._visible=!0,this._points=[new MathEx.Point(0,e.coordinate)],this._color=e.color)}},r.prototype.renderer=function(){var e={};return e.points=this._points,e.color=this._color,e.linewidth=1,e.linestyle=CanvasEx.LINESTYLE_DOTTED,e.hitTestResult=TradingView.HitTestResult.REGULAR,e.visible=this._visible,new b(e)},inherit(n,d),n.prototype.update=function(){this._invalidated=!0},n.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),d.prototype.coordinate.call(this)},n.prototype._updateImpl=function(){this._visible=!1,this._text="";var e=this.Z97.lastValueData("close",!1);e.noData||(this._text=e.text,this._floatCoordinate=e.floatCoordinate,this._coordinate=e.coordinate,this._background=e.color,this._visible=!0)},n.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);var e={text:this._text,coordinate:this._coordinate,color:this.color(),background:this._background,visible:this._visible};return new h(e)},inherit(o,y),o.prototype._updateImpl=function(){if(this._header=this.Z99.title(),!this.Z98.timeScale().isEmpty()&&0!==this.Z99.data().length){var e,t,i=!1;this.Z99.properties().style.value()===s.STYLE_BARS?(e=this.Z99.properties().barStyle.upColor.value(),t=this.Z99.properties().barStyle.downColor.value(),i=this.Z99.properties().barStyle.barColorsOnPrevClose.value()):this.Z99.properties().style.value()===s.STYLE_CANDLES?(e=this.Z99.properties().candleStyle.upColor.value(),t=this.Z99.properties().candleStyle.downColor.value(),i=this.Z99.properties().candleStyle.barColorsOnPrevClose.value()):this.Z99.properties().style.value()===s.STYLE_HOLLOW_CANDLES?(e=this.Z99.properties().hollowCandleStyle.upColor.value(),t=this.Z99.properties().hollowCandleStyle.downColor.value(),i=!0):this.Z99.properties().style.value()===s.STYLE_LINE?e=t=this.Z99.properties().lineStyle.color.value():this.Z99.properties().style.value()===s.STYLE_AREA&&(e=t=this.Z99.properties().areaStyle.linecolor.value());var r=this.Z99.series(),n=this.Z98.crossHairSource().appliedIndex(),o=r.nearestIndex(n,TradingView.SEARCH_NEAREST_LEFT);if(void 0!==o){var a=this.Z99.data().valueAt(o);if(!(a&&a[TradingView.OPEN_PLOT]&&a[TradingView.HIGH_PLOT]&&a[TradingView.LOW_PLOT]&&a[TradingView.CLOSE_PLOT]))return;var l=this.Z99.formatter();this._items[0].setValue(l.format(a[TradingView.OPEN_PLOT])),this._items[1].setValue(l.format(a[TradingView.HIGH_PLOT])),this._items[2].setValue(l.format(a[TradingView.LOW_PLOT])),this._items[3].setValue(l.format(a[TradingView.CLOSE_PLOT]));var d;if(i&&o>=1){var h=this.Z99.data().valueAt(o-1);d=h[TradingView.CLOSE_PLOT]<=a[TradingView.CLOSE_PLOT]?e:t}else d=a[TradingView.OPEN_PLOT]<=a[TradingView.CLOSE_PLOT]?e:t;for(var p=0;4>p;p++)this._items[p].setColor(d)}var c=TradingView.getDataVendorString(this.Z99.symbolInfo());c?this._additional="(Data Provided by "+c+")":this._additional=void 0}},o.prototype.items=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items},o.prototype.update=function(){this._invalidated=!0},o.prototype.additional=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._additional},inherit(a,l),a.prototype.createPlotLabels=function(e){},a.prototype.symbol=function(){var e,t=this.properties().inputs.symbol.value(),i=this._resolvedSymbols?this._resolvedSymbols[t]:null;return e=i?i.name:t,e.toUpperCase()},a.prototype.lastValueData=function(e,t){var i=l.prototype.lastValueData.call(this,"close",t);if(i.noData)return i;var r=this.properties(),n=i.item;switch(r.style.value()){case s.STYLE_BARS:i.color=n[TradingView.OPEN_PLOT]<=n[TradingView.CLOSE_PLOT]?r.barStyle.upColor.value():r.barStyle.downColor.value();break;case s.STYLE_CANDLES:i.color=n[TradingView.OPEN_PLOT]<=n[TradingView.CLOSE_PLOT]?r.candleStyle.upColor.value():r.candleStyle.downColor.value();break;case s.STYLE_HOLLOW_CANDLES:i.color=n[TradingView.OPEN_PLOT]<=n[TradingView.CLOSE_PLOT]?r.candleStyle.upColor.value():r.candleStyle.downColor.value();break;case s.STYLE_LINE:i.color=r.lineStyle.color.value();break;case s.STYLE_AREA:i.color=r.areaStyle.color1.value()}return i},a.prototype.createViews=function(){this._priceAxisViews=[],this._priceAxisViewsBase=[new n(this,this.Z98)],this._paneViews=[];var e=null;switch(this.Q0.style.value()){case s.STYLE_BARS:e=new g(this,this.Z98);break;case s.STYLE_CANDLES:e=new f(this,this.Z98);break;case s.STYLE_HOLLOW_CANDLES:e=new _(this,this.Z98);break;case s.STYLE_LINE:e=new u(this,this.Q0.lineStyle.priceSource.value(),this.Z98);break;case s.STYLE_AREA:e=new c(this,this.Q0.areaStyle.priceSource.value(),this.Z98)}e&&this._paneViews.push(e),this._paneViews.push(new r(this,this.Z98)),this._paneViews.push(this._symbolLabelView),this._dataWindowView||(this._dataWindowView=new o(this,this.Z98)),this._statusView||(this._statusView=new v(this)),this._priceAxisViews=[].concat(this._priceAxisViewsBase,this._hlinesPriceAsisViews,this._horizlinesPriceAsisViews)},a.prototype.barColorer=function(){return new T(this)},a.prototype.start=function(){this._formatter=null,l.prototype.start.call(this),this.priceScale()&&this.priceScale().updateFormatter()},a.prototype._createFormatter=function(){if("default"==this.properties().minTick.value()){var e=this.properties().inputs.symbol.value(),t=this._resolvedSymbols[e];this._formatter=new TradingView.PriceFormatter(t?t.pricescale:100,t?t.minmov:1,t?t.fractional:!1)}else{var i,r=this.properties().minTick.value();i=isNumber(r)?["100","1","false"]:r.split(",");var n=parseInt(i[0]),o=parseInt(i[1]),a="true"===i[2];this._formatter=new TradingView.PriceFormatter(n,o,a)}this.priceScale()&&this.priceScale().updateFormatter()},a.prototype.formatter=function(){return this._formatter||this._createFormatter(),this._formatter},a.prototype._changeInputs=function(){l.prototype._changeInputs.call(this,this.inputs()),this.m_formatter=null,this.priceScale().updateFormatter()},a.prototype.title=function(){var e,t=this.properties().inputs.symbol.value(),i=this._resolvedSymbols[t];return e=i?i.exchange?i.name+", "+i.exchange:i.name:t,e.toUpperCase()},a.prototype.bars=function(){return this.m_data},a.prototype.open=function(e){return this.bars().valueAt(e)[TradingView.OPEN_PLOT]},a.prototype.high=function(e){return this.bars().valueAt(e)[TradingView.HIGH_PLOT]},a.prototype.low=function(e){return this.bars().valueAt(e)[TradingView.LOW_PLOT]},a.prototype.close=function(e){return this.bars().valueAt(e)[TradingView.CLOSE_PLOT]},a.prototype.hl2=function(e){return(this.high(e)+this.low(e))/2},a.prototype.hlc3=function(e){return(this.high(e)+this.low(e)+this.close(e))/3},a.prototype.ohlc4=function(e){return(this.open(e)+this.high(e)+this.low(e)+this.close(e))/4},a.prototype.symbolInfo=function(){if(!this._resolvedSymbols)return null;var e=this.Q0.inputs.symbol.value();return e?this._resolvedSymbols[e]:null},a.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},a.prototype.tags=function(){var e=[],t=this.symbolInfo();return t?e.push(t.name):this.Q0.inputs.symbol.value()&&e.push(this.Q0.inputs.symbol.value()),e},t.OverlayDataWindowView=o,t.study_Overlay=a},function(e,t,i){"use strict";function r(e,t,i,r){this._prices=[],this._canvas=$("<canvas>"),this._cache=this._canvas.get(0).getContext("2d"),this.reset({font:e,fontSize:t,backColors:i,colors:r}),this._priceAxisFontSize=11}function n(e,t,i){this.Z97=e,this.Z98=e.Z98,this._name=t,this._completeName="P"===t.toUpperCase()?"P":"S"+t[1]+"/R"+t[1],this._rendererData={visible:!1,text:"",coordinate:0,color:"",background:""},this._renderer=new c(this._rendererData)}function o(e,t){this.Z98=e,this.Z97=t,this._pivots=[],this._textCache={}}function a(e,t){this.Z97=e,this.Z98=e.Z98,this._prices=[],this._invidated=!0,this._cache=t;var i=this;e.priceScale()&&(this._cachedFormatter=e.priceScale().formatter(),this._formatterCache=new h(function(e){return i._cachedFormatter.format(e)}))}function s(e,t,i,r){p.call(this,e,t,i,r,new o(e,this));for(var n=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],a=this.properties().levelsStyle.visibility,s=0;s<n.length;s++)a[n[s]].listeners().subscribe(this,TradingView.Study.prototype.processHibernate)}var l=i(62),d=i(79).StudyDataWindowView,h=i(64),p=i(84),c=i(15),u=i(76),_=i(13).LineDataSource,f=i(55).TrendLineRenderer,g=i(47),v=i(14);r.prototype.remove=function(){this._canvas.remove()},r.prototype.reset=function(e){this._prices=[],this._params=e,this._cache.setFont(e.fontSize+"px "+e.font);var t=this;this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].reduce(function(e,i){var r=t._cache.measureText(i).width;return Math.max(r,e)},0)},r.prototype.rowHeight=function(){return this._priceAxisFontSize+4},r.prototype._labelRectByIndex=function(e){var t=0,i=Math.round(this._topByIndex(e)),r=Math.round(this._labelWidth+4),n=this._params.fontSize+8;return{left:t,top:i,width:r,height:n}},r.prototype.params=function(){return this._params},r.prototype._centerByIndex=function(e){var t=8;return Math.round((e+.5)*(this._params.fontSize+t))},r.prototype._topByIndex=function(e){var t=8;return Math.round(e*(this._params.fontSize+t))},r.prototype.setPrices=function(e){var t=8,i=!1,r=function(e,t){return void 0===e&&void 0===t?!0:e.formatted==t.formatted};if(e.length!=this._prices.length)i=!0;else for(var n=0;n<this._prices.length;n++)if(!r(this._prices[n],e[n])){i=!0;break}if(i){var o=this;o._cache.save(),o._cache.font=this._priceAxisFontSize+"px Arial",o._cache.restore();var a=this._labelWidth+6,s=window.hidpiCanvasRatio||1;a*=s,this._canvas.prop("width",a);var l=Math.max(e.length,11)*(this._params.fontSize+t);l*=s,this._canvas.prop("height",l),this._canvas.css("width",a).css("height",l),this._prices=e,this._cache.clearRect(0,0,a,l),this._cache.save(),this._cache.translate(.5,.5),this._cache.font=this._params.fontSize+"px "+this._params.font,this._cache.textBaseline="middle";for(var n=0;n<this._prices.length;n++)if(this._prices[n]){var d=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"][n];this._cache.fillStyle=this._params.backColors[n],this._cache.fillText(d,0,this._centerByIndex(n))}this._prices=e,this._cache.restore()}},inherit(n,u),n.prototype._updateImpl=function(){if(this._rendererData.visible=!1,this._rendererData.text="",this.Z97.properties().visible.value()){var e=this.Z97.pricesView().prices(),t=this._completeName,i=this.Z97.properties().levelsStyle.visibility;if(i[t]&&i[t].value()&&!this.Z98.timeScale().isEmpty()&&!this.Z97.priceScale().isEmpty()){var r=this.Z98.timeScale().visibleBars();if(!r.isEmpty()&&this.Z97._nonseriesdata&&this.Z97._nonseriesdata.pivots){var n=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].indexOf(this._name.toUpperCase()),o=e[n];o&&(this._rendererData.visible=!0,this._rendererData.background!==o.color&&(this._rendererData.background=o.color,this._rendererData.color=new TradingView.RGBColor(o.color).blackWhiteContrast()),this._rendererData.text=o.formatted,this._rendererData.coordinate=o.coordinate,this._coordinate=o.coordinate,this._floatCoordinate=o.coordinate)}}}},n.prototype.renderer=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer},n.prototype.text=function(){return this._rendererData.visible?this._rendererData.text:""},n.prototype.coordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),v.prototype.coordinate.call(this)},n.prototype.floatCoordinate=function(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),v.prototype.floatCoordinate.call(this)},o.prototype.setCache=function(e){this._cache=e},o.prototype.priceAxisViews=function(e,t){return this._priceAxisViews},o.prototype.mergeLabel=function(e,t,i){var r=""+t;void 0===e[r]?(e[r]={},e[r].text=i,e[r].ids=[this.complete(i)]):(e[r].text+="/"+i,e[r].ids.push(this.complete(i)))},o.prototype.complete=function(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]},o.prototype.update=function(){this._invalidated=!0},o.prototype._updateImpl=function(){this.Z97.pricesView().prices();if(this._pivots=[],this.Z97._nonseriesdata&&this.Z97._nonseriesdata.pivots&&this.Z97.properties().visible.value()){var e=this.Z97._nonseriesdata.pivots,t=this.Z97._indexes,i=this.Z98.timeScale(),r=this.Z97.priceScale();this.Z98.mainSeries();if(r&&!r.isEmpty()&&!i.isEmpty()&&e){var n=i.visibleBars(),o=n.firstBar(),a=n.lastBar(),s=null;if(r.isPercent()){if(!this.Z97.ownerSource())return;s=this.Z97.ownerSource().firstValue()}for(var l=0;l<e.length;l++)if(e[l]){var d=t[e[l].startIndex],h=t[e[l].endIndex];if(!(o>h||d>a)){var p={},c=this.Z97.properties().levelsStyle.visibility;c.P.value()&&this.mergeLabel(p,e[l].p,"P"),c["S1/R1"].value()&&(this.mergeLabel(p,e[l].s1,"S1"),this.mergeLabel(p,e[l].r1,"R1")),c["S2/R2"].value()&&(this.mergeLabel(p,e[l].s2,"S2"),this.mergeLabel(p,e[l].r2,"R2")),c["S3/R3"].value()&&(this.mergeLabel(p,e[l].s3,"S3"),this.mergeLabel(p,e[l].r3,"R3")),c["S4/R4"].value()&&(this.mergeLabel(p,e[l].s4,"S4"),this.mergeLabel(p,e[l].r4,"R4")),c["S5/R5"].value()&&(this.mergeLabel(p,e[l].s5,"S5"),this.mergeLabel(p,e[l].r5,"R5"));var u=i.indexToCoordinate(d),_=i.indexToCoordinate(h);for(var f in p){var g=parseFloat(f);r.isPercent()&&(g=r.priceRange().convertToPercent(g,s));var v=r.priceToCoordinate(g);this._pivots.push({x1:u,x2:_,y:v,label:p[f].text,labelIds:p[f].ids})}}}}}},o.prototype.renderer=function(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=(this.Z97.properties().font.value(),this.Z97.properties().fontsize.value(),this.Z97.properties().levelsStyle.colors),i=this.Z97.properties().levelsStyle.widths,r=0;r<this._pivots.length;r++){var n=this._pivots[r],o=new MathEx.Point(n.x1,n.y),a=new MathEx.Point(n.x2,n.y),s={points:[o,a],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t[n.labelIds[0]].value(),linewidth:i[n.labelIds[0]].value(),linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:_.LINEEND_NORMAL,rightend:_.LINEEND_NORMAL};if(e.append(new f(s,new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR))),this.Z97.properties().levelsStyle.showLabels.value()){var l=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].indexOf(n.label),d=this._cache._labelRectByIndex(l),h={left:o.x-d.width,top:Math.round(o.y-d.height/2),width:d.width,height:d.height},p=this._cache._canvas.get(0),c=new TradingView.PaneRendererCachedImage(p,d,h);e.append(c)}}return e},a.prototype._updateImpl=function(){if(!this.Z98.timeScale().isEmpty()&&!this.Z97.priceScale().isEmpty()){var e=this.Z98.timeScale().visibleBars();if(!e.isEmpty()&&this.Z97._nonseriesdata&&this.Z97._nonseriesdata.pivots){if(this._cachedFormatter!=this.Z97.priceScale().formatter()){this._cachedFormatter=this.Z97.priceScale().formatter();var t=this;this._formatterCache=new h(function(e){return t._cachedFormatter.format(e)})}var t=this,i=this.Z98.mainSeries(),r=(this.Z98.timeScale(),this.Z97.priceScale()),n=i.bars().search(e.lastBar(),TradingView.SEARCH_NEAREST_LEFT);if(n){for(var o=n.index,a=this.Z97._nonseriesdata.pivots,s=this.Z97._indexes,l=this.Z97.properties(),d=0;d<a.length;d++)if(a[d]){var p=s[a[d].startIndex],c=s[a[d].endIndex],u=l.inputs.showHistoricalPivots.value();if(c>o&&o>=p||!u){var _;if(r.properties().percentage.value())var _=t.Z97.firstValue();var f=["p","s1","r1","s2","r2","s3","r3","s4","r4","s5","r5"];this._prices=[];for(var g=0;g<f.length;g++){var v=f[g],m=a[d][v];if(void 0!==m){r.properties().percentage.value()&&(m=100*(m-_)/_);var y=r.priceToCoordinate(m),w={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"},T=l.levelsStyle.colors[w[v.toUpperCase()]].value();this._prices.push({formatted:t._formatterCache.format(m),price:m,coordinate:y,color:T})}}}}this._cache.setPrices(this._prices)}}}},a.prototype.update=function(){this._invidated=!0},a.prototype.prices=function(){return this._invidated&&(this._updateImpl(),this._invidated=!1),this._prices},inherit(s,p),s.prototype.lastValueData=function(e,t,i){var r=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].indexOf(e.toUpperCase()),n={noData:!0},o=this._pricesView.prices()[r];return null!==o&&void 0!==o?o:n},s.prototype.lastPriceLabelFixedCoordinate=function(e){var t=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].indexOf(e.toUpperCase()),i=this._priceAxisViews[t];return i._fixedCoordinate},s.prototype.priceLabelText=function(e){return this._metaInfo.shortDescription+":"+e.toUpperCase()},s.prototype.pricesView=function(){return this._pricesView},s.prototype._getActualCacheParams=function(){var e={};return e.font=this.properties().font.value(),e.fontSize=this.properties().fontsize.value(),e.backColors=[this.properties().levelsStyle.colors.P.value(),this.properties().levelsStyle.colors["S1/R1"].value(),this.properties().levelsStyle.colors["S1/R1"].value(),this.properties().levelsStyle.colors["S2/R2"].value(),this.properties().levelsStyle.colors["S2/R2"].value(),this.properties().levelsStyle.colors["S3/R3"].value(),this.properties().levelsStyle.colors["S3/R3"].value(),this.properties().levelsStyle.colors["S4/R4"].value(),this.properties().levelsStyle.colors["S4/R4"].value(),this.properties().levelsStyle.colors["S5/R5"].value(),this.properties().levelsStyle.colors["S5/R5"].value()],e.colors=e.backColors.map(function(e){return new TradingView.RGBColor(e).blackWhiteContrast()}),e},s.prototype.updateAllViews=function(){p.prototype.updateAllViews.call(this),this._pricesView.update();for(var e=0;e<this._priceAxisViews.length;e++)this._priceAxisViews[e].update();for(var e=0;e<this._paneViews.length;e++)this._paneViews[e].update()},s.prototype.paneViews=function(e){var t=p.prototype.paneViews.call(this,e);return t?t.concat(this._paneViews):this._paneViews},s.prototype.createViews=function(){var e=this._getActualCacheParams();this._cache&&this._cache.remove(),this._cache=new r(e.font,e.fontSize,e.backColors,e.colors),this._priceAxisViews=[];var t=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"];this._paneViews.length=0;for(var i=this.properties().levelsStyle.visibility,o=0;o<t.length;o++){this._priceAxisViews.push(new n(this,t[o],this._cache));var s="P"===t[o].toUpperCase()?"P":"S"+t[o][1]+"/R"+t[o][1];i[s]&&i[s].value()&&this._paneViews.push(new g(this.Z98,this,t[o],"priceLabelText","showStudyPlotLabels"))}this._dataWindowView||(this._dataWindowView=new d(this,this.Z98)),this._statusView||(this._statusView=new l(this,this.Z98.properties())),this._paneView.setCache(this._cache),this._pricesView=new a(this,this._cache)},s.prototype._postProcessGraphics=function(){},s.prototype.isVisible=function(){if(!this.properties().visible.value())return!1;for(var e=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],t=this.properties().levelsStyle.visibility,i=0;i<e.length;i++)if(t[e[i]].value())return!0;return!1},s.prototype.stop=function(){TradingView.Study.prototype.stop.call(this),this._cache&&this._cache.remove()},s.prototype.priceRange=function(e,t){if(!this._nonseriesdata||!this._nonseriesdata.pivots||!this._indexes)return null;if(!this.priceScale())return null;for(var i=this._nonseriesdata.pivots,r=this._indexes,n=null,o=0;o<i.length;o++)if(i[o]){var a=r[i[o].startIndex],s=r[i[o].endIndex];if(!(e>s||a>t)){var l=[],d=this.Q0.levelsStyle.visibility;d.P.value()&&l.push(i[o].p),d["S1/R1"].value()&&l.push(i[o].s1,i[o].r1),d["S2/R2"].value()&&l.push(i[o].s2,i[o].r2),d["S3/R3"].value()&&l.push(i[o].s3,i[o].r3),d["S4/R4"].value()&&l.push(i[o].s4,i[o].r4),d["S5/R5"].value()&&l.push(i[o].s5,i[o].r5);for(var h=0;h<l.length;h++)l[h]&&(null===n?n=new PriceRange(l[h],l[h]):n.apply(l[h],l[h]))}}if(this.priceScale().isLog()&&n)return new PriceRange(this.priceScale().priceToLogical(n.minValue()),this.priceScale().priceToLogical(n.maxValue()));if(this.priceScale().properties().percentage.value()&&n){var p=this.ownerSource().firstValue();return p?n.convertToPercents(p):null}return n},e.exports=s},function(e,t,i){"use strict";function r(e,t,i,r){this._symbolLabelView=new o(e,this,"compare","symbol","showSymbolLabels"),TradingView.Study.call(this,e,t,i,r);var n=this;this.Q0.minTick.listeners().subscribe(null,function(){n._createFormatter()}),this.properties().minTick.listeners().subscribe(null,function(){n.Z98.Q18(new $21($21.FULL_UPDATE))}),this.Q0.merge({skipHistogramBaseOnAutoScale:!0})}var n=i(79).DataVendorStudyDataWindowView,o=i(47);inherit(r,TradingView.Study),r.prototype.createPlotLabels=function(e){},r.prototype.createViews=function(){this._dataWindowView||(this._dataWindowView=new n(this,this.Z98)),TradingView.Study.prototype.createViews.call(this),this._paneViews.push(this._symbolLabelView)},r.prototype._createFormatter=function(){var e=this.properties().inputs.symbol.value(),t=this._resolvedSymbols?this._resolvedSymbols[e]:null;if("default"==this.properties().minTick.value())this._formatter=new TradingView.PriceFormatter(t?t.pricescale:100,t?t.minmov:1,t?t.fractional:!1);else{var i,r=this.properties().minTick.value();i=isNumber(r)?["100","1","false"]:r.split(",");var n=parseInt(i[0]),o=parseInt(i[1]),a="true"===i[2];this._formatter=new TradingView.PriceFormatter(n,o,a)}this.priceScale()&&this.priceScale().updateFormatter()},r.prototype.symbol=function(){var e,t=this.properties().inputs.symbol.value(),i=this._resolvedSymbols?this._resolvedSymbols[t]:null;return e=i?i.name:t,e.toUpperCase()},r.prototype.title=function(e){var t,i=this.properties().inputs.symbol.value(),r=this._resolvedSymbols?this._resolvedSymbols[i]:null;return t=r?r.exchange?r.name+", "+r.exchange:r.name:i,t.toUpperCase()},r.prototype.symbolInfo=function(){if(!this._resolvedSymbols)return null;var e=this.Q0.inputs.symbol.value();return e?this._resolvedSymbols[e]:null},r.prototype.lastPriceLabelFixedCoordinate=function(){return this._priceAxisViews[0]._fixedCoordinate},r.prototype.tags=function(){var e=this.symbol();return e?[e]:[]},e.exports=r},function(e,t,i){"use strict";function r(e,t){this.Z98=e,this.Z97=t,this._waves=[],this._highlights=[],this._retracements=[],this._textCache={},this._invalidated=!0}function n(e,t,i,n){s.call(this,e,t,i,n,new r(e,this))}var o=i(13).LineDataSource,a=i(45).TextRenderer,s=i(84),l=i(55).TrendLineRenderer;r._wave5Labels=[["i","ii","iii","iv","v"],["(i)","(ii)","(iii)","(iv)","(v)"],["((i))","((ii))","((iii))","((iv))","((v))"],["1","2","3","4","5"],["(1)","(2)","(3)","(4)","(5)"],["((1))","((2))","((3))","((4))","((5))"],["I","II","III","IV","V"],["(I)","(II)","(III)","(IV)","(V)"],["((I))","((II))","((III))","((IV))","((V))"]],r._wave3Labels=[["a","b","c"],["A","B","C"]],r._fontSizes=[10,10,10,11,11,11,12,12,12],r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(this._waves=[],this._highlights=[],this._retracements=[],this.Z97._nonseriesdata&&this.Z97.properties().visible.value()){var e=this.Z97._nonseriesdata.waves,t=this.Z97._indexes,i=this.Z98.timeScale(),n=this.Z97.priceScale(),o=this.Z98.mainSeries(),a=o.firstBar();if(n&&!n.isEmpty()&&!i.isEmpty()&&a&&e){for(var s,l=i.visibleBars(),d=l.lastBar(),h=l.firstBar(),p=["m0StartIndex","startIndex","endIndex","m2EndIndex","m3EndIndex"],c=0;c<e.length;c++)if(e[c]){for(var u=[],_=0;5>_;_++){var f=t[e[c][p[_]]];if(!isFinite(f))break;u.push(f)}if(0!==u.length&&!(u[0]>d||u[u.length-1]<h)){var g=+e[c].size;if(isFinite(g)){var v="level"+g,m=this.Z97.properties()[v];if(m.visible.value()){var y=parseInt(e[c].direction,10),w=[];w.dir=y,w.prices=[],w.orig_prices=[],s=o.firstValue();for(var T=0;T<u.length;T++){if(void 0!==u[T]){var b={},S=u[T],a=o.bars().first();if(a>S)continue;b.x=i.indexToCoordinate(S);var C=o.bars().valueAt(S);if(!C){w.push(void 0),w.prices.push(void 0),w.orig_prices.push(void 0),y=-y;continue}var x=1==y?C[TradingView.HIGH_PLOT]:C[TradingView.LOW_PLOT];if(w.orig_prices.push(x),n.isPercent()){var P=n.priceRange().convertToPercent(x,s);b.y=n.priceToCoordinate(P),w.prices.push(P)}else w.prices.push(x),b.y=n.priceToCoordinate(x);if(b.label=r._wave5Labels[g][T],b.align=-1==y?"top":"bottom",b.color=m.color.value(),delete b.backgroundColor,w.id="wave_"+c,this.Z97===this.Z98.hoveredSource()){var L=this.Z98.lastHittestData();L&&L.wave&&L.wave.id===w.id&&(b.color="#FFFFFF",b.backgroundColor=m.color.value())}b.fontsize=r._fontSizes[g],b._textCache={widths:[]},b.wave=w,w.push(b)}else w.push(void 0),w.prices.push(void 0);y=-y}w.inds=u,w.dir=y,w.color=m.color.value(),this._waves.push(w)}}}}if(this.Z97===this.Z98.hoveredSource()){var L=this.Z98.lastHittestData();if(L){for(var u=L.wave.inds,y=-L.wave.dir,E=L.backgroundColor?L.backgroundColor:L.color,V=L.wave.orig_prices,I=null,T=0;T<u.length;T++){if(void 0!==u[T]){var S=u[T],A=i.indexToCoordinate(S),C=o.bars().valueAt(S);if(!C){y=-y;continue}var x=V[T];n.isPercent()&&(x=n.priceRange().convertToPercent(x,s));var k=n.priceToCoordinate(x),R=new MathEx.Point(A,k);I&&this._highlights.push({points:[I,R],color:E}),I=R}y=-y}if(void 0!==V[1]&&void 0!==V[2]){var M=V[1],O=V[2],D=V[3],B=V[0];n.isPercent()&&(M=n.priceRange().convertToPercent(M,s),O=n.priceRange().convertToPercent(O,s),void 0!==B&&(B=n.priceRange().convertToPercent(B,s)),void 0!==D&&(D=n.priceRange().convertToPercent(D,s))),this._retracements.push({y:n.priceToCoordinate(M),x:0,extendLeft:!0,extendRight:!0,color:E,text:"",style:CanvasEx.LINESTYLE_SOLID}),this._retracements.push({y:n.priceToCoordinate(M),x:0,extendLeft:!0,extendRight:!0,color:E,text:"",style:CanvasEx.LINESTYLE_SOLID});var y=O-M;if(void 0!==V[0]){var N=B-M,F=N/y,x=M+F*y,A=i.indexToCoordinate(u[0]);this._retracements.push({y:n.priceToCoordinate(x),x:A,extendLeft:!1,extendRight:!0,color:E,text:""+F.toFixed(3),style:CanvasEx.LINESTYLE_DASHED})}if(void 0!==D){var W=O-D,F=W/y,x=O-F*y,A=i.indexToCoordinate(u[3]);this._retracements.push({y:n.priceToCoordinate(x),x:A,extendLeft:!0,extendRight:!1,color:E,text:""+F.toFixed(3),style:CanvasEx.LINESTYLE_DASHED})}}}}}}},r.prototype.CIRCLE_SIZE=16,r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=this.CIRCLE_SIZE,i={},r=0;r<this._waves.length;r++)for(var n=this._waves[r],s=0;s<n.length;s++){var d=n[s];if(void 0!==d){var h,p;d.x-t/2,d.x+t/2;"top"==d.align?(h=d.y+4,i["top_"+d.x]?(h+=i["top_"+d.x]*t,i["top_"+d.x]=i["top_"+d.x]+1):i["top_"+d.x]=1,p=h+t):(h=d.y-t-4,i["bottom_"+d.x]?(h-=i["bottom_"+d.x]*t,i["bottom_"+d.x]=i["bottom_"+d.x]+1):i["bottom_"+d.x]=1,p=h+t);var c={};c.points=[new MathEx.Point(d.x,(h+p)/2)],c.text=d.label,c.color=d.color,c.backgroundColor=d.backgroundColor,c.font="Verdana",c.bold=!0,c.offsetX=0,c.offsetY=0,c.vertAlign="middle",c.horzAlign="center",c.fontsize=d.fontsize;var u=new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR,d),_=r+"_"+s;this._textCache[_]=this._textCache[_]||{},e.append(new a(c,this._textCache[_],u))}}for(var r=0;r<this._highlights.length;r++){var f=this._highlights[r],g={points:f.points,width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:TradingView.generateColor(f.color,50),linewidth:3,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:o.LINEEND_CIRCLE,rightend:o.LINEEND_CIRCLE};e.append(new l(g))}for(var r=0;r<this._retracements.length;r++){var v=this._retracements[r],g={points:[new MathEx.Point(v.x+1,v.y),new MathEx.Point(v.x,v.y)],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:TradingView.generateColor(v.color,50),linewidth:1,linestyle:v.style,extendleft:v.extendLeft,extendright:v.extendRight,leftend:o.LINEEND_NORMAL,rightend:o.LINEEND_NORMAL};e.append(new l(g)),this._retracements[r]._textCache={};var m={points:[new MathEx.Point(v.x,v.y)],text:this._retracements[r].text,backgroundColor:"#606060",color:"#FFFFFF",vertAlign:"middle",horzAlign:"center",font:"Arial",offsetX:v.extendRight?-50:50,offsetY:-2,fontsize:12};e.append(new a(m,this._retracements[r]._textCache))}return e},inherit(n,s),n.prototype.margins=function(){return[.1,.1]},n.prototype.isVisible=function(){if(!this.properties().visible.value())return!1;for(var e=0;8>=e;e++)if(this.properties()["level"+e].visible.value())return!0;return!1},e.exports=n},function(e,t,i){"use strict";function r(e,t){this._data=e,this._textCache=t}function n(e,t){this.Z98=e,this.Z97=t,this._pivots=[],this._textCache={},this._invalidated=!0}function o(e,t,i,r){a.call(this,e,t,i,r,new n(e,this))}var a=i(84);r.prototype.draw=function(e){e.textBaseline="bottom",e.font=(this._data.bold?"bold ":"normal ")+this._data.fontsize+"px "+this._data.font;var t=Math.round(e.measureText(this._data.text).width+4);this._textCache.width=t,e.translate(this._data.x+.5,this._data.y),e.strokeStyle=this._data.borderColor,e.fillStyle=this._data.backColor,e.beginPath(),e.moveTo(0,0),1===this._data.type?(e.lineTo(5,-5),e.lineTo(t/2,-5),e.lineTo(t/2,-5-this._data.fontsize),e.lineTo(-t/2,-5-this._data.fontsize),e.lineTo(-t/2,-5),e.lineTo(-5,-5),e.lineTo(0,0)):(e.lineTo(5,5),e.lineTo(t/2,5),e.lineTo(t/2,5+this._data.fontsize),e.lineTo(-t/2,5+this._data.fontsize),e.lineTo(-t/2,5),e.lineTo(-5,5),e.lineTo(0,0)),e.fill(),e.stroke(),e.fillStyle=this._data.textColor,e.textAlign="center",1===this._data.type?e.fillText(this._data.text,0,-4):e.fillText(this._data.text,0,6+this._data.fontsize)},r.prototype.hitTest=function(e){var t=this._textCache.width,i=this._data.fontsize+12,r=this._data.x-t/2,n=this._data.y;return 1===this._data.type&&(n-=i),e.x>=r&&e.x<=r+t&&e.y>=n&&e.y<=n+i?new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR):null},n.prototype.update=function(){this._invalidated=!0},n.prototype.updateImpl=function(){if(this._pivots=[],this.Z97._nonseriesdata&&this.Z97._nonseriesdata.pivots&&this.Z97.properties().visible.value()){var e=this.Z97._nonseriesdata.pivots,t=this.Z97._indexes,i=this.Z98.timeScale(),r=this.Z97.priceScale(),n=this.Z98.mainSeries(),o=n.firstValue();if(r&&!r.isEmpty()&&!i.isEmpty()&&o)for(var a=i.visibleBars(),s=a.firstBar(),l=a.lastBar(),d=0;d<e.length;d++)if(e[d]){
var h=t[e[d].index];if(!(s>h||h>l)){var p=e[d].type,c=n.bars().valueAt(h);if(c){var u=1==p?c[TradingView.HIGH_PLOT]:c[TradingView.LOW_PLOT];r.isPercent()&&(u=r.priceRange().convertToPercent(u,o));var _=Math.round(i.indexToCoordinate(h)),f=r.priceToCoordinate(u);1===p?f-=i.barSpacing()/6:f+=i.barSpacing()/6+1,f=Math.round(f),this._pivots.push({x:_,y:f,price:r.formatter().format(u),type:p})}}}}},n.prototype.renderer=function(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),0!==this._pivots.length){for(var e=this.Z97.properties().font.value(),t=this.Z97.properties().fontsize.value(),i=this.Z97.properties().borderColor.value(),n=this.Z97.properties().backColor.value(),o=this.Z97.properties().textColor.value(),a=new TradingView.CompositeRenderer,s=0;s<this._pivots.length;s++){var l=this._pivots[s],d={x:l.x,y:l.y,type:l.type,text:l.price,font:e,fontsize:t,borderColor:i,backColor:n,textColor:o},h=s;this._textCache[h]||(this._textCache[h]={}),a.append(new r(d,this._textCache[h]))}return a}},inherit(o,a),o.prototype.isVisible=function(){return this.properties().visible.value()},o.prototype.margins=function(){return[.1,.1]},e.exports=o},function(e,t,i){"use strict";function r(e,t){this.Z98=e,this.Z97=t,this._pivots=[],this._textCache={},this._invalidated=!0}function n(e,t,i,n){o.call(this,e,t,i,n,new r(e,this))}var o=i(84),a=i(13).LineDataSource,s=i(55).TrendLineRenderer;r.prototype.update=function(){this._invalidated=!0},r.prototype.updateImpl=function(){if(this._pivots=[],this.Z97._nonseriesdata&&this.Z97._nonseriesdata.zigzag&&this.Z97.properties().visible.value()){var e=this.Z97._nonseriesdata.zigzag,t=this.Z97._indexes,i=this.Z98.timeScale(),r=this.Z97.priceScale(),n=this.Z98.mainSeries(),o=n.firstValue();if(r&&!r.isEmpty()&&!i.isEmpty()&&o)for(var a=(i.visibleBars(),0);a<e.length;a++)if(e[a]){var s=t[e[a].index],l=e[a].type,d=n.bars().valueAt(s);if(d){var h=1==l?d[TradingView.HIGH_PLOT]:d[TradingView.LOW_PLOT];r.isPercent()&&(h=r.priceRange().convertToPercent(h,o));var p=Math.round(i.indexToCoordinate(s)),c=r.priceToCoordinate(h);this._pivots.push({x:p,y:c})}}}},r.prototype.renderer=function(){this._invalidated&&(this.updateImpl(),this._invalidated=!1);for(var e=new TradingView.CompositeRenderer,t=this.Z97.properties().color.value(),i=this.Z97.properties().linewidth.value(),r=1;r<this._pivots.length;r++){var n=this._pivots[r],o=this._pivots[r-1],l=new MathEx.Point(o.x,o.y),d=new MathEx.Point(n.x,n.y),h={points:[l,d],width:this.Z98.timeScale().width(),height:this.Z97.priceScale().height(),color:t,linewidth:i,linestyle:CanvasEx.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:a.LINEEND_NORMAL,rightend:a.LINEEND_NORMAL};e.append(new s(h,new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)))}return e},inherit(n,o),n.prototype.isVisible=function(){return this.properties().visible.value()},e.exports=n},function(e,t,i){"use strict";function r(e,t,i,r){n.call(this,e,t,i,r)}var n=i(74).Study;inherit(r,n),r.prototype.priceRange=function(e,t){var i=this.graphics().hhists;if(!i)return null;var r=i[0].data[0],n=null;return n=this.Q0.graphics.hhists.histBars.showValues.value()?new PriceRange(r.priceLow-.8*(r.priceHigh-r.priceLow),r.priceHigh):new PriceRange(r.priceLow,r.priceHigh),this.priceScale().isLog()&&n?new PriceRange(this.priceScale().priceToLogical(n.minValue()),this.priceScale().priceToLogical(n.maxValue())):n},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){n.call(this,e,t,i,r)}var n=i(74).Study;inherit(r,n),r.prototype.priceRange=function(e,t){var i=this.graphics().hhists,r=this.graphics().indexes;if(!i||!i.length)return null;i=i[0].data;for(var n=!1,o=null,a=null,s=null,l=0;l<i.length;l++){var d=i[l],h=r[d.firstBarTime],p=r[d.lastBarTime],c=h>=e&&t>=h,u=p>=e&&t>=p,_=e>=h&&p>=t;if(c||u||_)if(n)i[l].priceLow<o&&(o=i[l].priceLow,a=i[l].priceHigh),s=Math.max(s,i[l].priceHigh);else{var o=i[l].priceLow,a=i[l].priceHigh,s=i[l].priceHigh;n=!0}}if(!n)return null;var f=null;return f=this.Q0.graphics.hhists.histBars.showValues.value()?new PriceRange(o-.8*(a-o),s):new PriceRange(o,s),this.priceScale().isLog()&&f?new PriceRange(this.priceScale().priceToLogical(f.minValue()),this.priceScale().priceToLogical(f.maxValue())):f},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){n.call(this,e,t,i,r)}var n=i(74).Study;inherit(r,n),r.prototype._buildInputs=function(e){assert(this._metaInfo.shortId.startsWith("Script$EDGR_"));var t=n.prototype._buildInputs.call(this,e);if(!e.skipHiddenInputs){var i=this.Q0.inputs.ttm.value();i||(t[0]=t[0].replace(/(EDGR:'\+ticker\+')/g,"$1_QUARTER"))}return t},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){n.call(this,e,t,i,r)}var n=i(74).Study;inherit(r,n),r.prototype.clearData=function(){n.prototype.clearData.call(this),this._underlyingData=new TradingView.PlotList(this._plotFields)},r.prototype._mergeData=function(e){var t=0===this._underlyingData._length()?null:this._underlyingData._indexAt(0);this._underlyingData.merge(e),t!==this._underlyingData._indexAt(0)&&(this.m_data=new TradingView.PlotList(this._underlyingData.columns())),this.m_data._start=this._underlyingData._start,this.m_data._end=this._underlyingData._end;for(var i=this.m_data._length(),r=i;r<this._underlyingData._length();++r){var n=TradingView.merge({},this._underlyingData._valueAt(r));this.m_data.add(this._underlyingData._indexAt(r),n)}return this._plotsForStrategyProcessing().forEach(function(e){var t=this._createStrategy(e.strategy,e.strategyIndex,e.targetIndex,i);t.rebuildData(this.m_data)},this),this.m_data},r.prototype._plotsForStrategyProcessing=function(){var e=["dataoffset"],t=[];return this._metaInfo.plots.forEach(function(i,r){var n=e.indexOf(i.type)>-1;if(n){var o=null;this._metaInfo.plots.forEach(function(e,t){e.id==i.target&&(o=t)}),assert(o>=0,"target plot not found for strategy plot "+i.id);var a={strategy:i.type,strategyIndex:r,targetIndex:o};t.push(a)}},this),t},r.prototype._createStrategy=function(e,t,i,n){var o="Strategy_"+e;return new r[o](t,i,n)},r.Strategy_dataoffset=function(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i},r.Strategy_dataoffset.prototype.rebuildData=function(e){for(var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,r=null,n=null,o=this._startIndex;o<e._length();++o){var a=e._valueAt(o),s=a[t],l=a[i]?Math.round(a[i]):null;if(a[t]=null,a[i]=null,l&&!(l>0)){var d=o+l,h={pointIndex:d,value:s};if(n){if(n.pointIndex!=h.pointIndex){d>=0&&(e._items[d].value[t]=s);var p=!1;r&&(p=r.value<=n.value&&n.value<=s||r.value>=n.value&&n.value>=s),p?n.pointIndex>=0&&(e._items[n.pointIndex].value[t]=null):r=n,n=h}}else n=h}}},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i)}var n=i(106);inherit(r,n),r.prototype._mtpStudyId=function(){return"mtp_tsanalysis"},r.prototype.pointsCount=function(){return 1},r.prototype._studyInputs=function(){var e=this.points()[0].index,t=this.Z98.mainSeries().bars().valueAt(e);return t?[this.properties().inputs.displayZoneLabels.value(),1e3*t[TradingView.TIME_PLOT],this.properties().inputs.account_size.value(),this.properties().inputs.percent_risk.value(),this.properties().inputs.tickEntryOffset.value(),this.properties().inputs.tickStopOffset.value(),this.properties().inputs.minRRRatio.value(),this.properties().inputs.shouldFilterWPTZones.value(),this.properties().inputs.shouldFilterSTFTrends.value()]:null},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this._symbolIntervalChanged=!1,this.Z98.mainSeries().onSymbolIntervalChanged().subscribe(this,this.onSymbolIntervalChanged)}var n=i(106);inherit(r,n),r.prototype._mtpStudyId=function(){return"mtp_decisionpoint"},r.prototype.onSymbolIntervalChanged=function(){this._symbolIntervalChanged=!0},r.prototype.pointsCount=function(){return 1},r.prototype._studyInputs=function(){var e=this.points()[0].index,t=this.Z98.mainSeries().bars().valueAt(e);return t?[this.properties().inputs.displayZoneLabels.value(),this._symbolIntervalChanged,1e3*t[TradingView.TIME_PLOT]]:null},r.prototype.onData=function(e){n.prototype.onData.call(this,e),this._symbolIntervalChanged=!1},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i)}var n=i(106);inherit(r,n),r.prototype._mtpStudyId=function(){return"mtp_riskreward"},r.prototype.pointsCount=function(){return 3},r.getTooltipText=function(e){return e&&0!==e._points.length?1==e._points.length?"Select Stop Bar":2==e._points.length?"Select Target Point":null:"Select Entry Setup Bar"},r.prototype._studyInputs=function(){var e=this.points()[0].index,t=this.points()[1].index,i=this.points()[2].index,r=this.Z98.mainSeries().bars().valueAt(e),n=this.Z98.mainSeries().bars().valueAt(t),o=this.Z98.mainSeries().bars().valueAt(i);return r&&n&&o?[1e3*r[TradingView.TIME_PLOT],1e3*n[TradingView.TIME_PLOT],1e3*o[TradingView.TIME_PLOT],this.points()[2].price,this.properties().inputs.account_size.value(),this.properties().inputs.percent_risk.value(),this.properties().inputs.tickEntryOffset.value(),this.properties().inputs.tickStopOffset.value()]:null},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){s.call(this,e,t,i)}function n(e,t,i){r.call(this,e,t,i)}function o(e,t,i){r.call(this,e,t,i)}function a(e,t,i){r.call(this,e,t,i)}var s=i(106);inherit(r,s),r.prototype.pointsCount=function(){return 1},r.prototype._studyInputs=function(){var e=this.points()[0].index,t=this.Z98.mainSeries().bars().valueAt(e);return t?[this.properties().inputs.displayZoneLabels.value(),1e3*t[TradingView.TIME_PLOT]]:null},inherit(n,r),n.prototype._mtpStudyId=function(){return"mtp_ew_main"},inherit(o,r),o.prototype._mtpStudyId=function(){return"mtp_ew_major"},inherit(a,r),a.prototype._mtpStudyId=function(){return"mtp_ew_minor"},t.LineStudyMtpElliotWaveMinor=a,t.LineStudyMtpElliotWaveMajor=o,t.LineStudyMtpElliotWaveMain=n,t.LineStudyMtpElliotWave=r},function(e,t,i){"use strict";function r(e,t,i,r,n){this._wptStudyId=r,this._pointsCount=n,g.call(this,e,t,i)}function n(e,t,i){r.call(this,e,t,i,"mtp_wpt_down1ora",2)}function o(e,t,i){r.call(this,e,t,i,"mtp_wpt_down2orb",2)}function a(e,t,i){r.call(this,e,t,i,"mtp_wpt_down3",3)}function s(e,t,i){r.call(this,e,t,i,"mtp_wpt_down4",2)}function l(e,t,i){r.call(this,e,t,i,"mtp_wpt_down5",5)}function d(e,t,i){r.call(this,e,t,i,"mtp_wpt_downc",3)}function h(e,t,i){r.call(this,e,t,i,"mtp_wpt_up1ora",2)}function p(e,t,i){r.call(this,e,t,i,"mtp_wpt_up2orb",2)}function c(e,t,i){r.call(this,e,t,i,"mtp_wpt_up3",3)}function u(e,t,i){r.call(this,e,t,i,"mtp_wpt_up4",2)}function _(e,t,i){r.call(this,e,t,i,"mtp_wpt_up5",5)}function f(e,t,i){r.call(this,e,t,i,"mtp_wpt_upc",3)}var g=i(106);inherit(r,g),r.prototype._studyInputs=function(){for(var e=[this.properties().inputs.displayZoneLabels.value()],t=0;t<this.pointsCount();++t){var i=this.points()[t].index,r=this.Z98.mainSeries().bars().valueAt(i);if(!r)return null;e.push(1e3*r[TradingView.TIME_PLOT])}return e},r.prototype._mtpStudyId=function(){return this._wptStudyId},r.prototype.pointsCount=function(){return this._pointsCount},inherit(n,r),n.getTooltipText=function(e){var t=e?e._points.length:0;return"Down Wave 1 or A: Select Point "+(t+1)},inherit(o,r),o.getTooltipText=function(e){var t=e?e._points.length:0;return"Down Wave 2 or B: Select Point "+(t+1)},inherit(a,r),a.getTooltipText=function(e){var t=e?e._points.length:0;return"Down Wave 3: Select Point "+(t+1)},inherit(s,r),s.getTooltipText=function(e){var t=e?e._points.length:0;return"Down Wave 4: Select Point "+(t+1)},inherit(l,r),l.getTooltipText=function(e){var t=e?e._points.length:0;return"Down Wave 5: Select Point "+(t+1)},inherit(d,r),d.getTooltipText=function(e){var t=e?e._points.length:0;return"Down Wave C: Select Point "+(t+1)},inherit(h,r),h.getTooltipText=function(e){var t=e?e._points.length:0;return"Up Wave 1 or A: Select Point "+(t+1)},inherit(p,r),p.getTooltipText=function(e){var t=e?e._points.length:0;return"Up Wave 2 or B: Select Point "+(t+1)},inherit(c,r),c.getTooltipText=function(e){var t=e?e._points.length:0;return"Up Wave 3: Select Point "+(t+1)},inherit(u,r),u.getTooltipText=function(e){var t=e?e._points.length:0;return"Up Wave 4: Select Point "+(t+1)},inherit(_,r),_.getTooltipText=function(e){var t=e?e._points.length:0;return"Up Wave 5: Select Point "+(t+1)},inherit(f,r),f.getTooltipText=function(e){var t=e?e._points.length:0;return"Up Wave C: Select Point "+(t+1)},t.LineStudyMtpDownWave1OrA=n,t.LineStudyMtpDownWave2OrB=o,t.LineStudyMtpDownWave3=a,t.LineStudyMtpDownWave4=s,t.LineStudyMtpDownWave5=l,t.LineStudyMtpDownWaveC=d,t.LineStudyMtpUpWave1OrA=h,t.LineStudyMtpUpWave2OrB=p,t.LineStudyMtpUpWave3=c,t.LineStudyMtpUpWave4=u,t.LineStudyMtpUpWave5=_,t.LineStudyMtpUpWaveC=f},function(e,t,i){"use strict";function r(e,t,i){this.Z98=t,this._paneWidget=e,this._chart=e._chart,this._mainDiv=i,this.$el=$(document.createElement("div")).addClass("pane-legend"),this._itemsBinding=[],this._chart.properties().paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,this.updateLayout),this._chart.properties().paneProperties.legendProperties.showSeriesTitle.listeners().subscribe(this,this.updateLayout),this._chart.properties().paneProperties.legendProperties.showSeriesOHLC.listeners().subscribe(this,this.updateLayout),this._chart.properties().paneProperties.legendProperties.showStudyValues.listeners().subscribe(this,this.updateLayout);var r=this._chart.properties().scalesProperties.textColor;r.listeners().subscribe(this,function(e){this.$el.css("color",e)}),this.$el.css("color",r.value()),this.updateLayout()}var n=i(74).Study;r.prototype.contextMenuEvent=function(e,t){if(!this.Z98.chartModel().readOnly()&&Z75.enabled("legend_context_menu")){var i=t.source;this._paneWidget.showContextMenuForSource(i,e)}},r.prototype.updateLayout=function(){this._itemsBinding.length=0,this.$el.find(".apply-common-tooltip").trigger("mouseleave"),this.$el.empty();var e=this._paneWidget.state();if(e&&this.Z98){var t={showStudyTitles:this.Z98.model().properties().paneProperties.legendProperties.showStudyTitles.value(),showSeriesTitle:this._chart.properties().paneProperties.legendProperties.showSeriesTitle.value(),showSeriesOHLC:this._chart.properties().paneProperties.legendProperties.showSeriesOHLC.value(),showStudyValues:this._chart.properties().paneProperties.legendProperties.showStudyValues.value(),showLegend:this.Z98.model().properties().paneProperties.legendProperties.showLegend.value()},i=this.Z98.mainSeries(),r=e.orderedSources().slice(),n=r.indexOf(i);n>-1&&(r.splice(n,1),r.push(i));for(var o=r.length-1;o>=0;o--){var a=r[o],s=a.statusView();if(s){var l=a==i;if(!l||t.showSeriesTitle||t.showSeriesOHLC||t.showStudyTitles||t.showStudyValues)if(t.showLegend||!l){if((l||t.showStudyTitles||t.showStudyValues)&&t.showLegend){var d=$("<div>").addClass("pane-legend-line pane-legend-wrap").appendTo(this.$el);if(d.source=a,l){var h=$('<a class="pane-legend-minbtn apply-common-tooltip apply" title="'+$.t("Hide")+'"></a>').append($(svgAsset("legend-show",{"class":"expand"})));d.addClass("main").append(h.on("click touchend",this.toggleTitles.bind(this)))}else d.addClass("study");a.properties().visible.value()||d.addClass("disabled"),this._generateItemsForRow(d,s,t),TradingView.setMouseEventHandler(d,this,!0)}}else if(!this.$el.find(".expand-line").length){var d=$("<div>").addClass("pane-legend-line pane-legend-wrap main expand-line").appendTo(this.$el),h=$('<a class="pane-legend-minbtn apply-common-tooltip apply" title="'+$.t("Show")+'"></a>').append($(svgAsset("legend-hide",{"class":"expand closed"})));d.append(h.on("click touchend",this.toggleTitles.bind(this))),d.source=a,t={showStudyTitles:!1,showSeriesTitle:!1,showSeriesOHLC:t.showSeriesOHLC,showStudyValues:!1},this._generateItemsForRow(d,s,t),TradingView.setMouseEventHandler(d,this,!0),this.update()}}}this.update()}},r.prototype._generateItemsForRow=function(e,t,i){var r=e.source,o=this,a=r==this.Z98.mainSeries();if(a&&i.showSeriesTitle||!a&&i.showStudyTitles){var s=$("<span>");if(s.addClass("pane-legend-line apply-overflow-tooltip"),Z75.enabled("legend_context_menu")||s.addClass("no-context-menu"),a&&s.addClass("main"),r.properties().visible.value()||s.addClass("disabled"),s.css({"font-weight":t.bold()?"bold":"normal","font-size":t.size()}),s.click(function(t){o.contextMenuEvent(t,e)}),s.appendTo(e),this._itemsBinding.push({value:t,cell:s,source:e.source}),!this._chart.readOnly()&&r.userEditEnabled()&&Z75.enabled("edit_buttons_in_legend")){var l=$('<span class="pane-legend-icon-container">').appendTo(e);if($('<a class="pane-legend-icon apply-common-tooltip icon-hide" title="'+$.t("Show/Hide")+'">').append(svgAsset("hide","14x14")).appendTo(l).on("click touchend",this._generateItemsForRow._onShowhideClick.bind(this,r)),$('<a class="pane-legend-icon apply-common-tooltip format" title="'+$.t("Format")+'">').append(svgAsset("format","14x14")).appendTo(l).on("click touchend",this._generateItemsForRow._onFormatClick.bind(this,r)),r instanceof n){var d=r.metaInfo().isTVScript&&void 0!==r.metaInfo().TVScriptSourceCode;if(d&&!TradingView.isMobileView){var h=$('<a class="pane-legend-icon apply-common-tooltip source" title="'+$.t("Show Source Code")+'">').append(svgAsset("legend-sourcecode","14x14")).appendTo(l).on("click touchend",this._generateItemsForRow._onViewSorceClick.bind(this,r));if(TradingView.ScriptEditorWidget){var p=TradingView.ScriptEditorWidget.loadedScriptIdPart();p&&r.metaInfo().scriptIdPart===p&&h.addClass("active")}}}a||$('<a class="pane-legend-icon apply-common-tooltip delete" title="'+$.t("Delete")+'">').append(svgAsset("legend-delete","14x14")).appendTo(l).on("click touchend",this._generateItemsForRow._onDeleteClick.bind(this,r))}}var c=r.dataWindowView(),c=r.dataWindowView();if(this.isDataWindowValuesVisible(c)&&(a&&i.showSeriesOHLC||!a&&i.showStudyValues)){for(var u=[],_=[],f=$('<div class="pane-legend-item-value-container">'),g=0;g<c.items().length;g++){var v=(c.items()[g],$("<span class='pane-legend-item-value-wrap'>").appendTo(f)),m=a?$("<span class='pane-legend-item-value-title pane-legend-line'>").appendTo(v):null,y=$("<span class='pane-legend-item-value pane-legend-line'>").appendTo(v);a&&y.addClass("main"),r.properties().visible.value()||(y.addClass("disabled"),m&&m.addClass("disabled")),u.push(y),m&&_.push(m)}var w=$("<span class='pane-legend-item-additional pane-legend-line'>").appendTo(f.appendTo(e));this._itemsBinding.push({value:c,cell:u,titleCells:_.length?_:null,source:r,additional:w})}if(Z75.enabled("alerts")&&a){var T=$('<span class="pane-legend-icon-container">').appendTo(e);this.alertWidget&&this.alertWidget.destroy(),this.Z98.chartModel().readOnly()||(this.alertWidget=new TradingView.AlertsLegendWidget(T,this.Z98))}},r.prototype.isDataWindowValuesVisible=function(e){return this._chart.onWidget()?!!e&&!this._chart.isSmall():!!e},r.prototype._generateItemsForRow._onShowhideClick=function(e){this.Z98.setProperty(e.properties().visible,!e.properties().visible.value(),"Show/Hide "+e.title())},r.prototype._generateItemsForRow._onFormatClick=function(e,t){if(e.userEditEnabled()){TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Style"));var r=i(175);new r(e,this.Z98).show()}},r.prototype._generateItemsForRow._onDeleteClick=function(e){e.isUserDeletable()&&this.Z98.removeSource(e)},r.prototype._generateItemsForRow._onViewSorceClick=function(e){var t=e.metaInfo(),i={scriptSource:e.metaInfo().TVScriptSourceCode,scriptIdPart:t.scriptIdPart};TradingView.ScriptEditorWidget&&TradingView.ScriptEditorWidget.open(i)},r.prototype.setItemEnabled=function(e,t){var i=!e.hasClass("disabled"),r=e.closest(".pane-legend-wrap");t&&!i?(e.removeClass("disabled"),r.removeClass("disabled")):!t&&i&&(e.addClass("disabled"),r.addClass("disabled"))},r.prototype.valueChanged=function(e,t,i){return e[t]!==i?(e[t]=i,!0):!1},r.prototype.firstTitle=function(){return this.$el.find(".pane-legend-line.pane-legend-wrap:first-child")},r.prototype.updateTitle=function(){for(var e,t,i=this._itemsBinding.length;i--;)if(t=this._itemsBinding[i],!Array.isArray(t.cell)){t.last||(t.last={});var r=t.last,n=t.source;e=n.properties().visible.value(),this.valueChanged(r,"sourceVisible",e)&&this.setItemEnabled(t.cell,e);var o=t.value.color(),a=n!=this.Z98.mainSeries()&&n===this.Z98.selectedSource()?"bold":"normal",s=t.value.text();(this.valueChanged(r,"color",o)||this.valueChanged(r,"fontWeight",a)||this.valueChanged(r,"text",s))&&t.cell.text(TradingView.clean(s,!0)).css({color:o,"border-color":o,"font-weight":a})}this._chart.resizeIndicator()},r.prototype.update=function(e){this.updateTitle();for(var t,i,r,n,o,a,s,l=this._itemsBinding.length;l--;)if(n=this._itemsBinding[l],t=n.cell,i=n.titleCells,r=n.source.properties().visible.value(),Array.isArray(t)){n.last||(n.last={},n.last.dwView||(n.last.dwView={}));var d=n.last;for(o=n.value.items(),a=0;a<t.length;a++)s=o[a],d[a]||(d[a]={}),this.valueChanged(d,"sourceVisible",r)&&this.setItemEnabled(t[a],r),this.valueChanged(d[a],"text",s.text())&&(t[a][0].textContent=s.text()),s.color()&&this.valueChanged(d[a],"color",s.color())&&t[a].css("color",s.color()),i&&(this.valueChanged(d,"sourceVisible",r)&&this.setItemEnabled(i[a],r),this.valueChanged(d[a],"title",s.title())&&(i[a][0].textContent=s.title()));n.additional&&n.value.additional&&this.valueChanged(d,"additional",n.value.additional())&&n.additional.text(n.value.additional()||"")}this._chart.resizeIndicator()},r.prototype.dataSourceAtPoint=function(e,t){return null},r.prototype.renderTo=function(e,t,i){e.save(),e.fillStyle=this._chart.properties().scalesProperties.textColor.value(),e.textBaseline="middle";for(var r=0,n=0;n<this._itemsBinding.length;++n){var o=this._itemsBinding[n],a=o.value,s=o.source==this.Z98.mainSeries(),l=s?12:8,d=s?25:17;Array.isArray(o.cell)||(e.font=a.size()+" Verdana, Arial",e.fillText(a.text(),t,i+r+l),r+=d)}e.restore()},r.prototype.toggleTitles=function(e){this.Z98.model().properties().paneProperties.legendProperties.showLegend.setValue(!this._chart.properties().paneProperties.legendProperties.showLegend.value());for(var t=this._chart._paneWidgets.length-1;t>=0;t--)this._chart._paneWidgets[t].legendWidget.updateLayout()},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){this.Z97=e,this.Z98=t,this._undoCheckpoint=i}var n=i(13).LineDataSource,o=i(74).Study,a=i(18).DataSource;$.extend(r,{TAB_PRIORITY_COORDINATES:100,TAB_PRIORITY_DISPLAY:100,TAB_PRIORITY_STYLE:200,TAB_PRIORITY_INPUTS:300,TAB_PRIORITY_PROPERTIES:250,TAB_NAME_COORDINATES:"Coordinates",TAB_NAME_DISPLAY:"Properties",TAB_NAME_STYLE:"Style",TAB_NAME_INPUTS:"Inputs",TAB_NAME_PROPERTIES:"Properties",TAB_NAME_GRAPHICS:"Graphics",TAB_NAME_VISIBILITY:"Visibility",TAB_OPEN_DEFAULT:100,TAB_OPEN_USERSAVE:200,TAB_OPEN_OVERRIDE:300}),r.prototype.hide=function(e){$82.destroy(this._dialogTitle,{undoChanges:!!e})},r.prototype._onDestroy=function(e,t){var i=(t||{}).undoChanges;if($(window).unbind("keyup.hidePropertyDialog"),i){var r=this._undoCheckpoint?this._undoCheckpoint:this._undoCheckpointOnShow;r&&this.Z98.undoToCheckpoint(r)}else this.Z97.hasAlert.value()&&this.Z97.localAndServerAlersMismatch&&this.Z97.synchronizeAlert(!0);this._undoCheckpointOnShow&&delete this._undoCheckpointOnShow,window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.refresh()},r.prototype.isVisible=function(){return this._dialog&&this._dialog.is(":visible")},r.prototype.focusOnText=function(){this._dialog.find('input[type="text"]').focus().select()},r.prototype.switchTab=function(e,t){if(this._tabs){var i=null;if(e?e=e.valueOf():null===e&&(e=void 0),"string"==typeof e&&$.each(this._tabs,function(t,r){return r.name==e?(i=r,!1):void 0}),"object"==typeof e&&$.each(this._tabs,function(t,r){return e==r||$(r.labelObject).is(e)||$(r.wrapperObject).is(e)?(i=r,!1):void 0}),i||(i=this._tabs[~~e]),!i)return!1;if($.each(this._tabs,function(e,t){var r=t==i;$(t.wrapperObject)[r?"show":"hide"](),$(t.labelObject)[r?"addClass":"removeClass"]("active")}),t){var r=this.activeTabSettingsName();if(r){TVSettings.setValue(r,i.name)}}return this._dialog.height()+100>$(window).height()&&!i.isScrollable&&this.makeScrollable(i),$(":focus").blur(),!0}},r.prototype.makeScrollable=function(e){var t=e.wrapperObject,i=$(e.objects[0]),r=i.width();t.css({height:$(window).height()/1.4,overflow:"auto"}),i.css("width",r+20),e.isScrollable=!0},r.prototype.appendToTab=function(e,t,i,r,n,o){if(!$(e).is("table")||$(e).find("tr").size()){var a;this._tabs||(this._tabs=[]),$.each(this._tabs,function(e,i){return i.name==t?(a=e,!1):void 0}),void 0===a&&(this._tabs.push({name:t,localizedName:$.t(t),objects:$(),displayPriority:0,defaultOpen:0,isButton:!!n,callback:n?o||function(){}:null}),a=this._tabs.length-1);var s=this._tabs[a];s.objects=s.objects.add(e),s.displayPriority=Math.max(s.displayPriority||0,i||0),s.defaultOpen=Math.max(s.defaultOpen||0,r||0)}},r.prototype.insertTabs=function(){function e(e){a&&a===e.name&&(e.defaultOpen=Math.max(~~e.defaultOpen,r.TAB_OPEN_USERSAVE)),(!n||~~n.defaultOpen<~~e.defaultOpen)&&(n=e),e.labelObject=$('<a href="#" class="properties-tabs-label"></a>').text(e.localizedName).appendTo(i._tabContainer),e.labelObject.bind("click",function(e){e.preventDefault(),i.switchTab(this,!0)});var t=$('<div class="main-properties"></div>');e.wrapperObject=$().add(t),e.objects.each(function(i,r){var n=$(r);n.is("table")?(n.data("layout-separated")&&(e.wrapperObject=e.wrapperObject.add('<div class="properties-separator"></div>').add(t=$('<div class="main-properties"></div>')),n.removeData("layout-separated")),t.append(n),n.children("tbody").each(function(i,n){if(0!==i&&$(n).data("layout-separated")){e.wrapperObject=e.wrapperObject.add('<div class="properties-separator"></div>').add(t=$('<div class="main-properties"></div>'));var o=$(r).clone(!0,!1).appendTo(t);o.children().remove(),o.append(n),$(n).removeData("layout-separated")}})):t.append(n)}),e.wrapperObject.appendTo(i._container)}function t(e){e.labelObject=$('<a href="#" class="properties-tabs-label"></a>').text(e.localizedName).appendTo(i._tabContainer),e.labelObject.bind("click",e.callback)}if(this._tabs){this._tabs.sort(function(e,t){return(t.displayPriority||0)-(e.displayPriority||0)});var i=this,n=null,o=this.activeTabSettingsName();if(o)var a=TVSettings.getValue(o);$.each(this._tabs,function(i,r){r.isButton?t(r):e(r)}),this.switchTab(n)}},r.prototype.activeTabSettingsName=function(){var e=i(3),t=i(31),r=this.Z97;return r?r instanceof t||r instanceof e?"properties_dialog.active_tab.chart":r instanceof n?"properties_dialog.active_tab.drawing":r instanceof o?"properties_dialog.active_tab.study":void 0:void 0},r.prototype.show=function(e){function t(){y.hide(!0)}var s=i(176),l=i(3),e=e||{},d=e.onWidget||!1;TradingView.isInherited(this.Z97.constructor,l)&&TradingView.trackEvent("GUI","Chart Properties"),TradingView.isInherited(this.Z97.constructor,o)&&TradingView.trackEvent("GUI","Study Properties"),TradingView.isInherited(this.Z97.constructor,a)&&this.Z98.setSelectedSource(this.Z97);var h=s.createStudyStrategyPropertyPage(this.Z97,this.Z98),p=s.createInputsPropertyPage(this.Z97,this.Z98),c=s.createStylesPropertyPage(this.Z97,this.Z98),u=s.createVisibilitiesPropertyPage(this.Z97,this.Z98),_=s.createDisplayPropertyPage(this.Z97,this.Z98);if(p||c||h){var f,g,v,m,y=this,w=null!==p,T=this.Z97.title(),b=$82.createDialog(T,{hideTitle:!0,dragHandle:".properties-tabs"}),S=b.find("._tv-dialog-content"),C=$('<div class="properties-tabs"></div>').appendTo(S),x=[],P=400;this._tabs=x,this._dialog=b,this._dialogTitle=T,this._dialog=b,this._container=S,this._tabContainer=C,this._undoCheckpointOnShow=this.Z98.createUndoCheckpoint(),b.on("destroy",function(e,t){y._onDestroy(e,t),p&&p.destroy(),h&&h.destroy(),c&&c.destroy(),_&&_.destroy(),u&&u.destroy()}),e.selectScales&&c.setScalesOpenTab&&c.setScalesOpenTab(),e.selectTmz&&c.setTmzOpenTab&&c.setTmzOpenTab(),!this.Z98.readOnly()&&h&&h.widget().each(function(e,t){var i=+$(t).data("layout-tab-priority");isNaN(i)&&(i=r.TAB_PRIORITY_PROPERTIES);var n=~~$(t).data("layout-tab-open"),o=$(t).data("layout-tab");void 0===o&&(o=r.TAB_NAME_PROPERTIES),y.appendToTab(t,o,i,n)}),this.Z98.readOnly()||!w||p.widget().is(":empty")||p.widget().each(function(e,t){var n=i(188),o=p instanceof n,a=+$(t).data("layout-tab-priority");TradingView.isNaN(a)&&(a=o?r.TAB_PRIORITY_COORDINATES:r.TAB_PRIORITY_INPUTS);var s=~~$(t).data("layout-tab-open"),l=$(t).data("layout-tab");void 0===l&&(l=o?r.TAB_NAME_COORDINATES:r.TAB_NAME_INPUTS),y.appendToTab(t,l,a,s)}),c&&c.widget().each(function(e,t){var n=+$(t).data("layout-tab-priority");TradingView.isNaN(n)&&(n=r.TAB_PRIORITY_STYLE);var o=~~$(t).data("layout-tab-open"),a=i(178);!o&&c instanceof a&&(o=r.TAB_OPEN_DEFAULT);var s=$(t).data("layout-tab");void 0===s&&(s=r.TAB_NAME_STYLE),y.appendToTab(t,s,n,o)}),_&&_.widget().each(function(e,t){var i=+$(t).data("layout-tab-priority");TradingView.isNaN(i)&&(i=r.TAB_PRIORITY_DISPLAY);var n=~~$(t).data("layout-tab-open"),o=$(t).data("layout-tab");void 0===o&&(o=r.TAB_NAME_DISPLAY),y.appendToTab(t,o,i,n)}),u&&u.widget().each(function(e,t){y.appendToTab(t,r.TAB_NAME_VISIBILITY,r.TAB_PRIORITY_DISPLAY,!1)});var L=this.Z97 instanceof o&&this.Z97.metaInfo().isTVScript&&!!this.Z97.metaInfo().TVScriptSourceCode&&!TradingView.isMobileView;L&&y.appendToTab(null,$.t("Source Code"),null,null,!0,function(){this.hide();var e=this.Z97.metaInfo();TradingView.ScriptEditorWidget.open({scriptSource:e.TVScriptSourceCode,scriptIdPart:e.scriptIdPart})}.bind(this));var E=Z75.enabled("alerts")&&this.Z97.canHasAlert()&&!TradingView.isMobileView;E&&y.appendToTab(null,$.t("Alert"),null,null,!0,function(){runOrSignIn(function(){if(y.hide(),y.Z97.hasAlert.value())y.Z97.editAlert();else{var e=i(28);new e({drawing:y.Z97})}},{source:"Alert add from object properties dialog"})}),this.insertTabs(),this._helpItemRequired()&&this._createHelp(),f=$('<div class="main-properties main-properties-aftertabs"></div>').appendTo(S),g=$('<div class="dialog-buttons">').appendTo(f);var V=function(){function e(t){t._childs&&t._childs.length&&$.each(t._childs,function(i,r){"percentage"==r?t.percentage.listeners().fire(t.percentage):e(t[r])})}var t=[];c&&"function"==typeof c.defaultProperties&&(t=t.concat(c.defaultProperties())),p&&"function"==typeof p.defaultProperties&&(t=t.concat(p.defaultProperties())),0===t.length&&y.Z97.properties?t=[y.Z97.properties()]:y.Z97._sessionsStudy&&(t=t.concat(y.Z97._sessionsStudy.properties())),t.length&&($.each(t,function(t,i){y.Z98.restoreFactoryDefaults(i),y.Z97.calcIsActualSymbol&&y.Z97.calcIsActualSymbol(),e(i)}),y.Z97.properties().minTick&&y.Z97.properties().minTick.listeners().fire(y.Z97.properties().minTick),y.Z97.properties().precision&&y.Z97.properties().precision.listeners().fire(y.Z97.properties().precision),p&&p.loadData(),h&&h.loadData(),c.onResoreDefaults&&c.onResoreDefaults(),c&&c.loadData(),u&&u.loadData())},I=function(){u&&u.loadData(),p&&p.loadData()};if((!d||window.is_authenticated)&&c&&"function"==typeof c.createTemplateButton&&Z75.enabled("linetoolpropertieswidget_template_button"))c.createTemplateButton({defaultsCallback:V,loadTemplateCallback:I}).addClass("tv-left").appendTo(g);else if(TradingView.isInherited(this.Z97.constructor,o)){var A=[{title:$.t("Reset Settings"),action:V},{title:$.t("Save As Default"),action:function(){y.Z97.properties().saveDefaults()}}],k=$('<a href="#" class="_tv-button tv-left">'+$.t("Defaults")+'<span class="icon-dropdown"></span></a>');k.on("click",function(e){e.preventDefault();var t=$(this);t.is(".active")||t.trigger("button-popup",[A,!0]);
}).appendTo(g),TradingView.bindPopupMenu(k,null,{direction:"down",event:"button-popup",notCloseOnButtons:!0})}else $('<a class="_tv-button tv-left">'+$.t("Defaults")+"</a>").appendTo(g).click(V);v=$('<a class="_tv-button ok">'+$.t("OK")+"</a>").appendTo(g).click(function(){y.hide()}),m=$('<a class="_tv-button cancel">'+$.t("Cancel")+"</a>").appendTo(g).on("click",t),b.find("._tv-dialog-title a").on("click",t),$(window).bind("keyup.hidePropertyDialog",function(e){"13"==e.keyCode&&"textarea"!==e.target.tagName.toLowerCase()&&y.hide()}),$("select",S).each(function(){var e=$(this),t="tv-select-container dialog";e.hasClass("tv-select-container-fontsize")&&(t+=" tv-select-container-fontsize"),e.selectbox({speed:100,classHolder:t})}),$('input[type="text"]',S).addClass("tv-text-input inset dialog"),$("input.ticker",S).TVTicker(),b.css("min-width",P+"px"),$82.applyHandlers(b);var R={top:($(window).height()-b.height())/2,left:($(window).width()-b.width())/2};return c&&"function"==typeof c.dialogPosition&&(R=c.dialogPosition(R,b)||R),$82.positionDialog(b,R),window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.hide(),Q15.emit("edit_object_dialog",{objectType:this.Z97===this.Z98.mainSeries()?"mainSeries":this.Z97 instanceof n?"drawing":this.Z97 instanceof o?"study":"other",sourceTitle:this.Z97.title()}),b}},r.prototype._helpItemRequired=function(){return this.Z97._metaInfo&&!!this.Z97._metaInfo.helpURL},r.prototype._createHelp=function(){var e=$('<a class="help" href="#" target="_blank" title="'+$.t("Help")+'"></a>');e.attr("href",this.Z97._metaInfo.helpURL),this._tabContainer.prepend(e)},e.exports=r},function(e,t,i){"use strict";function r(e){return e instanceof d?e instanceof ie?je:e instanceof T?De:e instanceof fe?null:e instanceof Y?null:e instanceof le?null:e instanceof R?Ue:e instanceof k?null:e instanceof re?null:e instanceof pe?null:e instanceof z?null:e instanceof se?null:e instanceof ce?He:e instanceof x?null:e instanceof G?null:e instanceof j?null:e instanceof C?Ye:e instanceof Se?Ne:e instanceof q?null:e instanceof b?null:e instanceof D?null:e instanceof me?Xe:Fe:e instanceof Te?e instanceof Le?et:e instanceof Pe?Be:Oe:null}function n(e,t){if(e instanceof l||e instanceof s||e instanceof be)return Ut;if(e instanceof Te)return e instanceof Ee?tt:e instanceof xe?Ht:e instanceof Ve?it:e instanceof Ce?Me:e instanceof Ie?rt:"Volume@tv-basicstudies"==e.metaInfo().id?nt:e instanceof Ae?ot:e instanceof ke?ot:$e;if(e instanceof d){if(e instanceof S)return at;if(e instanceof T)return rt;if(e instanceof M)return Qe;if(e instanceof R)return ze;if(e instanceof V)return Rt;if(e instanceof I)return Rt;if(e instanceof A)return Mt;if(e instanceof ce)return We;if(e instanceof ue)return We;if(e instanceof C)return qe;if(e instanceof U)return lt;if(e instanceof B)return dt;if(e instanceof pe)return ht;if(e instanceof ae)return Dt;if(e instanceof de)return Ze;if(e instanceof _e||e instanceof Y)return pt;if(e instanceof fe)return ct;if(e instanceof le)return ut;if(e instanceof J)return _t;if(e instanceof k)return ft;if(e instanceof G)return Nt;if(e instanceof j)return Ft;if(e instanceof O)return gt;if(e instanceof oe)return vt;if(e instanceof q)return Wt;if(e instanceof he)return mt;if(e instanceof se)return yt;if(e instanceof ne)return wt;if(e instanceof re)return Tt;if(e instanceof N)return bt;if(e instanceof W)return St;if(e instanceof H)return Ct;if(e instanceof h)return p;if(e instanceof c)return u;if(e instanceof w)return xt;if(e instanceof K)return Et;if(e instanceof _)return f;if(e instanceof m)return zt;if(e instanceof P)return Pt;if(e instanceof F)return Lt;if(e instanceof L)return Vt;if(e instanceof g)return v;if(e instanceof z)return It;if(e instanceof E)return At;if(e instanceof ge||e instanceof ve)return kt;if(e instanceof y)return Re;if(e instanceof x)return Ke;if(e instanceof ie)return Ge;if(e instanceof Q)return Ot;if(e instanceof te)return $t;if(e instanceof Z)return Bt;if(e instanceof ee)return $t;if(e instanceof X)return Ot;if(e instanceof Se)return $e;if(e instanceof we||e instanceof ye)return st;if(e instanceof me)return Je}return null}function o(e){var t=i(186).StudyDisplayPropertyPage;return e instanceof be?null:e instanceof Te?t:null}function a(e){var t=i(357);return e instanceof d?t:void 0}var s=i(3),l=i(31),d=(i(7),i(154),i(13).LineDataSource),h=i(8),p=i(177),c=i(99),u=i(180),_=i(100),f=i(181),g=i(101),v=i(182),m=i(103),y=i(96).LineToolElliott,w=i(97).LineToolFibCircles,T=i(81),b=i(104),S=i(105),C=i(86).LineToolVertLine,x=i(92),P=i(107),L=i(108),E=i(109),V=i(110),I=i(111),A=i(112),k=i(83).LineToolParallelChannel,R=i(94),M=i(55).LineToolTrendLine,O=i(113).LineToolArrowMark,D=i(57).LineToolExecution,B=i(115),N=i(117),F=i(118),W=i(119),H=i(120),z=i(102).LineToolFibWedge,U=i(116).LineToolPitchfork,G=i(121),j=i(122),q=i(123),Y=i(124),K=i(125),X=i(126),J=i(127).LineToolTriangle,Z=i(128),Q=i(129).LineTool5PointsPattern,ee=i(130),te=i(131),ie=i(132).LineToolRiskReward,re=i(133),ne=i(134),oe=i(135),ae=i(136).LineToolNote,se=i(137),le=i(138),de=i(93),he=i(139),pe=i(45).LineToolText,ce=i(43).LineToolHorzLine,ue=i(140),_e=i(12).LineToolRectangle,fe=i(141),ge=i(142),ve=i(143),me=i(95),ye=i(144).LineToolBezierQuadro,we=i(144).LineToolBezierCubic,Te=i(74).Study,be=i(61).ESDStudyBase,Se=i(85).StudyLineDataSource,Ce=i(159).study_Overlay,xe=i(160),Pe=i(161),Le=i(162),Ee=i(163),Ve=i(164),Ie=i(82).study_LinearRegression,Ae=i(165),ke=i(166),Re=i(183),Me=i(184),Oe=i(186).StudyInputsPropertyPage,$e=i(186).StudyStylesPropertyPage,De=i(187),Be=i(189),Ne=i(190),Fe=i(188),We=i(191).LineToolHorzLineStylesPropertyPage,He=i(191).LineToolHorzLineInputsPropertyPage,ze=i(192).LineToolTrendAngleStylesPropertyPage,Ue=i(192).LineToolTrendAngleInputsPropertyPage,Ge=i(193).LineToolRiskRewardStylesPropertyPage,je=i(193).LineToolRiskRewardInputsPropertyPage,qe=i(194).LineToolVertLineStylesPropertyPage,Ye=i(194).LineToolVertLineInputsPropertyPage,Ke=i(195).LineToolBarsPatternStylesPropertyPage,Xe=i(196).LineToolGhostFeedInputsPropertyPage,Je=i(196).LineToolGhostFeedStylesPropertyPage,Ze=i(197),Qe=i(198),et=i(199),tt=i(200),it=i(201),rt=i(202),nt=i(203),ot=i(204).StudyVolumeProfilePropertyPage,at=i(204).VolumeProfilePropertyPage,st=i(205),lt=i(206),dt=i(207),ht=i(208),pt=i(209),ct=i(210),ut=i(211),_t=i(212),ft=i(213),gt=i(214),vt=i(215),mt=i(216),yt=i(217),wt=i(218),Tt=i(219),bt=i(220),St=i(221),Ct=i(222),xt=i(223),Pt=i(224),Lt=i(225),Et=i(226),Vt=i(227),It=i(228),At=i(229),kt=i(230),Rt=i(231),Mt=i(232),Ot=i(233),$t=i(234),Dt=i(235),Bt=i(236),Nt=i(237),Ft=i(238),Wt=i(239),Ht=i(240),zt=i(241),Ut=i(242);t.createInputsPropertyPage=function(e,t){var i=r(e);return i?new i(e.properties(),t,e):null},t.createStudyStrategyPropertyPage=function(e,t){var r=i(155),n=i(358);return e instanceof r?new n(e.properties(),t,e):null},t.createStylesPropertyPage=function(e,t){var i=n(e);return i?new i(e.properties(),t,e):null},t.createDisplayPropertyPage=function(e,t){var i=o(e);return i?new i(e.properties(),t,e):null},t.createVisibilitiesPropertyPage=function(e,t){var i=a(e);return i?new i(e.properties(),t,e):null},t.hasInputsPropertyPage=function(e){return!!r(e)},t.hasStylesPropertyPage=function(e){return!!n(e)},t.hasDisplayPropertyPage=function(e){return!!o(e)}},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.FloatBinder,s=o.BooleanBinder,l=o.SliderBinder,d=o.ColorBinding,h=o.SimpleComboBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t){var i=t||$("<tr>").appendTo(this._table),r=$("<td>");r.appendTo(i);var n=$("<input type='checkbox' class='visibility-switch'>");n.appendTo(r),t&&n.css("margin-left","15px");var o=$("<td>");o.appendTo(i);var l=$("<input type='text'>");l.appendTo(o),l.css("width","70px"),this.bindControl(new a(l,e.coeff,!1,this.model(),"Change Pitchfork Line Coeff"));var h=$("<td class='colorpicker-cell'>");h.appendTo(i);var p=TradingView.addColorPicker(h);return this.bindControl(new s(n,e.visible,!0,this.model(),"Change Fib Retracement Line Visibility")),this.bindControl(new d(p,e.color,!0,this.model(),"Change Fib Retracement Line Color",0)),i},r.prototype.prepareLayout=function(){this._div=$(document.createElement("div")).addClass("property-page");var e=this._linetool.properties().trendline,t=$("<table>").appendTo(this._div).css("padding-bottom","3px");if(e){var i=$("<tr>").appendTo(t),r=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(r).appendTo(i),$("<td>").append($.t("Trend Line")).appendTo(i),this.bindControl(new s(r,e.visible,!0,this.model(),"Change Fib Retracement Line Visibility"));var n=$("<td class='colorpicker-cell'>").appendTo(i),o=TradingView.addColorPicker(n);this.bindControl(new d(o,e.color,!0,this.model(),"Change Fib Retracement Line Color",0));var a=$("<td>").appendTo(i),p=TradingView.createLineWidthEditor();p.appendTo(a),this.bindControl(new l(p,e.linewidth,parseInt,this.model(),"Change Fib Retracement Line Width"));var c=$("<td>").appendTo(i),u=TradingView.createLineStyleEditor();u.render().appendTo(c),this.bindControl(new h(u,e.linestyle,parseInt,!0,this.model(),"Change Fib Retracement Line Style"))}var _=this._linetool.properties().levelsStyle,f=$("<tr>").appendTo(t);$("<td>").appendTo(f),$("<td>"+$.t("Levels Line")+"</td>").appendTo(f),$("<td>").appendTo(f);var a=$("<td>").appendTo(f),p=TradingView.createLineWidthEditor();p.appendTo(a),this.bindControl(new l(p,_.linewidth,parseInt,this.model(),"Change Fib Retracement Line Width"));var c=$("<td>").appendTo(f),u=TradingView.createLineStyleEditor();u.render().appendTo(c),this.bindControl(new h(u,_.linestyle,parseInt,!0,this.model(),"Change Fib Retracement Line Style")),this._table=$(document.createElement("table")).appendTo(this._div),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");for(var g={},v=0;24>v;v++){var m=v%8,f=g[m],y="level"+(v+1);g[m]=this.addLevelEditor(this._linetool.properties()[y],f)}var w,T=$("<table cellpadding=0 cellspacing=0>").appendTo(this._div),b=$("<tr>").appendTo(T);if(this._linetool.properties().extendLines){w=$("<input type='checkbox' class='visibility-switch'>");var S=$("<label>").append(w).append($.t("Extend Lines"));$("<td>").append(S).appendTo(b)}var C;if(this._linetool.properties().extendLeft){C=$("<input type='checkbox' class='visibility-switch'>");var S=$("<label>").append(C).append($.t("Extend Left"));$("<td>").append(S).appendTo(b)}var x;if(this._linetool.properties().extendRight){x=$("<input type='checkbox' class='visibility-switch'>");var S=$("<label>").append(x).append($.t("Extend Right"));$("<td>").append(S).appendTo(b)}var P;if(this._linetool.properties().reverse){P=$("<input type='checkbox' class='visibility-switch'>");var S=$("<label>").append(P).append($.t("Reverse"));$("<td>").append(S).appendTo(b)}var L=$("<tr>").appendTo(T),E=$("<input type='checkbox' class='visibility-switch'>"),S=$("<label>").append(E).append($.t("Levels"));$("<td>").append(S).appendTo(L);var V=$("<input type='checkbox' class='visibility-switch'>"),S=$("<label>").append(V).append($.t("Prices"));$("<td>").append(S).appendTo(L);var I=$("<input type='checkbox' class='visibility-switch'>"),S=$("<label>").append(I).append($.t("Percents"));$("<td>").append(S).appendTo(L);var A=$("<table cellspacing='0' cellpadding='0'>").appendTo(this._div),k=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),R=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>"),f=$("<tr>");f.append("<td>"+$.t("Labels")+"</td>").append(k).append("<td>&nbsp</td>").append(R),f.appendTo(A);var M=$("<table cellspacing='0' cellpadding='0'>").appendTo(this._div),f=$("<tr>").appendTo(M),O=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(O).appendTo(f),this.createLabeledCell($.t("Background"),O).appendTo(f);var D=TradingView.createTransparencyEditor();$("<td>").append(D).appendTo(f),this.bindControl(new s(V,this._linetool.properties().showPrices,!0,this.model(),"Change Gann Fan Prices Visibility")),this.bindControl(new s(E,this._linetool.properties().showCoeffs,!0,this.model(),"Change Gann Fan Levels Visibility")),this.bindControl(new s(O,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility")),this.bindControl(new l(D,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency")),this._linetool.properties().extendLines&&this.bindControl(new s(w,this._linetool.properties().extendLines,!0,this.model(),"Change Fib Retracement Extend Lines")),this._linetool.properties().extendLeft&&this.bindControl(new s(C,this._linetool.properties().extendLeft,!0,this.model(),"Change Fib Retracement Extend Lines")),this._linetool.properties().extendRight&&this.bindControl(new s(x,this._linetool.properties().extendRight,!0,this.model(),"Change Fib Retracement Extend Lines")),this._linetool.properties().reverse&&this.bindControl(new s(P,this._linetool.properties().reverse,!0,this.model(),"Change Fib Retracement Reverse")),this.bindControl(new h(k,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Labels Horizontal Alignment")),this.bindControl(new h(R,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Labels Vertical Alignment")),this.bindControl(new s(I,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents")),this.loadData()},r.prototype.widget=function(){return this._div},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t),this._linetool=i,this._templateList=new TradingView.LinetoolTemplatesList(this._linetool._constructor,this.applyTemplate.bind(this))}var n=i(179).Q5;inherit(r,n),r.prototype.applyTemplate=function(e){this._linetool.restoreTemplate(e),this.Z98.model().updateSource(this._linetool),this.loadData()},r.prototype.createTemplateButton=function(e){var t=this,e=$.extend({},e,{getDataForSaveAs:function(){return t._linetool.template()}.bind(t)});return this._templateList.createButton(e)},r.prototype.appendTemplateRow=function(e){if(is_authenticated){var t=$(document.createElement("tr"));t.appendTo(e);var i=$(document.createElement("td"));i.attr("colspan",2),i.appendTo(t);var r=$('<div class="dialog-theme-buttons"></div>').appendTo(i);this.templateButton=$(this.createTemplateButton()),this.templateButton.appendTo(r),$('<tr><td class="property-page-separator-cell" colspan="6"><div class="property-page-separator"></div></td></tr>').appendTo(e)}},e.exports=r},function(e,t,i){"use strict";function r(e,t){this.Z98=t,this._bindings=[],this._property=e}function n(e,t,i,r,o,a){return e?(this._control=e,this._property=t,this._applyOnFly=i,this._undoModel=r,this._undoText=o,void(t&&(this._formatters=[],this._changed=!1,this.setValue(t.value()),t.listeners().subscribe(this,n.prototype.propertyChanged)))):void TradingView.logDebugChart("Binding: missing control")}function o(e){return e.toUpperCase()}function a(e){return function(t){return e>t?e:t}}function s(e){return function(t){return t>e?e:t}}function l(e){return function(t){var i=parseInt(t,10);return TradingView.isNaN(i)?e:i}}function d(e){var t=new TradingView.NumericFormatter;return function(i){var r=t.parse(i);return TradingView.isNaN(r)?e:r}}function h(){return function(e){for(var t=e,i=e.replace(/[^\u0000-\u007F]/,"");i.length!==t.length;)t=i,i=t.replace(/[^\u0000-\u007F]/,"");return i}}function p(e){return function(t){return 0===t.length?e:t}}function c(e,t,i,r,o,a){n.call(this,e,t,r,o,a),this._transformFunction=i,this._attachToControl(e,r)}function u(e,t,i,r,n){c.call(this,e,t,d(t.value()),i,r,n),this.addFormatter(function(e){return(new TradingView.NumericFormatter).format(e)})}function _(e,t,i,r,o,a){this._subControlIds=t,n.call(this,e,i,r,o,a),this._forEachSubControl(function(e){this._attachToControl(e,r)})}function f(e,t,i,r,o,a,s){this.Z98=r,this._mainSeries=a,this._toIntTransformer=l(s),this._disabled=!1,n.call(this,e,t,i,r,o);var d=this;i&&e.change(function(){d.setValueToProperty(d.value())}),this._mainSeries.onBarReceived().subscribe(this,function(e){d.setValue(this.property().value())})}function g(e,t,i,r,o){n.call(this,e,t,i,r,o),i&&e.on("accept-symbol",function(e,t){this.setValueToProperty(t)}.bind(this))}function v(e,t,i,r,o,a,s){n.call(this,e,t,r,o,a),this._transformFunction=i,this._setter=s;var l=this;r&&e.change(function(){l._setter?l._setter.call(l,l.value()):l.setValueToProperty(l.value())})}function m(e,t){n.call(this,e,t)}function y(e,t,i,r,o,a){if(!e.is(":checkbox, :radio"))return new T(e,t,i,r,o);n.call(this,e,t,i,r,o),this._setter=a;var s=this;i&&e.change(function(){s._setter?s._setter.call(s,s.value()):s.setValueToProperty(s.value())})}function w(e,t,i,r,o,a){n.call(this,e,t,i,r,o),this._inverted=a===!0}function T(e,t,i,r,o){n.call(this,e,t,i,r,o);var a=this;i&&e.click(function(){var e=$(this).toggleClass("active").hasClass("active");a.setValueToProperty(e)})}function b(e,t,i,r,o){return i?(n.call(this,e,t,!0,i,r),void(o?e.callbacks().subscribe(this,o):e.callbacks().subscribe(this,b.prototype.onActionCallback))):void TradingView.logDebugChart("ActionBinder: Missed undo model")}function S(e,t,i,r,o,a){var s;s=e.is("input")?e:e.find("input"),n.call(this,s,t,i,r),this._transparencyProperty=a,this.applyOldTransparency();var l=this;i&&s.change(function(){l.setValueToProperty(l.value())})}function C(e,t,i,r,o,a){function s(e,t){var i=d.control().slider("option","min"),r=d.control().slider("option","max"),n=d._property.value();(n>=i&&r>=n||i<t.value&&t.value<r)&&d.setValueToProperty(t.value)}function l(e,t){d.setValueToProperty(t.value)}isNumber(t.value())||(TradingView.logWarn("Property cannot be binded to control, bad value (expect number): "+t.value()),t=new Property),n.call(this,e,t,i,r,o);var d=this;i&&(a?(e.bind("slidechange",s),e.bind("slide",s)):(e.bind("slidechange",l),e.bind("slide",l))),e.bind("slidestart",function(e,t){r.beginUndoMacro(o)}),e.bind("slidestop",function(e,t){r.endUndoMacro()})}function x(e,t,i,r,n,o){y.call(this,e,t,r,n,o),this._intervalProperty=i,this._intervalProperty.listeners().subscribe(this,this.onIntervalChanged),this.onIntervalChanged()}function P(e,t,i,r){this._control=e,this._wv=t.spawn(),this._transformFunction=i,this._undoText=r,this._attachToControl(this._control)}function L(e,t,i,r,n){this._not=!!n,P.apply(this,arguments)}function E(e,t,i,r,n,o,a,s){this._propFrom=t[0],this._propTo=t[1],this._control=e,this._applyOnFly=r,this._undoModel=n,this._undoText=a,this.Q0=t,this._inputsText=o,this._transformers=i;var l=this;e.slider({range:!0,min:i[0],max:i[1],values:[l._propFrom.value(),l._propTo.value()]}),this.$rangeHandleFrom=$(e.find(".ui-slider-handle")[0]).addClass("from"),this.$rangeHandleTo=$(e.find(".ui-slider-handle")[1]).addClass("to"),this.setValue(this._propFrom,0),this.setValue(this._propTo,1),s&&($(s).on("change",function(e){$(this).is(":checked")?(l._control.slider("enable"),$(l._inputsText[0]).prop("disabled",!1),$(l._inputsText[1]).prop("disabled",!1)):(l._control.slider("disable"),$(l._inputsText[0]).prop("disabled",!0),$(l._inputsText[1]).prop("disabled",!0))}),$(s).is(":checked")?(l._control.slider("enable"),$(l._inputsText[0]).prop("disabled",!1),$(l._inputsText[1]).prop("disabled",!1)):(l._control.slider("disable"),$(l._inputsText[0]).prop("disabled",!0),$(l._inputsText[1]).prop("disabled",!0))),o&&($(o[0]).val(this._control.slider("values",0)),$(o[1]).val(this._control.slider("values",1)),e.slider({slide:function(e,t){$(o[0]).val(t.values[0]),$(o[1]).val(t.values[1])}}),$(o).each(function(){$(this).on("keydown",function(e){parseInt($(o[0]).val())<l._transformers[0]?$(o[0]).val(l._transformers[0]):parseInt($(o[1]).val())>l._transformers[1]&&$(o[1]).val(l._transformers[1]),-1!==$.inArray(e.keyCode,[46,8,9,27,13,110,190])||65==e.keyCode&&e.ctrlKey===!0||67==e.keyCode&&e.ctrlKey===!0||88==e.keyCode&&e.ctrlKey===!0||e.keyCode>=35&&e.keyCode<=39||(e.shiftKey||e.keyCode<48||e.keyCode>57)&&(e.keyCode<96||e.keyCode>105)&&e.preventDefault()})}),$(o[0]).on("keyup",function(e){parseInt($(this).val())<l._transformers[0]?$(this).val(l._transformers[0]):parseInt($(this).val())>l._transformers[1]&&$(this).val(l._transformers[1]),parseInt($(this).val())>parseInt($(o[1]).val())&&$(this).val(o[1].val()),l._control.slider("values",0,$(this).val()),E.prototype.setValueToProperty.call(l,l._control.slider("values"),"from")}),$(o[1]).on("keyup",function(e){parseInt($(this).val())<l._transformers[0]?$(this).val(l._transformers[0]):parseInt($(this).val())>l._transformers[1]&&$(this).val(l._transformers[1]),parseInt($(this).val())<$(o[0]).val()&&$(this).val(o[0].val()),l._control.slider("values",1,$(this).val()),E.prototype.setValueToProperty.call(l,l._control.slider("values"),"to")})),this._propFrom.listeners().subscribe(this,E.prototype.propertyChanged),this._propTo.listeners().subscribe(this,E.prototype.propertyChanged),r&&e.on("slide",function(e,t){l.setValueToProperty(l._control.slider("values"),t.handle)}),e.slider({stop:function(e,t){o&&($(o[0]).val(l._control.slider("values",0)),$(o[1]).val(l._control.slider("values",1))),l.setValueToProperty(l._control.slider("values"),t.handle)},start:function(e,t){o&&($(o[0]).val(l._control.slider("values",0)),$(o[1]).val(l._control.slider("values",1))),l.setValueToProperty(l._control.slider("values"),t.handle)}})}function V(e,t,i,r,o,a){n.call(this,e,t,i,r,o),this._separator=a||" ";var s=this;i&&e.change(function(){s.setValueToProperty(s.value())})}var I=i(5).UndoHistory;r.prototype.model=function(){return this.Z98},r.prototype.bindControl=function(e){return this._bindings.push(e),e},r.prototype.unbindControl=function(e){var t=this._bindings.indexOf(e);-1!==t&&this._bindings.splice(t,1)},r.prototype.loadData=function(){for(var e=0;e<this._bindings.length;e++){var t=this._bindings[e];if(t.properties){var i=t.properties();t.setValue(i[0],0),t.setValue(i[1],1)}else t.property&&(t.transparencyProperty&&t.transparencyProperty()?t.applyOldTransparency():t.setValue(t.property().value()))}},r.prototype.saveData=function(){this.Z98.beginUndoMacro();for(var e=0;e<this._bindings.length;e++){var t=this._bindings[e];t.changed()&&this.Z98.setProperty(t.property(),t.value())}this.Z98.endUndoMacro()},r.prototype.createColorPicker=function(e){e=e||{};var t=$('<input class="colorpicker-widget">').bind("customcolorchange",function(e,t){TVSettings.setJSON("pickerCustomColors",t)}).on("change",function(){$(this).css("border-color",TradingView.generateLowBrightnessColor($(this).val()))}).tvcolorpicker({customColors:TVSettings.getJSON("pickerCustomColors",[]),hideTransparency:!!e.hideTransparency}),i=$('<span class="tvcolorpicker-container">');return $('<div class="tvcolorpicker-transparency">').appendTo(i),t.appendTo(i),e.addClass&&i.addClass(e.addClass),i},r.prototype.createTextEditor=function(e,t){var i={};return e&&(i.width=e),t&&(i.height=t),$(document.createElement("textarea")).css(i)},r.prototype.createCombo=function(e){var t=$(document.createElement("select")),i=e.reduce(function(e,t){return e.add($(document.createElement("option")).prop({value:t,text:t}))},$());return t.append(i)},r.prototype.createKeyCombo=function(e){var t=$(document.createElement("select"));return $.each(e||[],function(e,i){$(document.createElement("option")).prop({value:e,text:i}).appendTo(t)}),t},r.prototype.createFontEditor=function(e){var t=e||TradingView.factoryDefaults("chartproperties.editorFontsList");return this.createCombo(t)},r.prototype.createFontSizeEditor=function(e){var t=e||[10,11,12,14,16,20,24,28,32,40];return this.createCombo(t).addClass("tv-select-container-fontsize")},r.prototype.createSeriesMinTickEditor=function(){var e="<select><option value='default'>"+$.t("Default")+"</option>",t=[{priceScale:1,minMove:1,frac:!1},{priceScale:10,minMove:1,frac:!1},{priceScale:100,minMove:1,frac:!1},{priceScale:1e3,minMove:1,frac:!1},{priceScale:1e4,minMove:1,frac:!1},{priceScale:1e5,minMove:1,frac:!1},{priceScale:1e6,minMove:1,frac:!1},{priceScale:2,minMove:1,frac:!0},{priceScale:4,minMove:1,frac:!0},{priceScale:8,minMove:1,frac:!0},{priceScale:16,minMove:1,frac:!0},{priceScale:32,minMove:1,frac:!0},{priceScale:64,minMove:1,frac:!0},{priceScale:128,minMove:1,frac:!0},{priceScale:320,minMove:1,frac:!0}];for(var i in t){var r=t[i],n=r.priceScale+","+r.minMove+","+r.frac,o=r.minMove+"/"+r.priceScale;e+="<option value='"+n+"'>"+o+"</option>"}return e+="</select>",$(e)},r.prototype.createPrecisionEditor=function(){for(var e="<select><option value='default'>"+$.t("Default")+"</option>",t=0;6>=t;t++)e+="<option value='"+t+"'>"+t+"</option>";return e+="</select>",$(e)},r.prototype.createLabeledCell=function(e,t,i){var r,n,o=null;"number"==typeof e.valueOf()?(o=e,r=t,n=i):(r=e,n=t),r+="";var a=this._labelToId(r),s=$("<td>");$("<label>").html(r.length>0?$.t(r):"").attr("for",a).appendTo(s);return o&&s.attr("colspan",o),n&&n.attr("id",a),s},r.prototype.createTableInTable=function(e){var t=$("<tr>").appendTo(e),i=$("<td>").appendTo(t);return $('<table cellpadding="0" cellspacing="0">').appendTo(i)},r.prototype._labelToId=function(e){return"control"+e.replace(/(^| )\w/g,function(e){return"-"+e.trim().toLowerCase()})+Math.floor(1e3*Math.random())},r.prototype.addRow=function(e){var t=$(document.createElement("tr"));return t.appendTo(e)},r.prototype.addLabeledRow=function(e,t,i,r){var n=t&&t.length>0?$.t(t):"",o=$(document.createElement("tr")),a=$(document.createElement("td")).html(n);if(r&&a.attr("colspan",2),i){var s=this._labelToId(t);i.attr("id",s),a.html('<label for="'+s+'">'+n+"</label>")}return o.append(a).appendTo(e)},r.prototype.addEditorRow=function(e,t,i,r){var n=$(document.createElement("td"));return i.row=this.addLabeledRow(e,t,i,r),i.appendTo(n.appendTo(i.row)),i},r.prototype.addColorPickerRow=function(e,t){return this.addEditorRow(e,t,this.createColorPicker())},r.prototype.addOffsetEditorRow=function(e,t){var i=$("<input/>");return i.attr("type","text"),i.css("width","100px"),i.addClass("ticker"),this.addEditorRow(e,t,i)},r.prototype.addFontEditorRow=function(e,t){return this.addEditorRow(e,t,this.createFontEditor())},r.prototype.refreshStateControls=function(e,t,i){for(var r=0;r<t.length;r++){var n=t[r],o=e[n.id];o.toggle(this.parseRule(n.visible,t,i)),o.attr("disabled",!this.parseRule(n.visible,t,i))}},r.prototype.parseRule=function(e,t,i){if(!e)return!0;var r=e.split("==");return r.length<2?!1:i[r[0]].value()==r[1]},r.prototype.destroy=function(){for(var e=this._bindings.length;e--;)this._bindings[e].destroy();this._bindings.length=0},r.prototype.bindInteger=function(e,t,i,r,n){var o=[l(t.value())];void 0!==r&&o.push(a(1)),void 0!==n&&o.push(s(1e3)),this.bindControl(new c(e,t,o,!1,this.model(),i))},r.prototype.bindColor=function(e,t,i){this.bindControl(new S(e,t,!0,this.model(),i))},r.prototype.bindBoolean=function(e,t,i){this.bindControl(new y(e,t,!0,this.model(),i))},n.prototype.addFormatter=function(e){this._formatters.push(e),this.setValue(this._property.value())},n.prototype._formatValue=function(e){return this._formatters.reduce(function(e,t){return t(e)},e)},n.prototype._attachToControl=function(e,t){var i=this;t?e.on("keyup change input",function(e){var t=i.value();i.setValueToProperty(t),i.setValue(t)}):(e.keypress(function(e){if(this._changed=!0,13==e.which){var t=i.value();i.setValueToProperty(t),i.setValue(t)}}),e.focusout(function(e){var t=i.value();i.changed()&&(i.setValueToProperty(t),i.setValue(t))}),e.change(function(e){var t=i.value();$(e.target).is(".ticker")?(void 0!==i._changeTimerId&&clearTimeout(i._changeTimerId),i._changeTimerId=setTimeout(function(){i.setValueToProperty(t)},250)):i.setValueToProperty(t),i.setValue(t)}))},n.prototype.control=function(){return this._control},n.prototype.changed=function(){return this._changed},n.prototype.setValueToProperty=function(e){this._undoModel.setProperty(this._property,e,this._undoText),this._changed=!1},n.prototype.property=function(){return this._property},n.prototype.propertyChanged=function(e){this.setValue(e.value())},n.prototype.destroy=function(){this._property&&this._property.listeners().unsubscribe(this,n.prototype.propertyChanged)},inherit(c,n),c.prototype.value=function(){var e=this._control.val();if(this._transformFunction)if(Array.isArray(this._transformFunction))for(var t=0;t<this._transformFunction.length;t++)e=this._transformFunction[t](e);else e=this._transformFunction(e);return e},c.prototype.setValue=function(e){var t=this._control.val(),i=this._formatValue(e);t!==i&&this._control.val(i)},inherit(u,c),inherit(_,n),_.prototype._forEachSubControl=function(e){this._subControlIds.forEach(function(t){var i="#"+t,r=this.control().find(i);e.call(this,r)},this)},_.prototype._parseSessions=function(e){var t=e.split("-",2);2!=t.length&&(t=["0","0"]);var i=parseInt(t[0]),r=parseInt(t[1]);return[Math.floor(i/100),i%100,Math.floor(r/100),r%100]},_.prototype.value=function(){var e=[];this._forEachSubControl(function(t){e.push(t.val())});var t=function(e,t){return t.forEach(function(t){e=t(e)}),("0"+e).slice(-2)},i=[l(0),a(0),s(23)],r=[l(0),a(0),s(59)];return t(e[0],i)+t(e[1],r)+"-"+t(e[2],i)+t(e[3],r)},_.prototype.setValue=function(e){var t=this._parseSessions(e);this._forEachSubControl(function(e){var i=e.val(),r=("0"+t[0]).slice(-2);t.shift(),i!==r&&e.val(r)})},inherit(f,n),f.prototype.value=function(){if(this._disabled)return this._control.attr("disabled",!0),null;var e=this._control.val(),t=this._toIntTransformer(e);0>t&&(t=0);var i=this._mainSeries.bars().size();t>=i&&(t=i-1);var r=this._mainSeries.bars()._valueAt(this._mainSeries.bars().lastIndex()-t)[TradingView.TIME_PLOT];return 1e3*r},f.prototype.setValue=function(e){if(this._disabled||null==e)return void this._control.attr("disabled",!0);if(0>e)return this._control.val(-e),void this._property.setValue(this.value());var t=this._mainSeries.data().timeToBarIndex(e/1e3,TradingView.SEARCH_FROM_RIGHT);if(null===t)return void(this._disabled=!0);var i=this._mainSeries.bars().lastIndex(),r=i-t,n=this._control.val();n!==""+r&&this._control.val(r)},inherit(g,n),g.prototype.value=function(){return this._control.val()},g.prototype.setValue=function(e){var t=this.value();e&&t!==e&&this._control.val(e)},inherit(v,n),v.prototype.value=function(){var e=this._control.val();return this._transformFunction&&(e=this._transformFunction(e)),e},v.prototype.setValue=function(e){if(this._control.val(e),this._control.selectbox)try{var t=this._control.find("[value='"+e+"']");if(t.length>0){var i=t[0];this._control.selectbox("change",i.value,i.text)}}catch(r){}},inherit(m,n),m.prototype.value=function(){return this._property.value()},m.prototype.setValue=function(e){return this._control.html(e)},inherit(y,n),y.prototype.value=function(){return this.control().is(":checked")},y.prototype.setValue=function(e){if(this.control().is(".visibility-checker")&&(e?(this.control().closest("tr").find(".slider-range").slider("enable"),this.control().closest("tr").find('input[type="text"]').each(function(){$(this).prop("disabled",!1)})):(this.control().closest("tr").find(".slider-range").slider("disable"),this.control().closest("tr").find('input[type="text"]').each(function(){$(this).prop("disabled",!0)}))),this.control().is(".visibility-switch")){var t={opacity:e?1:.5},i=e?"enable":"disable",r=this.control().data("hides");if(r)r.closest("td").css(t);else{var n=this.control();n.parent().parent().data("visible",e).find("td").filter(function(){var e=$(this);return!e.find("label").length&&e.find(":checkbox").attr("id")!==n.attr("id")}).each(function(){var r=$(this),n=r.children();n.each(function(){var n=$(this);n.is(".ui-slider")?n.slider(i):n.is("select")?(n.selectbox(i),r.css(t)):n.is(".custom-select")?(n.data(i)(),
r.css(t)):n.is(".tvcolorpicker-container")?(n.find("input").prop("disabled",!e),r.css(t)):(n.prop("disabled",!e),r.css(t))})})}}return this.control().attr("checked",!!e)},inherit(w,n),w.prototype.value=function(){return this.control().is(":disabled")},w.prototype.setValue=function(e){return e=!!e,this._inverted&&(e=!e),this.control().parents("label").toggleClass("disabled",e),this.control().attr("disabled",e)},inherit(T,n),T.prototype.value=function(){return this.control().hasClass("active")},T.prototype.setValue=function(e){return this.control().toggleClass("active",!!e)},inherit(b,n),b.prototype.onActionCallback=function(e){this._undoModel.setProperty(this._property,this.value(),this._undoText)},b.prototype.value=function(){return this.control().checked},b.prototype.setValue=function(e){return this.control().checked=!!e},inherit(S,n),S.prototype.applyOldTransparency=function(){if(this.transparencyProperty())if(TradingView.isHexColor(this.property().value())){var e=this.transparencyProperty().value?this.transparencyProperty().value():this.transparencyProperty(),t=TradingView.hexRgbDecomp(this.property().value()),i=(100-e)/100;this.control().val(TradingView.rgbaComp(t,i)),this.control().change()}else this.control().val(this.property().value()),this.control().change()},S.prototype.transparencyProperty=function(){return this._transparencyProperty},S.prototype.value=function(){return this._control.val()},S.prototype.setValue=function(e){this._control.val(e),this._control.change(),this._control.color&&this._control.color.fromString(e)},inherit(C,n),C.prototype.value=function(){return this._control.slider("option","value")},C.prototype.setValue=function(e){this._control.slider("option","value",e)},inherit(x,y),x.prototype.onIntervalChanged=function(){+this._intervalProperty.value()<1440?this._control.attr({disabled:!1,checked:!!this._property.value()}):this._control.attr({disabled:!0,checked:!1})},x.prototype.value=function(){return this._control.is(":disabled")?this._property.value():y.prototype.value.call(this)},x.prototype.setValue=function(e){return this._control.is(":disabled")?void 0:y.prototype.setValue.call(this,e)},x.prototype.destroy=function(){this._intervalProperty.listeners().unsubscribe(this,this.onIntervalChanged),delete this._intervalProperty,y.prototype.destroy.call(this,arguments)},P.prototype._attachToControl=function(e){var t=this;this._wv.subscribe(this.setValue.bind(this),{callWithLast:!0}),$(this._control).on("change",function(){t.setValueToProperty(t.value())})},P.prototype.control=function(){return this._control},P.prototype.value=function(){var e=$(this._control).val();return this._transformFunction&&(e=this._transformFunction(e)),e},P.prototype.setValue=function(e){$(this._control).val(e)},P.prototype.setValueToProperty=function(e){I.setWatchedValue(this._wv,e,this._undoText)},P.prototype.watchedValue=function(){return this._wv},P.prototype.destroy=function(){this._wv.destroy()},inherit(L,P),L.prototype._attachToControl=function(e){var t=this;this._wv.subscribe(this.setValue.bind(this),{callWithLast:!0}),$(this._control).on("click",function(){t.setValueToProperty(t.value())})},L.prototype.value=function(){var e=$(this._control).attr("checked");return this._not&&(e=!e),this._transformFunction&&(e=this._transformFunction(e)),e},L.prototype.setValue=function(e){this._not&&(e=!e),$(this._control).attr("checked",!!e)},E.prototype.properties=function(){return this.Q0},E.prototype.value=function(e){return this._control.slider("values",e)},E.prototype.setValue=function(e,t){this._control.slider("values",t,e.value()),this._inputsText&&$(this._inputsText[t]).val(e.value())},E.prototype.propertyChanged=function(e){this.setValue(e)},E.prototype.setValueToProperty=function(e,t){($(t).hasClass("from")||"from"===t)&&(this._undoModel.beginUndoMacro(this._undoText[0]),this._undoModel.setProperty(this._propFrom,e[0],this._undoText[0]),this._propFrom.setValue(e[0],0),this._undoModel.endUndoMacro()),($(t).hasClass("to")||"to"===t)&&(this._undoModel.beginUndoMacro(this._undoText[1]),this._undoModel.setProperty(this._propTo,e[1],this._undoText[1]),this._propTo.setValue(e[1],1),this._undoModel.endUndoMacro())},E.prototype.destroy=function(){this._propFrom&&this._propTo&&(this._propFrom.listeners().unsubscribe(this,n.prototype.propertyChanged),this._propTo.listeners().unsubscribe(this,n.prototype.propertyChanged))},inherit(V,n),V.prototype.value=function(){var e=[];return this._control.each(function(){var t=$(this);t.is(":checked")&&e.push(t.attr("value"))}),e.join(this._separator)},V.prototype.setValue=function(e){var t=e.split(this._separator).filter(Boolean);this._control.each(function(){var e=$(this),i=-1!==t.indexOf(e.attr("value"));e.attr("checked",i),e.parents("label").toggleClass("active",i)})},t.Q5=r,t.UppercaseTransformer=o,t.GreateTransformer=a,t.LessTransformer=s,t.ToIntTransformer=l,t.ToFloatTransformer=d,t.ToAsciiTransformer=h,t.ReplaceEmptyTransformer=p,t.SimpleStringBinder=c,t.FloatBinder=u,t.SessionBinder=_,t.BarTimeBinder=f,t.SymbolBinder=g,t.SimpleComboBinder=v,t.StaticContentBinder=m,t.BooleanBinder=y,t.DisabledBinder=w,t.ActionBinder=b,t.ColorBinding=S,t.SliderBinder=C,t.CheckboxWVBinding=L,t.RangeBinder=E},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i)}var n=i(177);inherit(r,n),e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.FloatBinder,s=o.SimpleComboBinder,l=o.BooleanBinder,d=o.ColorBinding,h=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(this._table);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");if(o.appendTo(n),e){var p=$("<td>");p.appendTo(r);var c=$("<input type='text'>");c.appendTo(p),c.css("width","70px"),this.bindControl(new a(c,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else $("<td>"+$.t("Trend Line")+"</td>").appendTo(r);var u=$("<td class='colorpicker-cell'>");u.appendTo(r);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(r);var g=TradingView.createLineWidthEditor();if(g.appendTo(f),!e){var v=$("<td>");v.appendTo(r);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new s(m,t.linestyle,parseInt,!0,this.model(),"Change Fib Speed Resistance Arcs Style"))}this.bindControl(new l(o,t.visible,!0,this.model(),"Change Fib Speed Resistance Arcs Visibility")),this.bindControl(new d(_,t.color,!0,this.model(),"Change Fib Speed Resistance Arcs Line Color",0)),this.bindControl(new h(g,t.linewidth,!0,this.model(),"Change Fib Speed Resistance Arcs Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var e=1;11>=e;e++){var t="level"+e;this.addLevelEditor("Level "+e,this._linetool.properties()[t],!1)}var i=$("<input type='checkbox' class='visibility-switch'>"),r=this.addLabeledRow(this._table,$.t("Levels"));$("<td>").append(i).prependTo(r),this.bindControl(new l(i,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Speed Resistance Arcs Levels Visibility"));var n=$("<input type='checkbox' class='visibility-switch'>"),r=this.addLabeledRow(this._table,$.t("Full Circles"));$("<td>").append(n).prependTo(r),this.bindControl(new l(n,this._linetool.properties().fullCircles,!0,this.model(),"Change Fib Speed Resistance Arcs Full Cirlces Mode"));var r=$("<tr>");r.appendTo(this._table);var o=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(o).appendTo(r),$("<td>"+$.t("Background")+"</td>").appendTo(r);var a=TradingView.createTransparencyEditor();$('<td colspan="3">').append(a).appendTo(r),this.bindControl(new l(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Arcs Background Visibility")),this.bindControl(new h(a,this._linetool.properties().transparency,!0,this.model(),"Change Fib Arcs Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SliderBinder,s=o.ColorBinding;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=this.createColorPicker(),t=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background");$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i);var r=TradingView.createLineWidthEditor(),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border");$("<td>").append(n).appendTo(i),$("<td>").appendTo(i),$("<td>").append(r).appendTo(i),this.bindControl(new s(n,this._linetool.properties().trendline.color,!0,this.model(),"Change Projection Line Color")),this.bindControl(new s(e,this._linetool.properties().color1,!0,this.model(),"Change Projection Background Color",this._linetool.properties().transparency)),this.bindControl(new s(t,this._linetool.properties().color2,!0,this.model(),"Change Projection Background Color",this._linetool.properties().transparency)),this.bindControl(new a(r,this._linetool.properties().linewidth,!0,this.model(),"Change Projection Border Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t,i),this.prepareLayout()}var n=i(96).LineToolElliott,o=i(178),a=i(179),s=a.SimpleComboBinder,l=a.ColorBinding,d=a.SliderBinder,h=a.BooleanBinder;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=n.degrees,t=this.createKeyCombo(e);t.width(300);var i=this.createColorPicker(),r=($('<input type="checkbox" class="visibility-switch">'),$('<input type="checkbox" class="visibility-switch">')),o=this.addLabeledRow(this._table,"Degree");$("<td>").prependTo(o),$("<td>").append(t).appendTo(o);var o=this.addLabeledRow(this._table,"Line Width"),a=TradingView.createLineWidthEditor();$("<td>").prependTo(o),$("<td>").append(a).appendTo(o);var o=this.addLabeledRow(this._table,"Color");$("<td>").prependTo(o),$("<td>").append(i).appendTo(o);var o=this.addLabeledRow(this._table,"Show Wave",r);$("<td>").append(r).prependTo(o),this.bindControl(new l(i,this._linetool.properties().color,!0,this.model(),"Change Elliott Label Color")),this.bindControl(new s(t,this._linetool.properties().degree,parseInt,!0,this.model(),"Change Elliott Wave Size")),this.bindControl(new h(r,this._linetool.properties().showWave,!0,this.model(),"Change Elliott Labels Background")),this.bindControl(new d(a,this._linetool.properties().linewidth,parseInt,this.model(),"Change Elliott Wave Line Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){a.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(185),o=i(179),a=o.Q5,s=o.BooleanBinder,l=o.SimpleComboBinder,d=i(186).StudyStylesPropertyPage;inherit(r,a),inherit(r,n),r.prototype.prepareLayout=function(){var e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$('<table class="property-page" cellspacing="0" cellpadding="2">'),i=$('<table class="property-page" cellspacing="0" cellpadding="2">'),r=$('<table class="property-page" cellspacing="0" cellpadding="2">'),n=$('<table class="property-page" cellspacing="0" cellpadding="2">'),o=this.Z99.properties();this._prepareSeriesStyleLayout(e,t,i,o),this._table=e.add(t).add(i).add(r).add(n);var a=$('<input type="checkbox">'),h=this.addLabeledRow(r,"Price Line",a);$("<td>").append(a).prependTo(h),this.bindControl(new s(a,o.showPriceLine,!0,this.model(),"Change Price Price Line"));var p=this.createSeriesMinTickEditor(),c=$("<tr>");c.appendTo(n),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(c),$("<td>").append(p).appendTo(c),this.bindControl(new l(p,o.minTick,null,!0,this.model(),"Change MinTick")),d.prototype._putStudyDefaultStyles.call(this,n)},r.prototype.loadData=function(){this.superclass.prototype.loadData.call(this),this.switchStyle()},r.prototype.switchStyle=function(){$(this._barsTbody).add(this._barsColorerTbody).add(this._candlesTbody).add(this._candlesColorerTbody).add(this._hollowCandlesTbody).add(this._lineTbody).add(this._areaTbody).css("display","none");switch(this.Z99.properties().style.value()){case TradingView.Series.STYLE_BARS:this._barsTbody.css("display","table-row-group"),this._barsColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_CANDLES:this._candlesTbody.css("display","table-row-group"),this._candlesColorerTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_HOLLOW_CANDLES:this._hollowCandlesTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_LINE:this._lineTbody.css("display","table-row-group");break;case TradingView.Series.STYLE_AREA:this._areaTbody.css("display","table-row-group")}},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(){}var n=i(179),o=n.Q5,a=n.GreateTransformer,s=n.LessTransformer,l=n.ToIntTransformer,d=n.ToFloatTransformer,h=n.SimpleStringBinder,p=n.SimpleComboBinder,c=n.ColorBinding,u=n.BooleanBinder,_=n.SliderBinder;inherit(r,o),r.prototype.getInputTitle=function(e,t){return t.inputInfo?t.inputInfo[e].name.value():e.toLowerCase().replace(/\b\w/g,function(e){return e.toUpperCase()})},r.prototype.prepareLayoutImpl=function(e,t,i,r){function n(t){u.refreshStateControls(c,e.inputs,i.inputs)}function o(e){return(new TradingView.NumericFormatter).format(e)}r=r||{};for(var c={},u=this,_=0;_<e.inputs.length;_++){var f=e.inputs[_],g=f.id,v=this.getInputTitle(g,i),m=$("<tr/>");m.appendTo(t);var y=$("<td/>");y.appendTo(m),y.addClass("propertypage-name-label"),y.text($.t(v));var w=$("<td"+(r.valueColspan?' colspan = "'+r.valueColspan+'"':"")+"/>");w.appendTo(m);var T=null;if(f.options)for(var T=$("<select/>"),b=0;b<f.options.length;b++){var S=f.options[b];$("<option value='"+S+"'>"+$.t(S)+"</option>").appendTo(T)}else{var T=$("<input/>");"bool"===f.type?T.attr("type","checkbox"):T.attr("type","text")}T.appendTo(w),T.css("width","100px");var C,x="Change "+v;if(f.options)this.bindControl(new p(T,i.inputs[g],null,!0,this.model(),x));else if("integer"===f.type)C=[l(f.defval)],f.min&&C.push(a(f.min)),f.max&&C.push(s(f.max)),this.bindControl(new h(T,i.inputs[g],C,!1,this.model(),x)),T.addClass("ticker");else if("float"===f.type){if(C=[d(f.defval)],f.min){var P;if(("BarSetRenko@tv-prostudies"==e.id||"BarSetPnF@tv-prostudies"==e.id)&&"boxSize"==f.id||"BarSetKagi@tv-prostudies"==e.id&&"reversalAmount"==f.id){var L=this.Z98.model().mainSeries().symbolInfo();P=L.minmov/L.pricescale}C.push(a(P?P:f.min))}f.max&&C.push(s(f.max));var E=new h(T,i.inputs[g],C,!1,this.model(),x);E.addFormatter(o),this.bindControl(E),T.addClass("ticker")}else"text"===f.type&&this.bindControl(new h(T,this._property.inputs[g],null,!1,this.model(),x));T.change(n),c[f.id]=m}this.refreshStateControls(c,e.inputs,i.inputs)},r.prototype.getMetaInfo=function(e){for(var t=this.Z98.m_model._studiesMetaData,i=0;i<t.length;i++)if(t[i].id===e)return t[i];return null},r.prototype._prepareSeriesStyleLayout=function(e,t,r,n){var o=i(184),a=$("<tbody>").appendTo(e),s=this._candlesColorerTbody=$("<tbody>").appendTo(t),l=this._barsColorerTbody=$("<tbody>").appendTo(t),d=this._haColorerTbody=$("<tbody>").appendTo(t),h=this._candlesTbody=$("<tbody>").appendTo(r),f=this._hollowCandlesTbody=$("<tbody>").appendTo(r),g=this._haTbody=$("<tbody>").appendTo(r),v=this._barsTbody=$("<tbody>").appendTo(r),m=this._lineTbody=$("<tbody>").appendTo(r),y=this._areaTbody=$("<tbody>").appendTo(r),w=this._renkoTbody=$("<tbody>").appendTo(r),T=this._pbTbody=$("<tbody>").appendTo(r),b=this._kagiTbody=$("<tbody>").appendTo(r),S=this._pnfTbody=$("<tbody>").appendTo(r),C=this.addLabeledRow(a,"Style"),x=$(document.createElement("td")).appendTo(C);x.addClass("property-wide-select");var P=$(document.createElement("select"));$("<option value="+TradingView.Series.STYLE_BARS+">"+$.t("Bars")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_CANDLES+">"+$.t("Candles")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_HOLLOW_CANDLES+">"+$.t("Hollow Candles")+"</option>").appendTo(P),this instanceof o||$("<option value="+TradingView.Series.STYLE_HEIKEN_ASHI+">"+$.t("Heikin Ashi")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_LINE+">"+$.t("Line")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_AREA+">"+$.t("Area")+"</option>").appendTo(P),P.css("width","100px").appendTo(x),this.switchStyle();var L=function(e){this._undoModel.setChartStyleProperty(this._property,e,this._undoText)};this.bindControl(new p(P,n.style,parseInt,!0,this.model(),"Change Series Style",L)),n.style.listeners().subscribe(this,this.switchStyle);var E=this.createColorPicker(),V=this.createColorPicker(),I=this.createColorPicker(),A=this.createColorPicker(),k=this.createColorPicker(),R=this.createColorPicker(),M=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(k).add(R)),O=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(I)),D=$("<input type='checkbox'/>"),B=this.addLabeledRow(s,"Color bars based on previous close",D);$("<td>").append(D).prependTo(B);var B=this.addLabeledRow(h,"Candles");$("<td>").prependTo(B),$("<td>").append(E).appendTo(B),$("<td>").append(V).appendTo(B);var B=this.addLabeledRow(h,"Borders",M);$("<td>").append(M).prependTo(B),$("<td>").append(k).appendTo(B),$("<td>").append(R).appendTo(B);var B=this.addLabeledRow(h,"Wick",O);$("<td>").append(O).prependTo(B),$("<td>").append(I).appendTo(B),$("<td>").append(A).appendTo(B),this.bindControl(new c(E,n.candleStyle.upColor,!0,this.model(),"Change Candle Up Color")),this.bindControl(new c(V,n.candleStyle.downColor,!0,this.model(),"Change Candle Down Color")),this.bindControl(new u(O,n.candleStyle.drawWick,!0,this.model(),"Change Candle Wick Visibility")),this.bindControl(new c(I,n.candleStyle.wickUpColor,!0,this.model(),"Change Candle Wick Up Color")),this.bindControl(new c(A,n.candleStyle.wickDownColor,!0,this.model(),"Change Candle Wick Down Color")),this.bindControl(new u(M,n.candleStyle.drawBorder,!0,this.model(),"Change Candle Border Visibility")),this.bindControl(new c(k,n.candleStyle.borderUpColor,!0,this.model(),"Change Candle Up Border Color")),this.bindControl(new c(R,n.candleStyle.borderDownColor,!0,this.model(),"Change Candle Down Border Color")),this.bindControl(new u(D,n.candleStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close"));var N=this.createColorPicker(),F=this.createColorPicker(),W=this.createColorPicker(),H=this.createColorPicker(),z=this.createColorPicker(),U=this.createColorPicker(),G=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(z).add(U)),j=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(W)),B=this.addLabeledRow(f,"Candles");$("<td>").prependTo(B),$("<td>").append(N).appendTo(B),$("<td>").append(F).appendTo(B);var B=this.addLabeledRow(f,"Borders",G);$("<td>").append(G).prependTo(B),$("<td>").append(z).appendTo(B),$("<td>").append(U).appendTo(B);var B=this.addLabeledRow(f,"Wick",j);$("<td>").append(j).prependTo(B),$("<td>").append(W).appendTo(B),$("<td>").append(H).appendTo(B),this.bindControl(new c(N,n.hollowCandleStyle.upColor,!0,this.model(),"Change Hollow Candle Up Color")),this.bindControl(new c(F,n.hollowCandleStyle.downColor,!0,this.model(),"Change Hollow Candle Down Color")),this.bindControl(new u(j,n.hollowCandleStyle.drawWick,!0,this.model(),"Change Hollow Candle Wick Visibility")),this.bindControl(new c(W,n.hollowCandleStyle.wickUpColor,!0,this.model(),"Change Hollow Candle Wick Up Color")),this.bindControl(new c(H,n.hollowCandleStyle.wickDownColor,!0,this.model(),"Change Hollow Candle Down Wick Color")),this.bindControl(new u(G,n.hollowCandleStyle.drawBorder,!0,this.model(),"Change Hollow Candle Border Visibility")),this.bindControl(new c(z,n.hollowCandleStyle.borderUpColor,!0,this.model(),"Change Hollow Candle Up Border Color")),this.bindControl(new c(U,n.hollowCandleStyle.borderDownColor,!0,this.model(),"Change Hollow Candle Down Border Color"));var q=$("<input type='checkbox'/>"),B=this.addLabeledRow(l,"Color bars based on previous close",q);$("<td>").append(q).prependTo(B);var Y=$("<input type='checkbox'/>"),B=this.addLabeledRow(l,"HLC Bars",Y);$("<td>").append(Y).prependTo(B);var K=this.addColorPickerRow(v,"Up Color"),X=this.addColorPickerRow(v,"Down Color");this.bindControl(new c(K,n.barStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new c(X,n.barStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new u(q,n.barStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close")),this.bindControl(new u(Y,n.barStyle.dontDrawOpen,!0,this.model(),"Change HLC Bars"));var J=TradingView.createPriceSourceEditor(),B=this.addLabeledRow(m,"Price Source");$('<td colspan="3">').append(J).appendTo(B);var Z=this.addLabeledRow(m,"Type"),Q=$('<td colspan="3">').appendTo(Z);Q.addClass("property-wide-select");var ee=$(document.createElement("select"));$("<option value="+TradingView.Series.STYLE_LINE_TYPE_SIMPLE+">"+$.t("Simple")+"</option>").appendTo(ee),$("<option value="+TradingView.Series.STYLE_LINE_TYPE_MARKERS+">"+$.t("With Markers")+"</option>").appendTo(ee),$("<option value="+TradingView.Series.STYLE_LINE_TYPE_STEP+">"+$.t("Step")+"</option>").appendTo(ee),ee.appendTo(Q);var B=this.addLabeledRow(m,"Line"),te=this.createColorPicker(),ie=TradingView.createLineWidthEditor();if($("<td>").append(te).appendTo(B),$("<td>").append(ie).appendTo(B),this.bindControl(new p(J,n.lineStyle.priceSource,null,!0,this.model(),"Change Price Source")),this.bindControl(new p(ee,n.lineStyle.styleType,parseInt,!0,this.model(),"Change Line Type")),this.bindControl(new c(te,n.lineStyle.color,!0,this.model(),"Change Line Color")),this.bindControl(new _(ie,n.lineStyle.linewidth,!0,this.model(),"Change Line Width")),n.haStyle){var re=this.createColorPicker(),ne=this.createColorPicker(),oe=this.createColorPicker(),ae=this.createColorPicker(),se=this.createColorPicker(),le=this.createColorPicker(),de=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(se).add(le)),he=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(oe)),pe=$("<input type='checkbox'/>"),ce=$("<input type='checkbox'/>"),B=this.addLabeledRow(d,$.t("Show real prices on price scale (instead of Heikin-Ashi price)"),ce);$("<td>").append(ce).prependTo(B);var B=this.addLabeledRow(d,$.t("Color bars based on previous close"),pe);$("<td>").append(pe).prependTo(B);var B=this.addLabeledRow(g,$.t("Candles"));$("<td>").prependTo(B),$("<td>").append(re).appendTo(B),$("<td>").append(ne).appendTo(B);var B=this.addLabeledRow(g,$.t("Borders"),de);$("<td>").append(de).prependTo(B),$("<td>").append(se).appendTo(B),$("<td>").append(le).appendTo(B);var B=this.addLabeledRow(g,$.t("Wick"),he);$("<td>").append(he).prependTo(B),$("<td>").append(oe).appendTo(B),$("<td>").append(ae).appendTo(B),this.bindControl(new c(re,n.haStyle.upColor,!0,this.model(),"Change Heikin Ashi Up Color")),this.bindControl(new c(ne,n.haStyle.downColor,!0,this.model(),"Change Heikin Ashi Down Color")),this.bindControl(new u(he,n.haStyle.drawWick,!0,this.model(),"Change Heikin Ashi Wick Visibility")),this.bindControl(new c(oe,n.haStyle.wickUpColor,!0,this.model(),"Change Heikin Ashi Wick Up Color")),this.bindControl(new c(ae,n.haStyle.wickDownColor,!0,this.model(),"Change Heikin Ashi Wick Down Color")),this.bindControl(new u(de,n.haStyle.drawBorder,!0,this.model(),"Change Heikin Ashi Border Visibility")),this.bindControl(new c(se,n.haStyle.borderUpColor,!0,this.model(),"Change Heikin Ashi Up Border Color")),this.bindControl(new c(le,n.haStyle.borderDownColor,!0,this.model(),"Change Heikin Ashi Down Border Color")),this.bindControl(new u(pe,n.haStyle.barColorsOnPrevClose,!0,this.model(),"Change Color Bars Based On Previous Close")),this.bindControl(new u(ce,n.haStyle.showRealLastPrice,!0,this.model(),"Change Show real prices on price scale (instead of Heiken-Ashi price)"))}if(!(this instanceof o||Z75.enabled("charting_library_base"))){$("<option value="+TradingView.Series.STYLE_RENKO+">"+$.t("Renko")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_PB+">"+$.t("Line Break")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_KAGI+">"+$.t("Kagi")+"</option>").appendTo(P),$("<option value="+TradingView.Series.STYLE_PNF+">"+$.t("Point & Figure")+"</option>").appendTo(P);var ue=this.createColorPicker(),_e=this.createColorPicker(),B=this.addLabeledRow(w,"Up bars");$('<td class="some-colorpicker">').append(ue).append(_e).appendTo(B);var fe=this.createColorPicker(),ge=this.createColorPicker(),B=this.addLabeledRow(w,"Down bars");$('<td class="some-colorpicker">').append(fe).append(ge).appendTo(B);var ve=this.createColorPicker(),me=this.createColorPicker(),B=this.addLabeledRow(w,"Projection up bars");$('<td class="some-colorpicker">').append(ve).append(me).appendTo(B);var ye=this.createColorPicker(),we=this.createColorPicker(),B=this.addLabeledRow(w,"Projection down bars");$('<td class="some-colorpicker">').append(ye).append(we).appendTo(B),this.prepareLayoutImpl(this.getMetaInfo("BarSetRenko@tv-prostudies"),w,n.renkoStyle),this.bindControl(new c(ue,n.renkoStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new c(fe,n.renkoStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new c(ve,n.renkoStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new c(ye,n.renkoStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),this.bindControl(new c(_e,n.renkoStyle.borderUpColor,!0,this.model(),"Change Border Bar Up Color")),this.bindControl(new c(ge,n.renkoStyle.borderDownColor,!0,this.model(),"Change Border Bar Down Color")),this.bindControl(new c(me,n.renkoStyle.borderUpColorProjection,!0,this.model(),"Change Projection Border Bar Up Color")),this.bindControl(new c(we,n.renkoStyle.borderDownColorProjection,!0,this.model(),"Change Projection Border Bar Down Color"));var Te=this.createColorPicker(),be=this.createColorPicker(),B=this.addLabeledRow(T,"Up bars");$('<td class="some-colorpicker">').append(Te).append(be).appendTo(B);var Se=this.createColorPicker(),Ce=this.createColorPicker(),B=this.addLabeledRow(T,"Down bars");$('<td class="some-colorpicker">').append(Se).append(Ce).appendTo(B);var xe=this.createColorPicker(),Pe=this.createColorPicker(),B=this.addLabeledRow(T,"Projection up bars");$('<td class="some-colorpicker">').append(xe).append(Pe).appendTo(B);var Le=this.createColorPicker(),Ee=this.createColorPicker(),B=this.addLabeledRow(T,"Projection down bars");$('<td class="some-colorpicker">').append(Le).append(Ee).appendTo(B),this.prepareLayoutImpl(this.getMetaInfo("BarSetPriceBreak@tv-prostudies"),T,n.pbStyle,{valueColspan:2}),this.bindControl(new c(Te,n.pbStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new c(Se,n.pbStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new c(xe,n.pbStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new c(Le,n.pbStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color")),this.bindControl(new c(be,n.pbStyle.borderUpColor,!0,this.model(),"Change Border Bar Up Color")),this.bindControl(new c(Ce,n.pbStyle.borderDownColor,!0,this.model(),"Change Border Bar Down Color")),this.bindControl(new c(Pe,n.pbStyle.borderUpColorProjection,!0,this.model(),"Change Projection Border Bar Up Color")),this.bindControl(new c(Ee,n.pbStyle.borderDownColorProjection,!0,this.model(),"Change Projection Border Bar Down Color"));var Ve=this.addColorPickerRow(b,"Up bars"),Ie=this.addColorPickerRow(b,"Down bars"),Ae=this.addColorPickerRow(b,"Projection up bars"),ke=this.addColorPickerRow(b,"Projection down bars");this.prepareLayoutImpl(this.getMetaInfo("BarSetKagi@tv-prostudies"),b,n.kagiStyle),this.bindControl(new c(Ve,n.kagiStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new c(Ie,n.kagiStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new c(Ae,n.kagiStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new c(ke,n.kagiStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color"));var Re=this.addColorPickerRow(S,"Up bars"),Me=this.addColorPickerRow(S,"Down bars"),Oe=this.addColorPickerRow(S,"Projection up bars"),$e=this.addColorPickerRow(S,"Projection down bars");this.prepareLayoutImpl(this.getMetaInfo("BarSetPnF@tv-prostudies"),S,n.pnfStyle),this.bindControl(new c(Re,n.pnfStyle.upColor,!0,this.model(),"Change Bar Up Color")),this.bindControl(new c(Me,n.pnfStyle.downColor,!0,this.model(),"Change Bar Down Color")),this.bindControl(new c(Oe,n.pnfStyle.upColorProjection,!0,this.model(),"Change Projection Bar Up Color")),this.bindControl(new c($e,n.pnfStyle.downColorProjection,!0,this.model(),"Change Projection Bar Down Color"))}var De=TradingView.createPriceSourceEditor(),B=this.addLabeledRow(y,"Price Source");$('<td colspan="3">').appendTo(B).append(De);var Be=this.createColorPicker(),Ne=TradingView.createLineWidthEditor(),B=this.addLabeledRow(y,"Line");$("<td>").appendTo(B).append(Be),$('<td colspan="2">').appendTo(B).append(Ne);var Fe=this.createColorPicker(),We=this.createColorPicker(),B=this.addLabeledRow(y,"Fill");$("<td>").appendTo(B).append(Fe),$("<td>").appendTo(B).append(We),this.bindControl(new p(De,n.areaStyle.priceSource,null,!0,this.model(),"Change Price Source")),this.bindControl(new c(Be,n.areaStyle.linecolor,!0,this.model(),"Change Line Color")),this.bindControl(new _(Ne,n.areaStyle.linewidth,!0,this.model(),"Change Line Width")),this.bindControl(new c(Fe,n.areaStyle.color1,!0,this.model(),"Change Line Color",n.areaStyle.transparency)),this.bindControl(new c(We,n.areaStyle.color2,!0,this.model(),"Change Line Color",n.areaStyle.transparency))},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){s.call(this,e,t),this.Z99=i,this._showOnlyConfirmInputs=r,this.prepareLayout()}function n(e,t,i){s.call(this,e,t),this.Z99=i,this.prepareLayout()}function o(e,t,i){s.call(this,e,t),this.Z99=i,this._property=e,this.prepareLayout()}var a=i(179),s=a.Q5,l=a.UppercaseTransformer,d=a.GreateTransformer,h=a.LessTransformer,p=a.ToIntTransformer,c=a.ToFloatTransformer,u=(a.ToAsciiTransformer,a.ReplaceEmptyTransformer,a.SimpleComboBinder),_=a.BooleanBinder,f=a.SymbolBinder,g=a.DisabledBinder,v=a.BarTimeBinder,m=a.ColorBinding,y=a.SliderBinder,w=a.SessionBinder,T=a.SimpleStringBinder;inherit(r,s),r.prototype._addSessionEditor=function(e,t,i,r){if("session"!==i.type)return void TradingView.logError("Session editor adding FAILED: wrong input type.");var n=function(e,t){var i=$("<td/>");i.appendTo(e),i.css("padding-left","0px"),i.css("padding-right","0px");var r=$("<input>");r.attr("type","text"),r.addClass("ticker"),r.css("width","40px"),r.attr("id",t),r.appendTo(i)},o=function(e,t,i){var r=$("<td/>");r.css("padding-left",i),r.css("padding-right",i),r.appendTo(e);var n=$("<div/>");n.appendTo(r),n.append(t),n.css("font-size","150%")},a=$("<table/>");a.appendTo(e);var s=$("<tr/>");s.appendTo(a);var l=["start_hours","start_minutes","end_hours","end_minutes"];n.call(this,s,l[0]),o.call(this,s,":",0),n.call(this,s,l[1]),o.call(this,s,"-",4),n.call(this,s,l[2]),o.call(this,s,":",0),n.call(this,s,l[3]);var d=!1;this.bindControl(new w(s,l,t,d,this.model(),r));
},r.prototype.prepareLayoutImpl=function(e,t){function i(e){return(new TradingView.NumericFormatter).format(e)}for(var r=0;r<e.inputs.length;r++){var n=e.inputs[r],o=n.id;if("first_visible_bar_time"!=o&&"last_visible_bar_time"!=o&&"time"!=n.type&&!n.isHidden&&(!this._showOnlyConfirmInputs||n.confirm)&&void 0===n.groupId){var a=n.name||o.toLowerCase().replace(/\b\w/g,function(e){return e.toUpperCase()}),s="Change "+a,g=$("<tr/>");g.appendTo(t);var m=$("<td/>");m.appendTo(g),m.addClass($.t("propertypage-name-label",{context:"css_class"})),m.text($.t(a,{context:"input"}));var y=$("<td/>");y.appendTo(g);var w=null;if("resolution"===n.type)w=$('<select><option value="1">1</option><option value="3">3</option><option value="5">5</option><option value="15">15</option><option value="30">30</option><option value="45">45</option><option value="60">1'+$.t("h")+'</option><option value="120">2'+$.t("h")+'</option><option value="180">3'+$.t("h")+'</option><option value="D">1'+$.t("d")+'</option><option value="W">1'+$.t("w")+"</option></select>");else if("symbol"===n.type)w=$('<input class="symbol-edit single">'),$68.bindToInput(w);else if("session"===n.type)this._addSessionEditor(y,this._property.inputs[o],n,s);else if(n.options)for(var w=$("<select/>"),b=0;b<n.options.length;b++){var S=n.options[b];$("<option value='"+S+"'>"+S+"</option>").appendTo(w)}else{var w=$("<input/>");"bool"===n.type?w.attr("type","checkbox"):w.attr("type","text")}if(w&&(w.appendTo(y),w.is(":checkbox")||w.css("width","100px")),n.options)this.bindControl(new u(w,this._property.inputs[o],null,!0,this.model(),s));else if("bar_time"===n.type){var C=10;this.bindControl(new v(w,this._property.inputs[o],!0,this.model(),s,this.model().mainSeries(),C)),w.addClass("ticker")}else if("integer"===n.type){var x=[p(n.defval)];(0===n.min||n.min)&&x.push(d(n.min)),(0===n.max||n.max)&&x.push(h(n.max)),this.bindControl(new T(w,this._property.inputs[o],x,!1,this.model(),s)),w.addClass("ticker"),isFinite(n.step)&&n.step>0&&w.attr("data-step",n.step)}else if("float"===n.type){var x=[c(n.defval)];(0===n.min||n.min)&&x.push(d(n.min)),(0===n.max||n.max)&&x.push(h(n.max));var P=new T(w,this._property.inputs[o],x,!1,this.model(),s);P.addFormatter(i),this.bindControl(P),w.addClass("ticker"),isFinite(n.step)&&n.step>0&&w.attr("data-step",n.step)}else"text"===n.type?this.bindControl(new T(w,this._property.inputs[o],null,!1,this.model(),s)):"bool"===n.type?this.bindControl(new _(w,this._property.inputs[o],!0,this.model(),s)):"resolution"===n.type?this.bindControl(new u(w,this._property.inputs[o],l,!0,this.model(),"Change Interval")):"symbol"===n.type&&this.bindControl(new f(w,this._property.inputs[o],!0,this.model(),"Change Symbol"))}}if(this._property.offset){var a=this._property.offset.title?this._property.offset.title.value():$.t("Offset"),w=this.addOffsetEditorRow(t,a),x=[p(this._property.offset.val)];x.push(d(this._property.offset.min)),x.push(h(this._property.offset.max)),this.bindControl(new T(w,this._property.offset.val,x,!1,this.model(),"Undo "+a))}this._property.offsets&&$.each(e.plots,function(e,i){if(this._property.offsets[i.id]){var r=this._property.offsets[i.id];if(void 0===r.isHidden||!r.isHidden.value()){var n=r.title.value(),o=this.addOffsetEditorRow(t,n),a=[p(r.val)];a.push(d(r.min)),a.push(h(r.max)),this.bindControl(new T(o,r.val,a,!1,this.model(),"Undo "+n))}}}.bind(this))},r.prototype.prepareLayout=function(){this._table=$("<table/>"),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=this.Z99.metaInfo();this.prepareLayoutImpl(e,this._table),this.loadData()},r.prototype.widget=function(){return this._table},inherit(n,s),n.prototype.prepareLayout=function(){function e(e){return(new TradingView.NumericFormatter).format(e)}this._table=$("<table/>"),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");for(var t=this.Z99.metaInfo(),i={},r=0;r<t.plots.length;++r)if(!(this.Z99.isSelfColorerPlot(r)||this.Z99.isTextColorerPlot(r)||this.Z99.isDataOffsetPlot(r)||this.Z99.isOHLCColorerPlot(r))){var o,a,s=t.plots[r];if(t.styles){if(t.styles[s.id])o=t.styles[s.id].isHidden;else{if(!this.Z99.isOHLCSeriesPlot(r))continue;if(a=t.plots[r].target,i[a])continue;o=t.ohlcPlots[a].isHidden,i[a]=a}if(o)continue}if(this.Z99.isLinePlot(r)||this.Z99.isBarColorerPlot(r)||this.Z99.isBgColorerPlot(r))this._prepareLayoutForPlot(r,s);else if(this.Z99.isPlotArrowsPlot(r))this._prepareLayoutForArrowsPlot(r,s);else if(this.Z99.isPlotCharsPlot(r))this._prepareLayoutForCharsPlot(r,s);else if(this.Z99.isPlotShapesPlot(r))this._prepareLayoutForShapesPlot(r,s);else if(this.Z99.isOHLCSeriesPlot(r)){var l={id:a,type:"ohlc"};this.Z99.isOHLCBarsPlot(r)?this._prepareLayoutForBarsPlot(r,l):this.Z99.isOHLCCandlesPlot(r)&&this._prepareLayoutForCandlesPlot(r,l)}else TradingView.logError("Unknown plot type: "+s.type)}var d=this.Z99.properties().bands;if(d&&d.childCount()>0)for(var r=0;r<d.childCount();r++){var h=d[r];if(!h.isHidden||!h.isHidden.value()){var p=$('<tr class="line"/>');p.appendTo(this._table);var f=$("<td/>");f.appendTo(p);var g=$("<input type='checkbox' class='visibility-switch'/>");g.appendTo(f);var v=h.name.value(),w=this.createLabeledCell(v,g).appendTo(p).addClass($.t("propertypage-name-label",{context:"css_class"})),b=$("<td/>");b.appendTo(p),b.addClass("colorpicker-cell");var S=TradingView.addColorPicker(b),C=$("<td/>");C.appendTo(p);var x=TradingView.createLineWidthEditor();x.appendTo(C);var P=$('<td colspan="4">').css({whiteSpace:"nowrap"});P.appendTo(p);var L=TradingView.createLineStyleEditor();L.render().appendTo(P);var E=$("<input class='property-page-bandwidth' type='text'/>");E.appendTo(P);var V=[c(h.value.value())],I="Change band",A=new T(E,h.value,V,!1,this.model(),I);A.addFormatter(e),this.bindControl(A),this.bindControl(new _(g,h.visible,!0,this.model(),I)),this.bindControl(new m(S,h.color,!0,this.model(),I)),this.bindControl(new u(L,h.linestyle,parseInt,!0,this.model(),I)),this.bindControl(new y(x,h.linewidth,!0,this.model(),I))}}if(this.Z99.properties().bandsBackground){var h=this.Z99.properties().bandsBackground,k=$.t("Background"),I=$.t("Change band background"),p=this._prepareFilledAreaBackground(h.fillBackground,h.backgroundColor,h.transparency,k,I);p.appendTo(this._table)}if(this.Z99.properties().areaBackground){var h=this.Z99.properties().areaBackground,k=$.t("Background"),I=$.t("Change area background"),p=this._prepareFilledAreaBackground(h.fillBackground,h.backgroundColor,h.transparency,k,I);p.appendTo(this._table)}var R=t.filledAreas;if(void 0!==R)for(var r=0;r<R.length;++r){var M=R[r];if(!M.isHidden){var h=this.Z99.properties().filledAreasStyle[M.id],k=M.title||$.t("Background"),I="Change "+k,p=this._prepareFilledAreaBackground(h.visible,h.color,h.transparency,k,I);p.appendTo(this._table)}}for(var O in t.graphics){var D=t.graphics[O];for(var B in D){var h=this._property.graphics[O][B];n["_createRow_"+O].call(this,this._table,h)}}var N=this._table.find(".visibility-switch.plot-visibility-switch");if(1==N.length){var f=N.parent();f.css("display","none");var w=this._table.find(".propertypage-plot-with-palette");1==w.length?w.css("display","none"):(w=this._table.find(".propertypage-name-label"),w.css("padding-left",0),w.find("label").attr("for",""))}var F=this._prepareStudyPropertiesLayout();if(this._table=this._table.add(F),TradingView.StudyMetaInfo.isScriptStrategy(t)){var W=this._prepareOrdersSwitches();this._table=this._table.add(W)}this.loadData()},n.prototype._prepareOrdersSwitches=function(){var e=$('<table class="property-page study-strategy-properties" cellspacing="0" cellpadding="2">'),t="chart-orders-switch_"+Date.now().toString(36),i=$("<tr>").appendTo(e),r=$('<input id="'+t+'" type="checkbox">').appendTo($("<td>").appendTo(i)),n=($('<label for="'+t+'">'+$.t("Trades on Chart")+"</label>").appendTo($("<td>").appendTo(i)),"chart-orders-labels-switch_"+Date.now().toString(36)),o=$("<tr>").appendTo(e),a=$('<input id="'+n+'" type="checkbox">').appendTo($("<td>").appendTo(o)),s=($('<label for="'+n+'">'+$.t("Signal Labels")+"</label>").appendTo($("<td>").appendTo(o)),"chart-orders-qty-switch_"+Date.now().toString(36)),l=$("<tr>").appendTo(e),d=$('<input id="'+s+'" type="checkbox">').appendTo($("<td>").appendTo(l)),h=($('<label for="'+s+'">'+$.t("Quantity")+"</label>").appendTo($("<td>").appendTo(l)),this.Z99.properties());return this.bindControl(new _(r,h.strategy.orders.visible,!0,this.model(),"Trades on chart visibility")),this.bindControl(new _(a,h.strategy.orders.showLabels,!0,this.model(),"Signal labels visibility")),this.bindControl(new g(a,h.strategy.orders.visible,!0,this.model(),"Signal labels visibility",!0)),this.bindControl(new _(d,h.strategy.orders.showQty,!0,this.model(),"Quantity visibility")),this.bindControl(new g(d,h.strategy.orders.visible,!0,this.model(),"Quantity visibility",!0)),e},n.prototype._prepareLayoutForPlot=function(e,t){var i=t.id,r=this.Z99.properties().styles[i],n=this._findPlotPalette(e,t),o=n.palette,a=n.paletteProps,s="Change "+i;if(o){var l=$('<tr class="line"/>');l.appendTo(this._table);var d=$("<td/>");d.appendTo(l),d.addClass("visibility-cell");var h=$("<input type='checkbox' class='visibility-switch plot-visibility-switch'/>");h.appendTo(d),this.bindControl(new _(h,r.visible,!0,this.model(),s));var p=r.title.value();this.createLabeledCell(p,h).appendTo(l).addClass("propertypage-name-label propertypage-plot-with-palette",{context:"css_class"}),this._prepareLayoutForPalette(e,t,o,a,s)}else{var l=$('<tr class="line"/>');l.appendTo(this._table);var d=$("<td/>");d.appendTo(l),d.addClass("visibility-cell");var h=$("<input type='checkbox' class='visibility-switch plot-visibility-switch'/>");h.appendTo(d);var p=this.Z99.properties().styles[i].title.value(),c=(this.createLabeledCell(p,h).appendTo(l).addClass($.t("propertypage-name-label",{context:"css_class"})),$("<td/>"));c.appendTo(l),c.addClass("colorpicker-cell");var f=TradingView.addColorPicker(c),g=$("<td/>");g.appendTo(l);var v=TradingView.createLineWidthEditor();v.appendTo(g);var w=$("<td>");w.appendTo(l);var T=TradingView.createPlotEditor();T.appendTo(w);var b=$("<td>");b.appendTo(l);var S=$("<input type='checkbox'>");S.appendTo(b),this.createLabeledCell("Price Line",S).appendTo(l),this.bindControl(new _(h,r.visible,!0,this.model(),s)),this.bindControl(new m(f,r.color,!0,this.model(),s,r.transparency)),this.bindControl(new y(v,r.linewidth,!0,this.model(),s,this.Z99.metaInfo().isTVScript)),this.bindControl(new u(T,r.plottype,parseInt,!0,this.model(),s)),this.bindControl(new _(S,r.trackPrice,!0,this.model(),"Change Price Line"))}},n.prototype._prepareLayoutForBarsPlot=function(e,t){var i=t.id,r=this.Z99.properties().ohlcPlots[i],n=this._findPlotPalette(e,t),o=n.palette,a=n.paletteProps,s="Change "+i,l=$('<tr class="line"/>');l.appendTo(this._table);var d=$("<td/>");d.appendTo(l),d.addClass("visibility-cell");var h=$("<input type='checkbox' class='visibility-switch'/>");h.appendTo(d),this.bindControl(new _(h,r.visible,!0,this.model(),s));var p=r.title.value();this.createLabeledCell(p,h).appendTo(l).addClass("propertypage-name-label",{context:"css_class"});if(o){var c=!0;this._prepareLayoutForPalette(e,t,o,a,s,c)}else{var u=$("<td/>");u.appendTo(l),u.addClass("colorpicker-cell");var f=TradingView.addColorPicker(u);this.bindControl(new m(f,r.color,!0,this.model(),s))}},n.prototype._prepareLayoutForCandlesPlot=function(e,t){this._prepareLayoutForBarsPlot(e,t);var i=t.id,r=this.Z99.properties().ohlcPlots[i],n="Change "+i,o=$('<tr class="line"/>');o.appendTo(this._table);var a=$("<td/>");a.appendTo(o),a.addClass("visibility-cell");var s=$("<input type='checkbox' class='visibility-switch'/>");s.appendTo(a),this.bindControl(new _(s,r.drawWick,!0,this.model(),n));var l="Wick",d=(this.createLabeledCell(l,s).appendTo(o),$("<td/>"));d.appendTo(o),d.addClass("colorpicker-cell");var h=TradingView.addColorPicker(d);this.bindControl(new m(h,r.wickColor,!0,this.model(),n))},n.prototype._prepareLayoutForShapesPlot=function(e,t){var i=t.id,r=this.Z99.properties().styles[i],n=this._findPlotPalette(e,t),o=n.palette,a=n.paletteProps,s="Change "+i,l=$('<tr class="line"/>');l.appendTo(this._table);var d=$("<td/>");d.appendTo(l),d.addClass("visibility-cell");var h=$("<input type='checkbox' class='visibility-switch'/>");h.appendTo(d),this.bindControl(new _(h,r.visible,!0,this.model(),s));var p=this.Z99.properties().styles[i].title.value(),c=(this.createLabeledCell(p,h).appendTo(l).addClass("propertypage-name-label",{context:"css_class"}),$("<td/>"));c.appendTo(l);var f=TradingView.createShapeStyleEditor();f.appendTo(c),this.bindControl(new u(f,r.plottype,null,!0,this.model(),s));var g=$("<td/>");g.appendTo(l);var v=TradingView.createShapeLocationEditor();if(v.appendTo(g),this.bindControl(new u(v,r.location,null,!0,this.model(),s)),o)this._prepareLayoutForPalette(e,t,o,a,s);else{var l=$('<tr class="line"/>');l.appendTo(this._table),$("<td/>").appendTo(l),$("<td/>").appendTo(l);var y=$("<td/>");y.appendTo(l),y.addClass("colorpicker-cell");var w=TradingView.addColorPicker(y);this.bindControl(new m(w,r.color,!0,this.model(),s,r.transparency))}},n.prototype._prepareLayoutForCharsPlot=function(e,t){var i=t.id,r=this.Z99.properties().styles[i],n=this._findPlotPalette(e,t),o=n.palette,a=n.paletteProps,s="Change "+i,l=$('<tr class="line"/>');l.appendTo(this._table);var d=$("<td/>");d.appendTo(l),d.addClass("visibility-cell");var h=$("<input type='checkbox' class='visibility-switch'/>");h.appendTo(d),this.bindControl(new _(h,r.visible,!0,this.model(),s));var p=this.Z99.properties().styles[i].title.value(),c=(this.createLabeledCell(p,h).appendTo(l).addClass($.t("propertypage-name-label",{context:"css_class"})),$("<td/>"));c.appendTo(l);var f=TradingView.createTextEditor();f.appendTo(c),f.keyup(function(){var e=$(this),t=e.val();t&&(e.val(t.split("")[t.length-1]),e.change())}),this.bindControl(new T(f,r["char"],null,!1,this.model(),s));var g=$("<td/>");g.appendTo(l);var v=TradingView.createShapeLocationEditor();if(v.appendTo(g),this.bindControl(new u(v,r.location,null,!0,this.model(),s)),o)this._prepareLayoutForPalette(e,t,o,a,s);else{var l=$('<tr class="line"/>');l.appendTo(this._table),$("<td/>").appendTo(l),$("<td/>").appendTo(l);var y=$("<td/>");y.appendTo(l),y.addClass("colorpicker-cell");var w=TradingView.addColorPicker(y);this.bindControl(new m(w,r.color,!0,this.model(),s,r.transparency))}},n.prototype._isStyleNeedsConnectPoints=function(e){return[TradingView.StudyConsts.PLOT_CROSS,TradingView.StudyConsts.PLOT_CIRCLES].indexOf(e)>=0},n.prototype._prepareLayoutForPalette=function(e,t,i,r,n,o){var a=e,s=t.id,l=null;l=o?this.Z99.properties().ohlcPlots[s]:this.Z99.properties().styles[s];var d=0;for(var h in i.colors){var p=r.colors[h],c=$('<tr class="line"/>');c.appendTo(this._table),$("<td/>").appendTo(c);var f=$("<td/>");f.appendTo(c),f.addClass($.t("propertypage-name-label",{context:"css_class"})),f.html($.t(p.name.value()));var g=$("<td/>");g.appendTo(c),g.addClass("colorpicker-cell");var v=TradingView.addColorPicker(g);if(this.bindControl(new m(v,p.color,!0,this.model(),n,l.transparency)),this.Z99.isLinePlot(a)){var w=$("<td/>");w.appendTo(c);var T=TradingView.createLineWidthEditor();T.appendTo(w),this.bindControl(new y(T,p.width,!0,this.model(),n));var b=$("<td>");if(b.appendTo(c),0===d){var S=TradingView.createPlotEditor();S.appendTo(b),this.bindControl(new u(S,l.plottype,parseInt,!0,this.model(),n));var C=$("<input type='checkbox'>"),x=$('<td colspan="4">').css({whiteSpace:"nowrap"}),P=$("<span>").html($.t("Price Line")),L=$("<span>");L.append(C),x.append(L).append(P).appendTo(c),this.bindControl(new _(C,l.trackPrice,!0,this.model(),"Change Price Line"))}}d++}},n.prototype._prepareLayoutForArrowsPlot=function(e,t){var i=t.id,r=this.Z99.properties().styles[i],n="Change "+i,o=$('<tr class="line"/>');o.appendTo(this._table);var a=$("<td/>");a.appendTo(o),a.addClass("visibility-cell");var s=$("<input type='checkbox' class='visibility-switch'/>");s.appendTo(a);var l=this.Z99.properties().styles[i].title.value(),d=(this.createLabeledCell(l,s).appendTo(o).addClass($.t("propertypage-name-label",{context:"css_class"})),$("<td/>"));d.appendTo(o),d.addClass("colorpicker-cell");var h=TradingView.addColorPicker(d),p=$("<td/>");p.appendTo(o),p.addClass("colorpicker-cell");var c=TradingView.addColorPicker(p);this.bindControl(new _(s,r.visible,!0,this.model(),n)),this.bindControl(new m(h,r.colorup,!0,this.model(),n,r.transparency)),this.bindControl(new m(c,r.colordown,!0,this.model(),n,r.transparency))},n.prototype._findPlotPalette=function(e,t){var i=e,r=t.id,n=null,o=null,a=this.Z99.metaInfo().plots;if(this.Z99.isBarColorerPlot(i)||this.Z99.isBgColorerPlot(i))n=this.Z99.metaInfo().palettes[t.palette],o=this.Z99.properties().palettes[t.palette];else for(var s=0;s<a.length;s++)if(a[s].target===r&&(this.Z99.isSelfColorerPlot(s)||this.Z99.isOHLCColorerPlot(s))){n=this.Z99.metaInfo().palettes[a[s].palette],o=this.Z99.properties().palettes[a[s].palette];break}return{palette:n,paletteProps:o}},n.prototype._prepareStudyPropertiesLayout=function(){var e=$('<table class="property-page study-properties" cellspacing="0" cellpadding="2">');if(!this.Z99.metaInfo().is_price_study){var t=this.createPrecisionEditor(),i=$("<tr>");i.appendTo(e),$("<td>"+$.t("Precision")+"</td>").appendTo(i),$("<td>").append(t).appendTo(i),this.bindControl(new u(t,this.Z99.properties().precision,null,!0,this.model(),"Change Precision"))}if("Compare@tv-basicstudies"==this.Z99.metaInfo().id){var t=this.createSeriesMinTickEditor(),i=$("<tr>");i.appendTo(e),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(i),$("<td>").append(t).appendTo(i),this.bindControl(new u(t,this.Z99.properties().minTick,null,!0,this.model(),"Change MinTick"))}return this._putStudyDefaultStyles(e),e},n.prototype._putStudyDefaultStyles=function(e,t){var i=null,r=this.Z99;if(r.properties().linkedToSeries&&r.properties().linkedToSeries.value())return!1;$.each(this.Z98.m_model.panes(),function(e,t){$.each(t.Q17(),function(e,n){return n==r?(i=t,!1):void 0})}),this._pane=i;var n;if(this._pane&&(-1!==this._pane.leftPriceScale().Q17().indexOf(this.Z99)?n="left":-1!==this._pane.rightPriceScale().Q17().indexOf(this.Z99)?n="right":this._pane.isOverlay(this.Z99)&&(n="none")),n){var o=this,a=this.createKeyCombo({left:$.t("Scale Left"),right:$.t("Scale Right"),none:$.t("Screen (No Scale)")}).val(n).change(function(){switch(this.value){case"left":o.Z98.move(o.Z99,o._pane,o._pane.leftPriceScale());break;case"right":o.Z98.move(o.Z99,o._pane,o._pane.rightPriceScale());break;case"none":o.Z98.move(o.Z99,o._pane,null)}}),s=this.addRow(e);$("<td>"+$.t("Scale")+"</td>").appendTo(s);var l=$("<td>").appendTo(s).append(a);t&&t>2&&l.attr("colspan",t-1)}return e},n.prototype.widget=function(){return this._table},n.prototype._prepareFilledAreaBackground=function(e,t,i,r,n){var o=$('<tr class="line"/>'),a=$("<td/>");a.appendTo(o);var s=$("<input type='checkbox' class='visibility-switch'/>");s.appendTo(a);var l=(this.createLabeledCell(r,s).appendTo(o).addClass($.t("propertypage-name-label",{context:"css_class"})),$("<td/>"));l.appendTo(o),l.addClass("colorpicker-cell");var d=TradingView.addColorPicker(l);return this.bindControl(new _(s,e,!0,this.model(),n+" visibility")),this.bindControl(new m(d,t,!0,this.model(),n+" color",i)),o},inherit(o,s),o.prototype.prepareLayout=function(){return this.Z99.properties().linkedToSeries&&this.Z99.properties().linkedToSeries.value()?void(this._table=$()):void(this._table=$())},o.prototype.widget=function(){return this._table},n._createRow_horizlines=function(e,t){var i=this.addRow(e),r=t.name.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),o=this.createColorPicker(),a=TradingView.createLineWidthEditor(),s=TradingView.createLineStyleEditor();$("<td>").append(n).appendTo(i),this.createLabeledCell(r,n).appendTo(i),$("<td>").append(o).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(s.render()).appendTo(i),this.bindControl(new _(n,t.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new m(o,t.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new u(s,t.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new y(a,t.width,!0,this.model(),"Change "+r+" width"))},n._createRow_vertlines=function(e,t){var i=this.addRow(e),r=t.name.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),o=this.createColorPicker(),a=TradingView.createLineWidthEditor(),s=TradingView.createLineStyleEditor();$("<td>").append(n).appendTo(i),this.createLabeledCell(r,n).appendTo(i),$("<td>").append(o).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(s.render()).appendTo(i),this.bindControl(new _(n,t.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new m(o,t.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new u(s,t.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new y(a,t.width,!0,this.model(),"Change "+r+" width"))},n._createRow_lines=function(e,t){var i=this.addRow(e),r=t.title.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),o=this.createColorPicker(),a=TradingView.createLineWidthEditor(),s=TradingView.createLineStyleEditor();$("<td>").append(n).appendTo(i),this.createLabeledCell(r,n).appendTo(i),$("<td>").append(o).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(s.render()).appendTo(i),this.bindControl(new _(n,t.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new m(o,t.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new u(s,t.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new y(a,t.width,!0,this.model(),"Change "+r+" width"))},n._createRow_hlines=function(e,t){var i=this.addRow(e),r=t.name.value(),n=$("<input type='checkbox' class='visibility-switch'/>"),o=this.createColorPicker(),a=TradingView.createLineWidthEditor(),s=TradingView.createLineStyleEditor(),l=$("<input type='checkbox'>");if($("<td>").append(n).appendTo(i),this.createLabeledCell(r,n).appendTo(i),$("<td>").append(o).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(s.render()).appendTo(i),$("<td>").appendTo(i),$("<td>").append(l).appendTo(i),this.createLabeledCell("Show Price",l).appendTo(i),this.bindControl(new _(n,t.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new m(o,t.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new u(s,t.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new y(a,t.width,!0,this.model(),"Change "+r+" width")),this.bindControl(new _(l,t.showPrice,!0,this.model(),"Change "+r+" show price")),t.enableText.value()){var i=this.addRow(e);$('<td colspan="2">').appendTo(i);var d=$("<input type='checkbox'>");$('<td class="text-center">').append(d).appendTo(i),this.createLabeledCell("Show Text",d).appendTo(i),this.bindControl(new _(d,t.showText,!0,this.model(),"Change "+r+" show text"));var h=TradingView.createTextPosEditor();$("<td>").append(h.render()).appendTo(i),this.bindControl(new u(h,t.textPos,parseInt,!0,this.model(),"Change "+r+" text position"));var p=this.createFontSizeEditor();$('<td colspan="2">').append(p).appendTo(i),this.bindControl(new u(p,t.fontSize,parseInt,!0,this.model(),"Change "+r+" font size"))}},n._createRow_hhists=function(e,t){var i=t.title.value(),r=[],n=[],o=this.addRow(e),a=TradingView.createVisibilityEditor();$("<td>").append(a).appendTo(o),this.createLabeledCell(i,a).appendTo(o),this.bindControl(new _(a,t.visible,!0,this.model(),"Change "+i+" Visibility"));var o=this.addRow(e),s=$("<input/>");s.attr("type","text"),s.addClass("ticker"),this.createLabeledCell($.t("Width (% of the Box)"),s).appendTo(o),$("<td>").append(s).appendTo(o);var l=[p(40)];l.push(d(0)),l.push(h(100)),this.bindControl(new T(s,t.percentWidth,l,!1,this.model(),"Change Percent Width"));var o=this.addLabeledRow(e,"Placement"),c=TradingView.createHHistDirectionEditor();$("<td>").append(c).appendTo(o),this.bindControl(new u(c,t.direction,null,!0,this.model(),"Change "+i+" Placement"));var o=this.addRow(e),f=$("<input type='checkbox'>");$("<td>").append(f).appendTo(o),this.createLabeledCell($.t("Show Values"),f).appendTo(o),this.bindControl(new _(f,t.showValues,!0,this.model(),"Change "+i+" Show Values"));var o=this.addRow(e),g=this.createColorPicker();this.createLabeledCell($.t("Text Color"),g).appendTo(o),$("<td>").append(g).appendTo(o),this.bindControl(new m(g,t.valuesColor,!0,this.model(),"Change "+i+" Text Color"));for(var v in t.colors)if(isNumber(parseInt(v,10))){var o=this.addRow(e);r[v]=t.titles[v].value(),n[v]=this.createColorPicker(),$("<td>").append(r[v]).appendTo(o),$("<td>").append(n[v]).appendTo(o),this.bindControl(new m(n[v],t.colors[v],!0,this.model(),"Change "+r[v]+" color"))}},n._createRow_backgrounds=function(e,t){var i=this.addRow(e),r=$("<input type='checkbox' class='visibility-switch'/>"),n=t.name.value(),o=this.createColorPicker();$("<td>").append(r).appendTo(i),this.createLabeledCell(n,r).appendTo(i),$("<td>").append(o).appendTo(i),this.bindControl(new _(r,t.visible,!0,this.model(),"Change "+n+" visibility")),this.bindControl(new m(o,t.color,!0,this.model(),"Change "+n+" color",t.transparency))},n._createRow_polygons=function(e,t){var i=this.addRow(e),r=t.name.value(),n=this.createColorPicker();$("<td>").append(r).appendTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new m(n,t.color,!0,this.model(),"Change "+r+" color"))},n._createRow_trendchannels=function(e,t){var i=this.addRow(e),r=t.name.value(),n=this.createColorPicker();$("<td>").append(r).appendTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new m(n,t.color,!0,this.model(),"Change "+r+" color",t.transparency))},n._createRow_textmarks=function(e,t){var i=this.addLabeledRow(e),r=t.name.value(),n=this.createColorPicker(),o=this.createColorPicker(),a=this.createFontEditor(),s=this.createFontSizeEditor(),l=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),d=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(r).appendTo(i),"rectangle"!==t.shape.value()&&$("<td>").append(n).appendTo(i),$("<td>").append(o).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(s).appendTo(i),$("<td>").append(l).appendTo(i),$("<td>").append(d).appendTo(i),this.bindControl(new m(n,t.color,!0,this.model(),"Change "+r+" color",t.transparency)),this.bindControl(new m(o,t.fontColor,!0,this.model(),"Change "+r+" text color",t.transparency)),this.bindControl(new u(s,t.fontSize,parseInt,!0,this.model(),"Change "+r+" font size")),this.bindControl(new u(a,t.fontFamily,null,!0,this.model(),"Change "+r+" font")),this.bindControl(new _(l,t.fontBold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new _(d,t.fontItalic,!0,this.model(),"Change Text Font Italic"))},n._createRow_shapemarks=function(e,t){var i=this.addRow(e),r=$("<input type='checkbox' class='visibility-switch'/>"),n=t.name.value(),o=this.createColorPicker(),a=$("<input/>");a.attr("type","text"),a.addClass("ticker"),$("<td>").append(r).appendTo(i),this.createLabeledCell(n,r).appendTo(i),$("<td>").append(o).appendTo(i),this.createLabeledCell("Size",a).appendTo(i),$("<td>").append(a).appendTo(i),this.bindControl(new _(r,t.visible,!0,this.model(),"Change "+n+" visibility")),this.bindControl(new m(o,t.color,!0,this.model(),"Change "+n+" back color",t.transparency)),this.bindControl(new T(a,t.size,null,!1,this.model(),"Change size"))},TradingView.StudyInputsPropertyPage=r,t.StudyInputsPropertyPage=r,t.StudyStylesPropertyPage=n,t.StudyDisplayPropertyPage=o},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t),this._linetool=i,this.prepareLayout()}var n=i(179).Q5,o=i(186).StudyInputsPropertyPage,a=i(188);inherit(r,a),r.prototype.prepareLayout=function(){var e=i(175),t=$('<table class="property-page" cellspacing="0" cellpadding="0">'),r=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({"layout-tab":e.TAB_NAME_INPUTS,"layout-tab-priority":e.TAB_PRIORITY_INPUTS});this._table=t.add(r);for(var n=this._linetool.points(),a=0;a<n.length;a++){var s=(n[a],$("<tr>"));s.appendTo(t);var l=$("<td>");l.html($.t("Point bar",{point:a+1})),l.appendTo(s);var d=$("<td>");d.appendTo(s);var h=$("<input type='text'>");h.appendTo(d),h.addClass("ticker");var p=this._linetool.properties().points[a];this.bindBarIndex(p.bar,h,this.model(),"Change "+this._linetool+" point bar index")}var c=TradingView.StudyMetaInfo.findStudyMetaInfo(this.Z98.studiesMetaData(),"RegressionTrend@tv-basicstudies");o.prototype.prepareLayoutImpl.call(this,c,r)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this._linetool=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.GreateTransformer,s=n.LessTransformer,l=n.ToIntTransformer,d=n.SimpleStringBinder;inherit(r,o),r.BarIndexPastLimit=-5e4,r.BarIndexFutureLimit=15e3,r.prototype.bindBarIndex=function(e,t,i,n){var o=[l(e.value()),a(r.BarIndexPastLimit),s(r.BarIndexFutureLimit)];this.bindControl(new d(t,e,o,!1,i,n))},r.prototype.createPriceEditor=function(e){var t=this._linetool.ownerSource().formatter(),i=function(e){var i=t.format(e);return i},r=function(e){var i=t.parse(e);return i.res?i.price?i.price:i.value:void 0},n=$("<input type='text'>");if(n.TVTicker({step:t._minMove/t._priceScale||1,formatter:i,parser:r}),e){var o=[function(t){var i=r(t);return void 0===i?e.value():i}];this.bindControl(new d(n,e,o,!1,this.model(),"Change "+this._linetool+" point price")).addFormatter(function(e){return t.format(e)})}return n},r.prototype._createPointRow=function(e,t,i){var r=$("<tr>"),n=$("<td>");n.html($.t("Price")+i),n.appendTo(r);var o=$("<td>");o.appendTo(r);var a=this.createPriceEditor(t.price);a.appendTo(o);var s=$("<td>");s.html($.t("Bar #")),s.appendTo(r);var l=$("<td>");l.appendTo(r);var d=$("<input type='text'>");return d.appendTo(l),d.addClass("ticker"),this.bindBarIndex(t.bar,d,this.model(),"Change "+this._linetool+" point bar index"),r},r.prototype.prepareLayoutForTable=function(e){for(var t=this._linetool.points(),i=t.length,r=0;r<t.length;r++){var n=t[r],o=this._linetool.properties().points[r];if(o){var a=(r||i>1?" "+(r+1):"")+"",s=this._createPointRow(n,o,a);s.appendTo(e)}}},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.prepareLayoutForTable(this._table),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t){o.call(this,e,t),this.prepareLayout()}var n=i(179),o=n.Q5,a=n.SimpleComboBinder;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=this.createKeyCombo({open:$.t("Open"),high:$.t("High"),low:$.t("Low"),close:$.t("Close")}),t=this.addLabeledRow(this._table,$.t("Source",{context:"compare"}));$("<td>").appendTo(t).append(e),this.bindControl(new a(e,this._property.inputs.source,null,!0,this.model(),"Change Price Source")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t),this._linetool=i,this.prepareLayout()}var n=i(179).Q5,o=i(186).StudyInputsPropertyPage,a=i(188);inherit(r,a),r.prototype.prepareLayout=function(){var e=i(175),t=$('<table class="property-page" cellspacing="0" cellpadding="0">'),r=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({
"layout-tab":e.TAB_NAME_INPUTS,"layout-tab-priority":e.TAB_PRIORITY_INPUTS});this._table=t.add(r);for(var n=this._linetool.points(),a=0;a<n.length;a++){var s=(n[a],$("<tr>"));s.appendTo(t);var l=$("<td>");l.html("Point "+(a+1)+" Bar #"),l.appendTo(s);var d=$("<td>");d.appendTo(s);var h=$("<input type='text'>");h.appendTo(d),h.addClass("ticker");var p=this._linetool.properties().points[a];this.bindBarIndex(p.bar,h,this.model(),"Change "+this._linetool+" point bar index")}var c=TradingView.StudyMetaInfo.findStudyMetaInfo(this.Z98.studiesMetaData(),this._linetool.studyId());o.prototype.prepareLayoutImpl.call(this,c,r)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t,i),this.prepareLayout()}function n(e,t,i){a.call(this,e,t,i)}var o=i(178),a=i(188),s=i(179),l=s.BooleanBinder,d=s.SimpleComboBinder,h=s.SimpleStringBinder,p=s.ColorBinding,c=s.SliderBinder;inherit(r,o),r.prototype.prepareLayout=function(){this._res=$("<div>"),this._table=$('<table class="property-page" cellspacing="0" cellpadding="2" style="width:100%"></table>').appendTo(this._res);var e=TradingView.createLineWidthEditor(),t=TradingView.createLineStyleEditor(),i=this.createColorPicker(),r=this.addLabeledRow(this._table,"Line");$("<td>").append(i).appendTo(r),$("<td>").append(e).appendTo(r),$('<td colspan="3">').append(t.render().css("display","block")).appendTo(r);var n=$("<input type='checkbox' class='visibility-switch'>"),r=$("<tr>").appendTo(this._table);$('<td colspan="3">').append($("<label>").append(n).append($.t("Show Price"))).prependTo(r);var o=$("<input type='checkbox'>"),r=$("<tr>").appendTo(this._table);$('<td colspan="3">').append($("<label>").append(o).append($.t("Show Text"))).prependTo(r);var r=this.addLabeledRow(this._table,"Text:"),a=this.createColorPicker(),s=this.createFontSizeEditor(),u=this.createFontEditor(),_=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(a).appendTo(r),$("<td>").append(u).appendTo(r),$("<td>").append(s).appendTo(r),$("<td>").append(_).appendTo(r),$("<td>").append(f).appendTo(r);var r=$("<tr>").appendTo(this._table);$("<td colspan='2'>").append($.t("Text Alignment:")).appendTo(r);var g=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),v=$("<select><option value='bottom'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='top'>"+$.t("bottom")+"</option></select>").data("selectbox-css",{display:"block"});$("<td>").append(g).appendTo(r),$("<td colspan='3'>").append(v).appendTo(r);var m=$("<textarea rows='7' cols='60'>").css("width","100%"),r=$("<tr>").appendTo(this._table);$("<td colspan='7'>").append(m).appendTo(r),this.bindControl(new l(o,this._linetool.properties().showLabel,!0,this.model(),"Change Horz Line Text Visibility")),this.bindControl(new d(g,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Horz Line Labels Alignment")),this.bindControl(new d(v,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Horz Line Labels Alignment")),this.bindControl(new h(m,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new l(n,this._linetool.properties().showPrice,!0,this.model(),"Change Horz Line Price Visibility")),this.bindControl(new p(i,this._linetool.properties().linecolor,!0,this.model(),"Change Horz Line Color")),this.bindControl(new d(t,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Horz Line Style")),this.bindControl(new c(e,this._linetool.properties().linewidth,!0,this.model(),"Change Horz Line Width")),this.bindControl(new d(s,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new d(u,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new p(a,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new l(_,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new l(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.loadData()},r.prototype.widget=function(){return this._res},inherit(n,a),n.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=this._linetool.points()[0];if(e){var t=this._linetool.properties().points[0],i=this.createPriceEditor(t.price),r=$("<tr>").appendTo(this._table);$("<td>"+$.t("Price")+"</td>").appendTo(r),$("<td>").append(i).appendTo(r),this.loadData()}},t.LineToolHorzLineStylesPropertyPage=r,t.LineToolHorzLineInputsPropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t,i),this.prepareLayout()}function n(e,t,i){a.call(this,e,t,i)}var o=i(178),a=i(188),s=i(179),l=s.GreateTransformer,d=s.LessTransformer,h=s.ToFloatTransformer,p=s.ColorBinding,c=s.BooleanBinder,u=s.SimpleComboBinder,_=s.SimpleStringBinder,f=s.SliderBinder;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=this.addLabeledRow(e,$.t("Line"));$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n);var o=$("<tbody>").appendTo(this._table),n=this.addLabeledRow(o,$.t("Text")),a=this.createColorPicker(),s=this.createFontSizeEditor(),l=this.createFontEditor(),d=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),h=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(a).appendTo(n),$("<td>").append(l).appendTo(n),$("<td>").append(s).appendTo(n),$("<td>").append(d).appendTo(n),$("<td>").append(h).appendTo(n);var _=$('<input type="checkbox">'),g=$('<input type="checkbox">'),n=this.addLabeledRow(o,$.t("Extend Right End"));$('<td colspan="3">').appendTo(n).append(_);var n=this.addLabeledRow(o,$.t("Extend Left End"));$('<td colspan="3">').appendTo(n).append(g);var v=$('<input type="checkbox">'),m=$('<input type="checkbox">'),y=$('<input type="checkbox">'),n=this.addLabeledRow(o,$.t("Show Price Range"));$('<td colspan="3">').appendTo(n).append(v);var n=this.addLabeledRow(o,$.t("Show Bars Range"));$('<td colspan="3">').appendTo(n).append(m);var n=this.addLabeledRow(o,$.t("Always Show Stats"));$('<td colspan="3">').appendTo(n).append(y),this.bindControl(new c(v,this._linetool.properties().showPriceRange,!0,this.model(),"Change Trend Line Show Price Range")),this.bindControl(new c(m,this._linetool.properties().showBarsRange,!0,this.model(),"Change Trend Line Show Bars Range")),this.bindControl(new u(s,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new u(l,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new p(a,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new c(d,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new c(h,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.bindControl(new p(r,this._linetool.properties().linecolor,!0,this.model(),"Change Trend Line Color")),this.bindControl(new u(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Trend Line Style")),this.bindControl(new f(t,this._linetool.properties().linewidth,!0,this.model(),"Change Trend Line Width")),this.bindControl(new c(_,this._linetool.properties().extendRight,!0,this.model(),"Change Trend Angle Extending Right")),this.bindControl(new c(g,this._linetool.properties().extendLeft,!0,this.model(),"Change Trend Angle Extending Left")),this.bindControl(new c(y,this._linetool.properties().alwaysShowStats,!0,this.model(),"Change Trend Line Always Show Stats")),this.loadData()},r.prototype.widget=function(){return this._table},inherit(n,a),n.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=this._linetool.points()[0],t=this._linetool.properties().points[0];if(e&&t){var i=this._createPointRow(e,t,"");this._table.append(i);var i=$("<tr>").appendTo(this._table);$("<td>").append($.t("Angle")).appendTo(i);var r=$("<input type='text'>");$("<td>").append(r).appendTo(i);var n=[h(t.price.value()),l(-360),d(360)],o=new _(r,this._linetool.properties().angle,n,!1,this.model(),"Change angle");o.addFormatter(function(e){return(new TradingView.NumericFormatter).format(e)}),this.bindControl(o),this.loadData()}},n.prototype.widget=function(){return this._table},t.LineToolTrendAngleStylesPropertyPage=r,t.LineToolTrendAngleInputsPropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){a.call(this,e,t,i),this.prepareLayout()}function n(e,t,i){o.call(this,e,t,i),this.prepareLayout()}var o=i(178),a=i(188),s=i(179),l=s.LessTransformer,d=s.GreateTransformer,h=s.ToIntTransformer,p=s.ToFloatTransformer,c=s.SimpleStringBinder,u=s.ColorBinding,_=s.SliderBinder,f=s.SimpleComboBinder;inherit(r,a),r.prototype.prepareLayout=function(){function e(e){return(new TradingView.NumericFormatter).format(e)}this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var t=$("<tbody>").appendTo(this._table),i=this.addLabeledRow(t,"Stop Level. Ticks:"),r=$("<input type='text'>");$("<td>").append(r).appendTo(i),r.addClass("ticker");var n=$("<input type='text'>");$("<td>"+$.t("Price:")+"</td>").appendTo(i),$("<td>").append(n).appendTo(i);var o=this.addLabeledRow(t,"Entry price:"),a=$("<input type='text'>");$('<td colspan="2">').append(a).appendTo(o);var s=this.addLabeledRow(t,"Profit Level. Ticks:"),u=$("<input type='text'>");$("<td>").append(u).appendTo(s),u.addClass("ticker");var _=$("<input type='text'>");$("<td>"+$.t("Price:")+"</td>").appendTo(s),$("<td>").append(_).appendTo(s),"LineToolRiskRewardLong"==this._linetool.getConstructor()&&(i.detach().appendTo(t),s.detach().prependTo(t));var f=[h(this._linetool.properties().stopLevel.value()),d(0),l(1e9)];this.bindControl(new c(r,this._linetool.properties().stopLevel,f,!1,this.model(),"Change "+this._linetool+" stop level"));var f=[h(this._linetool.properties().profitLevel.value()),d(0),l(1e9)];this.bindControl(new c(u,this._linetool.properties().profitLevel,f,!1,this.model(),"Change "+this._linetool+" profit level"));var f=[p(this._linetool.properties().entryPrice.value())],g=new c(a,this._linetool.properties().entryPrice,f,!1,this.model(),"Change "+this._linetool+" entry price");g.addFormatter(e),this.bindControl(g);var v=this,f=[p(this._linetool.properties().stopPrice.value()),function(e){return v._linetool.preparseStopPrice(e)}],g=new c(n,this._linetool.properties().stopPrice,f,!1,this.model(),"Change "+this._linetool+" stop price");g.addFormatter(e),this.bindControl(g);var f=[p(this._linetool.properties().targetPrice.value()),function(e){return v._linetool.preparseProfitPrice(e)}],g=new c(_,this._linetool.properties().targetPrice,f,!1,this.model(),"Change "+this._linetool+" stop price");g.addFormatter(e),this.bindControl(g)},r.prototype.widget=function(){return this._table},inherit(n,o),n.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=this.createColorPicker(),r=this.addLabeledRow(e,"Lines");$("<td>").append(i).appendTo(r),$("<td>").append(t).appendTo(r);var r=this.addLabeledRow(e,"Stop Color:"),n=this.createColorPicker();$("<td>").append(n).appendTo(r);var r=this.addLabeledRow(e,"Target Color:"),o=this.createColorPicker();$("<td>").append(o).appendTo(r);var r=this.addLabeledRow(e,"Text:"),a=this.createColorPicker(),s=this.createFontSizeEditor(),l=this.createFontEditor();$("<td>").append(a).appendTo(r),$("<td>").append(l).appendTo(r),$("<td>").append(s).appendTo(r),this.bindControl(new u(i,this._linetool.properties().linecolor,!0,this.model(),"Change Risk/Reward line Color")),this.bindControl(new _(t,this._linetool.properties().linewidth,!0,this.model(),"Change Risk/Reward line width")),this.bindControl(new u(n,this._linetool.properties().stopBackground,!0,this.model(),"Change stop color",this._linetool.properties().stopBackgroundTransparency)),this.bindControl(new u(o,this._linetool.properties().profitBackground,!0,this.model(),"Change target color",this._linetool.properties().profitBackgroundTransparency)),this.bindControl(new f(s,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new f(l,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new u(a,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.loadData()},n.prototype.widget=function(){return this._table},t.LineToolRiskRewardInputsPropertyPage=r,t.LineToolRiskRewardStylesPropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t,i),this.prepareLayout()}function n(e,t,i){a.call(this,e,t,i)}var o=i(178),a=i(188),s=i(179),l=s.BooleanBinder,d=s.SimpleComboBinder,h=s.SliderBinder,p=s.ColorBinding;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=TradingView.createLineStyleEditor(),i=this.createColorPicker(),r=this.addLabeledRow(this._table,"Line");$("<td>").prependTo(r),$("<td>").append(i).appendTo(r),$("<td>").append(e).appendTo(r),$("<td>").append(t.render()).appendTo(r);var n=$("<input type='checkbox' class='visibility-switch'>"),r=$("<tr>").appendTo(this._table);$("<td>").append(n).prependTo(r),this.createLabeledCell(2,"Show Time",n).appendTo(r),this.bindControl(new l(n,this._linetool.properties().showTime,!0,this.model(),"Change Vert Line Time Visibility")),this.bindControl(new p(i,this._linetool.properties().linecolor,!0,this.model(),"Change Vert Line Color")),this.bindControl(new d(t,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Vert Line Style")),this.bindControl(new h(e,this._linetool.properties().linewidth,!0,this.model(),"Change Vert Line Width")),this.loadData()},r.prototype.widget=function(){return this._table},inherit(n,a),n.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=this._linetool.points()[0];if(e){var t=$('<input type="text" class="ticker">'),i=$("<tr>").appendTo(this._table);$("<td>"+$.t("Bar #")+"</td>").appendTo(i),$("<td>").append(t).appendTo(i);var r=this._linetool.properties().points[0];this.bindBarIndex(r.bar,t,this.model(),"Change "+this._linetool+" point bar index"),this.loadData()}},t.LineToolVertLineStylesPropertyPage=r,t.LineToolVertLineInputsPropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t,i),this.prepareLayout()}function n(e,t,i){a.call(this,e,t,i)}var o=i(178),a=i(188),s=i(179),l=s.ToFloatTransformer,d=s.SimpleComboBinder,h=s.ColorBinding,p=s.BooleanBinder,c=s.SimpleStringBinder;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=$("<tbody>").appendTo(this._table),t=this.createColorPicker(),i=this.addLabeledRow(e,"Color");$("<td>").append(t).appendTo(i);var r=$('<select><option value="0">'+$.t("HL Bars")+'</option><option value="2">'+$.t("OC Bars")+'</option><option value="1">'+$.t("Line - Close")+'</option><option value="3">'+$.t("Line - Open")+'</option><option value="4">'+$.t("Line - High")+'</option><option value="5">'+$.t("Line - Low")+'</option><option value="6">'+$.t("Line - HL/2")+"</option></select>"),i=this.addLabeledRow(e,"Mode");$("<td>").append(r).appendTo(i);var i=$("<tr>").appendTo(e);$("<td>"+$.t("Mirrored")+"</td>").appendTo(i);var n=$("<input type='checkbox'>");$("<td>").append(n).appendTo(i);var i=$("<tr>").appendTo(e);$("<td>"+$.t("Flipped")+"</td>").appendTo(i);var o=$("<input type='checkbox'>");$("<td>").append(o).appendTo(i),this.bindControl(new p(n,this._linetool.properties().mirrored,!0,this.model(),"Change Bars Pattern Mirroring")),this.bindControl(new p(o,this._linetool.properties().flipped,!0,this.model(),"Change Bars Pattern Flipping")),this.bindControl(new h(t,this._linetool.properties().color,!0,this.model(),"Change Bars Pattern Color")),this.bindControl(new d(r,this._linetool.properties().mode,null,!0,this.model(),"Change Bars Pattern Mode")),this.loadData()},r.prototype.widget=function(){return this._table},inherit(n,a),n.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=this._linetool.points(),t=(e.item(0),$("<tr>"));t.appendTo(this._table);var i=$("<td>");i.html($.t("Price")),i.appendTo(t);var r=$("<td>");r.appendTo(t);var n=$("<input type='text'>");n.appendTo(r);var o=$("<td>");o.html($.t("Bar #")),o.appendTo(t);var a=$("<td>");a.appendTo(t);var s=$("<input type='text'>");s.appendTo(a),s.addClass("ticker");var d=this._linetool.properties().points[0],h=[l(d.price.value())];this.bindControl(new c(n,d.price,h,!1,this.model(),"Change "+this._linetool+" point price")),this.bindBarIndex(d.bar,s,this.model(),"Change "+this._linetool+" point bar index"),this.loadData()},t.LineToolBarsPatternStylesPropertyPage=r,t.LineToolBarsPatternInputsPropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){l.call(this,e,t),this._linetool=i,this.prepareLayout()}function n(e,t,i){o.call(this,e,t,i),this.prepareLayout()}var o=i(178),a=i(188),s=i(179),l=s.Q5,d=s.SliderBinder;inherit(r,a),r.prototype.prepareLayout=function(){var e=i(175),t=$('<table class="property-page" cellspacing="0" cellpadding="0">'),r=$('<table class="property-page" cellspacing="0" cellpadding="0">').data({"layout-tab":e.TAB_NAME_INPUTS,"layout-tab-priority":e.TAB_PRIORITY_INPUTS});this._table=t.add(r),a.prototype.prepareLayoutForTable.call(this,t);var n=$("<tr>").appendTo(r);$("<td>").append($.t("Avg HL in minticks")).appendTo(n);var o=$("<td>").appendTo(n),s=$("<input type='text'>").addClass("ticker").appendTo(o);n=$("<tr>").appendTo(r),$("<td>").append($.t("Variance")).appendTo(n);var l=$("<td>").appendTo(n),d=$("<input type='text'>").addClass("ticker").appendTo(l),h=this._linetool.properties();this.bindInteger(s,h.averageHL,$.t("Change Average HL value"),1,5e4),this.bindInteger(d,h.variance,$.t("Change Variance value"),1,100);r.is(":empty"),t.is(":empty");this.loadData()},r.prototype.widget=function(){this._table.is(":empty");return this._table},inherit(n,o),n.prototype.prepareLayout=function(){this._widget=$("<div>");var e=$("<table cellspacing=4>").appendTo(this._widget),t=this.createColorPicker(),i=this.createColorPicker(),r=this.createColorPicker(),n=this.createColorPicker(),o=this.createColorPicker(),a=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(n).add(o)),s=$("<input type='checkbox' class='visibility-switch'/>").data("hides",$(r)),l=this.addLabeledRow(e,$.t("Candles"));$("<td>").prependTo(l),$("<td>").append(t).appendTo(l),$("<td>").append(i).appendTo(l);var l=this.addLabeledRow(e,$.t("Borders"),a);$("<td>").append(a).prependTo(l),$("<td>").append(n).appendTo(l),$("<td>").append(o).appendTo(l),$("<td>").appendTo(l);var l=this.addLabeledRow(e,$.t("Wick"),s);$("<td>").append(s).prependTo(l),$("<td>").append(r).appendTo(l),$("<td>").appendTo(l),e=$("<table>").appendTo(this._widget);var l=$("<tr>").appendTo(e);$("<td colspan='2'>").append($.t("Transparency")).appendTo(l);var h=TradingView.createTransparencyEditor();$("<td colspan='2'>").append(h).appendTo(l);var p=this._linetool.properties();this.bindColor(t,p.candleStyle.upColor,"Change Candle Up Color"),this.bindColor(i,p.candleStyle.downColor,"Change Candle Down Color"),this.bindBoolean(s,p.candleStyle.drawWick,"Change Candle Wick Visibility"),this.bindColor(r,p.candleStyle.wickColor,"Change Candle Wick Color"),this.bindBoolean(a,p.candleStyle.drawBorder,"Change Candle Border Visibility"),this.bindColor(n,p.candleStyle.borderUpColor,"Change Candle Up Border Color"),this.bindColor(o,p.candleStyle.borderDownColor,"Change Candle Down Border Color"),this.bindControl(new d(h,p.transparency,!0,this.model(),"Change Guest Feed Transparency"))},n.prototype.widget=function(){return this._widget},t.LineToolGhostFeedInputsPropertyPage=r,t.LineToolGhostFeedStylesPropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SimpleComboBinder,d=o.SliderBinder,h=o.SimpleStringBinder;inherit(r,n),r.prototype.prepareLayout=function(){var e=this.createColorPicker(),t=this.createFontSizeEditor(),r=this.createFontEditor(),n=this.createTextEditor(350,200),o=this.createColorPicker(),p=TradingView.createLineWidthEditor(),c=this.createColorPicker(),u=$('<input type="checkbox">'),_=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),f=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new s(e,this._linetool.properties().color,!0,this.model(),"Change Text Color")),this.bindControl(new l(t,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new l(r,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new h(n,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new s(o,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().transparency)),this.bindControl(new s(c,this._linetool.properties().bordercolor,!0,this.model(),"Change Text Color")),this.bindControl(new d(p,this._linetool.properties().linewidth,!0,this.model(),"Change Border Width")),this.bindControl(new a(u,this._linetool.properties().wordWrap,!0,this.model(),"Change Text Wrap")),this.bindControl(new a(_,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new a(f,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var g=i(175),v=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab-open",g.TAB_OPEN_OVERRIDE),m=$('<table class="property-page" cellspacing="0" cellpadding="2">'),y=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=v.add(y).add(m),$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(e)).append($(document.createElement("td")).attr({width:1}).append(r)).append($(document.createElement("td")).attr({width:1}).append(t)).append($(document.createElement("td")).attr({width:1}).append(_)).append($(document.createElement("td")).append(f)).appendTo(v),$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(n)).appendTo(v);var w=this.addLabeledRow(m,"Text Wrap",u);$("<td>").append(u).prependTo(w);var w=this.addLabeledRow(y,"Background");$("<td>").append(o).appendTo(w);var w=this.addLabeledRow(y,"Border");$("<td>").append(c).appendTo(w),$("<td>").append(p).appendTo(w),this.loadData(),setTimeout(function(){n.select(),n.focus()},20)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.BooleanBinder,d=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=this.addLabeledRow(e,$.t("Line"));$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n);var o=$("<tbody>").appendTo(this._table),h=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),p=$('<input type="checkbox">').appendTo(h),c=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),u=$('<input type="checkbox">').appendTo(c),_=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),f=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(o,$.t("Left End"));$('<td colspan="3">').appendTo(n).append(_).append(h);var n=this.addLabeledRow(o,$.t("Right End"));$('<td colspan="3">').appendTo(n).append(f).append(c);var n=this.addLabeledRow(o,$.t("Stats Text Color")),g=this.createColorPicker();$("<td>").append(g).appendTo(n),this.bindControl(new s(g,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color"));var v=$('<input type="checkbox">'),m=($('<input type="checkbox">'),$('<input type="checkbox">')),y=$('<input type="checkbox">'),w=$('<input type="checkbox">'),T=$('<input type="checkbox">'),b=$('<input type="checkbox">'),n=this.addLabeledRow(o,$.t("Show Price Range"));$('<td colspan="3">').appendTo(n).append(v);var n=this.addLabeledRow(o,$.t("Show Bars Range"));$('<td colspan="3">').appendTo(n).append(m);var n=this.addLabeledRow(o,$.t("Show Date/Time Range"));$('<td colspan="3">').appendTo(n).append(y);var n=this.addLabeledRow(o,$.t("Show Distance"));$('<td colspan="3">').appendTo(n).append(w);var n=this.addLabeledRow(o,$.t("Show Angle"));$('<td colspan="3">').appendTo(n).append(T);var n=this.addLabeledRow(o,$.t("Always Show Stats"));$('<td colspan="3">').appendTo(n).append(b),this.bindControl(new l(p,this._linetool.properties().extendLeft,!0,this.model(),"Change Trend Line Extending Left")),this.bindControl(new l(u,this._linetool.properties().extendRight,!0,this.model(),"Change Trend Line Extending Right")),this.bindControl(new s(r,this._linetool.properties().linecolor,!0,this.model(),"Change Trend Line Color")),this.bindControl(new a(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Trend Line Style")),this.bindControl(new d(t,this._linetool.properties().linewidth,!0,this.model(),"Change Trend Line Width")),this.bindControl(new a(_,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Trend Line Left End")),this.bindControl(new a(f,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Trend Line Right End")),this.bindControl(new l(v,this._linetool.properties().showPriceRange,!0,this.model(),"Change Trend Line Show Price Range")),this.bindControl(new l(m,this._linetool.properties().showBarsRange,!0,this.model(),"Change Trend Line Show Bars Range")),this.bindControl(new l(y,this._linetool.properties().showDateTimeRange,!0,this.model(),"Change Trend Line Show Date/Time Range")),this.bindControl(new l(w,this._linetool.properties().showDistance,!0,this.model(),"Change Trend Line Show Distance")),this.bindControl(new l(T,this._linetool.properties().showAngle,!0,this.model(),"Change Trend Line Show Angle")),this.bindControl(new l(b,this._linetool.properties().alwaysShowStats,!0,this.model(),"Change Trend Line Always Show Stats")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.BooleanBinder,s=n.ColorBinding;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");for(var e=["Subminuette","Minuette","Minute","Minor","Intermediate","Primary","Cycle","SuperCycle","GrandSuperCycle"],t=0;9>t;t++){var i=this.Z99.properties()["level"+t].visible,r=$("<tr>");r.appendTo(this._table);var n=$("<input type='checkbox'>");this.createLabeledCell(e[t],n).appendTo(r);$("<td>").append(n).appendTo(r);var o=$("<td/>");o.appendTo(r),o.addClass("colorpicker-cell");var l=TradingView.addColorPicker(o);this.bindControl(new a(n,i,!0,this.model(),"Change Elliott "+e[t]+" Waves visibility")),this.bindControl(new s(l,this.Z99.properties()["level"+t].color,!0,this.model(),"Change Elliott "+e[t]+" Waves color"))}this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.SimpleComboBinder,s=n.ColorBinding,l=i(186).StudyStylesPropertyPage;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=this.createColorPicker(),t=this.createColorPicker(),i=this.createColorPicker(),r=this.createFontEditor(),n=this.createFontSizeEditor(),o=this.addLabeledRow(this._table,"Text");$("<td>").append(i).appendTo(o),$("<td>").append(n).appendTo(o),$("<td>").append(r).appendTo(o);var o=this.addLabeledRow(this._table,"Border Color");$("<td>").append(e).appendTo(o);var o=this.addLabeledRow(this._table,"Background");$("<td>").append(t).appendTo(o),this.bindControl(new s(e,this.Z99.properties().borderColor,!0,this.model(),"Change Pivots Border color")),this.bindControl(new s(t,this.Z99.properties().backColor,!0,this.model(),"Change Pivots Back color")),this.bindControl(new s(i,this.Z99.properties().textColor,!0,this.model(),"Change Pivots Text color")),this.bindControl(new a(r,this.Z99.properties().font,null,!0,this.model(),"Change Pivots Font")),this.bindControl(new a(n,this.Z99.properties().fontsize,parseInt,!0,this.model(),"Change Pivots Font Size")),l.prototype._putStudyDefaultStyles.call(this,this._table,3)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.ColorBinding,s=n.SliderBinder,l=i(186).StudyStylesPropertyPage;inherit(r,o),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=this.createColorPicker(),t=TradingView.createLineWidthEditor(),i=this.addLabeledRow(this._table,"Line");$("<td>").append(e).appendTo(i),$("<td>").append(t).appendTo(i),this.bindControl(new s(t,this.Z99.properties().linewidth,!0,this.model(),"Change ZigZag Width")),this.bindControl(new a(e,this.Z99.properties().color,!0,this.model(),"Change ZigZag Color")),l.prototype._putStudyDefaultStyles.call(this,this._table,3)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this._property=e,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.BooleanBinder,s=n.ColorBinding,l=n.SliderBinder,d=n.SimpleComboBinder;inherit(r,o),r.prototype.prepareLayout=function(){var e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$('<table class="property-page" cellspacing="0" cellpadding="2">'),i=!0;this._table=e.add(t);for(var r,n=this.Z99.properties(),o=[[$.t("Base"),n.styles.baseLine],[$.t("Up"),n.styles.upLine],[$.t("Down"),n.styles.downLine]],h=0;h<o.length;h++){var p=o[h],c=$("<input type='checkbox' class='visibility-switch'/>"),u=this.createColorPicker(),_=TradingView.createLineWidthEditor(),f=TradingView.createLineStyleEditor(),g=this.addLabeledRow(e,p[0],c);h||(r=u),$("<td>").append(c).prependTo(g),$("<td>").append(u).appendTo(g),
$("<td>").append(_).appendTo(g),$("<td>").append(f.render()).appendTo(g);var v="Change "+p[0];this.bindControl(new a(c,p[1].visible,!0,this.model(),v)),this.bindControl(new s(u,p[1].color,!0,this.model(),v,this._property.styles.transparency,i)),this.bindControl(new l(_,p[1].linewidth,!0,this.model(),v)),this.bindControl(new d(f,p[1].linestyle,parseInt,!0,this.model(),v))}var m=$("<input type='checkbox' class='visibility-switch'/>"),y=$("<input type='checkbox'/>"),g=$("<tr>").appendTo(t);$("<td>").append(m).appendTo(g),this.createLabeledCell($.t("Pearson's R"),m).appendTo(g);var g=$("<tr>").appendTo(t);$("<td>").append(y).appendTo(g),this.createLabeledCell($.t("Extend Lines"),y).appendTo(g),this.bindControl(new a(m,n.styles.showPearsons,!0,this.model(),"Change show Pearson's R")),this.bindControl(new a(y,n.styles.extendLines,!0,this.model(),"Change Extend Lines"))},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.BooleanBinder,s=n.SimpleComboBinder,l=n.SliderBinder,d=n.ColorBinding;inherit(r,o),r.prototype.prepareLayout=function(){var e=this.Z99.properties();this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var t=this.addLabeledRow(this._table,"Volume"),r=TradingView.createPlotEditor();$("<td>").append(r).appendTo(t),this.bindControl(new s(r,e.styles.vol.plottype,parseInt,!0,this.model(),"Change Volume Plot Style"));var n=this.Z99.metaInfo().version<=46&&"transparency"in e?e.transparency:e.styles.vol.transparency,o=this.createColorPicker();$("<td>").append(o).appendTo(t),this.bindControl(new d(o,e.palettes.volumePalette.colors[0].color,!0,this.model(),"Change Up Volume color",n));var h=this.createColorPicker();$("<td>").append(h).appendTo(t),this.bindControl(new d(h,e.palettes.volumePalette.colors[1].color,!0,this.model(),"Change Down Volume color",n));var p=$("<input type='checkbox'>");$("<td>").appendTo(t),$("<td>").append(p).appendTo(t),$("<td>"+$.t("Price Line")+"</td>").appendTo(t),this.bindControl(new a(p,e.styles.vol.trackPrice,!0,this.model(),"Change Price Line"));var c=e.styles.vol_ma,u=this.addLabeledRow(this._table,"Volume MA"),_=TradingView.createPlotEditor();$("<td>").append(_).appendTo(u),this.bindControl(new s(_,c.plottype,parseInt,!0,this.model(),"Change Volume MA Plot Style")),$("<td>").html("&nbsp;").appendTo(u);var f=this.createColorPicker();$("<td>").append(f).appendTo(u),this.bindControl(new d(f,c.color,!0,this.model(),"Change Volume MA color",c.transparency));var g=TradingView.createLineWidthEditor();$("<td>").append(g).appendTo(u),this.bindControl(new l(g,c.linewidth,!0,this.model(),"Change Volume MA Line Width"));var p=$("<input type='checkbox'>");$("<td>").append(p).appendTo(u),$("<td>"+$.t("Price Line")+"</td>").appendTo(u),this.bindControl(new a(p,c.trackPrice,!0,this.model(),"Change Price Line"));var v=i(186).StudyStylesPropertyPage;v.prototype._putStudyDefaultStyles.call(this,this._table,8)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){a.call(this,e,t),this.Z99=i,this.prepareLayout()}function n(e,t,i){r.call(this,e,t,i)}var o=i(179),a=o.Q5,s=o.GreateTransformer,l=o.LessTransformer,d=o.ToIntTransformer,h=o.SliderBinder,p=o.BooleanBinder,c=o.SimpleStringBinder,u=o.SimpleComboBinder,_=o.ColorBinding,f=i(186).StudyStylesPropertyPage;inherit(r,a),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=this.Z99.properties(),t=this._table,i=e.graphics.hhists.histBars,r=e.graphics.hhists.vaBars,n=e.graphics.horizlines.pocLines,o=e.graphics.polygons,a=i.title.value(),h=this.createTableInTable(t),f=this.addRow(h),g=TradingView.createVisibilityEditor();$("<td>").append(g).appendTo(f),this.createLabeledCell(a,g).appendTo(f),this.bindControl(new p(g,i.visible,!0,this.model(),"Change "+a+" Visibility")),this.bindControl(new p(g,r.visible,!0,this.model(),"Change "+a+" Visibility"));var f=this.addRow(h),v=$("<input type='checkbox'>");$("<td>").append(v).appendTo(f),this.createLabeledCell("Show Values",v).appendTo(f),this.bindControl(new p(v,i.showValues,!0,this.model(),"Change "+a+" Show Values"));var h=this.createTableInTable(t),f=this.addRow(h),m=$("<input/>");m.attr("type","text"),m.addClass("ticker"),this.createLabeledCell("Width (% of the Box)",m).appendTo(f),$("<td>").append(m).appendTo(f);var y=[d(40)];y.push(s(0)),y.push(l(100)),this.bindControl(new c(m,i.percentWidth,y,!1,this.model(),"Change Percent Width")),this.bindControl(new c(m,r.percentWidth,y,!1,this.model(),"Change Percent Width"));var f=this.addLabeledRow(h,"Placement"),w=TradingView.createHHistDirectionEditor();$("<td>").append(w).appendTo(f),this.bindControl(new u(w,i.direction,null,!0,this.model(),"Change "+a+" Placement")),this.bindControl(new u(w,r.direction,null,!0,this.model(),"Change "+a+" Placement"));var h=this.createTableInTable(t);this._createRow_horizlines(h,n);var T=e.styles.developingPoc;T&&this._createRow_plots(h,T.title.value(),T);var b=e.styles.developingVAHigh,S=e.styles.developingVALow;b&&S&&this._createRow_plots(h,"Developing VA",b,S);var f=this.addRow(h),C=this.createColorPicker();this.createLabeledCell("Text Color",C).appendTo(f),$("<td>").append(C).appendTo(f),this.bindControl(new _(C,i.valuesColor,!0,this.model(),"Change "+a+" Text Color")),this._createRow_hhist_color_transparency(h,i),this._createRow_hhist_color_transparency(h,r),o&&this._createRow_polygons(h,o.histBoxBg)},r.prototype._createRow_plots=function(e,t,i,r){var n=this.addRow(e),o=TradingView.createVisibilityEditor(),a=this.createColorPicker(),s=TradingView.createLineWidthEditor(),l=$("<label>").append(o);l.append('<span style="margin-left: 8px;">'+$.t(t)+"</span>"),$("<td>").append(l).appendTo(n),$("<td>").append(a).appendTo(n),$("<td>").append(s).appendTo(n),$("<td>").appendTo(n),this.bindControl(new p(o,i.visible,!0,this.model(),"Change "+t+" visibility")),this.bindControl(new _(a,i.color,!0,this.model(),"Change "+t+" color")),this.bindControl(new h(s,i.linewidth,!0,this.model(),"Change "+t+" width")),r&&(this.bindControl(new p(o,r.visible,!0,this.model(),"Change "+t+" visibility")),this.bindControl(new _(a,r.color,!0,this.model(),"Change "+t+" color")),this.bindControl(new h(s,r.linewidth,!0,this.model(),"Change "+t+" width")))},r.prototype._createRow_horizlines=function(e,t){var i=this.addRow(e),r=t.name.value(),n=TradingView.createVisibilityEditor(),o=this.createColorPicker(),a=TradingView.createLineWidthEditor(),s=TradingView.createLineStyleEditor(),l=$("<label>").append(n);l.append('<span style="margin-left: 8px;">'+$.t(r)+"</span>"),$("<td>").append(l).appendTo(i),$("<td>").append(o).appendTo(i),$("<td>").append(a).appendTo(i),$("<td>").append(s.render()).appendTo(i),$("<td>").appendTo(i),this.bindControl(new p(n,t.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new _(o,t.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new u(s,t.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new h(a,t.width,!0,this.model(),"Change "+r+" width"))},r.prototype._createRow_hhist_color_transparency=function(e,t){var i=[],r=[];for(var n in t.colors)if(isNumber(parseInt(n,10))){var o=this.addRow(e);i[n]=t.titles[n].value(),r[n]=this.createColorPicker(),$("<td>").append(i[n]).appendTo(o),$("<td>").append(r[n]).appendTo(o),this.bindControl(new _(r[n],t.colors[n],!0,this.model(),"Change "+i[n]+" color",t.transparencies[n]))}},r.prototype._createRow_polygons=function(e,t){var i=this.addRow(e),r=t.name.value(),n=this.createColorPicker();$("<td>").append(r).appendTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new _(n,t.color,!0,this.model(),"Change "+r+" color",t.transparency)),this.bindControl(new _(n,t.color,!0,this.model(),"Change "+r+" color",t.transparency))},r.prototype.widget=function(){return this._table},inherit(n,r),n.prototype.prepareLayout=function(){this.superclass.prototype.prepareLayout.call(this);var e=this.createTableInTable(this._table);f.prototype._putStudyDefaultStyles.call(this,e)},t.VolumeProfilePropertyPage=r,t.StudyVolumeProfilePropertyPage=n},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.ColorBinding,s=o.SimpleComboBinder,l=o.SliderBinder,d=o.BooleanBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._block=$("<div>").addClass("property-page");var e=$('<table cellspacing="0" cellpadding="2">').appendTo(this._block),t=$("<tbody>").appendTo(e),i=TradingView.createLineWidthEditor(),r=TradingView.createLineStyleEditor(),n=this.createColorPicker(),o=this.addLabeledRow(t,$.t("Line"));$("<td>").append(n).appendTo(o),$("<td>").append(i).appendTo(o),$('<td colspan="3">').append(r.render()).appendTo(o);var h=$('<table cellspacing="0" cellpadding="2">').appendTo(this._block),o=this.addLabeledRow(h,$.t("Background"),p),p=$('<input type="checkbox" class="visibility-switch">'),c=this.createColorPicker();$("<td>").append(p).prependTo(o),$("<td>").append(c).appendTo(o);var u=$('<table cellspacing="0" cellpadding="2">').appendTo(this._block),_=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),f=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),g=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),v=$('<input type="checkbox">').appendTo(g),m=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),y=$('<input type="checkbox">').appendTo(m),o=this.addLabeledRow(u,$.t("Left End"));$('<td colspan="3">').appendTo(o).append(_).append(g);var o=this.addLabeledRow(u,$.t("Right End"));$('<td colspan="3">').appendTo(o).append(f).append(m),this.bindControl(new a(n,this._linetool.properties().linecolor,!0,this.model(),"Change Curve Line Color")),this.bindControl(new s(r,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Curve Line Style")),this.bindControl(new l(i,this._linetool.properties().linewidth,!0,this.model(),"Change Curve Line Width")),this.bindControl(new d(p,this._linetool.properties().fillBackground,!0,this.model(),"Change Curve Filling")),this.bindControl(new a(c,this._linetool.properties().backgroundColor,!0,this.model(),"Change Curve Background Color",this._linetool.properties().transparency)),this.bindControl(new s(_,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Curve Line Left End")),this.bindControl(new s(f,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Curve Line Right End")),this.bindControl(new d(v,this._linetool.properties().extendLeft,!0,this.model(),"Change Curve Line Extending Left")),this.bindControl(new d(y,this._linetool.properties().extendRight,!0,this.model(),"Change Curve Line Extending Right")),this.loadData()},r.prototype.widget=function(){return this._block},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.FloatBinder,l=o.ColorBinding,d=o.SimpleComboBinder,h=o.SliderBinder;inherit(r,n),r.prototype.onResoreDefaults=function(){this._linetool.properties().style.listeners().fire(this._linetool.properties().style)},r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");if(r.appendTo(this._table),e){var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");o.appendTo(n);var p=$("<td>");p.appendTo(r);var c=$("<input type='text'>");c.appendTo(p),c.css("width","70px"),this.bindControl(new a(o,t.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new s(c,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else $("<td></td>").appendTo(r),$("<td>"+$.t("Median")+"</td>").appendTo(r);var u=$("<td class='colorpicker-cell'>");u.appendTo(r);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(r);var g=TradingView.createLineWidthEditor();g.appendTo(f);var v=$("<td>");v.appendTo(r);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new l(_,t.color,!0,this.model(),"Change Pitchfork Line Color",0)),this.bindControl(new d(m,t.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style")),this.bindControl(new h(g,t.linewidth,!0,this.model(),"Change Pitchfork Line Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().median,!1);for(var e=0;8>=e;e++){var t="level"+e;this.addLevelEditor($.t("Level {0}").format(e+1),this._linetool.properties()[t],!1)}var i=$("<tr>");i.appendTo(this._table);var r=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(r).appendTo(i),this.createLabeledCell("Background",r).appendTo(i);var n=TradingView.createTransparencyEditor();$('<td colspan="3">').append(n).appendTo(i);var o=$("<select><option value='0'>"+$.t("Original")+"</option><option value='3'>"+$.t("Schiff")+"</option><option value='1'>"+$.t("Modified Schiff")+"</option><option value='2'>"+$.t("Inside")+"</option></select>"),i=$("<tr>");i.appendTo(this._table),$("<td>"+$.t("Style")+"</td>").appendTo(i),$("<td>").append(o).appendTo(i),this.bindControl(new d(o,this._linetool.properties().style,parseInt,!0,this.model(),"Change Pitchfork Style")),this.bindControl(new a(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfork Background Visibility")),this.bindControl(new h(n,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfork Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.FloatBinder,l=o.ColorBinding,d=o.SimpleComboBinder,h=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");if(r.appendTo(this._table),e){var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");o.appendTo(n);var p=$("<td>");p.appendTo(r);var c=$("<input type='text'>");c.appendTo(p),c.css("width","70px"),this.bindControl(new a(o,t.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new s(c,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else $("<td colspan='2'>"+$.t("Median")+"</td>").appendTo(r);var u=$("<td class='colorpicker-cell'>");u.appendTo(r);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(r);var g=TradingView.createLineWidthEditor();g.appendTo(f);var v=$("<td>");v.appendTo(r);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new l(_,t.color,!0,this.model(),"Change Pitchfork Line Color"),0),this.bindControl(new d(m,t.linestyle,parseInt,!0,this.model(),"Change Pitchfan Line Style")),this.bindControl(new h(g,t.linewidth,!0,this.model(),"Change Pitchfan Line Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().median,!1);for(var e=0;8>=e;e++){var t="level"+e;this.addLevelEditor($.t("Level {0}").format(e+1),this._linetool.properties()[t],!1)}var i=$("<tr>");i.appendTo(this._table);var r=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(r).appendTo(i),this.createLabeledCell($.t("Background"),r).appendTo(i);var n=TradingView.createTransparencyEditor();$('<td colspan="3">').append(n).appendTo(i),this.bindControl(new a(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfan Background Visibility")),this.bindControl(new h(n,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfan Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t){this.Q2=e,this._undoModel=t}function n(e,t,i){o.call(this,e,t,i),this.prepareLayout()}var o=i(178),a=i(179),s=a.SimpleStringBinder,l=a.SimpleComboBinder,d=a.ColorBinding,h=a.BooleanBinder;r.prototype.attachSource=function(e,t){this.Z97=e,this._edit=$("<textarea>"),this._edit.css("width","300"),this._edit.css("height","150"),this._edit.appendTo(this.Q2._jqMainDiv),TradingView.setAbsolutePos(this._edit,t),this._edit.val(e.properties().text.value()),this._edit.focus();var i=this._edit;return i.select(),this._binding=new s(i,e.properties().text,null,!0,this._undoModel,"change line tool text"),this._edit.focusout(function(){e.properties().text.setValue(i.val())}),this._edit.mousedown(function(e){return!0}),i},inherit(n,o),n.prototype.prepareLayout=function(){var e=this.createColorPicker(),t=this.createColorPicker(),i=this.createFontSizeEditor(),r=this.createFontEditor(),n=this.createTextEditor(350,200),o=this.createColorPicker(),a=$('<input type="checkbox" class="visibility-switch">'),p=$('<input type="checkbox" class="visibility-switch">'),c=$('<input type="checkbox">'),u=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),_=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new d(e,this._linetool.properties().color,!0,this.model(),"Change Text Color")),this.bindControl(new l(i,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new l(r,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new s(n,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new d(o,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().backgroundTransparency)),this.bindControl(new h(a,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new h(p,this._linetool.properties().drawBorder,!0,this.model(),"Change Text Border")),this.bindControl(new d(t,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color")),this.bindControl(new h(c,this._linetool.properties().wordWrap,!0,this.model(),"Change Text Wrap")),this.bindControl(new h(u,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new h(_,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var f=$('<table class="property-page" cellspacing="0" cellpadding="2">'),g=$('<table class="property-page" cellspacing="0" cellpadding="2">'),v=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=f.add(v).add(g),$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(e)).append($(document.createElement("td")).attr({width:1}).append(r)).append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(u)).append($(document.createElement("td")).append(_)).appendTo(f),$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(n)).appendTo(f);var m=this.addLabeledRow(g,$.t("Text Wrap"),c);$("<td>").append(c).prependTo(m);var m=this.addLabeledRow(v,$.t("Background"),a);$("<td>").append(a).prependTo(m),$("<td>").append(o).appendTo(m);var m=this.addLabeledRow(v,$.t("Border"),p);$("<td>").append(p).prependTo(m),$("<td>").append(t).appendTo(m),this.loadData(),setTimeout(function(){n.select(),n.focus()},20)},n.prototype.widget=function(){return this._table},n.prototype.dialogPosition=function(e,t){var i,r=5,n=0,o=this._linetool,a=o.Z98.paneForSource(o),s=this.Z98.Q2;$.each(s.paneWidgets(),function(e,t){return t._state==a?(n=$(t.canvas).offset().top,!1):void 0}),e||(e={});var l=e.left,d=e.top,h=(this._linetool.paneViews()||[])[0];if(h)var i=h._floatPoints[0];i&&(l=i.x,d=i.y+n);var p=$(t).outerHeight(),c=$(window).height(),u=o.properties().fontsize.value();return d=c>=d+p+u+r?d+u+r:d-p-r,{top:d,left:l}},e.exports=n},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.ColorBinding,s=o.BooleanBinder,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border");i.prepend("<td>"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i);var r=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background",r);$("<td>").append(r).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new s(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Rectangle Filling")),this.bindControl(new a(t,this._linetool.properties().color,!0,this.model(),"Change Rectangle Line Color")),this.bindControl(new a(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Rectangle Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Rectangle Border Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Border"));i.prepend("<td>"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i);var r=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Background"),r);$("<td>").append(r).prependTo(i),$("<td>").append(n).appendTo(i);this._linetool.properties().fillBackground;this.bindControl(new a(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Ellipse Filling")),this.bindControl(new s(t,this._linetool.properties().color,!0,this.model(),"Change Ellipse Line Color")),this.bindControl(new s(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Ellipse Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Ellipse Border Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border");i.prepend("<td>"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i);var r=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background",r);$("<td>").append(r).prependTo(i),$("<td>").append(n).appendTo(i);this._linetool.properties().fillBackground;this.bindControl(new a(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Arc Filling")),this.bindControl(new s(t,this._linetool.properties().color,!0,this.model(),"Change Arc Line Color")),this.bindControl(new s(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Arc Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Arc Border Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Border"));i.prepend("<td>"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i);var r=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,$.t("Background"),r);$("<td>").append(r).prependTo(i),$("<td>").append(n).appendTo(i),this.bindControl(new a(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Triangle Filling")),this.bindControl(new s(t,this._linetool.properties().color,!0,this.model(),"Change Triangle Line Color")),this.bindControl(new s(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Triangle Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Triangle Border Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SimpleComboBinder,d=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=$("<tr>").appendTo(e);$("<td></td><td>"+$.t("Channel")+"</td>").appendTo(n),$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$("<td>").append(i.render()).appendTo(n);var n=$("<tr>").appendTo(e),o=$("<td>").appendTo(n),h=$("<input type='checkbox' class='visibility-switch'>");h.appendTo(o),this.createLabeledCell("Middle",h).appendTo(n);var p=TradingView.createLineWidthEditor(),c=TradingView.createLineStyleEditor(),u=this.createColorPicker();$("<td>").append(u).appendTo(n),$("<td>").append(p).appendTo(n),$("<td>").append(c.render()).appendTo(n);var n=$("<tr>").appendTo(e),_=$("<td>").appendTo(n),f=$("<input type='checkbox' class='visibility-switch'>");f.appendTo(_),this.createLabeledCell("Background",f).appendTo(n);var g=this.createColorPicker();$("<td>").append(g).appendTo(n);var v=$("<tbody>").appendTo(this._table),m=this.addEditorRow(v,"Extend Left",$("<input type='checkbox'>"),2),y=this.addEditorRow(v,"Extend Right",$("<input type='checkbox'>"),2),w=this._linetool.properties();this.bindControl(new a(f,w.fillBackground,!0,this.model(),"Change Parallel Channel Fill Background")),this.bindControl(new a(h,w.showMidline,!0,this.model(),"Change Parallel Channel Show Center Line")),this.bindControl(new a(m,w.extendLeft,!0,this.model(),"Change Parallel Channel Extending Left")),this.bindControl(new a(y,w.extendRight,!0,this.model(),"Change Parallel Channel Extending Right")),this.bindControl(new s(r,w.linecolor,!0,this.model(),"Change Parallel Channel Color")),this.bindControl(new l(i,w.linestyle,parseInt,!0,this.model(),"Change Parallel Channel Style")),this.bindControl(new d(t,w.linewidth,!0,this.model(),"Change Parallel Channel Width")),this.bindControl(new s(u,w.midlinecolor,!0,this.model(),"Change Parallel Channel Middle Color")),this.bindControl(new l(c,w.midlinestyle,parseInt,!0,this.model(),"Change Parallel Channel Middle Style")),this.bindControl(new d(p,w.midlinewidth,!0,this.model(),"Change Parallel Channel Middle Width")),this.bindControl(new s(g,w.backgroundColor,!0,this.model(),"Change Parallel Channel Back Color",w.transparency)),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleStringBinder,s=o.ColorBinding,l=o.SimpleComboBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">').css({width:"100%"});var e=$("<input type='text'>").css({width:"100%"}),t=$('<div class="property-page-fullwidth-wrapper">').append(e),i=this.createColorPicker(),r=this.createFontEditor(),n=$("<tr>").appendTo(this._table);$("<td>").css({width:"0"}).html($.t("Text")).appendTo(n),$('<td colspan="2">').append(t).appendTo(n);var n=this.addLabeledRow(this._table,"Text Font");n.children().css({whiteSpace:"nowrap"}),$("<td>").append(i).appendTo(n).css({width:"0"}),$("<td>").append(r).appendTo(n),this.bindControl(new s(i,this._linetool.properties().color,!0,this.model(),"Change Arrow Mark Text Color")),this.bindControl(new a(e,this._linetool.properties().text,null,!0,this.model(),"Change Arrow Mark Text")),this.bindControl(new l(r,this._linetool.properties().font,null,!0,this.model(),"Change Arrow Mark Font")),this.loadData(),setTimeout(function(){e.select(),e.focus()},20)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=this.createColorPicker(),t=this.createFontSizeEditor(),i=this.createColorPicker(),r=this.createColorPicker(),n=this.addLabeledRow(this._table,$.t("Text"));$("<td>").append(e).appendTo(n),$("<td>").append(t).appendTo(n);var n=this.addLabeledRow(this._table,$.t("Background"));$("<td>").append(i).appendTo(n);var n=this.addLabeledRow(this._table,$.t("Border"));$("<td>").append(r).appendTo(n),this.bindControl(new s(e,this._linetool.properties().color,!0,this.model(),"Change Price Text Color")),this.bindControl(new a(t,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Price Text Font Size")),this.bindControl(new s(i,this._linetool.properties().backgroundColor,!0,this.model(),"Change Background Color",this._linetool.properties().transparency)),this.bindControl(new s(r,this._linetool.properties().borderColor,!0,this.model(),"Change Border Color")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.SimpleStringBinder;inherit(r,n),r.prototype.prepareLayout=function(){var e=i(175),t=$('<table class="property-page" cellspacing="0" cellpadding="0">').css({width:"100%"}).data("layout-tab-open",e.TAB_OPEN_OVERRIDE),r=$('<table class="property-page" cellspacing="0" cellpadding="0">');this._table=t.add(r);var n=$("<input type='text'>").css({width:"100%"}),o=this.createColorPicker(),d=this.createFontSizeEditor(),h=this.createColorPicker(),p=this.createColorPicker(),c=$("<tr>").appendTo(t),u=$('<div class="property-page-fullwidth-wrapper">').append(n);$("<td>").append(u).appendTo(c);var _=this.addLabeledRow(r,$.t("Text"));$("<td>").append(o).appendTo(_),$("<td>").append(d).appendTo(_);var _=this.addLabeledRow(r,$.t("Background"));$("<td>").appendTo(_).append(h);var _=this.addLabeledRow(r,$.t("Border"));$("<td>").appendTo(_).append(p),$("<td>"),this.bindControl(new l(n,this._linetool.properties().text,null,!0,this.model(),"Change Balloon Text")),
this.bindControl(new s(o,this._linetool.properties().color,!0,this.model(),"Change Balooon Text Color")),this.bindControl(new a(d,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Balloon Text Font Size")),this.bindControl(new s(h,this._linetool.properties().backgroundColor,!0,this.model(),"Change Balloon Background Color",this._linetool.properties().transparency)),this.bindControl(new s(p,this._linetool.properties().borderColor,!0,this.model(),"Change Balloon Border Color")),this.loadData(),setTimeout(function(){n.select(),n.focus()},0)},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SliderBinder,s=o.BooleanBinder,l=o.ColorBinding,d=o.SimpleComboBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=$('<input type="checkbox" class="visibility-switch">'),r=this.createColorPicker(),n=this.addLabeledRow(this._table,"Line");$("<td>").prependTo(n),$("<td>").append(t).appendTo(n),$("<td>").append(e).appendTo(n);var n=this.addLabeledRow(this._table,"Background",i);$("<td>").append(i).prependTo(n),$("<td>").append(r).appendTo(n);var o=$("<tbody>").appendTo(this._table),h=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),p=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(o,$.t("Left End"));$("<td>").prependTo(n),$('<td colspan="3">').appendTo(n).append(h);var n=this.addLabeledRow(o,$.t("Right End"));$("<td>").prependTo(n),$('<td colspan="3">').appendTo(n).append(p),this.bindControl(new l(t,this._linetool.properties().linecolor,!0,this.model(),"Change Brush Color")),this.bindControl(new a(e,this._linetool.properties().linewidth,!0,this.model(),"Change Brush Line Width")),this.bindControl(new s(i,this._linetool.properties().fillBackground,!0,this.model(),"Change Brush Filling")),this.bindControl(new l(r,this._linetool.properties().backgroundColor,!0,this.model(),"Change Brush Background Color",this._linetool.properties().transparency)),this.bindControl(new d(h,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Trend Line Left End")),this.bindControl(new d(p,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Trend Line Right End")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.ColorBinding,s=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){var e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),i=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=e.add(t).add(i);var r=this.createColorPicker(),n=TradingView.createLineWidthEditor(),o=this.addLabeledRow(e,"Line");$("<td>").append(r).appendTo(o),$("<td>").append(n).appendTo(o);var l=$("<tr>").appendTo(t),d=$("<td>").appendTo(l).css({"vertical-align":"top",width:"50%"}),h=$("<td>").appendTo(l).css({"vertical-align":"top",width:"50%"}),p=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo(d),c=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo(h),u=this.addColorPickerRow(p,$.t("Source back color")),_=this.addColorPickerRow(p,$.t("Source text color")),f=this.addColorPickerRow(p,$.t("Source border color")),g=this.addColorPickerRow(p,$.t("Success back color")),v=this.addColorPickerRow(p,$.t("Success text color")),m=this.addColorPickerRow(c,$.t("Target back color")),y=this.addColorPickerRow(c,$.t("Target text color")),w=this.addColorPickerRow(c,$.t("Target border color")),T=this.addColorPickerRow(c,$.t("Failure back color")),b=this.addColorPickerRow(c,$.t("Failure text color"));this.bindControl(new a(r,this._linetool.properties().linecolor,!0,this.model(),"Forecast Line Color")),this.bindControl(new s(n,this._linetool.properties().linewidth,!0,this.model(),"Forecast Line Width")),this.bindControl(new a(r,this._linetool.properties().linecolor,!0,this.model(),"Forecast Line Color")),this.bindControl(new s(n,this._linetool.properties().linewidth,!0,this.model(),"Forecast Line Width")),this.bindControl(new a(u,this._linetool.properties().sourceBackColor,!0,this.model(),"Forecast Source Background Color",this._linetool.properties().transparency)),this.bindControl(new a(f,this._linetool.properties().sourceStrokeColor,!0,this.model(),"Forecast Source Border Color")),this.bindControl(new a(_,this._linetool.properties().sourceTextColor,!0,this.model(),"Forecast Source Text Color")),this.bindControl(new a(m,this._linetool.properties().targetBackColor,!0,this.model(),"Forecast Target Background Color")),this.bindControl(new a(w,this._linetool.properties().targetStrokeColor,!0,this.model(),"Forecast Target Border Color")),this.bindControl(new a(y,this._linetool.properties().targetTextColor,!0,this.model(),"Forecast Target Text Color")),this.bindControl(new a(g,this._linetool.properties().successBackground,!0,this.model(),"Forecast Success Back Color")),this.bindControl(new a(v,this._linetool.properties().successTextColor,!0,this.model(),"Forecast Success Text Color")),this.bindControl(new a(T,this._linetool.properties().failureBackground,!0,this.model(),"Forecast Failure Back Color")),this.bindControl(new a(b,this._linetool.properties().failureTextColor,!0,this.model(),"Forecast Failure Text Color")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.addLabeledRow(this._table,"Border");i.prepend("<td>"),$("<td>").append(t).appendTo(i),$("<td>").append(e).appendTo(i);var r=$('<input type="checkbox" class="visibility-switch">'),n=this.createColorPicker(),i=this.addLabeledRow(this._table,"Background",r);$("<td>").append(r).prependTo(i),$("<td>").append(n).appendTo(i);this._linetool.properties().fillBackground;this.bindControl(new a(r,this._linetool.properties().fillBackground,!0,this.model(),"Change Polyline Filling")),this.bindControl(new s(t,this._linetool.properties().linecolor,!0,this.model(),"Change Polyline Line Color")),this.bindControl(new s(n,this._linetool.properties().backgroundColor,!0,this.model(),"Change Polyline Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Polyline Border Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.FloatBinder,l=o.ColorBinding,d=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(e);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");o.appendTo(n);var d=$("<td>");d.appendTo(r);var h=$("<input type='text'>");h.appendTo(d),h.css("width","70px"),this.bindControl(new a(o,i.visible,!0,this.model(),"Change Gann Square Line Visibility")),this.bindControl(new s(h,i.coeff,!1,this.model(),"Change Pitchfork Line Coeff"));var p=$("<td class='colorpicker-cell'>");p.appendTo(r);var c=TradingView.addColorPicker(p);this.bindControl(new l(c,i.color,!0,this.model(),"Change Gann Square Line Color",0))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page property-page-unpadded"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this._table.css({width:"100%"});var e=$("<tbody>").appendTo(this._table),t=$("<tr>");t.appendTo(e);var i=$('<td width="50%">');i.appendTo(t);var r=$('<td width="50%">');r.appendTo(t);var n=$('<table cellspacing="0" cellpadding="2">');n.appendTo(i),n.addClass("property-page");var o=$('<table cellspacing="0" cellpadding="2">');o.appendTo(r),o.addClass("property-page"),$("<tr><td align='center' colspan='4'>"+$.t("Price Levels")+"</td></tr>").appendTo(n),$("<tr><td align='center' colspan='4'>"+$.t("Time Levels")+"</td></tr>").appendTo(o);for(var s=1;7>=s;s++){var l="hlevel"+s;this.addLevelEditor(n,$.t("Level {0}").format(s),this._linetool.properties()[l])}for(var s=1;7>=s;s++){var l="vlevel"+s;this.addLevelEditor(o,$.t("Level {0}").format(s),this._linetool.properties()[l])}var h=$("<input type='checkbox' class='visibility-switch'>"),p=$("<input type='checkbox' class='visibility-switch'>"),c=$("<input type='checkbox' class='visibility-switch'>"),u=$("<input type='checkbox' class='visibility-switch'>"),_=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),f=$("<tr>").appendTo(_),g=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(f)),v=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(f)),m=this.addLabeledRow(g,$.t("Left Labels"),h);$("<td>").append(h).prependTo(m);var m=this.addLabeledRow(v,$.t("Right Labels"),p);$("<td>").append(p).prependTo(m);var m=this.addLabeledRow(g,$.t("Top Labels"),c);$("<td>").append(c).prependTo(m);var m=this.addLabeledRow(v,$.t("Bottom Labels"),u);$("<td>").append(u).prependTo(m),this.bindControl(new a(h,this._linetool.properties().showLeftLabels,!0,this.model(),"Change Gann Square Left Labels Visibility")),this.bindControl(new a(p,this._linetool.properties().showRightLabels,!0,this.model(),"Change Gann Square Right Labels Visibility")),this.bindControl(new a(c,this._linetool.properties().showTopLabels,!0,this.model(),"Change Gann Square Top Labels Visibility")),this.bindControl(new a(u,this._linetool.properties().showBottomLabels,!0,this.model(),"Change Gann Square Bottom Labels Visibility")),this._table=this._table.add(_);var m=$("<tr>");m.appendTo(g);var y=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(y).appendTo(m);var w=TradingView.createTransparencyEditor();$("<td>").append(w).appendTo(m),this.bindControl(new a(y,this._linetool.properties().fillHorzBackground,!0,this.model(),"Change Gann Square Background Visibility")),this.bindControl(new d(w,this._linetool.properties().horzTransparency,!0,this.model(),"Change Gann Square Background Transparency"));var m=$("<tr>");m.appendTo(v);var y=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(y).appendTo(m);var w=TradingView.createTransparencyEditor();$("<td>").append(w).appendTo(m),this.bindControl(new a(y,this._linetool.properties().fillVertBackground,!0,this.model(),"Change Gann Square Background Visibility")),this.bindControl(new d(w,this._linetool.properties().vertTransparency,!0,this.model(),"Change Gann Square Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.SliderBinder,l=o.ColorBinding;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page property-page-unpadded"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this._table.css({width:"100%"});var e=$("<tr>");e.appendTo(this._table);var t=this._linetool.properties(),i=$("<table>");$("<td valign='top'>").append(i).appendTo(e);var r=$("<tr>");$("<td colspan='3'>"+$.t("Levels")+"</td>").appendTo(r),r.appendTo(i);for(var n in t.levels._childs){var o=t.levels[n],d=$("<tr>");d.appendTo(i),$("<td>"+n+"</td>").appendTo(d);var h=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(h).appendTo(d);var p=$("<td class='colorpicker-cell'>");p.appendTo(d);var c=TradingView.addColorPicker(p),u=$("<td>");u.appendTo(d);var _=TradingView.createLineWidthEditor();_.appendTo(u),this.bindControl(new a(h,o.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new l(c,o.color,!0,this.model(),"Change Gann Line Color",0)),this.bindControl(new s(_,o.width,!0,this.model(),"Change Gann Line Width"))}var f=$("<table>");$("<td valign='top'>").append(f).appendTo(e);var g=$("<tr>");$("<td colspan='4'>"+$.t("Fans")+"</td>").appendTo(g),g.appendTo(f);for(var n in t.fanlines._childs){var v=t.fanlines[n],m=$("<tr>");m.appendTo(f);var h=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(h).appendTo(m);var y=v.x.value()+"x"+v.y.value();$("<td>"+y+"</td>").appendTo(m);var p=$("<td class='colorpicker-cell'>");p.appendTo(m);var c=TradingView.addColorPicker(p),u=$("<td>");u.appendTo(m);var _=TradingView.createLineWidthEditor();_.appendTo(u),this.bindControl(new a(h,v.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new l(c,v.color,!0,this.model(),"Change Gann Fan Color",0)),this.bindControl(new s(_,v.width,!0,this.model(),"Change Gann Line Width"))}var w=$("<table>");$("<td valign='top'>").append(w).appendTo(e);var T=$("<tr>");$("<td colspan='4'>"+$.t("Arcs")+"</td>").appendTo(T),T.appendTo(w);for(var n in t.arcs._childs){var b=t.arcs[n],S=$("<tr>");S.appendTo(w);var h=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(h).appendTo(S);var y=b.x.value()+"x"+b.y.value();$("<td>"+y+"</td>").appendTo(S);var p=$("<td class='colorpicker-cell'>");p.appendTo(S);var c=TradingView.addColorPicker(p),u=$("<td>");u.appendTo(S);var _=TradingView.createLineWidthEditor();_.appendTo(u),this.bindControl(new a(h,b.visible,!0,this.model(),"Change Gann Line Visibility")),this.bindControl(new l(c,b.color,!0,this.model(),"Change Gann Arc Color",0)),this.bindControl(new s(_,b.width,!0,this.model(),"Change Gann Line Width"))}var C=$("<tbody>").appendTo(this._table),x=$('<input type="checkbox" class="visibility-switch">'),P=TradingView.createTransparencyEditor(),L=$("<tr>").appendTo(C),E=$("<table>");$('<td colspan="3">').append(E).appendTo(L);var L=$("<tr>").appendTo(E);$("<td>"+$.t("Background")+"</td>").appendTo(L),$("<td>").append(x).appendTo(L),$("<td>").append(P).appendTo(L),this.bindControl(new a(x,this._linetool.properties().arcsBackground.fillBackground,!0,this.model(),"Change Gann Square Filling")),this.bindControl(new s(P,this._linetool.properties().arcsBackground.transparency,!0,this.model(),"Change Gann Square Background Transparency"))},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SimpleComboBinder,d=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i,r){var n=$("<tr>");n.appendTo(this._tbody);var o="control-level-"+i+"-"+r,h=$("<td>");h.appendTo(n);var p=$("<input type='checkbox' class='visibility-switch' id='"+o+"'>");p.appendTo(h);var c=this.createLabeledCell(e).appendTo(n);c.find("label").attr("for",o);var u=$("<td class='colorpicker-cell'>");u.appendTo(n);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(n);var g=TradingView.createLineWidthEditor();g.appendTo(f);var v=$("<td>");v.appendTo(n);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new a(p,t.visible,!0,this.model(),"Change Gann Fan Line Visibility")),this.bindControl(new s(_,t.color,!0,this.model(),"Change Gann Fan Line Color",0)),this.bindControl(new l(m,t.linestyle,parseInt,!0,this.model(),"Change Gann Fan Line Style")),this.bindControl(new d(g,t.linewidth,!0,this.model(),"Change Gann Fan Line Width"))},r.prototype.prepareLayout=function(){var e=$('<table class="property-page" cellspacing="0" cellpadding="2">'),t=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._tbody=$("<tbody>").appendTo(e);for(var i=1;9>=i;i++){var r="level"+i,n=this._linetool.properties()[r],o=n.coeff1.value(),s=n.coeff2.value(),l="<sup>"+o+"</sup>&frasl;<sub>"+s+"</sub>";this.addLevelEditor(l,n,o,s)}var h=$("<input type='checkbox' class='visibility-switch'>"),p=this.addLabeledRow(t,$.t("Labels"),h);$("<td>").append(h).prependTo(p),this.bindControl(new a(h,this._linetool.properties().showLabels,!0,this.model(),"Change Gann Fan Labels Visibility")),this._table=e.add(t);var p=$("<tr>");p.appendTo(this._table);var c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(p),this.createLabeledCell($.t("Background"),c).appendTo(p);var u=TradingView.createTransparencyEditor();$('<td colspan="3">').append(u).appendTo(p),this.bindControl(new a(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfan Background Visibility")),this.bindControl(new d(u,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfan Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.FloatBinder,s=o.SimpleComboBinder,l=o.BooleanBinder,d=o.ColorBinding,h=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(this._table);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");if(o.appendTo(n),e){var p=$("<td>");p.appendTo(r);var c=$("<input type='text'>");c.appendTo(p),c.css("width","70px"),this.bindControl(new a(c,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else this.createLabeledCell("Trend Line",o).appendTo(r);var u=$("<td class='colorpicker-cell'>");u.appendTo(r);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(r);var g=TradingView.createLineWidthEditor();if(g.appendTo(f),!e){var v=$("<td>");v.appendTo(r);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new s(m,t.linestyle,parseInt,!0,this.model(),"Change Fib Circle Style"))}this.bindControl(new l(o,t.visible,!0,this.model(),"Change Fib Circle Visibility")),this.bindControl(new d(_,t.color,!0,this.model(),"Change Fib Circle Line Color",0)),this.bindControl(new h(g,t.linewidth,!0,this.model(),"Change Fib Circle Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var e=1;11>=e;e++){var t="level"+e;this.addLevelEditor("Level "+e,this._linetool.properties()[t],!1)}var i=$("<input type='checkbox' class='visibility-switch'>"),r=this.addLabeledRow(this._table,"Levels",i);$("<td>").append(i).prependTo(r);var n=$("<input type='checkbox' class='visibility-switch'>"),r=this.addLabeledRow(this._table,"Coeffs As Percents",n);$("<td>").append(n).prependTo(r),this.bindControl(new l(i,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Circle Levels Visibility"));var r=$("<tr>");r.appendTo(this._table);var o=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(o).appendTo(r),this.createLabeledCell("Background",o).appendTo(r);var a=TradingView.createTransparencyEditor();$('<td colspan="3">').append(a).appendTo(r),this.bindControl(new l(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Pitchfork Background Visibility")),this.bindControl(new h(a,this._linetool.properties().transparency,!0,this.model(),"Change Pitchfork Background Transparency")),this.bindControl(new l(n,this._linetool.properties().coeffsAsPercents,!0,this.model(),"Change Fib Retracement Coeffs As Percents")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.FloatBinder,s=o.BooleanBinder,l=o.SliderBinder,d=o.SimpleComboBinder,h=o.ColorBinding;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(this._table);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");if(o.appendTo(n),e){var p=$("<td>");p.appendTo(r);var c=$("<input type='text'>");c.appendTo(p),c.css("width","70px"),this.bindControl(new a(c,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else this.createLabeledCell($.t("Trend Line"),o).appendTo(r);var u=$("<td class='colorpicker-cell'>");u.appendTo(r);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(r);var g=TradingView.createLineWidthEditor();g.appendTo(f);var v=$("<td>");v.appendTo(r);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new s(o,t.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new h(_,t.color,!0,this.model(),"Change Pitchfork Line Color",0)),this.bindControl(new d(m,t.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style")),this.bindControl(new l(g,t.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var e=1;11>=e;e++){var t="level"+e;this.addLevelEditor($.t("Level {0}").format(e),this._linetool.properties()[t],!1)}var i=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),r=$("<tr>").appendTo(i),n=($('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(r)),$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(r)),$("<input type='checkbox' class='visibility-switch'>")),o=this.addLabeledRow(this._table,$.t("Show Labels"),n);$("<td>").append(n).prependTo(o);var a=$("<table cellspacing='0' cellpadding='0'>"),h=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),p=$("<select><option value='top'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='bottom'>"+$.t("bottom")+"</option></select>"),o=$("<tr>");o.append("<td>"+$.t("Labels")+"</td>").append(h).append("<td>&nbsp</td>").append(p),o.appendTo(a);var o=$("<tr>");$("<td colspan='5'>").append(a).appendTo(o),o.appendTo(this._table),this.bindControl(new d(h,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Trend-Based Fib Time Labels Alignment")),this.bindControl(new d(p,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Trend-Based Fib Time Labels Alignment"));var o=$("<tr>");o.appendTo(this._table);var c=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(c).appendTo(o),this.createLabeledCell($.t("Background"),c).appendTo(o);var u=TradingView.createTransparencyEditor();$('<td colspan="3">').append(u).appendTo(o),this.bindControl(new s(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility")),this.bindControl(new l(u,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency")),this.bindControl(new s(n,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Retracement Extend Lines")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.FloatBinder,d=o.SimpleComboBinder,h=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(e);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");o.appendTo(n);var d=$("<td>");d.appendTo(r);var h=$("<input type='text'>");h.appendTo(d),h.css("width","70px"),this.bindControl(new a(o,i.visible,!0,this.model(),"Change Gann Square Line Visibility")),this.bindControl(new l(h,i.coeff,!1,this.model(),"Change Pitchfork Line Coeff"));var p=$("<td class='colorpicker-cell'>");p.appendTo(r);var c=TradingView.addColorPicker(p);this.bindControl(new s(c,i.color,!0,this.model(),"Change Gann Square Line Color",0))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page property-page-unpadded"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this._table.css({width:"100%"});var e=$("<tbody>").appendTo(this._table),t=$("<tr>");t.appendTo(e);var i=$('<td width="50%">');i.appendTo(t);var r=$('<td width="50%">');r.appendTo(t);var n=$('<table cellspacing="0" cellpadding="2">');n.appendTo(i),n.addClass("property-page");var o=$('<table cellspacing="0" cellpadding="2">');o.appendTo(r),o.addClass("property-page"),$("<tr><td align='center' colspan='4'>"+$.t("Price Levels")+"</td></tr>").appendTo(n),$("<tr><td align='center' colspan='4'>"+$.t("Time Levels")+"</td></tr>").appendTo(o);for(var l=1;7>=l;l++){var p="hlevel"+l;this.addLevelEditor(n,"Level "+l,this._linetool.properties()[p])}for(var l=1;7>=l;l++){var p="vlevel"+l;this.addLevelEditor(o,"Level "+l,this._linetool.properties()[p])}var c=$("<input type='checkbox' class='visibility-switch'>"),u=$("<input type='checkbox' class='visibility-switch'>"),_=$("<input type='checkbox' class='visibility-switch'>"),f=$("<input type='checkbox' class='visibility-switch'>"),g=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}),v=$("<tr>").appendTo(g),m=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(v)),y=$('<table class="property-page" cellspacing="0" cellpadding="0">').appendTo($("<td>").css({width:"50%"}).appendTo(v)),w=this.addLabeledRow(m,$.t("Left Labels"),c);$("<td>").append(c).prependTo(w);var w=this.addLabeledRow(y,$.t("Right Labels"),u);$("<td>").append(u).prependTo(w);var w=this.addLabeledRow(m,$.t("Top Labels"),_);$("<td>").append(_).prependTo(w);var w=this.addLabeledRow(y,$.t("Bottom Labels"),f);$("<td>").append(f).prependTo(w),this.bindControl(new a(c,this._linetool.properties().showLeftLabels,!0,this.model(),"Change Gann Square Left Labels Visibility")),this.bindControl(new a(u,this._linetool.properties().showRightLabels,!0,this.model(),"Change Gann Square Right Labels Visibility")),this.bindControl(new a(_,this._linetool.properties().showTopLabels,!0,this.model(),"Change Gann Square Top Labels Visibility")),this.bindControl(new a(f,this._linetool.properties().showBottomLabels,!0,this.model(),"Change Gann Square Bottom Labels Visibility"));var T=$('<table class="property-page" cellspacing="0" cellpadding="2">'),b=TradingView.createLineWidthEditor(),S=TradingView.createLineStyleEditor(),C=this.createColorPicker(),x=$("<input type='checkbox' class='visibility-switch'>"),w=this.addLabeledRow(T,$.t("Grid"),x);$("<td>").append(x).prependTo(w),$("<td>").append(C).appendTo(w),$("<td>").append(b).appendTo(w),$("<td>").append(S.render()).appendTo(w),this.bindControl(new a(x,this._linetool.properties().grid.visible,!0,this.model(),"Change Fib Speed Resistance Fan Grid Visibility")),this.bindControl(new s(C,this._linetool.properties().grid.color,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Color",0)),this.bindControl(new d(S,this._linetool.properties().grid.linestyle,parseInt,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Style")),this.bindControl(new h(b,this._linetool.properties().grid.linewidth,!0,this.model(),"Change Fib Speed Resistance Fan Grid Line Width")),this._table=this._table.add(g).add(T);var w=$("<tr>");w.appendTo(T);var x=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(x).appendTo(w),this.createLabeledCell("Background",x).appendTo(w);var P=TradingView.createTransparencyEditor();$('<td colspan="3">').append(P).appendTo(w),this.bindControl(new a(x,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Speed/Resistance Fan Background Visibility")),this.bindControl(new h(P,this._linetool.properties().transparency,!0,this.model(),"Change Fib Speed/Resistance Fan Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=this.addLabeledRow(e,"Line");$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n),this.bindControl(new s(r,this._linetool.properties().linecolor,!0,this.model(),"Change Fib Spiral Line Color")),this.bindControl(new a(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Fib Spiral Line Style")),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Fib Spiral Line Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.FloatBinder,s=o.BooleanBinder,l=o.ColorBinding,d=o.SimpleComboBinder,h=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(this._table);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");if(o.appendTo(n),e){var p=$("<td>");p.appendTo(r);var c=$("<input type='text'>");c.appendTo(p),c.css("width","70px"),this.bindControl(new a(c,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else this.createLabeledCell($.t("Trend Line"),o).appendTo(r);var u=$("<td class='colorpicker-cell'>");u.appendTo(r);var _=TradingView.addColorPicker(u),f=$("<td>");f.appendTo(r);var g=TradingView.createLineWidthEditor();g.appendTo(f);var v=$("<td>");v.appendTo(r);var m=TradingView.createLineStyleEditor();m.render().appendTo(v),this.bindControl(new s(o,t.visible,!0,this.model(),"Change Pitchfork Line Visibility")),this.bindControl(new l(_,t.color,!0,this.model(),"Change Pitchfork Line Color",0)),this.bindControl(new d(m,t.linestyle,parseInt,!0,this.model(),"Change Pitchfork Line Style")),this.bindControl(new h(g,t.linewidth,parseInt,this.model(),"Change Pitchfork Line Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");for(var e=1;11>=e;e++){var t="level"+e;this.addLevelEditor("Level "+e,this._linetool.properties()[t],!1)}var i=(TradingView.createLineWidthEditor(),TradingView.createLineStyleEditor(),this.createColorPicker(),$("<input type='checkbox' class='visibility-switch'>")),r=this.addLabeledRow(this._table,$.t("Show Labels"),i);$("<td>").append(i).prependTo(r);var n=$("<table cellspacing='0' cellpadding='0'>"),o=$("<select><option value='left'>"+$.t("left")+"</option><option value='center'>"+$.t("center")+"</option><option value='right'>"+$.t("right")+"</option></select>"),a=$("<select><option value='top'>"+$.t("top")+"</option><option value='middle'>"+$.t("middle")+"</option><option value='bottom'>"+$.t("bottom")+"</option></select>"),r=$("<tr>");
r.append("<td>"+$.t("Labels")+"</td>").append(o).append("<td>&nbsp</td>").append(a),r.appendTo(n);var r=$("<tr>");$("<td colspan='5'>").append(n).appendTo(r),r.appendTo(this._table),this.bindControl(new d(o,this._linetool.properties().horzLabelsAlign,null,!0,this.model(),"Change Fib Time Zone Labels Alignment")),this.bindControl(new d(a,this._linetool.properties().vertLabelsAlign,null,!0,this.model(),"Change Fib Time Zone Labels Alignment"));var r=$("<tr>");r.appendTo(this._table);var l=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(l).appendTo(r),this.createLabeledCell($.t("Background"),l).appendTo(r);var p=TradingView.createTransparencyEditor();$('<td colspan="3">').append(p).appendTo(r),this.bindControl(new s(i,this._linetool.properties().showLabels,!0,this.model(),"Change Fib Time Zone Labels Visibility")),this.bindControl(new h(p,this._linetool.properties().transparency,!0,this.model(),"Change Fib Retracement Background Transparency")),this.bindControl(new s(l,this._linetool.properties().fillBackground,!0,this.model(),"Change Fib Retracement Background Visibility")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.FloatBinder,s=o.BooleanBinder,l=o.ColorBinding,d=o.SliderBinder;inherit(r,n),r.prototype.addLevelEditor=function(e,t,i){var r=$("<tr>");r.appendTo(this._table);var n=$("<td>");n.appendTo(r);var o=$("<input type='checkbox' class='visibility-switch'>");if(o.appendTo(n),e){var h=$("<td>");h.appendTo(r);var p=$("<input type='text'>");p.appendTo(h),p.css("width","70px"),this.bindControl(new a(p,t.coeff,!1,this.model(),"Change Pitchfork Line Coeff"))}else this.createLabeledCell("Trend Line",o).appendTo(r);var c=$("<td class='colorpicker-cell'>");c.appendTo(r);var u=TradingView.addColorPicker(c),_=$("<td>");_.appendTo(r);var f=TradingView.createLineWidthEditor();f.appendTo(_),this.bindControl(new s(o,t.visible,!0,this.model(),"Change Fib Wedge Visibility")),this.bindControl(new l(u,t.color,!0,this.model(),"Change Fib Wedge Line Color",0)),this.bindControl(new d(f,t.linewidth,!0,this.model(),"Change Fib Wedge Width"))},r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.addLevelEditor(null,this._linetool.properties().trendline,!1);for(var e=1;11>=e;e++){var t="level"+e;this.addLevelEditor("Level "+e,this._linetool.properties()[t],!1)}var i=$("<input type='checkbox' class='visibility-switch'>"),r=this.addLabeledRow(this._table,"Levels",i);$("<td>").append(i).prependTo(r),this.bindControl(new s(i,this._linetool.properties().showCoeffs,!0,this.model(),"Change Fib Wedge Levels Visibility"));var r=$("<tr>");r.appendTo(this._table);var n=$("<input type='checkbox' class='visibility-switch'>");$("<td>").append(n).appendTo(r),this.createLabeledCell("Background",n).appendTo(r);var o=TradingView.createTransparencyEditor();$('<td colspan="3">').append(o).appendTo(r),this.bindControl(new s(n,this._linetool.properties().fillBackground,!0,this.model(),"Change Wedge Background Visibility")),this.bindControl(new d(o,this._linetool.properties().transparency,!0,this.model(),"Change Wedge Background Transparency")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=TradingView.createLineStyleEditor(),i=this.createColorPicker(),r=this.addLabeledRow(this._table,"Lines");$("<td>").append(i).appendTo(r),$("<td>").append(e).appendTo(r),$("<td>").append(t.render()).appendTo(r),this.bindControl(new s(i,this._linetool.properties().linecolor,!0,this.model(),"Change Circle Lines Color")),this.bindControl(new a(t,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Circle Lines Style")),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Circle Lines Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.SliderBinder,d=o.BooleanBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=this.addLabeledRow(e,$.t("Line"));$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n);var o,h;if(this._linetool.properties().fillBackground){$("<td>").prependTo(n),o=$('<input type="checkbox" class="visibility-switch">'),h=this.createColorPicker();var p=$("<tbody>").appendTo(this._table),n=$("<tr>").appendTo(p);$("<td>").append(o).appendTo(n),$("<td>").append($.t("Background")).appendTo(n),$("<td>").append(h).appendTo(n)}this.bindControl(new s(r,this._linetool.properties().linecolor,!0,this.model(),"Change Time Cycles Color")),this.bindControl(new a(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Time Cycles Line Style")),this.bindControl(new l(t,this._linetool.properties().linewidth,!0,this.model(),"Change Time Cycles Line Width")),o&&(this.bindControl(new d(o,this._linetool.properties().fillBackground,!0,this.model(),"Change Time Cycles Filling")),this.bindControl(new s(h,this._linetool.properties().backgroundColor,!0,this.model(),"Change Time Cycles Background Color",this._linetool.properties().transparency)))},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.BooleanBinder,d=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=this.createColorPicker(),r=this.addLabeledRow(e,$.t("Line"));$("<td>").prependTo(r),$("<td>").append(i).appendTo(r),$("<td>").append(t).appendTo(r);var n=this.createColorPicker(),o=this.createColorPicker(),h=this.createFontSizeEditor(),p=this.createFontEditor(),c=(this.createTextEditor(350,200),this.createColorPicker()),u=$('<input type="checkbox" class="visibility-switch">'),_=this.createColorPicker(),f=$('<input type="checkbox" class="visibility-switch">');this.bindControl(new s(n,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new a(h,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new a(p,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new s(c,this._linetool.properties().labelBackgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().labelBackgroundTransparency)),this.bindControl(new l(u,this._linetool.properties().fillLabelBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new s(_,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().backgroundTransparency)),this.bindControl(new l(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new s(o,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color"));var g=this.addLabeledRow(e,$.t("Background"),f);$("<td>").append(f).prependTo(g),$("<td>").append(_).appendTo(g);var v=this.addLabeledRow(e,$.t("Label"));$("<td>").prependTo(v),$("<td>").append(n).appendTo(v),$("<td>").append(p).appendTo(v),$("<td>").append(h).appendTo(v);var g=this.addLabeledRow(e,$.t("Label Background"),u);$("<td>").append(u).prependTo(g),$("<td>").append(c).appendTo(g),this.bindControl(new s(i,this._linetool.properties().linecolor,!0,this.model(),"Change Date Range Color")),this.bindControl(new d(t,this._linetool.properties().linewidth,!0,this.model(),"Change Date Range Line Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.BooleanBinder,d=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=this.createColorPicker(),r=this.addLabeledRow(e,$.t("Line"));$("<td>").prependTo(r),$("<td>").append(i).appendTo(r),$("<td>").append(t).appendTo(r);var n=this.createColorPicker(),o=this.createColorPicker(),h=this.createFontSizeEditor(),p=this.createFontEditor(),c=(this.createTextEditor(350,200),this.createColorPicker()),u=$('<input type="checkbox" class="visibility-switch">'),_=this.createColorPicker(),f=$('<input type="checkbox" class="visibility-switch">');this.bindControl(new s(n,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new a(h,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new a(p,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new s(c,this._linetool.properties().labelBackgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().labelBackgroundTransparency)),this.bindControl(new l(u,this._linetool.properties().fillLabelBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new s(_,this._linetool.properties().backgroundColor,!0,this.model(),"Change Text Background",this._linetool.properties().backgroundTransparency)),this.bindControl(new l(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Text Background Fill")),this.bindControl(new s(o,this._linetool.properties().borderColor,!0,this.model(),"Change Text Border Color"));var g=this.addLabeledRow(e,$.t("Background"),f);$("<td>").append(f).prependTo(g),$("<td>").append(_).appendTo(g);var v=this.addLabeledRow(e,$.t("Label"));$("<td>").prependTo(v),$("<td>").append(n).appendTo(v),$("<td>").append(p).appendTo(v),$("<td>").append(h).appendTo(v);var g=this.addLabeledRow(e,$.t("Label Background"),u);$("<td>").append(u).prependTo(g),$("<td>").append(c).appendTo(g),this.bindControl(new s(i,this._linetool.properties().linecolor,!0,this.model(),"Change Date Range Color")),this.bindControl(new d(t,this._linetool.properties().linewidth,!0,this.model(),"Change Date Range Line Width")),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SliderBinder,d=o.SimpleComboBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.createColorPicker(),r=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),o=this.createFontSizeEditor(),h=this.createFontEditor(),p=this.addLabeledRow(this._table,"Border");p.prepend("<td>"),$("<td>").append(t).appendTo(p),$("<td>").append(e).appendTo(p);var c=$('<input type="checkbox" class="visibility-switch">'),u=this.createColorPicker(),h=this.createFontEditor(),p=this.addLabeledRow(this._table,"Background",c);$("<td>").append(c).prependTo(p),$("<td>").append(u).appendTo(p),this.bindControl(new a(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Pattern Filling")),this.bindControl(new s(t,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color")),this.bindControl(new s(i,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color")),this.bindControl(new s(u,this._linetool.properties().backgroundColor,!0,this.model(),"Change Pattern Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width")),this.bindControl(new d(o,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new d(h,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new a(r,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new a(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var _=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(h)).append($(document.createElement("td")).attr({width:1}).append(o)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(r)).append($(document.createElement("td")).css("vertical-align","top").append(n)).append($("</tr></table>")),p=this.addLabeledRow(this._table,"");$('<td colspan="5">').append(_).appendTo(p),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.ColorBinding,s=o.SliderBinder,l=o.SimpleComboBinder,d=o.BooleanBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.createColorPicker(),r=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),o=this.createFontSizeEditor(),h=this.createFontEditor(),p=this.addLabeledRow(this._table,"Border");p.prepend("<td>"),$("<td>").append(t).appendTo(p),$("<td>").append(e).appendTo(p);var h=this.createFontEditor();this.bindControl(new a(t,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color")),this.bindControl(new a(i,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color")),this.bindControl(new s(e,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width")),this.bindControl(new l(o,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new l(h,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new d(r,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new d(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var c=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(h)).append($(document.createElement("td")).attr({width:1}).append(o)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(r)).append($(document.createElement("td")).css("vertical-align","top").append(n)).append($("</tr></table>")),p=this.addLabeledRow(this._table,"");$('<td colspan="5">').append(c).appendTo(p),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.ColorBinding,s=o.SimpleComboBinder,l=o.SimpleStringBinder,d=o.BooleanBinder;inherit(r,n),r.prototype.prepareLayout=function(){var e=this.createColorPicker(),t=this.createFontSizeEditor(),i=this.createFontEditor(),r=this.createTextEditor(350,200),n=this.createColorPicker(),o=this.createColorPicker(),h=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),p=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');this.bindControl(new a(e,this._linetool.properties().textColor,!0,this.model(),"Change Text Color")),this.bindControl(new s(t,this._linetool.properties().fontSize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new s(i,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new l(r,this._linetool.properties().text,null,!0,this.model(),"Change Text")),this.bindControl(new a(n,this._linetool.properties().markerColor,!0,this.model(),"Change Marker and Border Color")),this.bindControl(new a(o,this._linetool.properties().backgroundColor,!0,this.model(),"Change Background Color",this._linetool.properties().backgroundTransparency)),this.bindControl(new d(h,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new d(p,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var c=$('<table class="property-page" cellspacing="0" cellpadding="2">'),u=$('<table class="property-page" cellspacing="0" cellpadding="2">'),_=$('<table class="property-page" cellspacing="0" cellpadding="2">');this._table=c.add(_).add(u),$(document.createElement("tr")).append($(document.createElement("td")).attr({width:1}).append(e)).append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(t)).append($(document.createElement("td")).attr({width:1}).append(h)).append($(document.createElement("td")).append(p)).appendTo(c),$(document.createElement("tr")).append($(document.createElement("td")).attr({colspan:5}).append(r)).appendTo(c);var f=this.addLabeledRow(_,$.t("Label"));$("<td>").attr("colspan",2).append(n).appendTo(f);var f=this.addLabeledRow(_,$.t("Background"));$("<td>").append(o).appendTo(f),this.loadData(),setTimeout(function(){r.select(),r.focus()},20)},r.prototype.widget=function(){return this._table},r.prototype.dialogPosition=function(e,t){var r=i(136).LineToolNote;if(e&&t){for(var n,o=0,a=this._linetool.Z98.paneForSource(this._linetool),s=$44.getChartWidget();o<s.paneWidgets().length;o++)if(s.paneWidgets()[o]._state==a){n=$(s.paneWidgets()[o].canvas).offset().left;break}var l=(this._linetool.paneViews()||[])[0],d=new MathEx.Point(0,0);l&&(d=l._floatPoints[0]||this._linetool._fixedPoints[0]);var h=(n||0)+d.x,p=r.TOOLTIP_WIDTH,c=h-p/2,u=t.outerWidth();return e.left<c&&e.left+u+10>c?(e.left-=e.left+u+10-c,e):e.left>c&&e.left<c+p+10?(e.left+=c+p+10-e.left,e):void 0}},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.BooleanBinder,s=o.ColorBinding,l=o.SliderBinder,d=o.SimpleComboBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=TradingView.createLineWidthEditor(),t=this.createColorPicker(),i=this.createColorPicker(),r=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),n=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>'),o=this.createFontSizeEditor(),h=this.createFontEditor(),p=this.addLabeledRow(this._table,"Border");p.prepend("<td>"),$("<td>").append(t).appendTo(p),$("<td>").append(e).appendTo(p);var c=$('<input type="checkbox" class="visibility-switch">'),u=this.createColorPicker(),h=this.createFontEditor(),p=this.addLabeledRow(this._table,"Background",c);$("<td>").append(c).prependTo(p),$("<td>").append(u).appendTo(p),this.bindControl(new a(c,this._linetool.properties().fillBackground,!0,this.model(),"Change Pattern Filling")),this.bindControl(new s(t,this._linetool.properties().color,!0,this.model(),"Change Pattern Line Color")),this.bindControl(new s(i,this._linetool.properties().textcolor,!0,this.model(),"Change Pattern Text Color")),this.bindControl(new s(u,this._linetool.properties().backgroundColor,!0,this.model(),"Change Pattern Background Color",this._linetool.properties().transparency)),this.bindControl(new l(e,this._linetool.properties().linewidth,!0,this.model(),"Change Pattern Border Width")),this.bindControl(new d(o,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new d(h,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new a(r,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new a(n,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic"));var _=$('<table class="property-page" cellspacing="0" cellpadding="2"><tr>').append($(document.createElement("td")).attr({width:1}).append(i)).append($(document.createElement("td")).attr({width:1}).append(h)).append($(document.createElement("td")).attr({width:1}).append(o)).append($(document.createElement("td")).css("vertical-align","top").attr({width:1}).append(r)).append($(document.createElement("td")).css("vertical-align","top").append(n)).append($("</tr></table>")),p=this.addLabeledRow(this._table,"");$('<td colspan="5">').append(_).appendTo(p),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.BooleanBinder,l=o.ColorBinding,d=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=this.addLabeledRow(e,$.t("Line"));$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n);var n=this.addLabeledRow(e,$.t("Text")),o=this.createColorPicker(),h=this.createFontSizeEditor(),p=this.createFontEditor(),c=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),u=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(o).appendTo(n),$("<td>").append(p).appendTo(n),$("<td>").append(h).appendTo(n),$("<td>").append(c).appendTo(n),$("<td>").append(u).appendTo(n);var _=$("<tbody>").appendTo(this._table),f=$('<input type="checkbox" class="visibility-switch">'),g=this.createColorPicker(),n=this.addLabeledRow(_,$.t("Background"),f),v=$("<table>");$('<td colspan="5">').append(v).appendTo(n);var n=$("<tr>").appendTo(v);$("<td>").append(f).appendTo(n),$("<td>").append(g).appendTo(n);var m=$("<tbody>").appendTo(this._table),y=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),w=$('<input type="checkbox">').appendTo(y),T=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),b=$('<input type="checkbox">').appendTo(T),S=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),C=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(m,$.t("Left End"));$('<td colspan="3">').appendTo(n).append(S).append(y);var n=this.addLabeledRow(m,$.t("Right End"));$('<td colspan="3">').appendTo(n).append(C).append(T);var x=$("<tbody>").appendTo(this._table),n=$("<tr>").appendTo(x),P=$("<input type='checkbox'>"),L=$("<label style='display:block'>").append(P).append($.t("Show Prices"));$("<td colspan='2'>").append(L).appendTo(n),this.bindControl(new a(h,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new a(p,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new l(o,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new s(c,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new s(u,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.bindControl(new s(P,this._linetool.properties().showPrices,!0,this.model(),"Change Disjoint Angle Show Prices")),this.bindControl(new s(w,this._linetool.properties().extendLeft,!0,this.model(),"Change Disjoint Angle Extending Left")),this.bindControl(new s(b,this._linetool.properties().extendRight,!0,this.model(),"Change Disjoint Angle Extending Right")),this.bindControl(new l(r,this._linetool.properties().linecolor,!0,this.model(),"Change Disjoint Angle Color")),this.bindControl(new a(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Disjoint Angle Style")),this.bindControl(new d(t,this._linetool.properties().linewidth,!0,this.model(),"Change Disjoint Angle Width")),this.bindControl(new a(S,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Disjoint Angle Left End")),this.bindControl(new a(C,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Disjoint Angle Right End")),this.bindControl(new s(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Disjoint Angle Filling")),this.bindControl(new l(g,this._linetool.properties().backgroundColor,!0,this.model(),"Change Disjoint Angle Background Color",this._linetool.properties().transparency)),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179),a=o.SimpleComboBinder,s=o.ColorBinding,l=o.BooleanBinder,d=o.SliderBinder;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var e=$("<tbody>").appendTo(this._table),t=TradingView.createLineWidthEditor(),i=TradingView.createLineStyleEditor(),r=this.createColorPicker(),n=this.addLabeledRow(e,$.t("Line"));$("<td>").append(r).appendTo(n),$("<td>").append(t).appendTo(n),$('<td colspan="3">').append(i.render()).appendTo(n);var n=this.addLabeledRow(e,$.t("Text")),o=this.createColorPicker(),h=this.createFontSizeEditor(),p=this.createFontEditor(),c=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-bold"></span></span>'),u=$('<span class="_tv-button _tv-button-fontstyle"><span class="icon-fontstyle-italic"></span></span>');$("<td>").append(o).appendTo(n),$("<td>").append(p).appendTo(n),$("<td>").append(h).appendTo(n),$("<td>").append(c).appendTo(n),$("<td>").append(u).appendTo(n);var _=$("<tbody>").appendTo(this._table),f=$('<input type="checkbox" class="visibility-switch">'),g=this.createColorPicker(),n=this.addLabeledRow(_,$.t("Background"),f),v=$("<table>");$('<td colspan="5">').append(v).appendTo(n);var n=$("<tr>").appendTo(v);$("<td>").append(f).appendTo(n),$("<td>").append(g).appendTo(n);var m=$("<tbody>").appendTo(this._table),y=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),w=$('<input type="checkbox">').appendTo(y),T=$("<label>"+$.t("Extend")+" </label>").css({"margin-left":"8px"}),b=$('<input type="checkbox">').appendTo(T),S=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),C=$("<select><option value='0'>"+$.t("Normal")+"</option><option value='1'>"+$.t("Arrow")+"</option></select>"),n=this.addLabeledRow(m,$.t("Left End"));$('<td colspan="3">').appendTo(n).append(S).append(y);var n=this.addLabeledRow(m,$.t("Right End"));$('<td colspan="3">').appendTo(n).append(C).append(T);var x=$("<tbody>").appendTo(this._table),n=$("<tr>").appendTo(x),P=$("<input type='checkbox'>"),L=$("<label style='display:block'>").append(P).append($.t("Show Prices"));$("<td colspan='2'>").append(L).appendTo(n),this.bindControl(new a(h,this._linetool.properties().fontsize,parseInt,!0,this.model(),"Change Text Font Size")),this.bindControl(new a(p,this._linetool.properties().font,null,!0,this.model(),"Change Text Font")),this.bindControl(new s(o,this._linetool.properties().textcolor,!0,this.model(),"Change Text Color")),this.bindControl(new l(c,this._linetool.properties().bold,!0,this.model(),"Change Text Font Bold")),this.bindControl(new l(u,this._linetool.properties().italic,!0,this.model(),"Change Text Font Italic")),this.bindControl(new l(P,this._linetool.properties().showPrices,!0,this.model(),"Change Disjoint Angle Show Prices")),this.bindControl(new l(w,this._linetool.properties().extendLeft,!0,this.model(),"Change Disjoint Angle Extending Left")),this.bindControl(new l(b,this._linetool.properties().extendRight,!0,this.model(),"Change Disjoint Angle Extending Right")),this.bindControl(new s(r,this._linetool.properties().linecolor,!0,this.model(),"Change Disjoint Angle Color")),this.bindControl(new a(i,this._linetool.properties().linestyle,parseInt,!0,this.model(),"Change Disjoint Angle Style")),this.bindControl(new d(t,this._linetool.properties().linewidth,!0,this.model(),"Change Disjoint Angle Width")),this.bindControl(new a(S,this._linetool.properties().leftEnd,parseInt,!0,this.model(),"Change Disjoint Angle Left End")),this.bindControl(new a(C,this._linetool.properties().rightEnd,parseInt,!0,this.model(),"Change Disjoint Angle Right End")),this.bindControl(new l(f,this._linetool.properties().fillBackground,!0,this.model(),"Change Disjoint Angle Filling")),this.bindControl(new s(g,this._linetool.properties().backgroundColor,!0,this.model(),"Change Disjoint Angle Background Color",this._linetool.properties().transparency)),this.loadData()},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i),this.prepareLayout()}var n=i(178),o=i(179).ColorBinding;inherit(r,n),r.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2");var e=this.createColorPicker(),t=this.addLabeledRow(this._table,"Color:");$("<td>").append(e).appendTo(t);var i=this._linetool.properties();this._div=$("<div>").append(this._table),this.bindControl(new o(e,i.color,!0,this.model(),"Change Icon Color")),this.loadData()},r.prototype.widget=function(){return this._div},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.SimpleComboBinder,s=n.BooleanBinder,l=n.SliderBinder,d=n.ColorBinding,h=i(186).StudyStylesPropertyPage;inherit(r,o),r.prototype.prepareLayout=function(){var e=this;this._table=$('<table class="property-page" cellspacing="0" cellpadding="2">');var t=this.createFontSizeEditor(),i=this.createFontEditor(),r=$("<input type='checkbox' class='visibility-switch'/>"),n=this.createTableInTable(this._table),o=this.addLabeledRow(n,"Labels Font");$("<td>").append(i).appendTo(o),$("<td>").append(t).appendTo(o);var p=this.createTableInTable(this._table),o=this.addLabeledRow(p,"Show Labels");$("<td>").append(r).prependTo(o),this.pivotTypes={Traditional:{"S5/R5":!0,"S4/R4":!0,"S3/R3":!0,"S2/R2":!0,"S1/R1":!0,P:!0},Fibonacci:{"S3/R3":!0,"S2/R2":!0,"S1/R1":!0,P:!0},Woodie:{"S4/R4":!0,"S3/R3":!0,"S2/R2":!0,"S1/R1":!0,
P:!0},Classic:{"S4/R4":!0,"S3/R3":!0,"S2/R2":!0,"S1/R1":!0,P:!0},DeMark:{"S1/R1":!0,P:!0},Camarilla:{"S4/R4":!0,"S3/R3":!0,"S2/R2":!0,"S1/R1":!0,P:!0}},this.bindControl(new a(i,this.Z99.properties().font,null,!0,this.model(),"Change Pivots Font")),this.bindControl(new a(t,this.Z99.properties().fontsize,parseInt,!0,this.model(),"Change Pivots Font Size")),this.bindControl(new s(r,this._property.levelsStyle.showLabels,!0,e.model(),"Show Pivot Labels"));var c=this._property.levelsStyle.visibility,u=this._property.levelsStyle.colors,_=this._property.levelsStyle.widths;e._rows=[];var f=function(e,t,i,r){for(var n=0;n<e._childs.length;n++){var o=e._childs[n],a=e[o],s=t[o],l=i[o];r(a,s,l,o)}};f(c,u,_,function(t,i,r,n){var o=$("<input type='checkbox' class='visibility-switch'/>");e.bindControl(new s(o,t,!0,e.model(),"Change "+n));var a=e.addLabeledRow(p,n,o);$("<td>").append(o).prependTo(a);var h=e.createColorPicker();$("<td>").append(h).appendTo(a),e.bindControl(new d(h,i,!0,e.model(),"Change "+n+" color"));var c=TradingView.createLineWidthEditor();$("<td>").append(c).appendTo(a),e.bindControl(new l(c,r,!0,e.model(),"Change "+n+" width")),e._rows.push({row:a,label:n,visibilityEditor:o})});var g=e.Z99.Q0.inputs.kind;e.lockNotUsedVisEditors(g.value()),g.subscribe(e,function(t){e.lockNotUsedVisEditors(t.value())}),h.prototype._putStudyDefaultStyles.call(this,this._table,3)},r.prototype.lockNotUsedVisEditors=function(e){for(var t=this,i=0;i<t._rows.length;i++){var r=t._rows[i],n=r.label,o=t.pivotTypes[e][n];r.visibilityEditor.prop("disabled",!o),r.row.css("opacity",o?1:.5)}},r.prototype.widget=function(){return this._table},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){n.call(this,e,t,i)}var n=i(177);inherit(r,n),e.exports=r},function(e,t,i){"use strict";function r(e,t,i){var r=t.m_model.properties();l.call(this,r,t);var n=this._series=t.mainSeries();this._chart=t.m_model,this.Z98=t,this.Z97=i,this._property=r,this._seriesProperty=n.properties(),this._scaleProperty=n.m_priceScale.properties(),this._mainAxisProperty=n.properties().priceAxisProperties;var o=null;$.each(t.m_model.panes(),function(e,t){$.each(t.Q17(),function(e,i){return i==n?(o=t,!1):void 0})}),this._pane=o,this.prepareLayout(),this._themes=[]}var n=i(185),o=i(5).UndoHistory,a=i(175),s=i(179),l=s.Q5,d=s.GreateTransformer,h=s.LessTransformer,p=s.ToIntTransformer,c=s.SimpleStringBinder,u=s.BooleanBinder,_=s.SliderBinder,f=s.ColorBinding,g=s.SimpleComboBinder,v=s.DisabledBinder,m=s.CheckboxWVBinding,y=i(61).ESDStudyBase,w=i(31),T=i(243);inherit(r,l),inherit(r,n),r.prototype.setScalesOpenTab=function(){this.scalesColumnLeft&&this.scalesColumnLeft.data("layout-tab-open",a.TAB_OPEN_OVERRIDE)},r.prototype.setTmzOpenTab=function(){this.tmzSessTable&&this.tmzSessTable.data("layout-tab-open",a.TAB_OPEN_OVERRIDE)},r.prototype.prepareLayout=function(){var e,t,i,r,n,o,s,l,m,T,b,S,C,x,P,L,E=this;if(Z75.enabled("chart_property_page_style")){e=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),t=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),i=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style")),this._prepareSeriesStyleLayout(e,t,i,this._seriesProperty),this._hasSeriesStyleLayout=!0,o=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style"));var V=$('<input type="checkbox">'),I=this.addLabeledRow(o,$.t("Price Line"),V);$("<td>").append(V).prependTo(I),this.bindControl(new u(V,this._seriesProperty.showPriceLine,!0,this.model(),"Change Price Price Line"));var A=TradingView.createLineWidthEditor();$("<td>").append(A).appendTo(I),this.bindControl(new _(A,this._seriesProperty.priceLineWidth,!0,this.model(),"Change Price Line Width")),s=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style"));var k=this.createSeriesMinTickEditor(),R=$("<tr>");R.appendTo(s),$("<td>"+$.t("Override Min Tick")+"</td>").appendTo(R),$("<td>").append(k).appendTo(R),this.bindControl(new g(k,this._seriesProperty.minTick,null,!0,this.model(),"Change MinTick")),l=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Style"));var M;if(this._pane&&(-1!==this._pane.leftPriceScale().Q17().indexOf(this._series)?M="left":-1!==this._pane.rightPriceScale().Q17().indexOf(this._series)?M="right":this._pane.isOverlay(this._series)&&(M="none")),M){var O={left:$.t("Scale Left"),right:$.t("Scale Right")};E._pane.actionNoScaleIsEnabled(E._series)&&(O.none=$.t("Screen (No Scale)"));var D=this.createKeyCombo(O).val(M).change(function(){switch(this.value){case"left":E.Z98.move(E._series,E._pane,E._pane.leftPriceScale());break;case"right":E.Z98.move(E._series,E._pane,E._pane.rightPriceScale());break;case"none":E.Z98.move(E._series,E._pane,null)}}),B=this.addRow(l);$("<td>"+$.t("Scale")+"</td>").appendTo(B),$("<td>").appendTo(B).append(D)}}if(Z75.enabled("chart_property_page_scales")){var N=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),F=$('<input type="checkbox">').change(function(){this.checked&&setTimeout(function(){E.Z98.m_model.Q18(new $21($21.LIGHT_UPDATE))},0)}),W=this.addLabeledRow(N,$.t("Auto Scale"),F),H=function(e){this._undoModel.setAutoScaleProperty(this._property,e,E._series.priceScale(),this._undoText)};$("<td>").append(F).prependTo(W),this.bindControl(new u(F,this._scaleProperty.autoScale,!0,this.model(),"Auto Scale",H)),this.bindControl(new v(F,this._scaleProperty.autoScaleDisabled,!0,this.model(),"Auto Scale"));var z=$('<input type="checkbox">'),U=this.addLabeledRow(N,$.t("Percentage"),z),G=function(e){this._undoModel.setPercentProperty(this._property,e,E._series.priceScale(),this._undoText)};$("<td>").append(z).prependTo(U),this.bindControl(new u(z,this._mainAxisProperty.percentage,!0,this.model(),"Scale Percentage",G)),this.bindControl(new v(z,this._mainAxisProperty.percentageDisabled,!0,this.model(),"Scale Percentage"));var j=$('<input type="checkbox">'),q=this.addLabeledRow(N,$.t("Log Scale"),j),Y=function(e){this._undoModel.setLogProperty(this._property,e,E._series.priceScale(),this._undoText)};$("<td>").append(j).prependTo(q),this.bindControl(new u(j,this._mainAxisProperty.log,!0,this.model(),"Log Scale",Y)),this.bindControl(new v(j,this._mainAxisProperty.logDisabled,!0,this.model(),"Log Scale"));var K=$('<input type="checkbox">').change(function(){this.checked&&setTimeout(function(){E.Z98.m_model.Q18(new $21($21.LIGHT_UPDATE))},0)}),X=this.addLabeledRow(N,$.t("Scale Series Only"),K);$("<td>").append(K).prependTo(X),this.bindControl(new u(K,this._property.scalesProperties.scaleSeriesOnly,!0,this.model(),"Scale Series Only"));var J=$("<input type='checkbox'/>"),Z=this.addLabeledRow(N,$.t("Lock scale"),J),Q=function(e){this._undoModel.setLockScaleProperty(this._property,e,E._series,this._undoText)},ee=function(e){Z.toggle(e.value()==w.STYLE_PNF)};$("<td>").append(J).prependTo(Z),this.bindControl(new u(J,this._seriesProperty.lockScale,!0,this.model(),"Change lock scale",Q)),this._seriesProperty.style.listeners().subscribe(this,ee);var te=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),ie=$('<input type="text" class="ticker">'),re=this.addLabeledRow(te,$.t("Top Margin"),ie);$("<td>").appendTo(re).append(ie),$("<td>%</td>").appendTo(re);var ne=[p(this._property.paneProperties.topMargin.value())];ne.push(h(25)),ne.push(d(0)),this.bindControl(new c(ie,this._property.paneProperties.topMargin,ne,!0,this.model(),"Top Margin"));var oe=$('<input type="text" class="ticker">'),ae=this.addLabeledRow(te,$.t("Bottom Margin"),oe);$("<td>").appendTo(ae).append(oe),$("<td>%</td>").appendTo(ae);var se=[p(this._property.paneProperties.bottomMargin.value())];se.push(h(25)),se.push(d(0)),this.bindControl(new c(oe,this._property.paneProperties.bottomMargin,se,!0,this.model(),"Bottom Margin"));var le=$('<input type="text" class="ticker">'),de=this.addLabeledRow(te,$.t("Right Margin"),le);$("<td>").appendTo(de).append(le),$("<td>"+$.t("bars",{context:"margin"})+"</td>").appendTo(de);var he=[p(this._property.timeScale.rightOffset.value())];he.push(h(~~this._chart.m_timeScale.maxOffset())),he.push(d(-200)),this.bindControl(new c(le,this._property.timeScale.rightOffset,he,!0,this.model(),"Right Margin"));var pe=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Scales")),ce=$("<input type='checkbox' />"),ue=this.addLabeledRow(pe,$.t("Left Axis"),ce);$("<td>").append(ce).prependTo(ue),setTimeout(function(){this.bindControl(new u(ce,this._property.scalesProperties.showLeftScale,!0,this.model(),"Show Left Axis"))}.bind(this),0);var _e=$("<input type='checkbox' />"),fe=this.addLabeledRow(pe,$.t("Right Axis"),_e);if($("<td>").append(_e).prependTo(fe),setTimeout(function(){this.bindControl(new u(_e,this._property.scalesProperties.showRightScale,!0,this.model(),"Show Right Axis"))}.bind(this),0),Z75.enabled("countdown")){var ge=$("<input type='checkbox'>"),ve=this.addLabeledRow(pe,$.t("Countdown"),ge);$("<td>").append(ge).prependTo(ve),this.bindControl(new u(ge,this._seriesProperty.showCountdown,!0,this.model(),"Change Show Countdown"))}var me=$('<input type="checkbox">'),ye=this.addLabeledRow(pe,$.t("Symbol Last Value"),me);$("<td>").append(me).prependTo(ye),this.bindControl(new u(me,this._property.scalesProperties.showSeriesLastValue,!0,this.model(),"Change Symbol Last Value Visibility"));var we=$('<input type="checkbox">'),Te=this.addLabeledRow(pe,$.t("Indicator Last Value"),we);$("<td>").append(we).prependTo(Te),this.bindControl(new u(we,this._property.scalesProperties.showStudyLastValue,!0,this.model(),"Change Indicator Last Value Visibility"));var be=$('<input type="checkbox">'),Se=this.addLabeledRow(pe,$.t("Symbol Labels"),be);$("<td>").append(be).prependTo(Se),this.bindControl(new u(be,this._property.scalesProperties.showSymbolLabels,!0,this.model(),"Show Symbol Labels"));var Ce=$('<input type="checkbox">'),xe=this.addLabeledRow(pe,$.t("Indicator Labels"),Ce);$("<td>").append(Ce).prependTo(xe),this.bindControl(new u(Ce,this._property.scalesProperties.showStudyPlotLabels,!0,this.model(),"Show Study Plots Labels"));var Pe=$("<input type='checkbox' />"),Le=this.addLabeledRow(pe,$.t("Precise Labels"),Pe);$("<td>").append(Pe).prependTo(Le),this.bindControl(new u(Pe,this._scaleProperty.alignLabels,!0,this.model(),"Precise Labels")),m=$('<div class="property-page-column-2">').data("layout-tab",$.t("Scales")),T=$('<div class="property-page-column-2">').data("layout-tab",$.t("Scales")),this.scalesColumnLeft=m,T.append(pe),m.append(N),m.append(te)}if(Z75.enabled("chart_property_page_background")){var Ee=$('<table class="property-page" cellspacing="0" cellpadding="2">'),Ve=this.createColorPicker({hideTransparency:!0}),Ie=this.addLabeledRow(Ee,$.t("Background"));$('<td colspan="2">').append(Ve).appendTo(Ie),this.bindControl(new f(Ve,this._property.paneProperties.background,!0,this.model(),"Change Chart Background Color"));var Ae=this.addLabeledRow(Ee,$.t("Vert Grid Lines")),ke=this.createColorPicker();$("<td>").append(ke).appendTo(Ae),this.bindControl(new f(ke,this._property.paneProperties.vertGridProperties.color,!0,this.model(),"Change Vert Grid Lines Color"));var Re=TradingView.createLineStyleEditor();$('<td colspan="2">').append(Re.render()).appendTo(Ae),this.bindControl(new g(Re,this._property.paneProperties.vertGridProperties.style,parseInt,!0,this.model(),"Change Vert Grid Lines Style"));var Me=this.addLabeledRow(Ee,$.t("Horz Grid Lines")),Oe=this.createColorPicker();$("<td>").append(Oe).appendTo(Me),this.bindControl(new f(Oe,this._property.paneProperties.horzGridProperties.color,!0,this.model(),"Change Horz Grid Lines Color"));var $e=TradingView.createLineStyleEditor();$('<td colspan="2">').append($e.render()).appendTo(Me),this.bindControl(new g($e,this._property.paneProperties.horzGridProperties.style,parseInt,!0,this.model(),"Change Horz Grid Lines Style"));var De=this.createColorPicker(),Be=this.addLabeledRow(Ee,$.t("Scales Text"));$("<td>").append(De).appendTo(Be),this.bindControl(new f(De,this._property.scalesProperties.textColor,!0,this.model(),"Change Scales Text Color"));var Ne=this.createFontSizeEditor();$("<td>").append(Ne).appendTo(Be),this.bindControl(new g(Ne,this._property.scalesProperties.fontSize,parseInt,!0,this.model(),"Change Scales Font Size"));var Fe=this.createColorPicker(),We=this.addLabeledRow(Ee,$.t("Scales Lines"));$('<td colspan="2">').append(Fe).appendTo(We),this.bindControl(new f(Fe,this._property.scalesProperties.lineColor,!0,this.model(),"Change Scales Lines Color"));var He=this.addLabeledRow(Ee,$.t("Watermark")),ze=this.createColorPicker();$("<td>").append(ze).appendTo(He),this.bindControl(new f(ze,this._property.symbolWatermarkProperties.color,!0,this.model(),"Change Symbol Watermark Color",this._property.symbolWatermarkProperties.transparency));var Ue=this.addLabeledRow(Ee,$.t("Crosshair")),Ge=this.createColorPicker();$("<td>").append(Ge).appendTo(Ue),this.bindControl(new f(Ge,this._property.paneProperties.crossHairProperties.color,!0,this.model(),"Change Crosshair Color",this._property.paneProperties.crossHairProperties.transparency));var je=TradingView.createLineStyleEditor();$("<td>").append(je.render()).appendTo(Ue),this.bindControl(new g(je,this._property.paneProperties.crossHairProperties.style,parseInt,!0,this.model(),"Change Crosshair Style"));var qe=TradingView.createLineWidthEditor();$("<td>").append(qe).appendTo(this.addRow(Ee).prepend("<td/><td/>")),this.bindControl(new _(qe,this._property.paneProperties.crossHairProperties.width,!0,this.model(),"Change Crosshair Width"));var Ye=$('<table class="property-page" cellspacing="0" cellpadding="2">'),Ke=$('<input type="checkbox">'),Xe=this.addLabeledRow(Ye,$.t("Symbol Description"),Ke);$("<td>").append(Ke).prependTo(Xe),this.bindControl(new u(Ke,this._property.paneProperties.legendProperties.showSeriesTitle,!0,this.model(),"Change Symbol Description Visibility"));var Je=$('<input type="checkbox">'),Ze=this.addLabeledRow(Ye,$.t("OHLC Values"),Je);$("<td>").append(Je).prependTo(Ze),this.bindControl(new u(Je,this._property.paneProperties.legendProperties.showSeriesOHLC,!0,this.model(),"Change OHLC Values Visibility"));var Qe=$('<input type="checkbox">'),et=this.addLabeledRow(Ye,$.t("Indicator Titles"),Qe);$("<td>").append(Qe).prependTo(et),this.bindControl(new u(Qe,this._property.paneProperties.legendProperties.showStudyTitles,!0,this.model(),"Change Indicator Titles Visibility"));var tt=$('<input type="checkbox">'),it=this.addLabeledRow(Ye,$.t("Indicator Arguments"),tt),rt=function(e){tt.prop("disabled",!e.value())};$("<td>").append(tt).prependTo(it),this.bindControl(new u(tt,this._property.paneProperties.legendProperties.showStudyArguments,!0,this.model(),"Change Indicator Arguments Visibility")),this._property.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,rt),rt(this._property.paneProperties.legendProperties.showStudyTitles);var nt=$('<input type="checkbox">'),ot=this.addLabeledRow(Ye,$.t("Indicator Values"),nt);$("<td>").append(nt).prependTo(ot),this.bindControl(new u(nt,this._property.paneProperties.legendProperties.showStudyValues,!0,this.model(),"Change Indicator Values Visibility")),b=$('<div class="property-page-column-2">').data("layout-tab",$.t("Background")),S=$('<div class="property-page-column-2">').data("layout-tab",$.t("Background")),b.append(Ee),S.append(Ye)}if(Z75.enabled("chart_property_page_timezone_sessions")){var x=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Timezone/Sessions"));this.tmzSessTable=x;var de=$("<tr>").appendTo(x),at=$("<td>").appendTo(de),st=$('<table cellspacing="0" cellpadding="0">').appendTo(at),lt=$("<tr>");lt.appendTo(st);var dt=$("<td>");dt.appendTo(lt),dt.text($.t("Time Zone"));var ht=$('<td colspan="2" class="tzeditor">');ht.appendTo(lt);for(var pt="",ct=0;ct<TradingView.availableTimezones.length;ct++)pt+='<option value="'+TradingView.availableTimezones[ct].id+'">'+TradingView.availableTimezones[ct].title+"</option>";var ut=$("<select>"+pt+"</select>");ut.appendTo(ht),this.bindControl(new g(ut,this._property.timezone,null,!0,this.model(),"Change Timezone")),Z75.enabled("charting_library_base")||(this._series.createSessStudy(),this.createSessTable(x))}var _t=Z75.enabled("chart_property_page_evetns_alerts")&&(Z75.enabled("alerts")||TradingView.Q16("esdindicatorfeature"))&&!Z75.enabled("charting_library_base");if(_t){var ft=Z75.enabled("alerts")?$.t("Events & Alerts"):$.t("Events");L=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",ft),this.Z97 instanceof y&&L.data("layout-tab-open",a.TAB_OPEN_OVERRIDE),this.createEventsTable(L)}var gt=(TradingView.Q16("paper_trading")||Z75.enabled("cqg_terminal"))&&(Z75.enabled("trading_options")||Z75.enabled("chart_property_page_trading"));gt&&(P=this.createTradingTable());var r=$('<table class="property-page" cellspacing="0" cellpadding="2">'),n=$('<table class="property-page property-page-unpadded" cellspacing="0" cellpadding="0">').css({width:"100%"}).data("layout-separated",!0),C=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Drawings"));this._table=$().add(e).add(t).add(i).add(r).add(n).add(o).add(l).add(s).add(m).add(T).add(b).add(S).add(C).add(x).add(P).add(L),this.loadData()},r.prototype.widget=function(){return this._table},r.prototype.loadData=function(){this.superclass.prototype.loadData.call(this),this.switchStyle()},r.prototype.loadTheme=function(e){var t=this;$.get("/theme/?themeName="+encodeURIComponent(e),function(i){t.Z98._lastLoadedTheme=e,t.applyTheme(JSON.parse(i.content))})},r.prototype.applyTheme=function(e){var t=this._seriesProperty.extendedHours.value();this.Z98.model().restoreTheme(e),this._seriesProperty.extendedHours.value()!==t&&this._seriesProperty.extendedHours.listeners().fire(this._seriesProperty.extendedHours),this.loadData()},r.prototype.createTemplateButton=function(e){if(!Z75.enabled("chart_property_page_template_button"))return $("<span />");var t=this;e||(e={});var i=function(){var i=[];i.push({title:$.t("Save As..."),action:function(){runOrSignIn(function(){TradingView.showThemeSaveDialog(t.Z98)},{source:"Save theme in chart properties"})},addClass:"special"}),"function"==typeof e.defaultsCallback&&i.push({title:$.t("Apply Defaults"),action:e.defaultsCallback,addClass:"special"});var r=[];return $.each(t._themes,function(e,i){r.push({title:$.t(i),action:function(){t.loadTheme(i)},deleteAction:is_authenticated?function(){var e=this,r=$.t("Do you realy want to delete theme",{theme:i?'"'+i+'"':""});$82.showConfirm($.t("Theme"),r,function(){e instanceof $&&e.remove(),$.post("/remove-theme/",{name:i}).error(function(e){TradingView.logError(e.responseText)}),TradingView.getThemesList.Q18();for(var r=t._themes.length;r--;)t._themes[r]==i&&t._themes.splice(r,1)})}:void 0})}),r.length&&(r.sort(function(e,t){return e=e.title.toUpperCase(),t=t.title.toUpperCase(),e==t?0:e>t?1:-1}),i.push({separator:!0}),i=i.concat(r)),i},r=$('<a href="#" class="_tv-button">'+$.t("Themes")+'<span class="icon-dropdown"></span></a>');return TradingView.bindPopupMenu(r,null,{direction:"up",event:"button-popup",notCloseOnButtons:!0}),r.bind("click",function(){var e=$(this);e.is(".active")||TradingView.getThemesList(function(r){t._themes=r,e.trigger("button-popup",[i(),!0])})}),r},r.prototype.switchStyle=function(){if(this._hasSeriesStyleLayout){$(this._barsTbody).add(this._barsColorerTbody).add(this._renkoTbody).add(this._pbTbody).add(this._kagiTbody).add(this._pnfTbody).add(this._candlesTbody).add(this._candlesColorerTbody).add(this._hollowCandlesTbody).add(this._lineTbody).add(this._areaTbody).add(this._haTbody).add(this._haColorerTbody).css("display","none");switch(this._seriesProperty.style.value()){case w.STYLE_BARS:this._barsTbody.css("display","table-row-group"),this._barsColorerTbody.css("display","table-row-group");break;case w.STYLE_CANDLES:this._candlesTbody.css("display","table-row-group"),this._candlesColorerTbody.css("display","table-row-group");break;case w.STYLE_HOLLOW_CANDLES:this._hollowCandlesTbody.css("display","table-row-group");break;case w.STYLE_LINE:this._lineTbody.css("display","table-row-group");break;case w.STYLE_AREA:this._areaTbody.css("display","table-row-group");break;case w.STYLE_RENKO:this._renkoTbody.css("display","table-row-group");break;case w.STYLE_PB:this._pbTbody.css("display","table-row-group");break;case w.STYLE_KAGI:this._kagiTbody.css("display","table-row-group");break;case w.STYLE_PNF:this._pnfTbody.css("display","table-row-group");break;case w.STYLE_HEIKEN_ASHI:this._haTbody.css("display","table-row-group"),this._haColorerTbody.css("display","table-row-group")}}},r.prototype.onResoreDefaults=function(){var e=this.Z98.model().properties().paneProperties.topMargin,t=this.Z98.model().properties().paneProperties.bottomMargin;e.listeners().fire(e),t.listeners().fire(t),TradingView.bottomWidgetBar&&(o.setWatchedValue(TradingView.bottomWidgetBar.hideFloatingPanel,!1,"Restore Defaults"),o.setWatchedValue(TradingView.bottomWidgetBar.hideCompletedOrders,!1,"Restore Defaults"),o.setWatchedValue(TradingView.bottomWidgetBar.noConfirmEnabled,!1,"Restore Defaults"));var i=this.Z98.model().properties().timezone;i.listeners().fire(i)},r.prototype.defaultProperties=function(){var e=this,t=[e._seriesProperty.extendedHours,e._property.scalesProperties.showLeftScale,e._property.scalesProperties.showRightScale,e._property.timeScale.rightOffset].map(function(e){return{property:e,previousValue:e.value()}});return setTimeout(function(){t.forEach(function(e){e.property.value()!==e.previousValue&&e.property.listeners().fire(e.property)});var i=new J50("chartproperties.paneProperties.rightAxisProperties");$.each(["autoScale","percentage","log"],function(t,r){var n=e._scaleProperty[r],o=i[r].value();o!==n.value()&&n.setValue(o)})},0),[this._property,this._seriesProperty]},r.prototype.createEventsTable=function(e){if(TradingView.Q16("esdindicatorfeature")){var t=$("<tr>").appendTo(e),i=$('<input type="checkbox" />'),r=this.addLabeledRow(t,$.t("Show Dividends on Chart"),i);$("<td>").append(i).prependTo(r),r.append("<td>"),this.bindControl(new u(i,this._seriesProperty.esdShowDividends,!0,this.model(),"Change Show or Hide Dividends"));var n=$('<input type="checkbox" />'),r=this.addLabeledRow(t,$.t("Show Splits on Chart"),n);$("<td>").append(n).prependTo(r),r.append("<td>"),this.bindControl(new u(n,this._seriesProperty.esdShowSplits,!0,this.model(),"Change Show or Hide Splits"));var o=$('<input type="checkbox" />'),r=this.addLabeledRow(t,$.t("Show Earnings on Chart"),o);$("<td>").append(o).prependTo(r),r.append("<td>"),this.bindControl(new u(o,this._seriesProperty.esdShowEarnings,!0,this.model(),"Change Show or Hide Earnings"));var a=this.createTableInTable(e),s=$('<input type="checkbox" />'),l=TradingView.createLineStyleEditor(),d=TradingView.createLineWidthEditor(),r=this.addLabeledRow(a,$.t("Earnings breaks"),s);$("<td>").append(s).prependTo(r);var h=TradingView.addColorPicker($("<td>").appendTo(r));$("<td>").append(l.render()).appendTo(r),$("<td>").append(d).appendTo(r),r.addClass("offset-row"),r.append("<td>"),this.bindControl(new u(s,this._seriesProperty.esdShowBreaks,!0,this.model(),"Change Show or Hide Earnings")),this.bindControl(new f(h,this._seriesProperty.esdBreaksStyle.color,!0,this.model(),"Change earnings color")),this.bindControl(new g(l,this._seriesProperty.esdBreaksStyle.style,parseInt,!0,this.model(),"Change style")),this.bindControl(new _(d,this._seriesProperty.esdBreaksStyle.width,!0,this.model(),"Change width"));var p=function(e){s.prop("disabled",!e.value())};this._seriesProperty.esdShowEarnings.listeners().subscribe(this,p)}if(Z75.enabled("chart_events")&&TradingView.Q16("chart_events")){var c=$('<input type="checkbox">'),m=$('<input type="checkbox">'),y=$('<input type="checkbox" />'),w=TradingView.createLineStyleEditor(),T=TradingView.createLineWidthEditor(),b=this.createColorPicker(),S=this._property.chartEventsSourceProperties;this.bindControl(new u(c,S.visible,!0,this.model(),"Change Show Economic Events on Chart")),this.bindControl(new u(m,S.futureOnly,!0,this.model(),"Change Show Only Future Events")),this.bindControl(new v(m,S.visible,!0,this.model(),"",!0)),this.bindControl(new v(y,S.visible,!0,this.model(),"",!0)),this.bindControl(new u(y,S.breaks.visible,!0,this.model(),"Change Show or Hide Events Breaks")),this.bindControl(new f(b,S.breaks.color,!0,this.model(),"Change Events Breaks Color")),this.bindControl(new g(w,S.breaks.style,parseInt,!0,this.model(),"Change Events Breaks Style")),this.bindControl(new _(T,S.breaks.width,!0,this.model(),"Change Events Breaks Width"));var C=$("<tr>").appendTo(e),r=this.addLabeledRow(C,$.t("Show Economic Events on Chart"),c);$("<td>").append(c).prependTo(r);var x=this.createTableInTable(e),r=this.addLabeledRow(x,$.t("Show Only Future Events"),m);$("<td>").append(m).prependTo(r),r.addClass("offset-row");var P=this.createTableInTable(e),r=this.addLabeledRow(P,$.t("Events Breaks"),y);$("<td>").append(y).prependTo(r),$("<td>").append(b).appendTo(r),$("<td>").append(w.render()).appendTo(r),$("<td>").append(T).appendTo(r),r.addClass("offset-row")}if(Z75.enabled("alerts")){var L=$("<tr>").appendTo(e),E=$('<input type="checkbox" />'),r=this.addLabeledRow(L,$.t("Show Alert Labels"),E);$("<td>").append(E).prependTo(r),r.append("<td>");var V=this._property.alertsProperties.labels.visible;this.bindControl(new u(E,V,!0,this.model(),"Change Show or Hide Alert Labels",function(e){this.Z98.beginUndoMacro("Show Alert Labels"),this.Z98.setProperty(V,e,"Show Alert Labels"),this.Z98.endUndoMacro()}.bind(this)));var I=this.createTableInTable(e),A=$('<input type="checkbox">'),k=TradingView.createLineWidthEditor(),R=TradingView.createLineStyleEditor(),M=R.render(),r=this.addLabeledRow(I,$.t("Extended Alert Line"),A);$("<td>").append(A).prependTo(r);var O=TradingView.addColorPicker($("<td>").appendTo(r));$("<td>").append(M).appendTo(r),$("<td>").append(k).appendTo(r),r.addClass("offset-row"),r.append("<td>"),this.bindControl(new u(A,this._property.alertsProperties.labels.line.visible,!0,this.model(),"Change Show or Hide Alert Labels Lines")),this.bindControl(new f(O,this._property.alertsProperties.labels.color,!0,this.model(),"Change Alerts Labels color")),this.bindControl(new g(R,this._property.alertsProperties.labels.line.style,parseInt,!0,this.model(),"Change style")),this.bindControl(new _(k,this._property.alertsProperties.labels.line.width,!0,this.model(),"Change width"));var D=function(e){A.prop("disabled",!e.value()),M.prop("disabled",!e.value()),k.prop("disabled",!e.value())};V.listeners().subscribe(this,D)}},r.prototype.createSessTable=function(e){var t=this._series.sessionsStudy().properties(),i=this.createTableInTable(e),r=t.name.value(),n=$("<input type='checkbox' />"),o=this.addLabeledRow(i,$.t("Session Breaks"),n),a=TradingView.createLineStyleEditor(),s=this.createColorPicker(),l=TradingView.createLineWidthEditor();$("<td>").append(n).prependTo(o),$("<td>").append(s).appendTo(o),$("<td>").append(a.render()).appendTo(o),$("<td>").append(l).appendTo(o),this.bindControl(new u(n,t.graphics.vertlines.sessBreaks.visible,!0,this.model(),"Change "+r+" visibility")),this.bindControl(new f(s,t.graphics.vertlines.sessBreaks.color,!0,this.model(),"Change "+r+" color")),this.bindControl(new g(a,t.graphics.vertlines.sessBreaks.style,parseInt,!0,this.model(),"Change "+r+" style")),this.bindControl(new _(l,t.graphics.vertlines.sessBreaks.width,!0,this.model(),"Change "+r+" width"));var i=this.createTableInTable(e),d=this._extendedHoursEditor=$('<input type="checkbox" />'),o=this.addLabeledRow(i,$.t("Extended Hours (Intraday Only)"),d);$("<td>").append(d).prependTo(o),this.bindControl(new u(d,this._seriesProperty.extendedHours,!0,this.model(),"Change Extended Hours")),this._seriesProperty.sessVis=t.graphics.vertlines.sessBreaks.visible;var i=this.createTableInTable(e),h=this._createStudySessRow(i,$.t("Extended Hours"),t.graphics.backgrounds.outOfSession),p=this._createStudySessRow(i,$.t("In Session"),t.graphics.backgrounds.inSession),c=function(e){h.prop("disabled",!e.value()),p.prop("disabled",!e.value())};this._seriesProperty.extendedHours.listeners().subscribe(this,c),c(this._seriesProperty.extendedHours);var v=this._series.isIntradayInterval();return n.prop("disabled",!v),i},r.prototype._createStudySessRow=function(e,t,i){var r=$("<input type='checkbox' />"),n=this.addLabeledRow(e,t,r),o=TradingView.addColorPicker($("<td>").appendTo(n));this.bindControl(new u(r,i.visible,!0,this.model(),"Change "+t+" visibility")),this.bindControl(new f(o,i.color,!0,this.model(),t+" color",i.transparency));var a=$("<td>");return a.append(r).prependTo(n),n.addClass("offset-row"),r},r.prototype.createTradingTable=function(){var e=$('<table class="property-page" cellspacing="0" cellpadding="2">').data("layout-tab",$.t("Trading")),t=$("<tr>").appendTo(e),i=$("<td>").appendTo(t),r=$('<table cellspacing="0" cellpadding="0">').appendTo(i),n=$('<input type="checkbox">');t=this.addLabeledRow(r,$.t("Show Positions"),n),$("<td>").append(n).prependTo(t),this.bindControl(new u(n,this._property.tradingProperties.showPositions,!0,this.model(),"Change Positions Visibility"));var o=$('<input type="checkbox">');t=this.addLabeledRow(r,$.t("Show Orders"),o),$("<td>").append(o).prependTo(t),this.bindControl(new u(o,this._property.tradingProperties.showOrders,!0,this.model(),"Change Orders Visibility"));var a=$('<input type="checkbox">'),s=this.addLabeledRow(r,$.t("Extend Lines Left"),a);$("<td>").append(a).prependTo(s),this.bindControl(new u(a,this._property.tradingProperties.extendLeft,!0,this.model(),"Extend Lines Left"));var l=TradingView.createLineWidthEditor();this.bindControl(new _(l,this._property.tradingProperties.lineWidth,!0,this.model(),"Change Connecting Line Width"));var f=TradingView.createLineStyleEditor();this.bindControl(new g(f,this._property.tradingProperties.lineStyle,parseInt,!0,this.model(),"Change Connecting Line Style"));var v=$('<input type="text" class="ticker">'),y=[p(this._property.tradingProperties.lineLength.value()),h(100),d(0)];this.bindControl(new c(v,this._property.tradingProperties.lineLength,y,!0,this.model(),"Change Connecting Line Length"));var w=$("<tbody>"),b=this.addLabeledRow(r,$.t("Connecting Line"),w);$("<td>").prependTo(b),$("<td>").append(l).appendTo(b),$('<td colspan="3">').append(f.render()).appendTo(b),$('<td colspan="3">').append(v).appendTo(b),$("<td>%</td>").appendTo(b);var S=$('<input type="checkbox">'),C=this.addLabeledRow(r,$.t("Show Executions"),S);if($("<td>").append(S).prependTo(C),this.bindControl(new u(S,this._property.tradingProperties.showExecutions,!0,this.model(),"Change Executions Visibility")),T){var x=$('<input type="checkbox">'),P=this.addLabeledRow(r,$.t("Show Buy/Sell Panel"),x);$("<td>").append(x).prependTo(P),this.bindControl(new m(x,T.hideFloatingPanel,null,"Change buy/sell panel visibility",!0));var L=$('<input type="checkbox">'),E=this.addLabeledRow(r,$.t("Show Active Orders Only"),L);$("<td>").append(L).prependTo(E),this.bindControl(new m(L,T.hideCompletedOrders,null,"Change completed orders visibility",!0));var V=$('<input type="checkbox">'),I=this.addLabeledRow(r,$.t("Require Order Confirmation"),V);$("<td>").append(V).prependTo(I),this.bindControl(new m(V,T.noConfirmEnabled,null,"Change order confirmation state",!0));
}return e},e.exports=r},function(e,t,i){"use strict";var r=i(244)["default"],n=i(264)["default"],o=i(266)["default"],a=i(319)["default"];Object.defineProperty(t,"__esModule",{value:!0});var s=i(321),l=a(s),d=i(323),h=a(d),p=i(356),c=a(p),u=i(336),_=a(u),f=function(){function e(){n(this,e),this._registeredChartWidgets=[],this._activeBroker=null,this.onBrokerChange=new Delegate,this.onBrokerLoading=new Delegate,this.onConnectionStatusChange=new Delegate,this.onNeedAttention=new Delegate,this.onOpenBottomWidgetBar=new Delegate,this.hideFloatingPanel=new WatchedValue,this.hideCompletedOrders=new WatchedValue,this.noConfirmEnabled=new WatchedValue}return r(e,[{key:"init",value:function(e){var t=this,i=e.Q4;this.Q3=i;var r=function(){t._save()};this.hideFloatingPanel.subscribe(r),this.hideCompletedOrders.subscribe(r),this.noConfirmEnabled.subscribe(r),this.onBrokerChange.subscribe(null,function(e){e?TVSettings.setValue(_["default"].ACTIVE_BROKER,e.id()):TVSettings.remove(_["default"].ACTIVE_BROKER)}),this._loadState(),this.pickDefaultBroker(),(!Z75.enabled("trading_terminal")||window.tradingController&&window.tradingController.supportFloatingPanel())&&this.initTradingFloatingToolbar()}},{key:"toggleTradingWidget",value:function(){this.onOpenBottomWidgetBar.fire()}},{key:"_save",value:function(){TVSettings.setJSON(_["default"].PROPERTIES,{hideFloatingPanel:+!!this.hideFloatingPanel.value(),hideCompletedOrders:+!!this.hideCompletedOrders.value(),noConfirmEnabled:+!!this.noConfirmEnabled.value()})}},{key:"_loadState",value:function(){var e=TVSettings.getJSON(_["default"].PROPERTIES,{});this.hideFloatingPanel.setValue(!!e.hideFloatingPanel),this.hideCompletedOrders.setValue(!!e.hideCompletedOrders),this.noConfirmEnabled.setValue(!!e.noConfirmEnabled)}},{key:"initTradingFloatingToolbar",value:function(){this._floater=new c["default"](this)}},{key:"showTradingProperties",value:function(){this.Q3&&(TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Trading")),this.Q3.activeChartWidget.value().showChartProperties())}},{key:"availableBrokers",value:function(){return[(TradingView.Q16("CQG")||Z75.enabled("cqg_terminal"))&&{id:"CQG",title:"CQG"},TradingView.Q16("paper_trading")&&{id:"Paper",title:"Paper Trading"},Z75.enabled("trading_terminal")&&window.tradingController&&{id:"APIBroker",title:"Trading"}].filter(Boolean)}},{key:"getActiveBroker",value:function(){return this._activeBroker}},{key:"_trackEvent",value:function(e,t,i){var r=this._activeBroker?this._activeBroker.id()+" Trading":"No Select Broker";TradingView.trackEvent(r,e+" "+t,i)}},{key:"_trackPaperEvent",value:function(e,t,i){TradingView.trackEvent("Paper Trading",e+" "+t,i)}},{key:"selectBrokerUI",value:function(e){var t=this;return null==e?void this.selectBroker(null):void runOrSignIn(function(){return t.selectBroker(e)},{source:"Trading select broker",sourceMeta:"Chart"})}},{key:"selectBroker",value:function(e){var t=this,i=this._activeBroker?this._activeBroker.id():void 0;if(e!==i)if(this._activeBroker&&(this._registeredChartWidgets.forEach(function(e){t._activeBroker.unregisterChartWidget(e)}),this._activeBroker.connection().onStatusChanged.unsubscribe(this,this._connectionListener),this.onConnectionStatusChange.fire(h["default"].DISCONNECT),this._activeBroker.disconnect(),delete this._activeBroker),null!=e&&l["default"][e]){var r=function(e){t._activeBroker=new e(t),t.onBrokerChange.fire(t._activeBroker),t._registeredChartWidgets.forEach(function(e){t._activeBroker.registerChartWidget(e)}),t._activeBroker.connection().onStatusChanged.subscribe(t,t._connectionListener),t.onConnectionStatusChange.fire(t.connectStatus())},n=function(i){var r=new o(function(e){l["default"][i](function(t){e(t[i])})});return t.onBrokerLoading.fire({brokerId:e,promise:r}),r};n(e).then(r)}else this.onBrokerChange.fire(null)}},{key:"registerChartWidget",value:function(e){this._activeBroker&&this._activeBroker.registerChartWidget(e),this._registeredChartWidgets.push(e)}},{key:"pickDefaultBroker",value:function(){if(!this._activeBroker){var e=void 0,t=this.availableBrokers();1===t.length?e=t[0].id:!function(){var i=TVSettings.getValue(_["default"].ACTIVE_BROKER);i&&t.some(function(e){return e.id===i})&&(e=i)}(),e&&this.selectBroker(e)}}},{key:"chartContextMenuActions",value:function(e,t){var i=this;return this._activeBroker?this._activeBroker.chartContextMenuActions(e,t):this.availableBrokers().map(function(e){var t=new TradingView.Action({text:$.t("Connect to %s",e.title)});return t.callbacks().subscribe(null,function(){i.toggleTradingWidget(!0),i.selectBrokerUI(e.id)}),t})}},{key:"connectStatus",value:function(){return this._activeBroker?this._activeBroker.connection().connectStatus():h["default"].DISCONNECT}},{key:"_connectionListener",value:function(){this.onConnectionStatusChange.fire(this.connectStatus())}}]),e}(),g=new f;t["default"]=g,e.exports=t["default"]},function(e,t,i){e.exports=i(245)},function(e,t,i){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var n=i(246),o=r(n);t["default"]=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,o["default"])(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}()},function(e,t,i){e.exports={"default":i(247),__esModule:!0}},function(e,t,i){i(248);var r=i(251).Object;e.exports=function(e,t,i){return r.defineProperty(e,t,i)}},function(e,t,i){var r=i(249);r(r.S+r.F*!i(259),"Object",{defineProperty:i(255).f})},function(e,t,i){var r=i(250),n=i(251),o=i(252),a=i(254),s="prototype",l=function(e,t,i){var d,h,p,c=e&l.F,u=e&l.G,_=e&l.S,f=e&l.P,g=e&l.B,v=e&l.W,m=u?n:n[t]||(n[t]={}),y=m[s],w=u?r:_?r[t]:(r[t]||{})[s];u&&(i=t);for(d in i)h=!c&&w&&void 0!==w[d],h&&d in m||(p=h?w[d]:i[d],m[d]=u&&"function"!=typeof w[d]?i[d]:g&&h?o(p,r):v&&w[d]==p?function(e){var t=function(t,i,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,i)}return new e(t,i,r)}return e.apply(this,arguments)};return t[s]=e[s],t}(p):f&&"function"==typeof p?o(Function.call,p):p,f&&((m.virtual||(m.virtual={}))[d]=p,e&l.R&&y&&!y[d]&&a(y,d,p)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){var i=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(e,t){var i=e.exports={version:"2.3.0"};"number"==typeof __e&&(__e=i)},function(e,t,i){var r=i(253);e.exports=function(e,t,i){if(r(e),void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,r){return e.call(t,i,r)};case 3:return function(i,r,n){return e.call(t,i,r,n)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,i){var r=i(255),n=i(263);e.exports=i(259)?function(e,t,i){return r.f(e,t,n(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){var r=i(256),n=i(258),o=i(262),a=Object.defineProperty;t.f=i(259)?Object.defineProperty:function(e,t,i){if(r(e),t=o(t,!0),r(i),n)try{return a(e,t,i)}catch(s){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(e[t]=i.value),e}},function(e,t,i){var r=i(257);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,i){e.exports=!i(259)&&!i(260)(function(){return 7!=Object.defineProperty(i(261)("div"),"a",{get:function(){return 7}}).a})},function(e,t,i){e.exports=!i(260)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,i){var r=i(257),n=i(250).document,o=r(n)&&r(n.createElement);e.exports=function(e){return o?n.createElement(e):{}}},function(e,t,i){var r=i(257);e.exports=function(e,t){if(!r(e))return e;var i,n;if(t&&"function"==typeof(i=e.toString)&&!r(n=i.call(e)))return n;if("function"==typeof(i=e.valueOf)&&!r(n=i.call(e)))return n;if(!t&&"function"==typeof(i=e.toString)&&!r(n=i.call(e)))return n;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,i){e.exports=i(265)},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,i){e.exports={"default":i(267),__esModule:!0}},function(e,t,i){i(268),i(269),i(298),i(302),e.exports=i(251).Promise},function(e,t){},function(e,t,i){"use strict";var r=i(270)(!0);i(273)(String,"String",function(e){this._t=e+"",this._i=0},function(){var e,t=this._t,i=this._i;return i>=t.length?{value:void 0,done:!0}:(e=r(t,i),this._i+=e.length,{value:e,done:!1})})},function(e,t,i){var r=i(271),n=i(272);e.exports=function(e){return function(t,i){var o,a,s=n(t)+"",l=r(i),d=s.length;return 0>l||l>=d?e?"":void 0:(o=s.charCodeAt(l),55296>o||o>56319||l+1===d||(a=s.charCodeAt(l+1))<56320||a>57343?e?s.charAt(l):o:e?s.slice(l,l+2):(o-55296<<10)+(a-56320)+65536)}}},function(e,t){var i=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:i)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,i){"use strict";var r=i(274),n=i(249),o=i(275),a=i(254),s=i(276),l=i(277),d=i(278),h=i(294),p=i(296),c=i(295)("iterator"),u=!([].keys&&"next"in[].keys()),_="@@iterator",f="keys",g="values",v=function(){return this};e.exports=function(e,t,i,m,y,w,T){d(i,t,m);var b,S,C,x=function(e){if(!u&&e in V)return V[e];switch(e){case f:return function(){return new i(this,e)};case g:return function(){return new i(this,e)}}return function(){return new i(this,e)}},P=t+" Iterator",L=y==g,E=!1,V=e.prototype,I=V[c]||V[_]||y&&V[y],A=I||x(y),k=y?L?x("entries"):A:void 0,R="Array"==t?V.entries||I:I;if(R&&(C=p(R.call(new e)),C!==Object.prototype&&(h(C,P,!0),r||s(C,c)||a(C,c,v))),L&&I&&I.name!==g&&(E=!0,A=function(){return I.call(this)}),r&&!T||!u&&!E&&V[c]||a(V,c,A),l[t]=A,l[P]=v,y)if(b={values:L?A:x(g),keys:w?A:x(f),entries:k},T)for(S in b)S in V||o(V,S,b[S]);else n(n.P+n.F*(u||E),t,b);return b}},function(e,t){e.exports=!0},function(e,t,i){e.exports=i(254)},function(e,t){var i={}.hasOwnProperty;e.exports=function(e,t){return i.call(e,t)}},function(e,t){e.exports={}},function(e,t,i){"use strict";var r=i(279),n=i(263),o=i(294),a={};i(254)(a,i(295)("iterator"),function(){return this}),e.exports=function(e,t,i){e.prototype=r(a,{next:n(1,i)}),o(e,t+" Iterator")}},function(e,t,i){var r=i(256),n=i(280),o=i(292),a=i(289)("IE_PROTO"),s=function(){},l="prototype",d=function(){var e,t=i(261)("iframe"),r=o.length,n=">";for(t.style.display="none",i(293).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object</script"+n),e.close(),d=e.F;r--;)delete d[l][o[r]];return d()};e.exports=Object.create||function(e,t){var i;return null!==e?(s[l]=r(e),i=new s,s[l]=null,i[a]=e):i=d(),void 0===t?i:n(i,t)}},function(e,t,i){var r=i(255),n=i(256),o=i(281);e.exports=i(259)?Object.defineProperties:function(e,t){n(e);for(var i,a=o(t),s=a.length,l=0;s>l;)r.f(e,i=a[l++],t[i]);return e}},function(e,t,i){var r=i(282),n=i(292);e.exports=Object.keys||function(e){return r(e,n)}},function(e,t,i){var r=i(276),n=i(283),o=i(286)(!1),a=i(289)("IE_PROTO");e.exports=function(e,t){var i,s=n(e),l=0,d=[];for(i in s)i!=a&&r(s,i)&&d.push(i);for(;t.length>l;)r(s,i=t[l++])&&(~o(d,i)||d.push(i));return d}},function(e,t,i){var r=i(284),n=i(272);e.exports=function(e){return r(n(e))}},function(e,t,i){var r=i(285);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){var i={}.toString;e.exports=function(e){return i.call(e).slice(8,-1)}},function(e,t,i){var r=i(283),n=i(287),o=i(288);e.exports=function(e){return function(t,i,a){var s,l=r(t),d=n(l.length),h=o(a,d);if(e&&i!=i){for(;d>h;)if(s=l[h++],s!=s)return!0}else for(;d>h;h++)if((e||h in l)&&l[h]===i)return e||h||0;return!e&&-1}}},function(e,t,i){var r=i(271),n=Math.min;e.exports=function(e){return e>0?n(r(e),9007199254740991):0}},function(e,t,i){var r=i(271),n=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),0>e?n(e+t,0):o(e,t)}},function(e,t,i){var r=i(290)("keys"),n=i(291);e.exports=function(e){return r[e]||(r[e]=n(e))}},function(e,t,i){var r=i(250),n="__core-js_shared__",o=r[n]||(r[n]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){var i=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++i+r).toString(36))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,i){e.exports=i(250).document&&document.documentElement},function(e,t,i){var r=i(255).f,n=i(276),o=i(295)("toStringTag");e.exports=function(e,t,i){e&&!n(e=i?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,i){var r=i(290)("wks"),n=i(291),o=i(250).Symbol,a="function"==typeof o,s=e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:n)("Symbol."+e))};s.store=r},function(e,t,i){var r=i(276),n=i(297),o=i(289)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=n(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,i){var r=i(272);e.exports=function(e){return Object(r(e))}},function(e,t,i){i(299);for(var r=i(250),n=i(254),o=i(277),a=i(295)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;5>l;l++){var d=s[l],h=r[d],p=h&&h.prototype;p&&!p[a]&&n(p,a,d),o[d]=o.Array}},function(e,t,i){"use strict";var r=i(300),n=i(301),o=i(277),a=i(283);e.exports=i(273)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,n(1)):"keys"==t?n(0,i):"values"==t?n(0,e[i]):n(0,[i,e[i]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,i){"use strict";var r,n,o,a=i(274),s=i(250),l=i(252),d=i(303),h=i(249),p=i(257),c=(i(256),i(253)),u=i(304),_=i(305),f=(i(309).set,i(312)),g=i(313).set,v=i(315)(),m="Promise",y=s.TypeError,w=s.process,T=s[m],w=s.process,b="process"==d(w),S=function(){},C=!!function(){try{var e=T.resolve(1),t=(e.constructor={})[i(295)("species")]=function(e){e(S,S)};return(b||"function"==typeof PromiseRejectionEvent)&&e.then(S)instanceof t}catch(r){}}(),x=function(e,t){return e===t||e===T&&t===o},P=function(e){var t;return p(e)&&"function"==typeof(t=e.then)?t:!1},L=function(e){return x(T,e)?new E(e):new n(e)},E=n=function(e){var t,i;this.promise=new e(function(e,r){if(void 0!==t||void 0!==i)throw y("Bad Promise constructor");t=e,i=r}),this.resolve=c(t),this.reject=c(i)},V=function(e){try{e()}catch(t){return{error:t}}},I=function(e,t){if(!e._n){e._n=!0;var i=e._c;v(function(){for(var r=e._v,n=1==e._s,o=0,a=function(t){var i,o,a=n?t.ok:t.fail,s=t.resolve,l=t.reject,d=t.domain;try{a?(n||(2==e._h&&R(e),e._h=1),a===!0?i=r:(d&&d.enter(),i=a(r),d&&d.exit()),i===t.promise?l(y("Promise-chain cycle")):(o=P(i))?o.call(i,s,l):s(i)):l(r)}catch(h){l(h)}};i.length>o;)a(i[o++]);e._c=[],e._n=!1,t&&!e._h&&A(e)})}},A=function(e){g.call(s,function(){var t,i,r,n=e._v;if(k(e)&&(t=V(function(){b?w.emit("unhandledRejection",n,e):(i=s.onunhandledrejection)?i({promise:e,reason:n}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",n)}),e._h=b||k(e)?2:1),e._a=void 0,t)throw t.error})},k=function(e){if(1==e._h)return!1;for(var t,i=e._a||e._c,r=0;i.length>r;)if(t=i[r++],t.fail||!k(t.promise))return!1;return!0},R=function(e){g.call(s,function(){var t;b?w.emit("rejectionHandled",e):(t=s.onrejectionhandled)&&t({promise:e,reason:e._v})})},M=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),I(t,!0))},O=function(e){var t,i=this;if(!i._d){i._d=!0,i=i._w||i;try{if(i===e)throw y("Promise can't be resolved itself");(t=P(e))?v(function(){var r={_w:i,_d:!1};try{t.call(e,l(O,r,1),l(M,r,1))}catch(n){M.call(r,n)}}):(i._v=e,i._s=1,I(i,!1))}catch(r){M.call({_w:i,_d:!1},r)}}};C||(T=function(e){u(this,T,m,"_h"),c(e),r.call(this);try{e(l(O,this,1),l(M,this,1))}catch(t){M.call(this,t)}},r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=i(316)(T.prototype,{then:function(e,t){var i=L(f(this,T));return i.ok="function"==typeof e?e:!0,i.fail="function"==typeof t&&t,i.domain=b?w.domain:void 0,this._c.push(i),this._a&&this._a.push(i),this._s&&I(this,!1),i.promise},"catch":function(e){return this.then(void 0,e)}}),E=function(){var e=new r;this.promise=e,this.resolve=l(O,e,1),this.reject=l(M,e,1)}),h(h.G+h.W+h.F*!C,{Promise:T}),i(294)(T,m),i(317)(m),o=i(251)[m],h(h.S+h.F*!C,m,{reject:function(e){var t=L(this),i=t.reject;return i(e),t.promise}}),h(h.S+h.F*(a||!C),m,{resolve:function(e){if(e instanceof T&&x(e.constructor,this))return e;var t=L(this),i=t.resolve;return i(e),t.promise}}),h(h.S+h.F*!(C&&i(318)(function(e){T.all(e)["catch"](S)})),m,{all:function(e){var t=this,i=L(t),r=i.resolve,n=i.reject,o=V(function(){var i=[],o=0,a=1;_(e,!1,function(e){var s=o++,l=!1;i.push(void 0),a++,t.resolve(e).then(function(e){l||(l=!0,i[s]=e,--a||r(i))},n)}),--a||r(i)});return o&&n(o.error),i.promise},race:function(e){var t=this,i=L(t),r=i.reject,n=V(function(){_(e,!1,function(e){t.resolve(e).then(i.resolve,r)})});return n&&r(n.error),i.promise}})},function(e,t,i){var r=i(285),n=i(295)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(i){}};e.exports=function(e){var t,i,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=a(t=Object(e),n))?i:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e,t,i,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(i+": incorrect invocation!");return e}},function(e,t,i){var r=i(252),n=i(306),o=i(307),a=i(256),s=i(287),l=i(308);e.exports=function(e,t,i,d,h){var p,c,u,_=h?function(){return e}:l(e),f=r(i,d,t?2:1),g=0;if("function"!=typeof _)throw TypeError(e+" is not iterable!");if(o(_))for(p=s(e.length);p>g;g++)t?f(a(c=e[g])[0],c[1]):f(e[g]);else for(u=_.call(e);!(c=u.next()).done;)n(u,f,c.value,t)}},function(e,t,i){var r=i(256);e.exports=function(e,t,i,n){try{return n?t(r(i)[0],i[1]):t(i)}catch(o){var a=e["return"];throw void 0!==a&&r(a.call(e)),o}}},function(e,t,i){var r=i(277),n=i(295)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[n]===e)}},function(e,t,i){var r=i(303),n=i(295)("iterator"),o=i(277);e.exports=i(251).getIteratorMethod=function(e){return void 0!=e?e[n]||e["@@iterator"]||o[r(e)]:void 0}},function(e,t,i){var r=i(257),n=i(256),o=function(e,t){if(n(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=i(252)(Function.call,i(310).f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(n){t=!0}return function(e,i){return o(e,i),t?e.__proto__=i:r(e,i),e}}({},!1):void 0),check:o}},function(e,t,i){var r=i(311),n=i(263),o=i(283),a=i(262),s=i(276),l=i(258),d=Object.getOwnPropertyDescriptor;t.f=i(259)?d:function(e,t){if(e=o(e),t=a(t,!0),l)try{return d(e,t)}catch(i){}return s(e,t)?n(!r.f.call(e,t),e[t]):void 0}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,i){var r=i(256),n=i(253),o=i(295)("species");e.exports=function(e,t){var i,a=r(e).constructor;return void 0===a||void 0==(i=r(a)[o])?t:n(i)}},function(e,t,i){var r,n,o,a=i(252),s=i(314),l=i(293),d=i(261),h=i(250),p=h.process,c=h.setImmediate,u=h.clearImmediate,_=h.MessageChannel,f=0,g={},v="onreadystatechange",m=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},y=function(e){m.call(e.data)};c&&u||(c=function(e){for(var t=[],i=1;arguments.length>i;)t.push(arguments[i++]);return g[++f]=function(){s("function"==typeof e?e:Function(e),t)},r(f),f},u=function(e){delete g[e]},"process"==i(285)(p)?r=function(e){p.nextTick(a(m,e,1))}:_?(n=new _,o=n.port2,n.port1.onmessage=y,r=a(o.postMessage,o,1)):h.addEventListener&&"function"==typeof postMessage&&!h.importScripts?(r=function(e){h.postMessage(e+"","*")},h.addEventListener("message",y,!1)):r=v in d("script")?function(e){l.appendChild(d("script"))[v]=function(){l.removeChild(this),m.call(e)}}:function(e){setTimeout(a(m,e,1),0)}),e.exports={set:c,clear:u}},function(e,t){e.exports=function(e,t,i){var r=void 0===i;switch(t.length){case 0:return r?e():e.call(i);case 1:return r?e(t[0]):e.call(i,t[0]);case 2:return r?e(t[0],t[1]):e.call(i,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(i,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(i,t[0],t[1],t[2],t[3])}return e.apply(i,t)}},function(e,t,i){var r=i(250),n=i(313).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,l="process"==i(285)(a);e.exports=function(){var e,t,i,d=function(){var r,n;for(l&&(r=a.domain)&&r.exit();e;){n=e.fn,e=e.next;try{n()}catch(o){throw e?i():t=void 0,o}}t=void 0,r&&r.enter()};if(l)i=function(){a.nextTick(d)};else if(o){var h=!0,p=document.createTextNode("");new o(d).observe(p,{characterData:!0}),i=function(){p.data=h=!h}}else if(s&&s.resolve){var c=s.resolve();i=function(){c.then(d)}}else i=function(){n.call(r,d)};return function(r){var n={fn:r,next:void 0};t&&(t.next=n),e||(e=n,i()),t=n}}},function(e,t,i){var r=i(254);e.exports=function(e,t,i){for(var n in t)i&&e[n]?e[n]=t[n]:r(e,n,t[n]);return e}},function(e,t,i){"use strict";var r=i(250),n=i(251),o=i(255),a=i(259),s=i(295)("species");e.exports=function(e){var t="function"==typeof n[e]?n[e]:r[e];a&&t&&!t[s]&&o.f(t,s,{configurable:!0,get:function(){return this}})}},function(e,t,i){var r=i(295)("iterator"),n=!1;try{var o=[7][r]();o["return"]=function(){n=!0},Array.from(o,function(){throw 2})}catch(a){}e.exports=function(e,t){if(!t&&!n)return!1;var i=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:i=!0}},o[r]=function(){return a},e(o)}catch(s){}return i}},function(e,t,i){e.exports=i(320)},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){return e&&e.__esModule?e:{"default":e}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={CQG:function(e){return i.e(1,function(t){e({CQG:i(322)})})},Paper:function(e){return i.e(2,function(t){e({Paper:i(344)})})}};t["default"]=r,e.exports=t["default"]},,function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={ERROR:"STATUS_ERROR",CONNECTING:"STATUS_CONNECTING",CONNECTED:"STATUS_CONNECTED",DISCONNECT:"STATUS_DISCONNECT"};t["default"]=i,e.exports=t["default"]},,,,,,,,,,,,,function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={ACTIVE_BROKER:"trading.active_broker",PROPERTIES:"trading.chart.proterty",QTY:"trading.qty."};t["default"]=i,e.exports=t["default"]},,,,,,,,,,,,,,function(e,t,i){"use strict";var r=i(244)["default"],n=i(264)["default"],o=i(319)["default"];Object.defineProperty(t,"__esModule",{value:!0});var a=i(336),s=o(a),l=function(){function e(){n(this,e),this._realtimeSubscriptions={},this._lastQuoteValues={},this._qtyPrefix=s["default"].QTY}return r(e,[{key:"subscribeRealtime",value:function(e,t){}},{key:"unsubscribeRealtime",value:function(e,t){}},{key:"suggestedQty",value:function(){var e=this;return this.sQty||!function(){var t=new Delegate;e.sQty={changed:t,value:function i(t,r){var n=void 0;switch(r&&r.symbolType){case"forex":n=1e3;break;case"stock":n=100;break;default:n=1}var i=TVSettings.getValue(e._qtyPrefix+t);return(null==i||0>=i||!isFinite(i))&&(i=n),+i},setValue:function(i,r){TVSettings.setValue(e._qtyPrefix+i,r),t.fire(i)}}}(),this.sQty}}]),e}();t.Connection=l;var d=function(){function e(){n(this,e),this._connection=new l}return r(e,[{key:"connection",value:function(){return this._connection}},{key:"getSymbolInfo",value:function(e){return $.Deferred().resolve({realtimeContractId:e,formatter:new TradingView.PriceFormatter})}}]),e}();t.RealtimeProvider=d},,,,,,function(e,t,i){"use strict";var r=i(323),n=i(350).RealtimeProvider,o=function(e){this._trading=e,this._realtimeProvider=new n,this._trading.hideFloatingPanel.subscribe(this._syncToolbar.bind(this)),this._trading.onBrokerChange.subscribe(this,this._brokerChange),this._trading.onConnectionStatusChange.subscribe(this,this._brokerChangeConnectStatus);var t=this;$(document).ready(function(){t._brokerChange(t._trading.getActiveBroker()),t._syncToolbar()}),this._activeBroker=e.getActiveBroker()||this._realtimeProvider};o.prototype._brokerChange=function(e){var t=(e||{}).connection&&e.connection().connectStatus(),i=t==r.CONNECTED?e:this._realtimeProvider;this._updateBroker(i)},o.prototype._brokerChangeConnectStatus=function(e){var t=e==r.CONNECTED?this._trading.getActiveBroker():this._realtimeProvider;this._updateBroker(t)},o.prototype._updateBroker=function(e){e==this._activeBroker||this._trading.hideFloatingPanel.value()||(this._unsubscribe(),this._activeBroker=e,this._subscribe())},o.prototype._POSITION_KEY="trading_floating_toolbar.position",o.prototype._gaOrigin="Chart BS Panel",o.prototype._isVisible=!1,o.prototype._qtyFieldFocued=!1,o.prototype._syncToolbar=function(){this._trading.hideFloatingPanel.value()?this.hide():this.show()},o.prototype.init=function(){function e(){var e=i.qty();e=TradingView.pow10Increment(e),e=Math.min(e,1e18),i.qty(e),i.syncQtyField(),i._activeBroker.connection().suggestedQty().setValue(i._symbol,i.qty())}function t(){var e=i.qty();e=TradingView.pow10Increment(e,!0,1),e=Math.max(e,1),i.qty(e),i.syncQtyField(),i._activeBroker.connection().suggestedQty().setValue(i._symbol,i.qty())}if(!this._initialized){var i=this;i._isTradableCache={},i._symbolTypeCache={};var r=$('<div class="trading-floating-toolbar symbol-tradable"><table class="flow"><tr><td><div class="drag-handler"><i></i></div></td><td class="order sell"><a class="market apply-common-tooltip" title="'+$.t("Sell Market")+'"><div class="title">'+$.t("Sell")+'</div><div class="value"></div></a></td><td class="order sell"><a class="more"><i class="arrow"></i></a></td><td class="order buy"><a class="market apply-common-tooltip" title="'+$.t("Buy Market")+'"><div class="title">'+$.t("Buy")+'</div><div class="value"></div></a></td><td class="order buy"><a class="more"><i class="arrow"></i></a></td><td class="qty"><div class="input-wrap"><div class="spacer"></div><input name="qty" class="apply-common-tooltip" title="'+$.t("Quantity")+'" value="1" autocomplete="off"></div></td><td><a class="qty-plus"></a><a class="qty-minus"></a></td></tr><table></div>').addClass("js-hidden").appendTo("body").draggable({handle:".drag-handler",stop:function(){TVSettings.setJSON(i._POSITION_KEY,r.offset())}});$(window).on("resize",i._updatePosition.bind(i)),i._$widget=r,i._$ask=r.find(".order.buy .value"),i._$bid=r.find(".order.sell .value");var n=i._$qty=r.find(".qty input"),o=i._$qtySpacer=r.find(".qty .spacer");n.on("keypress",function(e){e.charCode&&/[^0-9]/.test(String.fromCharCode(e.charCode))&&e.preventDefault()}),n.on("input",function(e){var t=n.val(),i=t.replace(/[^0-9]/g,"");t!==i&&n.val(i),o.text(i)}),n.on("focus",function(e){i._qtyFieldFocued=!0,i.syncQtyField()}),n.on("blur",function(e){if(i._qtyFieldFocued){i._qtyFieldFocued=!1;var t=+n.val()||1;t!==i.qty()&&(i.qty(t),i._activeBroker.connection().suggestedQty().setValue(i._symbol,i.qty())),i.syncQtyField()}}),r.find(".qty-plus").on("click",function(t){t.preventDefault(),i._trading._trackEvent(i._gaOrigin,"Plus"),e()}),r.find(".qty-minus").on("click",function(e){e.preventDefault(),i._trading._trackEvent(i._gaOrigin,"Minus"),t()});var a=!1;n.on("keydown",function(i){38!==i.keyCode&&40!==i.keyCode||(a=!0,i.preventDefault(),38===i.keyCode?e():t())}),n.on("keypress",function(i){38!==i.keyCode&&40!==i.keyCode||(i.preventDefault(),a||(38===i.keyCode?e():t()))}),TradingView.bindPopupMenu(r.find(".order.sell .more"),i._sellOptions.bind(i)),TradingView.bindPopupMenu(r.find(".order.buy .more"),i._buyOptions.bind(i)),i._$widget=r,r.find(".buy .market").on("click",function(e){e.preventDefault(),i._trading._trackEvent(i._gaOrigin,"Buy"),i.action({type:"market",side:"buy",price:"ask",noConfirm:!0})}),r.find(".sell .market").on("click",function(e){e.preventDefault(),i._trading._trackEvent(i._gaOrigin,"Sell"),i.action({type:"market",side:"sell",price:"bid",noConfirm:!0})}),r.on("contextmenu",function(e){if(!$(e.target).is("input")){e.preventDefault();var t=new TradingView.Action({text:$.t("Hide Buy/Sell Panel")});t.callbacks().subscribe(null,function(){i._trading._trackEvent(i._gaOrigin,"Hide BS Panel"),i._trading.hideFloatingPanel.setValue(!0)}),TradingView.ContextMenu.createMenu([t]).show(e)}}),this._boundOnQuoteData=this._onQuoteData.bind(this),i._initialized=!0}},o.prototype._updatePosition=function(){var e=this,t=this._$widget,i=$(window),r=i.height()-t.outerHeight(),n=i.width()-t.outerWidth(),o=TVSettings.getJSON(e._POSITION_KEY,{left:n/2,top:window.headerChartPanel.outerHeight()+15});o={top:Math.min(r,Math.max(o.top,0)),left:Math.min(n,Math.max(o.left,0))},t.css(o),t.draggable("option","containment",[0,0,n,r])},o.prototype._highlightChange=function(e,t,i){if(!i)return $(document.createTextNode(e));var r,n=e+"",o=t+"";if(n.length==o.length){for(var a=0;a<n.length;a++)if(n.charAt(a)!==o.charAt(a)){r=a;break}}else r=0;if(!isFinite(r))return $(document.createTextNode(n));var s=document.createTextNode(n.substr(0,r)),l=document.createElement("span");return l.className=0>i?"down":"up",l.appendChild(document.createTextNode(n.substr(r))),$(s).add(l)},o.prototype._onQuoteData=function(e){var t=this;if(!e)return void t._setIsTradable(!1);t._setIsTradable(window.tradingController&&window.tradingController.isTradable?window.tradingController.isTradable(this._subscribedSymbol):e.is_tradable),e.formatter&&(t._formatter=e.formatter),null!=e.symbol_type&&(t._symbolTypeCache[t._symbol]=e.symbol_type);var i=t._quoteValues||{},r={ask:e.ask||e.trade||e.prev_close,bid:e.bid||e.trade||e.prev_close};r.formattedAsk=t._formatter.format(r.ask),r.formattedBid=t._formatter.format(r.bid),i.ask!==r.ask&&(t._$ask.empty().append(t._highlightChange(r.formattedAsk,i.formattedAsk,r.ask-i.ask)),"forex"===t._symbolTypeCache[t._symbol]&&t._$ask.lastCharSup()),i.bid!==r.bid&&(t._$bid.empty().append(t._highlightChange(r.formattedBid,i.formattedBid,r.bid-i.bid)),"forex"===t._symbolTypeCache[t._symbol]&&t._$bid.lastCharSup()),t._quoteValues=r},o.prototype._subscribe=function(){var e=this._activeBroker,t=this,i=e.connection().suggestedQty().changed,r=function(i){if(i===t._symbol){var r=e.connection().suggestedQty().value(i);t.qty(r),t.syncQtyField()}};i.subscribe(null,r),t._destroyQtySubscription=function(){i.unsubscribe(null,r)},t._linking=$44.proSymbol.spawn(),t._linking.subscribe(function(i){if(t._symbol=i,t._subscribedSymbol!==i)if(r(t._symbol),t._$ask.empty(),t._$bid.empty(),t._quoteValues={},t._setIsTradable(),t._symbolType=void 0,e.connection().subscribeRealtime){var n=e.connection();t._formatter=new TradingView.PriceFormatter,t._subscribedSymbol&&n.unsubscribeRealtime(t._subscribedSymbol,t._boundOnQuoteData);var o=t._lastBrokerSymbolCall={};e.getSymbolInfo(i).done(function(e){if(o===t._lastBrokerSymbolCall){var i=e.realtimeContractId;t._subscribedSymbol=i,e.formatter&&(t._formatter=e.formatter),n.subscribeRealtime(i,t._boundOnQuoteData)}}).fail(function(){var e=t._activeBroker,i=$44.proSymbol.value();
t._updateBroker(t._realtimeProvider),t._untredableLink=$44.proSymbol.spawn(),t._untredableLink.subscribe(function(r){r!=i&&t._updateBroker(e)})})}else t._setIsTradable(void 0)},{callWithLast:!0})},o.prototype._unsubscribe=function(){var e=this;if(e._linking&&(e._linking.destroy(),delete e._linking),e._untredableLink&&(e._untredableLink.destroy(),delete e._untredableLink),e._subscribedSymbol){var t=e._activeBroker&&e._activeBroker.connection();t&&t.unsubscribeRealtime(e._subscribedSymbol,e._boundOnQuoteData),delete e._subscribedSymbol}e._destroyQtySubscription&&(e._destroyQtySubscription(),delete e._destroyQtySubscription),delete this._symbol,this._isTradableCache={},e._setIsTradable(void 0)},o.prototype._setIsTradable=function(e){var t=this._symbol;null==e&&Object.prototype.hasOwnProperty.call(this._isTradableCache,t)&&(e=this._isTradableCache[t]),this._isTradable=e,this._isTradableCache[t]=e},o.prototype._sellOptions=function(){var e=this._quoteValues||{},t=this._formatter||new TradingView.PriceFormatter,i=this;return[{title:$.t("Sell Market"),action:function(){i._trading._trackEvent(i._gaOrigin,"Sell","Market"),i.action({type:"market",side:"sell",price:"bid",noConfirm:!0})}},{title:$.t("Sell Ask",{quote:e.ask?" @ "+t.format(e.ask):""}),action:function(){i._trading._trackEvent(i._gaOrigin,"Sell","Ask"),i.action({type:"limit",side:"sell",price:"ask",noConfirm:!0})}},{title:$.t("Sell Bid",{quote:e.bid?" @ "+t.format(e.bid):""}),action:function(){i._trading._trackEvent(i._gaOrigin,"Sell","Bid"),i.action({type:"limit",side:"sell",price:"bid",noConfirm:!0})}},{title:$.t("Create New Order..."),action:function(){i.action({side:"sell"})}}]},o.prototype._buyOptions=function(){var e=this._quoteValues||{},t=this._formatter||new TradingView.PriceFormatter,i=this;return[{title:$.t("Buy Market"),action:function(){i._trading._trackEvent(i._gaOrigin,"Buy","Market"),i.action({type:"market",side:"buy",price:"ask",noConfirm:!0})}},{title:$.t("Buy Ask",{quote:e.ask?" @ "+t.format(e.ask):""}),action:function(){i._trading._trackEvent(i._gaOrigin,"Buy","Ask"),i.action({type:"limit",side:"buy",price:"ask",noConfirm:!0})}},{title:$.t("Buy Bid",{quote:e.bid?" @ "+t.format(e.bid):""}),action:function(){i._trading._trackEvent(i._gaOrigin,"Buy","Bid"),i.action({type:"limit",side:"buy",price:"bid",noConfirm:!0})}},{title:$.t("Create New Order..."),action:function(){i.action({side:"buy"})}}]},o.prototype.show=function(){this._isVisible||(this.init(),this._$widget.removeClass("js-hidden"),this._updatePosition(),this._unsubscribe(),this._subscribe(),this._isVisible=!0)},o.prototype.hide=function(){this._isVisible&&(this._$widget&&this._$widget.addClass("js-hidden"),this._unsubscribe(),this._isVisible=!1)},o.prototype.qty=function(e){if(arguments.length>0){var t=+e;(!isFinite(t)||0>=t)&&(t=1),this._qty=e}return this._qty},o.prototype.action=function(e){var t=this;if(this._activeBroker instanceof n&&!this._trading.getActiveBroker())return this._trading.onOpenBottomWidgetBar.fire(),void this._trading.onNeedAttention.fire();if(!this._isTradable&&this._trading.getActiveBroker().connection().connectStatus()==r.CONNECTED&&!window.tradingController)return void t._trading.getActiveBroker().getUntradableDialog().open(this._symbol);var i=this._quoteValues||{};"ask"===e.price?e.price=i.ask:"bid"===e.price&&(e.price=i.bid),e.symbol||(e.symbol=$44.proSymbol.value()),e.qty||(e.qty=this.qty()||1),e.price&&("limit"===e.type?(e.limit_price=e.price,this._formatter&&(e.formatted_limit_price=this._formatter.format(e.limit_price))):(e.stop_price=e.price,this._formatter&&(e.formatted_stop_price=this._formatter.format(e.stop_price))));var o=t._trading.getActiveBroker().getOrderDialog();is_authenticated||window.tradingController?o.open(e):$82.showSignInDialog(null,{source:"Trading floating toolbar"})},o.prototype.syncQtyField=function(){var e=this._qty,t=e+"";this._qtyFieldFocued||(t=TradingView.abbreviatedNumber(e)),$(this._$qty).val()!==t&&$(this._$qty).val(t),$(this._$qtySpacer).text(t)},e.exports=o},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this._linetool=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.BooleanBinder,s=n.RangeBinder;inherit(r,o),r.prototype.prepareLayout=function(){this._block=$("<table>");var e=this._linetool.properties().intervalsVisibilities;if(Z75.enabled("seconds_resolution")){var t=$("<tr>").appendTo(this._block),i=$("<label>").append($.t("Seconds")),r=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(i);$("<td>").css("padding-right","15px").append(i).appendTo(t);var n=$("<input type='text'>").addClass("ticker-text");$("<td>").append(n).appendTo(t);var o=$("<div>").addClass("slider-range ui-slider-horizontal");$("<td>").append(o).appendTo(t);var l=$("<input type='text'>").addClass("ticker-text");$("<td>").append(l).appendTo(t),this.bindControl(new a(r,e.seconds,!0,this.model(),"Change Line Tool Visibility On Seconds")),this.bindControl(new s(o,[e.secondsFrom,e.secondsTo],[1,59],!1,this.model(),[n,l],[$.t("Change Seconds From"),$.t("Change Seconds To")],r))}var t=$("<tr>").appendTo(this._block),i=$("<label>").append($.t("Minutes")),d=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(i);$("<td>").css("padding-right","15px").append(i).appendTo(t);var n=$("<input type='text'>").addClass("ticker-text");$("<td>").append(n).appendTo(t);var o=$("<div>").addClass("slider-range ui-slider-horizontal");$("<td>").append(o).appendTo(t);var l=$("<input type='text'>").addClass("ticker-text");$("<td>").append(l).appendTo(t),this.bindControl(new a(d,e.minutes,!0,this.model(),"Change Line Tool Visibility On Minutes")),this.bindControl(new s(o,[e.minutesFrom,e.minutesTo],[1,59],!1,this.model(),[n,l],[$.t("Change Minutes From"),$.t("Change Minutes To")],d));var t=$("<tr>").appendTo(this._block),i=$("<label>").append($.t("Hours")),h=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(i);$("<td>").append(i).appendTo(t);var n=$("<input type='text'>").addClass("ticker-text");$("<td>").append(n).appendTo(t);var o=$("<div>").addClass("slider-range ui-slider-horizontal");$("<td>").append(o).appendTo(t);var l=$("<input type='text'>").addClass("ticker-text");$("<td>").append(l).appendTo(t),this.bindControl(new a(h,e.hours,!0,this.model(),"Change Line Tool Visibility On Hours")),this.bindControl(new s(o,[e.hoursFrom,e.hoursTo],[1,24],!1,this.model(),[n,l],[$.t("Change Minutes From"),$.t("Change Hours To")],h));var t=$("<tr>").appendTo(this._block),i=$("<label>").append($.t("Days")),p=$("<input type='checkbox'>").addClass("visibility-checker").prependTo(i);$("<td>").append(i).appendTo(t);var n=$("<input type='text'>").addClass("ticker-text");$("<td>").append(n).appendTo(t);var o=$("<div>").addClass("slider-range ui-slider-horizontal");$("<td>").append(o).appendTo(t);var l=$("<input type='text'>").addClass("ticker-text");$("<td>").append(l).appendTo(t),this.bindControl(new a(p,e.days,!0,this.model(),"Change Line Tool Visibility On Days")),this.bindControl(new s(o,[e.daysFrom,e.daysTo],[1,366],!1,this.model(),[n,l],[$.t("Change Minutes From"),$.t("Change Days To")],p));var t=$("<tr>").css("height","29px").appendTo(this._block),i=$("<label>").append($.t("Weeks")),c=$("<input type='checkbox'>").prependTo(i);$("<td>").append(i).appendTo(t),this.bindControl(new a(c,e.weeks,!0,this.model(),"Change Line Tool Visibility On Weeks"));var t=$("<tr>").css("height","29px").appendTo(this._block),i=$("<label>").append($.t("Months")),u=$("<input type='checkbox'>").prependTo(i);$("<td>").append(i).appendTo(t),this.bindControl(new a(u,e.months,!0,this.model(),"Change Line Tool Visibility On Months")),this.loadData()},r.prototype.widget=function(){return this._block},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){o.call(this,e,t),this.Z99=i,this.prepareLayout()}var n=i(179),o=n.Q5,a=n.GreateTransformer,s=n.LessTransformer,l=n.ToIntTransformer,d=n.ToFloatTransformer,h=n.BooleanBinder,p=n.SimpleComboBinder,c=n.SimpleStringBinder;inherit(r,o),r.prototype._getStrategyInputs=function(){for(var e,t=0,i=this.Z99.metaInfo(),r={};t<i.inputs.length;t++)e=i.inputs[t],"strategy_props"===e.groupId&&(assert(void 0!==e.internalID,"Strategy input id="+e.id+" doesn't have an internalID"),r[e.internalID]=i.inputs[t]);return TradingView.clone(r)},r.prototype._setStdInput=function(e,t,i){if(e){var r,n=e.id,o="study_input-"+n+"-"+Date.now().toString(36)+"-"+Math.random().toString(36),u=$("<tr>").appendTo(this._$table),_="Change "+t,f=$('<label for="'+o+'">'+$.t(t,{context:"input"})+"</label>");if("bool"==e.type){var g=$('<td colspan="3">').appendTo(u);r=$('<input id="'+o+'" type="checkbox">').appendTo(g),f.appendTo(g),i!==!0&&this.bindControl(new h(r,this._property.inputs[n],!0,this.model(),_))}else{var v=($("<td>").addClass($.t("propertypage-name-label",{context:"css_class"})).append(f).appendTo(u),$('<td colspan="2">').appendTo(u));if(e.options){r=$('<select id="'+o+'">').appendTo(v);for(var m,y=0;y<e.options.length;y++)m=e.options[y],m instanceof jQuery?m.appendTo(r):$('<option value="'+m+'">'+m+"</option>").appendTo(r);i!==!0&&this.bindControl(new p(r,this._property.inputs[n],null,!0,this.model(),_))}else{if(r=$('<input id="'+o+'" type="text">').appendTo(v),i!==!0){var w;"integer"!=e.type&&"float"!=e.type||(w=["integer"==e.type?l(e.defval):d(e.defval)],(0===e.min||e.min)&&w.push(a(e.min)),(0===e.max||e.max)&&w.push(s(e.max)));var T=new c(r,this._property.inputs[n],w,!1,this.model(),_);"float"===e.type&&T.addFormatter(function(e){return(new TradingView.NumericFormatter).format(e)}),this.bindControl(T)}r.addClass("ticker")}}return r}},r.prototype._setPyramidingInputs=function(e){var t=e.pyramiding,i=this._property.inputs[t.id],r=this._setStdInput({id:"pyramiding_switch",type:"bool"},$.t("Pyramiding"),!0),n=this._setStdInput(e.pyramiding,$.t("Allow up to")),o=n.closest("tr");assert(void 0===this._onAllowUpToChanged),this._onAllowUpToChanged=function(e){e.value()>0?(r.prop("checked",!0),n.removeAttr("disabled"),o.removeClass("disabled")):(r.prop("checked",!1),n.attr("disabled","disabled"),o.addClass("disabled"))},i.subscribe(null,this._onAllowUpToChanged),r.change(function(){var e=!r.prop("checked");i.setValue(e?0:t.defval),e?n.attr("disabled","disabled"):n.removeAttr("disabled"),o.toggleClass("disabled",e)}),i.value()>0?r.prop("checked",!0):(r.prop("checked",!1),n.attr("disabled","disabled"),o.addClass("disabled")),o.children().last().removeAttr("colspan"),$("<td>").text("orders").appendTo(o)},r.prototype._setQtyInputs=function(e){function t(e){if(e=+e,isNaN(e)||0>e)return 0;var t=p.val();return"percent_of_equity"!=t?e=parseInt(e):e>100&&(e=100),e}var i=this,r=e.default_qty_value,n=$.extend({},e.default_qty_type),o=this._property.inputs[r.id],a=(this._property.inputs[n.id],this._setStdInput(r,$.t("Order size"),!0)),s=new c(a,o,t,!1,this.model(),"Change Order Size");this.bindControl(s);var l=a.closest("td");l.removeAttr("colspan");var d=this.Z99.reportData()&&this.Z99.reportData().currency||"USD",h=$('<option value="cash_per_order">'+d+"</option>");n.options=[$('<option value="fixed">'+$.t("Contracts")+"</option>"),h,$('<option value="percent_of_equity">'+$.t("% of equity")+"</option>")];var p=this._setStdInput(n,"type"),u=p.closest("td"),_=u.closest("tr");u.removeAttr("colspan"),u.detach().insertAfter(l),_.remove(),this.Z99.watchedData.subscribe(function(){var e=i.Z99.reportData()&&i.Z99.reportData().currency||"USD";h.text(e),p.closest("td").find("a[href=#cash_per_order]").text(e)})},r.prototype._setFillLimitsInputs=function(e){var t=this._setStdInput(e.backtest_fill_limits_assumption,$.t("Verify Price for Limit Orders")),i=t.closest("td");i.removeAttr("colSpan"),$("<td>").text("ticks").insertAfter(i)},r.prototype.prepareLayout=function(){this._$table=$(document.createElement("table")).addClass("property-page strategy-properties").attr("cellspacing","0").attr("cellpadding","2");var e=this._getStrategyInputs();e.initial_capital.min=1,this._setStdInput(e.initial_capital,$.t("Initial capital")),Array.isArray(e.currency.options)&&"NONE"==e.currency.options[0]&&(e.currency.options[0]=$('<option value="NONE">'+$.t("Default")+"</option>")),this._setStdInput(e.currency,$.t("Base currency")),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setPyramidingInputs(e),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setQtyInputs(e),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setStdInput(e.calc_on_order_fills,$.t("Recalculate After Order filled")),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setStdInput(e.calc_on_every_tick,$.t("Recalculate On Every Tick")),$('<tr class="spacer"><td colspan="3"></td></tr>').appendTo(this._$table),this._setFillLimitsInputs(e),this.loadData()},r.prototype.widget=function(){return this._$table},r.prototype.loadData=function(){o.prototype.loadData.call(this);var e=this._getStrategyInputs(),t=e.pyramiding,i=this._property.inputs[t.id];i.setValue(i.value(),!0)},r.prototype.destroy=function(){o.prototype.destroy.call(this);var e=this._getStrategyInputs(),t=e.pyramiding,i=this._property.inputs[t.id];i.unsubscribe(null,this._onAllowUpToChanged)},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){this.pane=e,this._isLeft=r.isLeft(t),this.Q0=e.chart().properties().scalesProperties,this._disableContextMenu=!!i,this.jqCell=$(document.createElement("td")),this.jqCell.addClass("chart-markup-table"),this.jqCell.addClass("price-axis"),this.jqCell.width(25),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqCell),this.canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this._textWidthCache=new o,this.restoreDefaultCursor(),this.update(),TradingView.setMouseEventHandler(this.jqCell,this,!0),this.dialog=this.pane.chart().dialog,this.contextMenu=null,this.actions={},this._isVisible=!0}var n=i(13).LineDataSource,o=i(36);r.prototype._BORDER_SIZE=1,r.prototype._OFFSET_SIZE=1,r.prototype._TICK_LENGTH=3,r.LHS=1,r.RHS=2,r.isLeft=function(e){return e===r.LHS?!0:e===r.RHS?!1:(TradingView.logDebugChart("PriceAxisWidget.isLeft: wrong side"),!1)},r.prototype.backgroundColor=function(){return this.pane.chart().properties().paneProperties.background.value()},r.prototype.lineColor=function(){return this.Q0.lineColor.value()},r.prototype.textColor=function(){return this.Q0.textColor.value()},r.prototype.fontSize=function(){return this.Q0.fontSize.value()},r.prototype.baseFont=function(){return TradingView.makeFont(this.fontSize(),"Arial","")},r.prototype.rendererOptions=function(){this._rendererOptions||(this._rendererOptions={isLeft:this._isLeft,width:0,height:0,borderSize:this._BORDER_SIZE,offsetSize:this._OFFSET_SIZE,tickLength:this._TICK_LENGTH,fontSize:NaN,font:"",widthCache:new o,_tickmarksCache:new TradingView.LabelsImageCache(11,"Arial","","#000"),color:""});var e=this._rendererOptions,t=!1;if(e.color!==this.textColor()&&(e.color=this.textColor(),t=!0),e.fontSize!==this.fontSize()){var i=this.fontSize();e.fontSize=i,e.font=this.baseFont(),e.paddingTop=Math.floor(i/4.5),e.paddingBottom=Math.ceil(i/4.5),e.paddingInner=Math.max(Math.ceil(i/3-e.tickLength/2),0),e.paddingOuter=Math.ceil(i/3),e.baselineOffset=Math.round(i/10),e.widthCache.reset(),t=!0}return t&&e._tickmarksCache.reset(e.fontSize,"Arial","",e.color),this.size&&(e.width=this.size.w,e.height=this.size.h),this._rendererOptions},r.prototype.mouseDownEvent=function(e){if(!this.priceScale().isEmpty()){var t=this.pane.chart().model(),i=(this.pane,this.pane.state());this._mousedown=!0,this.jqCell.css("cursor",TradingView.cursorCss("cursor_size_vertical","15 15")),t.startScalePrice(i,this.priceScale(),e.localY)}},r.prototype.pressedMouseMoveEvent=function(e){var t=this.pane.chart().model(),i=(this.pane,this.pane.state()),r=this.priceScale();t.scalePriceTo(i,r,e.localY)},r.prototype.mouseDownOutsideEvent=function(e){var t=this.pane.chart().model(),i=this.pane.state(),r=this.priceScale();this._mousedown&&(this._mousedown=!1,t.endScalePrice(i,r),this.restoreDefaultCursor())},r.prototype.mouseUpEvent=function(e){var t=this.pane.chart().model(),i=(this.pane,this.pane.state()),r=this.priceScale();this._mousedown=!1,t.endScalePrice(i,r),this.restoreDefaultCursor()},r.prototype._initActions=function(e){if(this.pane.state()){var t=i(179).ActionBinder,n=this;this.actions.reset=new TradingView.Action({text:$.t("Reset Scale")}),this.actions.reset.callbacks().subscribe(this,r.prototype.reset);var o=function(e){this._undoModel.setLockScaleProperty(this._property,e.checked,n.priceScale().mainSource(),this._undoText)};delete this.actions.setLockScale,this.priceScale().mainSource()instanceof TradingView.Series&&(this.actions.setLockScale=new TradingView.Action({text:$.t("Lock Scale"),checkable:!0,checked:this.priceScale().mainSource().properties().lockScale.value()}),this._lockScaleBinding=new t(this.actions.setLockScale,this.priceScale().mainSource().properties().lockScale,this.pane.chart().model(),"Undo LockScale",o),this._lockScaleBinding.setValue(this.priceScale().mainSource().properties().lockScale.value()));var a=function(){this._undoModel.setAutoScaleProperty(this._property,this.value(),n.priceScale(),this._undoText)};this.actions.setAutoScale=new TradingView.Action({text:$.t("Auto Scale"),checkable:!0,checked:!0}),this._autoScaleBinding=new t(this.actions.setAutoScale,this.priceScale().properties().autoScale,this.pane.chart().model(),"Undo AutoScale",a),this._autoScaleBinding.setValue(this._autoScaleBinding.property().value()),this.actions.setPercentage=new TradingView.Action({text:$.t("Percentage",{context:"scale_menu"}),checkable:!0,checked:!1});var s=function(){this._undoModel.setPercentProperty(this._property,this.value(),n.priceScale(),this._undoText)};this.actions.setPercentage.binding=new t(this.actions.setPercentage,this.priceScale().properties().percentage,this.pane.chart().model(),"Undo Percentage",s),this.actions.setLog=new TradingView.Action({text:$.t("Log Scale",{context:"scale_menu"}),checkable:!0,checked:!1}),this.actions.setLog.binding=new t(this.actions.setLog,this.priceScale().properties().log,this.pane.chart().model(),"Undo Log Scale"),this.actions.alignLabels=new TradingView.Action({text:$.t("Precise Labels",{context:"scale_menu"}),checkable:!0,checked:!1}),this.actions.alignLabels.binding=new t(this.actions.alignLabels,this.priceScale().properties().alignLabels,this.pane.chart().model(),"Precise Labels"),this._updateScalesActions()}},r.prototype._updateScalesActions=function(){var e=this.priceScale(),t=e.mainSource()instanceof TradingView.Series,i=e.mainSource().properties();this.actions.setPercentage.setEnabled(!(e.isLog()||t&&i.lockScale.value()||t&&i.style.value()===TradingView.Series.STYLE_PNF)),this.actions.setLog.setEnabled(!(e.isPercent()||t&&i.lockScale.value()||t&&i.style.value()===TradingView.Series.STYLE_PNF)),this.actions.setAutoScale.setChecked(e.Q0.autoScale.value()),this.actions.setAutoScale.setEnabled(!e.properties().autoScaleDisabled.value())},r.prototype.mouseClickEvent=function(e){},r.prototype.mouseDoubleClickEvent=function(e){this.reset(),TradingView.trackEvent("GUI","Double click price scale")},r.prototype.contextMenuEvent=function(e,t){!this._disableContextMenu&&Z75.enabled("scales_context_menu")&&this._createContextMenu().show(e)},r.prototype._createContextMenu=function(){return TradingView.ContextMenu.createMenu(this.getContextMenuActions())},r.prototype.getContextMenuActions=function(){this._initActions();var e=this.pane.chart().actions(),t=[this.actions.reset,new TradingView.ActionSeparator,e.showLeftAxis,e.showRightAxis,new TradingView.ActionSeparator,this.actions.setAutoScale,e.scaleSeriesOnly,new TradingView.ActionSeparator,this.actions.setPercentage,this.actions.setLog,new TradingView.ActionSeparator,e.showSymbolLabelsAction,e.showSeriesLastValue,e.showStudyPlotNamesAction,e.showStudyLastValue];return Z75.enabled("countdown")&&t.push(e.showCountdown),t.push(this.actions.alignLabels),TradingView.onWidget()||(t.push(new TradingView.ActionSeparator),t.push(e.scalesProperties)),this.actions.setLockScale&&t.splice(6,0,this.actions.setLockScale),t},r.prototype.backLabels=function(e){var t=[],i=this.priceScale().orderedSources().slice(),r=this.pane,n=r.chart().model(),o=r.state(),a=[],s=n.sourceBeingMoved()||n.lineBeingEdited()||n.lineBeingCreated();s&&a.push(s),n.selectedSource()&&a.push(n.selectedSource()),n.hoveredSource()&&a.push(n.hoveredSource());var l=this.priceScale()===o.defaultPriceScale();if(l)for(var d=this.pane.state().Q17(),h=0;h<d.length;h++)o.isOverlay(d[h])&&i.push(d[h]);for(var h=0;h<i.length;++h){var p=i[h];if(e||-1===a.indexOf(p)){var c=p.priceAxisViews(o,p.priceScale());if(c)for(var u=0;u<c.length;u++)t.push(c[u])}}return t},r.prototype.optimalWidth=function(){if(!this.isVisible())return 0;var e=0,t=this.rendererOptions();if(this.pane.state()){var i=this.ctx,r=this.priceScale().marks();i.setFont(this.baseFont()),r.length>0&&(e=Math.max(t.widthCache.measureText(i,r[0].label),t.widthCache.measureText(i,r[r.length-1].label)));for(var n=this.backLabels(!0),o=n.length;o--;){var a=t.widthCache.measureText(i,n[o].text());a>e&&(e=a)}}return Math.ceil(t.offsetSize+t.borderSize+t.tickLength+t.paddingInner+t.paddingOuter+e)},r.prototype.setSize=function(e){this.size&&this.size.equals(e)||(this.size=e,TradingView.setCanvasSize(this.canvas,e),TradingView.setCanvasSize(this.top_canvas,e),this.jqCell.css({width:e.w,"min-width":e.w,height:e.h}))},r.prototype.update=function(){},r.prototype._hightlightBackground=function(e,t,i){for(var r=t[0].price,n=t[0].price,o=1;o<t.length;o++)r=Math.min(r,t[o].price),n=Math.max(n,t[o].price);var a=this.priceScale();if(a.isPercent()&&i){var s=i.firstValue();r=a.priceRange().convertToPercent(r,s),n=a.priceRange().convertToPercent(n,s)}var l=this.priceScale().priceToCoordinate(r),d=this.priceScale().priceToCoordinate(n),h="rgba(109, 158, 235, 0.3)";TradingView.clearRect(e,1,l,this.size.w-1,d-l,h)},r.prototype.drawBackground=function(e){TradingView.clearRect(e,0,0,this.size.w,this.size.h,this.backgroundColor());var t=this.pane.chart().model(),i=t.model().selectedSource();if(i&&i.priceScale()==this.priceScale()&&i instanceof n){var r=i.axisPoints();if(0===r.length)return;this._hightlightBackground(e,r,i.ownerSource())}var o=t.model().crossHairSource();o.startMeasurePoint()&&this._hightlightBackground(e,o.measurePoints(),this.pane.state().mainDataSource())},r.prototype.drawBorder=function(e){e.save(),e.fillStyle=this.lineColor();var t,i,r=this.size.h;this._isLeft?(e.translate(-.5,-.5),t=this.size.w-this._BORDER_SIZE-1,i=this.size.w-1):(e.translate(.5,-.5),t=0,i=t+this._BORDER_SIZE),e.fillRect(t,0,i-t,r),e.restore()},r.prototype.drawTickMarks=function(e){e.save(),e.strokeStyle=this.lineColor();var t=this.priceScale().marks();e.fillStyle=this.textColor(),e.setFont(this.baseFont());var i=this;e.translate(-.5,-.5);var r=this.rendererOptions();if(i._isLeft){e.fillStyle=i.lineColor(),e.beginPath();for(var n=this.size.w-i._OFFSET_SIZE-i._BORDER_SIZE-i._TICK_LENGTH,o=t.length;o--;)e.rect(n,t[o].coord,i._TICK_LENGTH,1);e.fill();for(var o=t.length;o--;)r._tickmarksCache.paintTo(e,t[o].label,n-r.paddingInner,t[o].coord,"right")}else{e.fillStyle=i.lineColor(),e.beginPath();for(var a=i._BORDER_SIZE+i._OFFSET_SIZE,o=t.length;o--;)e.rect(a,t[o].coord,i._TICK_LENGTH,1);e.fill();for(var o=t.length;o--;)r._tickmarksCache.paintTo(e,t[o].label,a+i._TICK_LENGTH+r.paddingInner,t[o].coord,"left")}e.restore()},r.prototype._alignLabels=function(){var e=this.size.h/2,t=[],i=this.priceScale().orderedSources().slice(),r=this.pane,n=(r.chart().model(),r.state()),o=this.rendererOptions(),a=this.priceScale()===n.defaultPriceScale();if(a)for(var s=this.pane.state().Q17(),l=0;l<s.length;l++)n.isOverlay(s[l])&&i.push(s[l]);for(var d=this.priceScale().mainSource(),l=0;l<i.length;++l){var h=i[l],p=h.priceAxisViews(n,h.priceScale());if(p){for(var c=0;c<p.length;c++)t.push(p[c]);d==h&&p.length>0&&(e=p[0].floatCoordinate())}}var u=t.filter(function(t){return t.floatCoordinate()<=e}),_=t.filter(function(t){return t.floatCoordinate()>e});u.sort(function(e,t){return t.floatCoordinate()-e.floatCoordinate()}),u.length&&_.length&&_.push(u[0]),_.sort(function(e,t){return e.floatCoordinate()-t.floatCoordinate()}),t.forEach(function(e){e._fixedCoordinate=e.coordinate()});var f=this.priceScale().properties();if(f.alignLabels&&f.alignLabels.value()){for(var l=1;l<u.length;l++){var g=u[l],v=u[l-1],m=v.renderer().height(o,!1);if(g.coordinate()>v._fixedCoordinate-m){var y=v._fixedCoordinate-m;g._fixedCoordinate=y}}for(var c=1;c<_.length;c++){var g=_[c],v=_[c-1],m=v.renderer().height(o,!0);if(g.coordinate()<v._fixedCoordinate+m){var y=v._fixedCoordinate+m;g._fixedCoordinate=y}}}},r.prototype.drawBackLabels=function(e){e.save();for(var t=this.backLabels(),i=this.rendererOptions(),r=0;r<t.length;r++){var n=t[r],o=n.renderer();n._fixedCoordinate&&(o._data.coordinate=n._fixedCoordinate),o.draw(e,i)}e.restore()},r.prototype.drawCrossHairLabel=function(e){var t=this.pane.chart().model().model(),i=[],r=t.sourceBeingMoved()||t.lineBeingEdited()||t.lineBeingCreated();r&&i.push({source:r,scale:r.priceScale()}),t.selectedSource()&&i.push({source:t.selectedSource(),scale:t.selectedSource().priceScale()}),t.hoveredSource()&&i.push({source:t.hoveredSource(),scale:t.hoveredSource().priceScale()}),i.push({source:t.crossHairSource(),scale:this.priceScale()});for(var n=this.pane.state(),o=0;o<i.length;o++){var a=i[o],s=a.source.priceAxisViews(n,a.scale);if(s)for(var l=0;l<s.length;l++){var d=s[l];e.save();var h=d.renderer();d._fixedCoordinate&&(h._data.coordinate=d._fixedCoordinate),h.draw(e,this.rendererOptions()),e.restore()}}},r.prototype.priceScale=function(){var e=this.pane.state(),t=[];return t=this._isLeft?[e.leftPriceScale(),e.rightPriceScale()]:[e.rightPriceScale(),e.leftPriceScale()],null===t[0].mainSource()?null===t[1].mainSource()?t[0]:t[1]:t[0]},r.prototype.isVisible=function(){return this._isVisible},r.prototype.setVisible=function(e){e=!!e,e!==this._isVisible&&(e?this.jqCell.css("display","table-cell"):this.jqCell.css("display","none"),this._isVisible=e)},r.prototype.setAutoScale=function(e){var t=this.pane.state,i=this.priceScale(),r=this.pane.chart().model();r.setPriceAutoScale(t,i,e)},r.prototype.reset=function(){var e=this.pane.state(),t=this.priceScale(),i=this.pane.chart().model();i.resetPriceScale(e,t)},r.prototype.paint=function(e){this._isVisible&&e&&(e===$21.UPDATE_CURSOR_ONLY?(this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx)):(this._alignLabels(),this.drawBackground(this.ctx),this.drawBorder(this.ctx),this.pane.state()&&(this.drawTickMarks(this.ctx),this.drawBackLabels(this.ctx),this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h),this.drawCrossHairLabel(this.top_ctx))))},r.prototype.restoreDefaultCursor=function(){this.jqCell.css("cursor","default")},r.prototype.image=function(){var e={};return e.content=this.canvas.toDataURL(),e.contentWidth=this.size.w,e.contentHeight=this.size.h,e},e.exports=r},function(e,t,i){"use strict";function r(e,t){var i=this;if(n.call(this),this._series=e,t&&t.fixedData){this._distribution=t.fixedData;var r=e.model().properties().chartEventsSourceProperties.state();r.visible=!0,this.Q0=new Property(r)}else this._chartEvents=new o({minImportance:1}),this.Q0=e.model().properties().chartEventsSourceProperties;this.setOwnerSource(e);var a=function(t){i._coordinates||i._recalcCoordinates();var r=i._coordinates;if(!r||!r.length)return void i._hideTooltip();i._series.model().hoveredSource()!==i&&(i._hoverGroupIndex=void 0),i._createTemplates();var n=i._paneHeight,o=null,a=i._LOLLIPOP_LINE_WIDTH,s=a/2,l=i._LOLLIPOP_LINE_HEIGHT,d=i._LOLLIPOP_CIRCLE_DIAMETER,h=-d/2,p=i._LOLLIPOP_COUNTER_OFFSET_X,c=i._LOLLIPOP_COUNTER_OFFSET_Y,u=i._LOLLIPOP_COUNTER_HEIGHT,_=d,f=i.properties().breaks,g=f.visible.value();if(g){t.strokeStyle=f.color.value(),t.lineWidth=f.width.value(),CanvasEx.setLineStyle(t,f.style.value());for(var v=0;v<r.length;v++)CanvasEx.drawLine(t,r[v].x,0,r[v].x,n-l-d*r[v].items.length)}i._importanceByIndex||(i._importanceByIndex={});for(var m=i._importanceByIndex,v=r.length;v--;){t.drawImage(i._templatesCache.line,r[v].x-s+.5,n-l-.5,a,l);var y=r[v].index;m[y]||(m[y]=[]);for(var w=r[v].items.length;w--;){var T,b=r[v].items[w];if(w in m[y])T=m[y][w];else{T=-1;for(var S=b.length;S--;)b[S].importance>T&&(T=b[S].importance);m[y][w]=T}var C=n-l-d*(w+1)-.5,x=r[v].x,P=b.length,L=b[0].currency;if(i._hoverGroupIndex!==r[v].index||i._hoverItemIndex!==w){var E=i._templatesCache[T]||i._templatesCache[-1],V=E[L]||E[T][""];t.drawImage(V,x+h+.5,C,d,d),P>1&&t.drawImage(i._amountImage(P),x+p+.5,C+c,_,u)}else o={y:C,x:x,count:P,currency:L,currencyGroup:b,maxImportance:T}}}if(!g&&o){var C=0,I=e.bars().valueAt(i._hoverGroupIndex);if(I){var A=I[TradingView.LOW_PLOT],k=e.priceScale();if(isFinite(A)&&k){if(k.isPercent()){var R=e.firstValue();A=k.priceRange().convertToPercent(A,R)}C=k.priceToCoordinate(A)}}t.strokeStyle=i.color,t.lineWidth=1,CanvasEx.setLineStyle(t,CanvasEx.LINESTYLE_DASHED),CanvasEx.drawLine(t,o.x,C,o.x,n-l-d*o.count)}if(o){var V=i._templatesCache.hovered[o.currency]||i._templatesCache.hovered[""];t.drawImage(V,o.x-11.5,o.y,24,24),o.count>1&&t.drawImage(i._amountImage(o.count),o.x-9.5,o.y+1,24,12)}o?i._showTooltip(o.currencyGroup,o.x,o.y,t):i._hideTooltip()},s=function(e){i._hoverGroupIndex=void 0,i._hoverItemIndex=void 0;var t=e.x,r=e.y;i._coordinates||i._recalcCoordinates();var n=i._coordinates;if(!n||!n.length)return null;var o=i._paneHeight,a=Math.floor((o-22-r)/24),s=o-24*a-22-12,l=s-r,d=Math.sqrt(144-l*l);if(!isFinite(d))return null;for(var h=t-d,p=0,c=n.length-1;c-p>1;){var u=p+c>>1;n[u].x>=h&&(c=u),n[u].x<=h&&(p=u)}for(var _=p;_<n.length;_++){var f=n[_].x-t;if(f>d)break;if(!(-d>f)&&n[_].items[a])return i._hoverGroupIndex===n[_].index&&i._hoverItemIndex===a||(i._hoverGroupIndex=n[_].index,i._hoverItemIndex=a,i._invalidate()),new TradingView.HitTestResult(TradingView.HitTestResult.REGULAR)}return null};this._paneView={renderer:function(){return{hitTest:s,draw:a}}},this._series.model().timeScale().tickMarks().changed.subscribe(this,this._recalcDistribution),this._chartEvents&&this._chartEvents.changed.subscribe(this,this._recalcDistribution),this.Q0.subscribe(this,this._recalcDistribution),this._recalcDistribution()}var n=i(18).DataSource,o=i(361);inherit(r,n),r.prototype.color="#555",r.prototype.bgcolor="white",r.prototype._tooltipShown=!1,r.prototype._$tooltip=null,r.prototype._$content=null,r.prototype._tooltipX=void 0,r.prototype._tooltipY=void 0,r.prototype._tooltipItems=null,r.prototype._distribution=null,r.prototype._colorsByIndex=null,r.prototype._coordinates=null,r.prototype._hoverGroupIndex=void 0,r.prototype._hoverItemIndex=void 0,r.prototype._LOLLIPOP_LINE_WIDTH=2,r.prototype._LOLLIPOP_LINE_HEIGHT=22,r.prototype._LOLLIPOP_CIRCLE_DIAMETER=24,r.prototype._LOLLIPOP_COUNTER_OFFSET_X=-10,r.prototype._LOLLIPOP_COUNTER_OFFSET_Y=1,r.prototype._LOLLIPOP_COUNTER_HEIGHT=12,r.prototype.title=function(){return"Chart Events"},r.prototype.showInObjectTree=function(){return!1},r.prototype._constructor="ChartEventsSource",r.prototype.properties=function(){
return this.Q0},r.prototype.updateAllViews=function(){var e=this._series.model().timeScale();if(e&&this._coordinates){var t={width:e.width(),barSpacing:e.barSpacing(),rightOffset:e.rightOffset()};this._cachedTimescaleState&&this._cachedTimescaleState.width===t.width&&this._cachedTimescaleState.barSpacing===t.barSpacing&&this._cachedTimescaleState.rightOffset===t.rightOffset||(this._cachedTimescaleState=t,this._coordinates=null)}},r.prototype.paneViews=function(e){return this.Q0.visible.value()?(this._paneHeight=e.height(),this._paneWidth=e.width(),[this._paneView]):null},r.prototype._recalcDistribution=function(){var e=this._series.model().timezone();if(!e||"exchange"===e){var t=this._series.symbolInfo();e=t&&t.timezone}if(e&&(this._timeOffset=PineJsCalendar.get_timezone(e).offset_utc(new Date)),isFinite(this._timeOffset)){if(!this._chartEvents)return void(this.distibution&&this._createTemplates());if(this._coordinates=null,this._distribution=null,this._importanceByIndex=null,this.Q0.visible.value()){var t=this._series.symbolInfo();if(t&&t.name&&!(t.name.length<6)&&("forex"===t.type||"cfd"===t.type||"bitcoin"===t.type)){for(var i=null,r=t.name,n=0,a=0;2>a;a++){var s;"bitcoin"===t.type&&"DOGE"===r.substr(n,4).toUpperCase()?(s="DOGE",n+=4):(s=r.substr(n,3).toUpperCase(),n+=3),-1!==o.currencies.indexOf(s)&&(i||(i={}),i[s]=!0)}if(i){var l,d=new TradingView.Interval(this._series.interval());if(d.isValid()){var h=NaN;switch(d.kind()){case TradingView.Interval.WEEKS:h=168*d.multiplier();break;case TradingView.Interval.DAYS:h=24*d.multiplier();break;case TradingView.Interval.HOURS:h=d.multiplier();break;case TradingView.Interval.MINUTES:h=d.multiplier()/60;break;case TradingView.Interval.SECONDS:h=d.multiplier()/3600;break;default:return}if(4>h)l=-1;else if(48>h)l=0;else{if(!(672>h))return;l=1}this._minImportance!==l&&(this._chartEvents.reset({minImportance:l}),this._minImportance=l),this._createTemplates();var p=this._chartEvents.items(),c=this._series.model().timeScale(),u=c.tickMarks(),_={};this._distribution=_;var f=+u.minIndex;if(this.Q0.futureOnly.value()&&(f=Math.max(f,c.points().lastTimePointIndex())),isFinite(f)){var g=+u.maxIndex,v=p.length,m=0,y=u.indexToTime(g);if(y)for(var w=+y-this._timeOffset;m<p.length&&!(p[m].timestamp<=w);m++);for(var T=g;T>=f;T--){var y=u.indexToTime(T);if(y)for(var w=+y-this._timeOffset;;m++){if(m>=v)return void this._chartEvents.requestMore();var b=p[m];if(!i||i[b.currency]){if(b.timestamp<w)break;_[T]||(_[T]=[]);for(var S=_[T].length;S--;)if(_[T][S][0].currency===b.currency){_[T][S].push(b);break}0>S&&_[T].push([b])}}}}}}}}}},r.prototype._recalcCoordinates=function(){this._distribution||this._recalcDistribution();var e=[];this._coordinates=e;var t=this._distribution;if(t){var i=this._series.model().timeScale(),r=i.visibleBars();if(r){var n=r.lastBar(),o=r.firstBar();this._coordinates=e;for(var a=o;n>=a;a++)t[a]&&e.push({x:i.indexToCoordinate(a)+1,items:t[a],index:a})}}},r.prototype._onNewItems=function(){this._recalcDistribution(),this._series.model().updateSource(this)},r.prototype._createTemplates=function(){if(!this._templatesCache){this._templatesCache={line:null,hovered:{},numbers:{}},this._createTemplateLine();for(var e=([""].concat(o.currencies),0);e<o.currencies.length;e++){var t=o.currencies[e];this._createTemplateCircle(t,!1,o.icons[t],-1),this._createTemplateCircle(t,!1,o.icons[t],0),this._createTemplateCircle(t,!1,o.icons[t],1),this._createTemplateCircle(t,!0,o.icons[t])}}},r.prototype._createTemplateLine=function(){var e=document.createElement("canvas");e.width=this._LOLLIPOP_LINE_WIDTH,e.height=this._LOLLIPOP_LINE_HEIGHT;var t=e.getContext("2d");t.strokeStyle=this.color,CanvasEx.setLineStyle(t,CanvasEx.LINESTYLE_DASHED),CanvasEx.drawLine(t,this._LOLLIPOP_LINE_WIDTH/2,0,this._LOLLIPOP_LINE_WIDTH/2,this._LOLLIPOP_LINE_HEIGHT);var i=this._templatesCache;i.line=e;var r=new Image;r.onload=function(){i.line=r},r.src=e.toDataURL()},r.prototype._createTemplateCircle=function(e,t,i,r){function n(){var t=new Image;t.onload=function(){_[u][e]=t},t.src=p.toDataURL()}var o=this,a=this.color,s=this.bgcolor,l=2.5,d=1,h=o._LOLLIPOP_CIRCLE_DIAMETER,p=document.createElement("canvas");p.width=h,p.height=h;var c=p.getContext("2d");c.lineWidth=2*d,c.strokeStyle=a,t?c.fillStyle=a:r>0?(c.fillStyle="#d50000",c.strokeStyle="#8e0000"):0===r?(c.fillStyle="#ff8a00",c.strokeStyle="#aa5c00"):(c.fillStyle="#ffe613",c.strokeStyle="#aa990c"),c.beginPath(),c.arc(h/2,h/2,h/2-d,0,2*Math.PI),c.closePath(),c.stroke(),c.fill();var u,_=this._templatesCache;if(u=t?"hovered":r,_[u]||(_[u]={}),_[u][e]=p,i){var f=svgAsset.code(i),g=new Image;g.onload=function(){var e=g.width,t=g.height;e&&t||(e=+(/<svg[^>]*\bwidth="([^"]+)/.exec(f)||0)[1],t=+(/<svg[^>]*\bheight="([^"]+)/.exec(f)||0)[1]);var i=Math.floor((h-e)/2),r=Math.floor((h-t)/2),a=Math.floor(h/2);c.fillStyle=s,c.beginPath(),c.arc(a,a,e/2+l,0,2*Math.PI),c.closePath(),c.fill(),c.drawImage(g,i,r,e,t),n(),o._invalidate()},/\b(MSIE|Trident)\b/.test(navigator&&navigator.appVersion)?g.src=this._fallbackImages[i]:g.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(f)}else n()},r.prototype._amountImage=function(e){if(e+="",this._templatesCache.numbers[e])return this._templatesCache.numbers[e];var t=document.createElement("canvas");t.width=24,t.height=12;var i=t.getContext("2d");i.font="8px sans-serif",i.textBaseline="middle";var r=i.measureText(e),n=Math.ceil(r.width);return i.fillStyle=this.color,i.fillRect(24-n-4,0,n+4,12),i.fillStyle="white",i.fillText(e,24-n-2,6),this._templatesCache.numbers[e]=t,t},r.prototype._createTooltipLayout=function(){this._$tooltip=$("<div>").addClass("tv-chart-events-source__tooltip").css({position:"absolute",width:"200px","pointer-events":"none"}),this._$tooltipContent=$("<div>").addClass("tv-chart-events-source__tooltip__content").appendTo(this._$tooltip);var e=15,t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("width",e),t.setAttribute("height",(e>>1)+1);var i=document.createElementNS("http://www.w3.org/2000/svg","path");i.setAttribute("d","M 0 0L "+e/2+" "+e/2+"L"+e+" 0"),t.appendChild(i),this._$tooltipArrow=$(t),this._$tooltipArrow.css({position:"absolute",bottom:-(e>>1),left:"50%","margin-left":-e>>1}),this._$tooltip.append(t)},r.prototype._showTooltip=function(e,t,i,r){var n=r.canvas.parentNode;if(n){this._$tooltip||this._createTooltipLayout();var o=!1,a=!1;if(this._tooltipShown||(this._$tooltip.appendTo(n),this._tooltipShown=!0,o=!0,a=!0),t===this._tooltipX&&i===this._tooltipY||(o=!0),o){var s=(this._paneWidth,Math.max(Math.min(t-100,this._paneWidth-200),0)),l=Math.max(Math.min(t,this._paneWidth-8),8);this._$tooltip.css({left:Math.round(s),bottom:Math.round(this._paneHeight-i+10)}),this._$tooltipArrow.css("left",l-s)}if(this._tooltipItems||(a=!0),!a)for(var d=e.length;d--;)if(this._tooltipItems[d]!==e[d]){a=!0;break}if(a){var h;if(e.length<=1)h=e;else{for(var p={},d=e.length;d--;){var c=e[d].importance;null==c&&(c=-1),p[c]||(p[c]=[]),p[c].push(e[d])}var u=Object.keys(p).sort(function(e,t){return e-t});if(u.length<=1)h=p[u[0]];else{h=[];for(var d=u.length;d--;)for(var _=p[u[d]],f=_.length;f--;)h.push(_[f])}}this._$tooltipContent.empty();for(var d=h.length;d--;){var g=h[d],v="";0===g.importance?v="--importance-normal":g.importance>0&&(v="--importance-high");var m="tv-chart-events-source__tooltip__item";v&&(m+=" "+m+v);var y=$("<div>").attr("class",m);if($("<h2>").text(g.title).appendTo(y),$("<dl>").addClass("actual").append($("<dt>").text($.t("Actual")+": "),$("<dd>").text(g.actual||"—")).appendTo(y),$("<dl>").append($("<dt>").text($.t("Forecast")+": "),$("<dd>").text(g.forecast||"—")).appendTo(y),$("<dl>").append($("<dt>").text($.t("Previous")+": "),$("<dd>").text(g.previous||"—")).appendTo(y),$("<dl>").append($("<dt>").text($.t("Date")+": "),$("<dd>").text(this._dateStr(g.timestamp)||"—")).appendTo(y),0===d){var w="tv-chart-events-source__tooltip__arrow";v&&(w+=" "+w+v),this._$tooltipArrow.attr("class",w)}y.appendTo(this._$tooltipContent)}this._tooltipItems=e}}},r.prototype._hideTooltip=function(){this._tooltipShown&&(this._$tooltip.detach(),this._tooltipShown=!1)},r.prototype._invalidate=function(){this._series.model().updateSource(this)},r.prototype._dateStr=function(e){var t=new Date(e+this._timeOffset),i=Math.round(Math.abs(this._timeOffset)/6e4),r="UTC";return 0!==i&&(r+=this._timeOffset>0?"+":"-",r+=Math.floor(i/60),i%60&&(r+=":"+i%60)),t.getUTCFullYear()+"-"+("0"+(t.getUTCMonth()+1)).slice(-2)+"-"+("0"+t.getUTCDate()).slice(-2)+" "+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+" ("+r+")"},r.prototype._fallbackImages={"flag-rounded-au":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAtFBMVEUAAABHV6hGV6hIWKdGV6lGV6mjrNVba6/MoLvXrcJdarOGg7man8+dptF4hcDhtsXhtsRndbhHWKn0lJ5SYq74v8X2qbG3vt6Ml8mXoc+AjMT1z9bd4O9pd7nGy+ROX63///9ebbP1pK3vY3HpnKrbt8mutdnc3+/yipXuXm339/vl6PPyprCjrNTfmKv09fqOmcp9icLZscTxdIGvttnglqitia/o6vTl5/Ogk771nKXR1uok/dPkAAAAEnRSTlMAkNAgz4/kQ/D0l1Q146P+/tdT9Ek9AAAAl0lEQVQYGU3ABRLCMAAEwEtS3C9CCxR3d/3/vwhMkcVLJl1dM0gpJLJXq+v0UngbOqtbHTIe9wJ4uenssDydyUbXMA8Umv3BvTm6kYaGjyJKVjtrJx0aemEZFT13C2vrpr2iF0Bvtm7Xcnu2I76A/46GkPwT9iQEGfNHQDG6RPxSgGh0Q34IeDUTMyHxJpgQSCghSSkUvCcoxxGR2DVB1AAAAABJRU5ErkJggg==","flag-rounded-ca":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAWlBMVEUAAADyna7wnqf19/v19/n09/rvipX09vr09/ruXm3udYPte4fue4j09/rvj5nwkJv0+vr39//tVWXtXm307PD04uf02N7uaHf19/rzztTxpq/udIHuX27uc4Cmg02WAAAAEnRSTlMAPFd/gL/A7/D+8OfmwK+tMCDHCHMKAAAAfElEQVR4AWWPRQLEIAwAU6GuBFL//ze3kfU5wcSBmTJXli6bwBhWpRxBaP1q+E7i/i38AJD6T1GnUIgI+x5Y+AIaEdF7EtEAsjgP74+TRa1i8TcXC9SScJslSIk1pW0ja5qijI1RxmLyv9jX6q0dV+m/GsCY8r6q+nzm9wN3vQ/0RJj4yQAAAABJRU5ErkJggg==","flag-rounded-ch":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAxElEQVR4AWNAB+9DUw3ehqTUvwlJ2Q+k34MwlF0PkmPAB4CKCt6Gpv7HhUGGAel8rJqBtmyAKCSM34SmrifKZgKuKYD7GZuCD6VN/6EAxMbqHZBekO0N2Az4WN8N0w9i43JFAwPQPwfQbAZr+DJvOUw/iA0Sw3AJSC8DkPEBWZAAwPAGRQaA9OL2wvwVMD0gNk4vUByIsGj8QGo0gvS8D8hQoCghkZ2UQWrxZaYPeDR/QLcZV3ZugMbOBxAGsUFiYD+jAQBm1lU4Y8LtqgAAAABJRU5ErkJggg==","flag-rounded-cn":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAADvVGTtVGTsVWXtVGTvUGDvUGjtVGTtVWXsU2PtVWXsVGTsVWXtVGTsVGTvWmHuWmLtVWXwhVDtVWXuW2L2u0LylE7yjlHxgVXzmkzvdVn1tUT0p0fvaF7vblvxe1jxiFP1rUb0oUr0m0w7gi5vAAAAE3RSTlMAQIDA7xAg4JBQ8L9gf7CT4N95YlMWdQAAAIZJREFUGBlVwAcSgjAURdGX0LF7A0q37H+PfjOMg0df+WGXprtDrtU+hQlIK0UnIDQzppRx9x7oQ8A4KTs/uwCEcQEuma6NaYF5wjj5sWnemMeM8Upew3DDtAvmqOQWwp2pm4iO8kRtIPKq+OOUFWwUmeTYcDIlP6WifU1UV1rlPqmLxOcyH/tmDpsy+r2pAAAAAElFTkSuQmCC","flag-rounded-eu":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAABIWKdFVapHV6hHV6hGWKlGWKlGV6lHV6hHWKhGWKlGV6lGV6lHWKlSX6JeZpxpbZd1dJCAe4uMgoWXiX+ikHqjkHmvl3LFpGfGpWfcslzds1voulXoulbzwFD/yEoW9yMBAAAADXRSTlMAIDBvcH+Ar7C/wO/wuFJj1gAAAJdJREFUeAE9z4UBxDAIQFHqxk+pe9l/y/N7cSfyEmdV01RZLF8pH00ibyVA1wEU//XhPAeA9Hke+mnEnXHqaWLJYfDTnk4fIJcahm2Ab1OLEgIBILx6jShcBy8cJ6jULH4bgN0+U0sOS9sGCG27QC6xQlj3ed7XABq9AsMuN/PLIP2GvvRm/QLl93PKC5rKV5zXqnUevfoPfJIMWKgHm2UAAAAASUVORK5CYII=","flag-rounded-jp":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAP1BMVEUAAAD39//0+vr2+Pr2+Pr19/v19/n19vn19vn09/r09/r09vr09/rxpa/yw8r19/rxpq/zxMvvh5PtVWXviJT5Un0aAAAADXRSTlMAIDBvcH+Ar7C/wO/wuFJj1gAAAGpJREFUeAFljoMBRDEMQFMrxcf+s16D8ytiAGFDaa0EC4qfQnNi5/kiafyN3/WsjLUOrrIQSZ7X5iYtQqX4xYytVsD9d3F0qvl14H/Ju+kpTS2SHL0Pkmj+FvtePQPjUUz0oNhYEWs0pD8AMW8Lpf/OkoMAAAAASUVORK5CYII=","flag-rounded-nz":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAn1BMVEUAAABGV6lHV6hGWKlGWKlFVaqQgrRGV6lIWKfmmaimqdFHV6hGWKlGV6nTqb/e2ed1gb/TqL50gb/d2OZHWKhRVqRHV6j2qbH+9PX83+Lxf4tHWKn1o6v0maJmV5yFV49RV6TuXWxod7n0mqOMl8lcV6DOVXG5VXn2qrJGWKnuXm2vVn7yiZR6VpOPVouZVoelVoKkqNCDe7KaVobuX26RZHfdAAAAF3RSTlMA8HDAgDBq7yD++29/r/D90/DT/b/wsEIK9MUAAACcSURBVBgZTcAFEsIwAATAixR3S5MrLTXc4f9vI80wDItGazY/9xaDCF9TEztbkO0+gm6SOFsd6A3hjcr3sdzvn2xIoGWSPE+MebLRjjCJ3Xrt4uqQZvQ0xs4aY11c7LYkawVnK2Mq6x7phjxtlxD8c8kEFIPrjYGCZnDfMdCIBBsbelktOoDkzyuV8Fb8kQikYCAkviKthFC6A+8Dc4QUp0+PRNwAAAAASUVORK5CYII=","flag-rounded-gb":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABsElEQVR4AaVTA6+dURA8P6Fx+i/6D2rbttu4tm3HtS6fbdv2u7ated+W15zkaHd2ksVh4Zi3Tjxr6dYfa3M+1uQP33hrokV3srFEWLyZN2fJ1p+dS7f9xFB+E/SbD9P6dScb+YgTPXgbbx+RaEUVCPIRlwWDlzWw9eaTOiQr8OV7J3786NnMCHfu1MweaBm1mbsG0d48iVW7+DEFjp4pgkqih62hHZMTOjsjLNnyc93xc8XQyIywN3bA6/biybvmCAFRVj8sU0qYOwfR3TaNNXsEWLbt+zxWz29oIAItdV0X3F0DcLV2wZFb+k/AlVcKV3MnvP3DkFZ14C+/XtjQwNRn7niJFLE2HYp6D14Um7lAcAq0zM09cLV1w5VT8pfI3Yvh7uyHhksxmEuxjIpIFb7zogGBAGCra4VJY8F0Wds/ATmXt9/v54rcDq3CiJMXSqgrv4tIqCgf0Zu46lqmlRBy1Y7WxmXbf6K1YRzmnhGYxuXg8bqV7C++va7YouT6e+R0YcJBuvqwFh6nB19flW/OfJSjf6YfXbEEyEcclghU2OwPtQWjN9+aaNGdbNG4M6B0Sa2MTP3yAAAAAElFTkSuQmCC","flag-rounded-us":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAn1BMVEUAAAD19/n2+Prte4f09/rvipXuXm3wnqf0+vrvj5nudYOtlb5+jsu81PLwipbwkJvAutjue4judIKSib99i8d5hMPvkJusyu339/+GsOZznNv09vr00dfyna5KidztVWWCrudVkN7tXm319/q70/Jsn+KlxO6wy/Bgl+DS4veOtel3puWZvevvfYrM2/Pzz9XH2vRUhtVyhsfp8fvd6fm1RKu9AAAAHnRSTlMAgHDn8MD+VzCv8Hb7cr6t4ubv3vb45NIgr/PvyzyfYTeeAAAAkElEQVR4XlXLVQ7DMBBF0ReGMvMYwlDu/tfW2I6q9Gh+7pMGymg1ftJyGqA3r8UnJcb8melN3RDPiHUWqg9UkrpEsYFJLd45VYUZTiF2JbUNtZwSzcKRFEF01864cVFx8ciJaT7SjAquXswgsX71rtoWVvLHQugO290D9nCw0XHYjwMtkiZlhF7gxVLG3kXFF0FcGmdRqkNIAAAAAElFTkSuQmCC"},r.prototype.isSavedInChart=function(e){return!!e},r.prototype.state=function(e){var t=300,i=400;if(this._distribution||this._recalcDistribution(),!this._distribution)return null;var r={type:"ChartEventsSource",id:this.id(),state:null,zorder:this.zorder()};if(e){var n={},o=Object.keys(this._distribution).map(Number).filter(isFinite).sort(function(e,t){return t-e}),a=this._series.model().timeScale(),s=1/0,l=a.visibleBars();l&&(s=l.firstBar());for(var d=0,h=0;h<o.length&&!(d>t);h++){var p=o[h];if(s>p)break;n[p]=[];for(var c=this._distribution[p],u=0;u<c.length&&!(d>i);u++){n[p][u]=[];for(var _=this._distribution[p][u],f=0;f<_.length&&!(d>i);f++){var g=_[f],v={timestamp:g.timestamp,currency:g.currency};g.actual&&(v.actual=g.actual),g.forecast&&(v.forecast=g.forecast),g.previous&&(v.previous=g.previous),g.title&&(v.title=g.title),isFinite(g.importance)&&(v.importance=g.importance),n[p][u][f]=v,d++}}}r.state={distribution:n}}return r},r.createFromState=function(e,t,i){if(!t)return null;var n=i.mainSeries();if(!n)return null;var o=e&&e.state&&e.state.distribution;return o?new r(n,{fixedData:o}):null},TradingView.ChartEventsSource=r,e.exports=r},function(e,t){"use strict";function i(e){function t(e){f&&f.reject(),u.length=0,l={},d=-1,h=!1,null!=e&&(_=+e.minImportance,_=null!=_&&isFinite(_)?0|Math.max(-1,Math.min(1,_)):-1)}function r(e){Date.parse?e.timestamp=Date.parse(e.date):e.timestamp=+new Date(e.date)}function n(){var e=d+1;if(f)return f.promise();if(h)return $.Deferred().resolve({added:[],changed:[],finished:!0}).promise();var t=$.Deferred();f=t,t.always(function(){f=null});var i={};-1!==_&&(i.minImportance=_),e>0&&(i.offset=e);var r=$.ajax({method:"GET",url:p,dataType:"json",data:i}).done(function(i){if(i.error)return void t.reject(Error(i.error));if(t===f){d=e,i&&i.length||(h=!0);var r=o(i);t.resolve(r),c.fire(r)}}).fail(function(e){t.reject(e)});return t.fail(function(){r.abort()}),t.promise()}function o(e){for(var t={added:[],changed:[],finished:h},i=0;i<e.length;i++){var n=e[i];if(!(-1!==_&&_>n.importance))if(r(n),l[n.id]){var o=!1,a=l[n.id];for(var s in n)a[s]!=n[s]&&(a[s]=n[s],o=!0);o&&t.changed.push(a)}else l[n.id]=n,u.push(n),t.added.push(n)}return t}function a(e){var t=o(e);(t.changed.length||t.added.length)&&c.fire(t)}function s(){TradingView.pushStreamMultiplexer.off("chartevents",a),u.length=0,t()}if(!(this instanceof i))throw Error("ChartEvents is a constructor");var l,d,h,p="/chartevents/",c=new Delegate,u=[],_=-1;t(e);var f=null;TradingView.pushStreamMultiplexer.on("chartevents",a),this.requestMore=n,this.items=function(){return u},this.changed=c,this.destroy=s,this.reset=t}i.currencies=["EUR","USD","JPY","GBP","CHF","AUD","CAD","NZD","CNY"],i.icons={EUR:"flag-rounded-eu",USD:"flag-rounded-us",JPY:"flag-rounded-jp",GBP:"flag-rounded-gb",CHF:"flag-rounded-ch",AUD:"flag-rounded-au",CAD:"flag-rounded-ca",NZD:"flag-rounded-nz",CNY:"flag-rounded-cn"},e.exports=i},function(e,t,i){"use strict";function r(e,t,r,n,o,a,s,l){var d=i(5).ChartUndoModel,h=new d(e,t,r,n,o,a,s,l);return h.model().Q18(new $21($21.FULL_UPDATE)),h}TradingView.MAMetaInfo=function(){var e={id:"MASimple",inputs:[{id:"length",type:"integer",defval:10},{id:"source",type:"text",defval:"close"}],plots:[{id:"MovAvg",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"true"}],palettes:{}};return new TradingView.StudyMetaInfo(e)},TradingView.VolumeMetaInfo=function(){var e={id:"Volume",inputs:[],plots:[{id:"Volume",type:"histogram"},{id:"Color",type:"colorer",palette:"volumePalette",target:"Volume"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{volumePalette:{colors:{0:{color:"#007F0E",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Up Volume"},1:{color:"#872323",width:1,style:CanvasEx.LINESTYLE_SOLID,name:"Down Volume"}}}}};return new TradingView.StudyMetaInfo(e)},TradingView.DMMetaInfo=function(){var e={id:"DM",inputs:[{id:"ADX smoothing",max:50,min:1,type:"integer",defval:14},{id:"DI Length",max:500,min:1,type:"integer",defval:14}],plots:[{id:"ADX",type:"line"},{id:"DI_P",type:"line"},{id:"DI_N",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}};return new TradingView.StudyMetaInfo(e)},TradingView.RSIMetaInfo=function(){var e={id:"RSI",inputs:[{id:"length",type:"integer",defval:14}],plots:[{id:"RelativeStrengthIndex",type:"line"}],properties:[{id:"is_price_study",type:"bool",value:"false"}],palettes:{}};return new TradingView.StudyMetaInfo(e)},e.exports=r},function(e,t,i){"use strict";function r(e,t){this.chart=e,this.Q0=e.properties().scalesProperties,this.contextMenu=null,this._disableContextMenu=!!t,this.jqRow=$(document.createElement("tr")),this.jqLhsTimeAxisStub=$(document.createElement("td")),this.jqLhsTimeAxisStub.addClass("chart-markup-table"),this.jqLhsTimeAxisStub.appendTo(this.jqRow),this.jqLhsStub=$("<div>"),this.jqLhsStub.css("width","100%"),this.jqLhsStub.css("height","100%"),this.jqLhsStub.css("position","relative"),this.jqLhsStub.css("overflow","hidden"),this.jqLhsStub.appendTo(this.jqLhsTimeAxisStub),this.lhsCanvas=TradingView.addCanvasTo(this.jqLhsStub,new $60(16,16)),$(this.lhsCanvas).css("position","absolute"),$(this.lhsCanvas).css("z-order","2"),$(this.lhsCanvas).css("left",0),$(this.lhsCanvas).css("top",0),this.lhsCtx=this.lhsCanvas.getContext("2d"),this.jqCell=$(document.createElement("td")),this.jqCell.appendTo(this.jqRow),this.jqCell.addClass("chart-markup-table"),this.jqCell.addClass("time-axis"),this.jqCell.height(25),this._dv=$("<div>"),this._dv.css("width","100%"),this._dv.css("height","100%"),this._dv.css("position","relative"),this._dv.css("overflow","hidden"),this._dv.appendTo(this.jqCell),this.canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.canvas).css("position","absolute"),$(this.canvas).css("z-order","2"),$(this.canvas).css("left",0),$(this.canvas).css("top",0),this.ctx=this.canvas.getContext("2d"),this.top_canvas=TradingView.addCanvasTo(this._dv,new $60(16,16)),$(this.top_canvas).css("position","absolute"),$(this.top_canvas).css("z-order","1"),$(this.top_canvas).css("left",0),$(this.top_canvas).css("top",0),this.top_ctx=this.top_canvas.getContext("2d"),this.jqRhsTimeAxisStub=$(document.createElement("td")),this.jqRhsTimeAxisStub.addClass("chart-markup-table"),this.jqRhsTimeAxisStub.appendTo(this.jqRow),this.jqRhsStub=$("<div>"),this.jqRhsStub.css("width","100%"),this.jqRhsStub.css("height","100%"),this.jqRhsStub.css("position","relative"),this.jqRhsStub.css("overflow","hidden"),this.jqRhsStub.appendTo(this.jqRhsTimeAxisStub),this.rhsCanvas=TradingView.addCanvasTo(this.jqRhsStub,new $60(16,16)),$(this.rhsCanvas).css("position","absolute"),$(this.rhsCanvas).css("z-order","2"),$(this.rhsCanvas).css("left",0),$(this.rhsCanvas).css("top",0),this.rhsCtx=this.rhsCanvas.getContext("2d"),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=TradingView.MINUTE_SPAN,TradingView.setMouseEventHandler(this.jqCell,this,!0),this.updatePriceScalesVisibility()}var n=i(359),o=i(13).LineDataSource,a=i(36);r.prototype._BORDER_SIZE=1,r.prototype._OFFSET_SIZE=1,r.prototype._TICK_LENGTH=3,r.prototype.backgroundColor=function(){return this.chart.properties().paneProperties.background.value()},r.prototype.lineColor=function(){return this.Q0.lineColor.value()},r.prototype.textColor=function(){return this.Q0.textColor.value()},r.prototype.fontSize=function(){return this.Q0.fontSize.value()},r.prototype.baseFont=function(){return TradingView.makeFont(this.fontSize(),"Arial","")},r.prototype.baseBoldFont=function(){return TradingView.makeFont(this.fontSize(),"Arial","bold")},r.prototype.rendererOptions=function(){this._rendererOptions||(this._rendererOptions={borderSize:this._BORDER_SIZE,offsetSize:this._OFFSET_SIZE,tickLength:this._TICK_LENGTH,fontSize:NaN,font:"",widthCache:new a});var e=this._rendererOptions;if(e.fontSize!==this.fontSize()){var t=this.fontSize();e.fontSize=t,e.font=this.baseFont(),e.paddingTop=Math.ceil(Math.max(t/4.5-e.tickLength/2,0)),e.paddingBottom=Math.ceil(t/4.5),e.paddingHorizontal=Math.ceil(t/3),e.baselineOffset=Math.round(this.fontSize()/10),e.widthCache.reset()}return this._rendererOptions},r.prototype.updatePriceScalesVisibility=function(){var e=this.chart.properties().scalesProperties;e.showLeftScale.value()?this.jqLhsTimeAxisStub.css("display","table-cell"):this.jqLhsTimeAxisStub.css("display","none"),e.showRightScale.value()?this.jqRhsTimeAxisStub.css("display","table-cell"):this.jqRhsTimeAxisStub.css("display","none")},r.prototype.mouseDownEvent=function(e){if(this._mousedown)return!0;this._mousedown=!0;var t=this.chart.model();t.timeScale().isEmpty()||($(this.jqCell).css("cursor",TradingView.cursorCss("cursor_size_horizontal","15 15")),t.startScaleTime(e.localX))},r.prototype.mouseDownOutsideEvent=function(e){var t=this.chart.model();!t.timeScale().isEmpty()&&this._mousedown&&(this._mousedown=!1,t.endScaleTime(),this.restoreDefaultCursor())},r.prototype.pressedMouseMoveEvent=function(e){var t=this.chart.model();if(!t.timeScale().isEmpty()){var i=!1,r=(new Date).valueOf();if(this._lastScrollScaleTime){var n=r-this._lastScrollScaleTime;100>n&&(i=!0)}i||(t.scaleTimeTo(e.localX),this._lastScrollScaleTime=r)}},r.prototype.mouseUpEvent=function(e){this._mousedown=!1;var t=this.chart.model();t.timeScale().isEmpty()||(t.endScaleTime(),this.restoreDefaultCursor())},r.prototype.contextMenuEvent=function(e,t){!this._disableContextMenu&&Z75.enabled("scales_context_menu")&&this._createContextMenu().show(e)},r.prototype._createContextMenu=function(){return TradingView.ContextMenu.createMenu(this.getContextMenuActions())},r.prototype.getContextMenuActions=function(){var e=this.chart;e.model().mainSeries().createSessStudy(),e.updateActions();var t=e.actions(),i=Z75.enabled("charting_library_base")?[t.timeScaleReset,new TradingView.ActionSeparator,t.applyTimeZone,t.extendedHours]:[t.timeScaleReset,new TradingView.ActionSeparator,t.applyTimeZone,t.sessionBreaks,t.extendedHours];return Z75.enabled("timezone_menu")||i.splice(2,1),Z75.enabled("chart_property_page_timezone_sessions")&&i.push(new TradingView.ActionSeparator,t.tmzProperties),i},r.prototype.mouseClickEvent=function(e){},r.prototype.mouseDoubleClickEvent=function(e){TradingView.trackEvent("GUI","Double click time scale"),this.chart.model().resetTimeScale()},r.prototype.optimalHeight=function(){var e=this.rendererOptions();return Math.ceil(e.offsetSize+e.borderSize+e.tickLength+e.fontSize+e.paddingTop+e.paddingBottom)},r.prototype.setSize=function(e,t,i){this.size&&this.size.equals(e)||(this.lhsStubSize=t,TradingView.setCanvasSize(this.lhsCanvas,t),this.jqLhsTimeAxisStub.width(t.w),this.jqLhsTimeAxisStub.height(t.h),this.rhsStubSize=i,TradingView.setCanvasSize(this.rhsCanvas,i),this.jqRhsTimeAxisStub.width(i.w),this.jqRhsTimeAxisStub.height(i.h),this.size=e,TradingView.setCanvasSize(this.canvas,e),TradingView.setCanvasSize(this.top_canvas,e),this.lhsCanvas.getContext("2d"),this.rhsCanvas.getContext("2d"),this.canvas.getContext("2d"),this.top_canvas.getContext("2d"),this.jqCell.width(e.w),this.jqCell.height(e.h))},r.prototype._spanIndex=function(e){for(var t=[TradingView.MINUTE_SPAN,TradingView.HOUR_SPAN,TradingView.DAY_SPAN,TradingView.MONTH_SPAN,TradingView.YEAR_SPAN],i=t.length-1;i>0;){if(t[i]<=e)return i;i--}return i},r.prototype._spanOffset=function(e,t){if(e>t)throw Error("actual span cuold not be less then base");return this._spanIndex(t)-this._spanIndex(e)},r.prototype.update=function(){if(this.chart.model()){var e=this.chart.model().timeScale().marks();if(e){var t=this;this._minVisibleSpan=TradingView.YEAR_SPAN,$.each(e,function(){t._minVisibleSpan=Math.min(this.span,t._minVisibleSpan)})}}},r.prototype._hightlightBackground=function(e,t){for(var i=this.chart.model(),r=i.timeScale(),n=t[0].index,o=t[0].index,a=1;a<t.length;a++)n=Math.min(n,t[a].index),o=Math.max(o,t[a].index);var s=r.indexToCoordinate(n),l=r.indexToCoordinate(o),d="rgba(109, 158, 235, 0.3)";TradingView.clearRect(e,s,1,l-s,this.size.h-1,d)},r.prototype.drawBackground=function(e){TradingView.clearRect(e,0,0,this.size.w,this.size.h,this.backgroundColor());var t=this.chart.model();if(t){var i=t.timeScale(),r=t.model().selectedSource();if(r&&r instanceof o&&!i.isEmpty()){var n=r.axisPoints();if(0===n.length)return;this._hightlightBackground(e,n)}var a=t.model().crossHairSource();a.startMeasurePoint()&&this._hightlightBackground(e,a.measurePoints())}},r.prototype.drawBorder=function(e){e.save(),e.fillStyle=this.lineColor(),e.fillRect(-.5,.5,this.size.w+.5,this._BORDER_SIZE),e.restore()},r.prototype.drawStubs=function(){var e=this._BORDER_SIZE,t=2*this._BORDER_SIZE,i=this.lhsCtx;TradingView.clearRect(i,0,0,this.lhsStubSize.w,this.lhsStubSize.h,this.backgroundColor()),i.fillStyle=this.lineColor(),i.fillRect(this.lhsStubSize.w-t-.5,.5,t,e),i.fillRect(this.lhsStubSize.w-t-.5,-.5,e,e);var r=this.rhsCtx;TradingView.clearRect(r,0,0,this.rhsStubSize.w,this.rhsStubSize.h,this.backgroundColor()),r.fillStyle=this.lineColor(),r.fillRect(-.5,.5,t,e),r.fillRect(.5,-.5,e,e)},r.prototype.drawTickMarks=function(e){var t=this.chart.model().timeScale().marks();if(t&&0!==t.length){var i=t.reduce(function(e,t){return e.span>t.span?e:t}).span;i>30&&40>i&&(i=30),e.save(),e.strokeStyle=this.lineColor();var r=this.rendererOptions(),n=r.borderSize+r.tickLength+r.paddingTop+r.fontSize-r.baselineOffset;e.textAlign="center",e.translate(.5,.5),e.fillStyle=this.lineColor(),e.beginPath();for(var o=t.length;o--;)e.rect(t[o].coord,r.borderSize,1,r.tickLength);e.fill(),e.fillStyle=this.textColor();for(var a={},s=this.baseFont(),l=this.baseBoldFont(),o=0;o<t.length;o++){var d;d=t[o].span>=i?l:s;var h=a[d]||[];h.push(t[o]),a[d]=h}for(var p in a){e.setFont(p);for(var c=a[p],o=0;o<c.length;o++)e.fillText(c[o].label,c[o].coord,n)}e.restore()}},r.prototype.drawBackLabels=function(e){e.save();for(var t=this.chart.model().Q17(),i=this.chart.model(),r=i.sourceBeingMoved()||i.lineBeingEdited()||i.lineBeingCreated(),n=this.rendererOptions(),o=0;o<t.length;o++){var a=t[o];if(a!==this.chart.model().crossHairSource()&&a!==r&&a.timeAxisViews){var s=a.timeAxisViews();if(s)for(var l=0;l<s.length;l++)s[l].renderer().draw(e,n)}}e.restore()},r.prototype.drawCrossHairLabel=function(e){this.top_ctx.clearRect(-.5,-.5,this.size.w,this.size.h);var t=this.chart.model(),i=t.sourceBeingMoved()||t.lineBeingEdited()||t.lineBeingCreated(),r=this.rendererOptions();if(i){if(e.save(),i.timeAxisViews){var n=i.timeAxisViews();if(n)for(var o=0;o<n.length;o++)n[o].renderer().draw(e,r)}return void e.restore()}e.save();var n=this.chart.model().crossHairSource().timeAxisView();if(n)for(var o=0;o<n.length;o++)n[o].renderer().draw(e,r);e.restore()},r.prototype.paint=function(e){if(0!==e)if(e===$21.UPDATE_CURSOR_ONLY)this.drawCrossHairLabel(this.top_ctx);else{var t=this.ctx;this.drawBackground(t),this.drawBorder(t),this.drawStubs(),this.chart.model()&&(this.drawTickMarks(t),this.drawBackLabels(t),this.drawCrossHairLabel(this.top_ctx))}},r.prototype.setStubVisible=function(e,t){var i=n.isLeft(e)?this.jqLhsTimeAxisStub:this.jqRhsTimeAxisStub;t?i.css("display","table-cell"):i.css("display","none")},r.prototype.restoreDefaultCursor=function(){this.jqCell.css("cursor","default")},r.prototype.image=function(){var e={};return e.content=this.canvas.toDataURL(),e.contentWidth=this.size.w,e.contentHeight=this.size.h,e.lhsStub={},e.lhsStub.content=this.lhsCanvas.toDataURL(),e.lhsStub.contentWidth=this.lhsStubSize.w,e.lhsStub.contentHeight=this.lhsStubSize.h,e.rhsStub={},e.rhsStub.content=this.rhsCanvas.toDataURL(),e.rhsStub.contentWidth=this.rhsStubSize.w,e.rhsStub.contentHeight=this.rhsStubSize.h,e},e.exports=r},function(e,t,i){(function(t){"use strict";function i(e){this._currMetaInfoVersion=e}i.prototype.generateMetaInfo=function(){var e=[];return e=e.concat(this._generateSingleFieldMetaInfo()),e=e.concat(this._generateComplexFormulaMetaInfo())},i.prototype._generateSingleFieldMetaInfo=function(){for(var e=[],r=0;r<i.edgarFundamentalFields.length;++r){var n=i.edgarFundamentalFields[r],o={field:n.field},a=t.render(i.tvilScriptTemplate,o),o={miVers:this._currMetaInfoVersion,tvilScript:a,hash:"EDGR_"+n.field,pkgVers:1,title:n.title,plotTitle:"Plot",isPriceStudy:n.isPriceStudy,precision:n.precision,plotStyle:n.plotStyle,lineStyle:CanvasEx.LINESTYLE_SOLID},s=t.render(i.metaInfoTemplate,o),l=JSON.parse(s);e.push(l)}return e},i.prototype._generateComplexFormulaMetaInfo=function(){for(var e=[],r=0;r<i.edgarValuations.length;++r){var n=i.edgarValuations[r],o={miVers:this._currMetaInfoVersion,tvilScript:n.tvilScript,hash:n.formulaId,pkgVers:1,title:n.title,plotTitle:"Plot",isPriceStudy:n.isPriceStudy,precision:n.precision,plotStyle:n.plotStyle,lineStyle:CanvasEx.LINESTYLE_SOLID},a=t.render(i.metaInfoTemplate,o),s=JSON.parse(a);e.push(s)}return e},i.metaInfoTemplate='{ "_metainfoVersion": {{miVers}}, "defaults": { "inputs": { "text": "{{{tvilScript}}}", "ttm": true }, "precision": "{{precision}}", "styles": { "plot_1": { "color": "#0496ff", "linestyle": {{lineStyle}}, "linewidth": 2, "plottype": {{plotStyle}}, "trackPrice": false, "transparency": 60, "visible": true } } }, "description": "{{{title}}}", "id": "Script${{{hash}}}@tv-scripting-{{pkgVers}}", "classId": "Edgr", "inputs": [{ "defval": "{{tvilScript}}", "id": "text", "name": "TV IL Script", "type": "text", "isHidden": true }, { "defval": true, "id": "ttm", "name": "Trailing Twelve Months", "type": "bool", "isFake": true } ], "is_price_study": {{isPriceStudy}}, "plots": [{ "id": "plot_1", "type": "'+TradingView.StudyConsts.PLOT_TYPE_LINE+'" } ], "shortDescription": "{{{title}}}", "styles": { "plot_1": { "histogramBase": 0.0, "title": "{{plotTitle}}" } }}',i.tvilScriptTemplate="sym('EDGR:'+ticker+'_{{field}}','D',0)|close|$1",i.edgarValuations=[],i.edgarFundamentalFields=[{field:"ACCOUNTING_CHANGE",title:"Accounting Change",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCOUNTS_PAYABLE",title:"Accounts Payable",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCOUNTS_PAYABLE_AND_ACCRUED_EXPENSES",title:"Accounts Payable and Accrued Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCOUNTS_RECEIVABLE_TRADE_NET",title:"Accounts Receivable, Trade, Net",
isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCOUNTS_NOTES_RECEIVABLE_NET",title:"Accounts, Notes Receivable, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCRUED_EXPENSES",title:"Accrued Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCRUED_INTEREST",title:"Accrued Interest",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACCUMULATED_DEPRECIATION",title:"Accumulated Depreciation",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ACQUISITION_SALE_OF_BUSINESS_NET",title:"Acquisition/Sale of Business, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADDITIONAL_PAID_IN_CAPITAL",title:"Additional Paid-in Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADDITIONAL_PAID_IN_CAPITAL_PREFERRED_STOCK",title:"Additional Paid-in Capital - Preferred Stock",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADJUSTED_EBIT",title:"Adjusted EBIT",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADJUSTED_EBITDA",title:"Adjusted EBITDA",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADJUSTED_EPS_BASIC",title:"Adjusted EPS, Basic",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"ADJUSTED_EPS_DILUTED",title:"Adjusted EPS, Diluted",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"ADJUSTED_NET_INCOME",title:"Adjusted Net Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADJUSTMENT_FOR_EQUITY_EARNINGS",title:"Adjustment for Equity Earnings",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADJUSTMENT_FOR_MINORITY_INTEREST",title:"Adjustment for Minority Interest",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ADJUSTMENT_FOR_SPECIAL_CHARGES",title:"Adjustment for Special Charges",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"AFTER_TAX_MARGIN",title:"After-tax Margin",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"AMORTIZATION_EXPENSE",title:"Amortization Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"AMOUNTS_DUE_TO_RELATED_PARTIES_SHORT_TERM",title:"Amounts Due to Related Parties, Short-term",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"BASIC_EPS_NET_INCOME",title:"Basic EPS, Net Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"BASIC_EPS_NET_INCOME_FROM_CONTINUING_OPERATIONS",title:"Basic EPS, Net Income from Continuing, Operations",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"BASIC_WEIGHTED_AVERAGE_SHARES",title:"Basic Weighted Average Shares",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"BOOK_EQUITY",title:"Book Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CF_DEPRECIATION_AND_AMORTIZATION",title:"CF Depreciation & Amortization",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CF_NET_INCOME",title:"CF Net Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CAPITAL_EXPENDITURES",title:"Capital Expenditures",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_PAID_FOR_INCOME_TAXES",title:"Cash Paid for Income Taxes",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_PAID_FOR_INTEREST_EXPENSE",title:"Cash Paid for Interest Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_RATIO",title:"Cash Ratio",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"CASH_AND_CASH_EQUIVALENTS",title:"Cash and Cash Equivalents",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_AND_CASH_EQUIVALENTS_BEGINNING_OF_YEAR",title:"Cash and Cash Equivalents, Beginning of Year",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_AND_CASH_EQUIVALENTS_END_OF_YEAR",title:"Cash and Cash Equivalents, End of Year",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_FROM_DISCONTINUED_OPERATIONS",title:"Cash from Discontinued Operations",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_FROM_FINANCING_ACTIVITIES",title:"Cash from Financing Activities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_FROM_INVESTING_ACTIVITIES",title:"Cash from Investing Activities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_FROM_OPERATING_ACTIVITIES",title:"Cash from Operating Activities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CASH_CASH_EQUIVALENTS_AND_SHORT_TERM_INVESTMENTS",title:"Cash, Cash Equivalents and Short-term ,Investments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_ACCOUNTS_PAYABLE_AND_ACCRUED_EXPENSES",title:"Change in Accounts Payable & Accrued, Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_ACCOUNTS_RECEIVABLE",title:"Change in Accounts Receivable",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_CURRENT_ASSETS",title:"Change in Current Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_CURRENT_LIABILITIES",title:"Change in Current Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_DEBT_NET",title:"Change in Debt, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_DEFERRED_REVENUE",title:"Change in Deferred Revenue",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_EQUITY_NET",title:"Change in Equity, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_INCOME_TAXES_PAYABLE",title:"Change in Income Taxes Payable",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_INVENTORIES",title:"Change in Inventories",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_LONG_TERM_DEBT_NET",title:"Change in Long-term Debt, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_OPERATING_ASSETS_AND_LIABILITIES",title:"Change in Operating Assets & Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_OTHER_ASSETS",title:"Change in Other Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_OTHER_CURRENT_ASSETS",title:"Change in Other Current Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_OTHER_CURRENT_LIABILITIES",title:"Change in Other Current Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_OTHER_LIABILITIES",title:"Change in Other Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_PREPAID_EXPENSES",title:"Change in Prepaid Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CHANGE_IN_SHORT_TERM_BORROWINGS_NET",title:"Change in Short-term Borrowings, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"COMMITMENTS_AND_CONTINGENCIES",title:"Commitments & Contingencies",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"COMMON_STOCK",title:"Common Stock",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"COST_AND_OPERATING_EXPENSES",title:"Cost & Operating Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"COST_OF_REVENUE",title:"Cost of Revenue",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"COVER_SHEET_TSO",title:"Cover Sheet TSO",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CURRENT_PORTION_OF_LONG_TERM_DEBT",title:"Current Portion of Long-term Debt",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"CURRENT_RATIO",title:"Current Ratio",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:2},{field:"DEBT_TO_ASSETS",title:"Debt to Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"DEBT_TO_EQUITY",title:"Debt to Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"DEFERRED_CHARGES",title:"Deferred Charges",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEFERRED_INCOME_TAX_LIABILITIES_SHORT_TERM",title:"Deferred Income Tax Liabilities, Short-term",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEFERRED_INCOME_TAXES",title:"Deferred Income Taxes",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEFERRED_INCOME_TAXES_CURRENT",title:"Deferred Income Taxes, Current",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEFERRED_INCOME_TAXES_LONG_TERM",title:"Deferred Income Taxes, Long-term",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEFERRED_LIABILITY_CHARGES",title:"Deferred Liability Charges",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEGREE_OF_COMBINED_LEVERAGE",title:"Degree of Combined Leverage",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEGREE_OF_FINANCIAL_LEVERAGE",title:"Degree of Financial Leverage",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:2},{field:"DEGREE_OF_OPERATIONAL_LEVERAGE",title:"Degree of Operational Leverage",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:2},{field:"DEPRECIATION_AND_AMORTIZATION_EXPENSE",title:"Depreciation & Amortization Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DEPRECIATION_EXPENSE",title:"Depreciation Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DILUTED_EPS_NET_INCOME",title:"Diluted EPS, Net Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"DILUTED_EPS_NET_INCOME_FROM_CONTINUING_OPERATIONS",title:"Diluted EPS, Net Income from Continuing Operations",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:2},{field:"DILUTED_WEIGHTED_AVERAGE_SHARES",title:"Diluted Weighted Average Shares",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DISCONTINUED_OPERATIONS",title:"Discontinued Operations",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"DIVIDENDS_PAID",title:"Dividends Paid",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"EBIT",title:"EBIT",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"EBITDA",title:"EBITDA",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"EFFECT_OF_EXCHANGE_RATE_ON_CASH",title:"Effect of Exchange Rate on Cash",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"EMPLOYEE_COMPENSATION",title:"Employee Compensation",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"EQUITY_EARNINGS",title:"Equity Earnings",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"EXTRAORDINARY_ITEMS",title:"Extraordinary Items",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"FREE_CASH_FLOW",title:"Free Cash Flow",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"FREE_CASH_FLOW_MARGIN",title:"Free Cash Flow Margin",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"FREE_CASH_FLOW_RETURN_ON_ASSETS",title:"Free Cash Flow Return on Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"GENERAL_AND_ADMINISTRATIVE_EXPENSE",title:"General & Administrative Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"GOODWILL",title:"Goodwill",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"GOODWILL_AND_INTANGIBLE_ASSETS_NET",title:"Goodwill & Intangible Assets, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"GROSS_MARGIN",title:"Gross Margin",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"GROSS_PROFIT",title:"Gross Profit",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INCOME_AFTER_TAXES",title:"Income After Taxes",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INCOME_BEFORE_TAXES",title:"Income Before Taxes",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INCOME_TAXES",title:"Income Taxes",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INCOME_TAXES_PAYABLE",title:"Income Taxes Payable",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INCOME_BEFORE_EXTRAORDINARY_ITEMS",title:"Income before Extraordinary Items",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INTANGIBLE_ASSETS",title:"Intangible Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INTEREST_EXPENSE",title:"Interest Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INTEREST_INCOME",title:"Interest Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INTEREST_INCOME_EXPENSE_NET",title:"Interest Income/Expense, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INVENTORIES_NET",title:"Inventories, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"INVESTMENT_CHANGES_NET",title:"Investment Changes, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"ISSUANCE_OF_EQUITY",title:"Issuance of Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LABOR_EXPENSE",title:"Labor Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LIABILITIES_AND_STOCKHOLDER_S_EQUITY",title:"Liabilities & Stockholder's Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_CAPITAL",title:"Long Term Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_DEBT_TO_LONG_TERM_CAPITAL",title:"Long Term Debt to Long Term Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"LONG_TERM_DEBT_TO_TOTAL_CAPITAL",title:"Long Term Debt to Total Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:2},{field:"LONG_TERM_DEBT",title:"Long-term Debt",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_DEBT_PAYMENTS",title:"Long-term Debt Payments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_DEBT_PROCEEDS",title:"Long-term Debt Proceeds",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_DEFERRED_INCOME_TAX_LIABILITIES",title:"Long-term Deferred Income Tax Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_DEFERRED_LIABILITY_CHARGES",title:"Long-term Deferred Liability Charges",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"LONG_TERM_INVESTMENTS",title:"Long-term Investments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"MINORITY_INTEREST",title:"Minority Interest",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"MINORITY_INTEREST_AND_EQUITY_EARNINGS",title:"Minority Interest & Equity Earnings",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_CHANGE_IN_CASH",title:"Net Change in Cash",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_DEBT",title:"Net Debt",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_INCOME",title:"Net Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_INCOME_APPLICABLE_TO_COMMON",title:"Net Income Applicable to Common",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_INCOME_FROM_CONTINUING_OPERATIONS_APPLICABLE_TO_COMMON",title:"Net Income from Continuing, Operations Applicable to Common",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_INCOME_PER_EMPLOYEE",title:"Net Income per Employee",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_OPERATING_PROFIT_AFTER_TAX",title:"Net Operating Profit after Tax",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NET_WORKING_CAPITAL",title:"Net Working Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NON_OPERATING_GAINS_LOSSES",title:"Non-operating Gains/Losses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NONCONTROLLING_INTEREST",title:"Noncontrolling Interest",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NOTES_PAYABLE",title:"Notes Payable",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NUMBER_OF_EMPLOYEES",title:"Number of Employees",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"NUMBER_OF_SHAREHOLDERS",title:"Number of Shareholders",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OPERATING_EXPENSES",title:"Operating Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OPERATING_LEASES",title:"Operating Leases",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OPERATING_MARGIN",title:"Operating Margin",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"OPERATING_PROFIT",title:"Operating Profit",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OPERATING_REVENUE",title:"Operating Revenue",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_ACCOUNTS_PAYABLE_AND_ACCRUED_EXPENSES",title:"Other Accounts Payable and Accrued Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_ACCOUNTS_NOTES_RECEIVABLE",title:"Other Accounts, Notes Receivable",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_ACCUMULATED_COMPREHENSIVE_INCOME",title:"Other Accumulated Comprehensive Income",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_ADJUSTMENTS",title:"Other Adjustments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_ASSET_LIABILITY_CHANGES_NET",title:"Other Asset/Liability Changes, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_ASSETS",title:"Other Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_BORROWINGS",title:"Other Borrowings",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_CURRENT_ASSETS",title:"Other Current Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_CURRENT_LIABILITIES",title:"Other Current Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_DEBT_NET",title:"Other Debt, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_EQUITY",title:"Other Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_EQUITY_TRANSACTIONS_NET",title:"Other Equity Transactions, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_FINANCING_ACTIVITIES_NET",title:"Other Financing Activities, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_GENERAL_AND_ADMINISTRATIVE_EXPENSE",title:"Other General & Administrative Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_INTEREST_INCOME_EXPENSE_NET",title:"Other Interest Income/Expense, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_INVESTING_ACTIVITIES",title:"Other Investing Activities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_INVESTMENT_CHANGES_NET",title:"Other Investment Changes, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_INVESTMENTS",title:"Other Investments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_LIABILITIES",title:"Other Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_NON_OPERATING_INCOME_EXPENSE",title:"Other Non-operating Income/Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_OPERATING_EXPENSES",title:"Other Operating Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_RECEIVABLES",title:"Other Receivables",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_REVENUE",title:"Other Revenue",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"OTHER_SELLING_GENERAL_AND_ADMINISTRATIVE_EXPENSES",title:"Other Selling, General & Administrative Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PARTNERS_CAPITAL",title:"Partners Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PENSION_POSTRETIREMENT_OBLIGATION",title:"Pension/Postretirement Obligation",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PRE_TAX_MARGIN",title:"Pre-tax Margin",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"PREFERRED_DIVIDENDS",title:"Preferred Dividends",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PREFERRED_STOCK",title:"Preferred Stock",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PREPAID_EXPENSES",title:"Prepaid Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PROPERTY_AND_EQUIPMENT_GROSS",title:"Property and Equipment, Gross",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PROPERTY_PLANT_AND_EQUIPMENT_NET",title:"Property, Plant & Equipment, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"PURCHASE_OF_INVESTMENTS",title:"Purchase of Investments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"QUICK_RATIO",title:"Quick Ratio",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:2},{field:"REALIZED_GAINS_LOSSES",title:"Realized Gains/Losses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"REPURCHASE_OF_EQUITY",title:"Repurchase of Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"RESEARCH_AND_DEVELOPMENT_EXPENSE",title:"Research & Development Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"RESTRICTED_CASH",title:"Restricted Cash",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"RESTRUCTURING_REMEDIATION_AND_IMPAIRMENT_PROVISIONS",title:"Restructuring, Remediation & Impairment Provisions",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"RETAINED_EARNINGS",title:"Retained Earnings",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"RETURN_ON_ASSETS",title:"Return on Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"RETURN_ON_EQUITY",title:"Return on Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"RETURN_ON_INVESTED_CAPITAL",title:"Return on Invested Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:4},{field:"REVENUE_PER_EMPLOYEE",title:"Revenue per Employee",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"SALE_OF_INVESTMENTS",title:"Sale of Investments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"SALE_OF_PROPERTY_PLANT_AND_EQUIPMENT",title:"Sale of Property, Plant & Equipment",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"SALES_AND_MARKETING_EXPENSE",title:"Sales & Marketing Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"SELLING_GENERAL_AND_ADMINISTRATIVE_EXPENSES",title:"Selling, General & Administrative Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"SHORT_TERM_BORROWINGS",title:"Short-term Borrowings",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"SHORT_TERM_INVESTMENTS",title:"Short-term Investments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"STOCK_OPTION_TAX_BENEFITS",title:"Stock Option Tax Benefits",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TAX_RATE",title:"Tax Rate",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3},{field:"TEMPORARY_EQUITY",title:"Temporary Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_ADJUSTMENTS",title:"Total Adjustments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_ASSETS",title:"Total Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_CAPITAL",title:"Total Capital",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_CURRENT_ASSETS",title:"Total Current Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_CURRENT_LIABILITIES",title:"Total Current Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_DEBT",title:"Total Debt",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_LIABILITIES",title:"Total Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_LONG_TERM_ASSETS",title:"Total Long-term Assets",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_LONG_TERM_DEBT",title:"Total Long-term Debt",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_LONG_TERM_LIABILITIES",title:"Total Long-term Liabilities",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_NON_CASH_ADJUSTMENTS",title:"Total Non-cash Adjustments",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_NON_OPERATING_INCOME_EXPENSE",title:"Total Non-operating Income/Expense",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_OPERATING_EXPENSES",title:"Total Operating Expenses",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_RECEIVABLES_NET",title:"Total Receivables, Net",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_REVENUE",title:"Total Revenue",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_SHARES_OUTSTANDING",title:"Total Shares Outstanding",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_SHORT_TERM_DEBT",title:"Total Short-term Debt",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TOTAL_STOCKHOLDER_S_EQUITY",title:"Total Stockholder's Equity",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"TREASURY_STOCK",title:"Treasury Stock",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:0},{field:"USD_CONVERSION_RATE",title:"USD Conversion Rate",isPriceStudy:"false",plotStyle:TradingView.StudyConsts.PLOT_LINE,precision:3}],e.exports=i}).call(t,i(29))},function(e,t,i){(function(t){"use strict";function i(e){this._currMetaInfoVersion=e}i.prototype.generateMetaInfo=function(){var e=[];return e=e.concat(this._generateFieldMetaInfo())},i.prototype._applyDefaults=function(e){if(e.miVers=this._currMetaInfoVersion,e.pkgVers=1,e.show_bands=void 0!==e.bands,e.ticker=e.ticker||"'+ticker+'",e.color=e.color||"#49c54d",e.precision=e.precision||3,e.plottype=e.plottype||TradingView.StudyConsts.PLOT_LINE,e.hash="EOTPRO_"+e.field,void 0!==e.plots)for(var t=0;t<e.plots.length;++t)e.hash+="|"+e.plots[t].fieldIndex,e.plots[t].index=t,e.plots[t].comma=t!=e.plots.length-1?",":null,e.plots[t].bang=t!=e.plots.length-1?"!":null,e.plots[t].title=e.plots[t].title||"Plot";return e},i.prototype._generateFieldMetaInfo=function(){for(var e=[],r=0;r<i.availableFields.length;++r){var n=this._applyDefaults(i.availableFields[r]);n.tvilScript=t.render(i.tvilScriptTemplate,n);var o=t.render(i.metaInfoTemplate,n),a=JSON.parse(o);e.push(a)}return e},i.metaInfoTemplate='{ "_metainfoVersion": {{miVers}}, "defaults": { "inputs": { "text": "{{{tvilScript}}}" }, "precision": "{{precision}}", "styles": { {{#plots}}"plot_{{index}}": { "linestyle": 0, "linewidth": 2, "visible": true, "trackPrice": false, "transparency": 60, "color": "{{color}}", "plottype": {{plottype}} }{{comma}}{{/plots}} }{{#show_bands}}, "bands": [ {{#bands}}{ "linestyle": 2, "linewidth": 1, "visible": true, "value": 0, "color": "#808080" }{{comma}}{{/bands}} ]{{/show_bands}} }, "description": "{{{title}}}", "id": "Script${{{hash}}}@tv-scripting-{{pkgVers}}", "inputs": [{ "defval": "{{{tvilScript}}}", "id": "text", "name": "TV IL Script", "type": "text", "isHidden": true } ], "is_price_study": false, "plots": [ {{#plots}}{ "id": "plot_{{index}}", "type": "'+TradingView.StudyConsts.PLOT_TYPE_LINE+'" }{{comma}}{{/plots}} ], {{#show_bands}}"bands": [ {{#bands}}{ "name": "Zero" }{{comma}}{{/bands}} ],{{/show_bands}} "shortDescription": "{{{title}}}", "styles": { {{#plots}} "plot_{{index}}": { "histogramBase": 0.0, "title": "{{title}}" }{{comma}}{{/plots}} }}',
i.tvilScriptTemplate="{{#plots}}sym('EOTPRO:{{{ticker}}}_{{field}}|{{fieldIndex}}',_,0)|high|{{/plots}}{{#plots}}${{externalIndex}}{{bang}}{{/plots}}",i.availableFields=[{title:"SMA Normalized raw-s",field:"SMA",plots:[{externalIndex:1,fieldIndex:3}],bands:!0},{title:"SMA S, exponentially weighted (in time) sentiment estimate",field:"SMA",plots:[{externalIndex:1,fieldIndex:4}],bands:!0},{title:"SMA S-Score",field:"SMA",plots:[{externalIndex:1,fieldIndex:7}],bands:!0},{title:"SMA S-Volume",field:"SMA",plots:[{plottype:TradingView.StudyConsts.PLOT_HISTOGRAM,color:"#ff0000",externalIndex:1,fieldIndex:8}],bands:!0},{title:"SMA SV-Score",field:"SMA",plots:[{externalIndex:1,fieldIndex:11}],bands:!0},{title:"SMA S-Dispersion",field:"SMA",plots:[{externalIndex:1,fieldIndex:12}]},{title:"SMA S-Buzz",field:"SMA",plots:[{externalIndex:1,fieldIndex:13}]},{title:"SMA S-Delta",field:"SMA",plots:[{externalIndex:1,fieldIndex:14}]},{ticker:"SPY",field:"SMAMB",title:"MicroBias",plots:[{externalIndex:1,fieldIndex:0,title:"MicroBias",color:"#0000ff"},{externalIndex:7,fieldIndex:1,title:"Positive Delta",color:"#49c54d"},{externalIndex:4,fieldIndex:2,title:"Negative Delta",color:"#ff0000"}],bands:!0}],e.exports=i}).call(t,i(29))},function(e,t,i){"use strict";function r(e){this.Q1=e,this.props=this.Q1.model().mainSeries().properties(),this.studies=[],this.Q1.withModel(this,function(){this.init()})}var n=i(61).ESDStudyBase;r.prototype.getStudy=function(e,t){var i,r=this.Q1.model().Q17().some(function(r){if(r instanceof TradingView.Study){var n=r.metaInfo(),o=n.id==e;return o&&t&&(i=r),o}});return t?i:!!r},r.prototype.studIDs={},r.prototype.init=function(){if(!Z75.enabled("widget")){this.studies=this.getStudies();var e={esdShowDividends:"DIVIDENDS",esdShowSplits:"SPLITS",esdShowEarnings:"EARNINGS"},t=this;Object.keys(e).forEach(function(i){var r=e[i];t.props[i].subscribe(t,function(e){var i=t.studIDs[r],n=t.getStudy(i.id,!0);e.value()?i&&!n&&t.Q1.insertStudy(i.id,!1,!0):i&&n&&t.Q1.model().chartModel().removeSource(n)})}),this.studies.map(function(e){t.studIDs[e.field]={id:e.id,study:e};var i=!!n.getSettingsValue(e.field,t.props),r=t.getStudy(e.id,!0);r&&t.Q1.model().chartModel().removeSource(r),i&&t.Q1.insertStudy(e.id,!1,!0)})}},r.prototype.getStudies=function(){var e=this.Q1._studiesMetaData;return $.grep(e,function(e){return/Script\$TV_/.test(e.id)?!0:void 0})},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._defaultOptions={maxHeight:550,padding:20,minHeight:258},this.options=$.extend({},this._defaultOptions,e||{}),this.Z98=t}var n=i(368),o=i(123),a=i(13).LineDataSource;r.prototype.getSourceProperties=function(){for(var e={groups:[],model:this.Z98,drawings:[]},t=0;t<this.Z98.panes().length;t++){for(var i=this.Z98.panes()[t],r=[],n=i.orderedSources(),o=0;o<n.length;o++){var s=n[o];s.showInObjectTree()&&r.push({datasource:s,name:s.title()})}for(var l=i.Q17(),o=0;o<l.length;o++){var s=l[o];s instanceof a&&s.showInObjectTree()&&e.drawings.push({datasource:s,name:s.title(),symbol:$67.shortName(s.symbol()),lastupdate:s.properties().lastUpdateTime.value()})}r.length&&e.groups.push({children:r})}return e},r.prototype.calcHeight=function(e,t){for(var i=0,r=0;r<e.length;r++){if(e[r]>t){i=0===r?e[0]:e[r-1];break}i=e[r]}return i<this.options.minHeight&&(i=this.options.minHeight),i},r.prototype.tabChanged=function(e){0===e?this.objectsTreeTab.tabChanged():this.manageDrawingsTab.tabChanged()},r.prototype.onDestroy=function(){this.objectsTreeTab.unsubscribeListeners(),this.manageDrawingsTab&&this.manageDrawingsTab.unsubscribeListeners()},r.prototype.show=function(e){this.title=$.t("Objects Tree"),TradingView.trackEvent("GUI","Objects Tree");var t,r,o,a={hideTitle:!0,dragHandle:".properties-tabs"},s=$82.createDialog(this.title,a),l=s.find("._tv-dialog-content"),t=$('<div class="properties-tabs"></div>').appendTo(l),r=$('<a href="#" class="properties-tabs-label with-filter"></a>').text($.t("Objects Tree")).appendTo(t),d=$("<div>").appendTo(l);d.addClass("with-drawings");var h=$(window).height(),p=h>this.options.maxHeight?this.options.maxHeight:h;p-=t.height(),p-=this.options.padding;var c=$('<div class="main-tree-page active">').appendTo(d);if(c.addClass("no-top-border"),Z75.enabled("support_manage_drawings")){$('<a href="#" class="properties-tabs-label"></a>').text($.t("Manage Drawings")).appendTo(t);var o=$('<div class="main-tree-page active">').appendTo(d),u=i(369);this.manageDrawingsTab=new u(this,this.options,this.Z98,s),this.manageDrawingsTab.createView(o,p)}this.objectsTreeTab=new n(this,this.options,this.Z98,s),this.objectsTreeTab.createView(c,r,p,e),this.tabs=new $70(t,d,{saveTab:"ObjectsTreeDialog.tab",activeTab:this.options.activeTab}),this.tabs.tabChanged.subscribe(this,this.tabChanged),$82.applyHandlers(s),$82.positionDialog(s);var _=this;s.on("destroy",this.onDestroy.bind(this)),setTimeout(function(){s.unbind("mousedownoutside"),s.on("mousedownoutside",function(e){var t=$(e.target).parents().andSelf();t.is("._tv-dialog, .properties-toolbar, .colorpicker, .charts-popup-list, ._tv-dialog, .tvcolorpicker-popup, .symbol-edit-popup, .context-menu")||($82.destroy(_.title),s.unbind("mousedownoutside"))})})},r._getBackgroundPosition=function(e){return"-"+e[0]+"px -"+e[1]+"px"},r.List=function(e,t,i,r){this.model=e,this.datasources={},this.contentHeights=[],this.content=t,this.dialog=i,this.options=r},r.List.prototype.setDefaultItemClass=function(e){this.defaultItemClass=e},r.List.prototype.setActiveListener=function(e){this.activeListener=e},r.List.prototype.setActive=function(e){this.content.find("._tv-dialog-tree-item").removeClass("active"),e.addClass("active"),this.activeListener&&this.activeListener(e);var t=this.datasources[e.attr("id")];this.model.setSelectedSource(t.datasource),this.model.Q18(new $21($21.LIGHT_UPDATE))},r.List.prototype.createItem=function(e,t,i){var r=this,n=$('<a class="_tv-dialog-tree-item"></a>').appendTo(t),o=$('<span class="tree-icon-container">').appendTo(n);e.skipped&&n.addClass("skipped"),n.attr("id",e.datasource.id()),this.defaultItemClass&&n.addClass(this.defaultItemClass),this.datasources[e.datasource.id()]=e,this.contentHeights.push(this.content.height());var s=$('<div class="name-column"></div>').appendTo(n);if($('<span class="name">'+TradingView.clean($.t(e.name))+"</span>").appendTo(s),this.setIcon(n,e),this.setVisible(n,e),n.mousedown(function(e){r.setActive(n)}),e.datasource.userEditEnabled()){if(TradingView.isInherited(e.datasource.constructor,a)){var l=$('<a class="button icon-lock" title="'+$.t("Lock/Unlock")+'">');l.click(function(t){var i=e.datasource.properties().frozen.value();r.model.setProperty(e.datasource.properties().frozen,!i,"Lock/Unlock "+e.datasource.title())}),l.appendTo(o),$('<span class="icon">').appendTo(l),e.datasource.properties().frozen.value()&&(n.addClass("locked"),l.addClass("active")),e.datasource.properties().frozen.subscribe(this,function(e){var t=e.value();n.toggleClass("locked",t),l.toggleClass("active",t)})}else i&&$('<div class="button hidden">&nbsp;</div>').appendTo(o);var d=$('<a class="button icon-hide" title="'+$.t("Show/Hide")+'">');d.click(function(t){var i=e.datasource.properties().visible.value();n.toggleClass("hidden",i),d.toggleClass("active",i),r.model.setProperty(e.datasource.properties().visible,!i,"Show/Hide "+e.datasource.title())}),d.appendTo(o),$('<span class="icon">').appendTo(d),e.datasource.properties().visible.value()||(n.addClass("hidden"),d.addClass("active")),e.datasource.properties().visible.subscribe(this,function(e){var t=e.value();n.toggleClass("hidden",!t),d.toggleClass("active",!t)}),this.createPropertyIcon(e,o,n)}return n},r.List.prototype.contextMenuEvent=function(e,t){var i=this.options.Q1.paneByState(this.model.paneForSource(t));i.showContextMenuForSource(t,e)},r.List.prototype.createPropertyIcon=function(e,t,r){var n=this;if(e.datasource instanceof a&&!e.datasource.isActualSymbol())return void $('<div class="button hidden">&nbsp;</div>').appendTo(t);if(e.datasource===this.model.mainSeries()&&this.options.Q1&&this.options.Q1.onWidget())return void $('<div class="button hidden">&nbsp;</div>').appendTo(t);var o=i(176),s=i(175);if(o.hasStylesPropertyPage(e.datasource)||o.hasInputsPropertyPage(e.datasource)){var l=$('<a class="button format" title="'+$.t("Format")+'">').click(function(t){new s(e.datasource,n.model).show()}).appendTo(t);$('<span class="icon">').appendTo(l),r.dblclick(function(t){new s(e.datasource,n.model).show()}),r.on("contextmenu",function(t){n.contextMenuEvent(t,e.datasource),t.preventDefault(),t.stopPropagation()})}},r.List.prototype.updateItem=function(e){var t=this.content.find("#"+e.datasource.id());t.find(".name").text(TradingView.clean($.t(e.name))),this.setIcon(t,e),this.setVisible(t,e)},r.List.prototype.findItem=function(e){var t=this.content.find("#"+e.id());return t},r.List.prototype.removeItem=function(e){var t=this.findItem(e);t.remove()},r.List.prototype.setIcon=function(e,t){var r=e.find(".name-column");if(r.find(".instrument").remove(),t.datasource.getType&&!(t.datasource instanceof o)&&!r.find(".svg-icon").length){var n=$('<span class="svg-icon">'),a=$(svgAsset(t.datasource.getType(),"30x30")).appendTo(n);n.appendTo(r)}if(t.datasource instanceof o)var a=t.datasource.properties().icon.value(),s=String.fromCharCode(a),a=$('<span class="instrument lineicon text-as-icon">'+s+"</span>").appendTo(r);if(t.datasource===this.model.mainSeries()){var a=$('<span class="instrument series">').appendTo(r),l=this.model.mainSeries().properties().style.value(),d=i(370),h=d.styleIconPosition(l);a.css("background-position",h)}},r.List.prototype.setVisible=function(e,t){var i=t.datasource.properties().visible.value();i?e.removeClass("hidden"):e.addClass("hidden")},TradingView.ObjectTreeDialog=r,e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){this.dialog=e,this.options=t||{},this.model=i,this.$mainDialog=r}function n(e){this.$container=e,this.$button=$('<div class="button-filter">').click(function(e){this.$button.trigger("button-popup",[this._getActions()]),e.stopPropagation()}.bind(this)).appendTo(e),TradingView.bindPopupMenu(this.$button,null,{event:"button-popup",addClass:"tree-tab-filter"}),this.onChange=new Delegate}var o=i(13).LineDataSource;r.prototype.activeListener=function(e){this.selectedId=e.attr("id")},r.prototype.changeZOrder=function(e){this.model.removeListener("changeZOrder",this.changeZorderListener),e(),this.model.on("changeZOrder",this.changeZorderListener)},r.prototype.addSortable=function(e){var t=0,i=this;e.sortable({scroll:!0,scrollSensitivity:100,scrollSpeed:100,axis:"y",helper:"clone",start:function(e,i){t=i.item.index()},stop:function(e,r){var n=r.item.index();if(t-n!==0){var o=i.list.datasources[r.item.attr("id")],a=t-n>0?1:-1;i.changeZOrder(function(){i.items.model.beginUndoMacro("Change "+o.datasource.title()+" Z order");for(var e=0;e<Math.abs(t-n);e++)i.items.model.changeZOrder(o.datasource,a);i.items.model.endUndoMacro()})}i.setFirstLastItems(r.item.parent())}})},r.prototype.addItemControls=function(e,t,i,r,n){var o=this,a=t.find(".tree-icon-container"),s=$('<div class="button up" title="'+$.t("Move Up")+'">').click(function(i){i.stopPropagation(),i.preventDefault(),o.moveItemUp(t,e.datasource)}).prependTo(a);$('<span class="icon">').appendTo(s);var l=$('<a class="button down" title="'+$.t("Move Down")+'">').click(function(i){i.stopPropagation(),i.preventDefault(),o.moveItemDown(t,e.datasource)}).prependTo(a);if($('<span class="icon">').appendTo(l),e.datasource!==o.items.model.mainSeries()&&e.datasource.isUserDeletable()){var d=$('<a class="button delete" title="'+$.t("Delete")+'">').click(function(t){t.stopPropagation(),o.items.model.removeSource(e.datasource)}).appendTo(a);$('<span class="icon">').appendTo(d)}else $('<div class="button hidden">&nbsp;</div>').appendTo(a)},r.prototype.getNewSelectedIdOnRemoval=function(e){var t=this.content.find("._tv-dialog-tree-item"),i=t.index(e),r=t.length;r>0&&(i!==r-1?this.selectedId=$(t[i+1]).attr("id"):0!==i&&(this.selectedId=$(t[i-1]).attr("id")))},r.prototype.moveItemUp=function(e,t){var i=e.prev(":visible");if(i.length){var r=e.prev(":hidden").length;e.insertBefore(i.last()),t&&this.changeZOrder(function(){for(var e=0;1+r>e;e++)this.items.model.changeZOrder(t,1)}.bind(this)),this.setFirstLastItems(e.parent()),this._scroll.scrollTo(e)}},r.prototype.moveItemDown=function(e,t){var i=e.next(":visible");if(i.length){var r=e.next(":hidden").length;e.insertAfter(i.first()),t&&this.changeZOrder(function(){for(var e=0;1+r>e;e++)this.items.model.changeZOrder(t,-1)}.bind(this)),this.setFirstLastItems(e.parent()),this._scroll.scrollTo(e)}},r.prototype.showSpinner=function(){this.spinner=TradingView.unifiedSpinner().spin(this.page.get(0)),this.contentContainer.css("opacity",0)},r.prototype.hideSpinner=function(){this.spinner&&(this.spinner.stop(),this.contentContainer.css("opacity",1))},r.prototype.createView=function(e,t,r,o){var a=i(367);return this.items=this.dialog.getSourceProperties(),this.maxHeight=r,this.page=e,this.contentContainer=$('<div class="main-tree-container object-tree-container">').appendTo(e),this.contentWrap=$('<div class="main-tree-wrap"></div>').appendTo(this.contentContainer),this.content=$('<div class="main-tree"></div>').appendTo(this.contentWrap),this.list=new a.List(this.items.model,this.content,this.dialog,this.options),this.list.setDefaultItemClass("objects"),this.list.setActiveListener(this.activeListener.bind(this)),this.items.model.selectedSource()&&(this.selectedId=this.items.model.selectedSource().id()),this.updateListListener=this.updateList.bind(this),this.fillListListener=this.fillList.bind(this,o),this.removeSourceListener=function(e){if(e)if(Array.isArray(e))this.fillList(function(){this._scroll.scrollToStart()}.bind(this));else{var t=this.list.findItem(e);this.getNewSelectedIdOnRemoval(t);var i=this.content.find("#"+this.selectedId);this.fillList(function(){this._scroll.scrollToStart(),i.position&&i.position()&&this._scroll.scrollTo(i)}.bind(this),{showDialog:!0})}}.bind(this),this.changeZorderListener=function(e,t){if(e)if(t){var i=this.list.findItem(e);1==t?this.moveItemUp(i):this.moveItemDown(i)}else this.fillList(function(){this._scroll.scrollTo(this.list.findItem(e))}.bind(this),{showDialog:!0})}.bind(this),this.model.on("setProperty",this.updateListListener),this.model.on("removeSource",this.removeSourceListener),this.model.on("cloneLineTool",this.fillListListener),this.model.on("setChartStyleProperty",this.updateListListener),this.model.on("changeZOrder",this.changeZorderListener),this.model.on("moveSource",this.fillListListener),this.filter=new n(t),this.filter.onChange.subscribe(this,this.fillListListener),this.filter.setValue("all"),this.addScroll(),this.contentContainer},r.prototype.unsubscribeListeners=function(){this.model.removeListener("setProperty",this.updateListListener),this.model.removeListener("removeSource",this.removeSourceListener),this.model.removeListener("cloneLineTool",this.fillListListener),this.model.removeListener("setChartStyleProperty",this.updateListListener),this.model.removeListener("changeZOrder",this.changeZorderListener),this.model.removeListener("moveSource",this.fillListListener)},r.prototype.updateList=function(){this.items=this.dialog.getSourceProperties();for(var e=0;e<this.items.groups.length;e++){var t=this.items.groups[e];if(t.children.length)for(var i=t.children.length-1;i>=0;i--){var r=t.children[i];this.list.updateItem(r)}}},r.prototype.setFirstLastItems=function(e,t){var i=t&&t.ignoreItemVisibility,r=i?"._tv-dialog-tree-item":"._tv-dialog-tree-item:visible",n=e.find(r);n.length&&(n.removeClass("first last"),n.first().addClass("first"),n.last().addClass("last"))},r.prototype.setSelectedItemActive=function(e,t){e.datasource.id()===this.selectedId&&this.list.setActive(t)},r.prototype.executeFillListCallback=function(e){isFunction(e)&&(this.$mainDialog.show(),e())},r.prototype.renderGroup=function(e){e=e||{};var t=0,i=e.index,r=setInterval(function(){var r=e.group.children.slice(t,t+50);r.forEach(function(t){var i=this.list.createItem(t,e.subitemList,e.showLocks);this.setSelectedItemActive(t,i),this.addItemControls(t,i,e.$group,e.itemIndex--,e.group)}.bind(this)),t+=50,r.length||(e.$group.append(e.subitemList),this.setFirstLastItems(e.subitemList,{ignoreItemVisibility:!0}),clearInterval(e.intervals[i]),0===--this.fillListGroupsCount&&(this.hideSpinner(),this.executeFillListCallback(e.callback)))}.bind(this),100);e.intervals[i]=r,this.$mainDialog.one("destroy",function(){clearInterval(r)})},r.prototype.fillList=function(e,t){var i=t&&t.showDialog;isFunction(e)&&!i&&this.$mainDialog.hide(),this.content.empty(),this.hideSpinner(),this.showSpinner(),this.items=this.dialog.getSourceProperties();var r="studies"!=this.filter.value()&&this.items.drawings.length,n=[];this.fillListGroupsCount=this.items.groups.length;for(var o=0;o<this.items.groups.length;o++){var a=this.filter.applyToGroup(this.items.groups[o]);if(a.children.length){var s=$('<div class="_tv-dialog-tree-group">').appendTo(this.content);o>0&&s.append('<div class="_tv-dialog-tree-head">');var l=$('<div class="_tv-dialog-tree-item-list">');Modernizr.touch||this.addSortable(l);var d=a.children.length;a.children.reverse(),this.renderGroup({index:o,showLocks:r,intervals:n,callback:e,group:a,itemIndex:d,subitemList:l,$group:s})}}},r.prototype.addScroll=function(){this._scroll=new $58(this.contentContainer,this.contentWrap,{showBottomShadow:!1,scrollMarginTop:0})},r.prototype.tabChanged=function(){},n.prototype._getActions=function(){var e=[{name:"all",title:$.t("Show All")},{name:"drawings",title:$.t("Show Only Drawings")},{name:"studies",title:$.t("Show Only Studies")}].map(function(e){return e.name==this._value?e.active=!0:e.action=this.setValue.bind(this,e.name),e}.bind(this));return e},n.prototype.value=function(){return this._value},n.prototype.setValue=function(e){e!=this._value&&(this._value=e,this.onChange.fire(e))},n.prototype.applyToGroup=function(e){if("all"==this._value)return e;for(var t,i=0;i<e.children.length;i++)t=e.children[i],t.skipped=!TradingView.isInherited(t.datasource.constructor,TradingView.Series)&&!TradingView.isInherited(t.datasource.constructor,"drawings"==this._value?o:TradingView.Study);return e},e.exports=r},function(e,t,i){"use strict";function r(e,t,i,r){this.dialog=e,this.options=t||{},this.model=i,this.$mainDialog=r,this.SETTINGS_STORAGE_NAME="ManageDrawingsTab.sorting"}var n=i(367);r.prototype.unsubscribeListeners=function(){},r.prototype.tabChanged=function(){},r.prototype.getSortSettings=function(){return TVSettings.getJSON(this.SETTINGS_STORAGE_NAME)},r.prototype.saveSortSettings=function(e,t){var i=this.getSortSettings()||{};i.sortField=e,i.sortOrder=t,TVSettings.setJSON(this.SETTINGS_STORAGE_NAME,i)},r.prototype.createView=function(e,t){var r,o=this.dialog.getSourceProperties(),a=$("<div>").addClass("manage-drawings").appendTo(e),s=$("<div>").addClass("wrap").appendTo(a),l={},d=0,h=this;this.items=o.drawings,this.maxHeight=t,this.list=new n.List(o.model,a,this.dialog,this.options),this._scroll=new $58(a,s,{showBottomShadow:!1,scrollMarginTop:0});var p=function(e){var t=e.value();this.toggleClass("hidden",!t)},c=function(e){var t=e.data.row,i=e.data.symbol;if(t.hasClass("expanded")){var r=t.find(".subarea");r.length&&r.hide(),t.removeClass("expanded")}else{t.addClass("expanded");var r=t.find(".subarea");r.length||(r=$("<table cellspacing = 0 cellpading = 0>").addClass("subarea").appendTo(t),h.items.filter(function(e){return e.symbol===i}).forEach(function(e){var t=$("<tr class='drawing-item'>").appendTo(r);t.data("id",e.datasource._id);var n=$('<div class="name-column">'),o=$("<span>").append($.t(e.name)).addClass("name").appendTo(n);p.call(o,e.datasource.properties().visible),e.datasource.properties().visible.subscribe(null,p.bind(o));var a=$("<td class='drawing-property'>").append(n).appendTo(t);h.list.setIcon(a,e);var s=$('<td class="controls-cell drawing-property">').appendTo(t),l=$("<div>").addClass("controls").appendTo(s);$('<a class="button flat format" title="'+$.t("Format")+'"><span class="icon"></span></a>').appendTo(l).click({source:e.datasource},g),$('<a class="button flat delete" title="'+$.t("Delete")+'"><span class="icon"></span></a>').appendTo(l).click({symbol:i,source:e.datasource},function(e){e.preventDefault(),_(e)})})),r.show()}h._scroll.updateScrollBar()},u=function(e){var t=$(e.target).addClass("button-in-process").find(".icon").addClass("icon-delete"),i=e.data.symbol,r=h.items.filter(function(e){return e.symbol===i});TradingView.unifiedSpinner("micro").spin(t.get(0)),o.model.beginUndoMacro($.t("Remove all line tools for ")+i),h.asyncRemoveInterval=setInterval(function(){var t=r.splice(0,200).map(function(e){return e.datasource});return o.model.removeLineTools(t),r.length?void 0:(o.model.emitEvent("removeSource",[t]),o.model.endUndoMacro(),f(e,".row"),P(a),void clearInterval(h.asyncRemoveInterval))},50),h.$mainDialog.one("destroy",function(){clearInterval(h.asyncRemoveInterval)}),delete l[i],S(),e.stopPropagation()},_=function(e){var t=e.data.source,i=e.data.symbol,r=h.items.filter(function(e){return e.symbol===i}).length;return 1===r?void u(e):(o.model.removeSource(t),y(e),f(e,".drawing-item"),v(t._id),void S())},f=function(e,t){var i=$(e.target).closest(t),r=i.parent().children(),n=r.index(i),o=r.length;if(i.remove(),o>0){var a;n!==o-1?a=r[n+1]:0!==n&&(a=r[n-1]),m.call(a),h._scroll.scrollToStart(),h._scroll.scrollTo($(a)),h._scroll.updateScrollBar()}},g=function(e){var t=e.data.source,r=i(175);new r(t,o.model).show()},v=function(e){h.items.forEach(function(t,i,r){e===t.datasource._id&&r.splice(i,1)})},m=function(){s.find(".selected").removeClass("selected"),$(this).addClass("selected");var e=$(this).data("id"),t=h.items.filter(function(t){return t.datasource._id===e})[0];t&&o.model.setSelectedSource(t.datasource)},y=function(e){var t=$(e.target).closest(".expanded").find(".symbol").text();l[t].count-=1,l[t].row.$counter.text(l[t].count)},w=function(e,t,i){var r=[],i=i||"ASC";return $.each(e,function(e,t){r.push({name:e,counter:t.count})}),"ASC"===i?r.sort(function(e,i){return e[t]<i[t]?-1:e[t]>i[t]?1:0}):"DESC"===i&&r.sort(function(e,i){return e[t]>i[t]?-1:e[t]<i[t]?1:0}),r},T=function(){d=0,$.each(l,function(e,t){d+=t.count})},b=function(){r&&r.text($.t("# (Total: {0})").format(d))},S=function(){T(),b()},C=function(e){var t=this.data("order"),i={ASC:"DESC",DESC:"ASC"};L(e,i[t]),h.saveSortSettings(e,i[t])},x=function(e,t){$.each(e,function(e,t){t.removeClass("sorted")}),e[t].addClass("sorted")},P=function(e){var t=e.find(".row");t.find(".symbol-title").length||(t.remove(),$('<div class="empty-drawings-list"></div>').text($.t("No drawings yet")).appendTo(e))},L=function(e,t){var e=e||"name",t=t||"ASC",i=h.dialog.getSourceProperties();if(s.empty(),h.items=i.drawings,!h.items.length)return void P(a);var n=$('<div class="row header"><span class="symbol">'+$.t("Symbol")+'</span><span class="counter">#</span></div>').appendTo(s),o=n.find(".symbol").data("order",t);o.click(C.bind(o,"name")),r=n.find(".counter").data("order",t),r.click(C.bind(r,"counter")),x({name:o,counter:r},e),l={};for(var d=0;d<h.items.length;d++){var p=h.items[d];l[p.symbol]?l[p.symbol].count+=1:l[p.symbol]={count:1}}w(l,e,t).forEach(function(e){var t=$("<div>").addClass("row").appendTo(s),i=$('<div class="symbol-title">').appendTo(t);s.on("click",".symbol-title, .drawing-item",function(){$(this).hasClass("selected")||m.call(this)}),$('<span class="expand"></span>').appendTo(i),i.click({row:t,symbol:e.name},c);var r=$("<span>").append(e.name).addClass("symbol").appendTo(i),n=$("<span>").append(e.counter).addClass("counter").appendTo(i),o=$('<a class="button delete flat delete-symbol">').attr("title",$.t("Delete all drawing for this symbol")).appendTo(i).click({symbol:e.name},u);$('<span class="icon">').appendTo(o),l[e.name].row={$el:t,$symbol:r,$counter:n}}),h._scroll.updateScrollBar(),S()},E=this.getSortSettings()||{};L(E.sortField,E.sortOrder)},e.exports=r},function(e,t){"use strict";function i(){}TradingView.SYMBOL_SEARCH_MAX_LENGTH=100,i.prototype._createBackButton=function(e){var t=e.createGroup().appendTo(e._$left);e._backButton=$('<div class="mobile-back-button"><i></i></div>').click(function(){window.history.length>1&&window.history.back(),window.location.pathname="/"}).appendTo(t)},i.prototype._createBarsGroup=function(e){var t=this.createGroup({single:!0});return e._style_list.element().appendTo(t),t},i.prototype._createPropertiesGroup=function(e,t){var i=this.createGroup({single:!0});if(!this._onWidget||Z75.enabled("header_settings")){var r=$("<span>").addClass("button iconed properties apply-common-tooltip").append(svgAsset("properties","17x17")).appendTo(i);r.on(e,function(e){e.pageX=r.offset().left,e.pageY=r.offset().top+r.height()+15,TVSettings.setValue("properties_dialog.active_tab.chart",$.t("Style"));var i=t.activeChartWidget.value().showChartProperties({_lastEvent:e});r.addClass("active"),i.on("destroy",function(){r.removeClass("active")})}),r.attr("title",$.t("Chart Properties"))}return i},i.prototype._createCompareGroup=function(e,t,i){var r=this.createGroup({single:!0}),n=$('<a class="button toggle-caption compare apply-common-tooltip">').append(svgAsset("compare")).append($('<span class="caption">'+$.t("Compare")+"</span>")).appendTo(r);return this._compareButton=n,this._compareButton.on(i,function(e){e.preventDefault();var i=new TradingView.CompareDialog(t),r=i.show();n.addClass("active"),r.on("destroy",function(){n.removeClass("active")})}),this._compareButton.attr("title",$.t("Compare or Add Symbol")),r},i.prototype._createIndicatorsGroup=function(e,t){var i=this.createGroup({single:!0});return this._indicatorsButton=$('<a class="button toggle-caption indicators'+(this._onWidget?" no-last":"")+' apply-common-tooltip">').append(svgAsset("indicators")).append($('<span class="caption">'+$.t("Indicators")+"</span>")).appendTo(i),Z75.enabled("charting_library_base")?this._indicatorsButton.attr("title",$.t("Indicators")):this._indicatorsButton.attr("title",$.t("Indicators, Fundamentals, Economy and Add-ons")),this._indicatorsButton.on(e,function(e){e.stopPropagation(),e.preventDefault(),window.studyMarket.isVisible()?window.studyMarket.hide():(window.studyMarket.show(),Q15.emit("indicators_dialog"))}),TradingView.keyboardBinder.registerListener("IndicatorsHotkey",function(e){return"47"==e.which&&$(e.target).is("body")&&!window.studyMarket.isVisible()?(window.studyMarket.show(),window.studyMarket.selectSearchPage(),e.preventDefault(),e.stopPropagation(),!0):void 0}),window.studyMarket.visibilityChanged.subscribe(this,function(e){this._indicatorsButton.toggleClass("active",e)}),!TradingView.onWidget()&&Z75.enabled("study_templates")&&studyTemplates.appendMenuButtonTo(i),i},i.prototype.createGroup=function(e){e=e||{};var t=$("<div>").addClass("group");return e.right&&t.addClass("right"),e.single&&t.addClass("space-single"),t},i.prototype.bindToModel=function(){var e=this.Q2.model();e.mainSeries().properties();this.Z98=e},i.prototype.backButton=function(){return this._backButton},i.prototype.saveLoadWidget=function(){return this._saveLoad||TradingView.logWarn("No save-load widget created in footer")},i.prototype.styleIconPosition=function(e){return"-%1px 0".replace("%1",19*~~e)},i.styleIconPosition=i.prototype.styleIconPosition,e.exports=i},function(e,t,i){"use strict";function r(e){function t(){if(!e.favoriteChartTypes)return[];var t={Bars:TradingView.Series.STYLE_BARS,Candles:TradingView.Series.STYLE_CANDLES,Line:TradingView.Series.STYLE_LINE,Area:TradingView.Series.STYLE_AREA,"Heiken Ashi":TradingView.Series.STYLE_HEIKEN_ASHI,"Hollow Candles":TradingView.Series.STYLE_HOLLOW_CANDLES};return e.favoriteChartTypes.map(function(e){return t[e]})}var e=e||{},i=this.Q3=e.Q4,r=this.Q2=i.activeChartWidget.value(),l=this._onWidget=r.onWidget(),h=this,p=Modernizr.touch?"touchstart":"click",c=$(".header-chart-panel").eq(0);if(this._$right=c.find(".right"),this._$left=c.find(".left"),this._itemsVisibility=e.itemsVisibility,TradingView.isMobileView&&!TradingView.winMobileMode&&this._createBackButton(this),!i.readOnly()){if(Z75.enabled("header_symbol_search")){var u=this.createGroup().appendTo(this._$left),_=$('<div class="symbol-edit-widget no-last"></div>').appendTo(u),f=$('<div class="symbol-edit-wrap">').appendTo(_),g=null;if(!Z75.enabled("charting_library_base")&&$68.canShowSpreadActions()){var v=$('<div class="symbol-edit-buttonswrap">').appendTo(f);g=$('<div class="spread-actions">').appendTo(v).on("mousedown",function(e){e.preventDefault()})}var m=$('<div class="symbol-edit-inputspacer">').appendTo(f),y=$('<input type="text" class="symbol-edit" maxlenght="'+TradingView.SYMBOL_SEARCH_MAX_LENGTH+'">').appendTo(m);$68.bindToInput(y,{syncWithChartWidget:!0,spreadActions:g}),function(){var e=!1;y.on("focus",function(){e=!0,f.addClass("expanded")}),y.on("blur",function(){e=!1,setTimeout(function(){e||f.removeClass("expanded")},40)})}()}if(Z75.enabled("header_resolutions")){var u=this.createGroup({single:!0}).appendTo(this._$left),w={onWidget:l,submenuBtnAddClass:"apply-common-tooltip"};e.interval_options&&$.extend(w,e.interval_options),!TradingView.isMobileView&&Z75.enabled("items_favoriting")||$.extend(w,{notShowQuicks:!0,popupSpacing:1}),TradingView.isOnFeaturePage&&$.extend(w,{notShowQuicks:!0}),this._interval=new d(w),Z75.enabled("charting_library_base")&&Q14.on("configuration_received",function(){h._interval.forceUpdate()}),this._interval.element().addClass("no-first").appendTo(u),this._interval.onResize.subscribe(i,i.updateLayout),e.favoriteIntervals&&this._interval.setUpStarredItemsList(e.favoriteIntervals)}if(Z75.enabled("header_chart_type")){var T=Z75.enabled("charting_library_base")?[{id:TradingView.Series.STYLE_BARS,title:$.t("Bars"),icon:"bars"},{id:TradingView.Series.STYLE_CANDLES,title:$.t("Candles"),icon:"candles"},{id:TradingView.Series.STYLE_HOLLOW_CANDLES,title:$.t("Hollow Candles"),icon:"hollowCandles"},{id:TradingView.Series.STYLE_LINE,title:$.t("Line"),icon:"line"},{id:TradingView.Series.STYLE_AREA,title:$.t("Area"),icon:"area"},{id:TradingView.Series.STYLE_HEIKEN_ASHI,title:$.t("Heikin Ashi"),icon:"heikenAshi"}]:[{id:TradingView.Series.STYLE_BARS,title:$.t("Bars"),icon:"bars"},{id:TradingView.Series.STYLE_CANDLES,title:$.t("Candles"),icon:"candles"},{id:TradingView.Series.STYLE_HOLLOW_CANDLES,title:$.t("Hollow Candles"),icon:"hollowCandles"},{id:TradingView.Series.STYLE_HEIKEN_ASHI,title:$.t("Heikin Ashi"),icon:"heikenAshi"},{id:TradingView.Series.STYLE_LINE,title:$.t("Line"),icon:"line"},{id:TradingView.Series.STYLE_AREA,title:$.t("Area"),icon:"area"},{id:TradingView.Series.STYLE_RENKO,title:$.t("Renko"),icon:"renko"},{id:TradingView.Series.STYLE_PB,title:$.t("Line Break"),icon:"lineBreak"},{id:TradingView.Series.STYLE_KAGI,title:$.t("Kagi"),icon:"kagi"},{id:TradingView.Series.STYLE_PNF,title:$.t("Point & Figure"),icon:"pointFigure"}],b=t()||[1,4,5,6];!TradingView.isMobileView&&!TradingView.isOnFeaturePage||Z75.enabled("charting_library_base")||(b=[]),l?b=[1,3]:Z75.enabled("collapsible_header")&&this._createMinimizeButton(e.headerChartPanel),this._style_list=new $13("StyleWidget",$.map(T,function(e){return{id:e.id,title:e.title,svg:$(svgAsset(e.icon,"26x26")),favoriteButton:{title:e.title,addClass:"apply-common-tooltip"}}}),{defaultFavorites:b,
addClass:"chart-style-widget",popupAddClass:"chart-style-popup",notShowQuicks:!!TradingView.isMobileView||!Z75.enabled("items_favoriting"),showJustDefaultQuicks:b&&b.length&&Z75.enabled("predefined_items_only_may_be_starred"),tooltip:$.t("Bar's Style"),addTooltipClass:"apply-common-tooltip"}),i.activeChartStyle.subscribe(function(e){h._style_list.setValue(e)},{callWithLast:!0}),h._style_list.onChange().subscribe(this,function(e){i.activeChartStyle.setValue(e)}),h._style_list.onResize().subscribe(i,i.updateLayout)}window.studyMarket=new $1(i,window.user,{onWidget:l}),this._createLayout(e,h,p)}if(this.Q2.readOnly()||TradingView.isMobileView||!Z75.enabled("header_undo_redo")||(this._undoRedo=new n(this._$left,this.Q2),this._undoRedo.undoElement().addClass("apply-common-tooltip"),this._undoRedo.redoElement().addClass("apply-common-tooltip")),Z75.enabled("header_screenshot")){var S=$('<div class="group space-single"></div>').appendTo(this._$right),C=$('<a class="button getimage"></a>').append(svgAsset("snapshot",{"class":"icon"})).addClass("apply-common-tooltip").attr("title",$.t("Take instant snapshot of your chart. No more Paint or other editors to save screenshots simply click the button and copy the link of the picture.")).appendTo(S);S.click(function(e){if(!Z75.enabled("show_dialog_on_snapshot_ready")){if(C.hasClass("process"))return;C.addClass("process"),i.onScreenshotReady().subscribe(null,function(e){C.removeClass("process")},!0)}r.actions().takeScreenshot.callbacks().fire(),e.preventDefault()})}if(Z75.enabled("header_layouttoggle")&&!TradingView.isMobileView&&!i.readOnly()){var u=Z75.enabled("charting_library_base")?this.createGroup({single:!0}).appendTo(this._$right):this._$right,x=$("<div>").attr("title",$.t("Select Layout")).addClass("layout-toggle-container").addClass("apply-common-tooltip").appendTo(u);this._layoutToggle=new a(x,i)}if(Z75.enabled("header_saveload")){var P=Z75.enabled("header_saveload_to_the_right")?this._$right:this._$left,u=Z75.enabled("charting_library_base")?this.createGroup({single:!0}).appendTo(P):P,L=$("<div>").addClass("save-load-buttons").appendTo(u);this._saveLoad=new s(L,i,{popupDirection:"down",popupReverse:!0}),this._saveLoad.onTitleSizeChanged.subscribe(i,i.updateLayout),TradingView.isOnFeaturePage&&this._saveLoad.hideTitle()}Z75.enabled("header_widget_dom_node")||$(".header-chart-panel").css("display","none"),r.withModel(this,o.prototype.bindToModel)}var n=i(372),o=i(370),a=i(373),s=i(374),l=i(375),d=i(26);inherit(r,o),r.prototype._createUndoRedoGroup=function(){return this._undoRedo=new n(this._$left,this.Q2),this._undoRedo.undoElement().addClass("apply-common-tooltip"),this._undoRedo.redoElement().addClass("apply-common-tooltip"),this.createGroup({single:!0}).append(this._undoRedo.element())},r.prototype._createFullscreenGroup=function(){this._fullscreen=new l;var e=this.createGroup({single:!0});return this._fullscreen.element().addClass("apply-common-tooltip").appendTo(e),e},r.prototype._createLayout=function(e,t,i){var r=[];Z75.enabled("header_chart_type")&&r.push(this._createBarsGroup(t)),Z75.enabled("header_settings")&&r.push(this._createPropertiesGroup(i,e.Q4)),Z75.enabled("header_indicators")&&r.push(this._createIndicatorsGroup(i)),Z75.enabled("header_compare")&&r.push(this._createCompareGroup(t,e.Q4,i)),!Z75.enabled("header_undo_redo")||this.Q2.readOnly()||TradingView.isMobileView||r.push(this._createUndoRedoGroup()),Z75.enabled("header_fullscreen_button")&&!TradingView.isMobileView&&r.push(this._createFullscreenGroup()),r.forEach(function(e){e.appendTo(this._$left)},this),Z75.enabled("caption_buttons_text_if_possible")&&this._setupCaptionButtons()},r.prototype._setupCaptionButtons=function(){var e=this._$left,t=e.children(".group"),i=this.Q3&&this.Q3.updateLayout,r=function(){for(var e,i=0,r=t.toArray();i<t.length;i++)if(void 0!==e){if($(r[i]).offset().top>e+5)return!1}else e=$(r[i]).offset().top;return!0},n=function(){e.addClass("captions"),r()||e.removeClass("captions"),e.find("svg").pixelSnap(),"function"==typeof i&&i()};this._style_list.onResize().subscribe(null,n),this._interval.onResize.subscribe(null,n),window.studyTemplates&&studyTemplates.onFavoriteListResize.subscribe(null,n),$(window).resize(n),n()},r.prototype._createMinimizeButton=function(e){if(e&&e.size()){$(document.createElement("span")).addClass("tv-close-panel top").appendTo(e).on("click",function(t){t.isDefaultPrevented()||(t.preventDefault(),e.toggleClass("hidden"),Q15.emit("toggle_header",!e.hasClass("hidden")),$(window).trigger("resize"))})}},e.exports=r},function(e,t,i){"use strict";function r(){this._$wrap=$(document.createElement("span")),this._undo=$('<span class="button undo disabled"></span>').append(svgAsset("undo")).attr("title","").appendTo(this._$wrap),this._redo=$('<span class="button redo disabled"></span>').append(svgAsset("redo")).attr("title","").appendTo(this._$wrap);var e=this;this._undo.click(function(){e.undo()}),this._redo.click(function(){e.redo()}),n.undoStack().onChange().subscribe(this,this.update),n.redoStack().onChange().subscribe(this,this.update)}var n=i(5).UndoHistory;r.prototype.update=function(){var e=n.undoStack(),t=n.redoStack();e.isEmpty()?(this._undo.addClass("disabled"),this._undo.attr("title",null)):(this._undo.removeClass("disabled"),this._undo.attr("title",$.t("Undo {0}").format(e.head().text()||""))),t.isEmpty()?(this._redo.addClass("disabled"),this._redo.attr("title",null)):(this._redo.removeClass("disabled"),this._redo.attr("title",$.t("Redo {0}").format(t.head().text()||"")))},r.prototype.undo=function(){this._undo.hasClass("disabled")||(TradingView.trackEvent("GUI","Undo"),n.undo())},r.prototype.redo=function(){this._redo.hasClass("disabled")||(TradingView.trackEvent("GUI","Redo"),n.redo())},r.prototype.element=function(){return this._$wrap},r.prototype.undoElement=function(){return this._undo},r.prototype.redoElement=function(){return this._redo},e.exports=r},function(e,t,i){"use strict";function r(e,t){this._layouts=[{id:"s",spriteIconOrder:0,svg:"layout-1"},{id:"2h",spriteIconOrder:1,svg:"layout-2"},{id:"2v",spriteIconOrder:2,svg:"layout-3"},{id:"3v",spriteIconOrder:3,svg:"layout-4"},{id:"3h",spriteIconOrder:4,svg:"layout-5"},{id:"3s",spriteIconOrder:5,svg:"layout-6"},{id:"2-1",spriteIconOrder:9,svg:"layout-10"},{id:"4",spriteIconOrder:6,svg:"layout-7"},{id:"6",spriteIconOrder:7,svg:"layout-8"},{id:"8",spriteIconOrder:8,svg:"layout-9"}],this._ICON_W=31,this._ICON_H=25,this._container=e,this.Q3=t,this.$button=$('<div class="_tv-button"></div>'),this.$button.click(this.toggle.bind(this)),this.Q3.layout.subscribe(this._updateMainButton.bind(this),{callWithLast:!0}),this.$button.appendTo(e)}var n=i(5).UndoHistory;r.prototype.init=function(){function e(e,t,i,r){var n=$('<div class="input-row"><input type="checkbox" id="'+e+'"><label for="'+e+'">'+t+"</label></div>"),o=n.find(":checkbox");return o.change(function(){"function"==typeof i&&i($(this))}),r&&r.subscribe(function(e){o.attr("checked",e)},{callWithLast:!0}),n}if(!this.$widget){var t=this;if(this._container&&this.Q3){this.$widget=$('<div class="layout-widget"></div>').appendTo(document.body),this._boundMouseDownOutside=function(e){if(!t.$widget.hasClass("js-hidden")){var i=$(e.target).parents().andSelf();i.is(t.$button)||t.toggle()}};var i=e("lo-symbol-to-all",$.t("Link symbol to all charts"),function(e){t.Q3.lock.setSymbolLockWithUndo(e.is(":checked"))},this.Q3.lock.symbol),r=e("lo-interval-to-all",$.t("Link interval to all charts"),function(e){t.Q3.lock.setIntervalLockWithUndo(e.is(":checked"))},this.Q3.lock.interval),n=e("lo-crosshair-to-all",$.t("Sync crosshair on all charts"),function(e){t.Q3.lock.crosshair.setValue(e.is(":checked"))},this.Q3.lock.crosshair);this.$widget.append(this._createLayoutBtns(),i,r,n)}}},r.prototype._createLayoutBtns=function(){var e=this,t=$('<div class="layout-buttons"></div>');return this._layouts.forEach(function(i){var r=svgAsset(i.svg,"29x23");$('<div class="layout-button"></div>').append(r).appendTo(t).data("layout",i).click(function(t){$(t);e.Q3.layout.value()===i.id?e.Q3.maximizeCurrentChart.setValue(!1):(n.setChartLayout(e.Q3,i.id),$(".layout-button").removeClass("active"),$(this).addClass("active")),e.toggle()})}),this.$layoutButtons=t.children(),t},r.prototype._updateLayoutBtns=function(e){var e=e||this.Q3.layout.value();this.$layoutButtons.each(function(t,i){var r=$(i);r.toggleClass("active",e===r.data("layout").id)})},r.prototype._updateMainButton=function(e){var t=this,i=this.$button,e=e||this.Q3.layout.value(),r=function(){for(var i=0;i<t._layouts.length;i++)if(t._layouts[i].id===e)return t._layouts[i].svg}()||"layout-1";i.empty().append(svgAsset(r,"29x23"))},r.prototype.toggle=function(){var e=this;if(this.$widget&&!this.$widget.hasClass("js-hidden"))this.$widget.addClass("js-hidden"),this.$widget.off("mousedownoutside"),this.$button.removeClass("active");else{var t=e.$button.offset();this.init(),this.$widget.on("mousedownoutside",this._boundMouseDownOutside),this.$widget.css("top",t.top+e.$button.height()+4),t.left+350>$(document).width()?this.$widget.css("left",$(document).width()-350):this.$widget.css("left",t.left),this.$button.addClass("active"),this.$widget.removeClass("js-hidden"),this._updateLayoutBtns()}},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){function o(){t.metaInfo.name.value()||s._readOnly?s.setTitle(t.metaInfo.name.value()):s.hideTitle()}var i=$.extend({popupDirection:"up",popupReverse:!1},i||{});if(this._options=i,this.onTitleSizeChanged=new Delegate,this._container=e=$(e),this.Q3=t,this._readOnly=t.readOnly(),this._savedCharts=[],this._editEnabled=!0,this.loadChartDialog=new TradingView.LoadChartDialog,this.renameChartDialog=new TradingView.RenameChartDialog,this._load=$('<span class="load button first apply-common-tooltip"></span>').append(svgAsset("download")).attr("title",$.t("Load Chart Layout")).click(this.signInOrLoadChart.bind(this)).appendTo(e),this._title=$('<span class="title apply-common-tooltip"></span>'),i.hideChartTitle&&this._title.hide(),this._sep=$("<span>").addClass("separator"),this._optionsMenu=$('<span class="button with-arrow options last">').append($("<span>").addClass("arrow-icon")),TradingView.bindPopupMenu(this._optionsMenu,this._getSavedCharts.bind(this),{direction:i.popupDirection,reverse:i.popupReverse,notCloseOnButtons:!0,popupSpacing:i.popupSpacing}),this._readOnly)this._save=$(),this._copy=$('<span class="copy">'+$.t("Copy")+"</span>").appendTo(e).click($.proxy(this,"cloneChart")),this._title.addClass("read-only"),this._titleReadOnly=$("<span>").addClass("read-only").appendTo(this._title),this._sep.appendTo(this._copy),this._optionsMenu.hide();else{var a=$.t("Save Chart Layout saves not just some particular chart, it saves all charts for all symbols and intervals which you are modifying while working with this Layout");this._save=$('<span class="save button apply-common-tooltip"></span>').attr("title",a).append(svgAsset("upload")).appendTo(e).click($.proxy(this,"signInOrSaveChart")),this._copy=$(),this._titleInput=$('<span type="text" maxlength="80">').appendTo(this._title),this._title.bind("click",$.proxy(this,"_renameChart")),this._title.attr("title",$.t("Rename Chart Layout")),this._titleSize=$('<span class="sizer">').appendTo(this._title),this._sep.appendTo(this._save)}this._title.appendTo(e),this._optionsMenu.appendTo(e),this._savecopy=$().add(this._save).add(this._copy).mousedown(function(e){return e.button?!1:void this._save.addClass("active")}.bind(this)).mouseup(function(){this._save.removeClass("active")}.bind(this));var s=this;t.metaInfo.name.subscribe(function(){o()}),o(),loginStateChange.subscribe(this,this._refreshSavedChartsList),TVXWindowEvents.on("saved-charts-change",$.proxy(this._otherTabUpdated,this)),TVXWindowEvents.on("saved-charts-change-favorites",$.proxy(this._favoritesUpdated,this)),n.undoStack().onChange().subscribe(this,function(){if(!n.undoStack().isEmpty()){var e=n.undoStack().head().text();if("scroll"==e||"scale time"==e)return}this._setChanges(!0),this.autosave()}),TradingView.keyboardBinder.registerListener("LoadChartDialogHotkey",function(e){return e.ctrlKey?!1:"46"==e.which&&$(e.target).is("body")?(this.loadMenu(),e.preventDefault(),e.stopPropagation(),!0):!1}.bind(this)),this.favorites=TVSettings.getJSON(r.FAVORITES_KEY,{})}var n=i(5).UndoHistory;r.FAVORITES_KEY="loadChartDialog.favorites",r.prototype._favoritesUpdated=function(e){this.favorites=JSON.parse(e),this.loadChartDialog.updateFavoritesData(this.favorites)},r.prototype._otherTabUpdated=function(e){this._savedCharts=JSON.parse(e),this.loadChartDialog.updateChartsData(this._getLoadMenuCharts())},r.prototype._renameChart=function(){var e=this;e._editEnabled&&this.renameChartDialog.show(this.getTitle()).then(function(t){e.setTitle(t),e.saveChart()})},r.prototype._setTitle=function(e){this._titleInput.text(e),this._titleValue=e,this._savecopy.removeClass("last").addClass("titled"),e?this._options.hideChartTitle||(this._optionsMenu.show(),this._title.show()):(this._optionsMenu.hide(),this._title.hide(),this._savecopy.addClass("last").removeClass("titled")),this._setInputSuze(),this._setChanges(!0)},r.prototype._setReadOnlyTitle=function(e){this._titleReadOnly.html(e).attr("title",e.replace(/<[^>]+>/g,"")),this._savecopy.removeClass("last").addClass("titled"),this._title.addClass("last"),this._options.hideChartTitle||this._title.show()},r.prototype.setTitle=function(e){if(this._readOnly){var t=TradingView.clean(this.Q3.metaInfo.username.value());e=(e?e+": ":"")+"view-only chart by "+'<a href="/u/%1">%1</a>'.replace(/%1/g,t),this._setReadOnlyTitle(e)}else this._setTitle(e)},r.prototype.hideTitle=function(){this._title.hide(),this._optionsMenu.hide(),this._titleInput.text(""),this._savecopy.removeClass("titled").addClass("last")},r.prototype.getTitle=function(){return this._titleValue},r.prototype._setInputSuze=function(){this._titleSize.text(this._titleInput.text()),this._titleInput.width(this._titleSize.width()),this.onTitleSizeChanged.fire()},r.prototype.cloneChart=function(){var e=this;Z75.enabled("save_old_chart_before_save_as")&&this.Q3.metaInfo.id.value()&&this._saveChart();var t=new TradingView.RenameChartDialog($.t("Copy Chart Layout"));t.show($.t("{0} copy").format(e.Q3.metaInfo.name.value())).then(function(t){Z75.enabled("saved_charts_count_restriction")&&!user.is_pro&&e._savedCharts.length>=5?$82.showGoProDialog({feature:"savedChartsLimit"}):Z75.enabled("saveload_storage_customization")?(e.Q3.metaInfo.uid.setValue(void 0),e.Q3.metaInfo.id.setValue(void 0),e.setTitle(t),e.saveChart()):window.open("/chart/?clone="+e.Q3.metaInfo.uid.value()+"&name="+encodeURIComponent(t),"_blank")}.bind(this))},r.prototype._setChanges=function(e){e=!!e,this._haveChanges=e,!e&&this.getTitle()?this._save.addClass("no-change"):this._save.removeClass("no-change")},r.prototype._process=function(e){e=!!e,e?this._save.addClass("process"):this._save.removeClass("process")},r.prototype._saveChart=function(e,t){if(!this._readOnly&&!this._saving&&this._haveChanges){var i=function(){this._saving=!1,this._process(!1),this._editEnabled=!0,clearTimeout(this._saveTimeout)}.bind(this);this._saving=!0,this._process(!0),this._editEnabled=!1,this._saveTimeout=setTimeout(i,7e3);try{window.saver.saveChartSilently(function(){i(),this._setChanges(!1),"function"==typeof e&&e.call(this)}.bind(this),null,function(){i(),"function"==typeof t&&t.call(this)})}catch(r){i(),TradingView.logError("Error while saving",r)}}},r.prototype._autosaveInterval=6e4,r.prototype.autosave=function(){Z75.enabled("charts_auto_save")&&(this.Q3.onfeatures||(this._autosaveTimer&&(clearTimeout(this._autosaveTimer),this._autosaveTimer=0),this._autosaveTimer=setTimeout(function(){this.Q3.metaInfo.id.value()&&this._saveChart()}.bind(this),this._autosaveInterval)))},r.prototype._goChartPage=function(e){"/chart/"==location.pathname&&(location.href="/chart/"+e+(TradingView.isMobileView?"?mobile=1":""))},r.prototype.saveChart=function(){if(!this.Q3.onfeatures){var e=this.getTitle();e?(this.Q3.metaInfo.name.setValue(e),this._saveChart(function(){TradingView.trackEvent("GUI","Save Chart Layout"),this._goChartPage(this.Q3.metaInfo.uid.value()),void 0!==TradingView.UaTitleManager&&TradingView.UaTitleManager.instance&&TradingView.UaTitleManager.instance.updateView(),this._refreshSavedChartsList()}.bind(this),function(){this.Q3.metaInfo.name.setValue(""),this.setTitle("")}.bind(this))):TradingView.showChartNameDialog(function(e){this.setTitle(e),this.saveChart()}.bind(this),{label:$.t("Chart layout name")},64)}},r.prototype.signInOrSaveChart=function(){Z75.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"saveChart"),{source:"Save chart",sourceMeta:"Chart"}):this.saveChart()},r.prototype.signInOrLoadChart=function(){Z75.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"loadMenu"),{source:"Load chart",sourceMeta:"Chart"}):this.loadMenu()},r.prototype.signInOrRenameChart=function(){Z75.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"_renameChart"),{source:"Rename chart"}):this._renameChart()},r.prototype.signInOrSaveAs=function(){Z75.enabled("saveload_requires_authentication")?runOrSignIn($.proxy(this,"cloneChart"),{source:"Clone chart"}):this.cloneChart()},r.prototype.saveChartByEnter=function(e){"13"==e.keyCode&&(this._titleInput.blur(),this.signInOrSaveChart())},r.prototype._refreshSavedChartsList=function(e){Z75.enabled("saveload_requires_authentication")&&!is_authenticated?this._savedCharts=[]:TradingView.getSavedChartsList(function(e){this._savedCharts=e,TVXWindowEvents.emit("saved-charts-change",JSON.stringify(e))}.bind(this)).then(function(){TVSettings.getJSON(this._FAV_KEY,[]);e&&e()})},r.prototype._getSavedChartsList=function(){return this._savedCharts},r.prototype._fastDelete=function(e,t){this._savedCharts.splice(t,1),e==this.Q3.metaInfo.id.value()&&(Z75.enabled("saveload_storage_customization")?(this.Q3.clearChartMetaInfo(),this.setTitle(void 0)):location.href="/chart/")},r.prototype._getSavedCharts=function(){var e=[];if(this.isSaved()&&e.push({title:this.getTitle(),disabled:!0,addClass:"save-load-chart-title"}),!this._readOnly&&(e.push({title:$.t("Save Chart Layout"),action:this.signInOrSaveChart.bind(this)}),this.isSaved()&&(e.push({title:$.t("Save As..."),action:this.signInOrSaveAs.bind(this)}),e.push({title:$.t("Rename..."),action:this.signInOrRenameChart.bind(this)})),!Z75.enabled("charting_library_base"))){var t=new TradingView.bindPopupMenu.Group;t.push({addClass:"button-load",title:$.t("Load"),action:this.signInOrLoadChart.bind(this)}),t.push({addClass:"button-new",title:$.t("New"),action:this.loadChartDialog.openNewChart.bind(this.loadChartDialog)}),e.push(t)}return e},r.prototype.isSaved=function(){return!!this.getTitle()},r.prototype._getLoadMenuCharts=function(){var e=[],t=this,i=this._getSavedChartsList();return i.length&&$.each(i,function(i,n){e.push({id:n.id,title:n.name,symbol:n.short_symbol,interval:n.interval,toolsCount:0,modified:n.modified_iso,active:function(){return n.id==t.Q3.metaInfo.id.value()},openAction:function(){TradingView.openSavedChart(n)},deleteAction:function(e){TradingView.deleteChart(n.image_url,function(){t._fastDelete(n.id,i),TVXWindowEvents.emit("saved-charts-change",JSON.stringify(t._savedCharts)),e.resolve()})},favoriteAction:function(e){t.favorites=e,TVSettings.setJSON(r.FAVORITES_KEY,e),TVXWindowEvents.emit("saved-charts-change-favorites",JSON.stringify(e))}})}),e},r.prototype.loadMenu=function(){var e=this;this._load.addClass("process"),this._refreshSavedChartsList(function(){e._load.removeClass("process"),e.loadChartDialog.show(e._getLoadMenuCharts(),e.favorites)})},e.exports=r},function(e,t){"use strict";function i(){var e=this;this.isFullscreen=!1,this._e=$("<span>").addClass("button fullscreen iconed apply-common-tooltip").attr("title",$.t("Fullscreen mode")).append(svgAsset("fullscreen","18x18")),this._e.click(function(){e.startFullscreen()}),$(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",function(){var t;["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"].some(function(e){return e in document?void(t=!!document[e]):!1}),null!=t&&(t?e._onStartFullscreen():e._onExitFullscreen())})}i.prototype.element=function(){return this._e},i.prototype.startFullscreen=function(){["requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen"].some(function(e){return"function"==typeof document.documentElement[e]?(document.documentElement[e](),!0):void 0}),this._onStartFullscreen()},i.prototype._onStartFullscreen=function(){var e=this;if(Z75.enabled("side_toolbar_in_fullscreen_mode")){var t=$(".header-chart-panel");t.hide()}else{var i=$("#chart-area");i.addClass("fullscreen")}this._$exitButton||(this._$exitButton=$('<div class="exit-fullscreen">'+$.t("Exit Full Screen (ESC)")+"</div>").on("click",this.exitFullscreen.bind(this)).appendTo(document.body)),$(window).resize(),$(document).off("keyup.toggleFullscreen").on("keyup.toggleFullscreen",function(t){27==t.keyCode&&e.exitFullscreen()})},i.prototype.exitFullscreen=function(){["exitFullscreen","mozCancelFullScreen","mozExitFullscreen","webkitExitFullscreen","msExitFullscreen"].some(function(e){return"function"==typeof document[e]?(document[e](),!0):void 0}),this._onExitFullscreen()},i.prototype._onExitFullscreen=function(){if(this._$exitButton&&($(".exit-fullscreen").remove(),delete this._$exitButton),Z75.enabled("side_toolbar_in_fullscreen_mode")){var e=$(".header-chart-panel");e.show()}else{var t=$("#chart-area");t.removeClass("fullscreen")}$(window).resize(),$(document).off("keyup.toggleFullscreen")},e.exports=i},function(e,t,i){"use strict";function r(e,t,i,r,n){function o(e,i,r,n){var a=i.split("."),s=a[0];if(t&&t[s]&&(s=t[s]),!e.hasOwnProperty(s)&&n&&n===s){var l=a.splice(1).join(".");return void o(e,l,r)}if(!e.hasOwnProperty(s))throw"illegal path";if(a.length>1){var l=a.splice(1).join(".");o(e[s],l,r)}else e[s]&&e[s].setValue?e[s].setValue(r):e[s]=r}if(void 0!==r&&r)for(var a in r)try{o(e,a,r[a],n)}catch(s){void 0!==i&&i||TradingView.logWarn("Path `"+a+"` does not exist.")}}function n(e,t,i,n){"undefined"!=typeof __defaultsOverrides&&__defaultsOverrides&&r(e,t,i,__defaultsOverrides,n)}function o(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach(function(t){e.test(t)&&n(TradingView.defaultProperties[t],null,!1,t)})}function a(e,t){return t?l(e,t):s(e)}function s(e){var t=_(e);if(!window._UNIT_TESTS){var i=TradingView.clone(TVSettings.getJSON(e,null));i&&TradingView.merge(t,i)}return t}function l(e,t){var i=_(e);if(!window._UNIT_TESTS){var r=TradingView.clone(TVSettings.getJSON(e,null));if(e.startsWith("study_")&&r&&u.isVersionHead(r.version)){var n=t.updateStudyState(r,r);r=n}TradingView.merge(i,r)}return i}var d=i(13).LineDataSource,h=i(31),p=i(92),c=i(116).LineToolPitchfork,u=i(80),_=function(e){var t={a:function(e,t){return{color:e,visible:t}},b:function(e,t,i){return{coeff:e,color:t,visible:i}},c:function(e,t,i,r,n){return{coeff:e,color:t,visible:i,linestyle:void 0===r?CanvasEx.LINESTYLE_SOLID:r,linewidth:void 0===n?1:n}},d:function(e,t,i){return{color:e,width:i,visible:t}},e:function(e,t,i,r,n){return{color:e,visible:t,width:i,x:r,y:n}},f:function(e,t,i,r,n,o){return{coeff1:e,coeff2:t,color:i,visible:r,linestyle:void 0===n?CanvasEx.LINESTYLE_SOLID:n,linewidth:void 0===o?1:o}}};if(void 0===TradingView.defaultProperties){var i;switch(window.language){case"ru":i="Europe/Moscow";break;case"ja":i="Asia/Tokyo";break;default:i="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:i,timeScale:{barSpacing:TradingView.DEFAULT_BAR_SPACING,rightOffset:TradingView.DEFAULT_RIGHT_OFFSET},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:{background:"rgba( 255, 255, 255, 1)",gridProperties:{color:"#E6E6E6",style:CanvasEx.LINESTYLE_SOLID},vertGridProperties:{color:"rgba( 230, 230, 230, 1)",style:CanvasEx.LINESTYLE_SOLID},horzGridProperties:{color:"rgba( 230, 230, 230, 1)",style:CanvasEx.LINESTYLE_SOLID},crossHairProperties:{color:"rgba( 183, 183, 183, 1)",style:CanvasEx.LINESTYLE_DASHED,transparency:0,width:1},topMargin:5,bottomMargin:5,leftAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},rightAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},overlayPropreties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0}},scalesProperties:{showLeftScale:!1,showRightScale:!0,backgroundColor:"rgba( 255, 255, 255, 1)",lineColor:"rgba( 85, 85, 85, 1)",textColor:"rgba( 85, 85, 85, 1)",fontSize:11,scaleSeriesOnly:!1,showSeriesLastValue:!0,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1},mainSeriesProperties:{style:h.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdBreaksStyle:{color:"rgba( 226, 116, 91, 1)",style:CanvasEx.LINESTYLE_DASHED,width:1},esdFlagSize:2,showCountdown:!0,showInDataWindow:!0,visible:!0,silentIntervalChange:!1,showPriceLine:!0,priceLineWidth:1,lockScale:!1,minTick:"default",extendedHours:!1,sessVis:!1,candleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!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,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)"},haStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!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)",showRealLastPrice:!1,barColorsOnPrevClose:!1},barStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",barColorsOnPrevClose:!1,dontDrawOpen:!1},lineStyle:{color:"rgba( 60, 120, 216, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:h.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"rgba( 96, 96, 144, 0.5)",color2:"rgba( 1, 246, 245, 0.5)",linecolor:"rgba( 0, 148, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1},renkoStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",borderUpColorProjection:"rgba( 34, 84, 55, 1)",borderDownColorProjection:"rgba( 91, 26, 19, 1)",inputs:{source:"close",boxSize:3,style:"ATR",atrLength:14},inputInfo:{source:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR Length"}}},pbStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",borderUpColor:"rgba( 34, 84, 55, 1)",borderDownColor:"rgba( 91, 26, 19, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",borderUpColorProjection:"rgba( 34, 84, 55, 1)",borderDownColorProjection:"rgba( 91, 26, 19, 1)",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",inputs:{source:"close",reversalAmount:1},inputInfo:{source:{name:"Source"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",upColorProjection:"rgba( 74, 214, 190, 1)",downColorProjection:"rgba( 214, 73, 207, 1)",inputs:{sources:"HL",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR Length"}}}},symbolWatermarkProperties:{color:"rgba( 85, 85, 85, 0.15)",transparency:85},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"rgba(85, 85, 85, 1)",visible:!1,style:CanvasEx.LINESTYLE_DASHED,width:1}},tradingProperties:{showPositions:!0,showOrders:!0,showExecutions:!0,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:CanvasEx.LINESTYLE_DASHED},alertsProperties:{labels:{visible:!0,color:"rgba( 215, 84, 66, 1)",highlightColor:"rgba( 255, 255, 51, 1)",hoverColor:"rgba( 245, 227, 135, 1)",line:{visible:!0,style:CanvasEx.LINESTYLE_DASHED,width:1}},fakeLabels:{visible:!0,color:"rgba( 119, 119, 119, 1)",line:{visible:!0,style:CanvasEx.LINESTYLE_DASHED,width:1}},drawingIcon:{color:"rgba( 170, 170, 170, 1)"}},editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},drawings:{magnet:!1,stayInDrawingMode:!1,drawOnAllCharts:!0,crossHairColor:"rgba( 183, 183, 183, 1)",crossHairStyle:CanvasEx.LINESTYLE_DASHED,crossHairWidth:1},linetoolorder:{singleChartOnly:!0,extendLeft:"inherit",lineLength:"inherit",lineColor:"rgba( 255, 0, 0, 1)",lineTransparency:0,lineStyle:"inherit",lineWidth:"inherit",bodyBorderColor:"rgba( 255, 0, 0, 0)",bodyBorderTransparency:0,bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextColor:"rgba( 255, 0, 0, 0)",bodyTextTransparency:0,bodyFontFamily:"Verdana",bodyFontSize:7,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderColor:"rgba( 255, 0, 0, 0)",quantityBorderTransparency:0,quantityBackgroundColor:"rgba( 255, 0, 0, 0.75)",quantityBackgroundTransparency:25,quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:7,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderColor:"rgba( 255, 0, 0, 1)",cancelButtonBorderTransparency:0,cancelButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",cancelButtonBackgroundTransparency:25,cancelButtonIconColor:"rgba( 255, 0, 0, 1)",cancelButtonIconTransparency:0,tooltip:""},linetoolposition:{singleChartOnly:!0,extendLeft:"inherit",lineLength:"inherit",lineColor:"rgba( 0, 113, 224, 1)",lineTransparency:0,
lineStyle:"inherit",lineWidth:"inherit",bodyBorderColor:"rgba( 0, 113, 224, 1)",bodyBorderTransparency:0,bodyBackgroundColor:"rgba( 255, 255, 255, 0.75)",bodyBackgroundTransparency:25,bodyTextColor:"rgba( 0, 113, 224, 1)",bodyTextTransparency:0,bodyFontFamily:"Verdana",bodyFontSize:7,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderColor:"rgba( 0, 113, 224, 1)",quantityBorderTransparency:0,quantityBackgroundColor:"rgba( 0, 113, 224, 0.75)",quantityBackgroundTransparency:25,quantityTextColor:"rgba( 255, 255, 255, 1)",quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:7,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderColor:"rgba( 0, 113, 224, 1)",reverseButtonBorderTransparency:0,reverseButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",reverseButtonBackgroundTransparency:25,reverseButtonIconColor:"rgba( 0, 113, 224, 1)",reverseButtonIconTransparency:0,closeButtonBorderColor:"rgba( 0, 113, 224, 1)",closeButtonBorderTransparency:0,closeButtonBackgroundColor:"rgba( 255, 255, 255, 0.75)",closeButtonBackgroundTransparency:25,closeButtonIconColor:"rgba( 0, 113, 224, 1)",closeButtonIconTransparency:0,tooltip:""},linetoolexecution:{singleChartOnly:!0,direction:"buy",arrowHeight:8,arrowSpacing:1,arrowColor:"rgba( 0, 0, 255, 1)",arrowTransparency:0,text:"",textColor:"rgba( 0, 0, 0, 1)",textTransparency:0,fontFamily:"Verdana",fontSize:8,fontBold:!1,fontItalic:!1,tooltip:""},linetoolicon:{singleChartOnly:!0,clonable:!0,color:"rgba( 61, 133, 198, 1)",snapTo45Degrees:!0,size:40,icon:9786,angle:.5*Math.PI,scale:1},linetoolbezierquadro:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,fillBackground:!1,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL},linetoolbeziercubic:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,fillBackground:!1,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL},linetooltrendline:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,snapTo45Degrees:!0,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetooltimecycles:{clonable:!0,linecolor:"rgba(21, 153, 128, 1)",linewidth:1,fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:CanvasEx.LINESTYLE_SOLID},linetoolsineline:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetooltrendangle:{singleChartOnly:!0,clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,snapTo45Degrees:!0,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!0,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1},linetooldisjointangle:{clonable:!0,linecolor:"rgba( 18, 159, 92, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba( 106, 168, 79, 0.5)",transparency:50,extendLeft:!1,extendRight:!1,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 18, 159, 92, 1)",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolflatbottom:{clonable:!0,linecolor:"rgba( 73, 133, 231, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,extendLeft:!1,extendRight:!1,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 73, 133, 231, 1)",fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1},linetoolfibspiral:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},linetooldaterange:{clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 91, 133, 191, 0.9)",labelBackgroundTransparency:30,fillBackground:!0,backgroundColor:"rgba( 186, 218, 255, 0.4)",backgroundTransparency:60,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolpricerange:{clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 91, 133, 191, 0.9)",labelBackgroundTransparency:30,fillBackground:!0,backgroundColor:"rgba( 186, 218, 255, 0.4)",backgroundTransparency:60,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetooldateandpricerange:{clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba( 255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 91, 133, 191, 0.9)",labelBackgroundTransparency:30,fillBackground:!0,backgroundColor:"rgba( 186, 218, 255, 0.4)",backgroundTransparency:60,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolriskrewardshort:{isShort:!0,clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba(255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 88, 88, 88, 1)",labelBackgroundTransparency:0,fillBackground:!0,stopBackground:"rgba( 255, 0, 0, 0.2)",profitBackground:"rgba( 0, 160, 0, 0.2)",stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolriskrewardlong:{isShort:!1,clonable:!0,linecolor:"rgba( 88, 88, 88, 1)",linewidth:1,font:"Verdana",textcolor:"rgba(255, 255, 255, 1)",fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"rgba( 88, 88, 88, 1)",labelBackgroundTransparency:0,fillBackground:!0,stopBackground:"rgba( 255, 0, 0, 0.2)",profitBackground:"rgba( 0, 160, 0, 0.2)",stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)"},linetoolarrow:{clonable:!0,linecolor:"rgba( 111, 136, 198, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_ARROW,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetoolray:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!0,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetoolextended:{clonable:!0,linecolor:"rgba( 21, 153, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!0,extendRight:!0,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL,font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1},linetoolhorzline:{clonable:!0,linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,text:"",font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolhorzray:{clonable:!0,linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showPrice:!0,showLabel:!1,text:"",font:"Verdana",textcolor:"rgba( 21, 119, 96, 1)",fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{clonable:!0,linecolor:"rgba( 128, 204, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showTime:!0},linetoolcirclelines:{clonable:!0,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",clonable:!0,baselinecolor:"rgba( 128, 128, 128, 1)",linecolor:"rgba( 0, 85, 219, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,showLabels:!0,font:"Verdana",fillBackground:!1,transparency:80,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:t.c(0,"rgba( 128, 128, 128, 1)",!0),level2:t.c(1,"rgba( 0, 85, 219, 1)",!0),level3:t.c(2,"rgba( 0, 85, 219, 1)",!0),level4:t.c(3,"rgba( 0, 85, 219, 1)",!0),level5:t.c(5,"rgba( 0, 85, 219, 1)",!0),level6:t.c(8,"rgba( 0, 85, 219, 1)",!0),level7:t.c(13,"rgba( 0, 85, 219, 1)",!0),level8:t.c(21,"rgba( 0, 85, 219, 1)",!0),level9:t.c(34,"rgba( 0, 85, 219, 1)",!0),level10:t.c(55,"rgba( 0, 85, 219, 1)",!0),level11:t.c(89,"rgba( 0, 85, 219, 1)",!0)},linetooltext:{clonable:!0,color:"rgba( 102, 123, 139, 1)",text:$.t("Text"),font:"Verdana",fontsize:20,fillBackground:!1,backgroundColor:"rgba( 91, 133, 191, 0.9)",backgroundTransparency:70,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",bold:!1,italic:!1,locked:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:400},linetooltextabsolute:{singleChartOnly:!0,clonable:!0,color:"rgba( 102, 123, 139, 1)",text:$.t("Text"),font:"Verdana",fontsize:20,fillBackground:!1,backgroundColor:"rgba( 155, 190, 213, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"rgba( 102, 123, 139, 1)",bold:!1,italic:!1,locked:!0,wordWrap:!1,wordWrapWidth:400},linetoolballoon:{clonable:!0,color:"rgba( 102, 123, 139, 1)",backgroundColor:"rgba( 255, 254, 206, 0.7)",borderColor:"rgba( 140, 140, 140, 1)",fontWeight:"bold",fontsize:12,font:"Arial",transparency:30,text:$.t("Comment")},linetoolbrush:{clonable:!0,linecolor:"rgba( 53, 53, 53, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,smooth:5,fillBackground:!1,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,leftEnd:d.LINEEND_NORMAL,rightEnd:d.LINEEND_NORMAL},linetoolpolyline:{clonable:!0,linecolor:"rgba( 53, 53, 53, 1)",linewidth:2,linestyle:CanvasEx.LINESTYLE_SOLID,fillBackground:!0,backgroundColor:"rgba( 21, 56, 153, 0.5)",transparency:50,filled:!1},linetoolarrowmark:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkleft:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkup:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkright:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolarrowmarkdown:{clonable:!0,color:"rgba( 120, 120, 120, 1)",text:"",fontsize:20,font:"Verdana"},linetoolflagmark:{clonable:!0,color:"rgba( 255, 0, 0, 1)"},linetoolnote:{clonable:!0,markerColor:"rgba( 46, 102, 255, 1)",textColor:"rgba( 0, 0, 0, 1)",backgroundColor:"rgba( 255, 255, 255, 1)",backgroundTransparency:0,text:$.t("Text"),font:"Arial",fontSize:12,bold:!1,italic:!1,locked:!1,fixedSize:!0},linetoolnoteabsolute:{singleChartOnly:!0,clonable:!0,markerColor:"rgba( 46, 102, 255, 1)",textColor:"rgba( 0, 0, 0, 1)",backgroundColor:"rgba( 255, 255, 255, 1)",backgroundTransparency:0,text:$.t("Text"),font:"Arial",fontSize:12,bold:!1,italic:!1,locked:!0,fixedSize:!0},linetoolthumbup:{clonable:!0,color:"rgba( 0, 128, 0, 1)"},linetoolthumbdown:{clonable:!0,color:"rgba( 255, 0, 0, 1)"},linetoolpricelabel:{clonable:!0,color:"rgba( 102, 123, 139, 1)",backgroundColor:"rgba( 255, 255, 255, 0.7)",borderColor:"rgba( 140, 140, 140, 1)",fontWeight:"bold",fontsize:11,font:"Arial",transparency:30},linetoolrectangle:{clonable:!0,color:"rgba( 21, 56, 153, 1)",fillBackground:!0,backgroundColor:"rgba( 21, 56, 153, 0.5)",linewidth:1,snapTo45Degrees:!0,transparency:50},linetoolrotatedrectangle:{clonable:!0,color:"rgba( 152, 0, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 142, 124, 195, 0.5)",transparency:50,linewidth:1,snapTo45Degrees:!0},linetoolellipse:{clonable:!0,color:"rgba( 153, 153, 21, 1)",fillBackground:!0,backgroundColor:"rgba( 153, 153, 21, 0.5)",transparency:50,linewidth:1},linetoolarc:{clonable:!0,color:"rgba( 153, 153, 21, 1)",fillBackground:!0,backgroundColor:"rgba( 153, 153, 21, 0.5)",transparency:50,linewidth:1},linetoolprediction:{singleChartOnly:!0,linecolor:"rgba( 28, 115, 219, 1)",linewidth:2,sourceBackColor:"rgba( 241, 241, 241, 1)",sourceTextColor:"rgba( 110, 110, 110, 1)",sourceStrokeColor:"rgba( 110, 110, 110, 1)",targetStrokeColor:"rgba( 47, 168, 255, 1)",targetBackColor:"rgba( 11, 111, 222, 1)",targetTextColor:"rgba( 255, 255, 255, 1)",successBackground:"rgba( 54, 160, 42, 0.9)",successTextColor:"rgba( 255, 255, 255, 1)",failureBackground:"rgba( 231, 69, 69, 0.5)",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:{clonable:!0,color:"rgba( 153, 21, 21, 1)",fillBackground:!0,backgroundColor:"rgba( 153, 21, 21, 0.5)",transparency:50,linewidth:1},linetoolcallout:{clonable:!0,color:"rgba( 255, 255, 255, 1)",backgroundColor:"rgba( 153, 21, 21, 0.5)",transparency:50,linewidth:2,fontsize:12,font:"Verdana",text:$.t("Text"),bordercolor:"rgba( 153, 21, 21, 1)",bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:400},linetoolparallelchannel:{clonable:!0,linecolor:"rgba( 119, 52, 153, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:"rgba( 180, 167, 214, 0.5)",transparency:50,showMidline:!1,midlinecolor:"rgba( 119, 52, 153, 1)",midlinewidth:1,midlinestyle:CanvasEx.LINESTYLE_DASHED},linetoolelliottimpulse:{degree:7,clonable:!0,showWave:!0,color:"rgba( 61, 133, 198, 1)",linewidth:1},linetoolelliotttriangle:{degree:7,clonable:!0,showWave:!0,color:"rgba( 255, 152, 0, 1)",linewidth:1},linetoolelliotttriplecombo:{degree:7,clonable:!0,showWave:!0,color:"rgba( 106, 168, 79, 1)",linewidth:1},linetoolelliottcorrection:{degree:7,clonable:!0,showWave:!0,color:"rgba( 61, 133, 198, 1)",linewidth:1},linetoolelliottdoublecombo:{degree:7,clonable:!0,showWave:!0,color:"rgba( 106, 168, 79, 1)",linewidth:1},linetoolbarspattern:{singleChartOnly:!0,color:"rgba( 80, 145, 204, 1)",clonable:!0,mode:p.BARS_MODE,mirrored:!1,flipped:!1},linetoolghostfeed:{singleChartOnly:!0,clonable:!0,averageHL:20,variance:50,candleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375"},transparency:50},study:{inputs:{},styles:{},palettes:{},bands:{},area:{},graphics:{},showInDataWindow:!0,visible:!0,showStudyArguments:!0,precision:"default"},linetoolpitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:c.STYLE_ORIGINAL,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:t.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:t.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:t.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:t.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:t.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:t.c(1,"rgba( 0, 0, 153, 1)",!0),level6:t.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:t.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:t.c(2,"rgba( 165, 0, 0, 1)",!1)},linetoolpitchfan:{clonable:!0,fillBackground:!0,transparency:80,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:t.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:t.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:t.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:t.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:t.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:t.c(1,"rgba( 0, 0, 153, 1)",!0),level6:t.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:t.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:t.c(2,"rgba( 165, 0, 0, 1)",!1)},linetoolgannfan:{clonable:!0,showLabels:!0,font:"Verdana",fillBackground:!0,transparency:80,level1:t.f(1,8,"rgba( 160, 107, 0, 1)",!0),level2:t.f(1,4,"rgba( 105, 158, 0, 1)",!0),level3:t.f(1,3,"rgba( 0, 155, 0, 1)",!0),level4:t.f(1,2,"rgba( 0, 153, 101, 1)",!0),level5:t.f(1,1,"rgba( 128, 128, 128, 1)",!0),level6:t.f(2,1,"rgba( 0, 101, 153, 1)",!0),level7:t.f(3,1,"rgba( 0, 0, 153, 1)",!0),level8:t.f(4,1,"rgba( 102, 0, 153, 1)",!0),level9:t.f(8,1,"rgba( 165, 0, 0, 1)",!0)},linetoolganncomplex:{clonable:!0,fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},levels:[t.d("rgba( 128, 128, 128, 1)",!0,1),t.d("rgba( 160, 107, 0, 1)",!0,1),t.d("rgba( 105, 158, 0, 1)",!0,1),t.d("rgba( 0, 155, 0, 1)",!0,1),t.d("rgba( 0, 153, 101, 1)",!0,1),t.d("rgba( 128, 128, 128, 1)",!0,1)],fanlines:[t.e("rgba( 165, 0, 255, 1)",!1,1,8,1),t.e("rgba( 165, 0, 0, 1)",!1,1,5,1),t.e("rgba( 128, 128, 128, 1)",!1,1,4,1),t.e("rgba( 160, 107, 0, 1)",!1,1,3,1),t.e("rgba( 105, 158, 0, 1)",!0,1,2,1),t.e("rgba( 0, 155, 0, 1)",!0,1,1,1),t.e("rgba( 0, 153, 101, 1)",!0,1,1,2),t.e("rgba( 0, 153, 101, 1)",!1,1,1,3),t.e("rgba( 0, 0, 153, 1)",!1,1,1,4),t.e("rgba( 102, 0, 153, 1)",!1,1,1,5),t.e("rgba( 165, 0, 255, 1)",!1,1,1,8)],arcs:[t.e("rgba( 160, 107, 0, 1)",!0,1,1,0),t.e("rgba( 160, 107, 0, 1)",!0,1,1,1),t.e("rgba( 160, 107, 0, 1)",!0,1,1.5,0),t.e("rgba( 105, 158, 0, 1)",!0,1,2,0),t.e("rgba( 105, 158, 0, 1)",!0,1,2,1),t.e("rgba( 0, 155, 0, 1)",!0,1,3,0),t.e("rgba( 0, 155, 0, 1)",!0,1,3,1),t.e("rgba( 0, 153, 101, 1)",!0,1,4,0),t.e("rgba( 0, 153, 101, 1)",!0,1,4,1),t.e("rgba( 0, 0, 153, 1)",!0,1,5,0),t.e("rgba( 0, 0, 153, 1)",!0,1,5,1)]},linetoolgannsquare:{clonable:!0,color:"rgba( 21, 56, 153, 0.8)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,font:"Verdana",showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,hlevel1:t.b(0,"rgba( 128, 128, 128, 1)",!0),hlevel2:t.b(.25,"rgba( 160, 107, 0, 1)",!0),hlevel3:t.b(.382,"rgba( 105, 158, 0, 1)",!0),hlevel4:t.b(.5,"rgba( 0, 155, 0, 1)",!0),hlevel5:t.b(.618,"rgba( 0, 153, 101, 1)",!0),hlevel6:t.b(.75,"rgba( 0, 101, 153, 1)",!0),hlevel7:t.b(1,"rgba( 128, 128, 128, 1)",!0),vlevel1:t.b(0,"rgba( 128, 128, 128, 1)",!0),vlevel2:t.b(.25,"rgba( 160, 107, 0, 1)",!0),vlevel3:t.b(.382,"rgba( 105, 158, 0, 1)",!0),vlevel4:t.b(.5,"rgba( 0, 155, 0, 1)",!0),vlevel5:t.b(.618,"rgba( 0, 153, 101, 1)",!0),vlevel6:t.b(.75,"rgba( 0, 101, 153, 1)",!0),vlevel7:t.b(1,"rgba( 128, 128, 128, 1)",!0)},linetoolfibspeedresistancefan:{clonable:!0,fillBackground:!0,transparency:80,grid:{color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,visible:!0},linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,font:"Verdana",showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,snapTo45Degrees:!0,hlevel1:t.b(0,"rgba( 128, 128, 128, 1)",!0),hlevel2:t.b(.25,"rgba( 160, 107, 0, 1)",!0),hlevel3:t.b(.382,"rgba( 105, 158, 0, 1)",!0),hlevel4:t.b(.5,"rgba( 0, 155, 0, 1)",!0),hlevel5:t.b(.618,"rgba( 0, 153, 101, 1)",!0),hlevel6:t.b(.75,"rgba( 0, 101, 153, 1)",!0),hlevel7:t.b(1,"rgba( 128, 128, 128, 1)",!0),vlevel1:t.b(0,"rgba( 128, 128, 128, 1)",!0),vlevel2:t.b(.25,"rgba( 160, 107, 0, 1)",!0),vlevel3:t.b(.382,"rgba( 105, 158, 0, 1)",!0),vlevel4:t.b(.5,"rgba( 0, 155, 0, 1)",!0),vlevel5:t.b(.618,"rgba( 0, 153, 101, 1)",!0),vlevel6:t.b(.75,"rgba( 0, 101, 153, 1)",!0),vlevel7:t.b(1,"rgba( 128, 128, 128, 1)",!0)},linetoolfibretracement:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLines:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:t.b(0,"rgba( 128, 128, 128, 1)",!0),level2:t.b(.236,"rgba( 204, 40, 40, 1)",!0),level3:t.b(.382,"rgba( 149, 204, 40, 1)",!0),level4:t.b(.5,"rgba( 40, 204, 40, 1)",!0),level5:t.b(.618,"rgba( 40, 204, 149, 1)",!0),level6:t.b(.764,"rgba( 40, 149, 204, 1)",!0),level7:t.b(1,"rgba( 128, 128, 128, 1)",!0),level8:t.b(1.618,"rgba( 40, 40, 204, 1)",!0),level9:t.b(2.618,"rgba( 204, 40, 40, 1)",!0),level10:t.b(3.618,"rgba( 149, 40, 204, 1)",!0),level11:t.b(4.236,"rgba( 204, 40, 149, 1)",!0),level12:t.b(1.272,"rgba( 149, 204, 40, 1)",!1),level13:t.b(1.414,"rgba( 204, 40, 40, 1)",!1),level16:t.b(2,"rgba( 40, 204, 149, 1)",!1),level14:t.b(2.272,"rgba( 149, 204, 40, 1)",!1),level15:t.b(2.414,"rgba( 40, 204, 40, 1)",!1),level17:t.b(3,"rgba( 40, 149, 204, 1)",!1),level18:t.b(3.272,"rgba( 128, 128, 128, 1)",!1),level19:t.b(3.414,"rgba( 40, 40, 204, 1)",!1),level20:t.b(4,"rgba( 204, 40, 40, 1)",!1),level21:t.b(4.272,"rgba( 149, 40, 204, 1)",!1),level22:t.b(4.414,"rgba( 204, 40, 149, 1)",!1),level23:t.b(4.618,"rgba( 149, 204, 40, 1)",!1),level24:t.b(4.764,"rgba( 40, 204, 149, 1)",!1)},linetoolfibchannel:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:t.b(0,"rgba( 128, 128, 128, 1)",!0),level2:t.b(.236,"rgba( 204, 40, 40, 1)",!0),level3:t.b(.382,"rgba( 149, 204, 40, 1)",!0),level4:t.b(.5,"rgba( 40, 204, 40, 1)",!0),level5:t.b(.618,"rgba( 40, 204, 149, 1)",!0),level6:t.b(.764,"rgba( 40, 149, 204, 1)",!0),level7:t.b(1,"rgba( 128, 128, 128, 1)",!0),level8:t.b(1.618,"rgba( 40, 40, 204, 1)",!0),level9:t.b(2.618,"rgba( 204, 40, 40, 1)",!0),level10:t.b(3.618,"rgba( 149, 40, 204, 1)",!0),level11:t.b(4.236,"rgba( 204, 40, 149, 1)",!0),level12:t.b(1.272,"rgba( 149, 204, 40, 1)",!1),level13:t.b(1.414,"rgba( 204, 40, 40, 1)",!1),level16:t.b(2,"rgba( 40, 204, 149, 1)",!1),level14:t.b(2.272,"rgba( 149, 204, 40, 1)",!1),level15:t.b(2.414,"rgba( 40, 204, 40, 1)",!1),level17:t.b(3,"rgba( 40, 149, 204, 1)",!1),level18:t.b(3.272,"rgba( 128, 128, 128, 1)",!1),level19:t.b(3.414,"rgba( 40, 40, 204, 1)",!1),level20:t.b(4,"rgba( 204, 40, 40, 1)",!1),level21:t.b(4.272,"rgba( 149, 40, 204, 1)",!1),level22:t.b(4.414,"rgba( 204, 40, 149, 1)",!1),level23:t.b(4.618,"rgba( 149, 204, 40, 1)",!1),level24:t.b(4.764,"rgba( 40, 204, 149, 1)",!1)},linetoolprojection:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,color1:"rgba( 0, 128, 0, 0.2)",color2:"rgba( 255, 0, 0, 0.2)",linewidth:1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linestyle:CanvasEx.LINESTYLE_SOLID},level1:t.c(1,"rgba( 128, 128, 128, 1)",!0)},linetool5pointspattern:{clonable:!0,color:"rgba( 204, 40, 149, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 204, 40, 149, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetoolcypherpattern:{clonable:!0,color:"#CC2895",textcolor:"#FFFFFF",fillBackground:!0,backgroundColor:"#CC2895",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetooltrianglepattern:{clonable:!0,color:"rgba( 149, 40, 255, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 149, 40, 204, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:1},linetoolabcd:{clonable:!0,color:"rgba( 0, 155, 0, 1)",textcolor:"rgba( 255, 255, 255, 1)",font:"Verdana",fontsize:12,bold:!1,italic:!1,linewidth:2},linetoolthreedrivers:{clonable:!0,color:"rgba( 149, 40, 255, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 149, 40, 204, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolheadandshoulders:{clonable:!0,color:"rgba( 69, 104, 47, 1)",textcolor:"rgba( 255, 255, 255, 1)",fillBackground:!0,backgroundColor:"rgba( 69, 168, 47, 0.5)",font:"Verdana",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolfibwedge:{singleChartOnly:!0,clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:t.c(.236,"rgba( 204, 40, 40, 1)",!0),level2:t.c(.382,"rgba( 149, 204, 40, 1)",!0),level3:t.c(.5,"rgba( 40, 204, 40, 1)",!0),level4:t.c(.618,"rgba( 40, 204, 149, 1)",!0),level5:t.c(.764,"rgba( 40, 149, 204, 1)",!0),level6:t.c(1,"rgba( 128, 128, 128, 1)",!0),level7:t.c(1.618,"rgba( 40, 40, 204, 1)",!1),level8:t.c(2.618,"rgba( 204, 40, 40, 1)",!1),level9:t.c(3.618,"rgba( 149, 40, 204, 1)",!1),level10:t.c(4.236,"rgba( 204, 40, 149, 1)",!1),level11:t.c(4.618,"rgba( 204, 40, 149, 1)",!1)},linetoolfibcircles:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,snapTo45Degrees:!0,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:t.c(.236,"rgba( 204, 40, 40, 1)",!0),level2:t.c(.382,"rgba( 149, 204, 40, 1)",!0),level3:t.c(.5,"rgba( 40, 204, 40, 1)",!0),level4:t.c(.618,"rgba( 40, 204, 149, 1)",!0),level5:t.c(.764,"rgba( 40, 149, 204, 1)",!0),level6:t.c(1,"rgba( 128, 128, 128, 1)",!0),level7:t.c(1.618,"rgba( 40, 40, 204, 1)",!0),level8:t.c(2.618,"rgba( 204, 40, 40, 1)",!0),level9:t.c(3.618,"rgba( 149, 40, 204, 1)",!0),level10:t.c(4.236,"rgba( 204, 40, 149, 1)",!0),level11:t.c(4.618,"rgba( 204, 40, 149, 1)",!0)},linetoolfibspeedresistancearcs:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:t.c(.236,"rgba( 204, 40, 40, 1)",!0),level2:t.c(.382,"rgba( 149, 204, 40, 1)",!0),level3:t.c(.5,"rgba( 40, 204, 40, 1)",!0),level4:t.c(.618,"rgba( 40, 204, 149, 1)",!0),level5:t.c(.764,"rgba( 40, 149, 204, 1)",!0),level6:t.c(1,"rgba( 128, 128, 128, 1)",!0),level7:t.c(1.618,"rgba( 40, 40, 204, 1)",!0),level8:t.c(2.618,"rgba( 204, 40, 40, 1)",!0),level9:t.c(3.618,"rgba( 149, 40, 204, 1)",!0),level10:t.c(4.236,"rgba( 204, 40, 149, 1)",!0),level11:t.c(4.618,"rgba( 204, 40, 149, 1)",!0)},linetooltrendbasedfibextension:{clonable:!0,showCoeffs:!0,showPrices:!0,font:"Verdana",fillBackground:!0,transparency:80,extendLines:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",reverse:!1,coeffsAsPercents:!1,trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},levelsStyle:{linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level1:t.b(0,"rgba( 128, 128, 128, 1)",!0),level2:t.b(.236,"rgba( 204, 40, 40, 1)",!0),level3:t.b(.382,"rgba( 149, 204, 40, 1)",!0),level4:t.b(.5,"rgba( 40, 204, 40, 1)",!0),level5:t.b(.618,"rgba( 40, 204, 149, 1)",!0),level6:t.b(.764,"rgba( 40, 149, 204, 1)",!0),level7:t.b(1,"rgba( 128, 128, 128, 1)",!0),level8:t.b(1.618,"rgba( 40, 40, 204, 1)",!0),level9:t.b(2.618,"rgba( 204, 40, 40, 1)",!0),level10:t.b(3.618,"rgba( 149, 40, 204, 1)",!0),level11:t.b(4.236,"rgba( 204, 40, 149, 1)",!0),level12:t.b(1.272,"rgba( 149, 204, 40, 1)",!1),level13:t.b(1.414,"rgba( 204, 40, 40, 1)",!1),level16:t.b(2,"rgba( 40, 204, 149, 1)",!1),level14:t.b(2.272,"rgba( 149, 204, 40, 1)",!1),level15:t.b(2.414,"rgba( 40, 204, 40, 1)",!1),level17:t.b(3,"rgba( 40, 149, 204, 1)",!1),level18:t.b(3.272,"rgba( 128, 128, 128, 1)",!1),level19:t.b(3.414,"rgba( 40, 40, 204, 1)",!1),level20:t.b(4,"rgba( 204, 40, 40, 1)",!1),level21:t.b(4.272,"rgba( 149, 40, 204, 1)",!1),level22:t.b(4.414,"rgba( 204, 40, 149, 1)",!1),level23:t.b(4.618,"rgba( 149, 204, 40, 1)",!1),level24:t.b(4.764,"rgba( 40, 204, 149, 1)",!1)},linetooltrendbasedfibtime:{clonable:!0,showCoeffs:!0,font:"Verdana",fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:"rgba( 128, 128, 128, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_DASHED},level1:t.c(0,"rgba( 128, 128, 128, 1)",!0),level2:t.c(.382,"rgba( 204, 40, 40, 1)",!0),level3:t.c(.5,"rgba( 149, 204, 40, 1)",!1),level4:t.c(.618,"rgba( 40, 204, 40, 1)",!0),level5:t.c(1,"rgba( 40, 204, 149, 1)",!0),level6:t.c(1.382,"rgba( 40, 149, 204, 1)",!0),level7:t.c(1.618,"rgba( 128, 128, 128, 1)",!0),level8:t.c(2,"rgba( 40, 40, 204, 1)",!0),level9:t.c(2.382,"rgba( 204, 40, 40, 1)",!0),level10:t.c(2.618,"rgba( 149, 40, 204, 1)",!0),level11:t.c(3,"rgba( 204, 40, 149, 1)",!0)},linetoolschiffpitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:c.STYLE_SCHIFF,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:t.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:t.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:t.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:t.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:t.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:t.c(1,"rgba( 0, 0, 153, 1)",!0),level6:t.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:t.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:t.c(2,"rgba( 165, 0, 0, 1)",!1)},linetoolschiffpitchfork2:{clonable:!0,fillBackground:!0,transparency:80,style:c.STYLE_SCHIFF2,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:t.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:t.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:t.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:t.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:t.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:t.c(1,"rgba( 0, 0, 153, 1)",!0),level6:t.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:t.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:t.c(2,"rgba( 165, 0, 0, 1)",!1)},linetoolinsidepitchfork:{clonable:!0,fillBackground:!0,transparency:80,style:c.STYLE_INSIDE,median:{visible:!0,color:"rgba( 165, 0, 0, 1)",linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID},level0:t.c(.25,"rgba( 160, 107, 0, 1)",!1),level1:t.c(.382,"rgba( 105, 158, 0, 1)",!1),level2:t.c(.5,"rgba( 0, 155, 0, 1)",!0),level3:t.c(.618,"rgba( 0, 153, 101, 1)",!1),level4:t.c(.75,"rgba( 0, 101, 153, 1)",!1),level5:t.c(1,"rgba( 0, 0, 153, 1)",!0),level6:t.c(1.5,"rgba( 102, 0, 153, 1)",!1),level7:t.c(1.75,"rgba( 153, 0, 102, 1)",!1),level8:t.c(2,"rgba( 165, 0, 0, 1)",!1)},linetool:{frozen:!1,visible:!0},linetoolvisibilities:{intervalsVisibilities:{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,months:!0}}},n(TradingView.defaultProperties.chartproperties),o()}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:"rgba( 4, 150, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_ErrorOnUpdate@tv-basicstudies"]&&(TradingView.defaultProperties["study_ErrorOnUpdate@tv-basicstudies"]={description:"Error On Update",styles:{ErrorOnUpdate:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0}}}),void 0===TradingView.defaultProperties["study_ErrorOnCreate@tv-basicstudies"]&&(TradingView.defaultProperties["study_ErrorOnCreate@tv-basicstudies"]={description:"Error On Create",styles:{ErrorOnUpdate:{visible:!0,color:"rgba( 0, 255, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0}}}),void 0===TradingView.defaultProperties["study_ErrorOnNewBar@tv-basicstudies"]&&(TradingView.defaultProperties["study_ErrorOnNewBar@tv-basicstudies"]={description:"Error On New Bar",styles:{ErrorOnUpdate:{visible:!0,color:"rgba( 0, 0, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={font:"Arial",fontsize:10,borderColor:"rgba( 83, 143, 31, 1)",backColor:"rgba( 240, 255, 204, 1)",textColor:"rgba( 0, 0, 0, 1)"}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){var r="rgba( 212, 121, 40, 1)",a=!0,s=1;
TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,font:"Arial",fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:a,"S1/R1":a,"S2/R2":a,"S3/R3":a,"S4/R4":a,"S5/R5":a},colors:{P:r,"S1/R1":r,"S2/R2":r,"S3/R3":r,"S4/R4":r,"S5/R5":r},widths:{P:s,"S1/R1":s,"S2/R2":s,"S3/R3":s,"S4/R4":s,"S5/R5":s}}}}if(void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:"rgba( 86, 135, 29, 1)",linewidth:2}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t.a("rgba( 255, 0, 0, 1)",!1),level1:t.a("rgba( 0, 128, 0, 1)",!1),level2:t.a("rgba( 0, 0, 255, 1)",!1),level3:t.a("rgba( 255, 0, 255, 1)",!1),level4:t.a("rgba( 0, 128, 255, 1)",!0),level5:t.a("rgba( 255, 0, 0, 1)",!0),level6:t.a("rgba( 0, 128, 0, 1)",!0),level7:t.a("rgba( 0, 0, 255, 1)",!0),level8:t.a("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:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:"rgba( 255, 0, 0, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba( 153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_RegressionTrend@tv-basicstudies"]&&(TradingView.defaultProperties["study_RegressionTrend@tv-basicstudies"]={linewidth:1,linestyle:CanvasEx.LINESTYLE_SOLID,styles:{upLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},downLine:{visible:!0,color:"rgba( 0, 0, 255, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},baseLine:{visible:!0,color:"rgba( 255, 0, 0, 0.3)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1},extendLines:!1,showPearsons:!0,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"]){var l="study_Overlay@tv-basicstudies";TradingView.defaultProperties[l]={style:h.STYLE_BARS,showPriceLine:!1,minTick:"default",candleStyle:{upColor:"rgba( 107, 165, 131, 1)",downColor:"rgba( 215, 84, 66, 1)",drawWick:!0,drawBorder:!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,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},lineStyle:{color:"rgba( 3, 3, 247, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",styleType:h.STYLE_LINE_TYPE_SIMPLE},areaStyle:{color1:"rgba( 96, 96, 144, 0.5)",color2:"rgba( 1, 246, 245, 0.5)",linecolor:"rgba( 0, 148, 255, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,priceSource:"close",transparency:50},styles:{open:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0,title:"open"},high:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0,title:"high"},low:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0,title:"low"},close:{visible:!0,color:"rgba( 255, 0, 0, 1)",linestyle:CanvasEx.LINESTYLE_SOLID,linewidth:1,plottype:TradingView.StudyConsts.PLOT_LINE,histogramBase:0,title:"close"}}},Z75.enabled("use_overrides_for_overlay")&&n(TradingView.defaultProperties[l],null,!1,l)}for(var u=e.split("."),_=TradingView.defaultProperties,f=0;f<u.length;f++)_&&(_=_[u[f]]);return _?TradingView.clone(_):{}};a.create=function(e,t){if(t){var i=TradingView.StudyMetaInfo.parseIdString(e),r=_(i.id);TradingView.defaultProperties[i.id]=$.extend(t,r)}},a.createOrReplace=function(e,t){if(t){var i=TradingView.StudyMetaInfo.parseIdString(e);TradingView.defaultProperties[i.id]=t}},a.remove=function(e){TradingView.defaultProperties[e]=void 0},TradingView.saveDefaults=function(e,t){TVSettings.setJSON(e,t)},TradingView.factoryDefaults=_,window.defaults=a,window.applyDefaultsOverrides=n,window.applyPropertiesOverrides=r,window.applyDefaultOverridesToLinetools=o,t.factoryDefaults=_,t.applyDefaultsOverrides=n,t.applyPropertiesOverrides=r,t.applyDefaultOverridesToLinetools=o,t.defaults=a},function(e,t,i){"use strict";function r(e){function t(){var e=C.last();i.toolsGroupsHeight=e.offset().top+e.outerHeight(),$(window).resize()}var i=this;e=e||{},this.options=e,TradingView.drawingState.init();var n=this._container=e.container;if(this.Q3=e.Q4,this._container.on("contextmenu",function(e){e.preventDefault()}),!e.onWidget&&!TradingView.isMobileView){var a=$("<span>").addClass("main-menu apply-common-tooltip common-tooltip-vertical");n.append($("<div>").addClass("tools-group").append(a)),this._mainMenuWidget=new TradingView.MainMenuWidget(a)}if(this._allToolGroups=[],e.drawingsAccess?this._toolsFilter=new r.ModernToolsFilter(e.drawingsAccess):this._toolsFilter=new r.ObsoleteToolsFilter(e.enabledDrawings,e.disabledDrawings),this.favorites=TVSettings.getJSON("chart.favoriteDrawings",[]),!e.readOnly){var s=$("<div>").addClass("tools-group no-delimiter").appendTo(n);if(this._main=s,this.appendToolsGroup([{tool:"cursor",name:$.t("Cross")},{tool:"dot",name:$.t("Dot")},{tool:"arrow",name:$.t("Arrow")},{tool:"eraser",name:$.t("Eraser")}]),this.appendToolsGroup([{tool:"LineToolTrendLine",name:$.t("Trend Line")},{tool:"LineToolTrendAngle",name:$.t("Trend Angle")},{tool:"LineToolHorzLine",name:$.t("Horizontal Line"),shortcut:{keys:"Alt+H",immediately:!0}},{tool:"LineToolHorzRay",name:$.t("Horizontal Ray")},{tool:"LineToolVertLine",name:$.t("Vertical Line"),shortcut:{keys:"Alt+V",immediately:!0}},{tool:"LineToolArrow",name:$.t("Arrow")},{tool:"LineToolRay",name:$.t("Ray")},{tool:"LineToolExtended",name:$.t("Extended")},{tool:"LineToolParallelChannel",name:$.t("Parallel Channel")},{tool:"LineToolDisjointAngle",name:$.t("Disjoint Angle")},{tool:"LineToolFlatBottom",name:$.t("Flat Top/Bottom")},{tool:"LineToolRegressionTrend",name:$.t("Regression Trend")}]),this.appendToolsGroup([{tool:"LineToolPitchfork",name:$.t("Pitchfork")},{tool:"LineToolSchiffPitchfork2",name:$.t("Schiff Pitchfork")},{tool:"LineToolSchiffPitchfork",name:$.t("Modified Schiff Pitchfork")},{tool:"LineToolInsidePitchfork",name:$.t("Inside Pitchfork")},{tool:"LineToolPitchfan",name:$.t("Pitchfan")},{tool:"LineToolGannSquare",name:$.t("Gann Box")},{tool:"LineToolGannComplex",name:$.t("Gann Square")},{tool:"LineToolGannFan",name:$.t("Gann Fan")},{tool:"LineToolFibRetracement",name:$.t("Fib Retracement")},{tool:"LineToolTrendBasedFibExtension",name:$.t("Trend-Based Fib Extension")},{tool:"LineToolFibSpeedResistanceFan",name:$.t("Fib Speed Resistance Fan")},{tool:"LineToolFibTimeZone",name:$.t("Fib Time Zone")},{tool:"LineToolTrendBasedFibTime",name:$.t("Trend-Based Fib Time")},{tool:"LineToolFibCircles",name:$.t("Fib Circles")},{tool:"LineToolFibSpiral",name:$.t("Fib Spiral")},{tool:"LineToolFibSpeedResistanceArcs",name:$.t("Fib Speed Resistance Arcs")},{tool:"LineToolFibWedge",name:$.t("Fib Wedge")},{tool:"LineToolFibChannel",name:$.t("Fib Channel")}]),this.appendToolsGroup([{tool:"LineToolBrush",name:$.t("Brush")},{tool:"LineToolRectangle",name:$.t("Rectangle")},{tool:"LineToolRotatedRectangle",name:$.t("Rotated Rectangle")},{tool:"LineToolEllipse",name:$.t("Ellipse")},{tool:"LineToolTriangle",name:$.t("Triangle")},{tool:"LineToolPolyline",name:$.t("Polyline")},{tool:"LineToolBezierQuadro",name:$.t("Curve")},{tool:"LineToolBezierCubic",name:$.t("Double Curve")},{tool:"LineToolArc",name:$.t("Arc")}]),this.appendToolsGroup([{tool:"LineToolText",name:$.t("Text")},{tool:"LineToolTextAbsolute",name:$.t("Anchored Text")},{tool:"LineToolNote",name:$.t("Note")},{tool:"LineToolNoteAbsolute",name:$.t("Anchored Note")},{tool:"LineToolCallout",name:$.t("Callout")},{tool:"LineToolBalloon",name:$.t("Balloon")},{tool:"LineToolPriceLabel",name:$.t("Price Label")},{tool:"LineToolArrowMarkLeft",name:$.t("Arrow Mark Left")},{tool:"LineToolArrowMarkRight",name:$.t("Arrow Mark Right")},{tool:"LineToolArrowMarkUp",name:$.t("Arrow Mark Up")},{tool:"LineToolArrowMarkDown",name:$.t("Arrow Mark Down")},{tool:"LineToolFlagMark",name:$.t("Flag Mark")}]),this.appendToolsGroup([{tool:"LineTool5PointsPattern",name:$.t("XABCD Pattern")},{tool:"LineToolCypherPattern",name:$.t("Cypher Pattern")},{tool:"LineToolABCD",name:$.t("ABCD Pattern")},{tool:"LineToolTrianglePattern",name:$.t("Triangle Pattern")},{tool:"LineToolThreeDrivers",name:$.t("Three Drivers Pattern")},{tool:"LineToolHeadAndShoulders",name:$.t("Head & Shoulders")},{tool:"LineToolElliottImpulse",name:$.t("Elliott Impulse Wave (12345)")},{tool:"LineToolElliottTriangle",name:$.t("Elliott Triangle Wave (ABCDE)")},{tool:"LineToolElliottTripleCombo",name:$.t("Elliott Triple Combo Wave (WXYXZ)")},{tool:"LineToolElliottCorrection",name:$.t("Elliott Correction Wave (ABC)")},{tool:"LineToolElliottDoubleCombo",name:$.t("Elliott Double Combo Wave (WXY)")},{tool:"LineToolCircleLines",name:$.t("Cyclic Lines")},{tool:"LineToolTimeCycles",name:$.t("Time Cycles")},{tool:"LineToolSineLine",name:$.t("Sine Line")}]),this.appendToolsGroup([{tool:"LineToolRiskRewardLong",name:$.t("Long Position")},{tool:"LineToolRiskRewardShort",name:$.t("Short Position")},{tool:"LineToolPrediction",name:$.t("Forecast")},{tool:"LineToolDateRange",name:$.t("Date Range")},{tool:"LineToolPriceRange",name:$.t("Price Range")},{tool:"LineToolDateAndPriceRange",name:$.t("Date and Price Range")},{tool:"LineToolBarsPattern",name:$.t("Bars Pattern")},{tool:"LineToolGhostFeed",name:$.t("Ghost Feed")},{tool:"LineToolProjection",name:$.t("Projection")}]),this._toolsFilter.isToolEnabled("Font Icons")){var l=new this.Button(this.createIconActions(),{addClass:"font-awesome line-tool-icons-popup",buttonClass:"font-awesome"},!0);this._icons=l,s.append(l.element()),this._allToolGroups.push(l)}if(!TradingView.isMobileView){var d=$("<div>").addClass("tools-group").appendTo(n),h=new this.Button({tool:"zoom",name:"Zoom In",action:function(){TradingView.drawingState.tool.setValue("zoom")}});if(d.append(h.element()),this._allToolGroups.push(h),i.Q3){var p=new this.Button({tool:"zoom-out",name:"Zoom Out",action:function(){var e=i.Q3;if(e){var t=e.activeChartWidget.value().model();t&&t.zoomFromViewport()}}});d.append(p.element()),p.element().addClass("js-hidden"),function(){function e(){var r=i.Q3.activeChartWidget.value(),n=r.model(),o=!1;n?(t!==n&&(t&&t.zoomStack().onChange().unsubscribe(null,e),n.zoomStack().onChange().subscribe(null,e),t=n),o=!n.zoomStack().isEmpty()):r.withModel(null,e),p.element().toggleClass("js-hidden",!o)}var t=null;i.Q3.activeChartWidget.subscribe(e,{callWithLast:!0})}()}var c=new this.Button({tool:"measure",name:"Measure (Shift + Click on the chart)",action:function(){TradingView.drawingState.tool.setValue("measure")}});d.append(c.element()),this._allToolGroups.push(c)}var u=$("<div>").addClass("tools-group").appendTo(n),_=!!TradingView.drawingState.properties().magnet.value(),f=new this.Button({tool:"magnet",name:"Magnet Mode",action:this.ToolbarActions.magnet.bind(this)});if(this.magnet=f,u.append(f.element()),f.activate(_),TradingView.drawingState.properties().magnet.subscribe(this,function(e){f.activate(e.value())}),!e.onWidget&&!TradingView.isMobileView||Z75.enabled("charting_library_base")){var _=!!TradingView.drawingState.properties().stayInDrawingMode.value(),g=new this.Button({tool:"drawginmode",name:"Stay in Drawing Mode",action:this.ToolbarActions.drawingmode.bind(this)});this.drawingmode=g,u.append(g.element()),g.activate(_),TradingView.drawingState.properties().stayInDrawingMode.subscribe(this,function(e){g.activate(e.value())});var _=!!TradingView.drawingState.lockDrawings().value(),v=new this.Button({tool:"lockAllDrawings",name:"Lock All Drawing Tools",action:this.ToolbarActions.lockDrawings.bind(this)});this.lockDrawings=v,u.append(v.element()),v.activate(_),TradingView.drawingState.lockDrawings().subscribe(this,function(e){v.activate(e.value())});var _=!!TradingView.drawingState.hideAllDrawings().value(),m=new this.Button({tool:"hideAllDrawings",name:"Hide All Drawing Tools",action:this.ToolbarActions.hideAllDrawings.bind(this)});if(this.hideAllDrawings=m,u.append(m.element()),m.activate(_),TradingView.drawingState.hideAllDrawings().subscribe(this,function(e){m.activate(e.value())}),Z75.enabled("support_multicharts")){var _=!!TradingView.drawingState.drawOnAllCharts().value(),y=new this.Button({tool:"SyncDrawing",name:$.t("Sync drawings to all charts"),action:this.ToolbarActions.drawAllCharts.bind(this)});this.drawOnAllCharts=y,u.append(y.element()),y.activate(_),TradingView.drawingState.drawOnAllCharts().subscribe(this,function(e){y.activate(e.value())})}var w=$("<div>").addClass("tools-group").appendTo(n);this.removeAndObjectsTreeTools=w;var T=new this.Button({tool:"showObjectsTree",name:$.t("Show Objects Tree"),action:this.ToolbarActions.showObjectsTree.bind(this)});this.showObjectsTree=T,w.append(T.element());var b=new this.Button({tool:"removeAllDrawingTools",name:"Remove All Drawing Tools",action:this.ToolbarActions.removeTools.bind(this)});this.removeTools=b,w.append(b.element());var S=$("<div>").addClass("tools-group no-delimiter").appendTo(n);this.responsiveToolbar=new this.ResponsiveToolbar(this),S.append(this.responsiveToolbar.getButton().element())}TVSettings.getValue("chart.cursorPreference","cursor");this._favoritesEvent=new Delegate,this._favoritesEvent.subscribe(this,function(e){~["add","remove","reorder"].indexOf(e)&&TVSettings.setJSON("chart.favoriteDrawings",this.favorites.map(function(e){return{tool:e.drawing.tool}}))}),e.onWidget||(this.favorites=this.favorites.filter(function(e){return!!e.drawing}),this.favoriteDrawingToolbar=new o(this))}if(e.onWidget||TradingView.isMobileView||$(window).load(function(){this.createBugReportButton(),this.createHelpButton(e),loginStateChange.subscribe(this,function(t){!t&&window.is_authenticated&&(this.createBugReportButton(),this.createHelpButton(e))})}.bind(this)),e.readOnly||TradingView.drawingState.tool.subscribe(function(e){this._syncView(e)}.bind(this),{callWithLast:!0}),$(document).bind("keydown","esc",function(){TradingView.drawingState.resetToCursor(!0)}),this._twoColumnLayout=!1,!e.onWidget&&!TradingView.isMobileView||Z75.enabled("charting_library_base")){var C=n.find(".tools-group");window.loaded?t():$(window).load(t),$(window).on("resize",this.updateToolsVisibility.bind(this))}this.visible=new Property,this.visible.subscribe(this,function(e){this._fold(!e.value()),this.$panelClose&&this.$panelClose.prop("title",this.getVisibilityChangeText(e.value())),TVSettings.setValue("ChartSideToolbarWidget.visible",e.value())}),this.visible.setValue("boolean"==typeof e.forceVisible?e.forceVisible:TVSettings.getBool("ChartSideToolbarWidget.visible",!0)),this.$panelClose=$('<a href="#" class="tv-close-panel left" title="'+this.getVisibilityChangeText(this.visible.value())+'"></a>'),this.$panelClose.on("click",function(e){var t=this.activeChartWidget().model();if(t){var i=this.visible.value();this.$panelClose.prop("title",this.getVisibilityChangeText(!i)),t.setProperty(this.visible,!i,this.getVisibilityChangeText(i)),Q15.emit("toggle_sidebar",!i),e.preventDefault()}}.bind(this)).appendTo(n),e.onResize&&(this.onResize=e.onResize),$(window).on("resize",this.updateLayout.bind(this))}var n=i(378),o=i(383),a=i(380),s=i(123);r.prototype.updateToolsVisibility=function(){var e=$(window).height()<this.toolsGroupsHeight+10;e!=this._twoColumnLayout&&(this.magnet.element().toggleClass("js-hidden",e),this.drawingmode.element().toggleClass("js-hidden",e),this.lockDrawings.element().toggleClass("js-hidden",e),this.hideAllDrawings.element().toggleClass("js-hidden",e),this.drawOnAllCharts&&this.drawOnAllCharts.element().toggleClass("js-hidden",e),this.showObjectsTree.element().toggleClass("js-hidden",e),this.removeTools.element().toggleClass("js-hidden",e),this.removeAndObjectsTreeTools.toggleClass("js-hidden",e),this.responsiveToolbar.getButton().element().toggleClass("js-hidden",!e),this._twoColumnLayout=e)},r.prototype.updateLayout=function(){this.onResize&&this.onResize(this._container)},r.prototype.appendToolsGroup=function(e){var t=this.filterEnabledTools(this.extendTools(e));if(t.length>0){var i=new this.Button(t);this._main.append(i.element()),this._allToolGroups.push(i)}},r.prototype.filterEnabledTools=function(e){return e.filter(function(e){return this._toolsFilter.isToolEnabled(e.name)},this)},r.prototype.element=function(){return this._container},r.prototype._syncView=function(e){if(this._allToolGroups)for(var t=this._allToolGroups.length;t--;){var i=this._allToolGroups[t];if(i.textAsIcon)i.activate("LineToolIcon"==e);else{for(var r=!1,n=i.tools.length;n--;)i.tools[n].tool===e&&(i.setCurrent(n),r=!0);i.activate(r)}}},r.prototype.activeChartWidget=function(){return this.Q3.activeChartWidget.value()},r.prototype.extendTools=function(e){var t=this,i=this._addToFavorite.bind(this),r=t._removeFromFavorite.bind(this),n=this.favorites.reduce(function(e,t){return e.push(t.tool),e},[]);return $.map(e,function(e){var o={tool:e.tool,name:e.name,localizedName:$.t(e.name),addClass:t._toolsFilter.isToolGrayed(e.name)&&" grayed",shortcut:e.shortcut,action:function(){TradingView.drawingState.tool.value()!==e.tool&&(TradingView.supportTouch()&&t.Q3.selectedSource.value()&&t.activeChartWidget().model().lineBeingCreated()&&t.activeChartWidget().model().cancelCreatingLine(),TradingView.drawingState.tool.setValue(e.tool))},favOptions:{allowMakeFavorite:!t.options.onWidget,addToFavorite:i,removeFromFavorite:r}},a=!!~n.indexOf(e.tool);if(a)for(var s=0;s<t.favorites.length;s++)t.favorites[s].tool==e.tool&&(t.favorites[s].drawing=o);return o.favOptions.isFavorite=a,e.shortcut&&TradingView.shortcuts.bind(e.shortcut.keys,function(i){return i.preventDefault(),e.shortcut.immediately?t.activeChartWidget().activePaneWidget&&t.activeChartWidget().activePaneWidget.drawRightThere(e.tool):o.action(),!1}.bind(this)),o})},r.prototype._addToFavorite=function(e){e.favOptions.isFavorite=!0;var t={drawing:e,tool:e.tool};this.favorites.push(t),this._favoritesEvent.fire("add",t)},r.prototype._removeFromFavorite=function(e){e.favOptions.isFavorite=!1;for(var t=0;t<this.favorites.length;t++)this.favorites[t].drawing.tool===e.tool&&(this.favorites.splice(t,1),this._favoritesEvent.fire("remove",e))},r.prototype.createIconActions=function(e){var t=this,i=s.availIcons,r=TVSettings.getJSON("linetoolicon.recenticons");return r&&(i=r.concat(["separator"]).concat(i)),$.map(i,function(e){return"separator"===e?{separator:!0}:{tool:"LineToolIcon",name:String.fromCharCode(e),addClass:t._toolsFilter.isToolGrayed("Font Icons")&&" grayed",action:function(){var i=defaults("linetoolicon");i.icon=e,TradingView.saveDefaults("linetoolicon",i),TradingView.drawingState.tool.setValue("LineToolIcon"),t._icons.setTools(t.createIconActions());var r=TVSettings.getJSON("linetoolicon.recenticons")||[],n=10;r=$.grep(r,function(t){return t!=e}),r.unshift(e),r.length>n&&(r=r.slice(0,n)),TVSettings.setJSON("linetoolicon.recenticons",r)}}})},r.prototype.changeTool=function(e){e?this.Q2.setCurrentTool(e):this.Q2.setCurrentTool(this.Q2.currentCursorTool())},r.prototype._fold=function(e){e=!!e;var t=this._container;t.toggleClass("hidden",e),$(window).resize()},r.prototype.getVisibilityChangeText=function(e){return e?$.t("Hide Drawings Toolbar"):$.t("Show Drawings Toolbar")},r.prototype.createHelpButton=function(e){if(window.widgetbar){var t,i=widgetbar.layout.setHelpButton();e.withWizard&&e.Q4&&(t=e.Q4.activeChartWidget.value());new n(i,!!e.withWizard,t)}},r.prototype.createBugReportButton=function(){if(window.widgetbar){var e=widgetbar.layout.setBugReportButton();e.click(function(t){runOrSignIn(function(){e.addClass("active");var t=new a,i=t.show();i.on("destroy",e.removeClass.bind(e,"active"))},{source:"Bug report dialog",sourceMeta:"Chart"})})}},r.prototype.Button=function(e,t,i){e=Array.isArray(e)?e:[e],this.isGroup=e.length>1,this.textAsIcon=i,this.setTools(e),this._e=$("<span>").addClass("button").addClass("apply-common-tooltip common-tooltip-vertical"),this._main=$("<span>").addClass("main"),i&&(this._main.addClass("text-as-icon"),this._main.text(this._firstNonGrayedTool().localizedName)),this.isGroup&&(this._side=$("<span>").addClass("side").append(svgAsset("small_arrow_right","3x6")),this._e.addClass("subgroup"));var r=i?$.t("Icon"):this.tools[0].localizedName;this._e.append(this._main).attr("title",r).append(this._side),this.isGroup&&(t=$.extend({direction:TradingView.isMobileView?"up":"right",event:"button-popup",addClass:"drawings-popup-list favored-list",reverse:!1,popupSpacing:TradingView.isMobileView?15:4,svg:!i,listInner:!0,listTable:!0,wrapIcon:!0},t||{}),i||(t.addClass+=" iconed"),"function"==typeof TradingView.setWidgetLogoOverlayVisibility&&(this._e.on(t.event,function(){TradingView.setWidgetLogoOverlayVisibility(!1)}),t.onRemove=function(){TradingView.setWidgetLogoOverlayVisibility(!0)}),TradingView.bindPopupMenu(this._e,null,t)),this.activated=e.activated||!1,this.setCurrent(this.tools.indexOf(this._firstNonGrayedTool())),this.isGroup?(Modernizr.touch?(this._main.bind("touchstart",$.proxy(this,"_startclick")),this._main.bind("touchend",$.proxy(this,"_stopclick"))):(this._main.mousedown($.proxy(this,"_startclick")),this._main.mouseup($.proxy(this,"_stopclick"))),this._side.click($.proxy(this,"_submenu")),this._e.click(function(){return!1})):this._e.click($.proxy(this,"action"))},r.prototype.Button.prototype.toggle=function(){switch(this.element().css("display")){case"none":this.element().css("display","block");break;case"block":this.element().css("display","none")}},r.prototype.Button.prototype._isToolGrayed=function(e){return e.addClass&&e.addClass.indexOf("grayed")>-1},r.prototype.Button.prototype._firstNonGrayedTool=function(){for(var e=0;e<this.tools.length;++e){var t=this.tools[e];if(!this._isToolGrayed(t)&&!t.separator)return t}return this.tools[0]},r.prototype.Button.prototype.element=function(){return this._e},r.prototype.Button.prototype.setTools=function(e){if(Array.isArray(e)){var t=this;this.tools=$.map(e,$.proxy(function(e,i){return e.separator?{separator:!0}:{icon:t.textAsIcon?e.name:e.tool,name:e.name,shortcut:e.shortcut,localizedName:e.localizedName||$.t(e.name),tool:e.tool,addClass:e.addClass,action:"function"==typeof e.action?e.action:t._defaultAction,favOptions:e.favOptions}},this))}},r.prototype.Button.prototype._setIcon=function(e){var t=$(svgAsset(e,"30x30"));this._main.empty().append(t)},r.prototype.Button.prototype._setTextAsIcon=function(e){this._main.text(e)},r.prototype.Button.prototype.setIcon=function(e){this.icon=e,this.textAsIcon?this._setTextAsIcon(e):this._setIcon(e)},r.prototype.Button.prototype._getPopupMenuItems=function(){function e(e){return e?$.t("Remove from favorites"):$.t("Add to favorites")}var t=this;return $.map(this.tools,function(i,r){if(i.separator)return i;var n,o=function(){t._isToolGrayed(i)?Q15.emit("onGrayedObjectClicked",{type:"drawing",name:i.name}):(t.setCurrent(r),i.action.call(t,i),$(document).trigger("click"),$(document).trigger("touch"))};return!t.textAsIcon&&i.favOptions.allowMakeFavorite&&(n=$('<span class="to-quick" title="'+e(i.favOptions.isFavorite)+'"></span>').append(svgAsset("star","16x16")).toggleClass("quicked",!!i.favOptions.isFavorite)),{title:""+i.localizedName,action:o,shortcut:i.shortcut,active:r==t.current,svg:t.textAsIcon?!1:$(svgAsset(i.icon,"30x30")),addClass:i.addClass,buttons:t.textAsIcon||!i.favOptions.allowMakeFavorite?void 0:[{el:n,handler:function(t){i.favOptions.isFavorite?(i.favOptions.removeFromFavorite(i),n.removeClass("quicked").attr("title",e(!1))):(i.favOptions.addToFavorite(i),n.addClass("quicked").attr("title",e(!0))),t.stopPropagation(),t.preventDefault()}}]}})},r.prototype.Button.prototype._defaultAction=function(){this.activate()},r.prototype.Button.prototype._startclick=function(){this._e.hasClass("active")?($(document).trigger("click"),this.action()):this._delay=setTimeout($.proxy(function(){this._delay=null,this.openSubmenu()},this),200)},r.prototype.Button.prototype._stopclick=function(){this._delay&&(clearTimeout(this._delay),this._delay=null,this.action())},r.prototype.Button.prototype._submenu=function(){return this._e.hasClass("active")?void $(document).trigger("click"):void this.openSubmenu()},r.prototype.Button.prototype.activate=function(e){e=void 0!==e?!!e:!0,this.activated=e,e?this._e.addClass("selected"):this._e.removeClass("selected"),this.textAsIcon||this._setIcon(this.icon)},r.prototype.Button.prototype.action=function(){var e=this.getCurrent();this._isToolGrayed(e)?Q15.emit("onGrayedObjectClicked",{type:"drawing",name:e.name}):e.action.call(this,e)},r.prototype.Button.prototype.openSubmenu=function(){this._e.trigger("button-popup",[this._getPopupMenuItems()])},r.prototype.Button.prototype.setCurrent=function(e){if(e>=0&&e<this.tools.length){var t=this.tools[e];this.setIcon(t.icon),this._isToolGrayed(t)?this._e.find(".main").addClass(" grayed"):this._e.find(".main").removeClass(" grayed"),this.isGroup&&!this.textAsIcon&&this._e.attr("title",t.localizedName),this.current=e}},r.prototype.Button.prototype.getCurrent=function(){return this.tools[this.current]},r.prototype.Button.prototype.setCurrentTool=function(e,t){var i=this;if("LineToolIcon"===e){var r=String.fromCharCode(defaults("linetoolicon").icon);$.each(this.tools,function(e,t){return t.icon==r?(i.setCurrent(e),i.activate(),!1):void 0})}else $.each(this.tools,function(t,r){return r.tool==e?(i.setCurrent(t),i.activate(),!1):void 0})},r.prototype.ResponsiveToolbar=function(e,t){this.initButton(e,t),this.initPopupMenu()},r.prototype.ResponsiveToolbar.prototype.initButton=function(e){this.button=new r.prototype.Button({tool:"group",name:$.t("Show Hidden Tools"),addClass:"block",action:function(){this.button.activate(!this.button.activated);var t=[this.getMenuItem("Magnet Mode",e.ToolbarActions.magnet.bind(e),e.magnet.activated),this.getMenuItem("Stay in Drawing Mode",e.ToolbarActions.drawingmode.bind(e),e.drawingmode.activated),this.getMenuItem("Lock All Drawing Tools",e.ToolbarActions.lockDrawings.bind(e),e.lockDrawings.activated),this.getMenuItem("Hide All Drawing Tools",e.ToolbarActions.hideAllDrawings.bind(e),e.hideAllDrawings.activated),e.drawOnAllCharts&&this.getMenuItem("Sync drawings to all charts",e.ToolbarActions.drawAllCharts.bind(e),e.drawOnAllCharts.activated),this.getSeparator(),this.getMenuItem("Show Objects Tree...",e.ToolbarActions.showObjectsTree.bind(e)),this.getMenuItem("Remove All Drawing Tools",e.ToolbarActions.removeTools.bind(e))],i=t.filter(function(e){return void 0!==e});this.button.element().trigger("button-popup",[i])}.bind(this)}),this.button.element().addClass("js-hidden")},r.prototype.ResponsiveToolbar.prototype.getSeparator=function(){return{separator:!0}},r.prototype.ResponsiveToolbar.prototype.getMenuItem=function(e,t,i){return{title:$.t(e),action:t,addClass:this.getClass(i)}},r.prototype.ResponsiveToolbar.prototype.initPopupMenu=function(){TradingView.bindPopupMenu(this.button.element(),null,{direction:"right",event:"button-popup",reverse:!0,notCloseOnButtons:!0,onRemove:function(){this.button.activate(!1)}.bind(this)})},r.prototype.ResponsiveToolbar.prototype.getClass=function(e){var t="setting-hidden";return e&&(t+=" checked"),t},r.prototype.ResponsiveToolbar.prototype.getButton=function(){return this.button},r.prototype.ResponsiveToolbar.prototype.getButtonElement=function(){return this.button.element()},r.prototype.ToolbarActions={magnet:function(e){this.magnet.activate(!this.magnet.activated),TradingView.saveDefaultProperties(!0),TradingView.drawingState.properties().magnet.setValue(this.magnet.activated),TradingView.saveDefaultProperties(!1)},drawingmode:function(){this.drawingmode.activate(!this.drawingmode.activated),TradingView.saveDefaultProperties(!0),TradingView.drawingState.properties().stayInDrawingMode.setValue(this.drawingmode.activated),TradingView.saveDefaultProperties(!1)},lockDrawings:function(){this.lockDrawings.activate(!this.lockDrawings.activated),TradingView.drawingState.lockDrawings().setValue(this.lockDrawings.activated)},hideAllDrawings:function(){this.hideAllDrawings.activate(!this.hideAllDrawings.activated),TradingView.drawingState.hideAllDrawings().setValue(this.hideAllDrawings.activated)},drawAllCharts:function(){this.drawOnAllCharts.activate(!this.drawOnAllCharts.activated),TradingView.saveDefaultProperties(!0),TradingView.drawingState.drawOnAllCharts().setValue(this.drawOnAllCharts.activated),TradingView.saveDefaultProperties(!1)},showObjectsTree:function(){this.activeChartWidget().showSourceProperties()},removeTools:function(){this.Q3.activeChartWidget.value().model().removeAllDrawingTools()}},r.ObsoleteToolsFilter=function(e,t){this._enabledTools=e,this._disabledTools=t},r.ObsoleteToolsFilter.prototype.isToolEnabled=function(e){var t=!!this._enabledTools&&this._enabledTools.length>0,i=!!this._disabledTools&&this._disabledTools.length>0;if(t&&i)throw"Unable to use enabled drawings list and disabled drawings one together. Please use just one of them.";return!i&&!t||t&&this._enabledTools.indexOf(e)>=0||i&&this._disabledTools.indexOf(e)<0},r.ObsoleteToolsFilter.prototype.isToolGrayed=function(){return!1},r.ModernToolsFilter=function(e){this._toolsAccess=e},r.ModernToolsFilter.prototype._findTool=function(e){for(var t=null,i=0;i<this._toolsAccess.tools.length;++i){var r=this._toolsAccess.tools[i];if(r.name==e){t=r;break}}return t},r.ModernToolsFilter.prototype.isToolEnabled=function(e){var t=this._findTool(e);return t&&t.grayed?!0:"black"==this._toolsAccess.type?!t:!!t},r.ModernToolsFilter.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},e.exports=r},function(e,t,i){"use strict";function r(e,t,i){this._withWizard=t,this.Q2=i,this.$button=e,this.$button.on("click",this.toggle.bind(this)),$("body").on("click",this.hideOutside.bind(this))}var n=i(379),o=i(380);r.prototype._createPopup=function(){this.$element||(this.$element=$("<div>").addClass("help-menu"),this.$element.append(this.item({text:$.t("Report data issues"),onClick:this.showBugReportDialog}),this.item({text:$.t("Feature Request and Feedback"),onClick:this.showFeedback}),this.item({text:$.t("Suggestions & Feedback"),external:!0,onClick:this.goGetSF}),this.item({text:$.t("Help & Wiki"),external:!0,onClick:this.goWiki}),this.item({text:$.t("Keyboard Shortcuts"),onClick:this.showKeysComb})),"pro_premium"==user.pro_plan&&this.$element.append(this.item({text:$.t("Priority Support"),onClick:$82.showPrioritySupportDialog
})),this.Q2&&!this.Q2.readOnly()&&this._withWizard&&this.$element.append(this.item({text:$.t("Run Product Walk-Through"),onClick:this.startMainWizard})),this.$element.addClass("js-hidden"),this.$element.appendTo("body"),this._boundHideOutside=this.hideOutside.bind(this))},r.prototype.item=function(e){var t=$("<span>");return t.text(e.text+""),t.toggleClass("external",!!e.external),t.toggleClass("checked",!!e.checked),t.on("click",e.onClick||$.noop),t},r.prototype.open=function(){var e=this.$button.offset(),t=$(window).width(),i=$(window).height();this._createPopup(),this.$element.css({bottom:i-e.top+1,right:t-e.left-this.$button.outerWidth()}),this.$element.removeClass("js-hidden"),this.$button.addClass("active"),this.$element.on("mousedownoutside",this._boundHideOutside)},r.prototype.close=function(){this.$button.removeClass("active"),this.$element&&(this.$element.addClass("js-hidden"),this.$element.off("mousedownoutside",this._boundHideOutside))},r.prototype.isOpened=function(){return this.$element&&!this.$element.hasClass("js-hidden")},r.prototype.toggle=function(){this.isOpened()?this.close():this.open()},r.prototype.hideOutside=function(e){$(e.target).closest(this.$button).length||this.close()},r.prototype.showBugReportDialog=function(){runOrSignIn(function(){var e=(new o).show(),t=$(".widgetbar-tabs .widgetbar-bug-report-button");t.size()&&(t.addClass("active"),e.on("destroy",t.removeClass.bind(t,"active")))},{source:"Bug report from chart help menu"})},r.prototype.showFeedback=function(e){window.feedback_widget.show()},r.prototype.goGetSF=function(e){open("https://getsatisfaction.com/tradingview/")},r.prototype.goWiki=function(e){open("https://www.tradingview.com/stock-charts-support/")},r.prototype.startMainWizard=function(){TradingView.wizards||(TradingView.wizards={}),!TradingView.wizards.main&&TradingView.wizardScenarios&&TradingView.wizardScenarios.main&&(TradingView.wizards.main=new n(TradingView.wizardScenarios.main.steps,TradingView.wizardScenarios.main.options)),TradingView.wizards.main.start()},r.prototype.showKeysComb=function(){var e=$82.createDialog($.t("Shortcuts")),t=e.find("._tv-dialog-content");t.html('<div class="main keyboard-help"><h4>'+$.t("Chart")+'</h4><div class="columns"><div class="column"><p><kbd>/</kbd>&nbsp;&ndash; '+$.t("open Indicators.")+"</p><p><kbd>.</kbd>&nbsp;&ndash; "+$.t("open Load Chart.")+"</p><p>"+$.t("<kbd>Symbol</kbd>&nbsp;&ndash; change symbol.")+"<p>"+$.t("<kbd>Number</kbd>&nbsp;or&nbsp;<kbd>,</kbd>&nbsp;&ndash; change interval. Type in a digit for minute charts, or first letter of the word for longer resolutions. E.g. 1, 5, 30, 60, 1440, H, 2H, 6H, D, 5D, 3W, 6M.")+"</p><p><kbd>&larr;</kbd>&nbsp;&ndash; "+$.t("move chart 1 bar to the left.")+"</p><p><kbd>&rarr;</kbd>&nbsp;&ndash; "+$.t("move chart 1 bar to the right.")+"</p><p><kbd>Ctrl / &#8997;</kbd>&nbsp;+&nbsp;<kbd>&larr;</kbd>&nbsp;&ndash; "+$.t("move further to the left.")+"</p><p><kbd>Ctrl / &#8997;</kbd>&nbsp;+&nbsp;<kbd>&rarr;</kbd>&nbsp;&ndash; "+$.t("move further to the right.")+"</p><p><kbd>Ctrl</kbd>&nbsp+&nbsp;<kbd>z</kbd>&nbsp;&ndash; "+$.t("undo")+".</p><p><kbd>Ctrl</kbd>&nbsp+&nbsp;<kbd>y</kbd>&nbsp;&ndash; "+$.t("redo")+".</p><p><kbd>Ctrl</kbd>&nbsp;+&nbsp;<kbd>"+$.t("Eraser")+"</kbd>&nbsp;&ndash; "+$.t("partially erase.")+"</p><p><kbd>"+$.t("DoubleClick")+"</kbd>&nbsp;&ndash; "+$.t("toggle maximize pane.")+'</p></div><div class="column"><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>a</kbd>&nbsp;&ndash; '+$.t("add alert.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>g</kbd>&nbsp;&ndash; "+$.t("go to date.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>h</kbd>&nbsp;&ndash; "+$.t("insert horizontal line.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>n</kbd>&nbsp;&ndash; "+$.t("add text note for symbol.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>s</kbd>&nbsp;&ndash; "+$.t("take snapshot.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>r</kbd>&nbsp;&ndash; "+$.t("reset chart.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>v</kbd>&nbsp;&ndash; "+$.t("insert vertical line.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>w</kbd>&nbsp;&ndash; "+$.t("add symbol to watchlist.")+"</p><p><kbd>Alt</kbd>&nbsp+&nbsp;<kbd>p</kbd>&nbsp;&ndash; "+$.t("open Publish Idea dialog.")+"</p><p><kbd>Esc</kbd>&nbsp;&ndash; "+$.t("close Publish Idea dialog.")+"</p><p>"+$.t("<code>Hold</code>&nbsp;<kbd>Shift</kbd>&nbsp;&ndash; draw lines at right angles.")+"</p><p>"+$.t("<code>Hold</code>&nbsp;<kbd>Shift</kbd>&nbsp; + click &ndash; measure tool.")+"</p><p><kbd>Ctrl</kbd>&nbsp+&nbsp;<kbd>c</kbd>&nbsp;&ndash; "+$.t("copy selected object.")+"</p><p><kbd>Ctrl</kbd>&nbsp+&nbsp;<kbd>v</kbd>&nbsp;&ndash; "+$.t("paste object.")+"</p><p><kbd>Tab</kbd>&nbsp;&ndash; "+$.t("switching between charts in multi-charts layout")+"</p></div></div><h4>"+$.t("Watchlist")+'</h4><div class="columns"><div class="column"><p><kbd>&darr;</kbd>,&nbsp;<kbd>Space</kbd> &ndash; '+$.t("next symbol")+".</p><p><kbd>&uarr;</kbd>,&nbsp;<kbd>Shift</kbd> + <kbd>Space</kbd> &ndash; "+$.t("previous symbol")+".</p></div></div></div>"),$82.positionDialog(e),$82.applyHandlers(e)},e.exports=r},function(e,t){"use strict";function i(e,t){this._steps=[],this.$tooltip=null,this.options=$.extend({},this.defaultOptions,t),this.setSteps(e),this.createTooltip()}i.prototype.defaultOptions={triangleTooltipIndent:10,triangleElementIndent:10,elPadding:3,firstIsIntroduction:!1,animationSpeed:200},i.prototype.setSteps=function(e){if(!e||!$.isArray(e)||!e.length)throw Error("no steps or invalid steps for wizard");for(var t=0,i=e.length;i>t;t++)this._steps.push(new this.Step(this,e[t],t))},i.prototype.createTooltip=function(){var e=this;this.$tooltip=$('<div class="wizard-tooltip"><div class="wizard-tooltip-description"></div><div class="wizard-tooltip-stop"></div><div class="wizard-tooltip-footer"><div class="wizard-tooltip-counter"></div><div class="wizard-tooltip-btn-group clearfix"><div class="wizard-tooltip-btn skip">'+$.t("Skip")+'</div><div class="wizard-tooltip-btn start">'+$.t("start_input")+'</div><div class="wizard-tooltip-btn prev">← '+$.t("Prev")+'</div><div class="wizard-tooltip-btn next">'+$.t("Next")+' →</div><div class="wizard-tooltip-btn close">'+$.t("Close")+"</div></div></div></div>").appendTo($("body")),this.$tooltip.$triangle=$('<div class="wizard-tooltip-triangle"></div>').appendTo($("body")),this.$tooltip.$description=this.$tooltip.find(".wizard-tooltip-description"),this.$tooltip.$counter=this.$tooltip.find(".wizard-tooltip-counter"),this.$tooltip.find(".start").click(function(){e.showStep(1)}),this.$tooltip.find(".prev").click(this.prev.bind(this)),this.$tooltip.find(".next").click(this.next.bind(this)),this.$tooltip.find(".skip").click(this.stop.bind(this)),this.$tooltip.find(".close").click(this.stop.bind(this)),this.$tooltip.find(".wizard-tooltip-stop").click(this.stop.bind(this)),this.$tooltip.keydown(function(t){"37"==t.keyCode||"40"==t.keyCode?e.prev():"38"!=t.keyCode&&"39"!=t.keyCode||e.next()})},i.prototype.start=function(){void 0!==this._current_step_index&&this.stop(),this.showStep(0)},i.prototype.showStep=function(e){var t=this._steps[e];t&&(t.show(),this._current_step_index=e,this.options.firstIsIntroduction?e&&this.$tooltip.$counter.text($.t("wizofstep",{index:e,steps:this._steps.length-1})):this.$tooltip.$counter.text($.t("wizofstep",{index:e+1,steps:this._steps.length})))},i.prototype.hideCurrentStep=function(){this._steps[this._current_step_index].hide()},i.prototype.stop=function(){this.hideCurrentStep(),this._current_step_index=0,TVSettings.setValue("notShowMainWizard",!0)},i.prototype.next=function(){var e=this._current_step_index+1;e<this._steps.length&&this.showStep(e)},i.prototype.prev=function(){var e=this._current_step_index-1;e>=0&&this.showStep(e)},i.prototype.Step=function(e,t,i){if(this.wizard=e,this.index=i,this.target=t.target,this.description=t.description,this.position=t.position||"bc",this.triangleTooltipIndent=t.triangleTooltipIndent||e.options.triangleTooltipIndent,this.triangleElementIndent=t.triangleElementIndent||e.options.triangleElementIndent,this.elPadding=t.elPadding||e.options.elPadding,this.tooltipWidth=t.tooltipWidth||e.options.tooltipWidth,this.tooltipHeight=t.tooltipHeight||e.options.tooltipHeight,this.animationSpeed=t.animationSpeed||e.options.animationSpeed,!this.description)throw Error("No description for step #"+i);t.initialize&&(this.initialize=t.initialize.bind(this)),t.beforeShow&&(this.beforeShow=t.beforeShow.bind(this)),t.afterShow&&(this.afterShow=t.afterShow.bind(this))},i.prototype.Step.prototype.hide=function(){this.wizard.$tooltip.fadeOut(this.animationSpeed),this.wizard.$tooltip.$triangle.fadeOut(this.animationSpeed)},i.prototype.Step.prototype.show=function(){this.wizard,this.wizard.$tooltip;this._initialized||(this.initialize&&this.initialize(),this._initialized=!0),this.beforeShow&&this.beforeShow(),this.showSoftly()},i.prototype.Step.prototype.showSoftly=function(e){var t=this,i=this.wizard.$tooltip,r=i.add(i.$triangle),n=r.filter(":visible"),o=function(){t.prepareElements();var e=t.calculatePositions();e.triangle&&(i.$triangle.css({top:e.triangle.top,left:e.triangle.left}),i.$triangle.fadeIn(t.animationSpeed)),i.css({top:e.tooltip.top,left:e.tooltip.left}),i.fadeIn(t.animationSpeed,null,function(){t.afterShow&&t.afterShow.bind(t)})};n.length?n.fadeOut(t.animationSpeed,null,o):o()},i.prototype.Step.prototype.prepareElements=function(){this.wizard.$tooltip.$description.html(this.description),this.wizard.$tooltip.css({width:this.tooltipWidth>$(document).width()-20?$(document).width()-20:this.tooltipWidth,height:this.tooltipHeight>$(document).height()-20?$(document).height()-20:this.tooltipHeight}),this.wizard.$tooltip.toggleClass("first",0===this.index),this.wizard.$tooltip.toggleClass("last",!this.wizard._steps[this.index+1]),this.wizard.options.firstIsIntroduction&&0===this.index?this.wizard.$tooltip.addClass("introduction"):this.wizard.$tooltip.removeClass("introduction")},i.prototype.Step.prototype.calculatePositions=function(){function e(e,t){if("top"==e)10>t?t=10:t+i.h()>$(document).height()-10&&(t=$(document).height()-10-i.h()),i.t=t;else{if("left"!=e)throw Error("Wrong position in setTooltipPosition, 'left' and 'top' are allowed");10>t?t=10:t+i.w()>$(document).width()-10&&(t=$(document).width()-10-i.w()),i.l=t}}var t=this.wizard,i={t:0,l:0,h:function(){return t.$tooltip.outerHeight()},w:function(){return t.$tooltip.outerWidth()}},r="function"==typeof this.target?$(this.target()):$(this.target);if(i.w()>$(document).width()-20&&this.wizard.$tooltip.width($(document).width()-20),i.h()>$(document).height()-20&&this.wizard.$tooltip.height($(document).height()-20),r&&r instanceof $&&r.size())for(;!r.is(":visible");){if(r.is(document.body)||r.is(document.documentElement)){r=null;break}r=r.parent()}else r=null;var n,o,a;if(r){a=r.offset();var s={w:r.outerWidth(),h:r.outerHeight(),t:a.top,b:a.top+r.outerHeight(),l:a.left,r:a.left+r.outerWidth()},l={t:0,l:0,direction:"",h:function(){return t.$tooltip.$triangle.outerHeight()},w:function(){return t.$tooltip.$triangle.outerWidth()},padding:this.elPadding},d="down up right left",h=this.triangleTooltipIndent,p=this.triangleElementIndent;if(n={},t.$tooltip.$triangle.removeClass(d),"string"==typeof this.position){switch(this.position.charAt(0)){case"t":t.$tooltip.$triangle.addClass("down"),e("top",s.t-l.padding-i.h()-l.h()),l.t=s.t-l.padding-l.h();break;case"b":t.$tooltip.$triangle.addClass("up"),e("top",s.b+l.padding+l.h()),l.t=s.b+l.padding;break;case"l":t.$tooltip.$triangle.addClass("right"),e("left",s.l-l.padding-i.w()-l.w()),l.l=s.l-l.padding-l.w();break;case"r":t.$tooltip.$triangle.addClass("left"),e("left",s.r+l.padding+l.w()),l.l=s.r+l.padding}switch(this.position.charAt(1)){case"l":l.l=s.l-l.w()/2+Math.min(p,s.w/2),e("left",s.l+Math.min(p,s.w/2)+l.w()/2+Math.min(h,i.w())-l.w());break;case"c":l.l=s.l+s.w/2-l.w()/2,e("left",s.l+s.w/2-i.w()/2);break;case"r":l.l=s.r-l.w()/2-Math.min(p,s.w/2),e("left",s.r-Math.min(p,s.w/2)-l.w()/2-Math.min(h,i.w()-l.w()));break;case"t":l.t=s.t+Math.min(p,s.h/2),e("top",l.t-Math.min(h,i.h()-l.h()));break;case"m":e("top",s.t+s.h/2-i.h()/2),l.t=s.t+s.h/2-l.h()/2;break;case"b":e("top",s.b-Math.min(p,s.h/2)-l.h()/2+Math.min(h,i.h()-l.h())),l.t=s.b-Math.min(p,s.h/2)}n={tooltip:{top:i.t,left:i.l<10?10:i.l},triangle:{top:l.t,left:l.l}}}else t.$tooltip.$triangle.addClass(this.position.triangle.direction),n=this.position}else this.position&&this.position.tooltip&&this.position.tooltip.top&&this.position.tooltip.left?n=this.position:(o=$("#chart-area"),o.length||(o=$(window)),a=o.offset(),n={tooltip:{top:(o.height()-i.h())/2+a.top,left:(o.width()-i.w())/2+a.left}});return n},e.exports=i},function(e,t,i){(function(t){"use strict";function r(e){this._options=e||{},this._dialogTitle=$.t("Report data issues"),this._reportEventName="data_issue",this._emailRegExp=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}var n=i(381),o=i(382);r.prototype._setBrowserInfo=function(){this._$browserInfoWrap=$('<div class="browser-info">').html($.t('<span>You are using </span><span class="broswer">{0}</span><span> on </span><span class="os">{1}</span>. ').format(n().browser(),n().os())).appendTo(this._$container),n().browserConfirmed()||(this._$confirmWrap=$("<span>").appendTo(this._$browserInfoWrap),$("<span>"+$.t("Correct?")+"</span>").appendTo(this._$confirmWrap),this._$yesButton=$('<a href="#yes">'+$.t("Yes")+"</a>").click(this._onConfirmBrowserYesClick.bind(this)).appendTo(this._$confirmWrap),this._$noButton=$('<a href="#no">'+$.t("No")+"</a>").click(this._onConfirmBrowserNoClick.bind(this)).appendTo(this._$confirmWrap))},r.prototype._onConfirmBrowserNoClick=function(e){e.preventDefault(),this._$browserInfoWrap.addClass("editing"),this._$browserInput=$(document.createElement("input")).attr("type","text").val(n().browser()).addClass("tv-text-input").appendTo(this._$browserInfoWrap.find(".broswer").empty()),this._$osInput=$(document.createElement("input")).attr("type","text").val(n().os()).addClass("tv-text-input").appendTo(this._$browserInfoWrap.find(".os").empty()),this._$yesButton.text("ok").detach(),this._$confirmWrap.empty().append(this._$yesButton),this._$browserInput.focus()},r.prototype._onConfirmBrowserYesClick=function(e){e.preventDefault(),this._$confirmWrap&&(this._$confirmWrap.html($.t("Thanks!")),setTimeout(function(){this._$confirmWrap.remove(),this._$confirmWrap=null}.bind(this),1500)),this._$browserInfoWrap.hasClass("editing")&&(n().setBrowser(this._$browserInput.val().trim()),this._$browserInfoWrap.find(".broswer").text(n().browser()),n().setOS(this._$osInput.val().trim()),this._$browserInfoWrap.find(".os").text(n().os()),this._$browserInfoWrap.removeClass("editing")),n().confirmBrowser()},r.prototype._checkForm=function(){var e=this._$issueTypeInput.val(),t=this._$descriptionInput.val().trim(),i=this._$emailInput.val().trim();return"none"==e?(this._$issueTypeInput.parent().find(".tv-select-container").addClass("error"),!1):"Alerts issue"!==e||!this._$alertInput||"none"!==this._$alertInput.val()&&"_reset_"!==this._$alertInput.val()?"Trading issue"==e&&"none"==this._$tradingOrderInput.val()?(this._$tradingOrderInput.parent().find(".tv-select-container").addClass("error"),!1):t?i&&this._emailRegExp.test(i)?!0:(this._$emailInput.addClass("error").focus(),!1):(this._$descriptionInput.addClass("error").focus(),!1):(this._$alertInput.parent().find(".tv-select-container").addClass("error"),!1)},r.prototype._setForm=function(){this._$form=$("<form>").appendTo(this._$container);var e=Date.now().toString(36),t=[["Chart does not load",$.t("Chart does not load")],["No real-time data",$.t("No real-time data")],["Price incorrect",$.t("Price incorrect")],["Study not loading",$.t("Study not loading")],["Gap in the data",$.t("Gap in the data")],["Alerts issue",$.t("Alerts issue")],["Trading issue",$.t("Trading issue")],["Slow scrolling or chart loading",$.t("Slow scrolling or chart loading")]];$('<table><tbody><tr><td><label for="issue-type-'+e+'">'+$.t("Issue Type")+'</label></td><td><select id="issue-type-'+e+'" name="issue-type"><option value="none" selected disabled>'+$.t("Select type...")+"</option>"+t.map(function(e){return'<option value="'+e[0]+'">'+e[1]+"</option>"}).join()+'</select><div class="alert-input-container"></div><div class="alert-input-message">'+$.t("Please do not modify the alert so we can investigate the issue.")+'</div><div class="trading-order-input-container"></div><div class="trading-order-input-message">'+$.t("Please do not modify the order so we can investigate the issue.")+'</div></td></tr><tr><td><label for="description-'+e+'">'+$.t("Description")+'</label></td><td><textarea id="description-'+e+'" name="description"></textarea></td></tr><tr><td><label for="email-'+e+'">'+$.t("E-mail")+'</label></td><td><input id="email-'+e+'" class="tv-text-input" name="email" type="text"'+(window.user&&user.email?' value="'+user.email+'"':"")+'></td></tr><tr><td class="buttons" colspan="2"><input class="_tv-button ok" type="submit" value="'+$.t("Send")+'"><input class="_tv-button cancel" type="button" value="'+$.t("Cancel")+'"></td></tr></tbody></table>').appendTo(this._$form);var i=this;this._$issueTypeInput=this._$form.find("select[name=issue-type]"),this._$alertInputContainer=this._$form.find(".alert-input-container"),this._$alertInputMessage=this._$form.find(".alert-input-message"),this._$tradingOrderInputContainer=this._$form.find(".trading-order-input-container"),this._$tradingOrderInputMessage=this._$form.find(".trading-order-input-message"),this._$alertInput=$(),this._$tradingOrderInput=$(),this._$descriptionInput=this._$form.find("textarea[name=description]"),this._$emailInput=this._$form.find("input[name=email]"),this._$submit=this._$form.find("input[type=submit]"),this._$issueTypeInput.change(function(){i._$alertInputMessage.hide(),i._$alertInputContainer.hide(),i._spinner&&(i._spinner.stop(),delete i._spinner),i._$tradingOrderInputContainer.hide(),i._$tradingOrderInputMessage.hide(),"Alerts issue"===i._$issueTypeInput.val()?i._setAlertInput():"Trading issue"==i._$issueTypeInput.val()&&i._setTradingOrderInput()}),this._initSelect(this._$issueTypeInput),this._$form.find("input[type=button].cancel").click(function(){$82.destroy(i._options.modal===!0?null:i._dialogTitle)}),this._$form.on("input change",function(){$(this).find(".error").removeClass("error")}).submit(function(e){e.preventDefault(),i._submit()})},r.prototype._setAlertInput=function(e){function i(e,i){return i&&(r._alertsFullListLoaded=!0),e.length?(r._$alertInput=$(t.render('<select name="alert-id"><option value="none" selected disabled>'+$.t("Select alert")+'</option>{{# alerts }}<option value="{{value}}">{{title}}</option>{{/ alerts }}'+(i||r._alertsFullListLoaded?"":'<option value="_reset_">'+$.t("Load all alerts...")+"</option>")+"</select>",{alerts:e.map(function(e){return{value:e.id,title:e.get("description")}})})),r._$alertInputContainer.empty(),r._spinner&&(r._spinner.stop(),delete r._spinner),r._$alertInput.appendTo(r._$alertInputContainer).change(function(){var e=r._$alertInput.val();"_reset_"===e&&setTimeout(function(){r._setAlertInput(!0)},0),/^\d+$/.test(e)&&r._$alertInputMessage.show()}),void r._initSelect(r._$alertInput)):(r._$alertInputContainer.empty(),r._spinner&&(r._spinner.stop(),delete r._spinner),void delete r._$alertInput)}var r=this,n=TradingView.alertsDispatcher.alerts.models.slice();r._$alertInputContainer.html('<div class="js-spinner-container"></div>').show(),r._spinner=TradingView.unifiedSpinner("micro").spin(r._$alertInputContainer.find(".js-spinner-container").get(0)),n.length&&!e?i(n):TradingView.alertsDispatcher.requestList({success:function(e){i(e,!0)},error:function(){r._spinner&&(r._spinner.stop(),delete r._spinner),r._$alertInputContainer.empty()}})},r.prototype._setTradingOrderInput=function(){var e;try{e=TradingView.Trading.Broker.connection().orders()}catch(t){}if(e&&e.length){var i=this;this._$tradingOrderInput=$('<select name="order-id"><option value="none" selected disabled>'+$.t("Select order")+"</option>"+e.map(function(e){return'<option value="'+e.id+'">'+e.symbol+" "+(e.side+"").toUpperCase()+" "+(e.type+"").toUpperCase()+" "+e.qty+" @ "+e.price+"</option>"}).join("")+"</select>").on("change",function(){var e=$(this).val();"none"!=e&&i._$tradingOrderInputMessage.show()}),this._$tradingOrderInputContainer.empty().append(this._$tradingOrderInput).show(),this._initSelect(this._$tradingOrderInput)}},r.prototype._initSelect=function(e){return e.selectbox({speed:100,classHolder:"tv-select-container dialog placeholder"}).change(function(){var e=$(this);e.parent().find(".tv-select-container").toggleClass("placeholder","none"==e.val())}),e},r.prototype._onSubmitSuccess=function(){delete this._sending,$82.destroy(this._options.modal===!0?null:this._dialogTitle)},r.prototype._onSubmitFailure=function(){delete this._sending,this._$submit.removeClass("process"),this._$form.removeClass("readonly").find("select, textarea, input[type=text]").prop("readonly",!1),this._$confirmWrap&&this._$confirmWrap.css("display",""),$82.showError($.t("Could not send your report"))},r.prototype._submitImpl=function(){var e={issueType:this._$issueTypeInput.val(),description:this._$descriptionInput.val().trim(),email:this._$emailInput.val().trim()};"Alerts issue"===e.issueType&&this._$alertInput?e.alertIds=[this._$alertInput.val()]:"Trading issue"==e.issueType&&(e.tradingOrderIds=[this._$tradingOrderInput.val()]),this._report.setInfo(e).send().then(this._onSubmitSuccess.bind(this),this._onSubmitFailure.bind(this))},r.prototype._submit=function(){!this._sending&&this._checkForm()&&(this._sending=!0,this._$confirmWrap&&this._$confirmWrap.css("display","none"),this._$form.addClass("readonly").find("select, textarea, input[type=text]").prop("readonly",!0),this._$submit.addClass("process"),this._report.ready().then(this._submitImpl.bind(this)))},r.prototype._prepareLayout=function(){$("<p>"+$.t("This report is only for data issues, questionable prices or chart performance issues. This report goes directly to the backend team, so they can ensure the highest quality of the data feed. Mark on your chart in detail which bar is incorrect and any other notes &ndash; a screenshot of your chart is sent with the report automatically. We look at all reported issues, but cannot reply to every sender due to time limitations. If there are additional questions, we'll reach out. Thanks for your understanding!")+'</p><p class="nb">'+$.t("IMPORTANT:")+" "+$.t('All feature requests, ideas and other questions should be posted to <a href="https://getsatisfaction.com/tradingview" target="_blank" style="white-space:nowrap">Suggestions and Feedback Section</a>.')+"</p>").appendTo(this._$container),this._setBrowserInfo(),this._setForm()},r.prototype.show=function(){this._report=new o({eventName:this._reportEventName});var e=$82[this._options.modal===!0?"createModalDialog":"createDialog"](this._dialogTitle,{addClass:"bug-report-dialog"});return this._$container=e.find("._tv-dialog-content"),this._prepareLayout(),e.css("min-width",0),$82.applyHandlers(e,{notFocusFirst:!0}),$82.positionDialog(this._options.modal===!0?null:e),e},TradingView.UserBugReportDialog=r,e.exports=r}).call(t,i(29))},function(e,t){"use strict";function i(){return n?n:this instanceof i?(n=this,this._ready=$.Deferred(),void r(function(e){e&&(d=e),this._ready.resolve()}.bind(this))):new i}function r(e){if(!Modernizr.websockets)return void e("Error. Not Supported");var t=window.WebSocket||window.MozWebSocket;if(!t)return void e("Error. Websocket constructor is undefined");var i,r=Date.now().toString(36),n=new t(h);n.onopen=function(t){n.send(r),i=setTimeout(function(){e("Error. Websocket response timeout")},p)},n.onerror=function(t){clearTimeout(i),e("Error. "+t.data)},n.onmessage=function(t){clearTimeout(i),e(t.data==r?"Success":"Error. Incorrect response"),n.close()}}var n,o,a,s,l=!1,d="Pending",h="wss://echo.websocket.org/",p=3e4;i.prototype.browser=function(){if(o)return o;var e=(navigator.userAgent+"").toLowerCase().match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/)||[null,"unknown",0];"trident"==e[1]?(e[1]="ie",e[4]&&(e[2]=e[4])):"crios"==e[1]&&(e[1]="chrome");var t=("version"==e[1]?e[3]:e[1])+"",i=parseFloat("opera"==e[1]&&e[4]?e[4]:e[2]);return t="ie"==t?"Internet Explorer":t.replace(/^[a-z]/,function(e){return e.toUpperCase()}),t+" "+i},i.prototype.setBrowser=function(e){"string"==typeof e&&e&&(o=e)},i.prototype.os=function(){if(a)return a;for(var e=0,t="Unknown",i=[[/Win16/,"Windows 3.11"],[/(Windows 95|Win95|Windows_95)/,"Windows 95"],[/(Win 9x 4.90|Windows ME)/,"Windows ME"],[/(Windows 98|Win98)/,"Windows 98"],[/Windows CE/,"Windows CE"],[/(Windows NT 5.0|Windows 2000)/,"Windows 2000"],[/(Windows NT 5.1|Windows XP)/,"Windows XP"],[/Windows NT 5.2/,"Windows Server 2003"],[/Windows NT 6.0/,"Windows Vista"],[/(Windows 7|Windows NT 6.1)/,"Windows 7"],[/(Windows 8.1|Windows NT 6.3)/,"Windows 8.1"],[/(Windows 8|Windows NT 6.2)/,"Windows 8"],[/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/,"Windows NT 4.0"],[/Android/,"Android"],[/OpenBSD/,"Open BSD"],[/SunOS/,"Sun OS"],[/(Linux|X11)/,"Linux"],[/(iPhone|iPad|iPod)/,"iOS"],[/Mac OS X/,"Mac OS X"],[/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/,"Mac OS"]],r=navigator.userAgent+"";e<i.length;e++)if(i[e][0].test(r)){t=i[e][1];break}return a=t},i.prototype.setOS=function(e){"string"==typeof e&&e&&(a=e)},i.prototype.cookieEnabled=function(){return navigator.cookieEnabled},i.prototype.flashVersion=function(){function e(e){return(e.match(/\d+/g)||[]).slice(0,3).join(",")}if(s)return s;var t,i,r="0,0,0";try{i=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6")}catch(n){}if(i){try{i.AllowScriptAccess="always"}catch(n){t="6,0,0"}if(t)return s=e(t)||r}try{i=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(n){}if(i){try{t=i.GetVariable("$version")}catch(n){}if(t)return s=e(t)||r}var o=navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"];if(o&&o.enabledPlugin){var a=navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"];if(t=a&&a.description)return s=e(t)||r}return s=r},i.prototype.viewportSize=function(){return $(window).width()+" x "+$(window).height()},i.prototype.screenSize=function(){return window.screen&&(screen.width||screen.availWidth)+" x "+(screen.height||screen.availHeight)||"unknown"},i.prototype.colorDepth=function(){return window.screen&&screen.colorDepth||"unknown"},i.prototype.pixelRatio=function(){return window.hidpiCanvasRatio||window.devicePixelRatio||0},i.prototype.wsTestResult=function(){return d},i.prototype.confirmBrowser=function(){l=!0},i.prototype.browserConfirmed=function(){return l},i.prototype.ready=function(){return this._ready.promise()},i.prototype.state=function(){return{os:this.os(),browser:this.browser(),browserConfirmed:l,cookieEnabled:this.cookieEnabled(),flashVersion:this.flashVersion(),websocketTest:this.wsTestResult(),viewportSize:this.viewportSize(),screenSize:this.screenSize(),colorDepth:this.colorDepth(),pixelRatio:this.pixelRatio()}},TradingView.BrowserInfo=i,e.exports=i},function(e,t,i){"use strict";function r(e){this._options=e||{},this._eventName=e.eventName||"unknown",this._info=e.info||{},this._snapshotURL=null,this._ready=$.Deferred(),this._sent=$.Deferred(),$.when(n().ready(),this._generateSnapshot()).done(this._ready.resolve)}var n=i(381);r.prototype._generateSnapshot=function(){var e=$.Deferred(),t=this._options.Q4||r.getChartWidgetCollection();if(!t)return void e.resolve();var i=this;try{TradingView.takeSnapshot(t,function(t){i._snapshotURL=location.protocol+"//"+location.host+"/x/"+t,e.resolve()},e.resolve.bind(e))}catch(n){e.resolve()}return e.promise()},r.prototype.setInfo=function(e){return this._info=e||{},this},r.prototype.setEventName=function(e){return e&&"string"==typeof e&&(this._eventName=e),this},r.prototype._sendImpl=function(){var e=this._info||{};this._snapshotURL&&(e.snapshotURL=this._snapshotURL),e.browserInfo=n().state();var t=this._timezone();t&&(e.timezone=t);var i=this._extendedHours();"boolean"==typeof i&&(e.extendedHours=i);var r=this._chartSessionDisconnects();"number"==typeof r&&(e.chartSessionDisconnects=r),e.is_pro=this._userIsPro();var o=this._proOffers();Array.isArray(o)&&o.length&&(e.proOffers=o),$71.sendReport(this._eventName,e,null,!0).then(this._sent.resolve.bind(this._sent),this._sent.reject.bind(this._sent))},r.prototype._extendedHours=function(){var e=this._options.Q4||r.getChartWidgetCollection();if(e){var t;try{t=e.activeChartWidget.value().model().mainSeries().properties().extendedHours.value()}catch(i){}return t}},r.prototype._chartSessionDisconnects=function(){return window.Q14&&Q14.disconnectCount()},r.prototype._userIsPro=function(){return!(!window.user||!user.is_pro)},r.prototype._proOffers=function(){return window.pro&&pro.offers()},r.prototype._timezone=function(){var e=this._options.Q4||r.getChartWidgetCollection();if(e){var t;try{t=e.activeChartWidget.value().model().model().properties().timezone.value()}catch(i){}return t}},r.prototype.send=function(){return this._ready.done(this._sendImpl.bind(this)),this._sent},r.prototype.ready=function(){return this._ready},r.prototype.sent=function(){return this._sent},function(){var e;r.setChartWidgetCollection=function(t){e=t},r.getChartWidgetCollection=function(){return e}}(),e.exports=r},function(e,t){"use strict";function i(e){this.drawingToolbar=e,this.tools=this.drawingToolbar.favorites,this.visibleProperty=new Property(TVSettings.getBool("ChartFavoriteDrawingToolbarWidget.visible",!0)),this.visibleProperty.subscribe(this,function(e){this.toggle(e.value()),TVSettings.setValue("ChartFavoriteDrawingToolbarWidget.visible",e.value())}),this._attach(),this.visibleProperty.value()&&this.tools.length>0&&this.show()}i.prototype._POSITION_KEY="chart.favoriteDrawingsPosition",i.prototype._attach=function(){this.drawingToolbar._favoritesEvent.subscribe(this,this._onEvent),TradingView.drawingState.tool.subscribe(function(){this._visible&&this.render()}.bind(this))},i.prototype._onEvent=function(e,t){this.tools=this.drawingToolbar.favorites,this._visible||this.visibleProperty.value()?this.tools.length>0?(this.render(),this._visible||this.showWidget(),this._updatePosition()):this.hideWidget():"add"==e&&this.tools.length>0&&this.setVisible(!0)},i.prototype.render=function(){this._$toolsContainer.empty();var e=TradingView.drawingState.tool.value();this.tools.forEach(function(t){if(t.drawing){var i=t.drawing.tool==e,r=$(svgAsset(t.drawing.tool,"30x30")),n=$('<span class="button apply-common-tooltip" />').attr("title",t.drawing.localizedName).append(r).toggleClass("active",i).on("click",function(){TradingView.drawingState.tool.value()==t.drawing.tool?TradingView.drawingState.resetToCursor():t.drawing.action.call(this.drawingToolbar,t.drawing)});this._$toolsContainer.append(n)}}.bind(this))},i.prototype.init=function(){if(!this._inited){this._inited=!0;var e=this,t=$('<div class="drawing-favorites-toolbar"><div class="drag-handler"><i></i></div></div>').css("position","absolute").addClass("js-hidden").draggable({handle:".drag-handler",stop:function(){TVSettings.setJSON(e._POSITION_KEY,t.offset())}});$(window).resize(function(){e._visible&&e._updatePosition()}),t.on("contextmenu",function(t){t.preventDefault();var i=new TradingView.Action({text:$.t("Hide Favorite Drawings Toolbar")});i.callbacks().subscribe(null,function(){var t=e.drawingToolbar.activeChartWidget().model();if(t){var i=!e.visibleProperty.value();t.setProperty(e.visibleProperty,i,$.t("Hide Favorite Drawings Toolbar"))}}),TradingView.ContextMenu.createMenu([i]).show(t)}),this._$widget=t,this._$toolsContainer=$('<div class="tools-group"/>').appendTo(t),
this._$widget.appendTo(document.body);var i;this._$toolsContainer.sortable({tolerance:"pointer",start:function(e,t){TradingView.Tooltip.hide(),i=t.item.index()},stop:function(e,t){var r=t.item.index();i!=r&&(this.tools.splice(r,0,this.tools.splice(i,1)[0]),this.drawingToolbar._favoritesEvent.fire("reorder"))}.bind(this)})}},i.prototype._updatePosition=function(){var e=this,t=this._$widget,i=$(window),r=i.height()-t.outerHeight(),n=i.width()-t.outerWidth(),o=TVSettings.getJSON(e._POSITION_KEY,{left:n/2,top:window.headerChartPanel.outerHeight()+61});o={top:Math.min(r,Math.max(o.top,0)),left:Math.min(n,Math.max(o.left,0))},t.css(o),t.draggable("option","containment",[0,0,n,r])},i.prototype.showWidget=function(){this._visible=!0,this.render(),this._$widget.removeClass("js-hidden"),this._updatePosition()},i.prototype.hideWidget=function(){this._$widget.addClass("js-hidden"),this._visible=!1},i.prototype.setVisible=function(e){this.visibleProperty.setValue(e)},i.prototype.toggle=function(e){e?this.show():this.hide()},i.prototype.show=function(){!this._visible&&this.tools.length>0&&(this.init(),this.showWidget())},i.prototype.hide=function(){this._visible&&this.hideWidget()},e.exports=i},function(e,t,i){"use strict";function r(e){this.Q3=e,this._bindings=[],this.attachHandlers()}var n=i(179),o=n.Q5,a=n.SimpleComboBinder,s=n.ColorBinding,l=i(71).BarsMarksContainer,d=i(13).LineDataSource;r.prototype._POSITION_KEY="properties_toolbar.position",r.prototype.activeChartWidget=function(){return this.Q3.activeChartWidget.value()},r.prototype.selectedSource=function(){return this.Q3.selectedSource.value()},r.prototype.init=function(){if(!this._inited){this._inited=!0;var e=this,t=$('<div class="properties-toolbar"><div class="drag-handler"><i></i></div></div>').css("position","absolute").addClass("js-hidden").draggable({handle:".drag-handler",stop:function(){TVSettings.setJSON(e._POSITION_KEY,t.offset())}});$(window).resize(function(){e._visible&&e._updatePositoin()}),this._$widget=t,this._$templates=$('<div class="tools-group properties-tools-group">').css("display","inline-block").addClass("js-hidden").appendTo(t),this._$properties=$('<div class="tools-group properties-tools-group">').css("display","inline-block").addClass("js-hidden").appendTo(t),this._$sourceActions=$('<div class="tools-group">').css("display","inline-block").addClass("js-hidden").appendTo(t),this.createSourceActions(),this._$widget.appendTo(document.body)}},r.prototype.attachHandlers=function(){TradingView.drawingState.tool.subscribe(function(e){this.onToolChanged(e)}.bind(this),{callWithLast:!0}),this.Q3.selectedSource.subscribe(function(e){this.onSourceChanged(e)}.bind(this))},r.prototype.onToolChanged=function(e,t){if(e&&-1!=e.toLowerCase().indexOf("linetool")){var t=t instanceof J50?t:new J50(e.toLowerCase());this.init(),this.hideSourceActions(),this.showPropertiesOf(e,t),this.showTemplatesOf({tool:e,properties:t}),this._updateVisibility()}else this.selectedSource()?this.onSourceChanged(this.selectedSource()):this.hide()},r.prototype.findSourceOnWidget=function(e){for(var t=0;t<this.activeChartWidget().model().panes().length;t++)for(var i=this.activeChartWidget().model().panes()[t],r=i.orderedSources(),n=0;n<r.length;n++)if(r[n]===e)return r[n]},r.prototype.onSourceChanged=function(e){return e?void(e instanceof d&&!(e instanceof l)&&this.findSourceOnWidget(e)?(this.init(),!e.userEditEnabled()||"LineToolBrush"!==e.toolname&&this.activeChartWidget().model().lineBeingCreated()?this.hideSourceActions():this.showSourceActions(e),this.showPropertiesOf(e.getConstructor(),e.properties()),this.showTemplatesOf({source:e}),this._setupToggleLockButton(e),this._updateVisibility()):this.hide()):void this.hide()},r.prototype.showTemplatesOf=function(e){if(Z75.enabled("line_tool_templates")){var t,i,r=e.source;r?(t=r.getConstructor(),i=r.properties()):(t=e.tool,i=e.properties),this._$templates.addClass("js-hidden").empty();var n=this,o=function(e){r?(r.restoreTemplate(e),n.activeChartWidget().model().model().updateSource(this._linetool),n.onSourceChanged(r)):(i.merge(e),i.listeners().fire(this),i.saveDefaults(),n.onToolChanged(t,i))},a=new TradingView.LinetoolTemplatesList(t,o,{buttonInner:$.t("Template")+' <span class="icon"></span>',defaultsCallback:function(){i.restoreFactoryDefaults(),n.showPropertiesOf(t,i)},saveAsText:$.t("Save Drawing Template As..."),applyDefaultText:$.t("Apply Default Drawing Template"),getDataForSaveAs:r?function(){return r.template()}:null}),s=a.createButton().attr("title",$.t("Templates"));this.templatesList=a,this._$templates.append(s),this.activeChartWidget()._options.onWidget&&!window.is_authenticated||!Z75.enabled("linetoolpropertieswidget_template_button")||this._$templates.removeClass("js-hidden"),this._templatesVisible=!0}},r.prototype.createSourceActions=function(){function e(e,t,i,r){var n=$("<div>").addClass("button apply-common-tooltip").attr("title",t).on("click",function(e){i(e)});return r&&n.append(r),n}var t=this,r=i(175),n=e("Settings",$.t("Settings"),function(){new r(t.selectedSource(),t.activeChartWidget().model()).show({onWidget:t.activeChartWidget()._options.onWidget})},$(svgAsset("config","15x15")).css({"margin-top":"8px"}));this.$zOrder=e("ZOrder",$.t("Visual Order"),function(){t.zOrderButtonHandler()},$(svgAsset("linetool-layers","18x18")).css({"margin-top":"7px"})),this.$zOrder.addClass("with-arrow"),TradingView.bindPopupMenu(this.$zOrder,null,{direction:"down",event:"button-popup",reverse:!1,notCloseOnButtons:!0});var o=$.t("Clone");Z75.enabled("datasource_copypaste")&&(o=o+", "+$.t("Copy")),Z75.enabled("support_multicharts")&&(o=o+", "+$.t("Sync")),this.$clone=e("Clone",o,function(){t.cloneButtonHandler()},$(svgAsset("linetool-clone","18x18")).css({"margin-top":"7px"})),this.$clone.addClass("with-arrow"),TradingView.bindPopupMenu(this.$clone,null,{direction:"down",event:"button-popup",reverse:!1,notCloseOnButtons:!0}),this.$lock=e("Lock",$.t("Lock"),function(){t.activeChartWidget().toggleLockSelectedObject()},$(svgAsset("lockAllDrawings","26x26")).css({"margin-top":"2px"})),this._lockChangeListener=function(e){t.$lock.toggleClass("active",e.value())};var a=e("Hide",$.t("Hide"),function(){t.activeChartWidget().hideSelectedObject()},$(svgAsset("linetool-visibility","15x15")).css({"margin-top":"8px"})),s=e("Remove",$.t("Remove"),function(){t.activeChartWidget().removeSelectedSource()},$(svgAsset("bucket",{width:20,height:20})).css({"margin-top":"5px"}));Z75.enabled("alerts")?(this.$editAlert=e("alert",$.t("Edit Alert"),function(){runOrSignIn(function(){t.selectedSource().editAlert()},{source:"Alert edit from line properties"})},$(svgAsset("alarm-clock","20x20")).css({"margin-top":"5px"})),this.$addAlert=e("add-alert",$.t("Add Alert"),function(){var e=i(28);runOrSignIn(function(){new e({drawing:t.selectedSource()})},{source:"Alert add from line properties"})},$(svgAsset("alarm-clock-plus","20x20")).css({"margin-top":"5px"})),this._$sourceActions.append(n,this.$editAlert,this.$addAlert,this.$zOrder,this.$clone,this.$lock,a,s)):this._$sourceActions.append(n,this.$zOrder,this.$clone,this.$lock,a,s)},r.prototype.zOrderButtonHandler=function(){this.$zOrder.hasClass("active")||this.$zOrder.trigger("button-popup",[this._getZOrderActions()])},r.prototype.cloneButtonHandler=function(){this.$clone.hasClass("active")||this.$clone.trigger("button-popup",[this._getCloneActions()])},r.prototype._getCloneActions=function(){var e=this.activeChartWidget().model(),t=this.selectedSource(),i=[];return t.properties().clonable.value()&&i.push({title:$.t("Clone"),action:function(){e.cloneLineTool(t)}}),Z75.enabled("datasource_copypaste")?(i.push({title:$.t("Copy"),shortcut:"Ctrl-C",action:function(){e.copySourceToClip(t)}}),Z75.enabled("support_multicharts")?(i.push({title:$.t("Sync"),action:function(){e.copyToOtherCharts(t)}}),i):i):i},r.prototype._getZOrderActions=function(){var e=[],t=this.selectedSource(),i=this.activeChartWidget().model(),r={title:$.t("Bring to Front"),action:function(){i.bringToFront(t)}},n={title:$.t("Send to Back"),action:function(){i.sendToBack(t)}},o={title:$.t("Bring Forward"),action:function(){i.changeZOrder(t,1)}},a={title:$.t("Send Backward"),action:function(){i.changeZOrder(t,-1)}},s=i.paneForSource(this.selectedSource()),l=s.getZOrderMinMax();return t.zorder()===l.minZOrder&&(n.disabled=!0,a.disabled=!0),t.zorder()===l.maxZOrder&&(o.disabled=!0,r.disabled=!0),e.push(r,n,o,a),e},r.prototype._getPossibleProperty=function(e){for(var t=[],i=this._defaultToolProperties(),n=!0,o=!1,a=0;a<i.length;a++){var s=i[a];s.name in e?(n=!1,t.push(s)):s.divider&&(t.push(s),o=!0)}return e.extendLeft||(t=t.map(function(e){return"leftEnd"==e.name&&(e.comboboxOptions=e.comboboxOptions.filter(function(e){return e.value!=r.LINE_EXTEND})),e})),e.extendRight||(t=t.map(function(e){return"rightEnd"==e.name&&(e.comboboxOptions=e.comboboxOptions.filter(function(e){return e.value!=r.LINE_EXTEND})),e})),2===t.length&&o&&(t=$.grep(t,function(e){return!e.divider})),n?[]:t},r.prototype.showPropertiesOf=function(e,t){this._toolExceptionCases||(this._toolExceptionCases=this._createToolExceptionCases());var i=this._toolExceptionCases[e]||this._getPossibleProperty(t);if(this._$properties.empty(),this._propertiesVisible=!1,!i.length)return void this._$properties.addClass("js-hidden");for(var r=0;r<i.length;r++){var n=i[r];if(n.divider)this._$properties.append('<div class="divider"></div>');else{var o=t[n.name];if("function"!=typeof n.showIf||n.showIf(o,t)){var a=new this.propertyControl(this,o,n,t);this._$properties.append(a.el),this._propertiesVisible=!0}}}this._$properties.toggleClass("js-hidden",!this._propertiesVisible)},r.prototype.showSourceActions=function(e){function t(i){n.$editAlert.addClass("js-hidden"),n.$addAlert.addClass("js-hidden"),e.canHasAlert()&&(i?n.$editAlert.removeClass("js-hidden"):n.$addAlert.removeClass("js-hidden")),e.hasAlert.subscribe(t,!0)}var i=TradingView.className((e||this.selectedSource()).constructor),r=this.activeChartWidget().model().model().isSingleInstanceLineTool(i),n=this;this.$clone.toggleClass("js-hidden",r),n.$editAlert&&n.$addAlert&&t(e.hasAlert.value()),this._$sourceActions.removeClass("js-hidden"),this._sourceActionsVisible=!0},r.prototype.hideSourceActions=function(){this._$sourceActions.addClass("js-hidden"),this._sourceActionsVisible=!1},r.prototype._updateVisibility=function(){this._propertiesVisible||this._sourceActionsVisible||this._templatesVisible?this._show():this.hide()},r.prototype.hide=function(){this._$widget&&this._$widget.addClass("js-hidden"),this._visible=!1},r.prototype._show=function(){this._$widget.removeClass("js-hidden"),this._updatePositoin(),this._visible=!0},r.prototype.refresh=function(){this.onSourceChanged(this.selectedSource())},r.prototype._setupToggleLockButton=function(e){e!=this._selectedSourceBk&&(this._selectedSourceBk&&this._selectedSourceBk.properties().frozen&&this._selectedSourceBk.properties().frozen.unsubscribe(this,this._lockChangeListener),e&&e.properties().frozen&&(e.properties().frozen.subscribe(this,this._lockChangeListener),this.$lock.toggleClass("active",e.properties().frozen.value())),this._selectedSourceBk=e)},r.prototype._updatePositoin=function(){var e=this,t=this._$widget,i=$(window),r=i.height()-t.outerHeight(),n=i.width()-t.outerWidth(),o=TVSettings.getJSON(e._POSITION_KEY,{left:n/2,top:window.headerChartPanel.outerHeight()+15});o={top:Math.min(r,Math.max(o.top,0)),left:Math.min(n,Math.max(o.left,0))},t.css(o),t.draggable("option","containment",[0,0,n,r])},r.prototype.bindControl=function(e){this._bindings.push(e)},r.prototype.clearBindings=function(e){for(var t=this._bindings.length;t--;)this._bindings[t].destroy();this._bindings.length=0},r.prototype.propertyControl=function(e,t,i,r){if(t&&i&&e&&i.inputType){"combobox"!==i.inputType||i.comboboxOptions||TradingView.logWarn('inputType combobox, needs "comboboxOptions" option'),this._toolbarWidget=e;var n,l=i.inputType;if("colorPicker"===l){n=o.prototype.createColorPicker({addClass:"tv-colorpicker-icon"});var d=n.find("input");if(i.icon){d.addClass("svg-"+i.icon);var h=$(svgAsset(i.icon,"40x36"));h.on("click",function(e){d.data("tvcolorpicker")||d.focus()}),$(document).on("click",function(e){d.data("tvcolorpicker")?d.addClass("active"):d.removeClass("active")}),d.after(h)}e.bindControl(new s(n,t,!0,e.activeChartWidget().model(),null,this.getTransparency(i,r))),d.addClass("apply-common-tooltip")}else if("combobox"===l){var p,c=!0;i.simple===!0?(p=$.map(i.comboboxOptions,function(e){return{value:e,html:'<div class="combobox-simple">'+e+"</div>"}}),c=!1):p=$.map(i.comboboxOptions,function(e){var t=$('<div class="combobox-icon"></div>');return t.append(svgAsset(e.icon,"32x25")),{value:e.value,html:t}});var u=new TradingView.HTMLHelper.Combobox(p,{horizontal:c}),_=0,f=1,g=41;n=u.render(),c&&n.find(".items").width(i.comboboxOptions.length*g+2*_+2*f-1),i.propertyProxy&&(t=i.propertyProxy(r,e.activeChartWidget().model())),e.bindControl(new a(u,t,null,!0,e.activeChartWidget().model())),n.addClass("apply-common-tooltip")}i.title&&n.attr("title",i.title),"string"==typeof i.addClass&&n.addClass(i.addClass),this.el=n}},r.prototype.propertyControl.prototype.getTransparency=function(e,t){return e.transparency?e.transparencyField?t[e.transparencyField].value():t.transparency.value():void 0},r.prototype.createLineEndPropertyProxy=function(e,t){return function(i,n){var o;o=i[t]&&i[t].value()?r.LINE_EXTEND:i[e].value();var a=new Property(o);return a.subscribe(this,function(r){var o=r.value();2>o?(n.beginUndoMacro(""),i[e].setValue(o),i[t]&&i[t].setValue(!1),n.endUndoMacro()):(n.beginUndoMacro(""),i[e].setValue(d.LINEEND_NORMAL),i[t]&&i[t].setValue(!0),n.endUndoMacro())}),a}},r.LINE_EXTEND=42,r.prototype._defaultToolProperties=function(){return[{name:"color",inputType:"colorPicker",icon:"pencil2",title:$.t("Color")},{name:"linecolor",inputType:"colorPicker",icon:"pencil2",title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",icon:"bucket2",title:$.t("Background Color"),transparency:!0},{divider:!1},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}],title:$.t("Width")},{name:"linestyle",title:$.t("Style"),inputType:"combobox",comboboxOptions:[{value:0,icon:"line-width-1"},{value:1,icon:"line-dotted"},{value:2,icon:"line-dashed"}]},{name:"leftEnd",title:$.t("Left End"),inputType:"combobox",comboboxOptions:[{value:d.LINEEND_NORMAL,icon:"line-left-normal"},{value:d.LINEEND_ARROW,icon:"line-left-arrow"},{value:r.LINE_EXTEND,icon:"line-left-extend"}],propertyProxy:this.createLineEndPropertyProxy("leftEnd","extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:d.LINEEND_NORMAL,icon:"line-right-normal"},{value:d.LINEEND_ARROW,icon:"line-right-arrow"},{value:r.LINE_EXTEND,icon:"line-right-extend"}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]},r.prototype._riskPropertiesExceptionCases=function(){return[{name:"textcolor",title:$.t("Text color"),inputType:"colorPicker",icon:"font"},{name:"profitBackground",title:$.t("Profit Background Color"),inputType:"colorPicker",icon:"bucket2",transparency:!0,transparencyField:"profitBackgroundTransparency"},{name:"stopBackground",title:$.t("Stop Background Color"),inputType:"colorPicker",icon:"bucket2",transparency:!0,transparencyField:"stopBackgroundTransparency"},{name:"linecolor",title:$.t("Border color"),inputType:"colorPicker",icon:"pencil2"}]},r.prototype._elliottPropertiesExceptionCases=function(){return[{name:"color",inputType:"colorPicker",icon:"pencil2"}]},r.prototype._rangeExceptionCases=function(){return[{name:"linecolor",inputType:"colorPicker",icon:"pencil2",title:"Color"},{name:"backgroundColor",inputType:"colorPicker",icon:"bucket2",title:"Background Color",transparency:!0,transparencyField:"backgroundTransparency"},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}],title:"Width"}]},r.prototype._textPropertiesExceptionCases=function(){return[{name:"color",title:$.t("Text color"),inputType:"colorPicker",icon:"font"},{name:"backgroundColor",title:$.t("Background Color"),inputType:"colorPicker",icon:"bucket2",showIf:function(e,t){return t&&t.fillBackground?!!t.fillBackground.value():!0}},{name:"borderColor",title:$.t("Border Color"),inputType:"colorPicker",icon:"pencil2"},{name:"bordercolor",title:$.t("Border Color"),inputType:"colorPicker",icon:"pencil2"},{divider:!1},{name:"fontsize",title:$.t("Font Size"),inputType:"combobox",simple:!0,addClass:"simple fontsize-dropdown",comboboxOptions:[10,11,12,14,16,20,24,28,32,40]}]},r.prototype._notePropertiesExceptionCases=function(){return[{name:"markerColor",title:$.t("Marker Color"),inputType:"colorPicker",icon:"pencil2"},{name:"textColor",title:$.t("Text color"),inputType:"colorPicker",icon:"font"},{divider:!1},{name:"fontSize",title:$.t("Font Size"),inputType:"combobox",simple:!0,addClass:"simple fontsize-dropdown",comboboxOptions:[10,11,12,14,16,20,24,28,32,40]}]},r.prototype._brushPropertiesExceptionCases=function(){return[{name:"linecolor",inputType:"colorPicker",icon:"pencil2",title:$.t("Color")},{name:"backgroundColor",inputType:"colorPicker",icon:"bucket2",transparency:!0,showIf:function(e,t){return t.fillBackground.value()},title:$.t("Background Color")},{divider:!1},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}],title:$.t("Line Width")},{name:"leftEnd",title:$.t("Left End"),inputType:"combobox",comboboxOptions:[{value:d.LINEEND_NORMAL,icon:"line-left-normal"},{value:d.LINEEND_ARROW,icon:"line-left-arrow"}],propertyProxy:this.createLineEndPropertyProxy("leftEnd","extendLeft")},{name:"rightEnd",title:$.t("Right End"),inputType:"combobox",comboboxOptions:[{value:d.LINEEND_NORMAL,icon:"line-right-normal"},{value:d.LINEEND_ARROW,icon:"line-right-arrow"}],propertyProxy:this.createLineEndPropertyProxy("rightEnd","extendRight")}]},r.prototype._createToolExceptionCases=function(){return{LineToolRegressionTrend:[],LineToolGannSquare:[],LineToolFibTimeZone:[],LineToolBrush:r.prototype._brushPropertiesExceptionCases(),LineToolPolyline:r.prototype._brushPropertiesExceptionCases(),LineToolText:r.prototype._textPropertiesExceptionCases(),LineToolTextAbsolute:r.prototype._textPropertiesExceptionCases(),LineToolBalloon:r.prototype._textPropertiesExceptionCases(),LineToolCallout:r.prototype._textPropertiesExceptionCases(),LineToolPriceLabel:r.prototype._textPropertiesExceptionCases(),LineToolArrowMarkLeft:[],LineToolArrowMarkRight:[],LineToolArrowMarkUp:[],LineToolArrowMarkDown:[],LineToolFlagMark:[],LineToolThumbUp:[],LineToolThumbDown:[],LineToolElliottCircle:r.prototype._elliottPropertiesExceptionCases(),LineToolElliottSubminuette:r.prototype._elliottPropertiesExceptionCases(),LineToolElliottMinor:r.prototype._elliottPropertiesExceptionCases(),LineToolElliottMinorRetr:r.prototype._elliottPropertiesExceptionCases(),LineToolElliottMajorRetr:r.prototype._elliottPropertiesExceptionCases(),LineToolDateRange:r.prototype._rangeExceptionCases(),LineToolPriceRange:r.prototype._rangeExceptionCases(),LineToolDateAndPriceRange:r.prototype._rangeExceptionCases(),LineToolIcon:[{name:"color",title:$.t("Color"),inputType:"colorPicker",icon:"bucket2"}],LineToolNote:r.prototype._notePropertiesExceptionCases(),LineToolNoteAbsolute:r.prototype._notePropertiesExceptionCases(),LineToolThreeDrivers:[{name:"color",title:$.t("Text color"),inputType:"colorPicker",icon:"pencil2"}],LineToolRiskRewardLong:r.prototype._riskPropertiesExceptionCases(),LineToolRiskRewardShort:r.prototype._riskPropertiesExceptionCases(),LineToolBarsPattern:[{name:"color",title:$.t("Color"),inputType:"colorPicker",icon:"bucket2"}],LineToolProjection:[{name:"color1",title:$.t("Background color 1"),inputType:"colorPicker",icon:"bucket2",transparency:!0},{name:"color2",title:$.t("Background color 2"),inputType:"colorPicker",icon:"bucket2",transparency:!0},{divider:!1},{name:"linewidth",inputType:"combobox",comboboxOptions:[{value:1,icon:"line-width-1"},{value:2,icon:"line-width-2"},{value:3,icon:"line-width-3"},{value:4,icon:"line-width-4"}]}]}},e.exports=r},function(e,t,i){"use strict";var r=i(5).UndoHistory;$81.ChartApi=function(e){this._notificationHandlers=[],this._sessions=[],this.studyCounter=0,this._connected=!1,this._enabled=!1,this._studyEngine=new $78(e),this._callbacks={},this._symbolIdCache={},this._seriesIdCache={},this._recentSeriesId={},this._enableLogging=!1,this._enabledMoreBarsRequest=!0,this._serverTimeOffset=0,this._autosaveTimeoutSeconds=5;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._autosavePaused=void 0,this._setupAutoSave()},$81.ChartApi.prototype._makeSymbolKey=function(e,t){if(!e||!t)throw"incorrect identifiers";return e+"_"+t},$81.ChartApi.prototype._makeSeriesKey=function(e,t){if(!e||!t)throw"incorrect identifiers";return e+"_"+t},$81.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},$81.ChartApi.prototype.purgeCache=function(e){this._symbolIdCache={},this._seriesIdCache={},this._recentSeriesId={},this._studyEngine.purgeCache(),this._studyEngine.purgeRangeExtensionData(),this._studyEngine.purgeDataCache()},$81.ChartApi.prototype.setAdditionalBarsRequestEnabled=function(e){this._enabledMoreBarsRequest=e},$81.ChartApi.prototype.setTimeFramesList=function(e){this._timeframes=[];for(var t=/(\d+)(\w+)/,i=0;i<e.length;++i){var r=e[i],n=t.exec(r.text),o=n[2].toLowerCase(),a=parseInt(n[1]),s="y"==o?12*a+"m":a+o,l=PineJS.Symbol.parsePeriod(r.resolution);this._timeframes.push({text:a+$.t(o,{context:"dates",count:a}),value:s,targetResolution:r.resolution,requiresIntraday:l.isIntraday})}},$81.ChartApi.prototype._setupAutoSave=function(){var e=this,t=!1;r.undoStack().onChange().subscribe(this,function(){e._autosavePaused?t=!0:(e._fireEvent("onAutoSaveNeeded",void 0,!0),e._autosavePaused=setTimeout(function(){t&&e._fireEvent("onAutoSaveNeeded",void 0,!0),e._autosavePaused=void 0,t=!1},1e3*e._autosaveTimeoutSeconds))})},$81.ChartApi.prototype.setAutoSaveDelay=function(e){this._autosaveTimeoutSeconds=+e},$81.ChartApi.prototype.defaultWatchlistSymbols=function(){return this._watchlistSettings.default_symbols},$81.ChartApi.prototype.availableTimeFrames=function(e,t){if(!e)return[];var i=this._timeframes.filter(function(t){return t.requiresIntraday&&!e.has_intraday?!1:!(e.supported_resolutions&&e.supported_resolutions.indexOf(t.targetResolution)<0)});return i},$81.ChartApi.prototype.defaultResolutions=function(){var e=this._studyEngine.supportedResolutions();return e||{1:1,3:1,5:1,15:1,30:1,45:1,60:1,120:1,180:1,240:1,D:1,W:1,M:1}},$81.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()},$81.ChartApi.prototype.supportedExchangesList=function(){return this._studyEngine.supportedExchangesList()},$81.ChartApi.prototype.futuresRegex=function(){return this._studyEngine.futuresRegex()},$81.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},$81.ChartApi.prototype._logMessage=function(e){this._enableLogging&&console.log(e)},$81.ChartApi.prototype.unsubscribe=function(e,t){var i=this._callbacks[e];if(i){i.splice(i.indexOf(t),1)}},$81.ChartApi.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},$81.ChartApi.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){var r=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(var n=0;n<r.length;++n)r[n](t)}},$81.ChartApi.prototype.setAuthToken=function(e,t){throw"This method is not implemented"},$81.ChartApi.prototype.authTokenRequired=function(e){return!1},$81.ChartApi.prototype.chartCreateSession=function(e,t){},$81.ChartApi.prototype.chartDeleteSession=function(e){},$81.ChartApi.prototype.createSession=function(e,t){TradingView.ChartapiMessagerInstances[e]=new $81.ChartapiMessager(this,e),this._sessions[e]=t,this._notificationHandlers[e]=t,this.connected()&&t.onMessage({method:"connected",params:[]})},$81.ChartApi.prototype.removeSession=function(e){delete this._sessions[e],delete this._notificationHandlers[e],this.chartDeleteSession(e),this._studyEngine.stopSources(e)},$81.ChartApi.prototype.connected=function(){return this._connected},$81.ChartApi.prototype._getHost=function(e){return e},$81.ChartApi.prototype._isSafari5=function(){return!!navigator.appVersion.match(/\/5\.[^\/]*?Safari\//)},$81.ChartApi.prototype._isIE9=function(){return!!navigator.appVersion.match(/MSIE 9/)},$81.ChartApi.prototype._isIOS5=function(){return!!navigator.appVersion.match(/iPad, CPU 5/)},$81.ChartApi.prototype._getPort=function(e){var t=8081;return this._isSafari5()||this._isIE9()?t:e},$81.ChartApi.prototype.connect=function(){if(!this._enabled){var e=this;return void this.on("start_enabled",function(){e.connect()})}this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]}))},$81.ChartApi.prototype.disconnect=function(){throw"This method is not implemented"},$81.ChartApi.prototype.switchTimezone=function(e,t){if(TradingView.ChartapiMessagerInstances[e].setTimezone(t),this._recentSeriesId[e]){this._studyEngine.purgeEndOfDataFlags(e,this._recentSeriesId[e]);var i=this;this._doWhenSeriesSymbolIdIsReady(e,this._recentSeriesId[e],function(t){var r=i._seriesIdCache[i._makeSeriesKey(e,i._recentSeriesId[e])].resolution;i._studyEngine.setDatafeedRequestsAllowed(!1),i._studyEngine.recreateSources(t.name,r,e),i._studyEngine.setDatafeedRequestsAllowed(!0),i._doWhenSeriesDataReceived(function(){var r=i._seriesIdCache[i._makeSeriesKey(e,i._recentSeriesId[e])].resolution,n=Q1.model().mainSeries().data().last();i._studyEngine.rebuildExtrapolatedData(e,t.name,r,t.info,1e3*n.value[0])})})}},$81.ChartApi.prototype.receiveLocalResponse=function(e){this._logMessage("< "+e.method),this._dispathNotification(e),this._fireEvent("message_"+e.method,void 0,!0)},$81.ChartApi.prototype.getMarks=function(e,t,i,r,n){this._studyEngine.getMarks(e,t,i,r,n)},$81.ChartApi.prototype.getTimescaleMarks=function(e,t,i,r,n){this._studyEngine.getTimescaleMarks(e,t,i,r,n)},$81.ChartApi.prototype.resolveSymbol=function(e,t,i,r,n){function o(t,r){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,r),TradingView.ChartapiMessagerInstances[e].onSeriesClearData(0,""),a._symbolIdCache[a._makeSymbolKey(e,t)]={name:i,status:"invalid_symbol"},a._fireEvent(a._makeSymbolKey(e,t)+"_resolve_fail"),a._fireEvent("resolve_fail",{session:e,symbolId:t},!0)}this._notificationHandlers[e][t]=new TradingView.HandlerInfo(r,t),this._symbolIdCache[this._makeSymbolKey(e,t)]=null;var a=this;this._studyEngine.resolveSymbol(i,function(r){return r.errmsg?void o(t,r.errmsg):(a._symbolIdCache[a._makeSymbolKey(e,t)]={name:i,info:r,status:"ok"},a._fireEvent(a._makeSymbolKey(e,t)+"_resolved",r),a._fireEvent("symbol_resolved",{symbolInfo:r,symbolId:t,session:e},!0),void TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,r))},function(e){o(t,e)})},$81.ChartApi.prototype._doWhenSymbolIdIsReady=function(e,t,i){function r(){return{name:o._symbolIdCache[o._makeSymbolKey(e,t)].name,info:o._symbolIdCache[o._makeSymbolKey(e,t)].info}}function n(){a&&(i(r()),a=!1,o.unsubscribe(o._makeSymbolKey(e,t)+"_resolved",n),o.unsubscribe(o._makeSymbolKey(e,t)+"_resolve_fail",n))}var o=this,a=!0;this._symbolIdCache[this._makeSymbolKey(e,t)]?n():(this.on(this._makeSymbolKey(e,t)+"_resolved",n),this.on(this._makeSymbolKey(e,t)+"_resolve_fail",n))},$81.ChartApi.prototype._doWhenSeriesDataReceived=function(e){function t(){Q1.model().mainSeries().onCompleted().unsubscribe(null,t),e()}Q1.model().mainSeries().onCompleted().subscribe(null,t)},$81.ChartApi.prototype._doWhenSeriesSymbolIdIsReady=function(e,t,i,r){function n(){var t=d._symbolIdCache[d._makeSymbolKey(e,h)];return{name:t.name,info:t.info}}function o(){i(n())}function a(){d.unsubscribe("symbol_resolved",l),d.unsubscribe("resolve_fail",s)}function s(t){t.symbolId==h&&t.session==e&&(a(),r&&r())}function l(t){t.symbolId==h&&t.session==e&&(a(),o())}var d=this,h=this._seriesIdCache[e+"_"+t].symbolId;this._symbolIdCache[this._makeSymbolKey(e,h)]?o():(this.on("symbol_resolved",l),this.on("resolve_fail",s))},$81.ChartApi.prototype.createSeries=function(e,t,i,r,n,o,a){i=i||"",this._notificationHandlers[e][t]=new TradingView.HandlerInfo(a,t),this._recentSeriesId[e]=t,TradingView.ChartapiMessagerInstances[e].setResolution(n);var s=this;this._seriesIdCache[e+"_"+t]={symbolId:r,resolution:n,turnaround:i},this._studyEngine.updateSeriesTurnaround(e,t,i),this._doWhenSeriesSymbolIdIsReady(e,t,function(r){s._studyEngine.createSeries(r.name,n,e,t,i)})},$81.ChartApi.prototype.removeSeries=function(e,t,i){this._notificationHandlers[e][t]=new TradingView.HandlerInfo(i,t),this._studyEngine.removeSeries(e,t)},$81.ChartApi.prototype.setVisibleTimeRange=function(e,t,i,r){function n(){o=Q1.model().mainSeries().data();var n=[o.timeToBarIndex(t,TradingView.SEARCH_FROM_LEFT),o.timeToBarIndex(i,TradingView.SEARCH_FROM_RIGHT)];TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(s,l._seriesIdCache[e+"_"+s].turnaround,n[0],n[1],!0),r&&r()}var o=Q1.model().mainSeries().data(),a=!!o.timeToBarIndex(t,TradingView.SEARCH_FROM_LEFT),s=this._recentSeriesId[e],l=this;a?n():(this._studyEngine.ensureExtendedTo(s,e,t),this._doWhenSeriesDataReceived(n))},$81.ChartApi.prototype._exactBarsCountOfTimeFrame=function(e,t){var i=Q1.model().mainSeries().bars(),r=Q1.model().mainSeries().symbolInfo().session,n=i._valueAt(i.size()-1)[0],o=PineJsBarBuilder.alignPeriodsBack(r,e.resolution,e.interval,1,1e3*n),a=i.size();o/=1e3;for(var s=0,s=0;a>s;++s){var l=i._valueAt(s)[0];if(l>o)break}return a-s},$81.ChartApi.prototype.modifySeries=function(e,t,i,r,n,o,a){i=i||"";var s=this._seriesIdCache[e+"_"+t]?this._seriesIdCache[e+"_"+t].resolution:void 0;TradingView.ChartapiMessagerInstances[e].setResolution(PineJS.Symbol.parsePeriod(n).pureResolution);var l=this;this._notificationHandlers[e][t]=new TradingView.HandlerInfo(function(a){if("series_completed"==a.method){var d=PineJS.Symbol.parsePeriod(s),h=PineJS.Symbol.parsePeriod(n);if(h.range&&d.range!=h.range){var p=Q1.model().mainSeries().bars().size(),c=l._exactBarsCountOfTimeFrame(h.range,l._symbolIdCache[l._makeSymbolKey(e,r)].info),u=Math.max(0,p-1-c),_=Math.max(u,p-1);TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,i,u,_)}}o(a)},t),this._recentSeriesId[e]=t,this._studyEngine.updateSeriesTurnaround(e,t,i),a&&(this._seriesIdCache[this._makeSeriesKey(e,a)]=null),this._seriesIdCache[this._makeSymbolKey(e,t)]={symbolId:r,resolution:n,turnaround:i},this._doWhenSeriesSymbolIdIsReady(e,t,function(i){l._studyEngine.purgeEndOfDataFlags(e,t),l._studyEngine.purgeRangeExtensionData(),l._studyEngine.purgeDataCache(),l._studyEngine.recreateSources(i.name,n,e,!0)})},$81.ChartApi.prototype.requestMoreData=function(e,t,i,r){this._enabledMoreBarsRequest&&(this._notificationHandlers[e][t]=new TradingView.HandlerInfo(r,t),
this._studyEngine.extendSeriesRange(t,e,i))},$81.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},$81.ChartApi.prototype.setWatchlistSettings=function(e){this._watchlistSettings=e},$81.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},$81.ChartApi.prototype.requestMetadata=function(e,t,i){this._notificationHandlers[e][t]=new TradingView.HandlerInfo(i,t);var r=this.studiesAccessController.getEnabledTools();TradingView.ChartapiMessagerInstances[e].onRequestMetadata(t,r)},$81.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounter<TradingView.STUDY_COUNT_LIMIT},$81.ChartApi.prototype.createStudy=function(e,t,i,r,n,o,a){if(!this.isCanCreateStudy())throw"Exceeded the limit of studies";var s=this;i=i||"",this._notificationHandlers[e][t]=new TradingView.HandlerInfo(a,t);var l=this._seriesIdCache[this._makeSeriesKey(e,r)].symbolId,d=this._seriesIdCache[this._makeSeriesKey(e,r)].resolution;this._doWhenSymbolIdIsReady(e,l,function(r){s._studyEngine.createStudy(r.name,d,e,t,i,n,o),s.studyCounter++})},$81.ChartApi.prototype.removeStudy=function(e,t){this._notificationHandlers[e][t]=null,this._studyEngine.removeStudy(e,t),this.studyCounter--},$81.ChartApi.prototype.modifyStudy=function(e,t,i,r,n){i=i||"",this._notificationHandlers[e][t]=new TradingView.HandlerInfo(n,t);[e,t,i].concat(r);this._studyEngine.recomputeStudy(t,r,e,i)},$81.ChartApi.prototype.createPointset=function(e,t,i,r,n,o,a){i=i||"",this._notificationHandlers[e][t]=new TradingView.HandlerInfo(a,t);var s=this;this._doWhenSymbolIdIsReady(e,r,function(i){s._studyEngine.createPointset(e,t,i.info.full_name,i.info,n,o)})},$81.ChartApi.prototype.modifyPointset=function(e,t,i,r,n){throw"This call is not implemented"},$81.ChartApi.prototype.removePointset=function(e,t,i){this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(t)},$81.ChartApi.prototype.requestMoreTickmarks=function(e,t,i,r){this._notificationHandlers[e][t]=new TradingView.HandlerInfo(r,t);var n=this;this._doWhenSeriesSymbolIdIsReady(e,t,function(r){var o=n._seriesIdCache[n._makeSeriesKey(e,t)].resolution;n._studyEngine.onMoreTickmarksRequested(e,r.name,r.info,o,i)})},$81.ChartApi.prototype.requestFirstBarTime=function(e,t,i,r){this._notificationHandlers[e][t]=new TradingView.HandlerInfo(r,t)},$81.ChartApi.prototype._invokeHandler=function(e,t){e&&e(t)},$81.ChartApi.prototype._sendRequest=function(e,t){throw"This method is not implemented"},$81.ChartApi.prototype._onMessage=function(e){throw"This method is not implemented"},$81.ChartApi.prototype._convertTimescaleResponse=function(e){for(var t=e.marks,i=0;i<t.length;++i)t[i]={span:t[i][0],time:t[i][1],index:t[i][2]};return e},$81.ChartApi.prototype._dispathNotification=function(e){var t=e.params.shift();if(this._notificationHandlers[t])switch(e.method){case"timescale_update":var i=e.params[0],r=e.params[1],n=this._convertTimescaleResponse(r);n.clear=0===r.changes.length&&0===r.marks.length,this._notificationHandlers[t].onMessage({method:"timescale_update",params:n});for(var o in i){var a={};a.customId=o,a.plots=i[o].series,i[o].ns&&(a.nonseries=i[o].ns),a.turnaround=i[o].turnaround;var s={method:"data_update",params:a};this._invokeNotificationHandler(t,o,s)}break;case"tickmark_update":var n=this._convertTimescaleResponse(e.params[0]);n.changes=[],this._notificationHandlers[t].onMessage({method:"timescale_update",params:n});break;case"data_update":for(var o in e.params[0]){var l=e.params[0][o],a={};a.customId=o,a.plots=l.series?l.series:l.plots,a.turnaround=l.turnaround,"s"in l&&"ns"in l&&(a.plots=l.s,a.nonseries=l.ns);for(var d in a.plots)for(var h in a.plots[d].value)1e100===a.plots[d].value[h]&&(a.plots[d].value[h]=void 0);var s={method:"data_update",params:a};this._invokeNotificationHandler(t,o,s)}break;case"index_update":for(var o in e.params[0]){var s={method:"index_update",params:e.params[0][o]};this._invokeNotificationHandler(t,o,s)}break;case"critical_error":TradingView.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._notificationHandlers[t].onMessage({method:"critical_error",params:e.params});break;case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._notificationHandlers[t].onMessage({method:e.method,params:e.params});break;default:var p=e.params[0];this._invokeNotificationHandler(t,p,e)}},$81.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var r=this._notificationHandlers[e][t];void 0!==r&&r&&this._invokeHandler(r.handler,i),"series_deleted"!=i.method&&"study_deleted"!=i.method||delete this._notificationHandlers[e][t]}},$81.ChartApi.prototype.searchSymbols=function(e,t,i,r,n){0===e.length&&0===t.length&&0===i.length&&n([]),this._studyEngine.searchSymbols(e,t,i,n)},$81.ChartApi.prototype._notifySessions=function(e){for(var t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;var i=this._sessions[t];"function"==typeof i.onMessage&&i.onMessage(e)}},$81.ChartApi.prototype.unpack=function(e){throw"This method is not implemented"},$81.ChartApi.prototype.reconnectTimeout=function(e){throw"This method is not implemented"},$81.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},$81.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},$81.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},$81.ChartApi.prototype.quoteAddSymbols=function(e,t){return this._studyEngine.quoteAddSymbols(e,t)},$81.ChartApi.prototype.quoteRemoveSymbols=function(e,t){return this._studyEngine.quoteRemoveSymbols(e,t)},$81.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},$81.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},$81.ChartApi.prototype.depthCreateSession=function(e,t,i){},$81.ChartApi.prototype.depthDeleteSession=function(e){},$81.ChartApi.prototype.depthSetSymbol=function(e,t){},$81.ChartApi.prototype.depthClearSymbol=function(e){},$81.ChartApi.prototype.depthSetScale=function(e,t){},$81.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return e?new this.StudiesAccessController(this._studyEngine,JSON.parse(e)):new this.ObsoleteStudiesAccessController(this._studyEngine,t&&JSON.parse(t),i&&JSON.parse(i))},$81.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},$81.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){for(var t=null,i=0;i<this._studiesAccess.tools.length;++i){var r=this._studiesAccess.tools[i];if(r.name==e||r==e){t=r;break}}return t},$81.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter(function(e){var t=this._findTool(e.description);return"black"==this._studiesAccess.type?!t||t.grayed:!!t},this)},$81.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},$81.ChartApi.prototype.ObsoleteStudiesAccessController=function(e,t,i){this._studyEngine=e,this._enabledStudiesList=t,this._disabledStudiesList=i},$81.ChartApi.prototype.ObsoleteStudiesAccessController.prototype.getEnabledTools=function(){var e=this._studyEngine.studiesMetadata();return this._enabledStudiesList.length>0?e=e.filter(function(e){return e.is_hidden_study||this._enabledStudiesList.indexOf(e.description)>=0},this):this._disabledStudiesList.length>0&&(e=e.filter(function(e){return e.is_hidden_study||-1==this._disabledStudiesList.indexOf(e.description)},this)),e},$81.ChartApi.prototype.ObsoleteStudiesAccessController.prototype.isToolGrayed=function(){return!1},$81.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},$81.ChartApi.prototype.alignTimePoint=function(e,t,i){return this._studyEngine.alignTimePoint(e,t,i)},TradingView.requireFullInterfaceImplementation($81.ChartApi,"$81.ChartApi",Z96,"Z96"),e.exports=$81.ChartApi}]);