(window.webpackJsonp=window.webpackJsonp||[]).push([["add-compare-dialog"],{"/NcV":function(t,e){t.exports=''},FxnJ:function(t,e,i){},MjtL:function(t,e){t.exports=''},NhD9:function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.createTabbedDialog=function(e){e=$.extend({},s,e);var i=$(t.render('
{{#tabs}}
{{name}}
{{/tabs}}
{{#customControls}}
{{/customControls}}
{{>additionalHeaderContent}}',{tabs:e.tabs,customControls:e.customControls,customControlsAddClass:e.customControlsContainerAddClass},{additionalHeaderContent:e.additionalHeaderContent})),n=$('
'),r=n;e.contentAddClass&&n.addClass(e.contentAddClass);!1!==e.withScroll&&(n=$('
').append(r.addClass("tv-dialog__scroll-wrap-inner")));var l=$('
').append(i).append(n);e.customControls&&i.find(".js-custom-controls").append(e.customControls);if(!0!==e.doNotCreatePages)for(var c=0;c').append(e.tabs[c].page));var d=e.tabStateSaveKey,u=e.activeTab,p=e.tabsScrollBoxAddClass,h=e.tabAddClass;delete e.tabs,delete e.activeTab,delete e.customControls,delete e.tabStateSaveKey,delete e.customControlsContainerAddClass,delete e.tabsScrollBoxAddClass,delete e.tabAddClass,e.closeButtonAddClass="tv-tabbed-dialog__close",e.contentWrapTemplate=l;var b=(0,a.createDialog)(e),f=new o.Tabs(i.find(".tv-tabs").get(0),r.get(0),{addLeftArrowsClass:"tv-tabbed-dialog__tabs-arrow-left",addRightArrowsClass:"tv-tabbed-dialog__tabs-arrow-right",addScrollBoxClass:p,tabClass:h,saveTab:d,activeTab:u});return b.on("afterOpen",(function(){f.setActivePage(f.index(),!0,!0)})),{dialog:b,tabs:f}};var o=i("pIOw"),a=i("YDhE");i("FxnJ");var s={tabs:[]}}).call(this,i("nbsC"))},UnpO:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddSymbolTab=void 0;var o=function(){function t(t,e){for(var i=0;i\n\t\t
\n\t
';e.AddSymbolTab=function(){function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._chartWidgetCollection=e,this._dialog=i,this._$popup=null,this.init()}return o(t,[{key:"init",value:function(){var t=this;this.$tab=$(n),this._$input=this.$tab.find(".js-add-symbol-tab-input"),this._checkbox=new a.AddSymbolCheckbox({labelRight:$.t("Overlay the main chart"),labelAddClass:"tv-add-symbol-tab__checkbox-label",boxAddClass:"tv-add-symbol-tab__checkbox-box"}),this.$tab.find(".js-add-symbol-tab-checkbox").append(this._checkbox.$el),(0,s.symbolSearchUIService)().bindToInput(this._$input,{callback:function(e){var i=t._chartWidgetCollection.activeChartWidget.value();i&&i.addOverlayStudy(e,t._checkbox.checked)},onPopupOpen:function(e){e.css("z-index",t._dialog.getZIndex()),t._$popup=e},onPopupClose:function(){t._$popup=null},keepFocus:!0,clearAfterAccept:!0})}},{key:"focus",value:function(){Modernizr.mobiletouch||this._$input.focus()}},{key:"isClickOnTab",value:function(t){return!!this._$popup&&!(this._$popup[0]!==t.target&&!this._$popup[0].contains(t.target))}}]),t}()},UxRG:function(t,e,i){},dKfe:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddSymbolCheckbox=void 0;var o,a=i("QwKQ"),s=(o=a)&&o.__esModule?o:{default:o};e.AddSymbolCheckbox=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t.checked=TVSettings.getBool("showAddSymbolDialog.checkboxState",!0);var i=function(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}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.$checkbox.change((function(){setTimeout((function(){TVSettings.setValue("showAddSymbolDialog.checkboxState",i.checked)}))})),i}return function(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)}(e,t),e}(s.default)},frtK:function(t,e,i){},jPTo:function(t,e,i){},k47Q:function(t,e,i){},ocUP:function(t,e,i){"use strict";(function(t,o){Object.defineProperty(e,"__esModule",{value:!0}),e.CompareTab=void 0;var a=function(){function t(t,e){for(var i=0;i\n\t
',l='\n\t
\n\t\t\n\t
';e.CompareTab=function(){function e(i,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.selectedSymbols=[],this._chartWidgetCollection=i,this._dialog=o,this._$popup=null,this._predefines={},this._symbolAlias={},this._isBovespa=t.enabled("bovespa_widget"),this._predefines=this._chartWidgetCollection.activeChartWidget.value().compareSymbols()||[],this.init()}return a(e,[{key:"_addCompareSymbol",value:function(t,e,i){var o=this._chartWidgetCollection.activeChartWidget.value();if(o)return this.selectedSymbols.push(t),o.addCompareStudy(t).then((function(t){var e=null!==t;return e&&(0,n.trackEvent)("GUI","Add Compare"),e}))}},{key:"removeCompareSymbol",value:function(t){var e=this,i=this._chartWidgetCollection.activeChartWidget.value();if(i){var o=i.model();o&&(this.selectedSymbols=this.selectedSymbols.filter((function(e){return e!==t})),o.dataSources().forEach((function(i){if(i._metaInfo&&"Compare@tv-basicstudies"===i._metaInfo.id){var a=i.properties().inputs.symbol.value();(a===t||e._symbolAlias[a]&&e._symbolAlias[a]===t)&&o.removeSource(i)}})))}}},{key:"init",value:function(){var t=this,e=this._chartWidgetCollection.activeChartWidget.value();if(e){var i=e.model();if(i){var o=i.dataSources();this.$tab=$(r),this._initSymbolSearch(),this._createPredefinesList();var a=this.$tab.find(".js-compare-tab-predefines");a.find(".js-predefine-checkbox").attr("checked",!1),this._predefines.forEach((function(e){var i=e.symbol,s=t._symbolToId(i),n=a.find("#"+s);o.forEach((function(e){if(e._metaInfo&&"Compare@tv-basicstudies"===e._metaInfo.id){var o=e.properties().inputs.symbol.value();(o===i||t._symbolAlias[o]&&t._symbolAlias[o]===i)&&(n.attr("checked",!0),t.selectedSymbols.push(o))}}))}))}}}},{key:"_initSymbolSearch",value:function(){var t=this;this._$input=this.$tab.find(".js-compare-tab-input"),(0,s.symbolSearchUIService)().bindToInput(this._$input,{callback:function(e){return t._addCompareSymbol(e)},onPopupOpen:function(e){e.css("z-index",t._dialog.getZIndex()),t._$popup=e},onPopupClose:function(){t._$popup=null},keepFocus:!0,clearAfterAccept:!0})}},{key:"_createPredefinesList",value:function(){var t=this,e=this;function i(t){var i=this;setTimeout((function(){$(i).is(":checked")?e._addCompareSymbol(t.data.symbol).then((function(t){ t||$(i).attr("checked",!1)})):e.removeCompareSymbol(t.data.symbol)}))}var a=$('
');this._predefines.forEach((function(e){var s=e.symbol,n=e.title,r=$(o.render(l,{symbolId:t._symbolToId(s),label:n,additionalClass:t._isBovespa?"tv-compare-tab__predefine-cell--wide":""}));r.find(".js-predefine-checkbox").change({symbol:s},i),r.appendTo(a)})),a.appendTo(this.$tab)}},{key:"_symbolToId",value:function(t){return t.replace(/[^a-z0-9]/gi,"_")}},{key:"focus",value:function(){Modernizr.mobiletouch||this._$input.focus()}},{key:"isClickOnTab",value:function(t){return!!this._$popup&&!(this._$popup[0]!==t.target&&!this._$popup[0].contains(t.target))}}]),e}()}).call(this,i("Kxc7"),i("nbsC"))},ohga:function(t,e,i){},pIOw:function(t,e,i){"use strict";i.r(e);i("ohga");var o=i("Eyy1");i("P5fv");function a(){return new Promise((function(t){i.e("lazy-velocity").then(function(e){i("WJ2Z"),t()}.bind(null,i)).catch(void 0)}))}$.fn.velocity=function(){for(var t=this,e=[],i=0;i'+f+""),this._elArrowRight=y(this._options.rArrowClass||"",this._elTabs,"append",'
'+v+"
"),this._addClass(this._elArrowLeft,this._options.addLeftArrowsClass),this._addClass(this._elArrowRight,this._options.addRightArrowsClass)),this._addClass(this._elScrollBox,this._options.addScrollBoxClass),this._addClass(this._elSlider,this._options.addSliderClass),this._addClass(this._elTabs,this._options.tabsContainerClass),this._addClass(this.getTabsArray(),this._options.tabClass),this._addClass(this._elTabs,this._options.loadedClass),this.checkScrollArrows(!0),this._initActivePage(),this._bindEvents()}return t.prototype.getTabsArray=function(){ var t=this._elScrollBox.children;if(!this._options.sliderClass)return Array.prototype.slice.call(t);for(var e=[],i=0;i=1?r(this._elArrowLeft):(e<=1||this._elScrollWrap.scrollWidth<=i)&&l(this._elArrowLeft,s.Left)),this._elArrowRight&&(o-e>1?r(this._elArrowRight):(e>=o||this._elScrollWrap.scrollWidth<=i)&&l(this._elArrowRight,s.Right))},t.prototype.index=function(){var t=this.getElActiveTab();return t?this.getTabsArray().indexOf(t):-1},t.prototype.getElActiveTab=function(){return this._getActiveElement(this.getTabsArray(),this._options.activeTabClass||"",this._options.inactiveTabClass)},t.prototype.getElActivePage=function(){return this._getActiveElement(this.getPagesArray(),this._options.activePageClass||"",this._options.inactivePageClass)},t.prototype.setActivePage=function(t,e,i){if(-1!==t&&(t!==this.index()||i)){var o=this.index();a(this.getTabsArray(),this._options.activeTabClass,this._options.inactiveTabClass),a(this.getPagesArray(),this._options.activePageClass,this._options.inactivePageClass),this._options.noSlider||this.updateSlider(o,t,e),this._options.saveTab&&p.setValue(this._options.saveTab,t),this.tabChanged.fire(t)}function a(e,i,o){e.forEach((function(e,a){var s=t===a;i&&S(e,i,s),o&&S(e,o,!s)}))}},t.prototype.updateSlider=function(t,e,i){var o=this;if(!this._options.noSlider){var s=this.getTabsArray()[e];if(!(0===s.clientWidth||0===s.clientHeight||"none"===window.getComputedStyle(s).getPropertyValue("display"))){var r=window.getComputedStyle(s),l=s.offsetLeft+parseInt(r.getPropertyValue("padding-left")),c=g(s),d=s.querySelector(".js-tabs__slider-pos");if(d){var u=window.getComputedStyle(d);l+=parseInt(u.getPropertyValue("padding-left"))+d.offsetLeft,c-=c-g(d)}(i=i||-1===t||document.all&&!window.atob)?(this._elSlider.style.left=l+"px",this._elSlider.style.width=c+"px"):(this._animating=!0,a().then((function(){$.Velocity.animate(o._elSlider,{left:l},{duration:n.dur,easing:"easeOutCubic",queue:!1}),$.Velocity.animate(o._elSlider,{width:c},{complete:function(){o._animating=!1},duration:n.dur,easing:"easeOutCubic",queue:!1})})))}}},t.prototype.onTabClick=function(t){var e=t.currentTarget||t.target,i=this.getTabsArray().indexOf(e) ;-1===i||this._isTabDisabled(e)||this.setActivePage(i),document.activeElement.blur(),t.preventDefault()},t.prototype.resizeSlider=function(){if(!this._options.noSlider){var t=this._elTabs.offsetWidth;if(t!==this._prevWidth){this._prevWidth=t;var e=this.index();this.updateSlider(e,e,!0)}}},t.prototype.count=function(){return this.getTabsArray().length},t.prototype.add=function(t,e){this._elScrollBox.appendChild(t),this._elPages&&e&&this._elPages.appendChild(e),this._bindTabEvents(t),this.checkScrollArrows(!0)},t.prototype.remove=function(t){function e(t){t.parentElement&&t.parentElement.removeChild(t)}var i=this.tabAt(t);i&&(this._unbindTabEvents(i),e(i));var o=this.pageAt(t);o&&e(o);var a=t-1>=0?t-1:0;this.setActivePage(a),this.checkScrollArrows(!0)},t.prototype.indexOfTab=function(t){return this.getTabsArray().indexOf(t)},t.prototype.indexOfPage=function(t){return this.getPagesArray().indexOf(t)},t.prototype.pageAt=function(t){return this.getPagesArray()[t]||null},t.prototype.tabAt=function(t){return this.getTabsArray()[t]||null},t.prototype.deselect=function(){var t=this.getElActiveTab();this._options.activeTabClass&&t&&C(t,this._options.activeTabClass);var e=this.getElActivePage();return this._options.activePageClass&&e&&C(e,this._options.activePageClass),this._elSlider&&(this._elSlider.style.left="",this._elSlider.style.width=""),this},t.prototype.stop=function(){this._unbindEvents({})},t.prototype._addClass=function(t,e){"string"==typeof e&&(Array.isArray(t)||(t=[t]),t.forEach((function(t){m(t,e)})))},t.prototype._initActivePage=function(){var t=0;this._options.saveTab&&(t=p.getInt(this._options.saveTab,0));var e=this.index();-1!==e&&(t=e),void 0!==this._options.activeTab&&(t=this._options.activeTab),this.setActivePage(t,!0,!0)},t.prototype._bindEvents=function(){var t=this;this.getTabsArray().forEach(this._bindTabEvents.bind(this)),this._bindOneEvent({eventName:"scroll",listener:this.checkScrollArrows.bind(this,!1),target:this._elScrollWrap}),this._elArrowLeft&&this._bindOneEvent({eventName:"click",listener:function(){var e=t.getTabsArray(),i=0,o=!1,s=t._elScrollWrap.scrollLeft;Object(h.isRtl)()&&e.reverse(),e.forEach((function(t){if(!o){var e=t.offsetLeft+t.offsetWidth;e>s?o=!0:i=e}})),a().then((function(){$.Velocity.animate(t._elScrollWrap,"scroll",{axis:"x",container:$(t._elScrollWrap),duration:n.dur/2,easing:"easeInOutCubic",offset:Math.floor(i-s-g(t._elArrowLeft)),queue:!1})}))},target:this._elArrowLeft}),this._elArrowRight&&this._bindOneEvent({eventName:"click",listener:function(){var e=t.getTabsArray(),i=0,s=Object(h.isRtl)()?0:t._elScrollWrap.scrollLeft+g(t._elScrollWrap);Object(h.isRtl)()&&e.reverse(),e.forEach((function(t){if(0===i){var e=t.offsetLeft+t.offsetWidth;e>s&&(i=e)}})),a().then((function(){$.Velocity.animate(t._elScrollWrap,"scroll",{axis:"x",container:$(t._elScrollWrap),duration:n.dur/2,easing:"easeInOutCubic",offset:Math.ceil(i-s+g(Object(o.ensureDefined)(t._elArrowRight))),queue:!1})}))},target:this._elArrowRight}) ;var e=Array.prototype.slice.call(this._elTabs.querySelectorAll(".js-tabs__slider-hover")||[]);e.length&&e.forEach((function(e){return t._bindOneEvent({eventName:"mouseenter",listener:function(e){if(!t._animating){var i=e.currentTarget;i&&t._options.activeTabClass&&w(i,t._options.activeTabClass)&&t._hoverSlider(i)}},target:e})}));var i=null,s=function(){i=null,t.checkScrollArrows(!0),t._options.noSlider||t.resizeSlider()};this._bindOneEvent({eventName:"resize",listener:function(){null===i&&(i=window.requestAnimationFrame(s))},target:window})},t.prototype._bindTabEvents=function(t){var e=this;this._bindOneEvent({eventName:"click",listener:function(t){"function"==typeof e._options.onTabClick?e._options.onTabClick(t):e.onTabClick(t)},target:t})},t.prototype._unbindTabEvents=function(t){this._unbindEvents({target:t})},t.prototype._bindOneEvent=function(t){t.target.addEventListener(t.eventName,t.listener),this._bindings.push(t)},t.prototype._unbindEvents=function(t){var e=function(e){return!(void 0!==e.eventName&&e.eventName!==t.eventName||void 0!==e.target&&e.target!==t.target||void 0!==e.listener&&e.listener!==t.listener)};this._bindings.filter(e).forEach((function(t){return t.target.removeEventListener(t.eventName,t.listener)})),this._bindings=this._bindings.filter((function(t){return!e(t)}))},t.prototype._getActiveElement=function(t,e,i){return t.filter((function(t){return e?w(t,e):!!i&&!w(t,i)}))[0]||null},t.prototype._isTabDisabled=function(t){return w(t,"i-disabled")||this._options.tabDisabledClass&&w(t,this._options.tabDisabledClass)||t.hasAttribute("disabled")},t.prototype._hoverSlider=function(t){var e=this,i=g(t),o=window.getComputedStyle(t),s=t.offsetLeft+parseInt(o.getPropertyValue("padding-left"))+parseInt(o.getPropertyValue("margin-left")),r={duration:n.dur/4,easing:"easeOutCubic",queue:!1};a().then((function(){$.Velocity.animate(e._elSlider,{left:s},r),$.Velocity.animate(e._elSlider,{width:i},r)}));var l=function(){e.getElActiveTab()===t&&e._unhoverSlider(t),t.removeEventListener("mousleave",l)};t.addEventListener("mouseleave",l)},t.prototype._unhoverSlider=function(t){var e=this,i=window.getComputedStyle(t),o=t.querySelector(".js-tabs__slider-pos"),s=window.getComputedStyle(o),r=t.offsetLeft+parseInt(i.getPropertyValue("padding-left"))+parseInt(i.getPropertyValue("margin-left"))+parseInt(s.getPropertyValue("padding-left"))+o.offsetLeft,l=g(t),c=l-(l-g(o)),d={duration:n.dur/2,easing:"easeInSine",queue:!1};a().then((function(){$.Velocity.animate(e._elSlider,{left:r},d),$.Velocity.animate(e._elSlider,{width:c},d)}))},t}();function g(t){if(0===t.offsetWidth)return 0;var e=window.getComputedStyle(t);return t.offsetWidth-parseFloat(e.getPropertyValue("padding-left"))-parseFloat(e.getPropertyValue("padding-right"))-parseFloat(e.getPropertyValue("border-left-width"))-parseFloat(e.getPropertyValue("border-right-width"))}function y(t,e,i,o){var a=e.querySelector("."+t);if(!a){var s=document.createElement("div");if(s.innerHTML=o||'
',a=s.firstElementChild,"append"===i)e.appendChild(a);else{ if("wrapInner"!==i)throw new Error("Unknown insertMethod");for(var n=Array.prototype.slice.call(e.childNodes),r=0;r