webpackJsonp([15,2],{1010:function(t,e,i){"use strict";function s(t,e,i){e.toggleClass("i-hidden",""===t.val()),i.fire(t.val())}function o(t){var e,i,o,n=$(h);return t.addClass&&n.addClass(t.addClass),t.withoutControls&&n.addClass("tv-search-row--without-controls"),e=n.find(".js-input-control"),i=n.find(".js-reset-button"),t.placeholder&&e.attr("placeholder",t.placeholder),i[0].addEventListener("click",function(){e.val("").trigger("input").focus()}),o=new r.a,e.on("input propertychange",s.bind(null,e,i,o)),s(e,i,o),{$control:n,$input:e,inputChangedDelegate:o}}var n,r,a,l,c,h;Object.defineProperty(e,"__esModule",{value:!0}),e.createSearchControl=o,n=i(8),r=i.n(n),a=i(325),i.n(a),l=i(1011),i.n(l),c=i(1012),i.n(c),h='
'+a+''+l+"
"},1011:function(t,e){t.exports=''},1012:function(t,e){},1013:function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a,l;Object.defineProperty(e,"__esModule",{value:!0}),e.AddSymbolCheckbox=void 0,a=i(308),l=s(a),e.AddSymbolCheckbox=function(t){function e(t){o(this,e),t.checked=TVSettings.getBool("showAddSymbolDialog.checkboxState",!0);var i=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.$checkbox.change(function(){setTimeout(function(){TVSettings.setValue("showAddSymbolDialog.checkboxState",i.checked)})}),i}return r(e,t),e}(l.default)},1103:function(t,e,i){"use strict";var s,o,n,r,a,l,c,h,d,u;Object.defineProperty(e,"__esModule",{value:!0}),i.d(e,"FavoriteScriptsModel",function(){return u}),s=i(49),i.n(s),o=i(107),n=i(26),r=i.n(n),a=i(8),l=i.n(a),c=i(12),i.n(c),h={FAV_KEY:"studyMarket.favorites",FAV_EXTRA_KEY:"studyMarket.favorites.extra"},d=null,u=function(){function t(){var t=this;this._previousFavorites=[],this._favorites=[],this._favoritesExtra={},this._favoritesChanged=new l.a,this.loadFavs(),o.TVXWindowEvents.on("StudyFavoritesChanged",function(e){var i=JSON.parse(e);t._updateFavorites(i.favorites||[]), t._updateFavoritesExtra(i.favoritesExtra||{})}),window.loginStateChange.subscribe(null,function(){t.loadFavs()})}return t.prototype.loadFavs=function(){var t=s.getJSON(h.FAV_KEY,[]),e=s.getJSON(h.FAV_EXTRA_KEY,{}),i=this._migrate(t,e);this._updateFavorites(i.favs),this._updateFavoritesExtra(i.favsExtra)},t.prototype.isFav=function(t){0===this._favorites.length&&this.loadFavs();var e=this.favId(t);return-1!==this._favorites.indexOf(e)},t.prototype.favorite=function(t,e){var i,s,n,r;0!==this._favorites.length&&0!==Object.keys(this._favoritesExtra).length||this.loadFavs(),i=this.favId(t),s=this.favorites(),n=this.favoritesExtra(),r=s.indexOf(i),-1!==r?(s.splice(r,1),delete n[i]):(s.push(i),void 0!==e&&(n[i]=e)),this._updateFavorites(s),this._updateFavoritesExtra(n),this._saveFavs(s,n),o.TVXWindowEvents.emit("StudyFavoritesChanged",JSON.stringify({favorites:s,favoritesExtra:n}))},t.prototype.favId=function(t){return r.a.cutScriptIdPart(t)||r.a.cutFullId(t)},t.prototype.previousFavorites=function(){return this._previousFavorites.slice()},t.prototype.favorites=function(){return this._favorites.slice()},t.prototype.favoritesExtra=function(){return Object.assign({},this._favoritesExtra)},t.prototype.favoritesChanged=function(){return this._favoritesChanged},t.getInstance=function(){return null===d&&(d=new t),d},t.prototype._saveFavs=function(t,e){s.setJSON(h.FAV_KEY,t),s.setJSON(h.FAV_EXTRA_KEY,e)},t.prototype._migrate=function(t,e){var i,s,o=[],n={};for(i=0;i
{{^minimized}}
{{/minimized}}
{{#minimized}}{{#withSearch}}
{{/withSearch}}{{/minimized}}
',A='
{{title}}
',P='
{{#withFavorites}}
'+i(869)+''+i(870)+'
{{/withFavorites}}
{{{title}}}
',k=!TradingView.onWidget()&&n("hide_fundamentals"),o.prototype.destroy=function(){},o.prototype.setup=function(){this._initialized=!1,this._loadMore=null,this._$economyTabInput=null,this._$symbolSearchPopup=null,this._market=null,this._studies=null,this._packagesWithTabNames={},this._pages={},this._tabs={},this._subProductIds={},this.favsChanged=new e,this._previousInviteOnlyStudiesIds=[],this.studiesReady=new $.Deferred,this.marketPagesReady=new $.Deferred,this._pubSearchCount=[0,0,0],this._pubSearchCanLoad=[!0,!0,!0],this._pubSearchEntries=[],this._pubSearchCache=[],this._pubSearchDfd=null,this._pubSearchPageShown=!1,this._w_market_tabs=null,this._w_technical_tabs=null},o.prototype.init=function(){if(this._initialized)return void this.getStudyInfo() ;this.setupMarketInfo(),this.getStudyInfo(),this.setUser(this._user),this.prepareLayout(),this.attachHandlers(),this._initialized=!0},o.prototype.DEFAULT_OPTIONS={onWidget:!1,hideMarketPages:!1,selectBasicPage:!0,minimized:!1,searchKeywords:{earning:RegExp("EPS"),earnings:RegExp("EPS"),"trailing twelve months":RegExp("TTM")}},o.prototype._PAGE_KEY="studyMarket.page",o.prototype._ECONOMY_TAB=$.t("Economy & Symbols"),o.prototype._PUB_SEARCH_ENTRIES_ON_PAGE=20,o.prototype.loadFavorites=function(){this.favsModel.loadFavs()},o.prototype.concretizeOptions=function(){r.enabled("study_market_minimized")&&(this._options.hideMarketPages=!0,this._options.selectBasicPage=!0,this._options.minimized=!0),this._options.onWidget&&(this._options.hideMarketPages=!0)},o.prototype.setupMarketInfo=function(){},o.prototype.getStudyInfo=function(){this._chart.withModel(this,function(){this.setupStudyInfo()})},o.prototype.setupStudyInfo=function(){var t=this._chartWidgetCollection.activeChartWidget.value().model().studiesMetaData();t.length;this._studies={},t=t.filter(function(t){return!this.isHidedStudy(t)},this),t.forEach(function(t){var e,i=this.getStudyPackageName(t.id);!(this._options.minimized&&i!==this._BASIC_STUDIES_PACKAGE_NAME||this._options.onWidget&&(h.isScriptStrategy(t)||i===this._CUSTOM_STUDIES_PACKAGE_NAME))&&(e=this.resolvePackageName(i),a(void 0!==e,"Cannot resolve packageName "+i),this._studies[e]=this._studies[e]||[],this._studies[e].push(t))}.bind(this),this),this.studiesReady.resolve()},o.prototype.setupAddonsInfo=function(){var t,e,i,s,o,n=[],r={};for(t in this._market.products)e=this._market.products[t],pro.hasPackage(t)&&e.subproduct_ids&&e.subproduct_ids[0]&&(i=e.subproduct_ids[0],s=i.split("$")[1],r[s]=t,n.push(ScriptLib.requestPineAddons(s)));return o=this,Promise.all(n).then(function(t){return t.reduce(function(t,e){var i,s;return e&&e.length?(i=e[0].scriptIdPart.split("_")[0],s=[],o._fillScriptsMetainfo(e,s),t[r[i]]=s,t):t},{})})},o.prototype.resolvePackageName=function(t){return t in this._subProductIds?this._subProductIds[t]:t},o.prototype.setUser=function(t){window.is_authenticated?this.setupUserData(t):this.setAnonymous()},o.prototype.setupUserData=function(t){this._user=t,this.loadFavorites(),this.updateMarketPages()},o.prototype.setAnonymous=function(){this.setupUserData(null),this.favsChanged.fire()},o.prototype.isHidedStudy=function(t){var e,i,s;return this._options.onWidget&&(e="IchimokuCloud@tv-basicstudies"===t.id),i=!1,s=!1,!!t.is_hidden_study&&!e||i&&!s},o._breakpointDevice="phone-vertical",o.prototype._switchPagesContainer=function(t,e){this._options.minimized||(t===o._breakpointDevice?this._w_pages.detach().appendTo(this._widget.find(".js-left-panel-wrapper")):e===o._breakpointDevice&&this._w_pages.detach().appendTo(this._widget.find(".js-right-panel")))},o.prototype.prepareLayout=function(){this._widget=$(s.render(E,{withSearch:r.enabled("study_dialog_search_control"),minimized:this._options.minimized})),this._w_tabs=this._widget.find(".js-tabs-container"), this._w_pages=this._widget.find(".js-pages"),this._loadMore=null,this.preparePages(),!this._options.selectBasicPage||this._options.fundamentalsOnly||f.device===o._breakpointDevice&&!this._options.minimized?this._options.fundamentalsOnly&&(f.device!==o._breakpointDevice||this._options.minimized)?this.selectPage(this._FUNDAMENTALS_PAGE_NAME):f.device===o._breakpointDevice&&this.selectPage(""):this.selectPage(this._BASIC_STUDIES_PAGE_NAME),this._scroll=new c(this._widget.find(".js-tabs-viewport"),this._w_tabs,{showBottomShadow:!1});var t='
'+i(873)+'
{{{ title }}}
';this._dialog=d({title:" ",titleTemplate:t,contentWrapTemplate:this._widget,addClass:"tv-insert-indicator-dialog "+(this._options.minimized?"i-minimized":""),width:this._options.minimized?490:842,height:580,withScroll:!1,focusFirstControl:!1,closeOnClickAtOtherDialogs:!1,isClickOutFn:function(t){var e,s=i.c[695];if(s&&(e=s.exports.instance()))return e.isEventOut(t);if(this._$symbolSearchPopup)return this._$symbolSearchPopup[0]!==t.target&&!this._$symbolSearchPopup[0].contains(t.target)&&void 0}.bind(this)}),this._dialog.on("afterClose",this._onDialogClosed.bind(this)),this._dialog.$title.find(".js-back-button").on(Modernizr.touch?"touchend":"click",this.selectPage.bind(this,"")),f.on("changeDevice",function(t,e){t===o._breakpointDevice&&this.currentPage()&&this.currentPage().hasClass("js-marketplace-page")&&this.selectPage(""),t===o._breakpointDevice&&(this._scroll.scrollToStart(),this._updateDialogTitleText()),this._switchPagesContainer(t,e)}.bind(this)),this._switchPagesContainer(f.device,""),this._showHideBackButton(),this.hide()},o.prototype.scrollHandler=function(){var t,e;if(!this._loadMore)return void this._w_pages.off("scroll.loadMoreOnEnd");t=$.map(this._w_pages.children(":visible"),function(t){return $(t).outerHeight(!0)}).reduce(function(t,e){return t+e},0),e=this._widget.find(".js-right-panel").height(),this._w_pages.scrollTop()>t-e-this.SCROLL_TOLERANCE&&(this._w_pages.off("scroll.loadMoreOnEnd"),this._loadMore())},o.prototype._updateDialogTitleText=function(){var t,e,i;if(this._dialog){if(t=""!==this._currentPageTitle,e=f.device!==o._breakpointDevice,!t||e||this._options.minimized)return void this._dialog.setTitleText(this._dialogTitleText);i=this.currentPage(),this._dialog.setTitleText(i.data("fullTitle"))}},o.prototype.currentPage=function(){return this._pages[this._currentPageTitle]},o.prototype.preparePages=function(){this.addSearchPage(),r.enabled("items_favoriting")&&this.addFavoritesPage(),this._options.fundamentalsOnly||this.prepareBasicPage(),this._options.fundamentalsOnly||this.addEconomyPage()},o.prototype.addEconomyPage=function(){var t,e,i=this.addPage(this._ECONOMY_TAB,{withoutTopPadding:!0,noFlex:!0}),s=p({ withoutControls:!0,placeholder:$.t("Symbol"),addClass:"tv-insert-indicator-dialog__economy"});this._$economyTabInput=s.$input,t=new y({labelRight:$.t("Overlay the main chart")}),this._symbolSearch=v(this._$economyTabInput,{keepFocus:!0,clearAfterAccept:!0,callback:function(e){var i=this._chartWidgetCollection.activeChartWidget.value();i&&i.addSymbol(e,t.checked)}.bind(this),onPopupOpen:function(t){this._$symbolSearchPopup=t,this._$symbolSearchPopup.css("z-index",this._dialog.zIndex)}.bind(this),onPopupClose:function(){this._$symbolSearchPopup=null}.bind(this)}),i.append(s.$control),e=$('
'),e.append(t.$el),i.append(e)},o.prototype.addFavoritesPage=function(){this.addPage("Favorites",{localizedTitle:$.t("Favorites")}),this.loadFavorites(),this.updateFavorites()},o.prototype.addInvitesOnlyPage=function(){this.addPage("invitesOnly",{localizedTitle:$.t("Invite-Only Scripts")})},o.prototype.prepareBasicPage=function(){var t=this.addPage(this._BASIC_STUDIES_PAGE_NAME,{packageName:this._BASIC_STUDIES_PACKAGE_NAME,technical:!r.enabled("plain_studymarket")});this._basicPage=t,this.studiesReady.done(function(){this.resetBasicPage()}.bind(this))},o.prototype._applyGlobalFilter=function(t){return this._parentSource&&(t=t.filter(h.canBeChild)),t},o.prototype._applyStrategiesFilter=function(t){var e=this._parentSource?"not_strategies":"none";return"not_strategies"!==e&&"only_strategies"!==e||(t=t.filter(function(t){var i=h.isScriptStrategy(t);return"not_strategies"===e?!i:i})),t},o.prototype.resetBasicPage=function(){var t,e,i=this.getPage(this._BASIC_STUDIES_PAGE_NAME);this._studies&&(t=this._studies[this._BASIC_STUDIES_PACKAGE_NAME]||[],e=this._studies[this._STANDARD_STUDIES_PACKAGE_NAME]||[],t=t.concat(e),t=this._applyStrategiesFilter(t),t=this._applyGlobalFilter(t),this.preparePageStudies(i,t))},o.prototype.resetAllPages=function(){this.resetBasicPage(),this.resetCustomScriptPage(),this.resetPublishedScriptPage(),this.resetInvitesOnlyPage()},o.prototype._fillScriptsMetainfo=function(t,e){var i,s,o;for(i=0;i')},o.prototype._createSubGroupItem=function(t){return $('
').text(t)},o.prototype._createItemsGroup=function(t,e,i){var s,o=this._createItemsList();return this.fillStudies(o,t,i),s=$('
'),e.length&&s.append(this._createSubGroupItem(e)),s.append(o),s},o.prototype.addSearchPage=function(){var t,e,i,s=p({addClass:"tv-insert-indicator-dialog__search-control"});this._tabs.search=s.$control.data("title","search"),this._pages.search=$('