webpackJsonp([1],{355:function(t,e,o){(function(e){"use strict";function i(t,e){this.options=t||{},this._chartWidget=t.chartWidget,this._model=e}function s(t,e){e.__init||(t.initView(),e.__init=!0)}var r,n=o(356),a=o(533),l=o(82).LineDataSource,d=o(348).createTabbedDialog,c=o(35).trackEvent;o(535),r=null,i.prototype.getSourceProperties=function(){var t,e,o,i,s,r,n,a={groups:[],drawings:[],currentSymbol:this._model.mainSeries().symbol()};for(t=0;t"),l=this.getSourceProperties.bind(this),h=$("
"),u=new n(l,this._chartWidget,this._model,h,i),o=o.add(i),t.push({customControl:i,name:$.t("Objects Tree"),page:h,onActivate:s.bind(null,u)}),p=null,e.enabled("support_manage_drawings")&&(_=$("
"),v=$("
"),p=new a(l,this._chartWidget,this._model,v,_),o=o.add(_),t.push({customControl:_,name:$.t("Manage Drawings"),page:v,onActivate:s.bind(null,p)})),m=d({tabs:t,width:520,tabStateSaveKey:"ObjectsTreeDialog.tab",activeTab:this.options.activeTab,customControlsContainerAddClass:"tv-objects-tree-dialog__custom-controls-container",customControls:o,destroyOnClose:!0,height:480,withScroll:!1,contentAddClass:"js-dialog__scroll-wrap",isClickOutFn:function(t){if($(t.target).parents().andSelf().is("._tv-dialog, .properties-toolbar, .colorpicker, .tvcolorpicker-popup, .symbol-edit-popup, .context-menu"))return!1}}),m.tabs.tabChanged.subscribe(null,function(e){t[e].onActivate(t[e]);for(var o=0;op?i.item.next():i.item.prev(),r=this._getSourceIdForItem(i.item),n=this._getSourceIdForItem(s),a=-1,l=-1,d=0;dl?1:-1,d=0;d=0;--i)s=o.children[i],r=this._getItemForSourceId(s.datasource.id()),0!==r.length&&this._listAccessor().updateItem(r,s)},i._groupRenderSize=50,i.prototype._renderGroup=function(t){var e,o;t=t||{},e=0,o=setInterval(function(){var s=t.items.slice(e,e+i._groupRenderSize);s.forEach(function(e){var o=this._list.createItem(e,{lockUnlock:t.showLocks,showHide:!0,draggable:!0,addContextMenu:!0});this._markItemForSource(o,e.datasource),e.datasource.id()===this._selectedSourceId()&&this._listAccessor().activateItem(o,e.datasource),t.$group.append(o)}.bind(this)),e+=i._groupRenderSize,s.length||(clearInterval(o),delete this._delayedRenderIntervals[o],0===--this._fillListGroupsCount&&t.callback())}.bind(this),100),this._delayedRenderIntervals[o]=!0},i.prototype._renderViewInternal=function(t){var e,o,i,s,r,n="studies"!==this._filter.value()&&this._items.drawings.length;for(this._fillListGroupsCount=0,e=this._getItems().groups,o=0,i=0;i').appendTo(this._$contentWrapper),this._addSortableToList(r,e[i].children),s.reverse(),this._renderGroup({showLocks:n,callback:t,items:s,$group:r}),o++,this._fillListGroupsCount++)},t.exports=i},357:function(t,e,o){(function(e,i){"use strict";function s(t){this._$filter=$(e.render(r,{filters:this._getActions()})).appendTo(t).tvDropdown();var o=this;this._$filter.on(Modernizr.touch?"touchend":"click",".js-dropdown-item",function(t){o._$filter.tvDropdown("close"),o._$filter.find(".js-dropdown-item.i-active").removeClass("i-active"),$(this).addClass("i-active")}),this._$filter.on("afterCloseMenu",function(){o.setValue(o._$filter.find(".js-dropdown-item.i-active").attr("data-name"))}),this._$filter.on("beforeOpenMenu",function(){o._$filter.find(".js-dropdown-item").each(function(){var t=$(this);t.toggleClass("i-active",t.attr("data-name")===o._value)})}),this.onChange=new i,this.setValue("all"),this._$filter.find('.js-dropdown-item[data-name="'+this._value+'"]').addClass("i-active")}var r,n=o(171).Study,a=o(102),l=o(82).LineDataSource;o(358),o(359),o(360),o(361),r='
{{#filters}}
{{title}}
{{/filters}}
',s.prototype.value=function(){return this._value},s.prototype.setValue=function(t){if(t!==this._value){this._value=t;var e=this._getActions().filter(function(e){return e.name===t})[0];this._$filter.find(".js-filter-title").text(e.title),this.onChange.fire(t)}},s.prototype.applyToGroup=function(t){var e,o,i,s,r;if("all"===this._value)return t;for(e=[],o=0;o=e&&r').appendTo(this._$tabContainer),this._list=new r(this._chartModel,e),this._list.setItemActivateListener(this._onActiveSourceChanged.bind(this)),this._sourceRemovedHandler=this._onSourceRemoved.bind(this),this._sourcesRemovedHandler=this._onSourcesRemoved.bind(this)}var s=o(69).SidebarCustomScroll,r=o(364).ObjectTreeItemsController,n=o(99),a=o(338).unifiedSpinner;o(531),i.prototype._removeSourceFromView=function(t){},i.prototype._removeSourcesFromView=function(t){},i.prototype._renderViewInternal=function(t){},i.prototype.destroy=function(){this._unsubscribeListeners()},i.prototype.initView=function(){this._chartModel.selectedSource()&&(this._selectedItemId=this._chartModel.selectedSource().id()),this._subscribeListeners(),this._renderView(null),this._addScroll()},i.prototype._sourceForId=function(t){return this._chartModel.dataSourceForId(t)},i.prototype._selectedSourceId=function(){return this._selectedItemId},i.prototype._onActiveSourceChanged=function(t){if(!t)return void(this._selectedItemId="");this._selectedItemId=t.id(),this._chartModel.setSelectedSource(t),this._chartModel.invalidate(new n(n.LIGHT_UPDATE))},i.prototype._getItemForSourceId=function(t){return this._$contentWrapper.find("#"+t)},i.prototype._markItemForSource=function(t,e){t.attr("id",e.id())},i.prototype._getSourceIdForItem=function(t){return t.attr("id")},i.prototype._getSourceForItem=function(t){return this._sourceForId(this._getSourceIdForItem(t))},i.prototype._listAccessor=function(){return this._list},i.prototype._showSpinner=function(){this.spinner=a().spin(this._$tabContainer.get(0)),this._$contentWrapper.css("visibility","hidden")},i.prototype._hideSpinner=function(){this.spinner&&(this.spinner.stop(),this._$contentWrapper.css("visibility","visible"))},i.prototype._onSourceRemoved=function(t){t&&(this._removeSourceFromView(t),this._scroll.updateScrollBar())},i.prototype._onSourcesRemoved=function(t){Array.isArray(t)&&(this._removeSourcesFromView(t),this._scroll.updateScrollBar())},i.prototype._subscribeListeners=function(){this._chartModel.on("removeSource",this._sourceRemovedHandler),this._chartModel.on("removeSources",this._sourcesRemovedHandler)},i.prototype._unsubscribeListeners=function(){this._chartModel.removeListener("removeSource",this._sourceRemovedHandler),this._chartModel.removeListener("removeSources",this._sourcesRemovedHandler)},i.prototype._getItems=function(){return this._items},i.prototype._reloadItems=function(){this._items=this._sourcesPropertiesGetter()},i.prototype._renderView=function(t){this._$contentWrapper.empty(),this._hideSpinner(),this._showSpinner(),this._reloadItems(),this._renderViewInternal(function(){this._hideSpinner(),t&&t()}.bind(this))},i.prototype._addScroll=function(){this._scroll=new s(this._$tabContainer,this._$contentWrapper,{showTopShadow:!1,showBottomShadow:!1,scrollMarginTop:0})},t.exports=i},364:function(t,e,o){(function(e,i){"use strict";function s(t,e){this._chartWidget=e,this._chartModel=t,this._$activeItem=null,this._nodeExpandCollapseCallback=null,this._nodeRemoveCallback=null,this._itemActivateCallback=null}var r,n,a,l,d,c,h,u,p=o(82).LineDataSource,_=o(209),v=o(315),m=o(365),f=o(426).lineToolsInfo,b=o(516);o(523),o(26),r=o(524),n=o(525),a=o(526),l=o(527),d=o(528),c=o(529),h=o(530),u='
{{#draggable}}
'+r+'
{{/draggable}}{{#treeNode}}
'+n+''+a+'
{{/treeNode}}{{^treeNode}}
{{/treeNode}}
{{#lockUnlockIcon}}'+l+'{{/lockUnlockIcon}}{{#showHideIcon}}'+d+'{{/showHideIcon}}{{^treeNode}}'+c+'{{/treeNode}}'+h+"
",s.prototype.setItemActivateListener=function(t){this._itemActivateCallback=t},s.prototype.setNodeExpandCollapseCallback=function(t){this._nodeExpandCollapseCallback=t},s.prototype.setNodeRemoveCallback=function(t){this._nodeRemoveCallback=t},s.prototype.activateItem=function(t,e,o){o&&o.originalEvent.defaultPrevented||(this._$activeItem&&0!==this._$activeItem.length&&this._$activeItem.removeClass("i-active"),this._$activeItem=t,this._$activeItem&&0!==this._$activeItem.length&&this._$activeItem.addClass("i-active"),this._itemActivateCallback&&this._itemActivateCallback(e))},s.prototype.createSortableForItemsList=function(t,e,o){t.sortable({scroll:!0,scrollSensitivity:100,scrollSpeed:100,axis:"y",handle:".js-drag-icon",placeholder:"tv-objects-tree-item tv-objects-tree-item--placeholder",start:e,stop:o})},s.prototype.createTreeNodeItem=function(t,o,i){var s,r=$(e.render(u,{draggable:!1,lockUnlockIcon:!1,formatIcon:!1,showHideIcon:!1,treeNode:!0,title:t,wideTitle:!0}));return this.updateNodeItem(r,t,o,i),r.click(this._onNodeToggleExpandCollapse.bind(this,r,t)),s=r.find(".js-remove-btn").attr("title",$.t("Delete all drawing for this symbol")),s.click(function(e){e.preventDefault(),this._nodeRemoveCallback&&this._nodeRemoveCallback(r,t)}.bind(this)),r},s.prototype.createItem=function(t,o){var i,s;return o=o||{},i=$(e.render(u,{draggable:o.draggable,lockUnlockIcon:o.lockUnlock,showHideIcon:o.showHide,treeNode:!1,largeLeftPadding:o.largeLeftPadding})),this.updateItem(i,t),s=t.datasource,i.click(this.activateItem.bind(this,i,s)),s.userEditEnabled()&&(o.lockUnlock&&this._setupLockUnlockButton(i.find(".js-lock-unlock-btn"),s),o.showHide&&this._setupItemPropertyButton(i.find(".js-show-hide-btn"),s,"visible",$.t("Show/Hide"),"Show/Hide ",!0),this._setupFormatButton(i.find(".js-format-btn"),s),this._canShowEditObjectDialog(s)&&(i.dblclick(this._showEditObjectDialog.bind(this,s)),o.addContextMenu&&i.on("contextmenu",function(t){this._showContextMenu(t,s),t.preventDefault()}.bind(this))),this._setupItemRemoveButton(i.find(".js-remove-btn"),s)),i},s.prototype.updateNodeItem=function(t,e,o,i){var s=t.find(".js-title-container");s.toggleClass("i-bold",i.isCurrent),s[0].innerHTML=e+" ("+o.length+")"},s.prototype.updateItem=function(t,e){t.find(".js-title-container")[0].innerHTML=TradingView.clean($.t(e.name)),this._setDataSourceIcon(t,e.datasource),this._setItemVisible(t,e.datasource)},s.prototype._showContextMenu=function(t,e){if(i.enabled("objects_tree_context_menu")){this._chartWidget.paneByState(this._chartModel.paneForSource(e)).showContextMenuForSource(e,t)}},s.prototype._canShowEditObjectDialog=function(t){return!(t instanceof p&&!t.isActualSymbol())&&((t!==this._chartModel.mainSeries()||!this._chartWidget||!this._chartWidget.onWidget())&&(v.hasStylesPropertyPage(t)||v.hasInputsPropertyPage(t)))},s.prototype._showEditObjectDialog=function(t){new m(t,this._chartModel).show()},s.prototype._setupLockUnlockButton=function(t,e){TradingView.isInherited(e.constructor,p)?this._setupItemPropertyButton(t,e,"frozen",$.t("Lock/Unlock"),"Lock/Unlock ",!1):t.addClass("i-hidden")},s.prototype._setupFormatButton=function(t,e){if(!this._canShowEditObjectDialog(e))return void t.addClass("i-hidden");t.attr("title",$.t("Format")).click(this._showEditObjectDialog.bind(this,e))},s.prototype._setItemVisible=function(t,e){var o=e.properties().visible.value();t.toggleClass("i-prop-hidden",!o)},s.prototype._setDataSourceIcon=function(t,e){var o,i,s,r,n,a=t.find(".js-icon-container").empty();a.removeClass("i-text-icon i-empty"),o=e instanceof p,i=e instanceof _,s=e===this._chartModel.mainSeries(),o&&!i||s?(r=s?b[e.properties().style.value()]:f[e.getType()].icon,$(r).attr({width:20,height:20}).appendTo(a)):i?(n=e.properties().icon.value(),a.addClass("i-text-icon"),a.text(String.fromCharCode(n))):a.addClass("i-empty"),t.prepend(a)},s.prototype._onItemPropertyButtonClicked=function(t,e){this._chartModel.setProperty(t,!t.value(),e)},s.prototype._onItemPropertyChanged=function(t,e,o){t.toggleClass("i-active",e?!o.value():o.value())},s.prototype._syncStateAndSubscribe=function(t,e,o){e.subscribe(null,this._onItemPropertyChanged.bind(this,t,o)),this._onItemPropertyChanged(t,o,e)},s.prototype._setupItemPropertyButton=function(t,e,o,i,s,r){t.attr("title",i).click(function(t){this._onItemPropertyButtonClicked(e.properties()[o],s+e.title())}.bind(this)),this._syncStateAndSubscribe(t,e.properties()[o],r)},s.prototype._setupItemRemoveButton=function(t,e){e!==this._chartModel.mainSeries()&&e.isUserDeletable()?t.attr("title",$.t("Delete")).click(function(t){t.preventDefault(),this._chartModel.removeSource(e)}.bind(this)):t.addClass("i-transparent")},s.prototype._onNodeToggleExpandCollapse=function(t,e){var o="i-expanded",i=t.hasClass(o);t.toggleClass(o,!i),this._nodeExpandCollapseCallback&&this._nodeExpandCollapseCallback(t,e,!i)},t.exports.ObjectTreeItemsController=s}).call(e,o(52),o(1))},523:function(t,e){},525:function(t,e){t.exports=''},526:function(t,e){t.exports=''},528:function(t,e){t.exports=''},529:function(t,e){t.exports=''},530:function(t,e){t.exports=''},531:function(t,e){},532:function(t,e){},533:function(t,e,o){"use strict";function i(t,e,o,i,r){s.call(this,t,e,o,i),this._clearRemoveNodeTimerId=null,this._$emptyListMessage=$('
').text($.t("No drawings yet")),this._$emptyListMessage.appendTo(this._$tabContainer),this._$totalValueContainer=$("
").appendTo(r)}var s=o(363);o(534),inherit(i,s),i.prototype.destroy=function(){this._clearRemoveNodeTimer(),s.prototype.destroy.call(this)},i.prototype.initView=function(){this._listAccessor().setNodeExpandCollapseCallback(this._renderViewForSymbol.bind(this)),this._listAccessor().setNodeRemoveCallback(this._onNodeRemoveClick.bind(this)),s.prototype.initView.call(this)},i.prototype._clearRemoveNodeTimer=function(){clearInterval(this._clearRemoveNodeTimerId),this._clearRemoveNodeTimerId=null},i.prototype._renderViewForSymbol=function(t,e,o){var i,s,r,n,a,l="tv-manage-drawings-tab__symbol-drawings";if(t.next().hasClass(l))return t.next().toggleClass("i-expanded",o),void this._scroll.updateScrollBar();for(i=$('
'),s=this._symbolDrawingsMap[e],r=0;r