| ').append(n).appendTo(d);var h=$(" | ||
| ').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=$('').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 ').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 "),this._zoomSelector.addClass("zoom-selector"),this._zoomSelector.css("display","none"),this._zoomSelector.appendTo(this._dv),this._tooltipSelector=$(" "),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 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 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 ")},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
"," "]),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?" |