").appendTo(h),t.enabled("link_to_tradingview")&&$('').append(r).appendTo(d),o&&a.addClass("on-pane")}:function(e,i,o){if(t.enabled("link_to_tradingview")){i=i||chartWidget._jqMainDiv,$(i).find(".onchart-tv-logo").remove();var n=$('').appendTo(i);t.enabled("minimalistic_logo")?n.on("mouseenter",function(){$(this).addClass("expanded")}).on("mouseleave",function(){$(this).removeClass("expanded")}):n.addClass("expanded"),o&&n.addClass("on-pane")}},P=t.enabled("widget_logo"),P&&(chartWidget.createLogo=v,t.enabled("show_logo_on_all_charts")&&(a.createLogo=v.bind(this)),t.enabled("move_logo_to_main_pane")||chartWidget.withModel(null,v)),urlParams.toolbarbg&&/^[0-9a-f]+$/i.test(urlParams.toolbarbg)&&$("'},function(t,e,i){"use strict";function o(t){r.call(this,t);var e=this;l.hideMarksOnBars().subscribe(this,function(){e._properties.visible.setValue(!l.hideMarksOnBars().value())})}function n(t){a.call(this)}var s=i(393),r=s.BarsMarksContainer,a=s.BarMarkTooltip,l=i(206);inherit(o,r),o.prototype._initialize=function(t){this._properties.visible.setValue(!0)},o.prototype.userEditEnabled=function(){return!1},o.prototype._constructor="UserDefinedBarsMarks",o.prototype._plateViewData=function(t){var e={text:t.text};return"object"==typeof t.color&&(e.theme="user_defined_theme",e.overridedTheme={},e.overridedTheme.border=t.color.border,e.overridedTheme.background=t.color.background),e},o.prototype.onClicked=function(){var t=this._model.lastHittestData().id;this._marks[t].onClicked()},o.prototype.clearMarks=function(){r.prototype.clearMarks.call(this),this.onNeedRepaint.fire()},o.prototype._getData=function(t){var e,i,o,n=this._model.mainSeries().symbolInfo();n&&(e=this.roundRange(this._rangeDifference(t)),i=this,o=this._model.mainSeries().properties().interval.value(),ChartApiInstance.getMarks(n,e.start,e.end,function(e){e.forEach(function(t){i._marks[t.id]=t},i),i._loadedRange=i._rangeUnion(t,i._loadedRange),i.onNeedRepaint.fire()},o))},
o.prototype._createTooltip=function(){return new n},o.prototype.updatePlateData=function(t,e){return e.barWidth=this.barWidth(),e.text=t.text,e.tooltipMargin=-1*Math.max(t.minSize/2,.4*this.barWidth()),e},o.prototype.hasContextMenu=function(){return!1},inherit(n,a),n.prototype._createLayout=function(){this._layout=$(''),this._layout_text=$('').appendTo(this._layout)},n.prototype._updatePlate=function(t){this._currentId=t.id,this._layout.css("border-color",t.theme.border),this._layout.css("margin-top",t.tooltipMargin+"px"),this._layout_text.html(t.text),this._layout.append(this._layout_text)},t.exports=o},function(t,e,i){(function(e){"use strict";function o(t,i,o){s.call(this,t),this._origState=i,this._title=o;var a={visible:!0};this._properties=new e(a),this._statusView=new n(this,t.properties()),this._status=$.t("compiling..."),this._statusView.setText(this._title+" "+this._status),this._formatter=new r(Math.pow(10,2)),this._failed=!1}var n=i(302),s=i(202).PriceDataSource,r=i(210).PriceFormatter;inherit(o,s),o.prototype.properties=function(){return this._properties},o.prototype.statusView=function(){return this._statusView},o.prototype.state=function(t){return this._origState},o.prototype.setStatus=function(t){this._status=t,this._statusView.setText(this._title+" "+this._status)},o.prototype.formatter=function(){return this._formatter},o.prototype.title=function(){return this._title},o.prototype.setFailed=function(t){this._failed=t},o.prototype.start=function(t){},o.prototype.firstValue=function(t){return null},t.exports=o}).call(e,i(195))},function(t,e){t.exports={STATUS_OFFLINE:0,STATUS_RESOLVING:1,STATUS_LOADING:2,STATUS_READY:3,STATUS_INVALID_SYMBOL:4,STATUS_SNAPSHOT:5,STATUS_EOD:6,STATUS_PULSE:7,STATUS_DELAYED:8,STATUS_DELAYED_STREAMING:9,STATUS_NO_BARS:10}},function(t,e,i){"use strict";TradingView.PublishedChartsTimeline=function(){},TradingView.LinearRegressionPaneView=function(){},TradingView.study_PivotPointsStandard=function(){},TradingView.study_PivotPointsHighLow=function(){},TradingView.study_ZigZag=function(){},TradingView.study_LinearRegression=function(){},TradingView.study_ElliottWave=function(){},TradingView.ESDStudyBase=function(){},TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.getStudies=function(){return[]},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]},TradingView.LineToolRegressionTrend=function(){},TradingView.templates=i(185),TradingView.templates.dialogs={symbolSearch:''},TradingView.AlertLabel=function(){},TradingView.getDataVendorString=function(){},window.Telemetry={sendReport:function(){}},
TradingView.study_VbPVisible=function(){},TradingView.study_VbPSessions=function(){},TradingView.LineToolVbPFixed=function(){},TradingView.study_ESD$TV_DIVIDENDS=function(){},TradingView.study_ESD$TV_SPLITS=function(){},TradingView.study_ESD$TV_EARNINGS=function(){},TradingView.MockupRequestedCache=function(t){t&&t([])},TradingView.MockupRequestedCache.invalidate=function(){},TradingView.StudyStrategy=function(){},TradingView.LinetoolTemplatesList=function(){},window.PublishedScript={suggest:function(){var t=$.Deferred();return t.resolve(null),t}}},function(t,e,i){"use strict";var o=i(66),n=i(50).parseJSONorNot,s=function(){var t,e,i,s,r={};return r.initialize=function(o,n,r,a){t=o,e=n,i=r,s=a},r.updateUser=function(t){e=t},r.getCharts=function(o,r){return $.ajax({url:"{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e)),type:"GET",crossDomain:!0}).done(function(t){var e,i=n(t);"ok"!==i.status&&console.warn("Charts list request failed: "+i.message),e=i.data.map(function(t){return{id:t.id,name:t.name,image_url:t.id,modified_iso:t.timestamp,short_symbol:t.symbol,interval:t.resolution}}),o(e)}).fail(r)},r.removeChart=function(o,r){$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o)),type:"DELETE",crossDomain:!0}).done(function(t){var e=n(t);"ok"!==e.status&&console.warn("Chart delete request failed: "+e.message),r()})},r.saveChart=function(o,r,a,l,h,c,d){var p=h.id.value(),u="{0}/{1}/charts?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e));void 0!==p&&(u+="&chart="+encodeURIComponent(p)),$.ajax({url:u,data:{name:o,content:JSON.stringify(l),symbol:r,resolution:a},type:"POST",crossDomain:!0}).done(function(t){var e=n(t);if("ok"!==e.status)return console.warn("Chart save request failed: "+e.message),void d();c(e.id)}).fail(function(){d()})},r.getChartContent=function(o,r,a){$.ajax({url:"{0}/{1}/charts?client={2}&user={3}&chart={4}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o.id)),type:"GET",crossDomain:!0}).done(function(t){var e,i=n(t);if("ok"!==i.status)return void console.warn("Chart load request failed: "+i.message);e=JSON.parse(i.data.content),e.uid=o.id,r(e)}).fail(function(){a&&a()})},r.loadChart=function(t){r.getChartContent(t,function(t){o.emit("chart_load_requested",t)},function(){console.warn("Error loading chart")})},r.removeStudyTemplate=function(o,r){$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}&template={4}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o)),type:"DELETE",crossDomain:!0}).done(function(t){var e=n(t);"ok"!==e.status&&console.warn("Chart delete request failed: "+e.message),r()})},r.getStudyTemplateContent=function(o,r){$.ajax({
url:"{0}/{1}/study_templates?client={2}&user={3}&template={4}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e),encodeURIComponent(o)),type:"GET",crossDomain:!0}).done(function(t){r(n(t).data)})},r.saveStudyTemplate=function(o,r){$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e)),type:"POST",crossDomain:!0,data:{name:o.name,content:o.content}}).done(function(t){var e=n(t);"ok"!==e.status&&console.warn("Template save request failed: "+e.message),r({error:"ok"===e.status?"":e.status})})},r._templatesCache=null,r.getStudyTemplatesList=function(o){if(r._templatesCache)return void o(r._templatesCache);r._templatesCache=[],$.ajax({url:"{0}/{1}/study_templates?client={2}&user={3}".format(i,encodeURIComponent(s),encodeURIComponent(t),encodeURIComponent(e)),type:"GET",crossDomain:!0}).done(function(t){var e,i;if(null!==r._templatesCache){if(e=n(t),"ok"!==e.status)return void console.warn("Templates list request failed: "+e.message);i=e.data.map(function(t){return{is_default:!1,name:t.name}}),r._templatesCache=i,o(i)}})},r.invalidateStudyTemplatesList=function(){r._templatesCache=null},r}();t.exports=s},function(t,e,i){(function(t,o,n){"use strict";function s(e){this._chartWidgetCollection=e,this._chartAboutToBeSavedDelegate=new t,this._chartSavedDelegate=new t}function r(t,e,i,o){var s,r,a;o=o||{},s={wl:o.wl,images:JSON.stringify(t.images()),previews:o.previews},r=t.activeChartWidget.value().widgetCustomer(),r&&(s.customer=r),s.timezone=t.activeChartWidget.value()._properties.timezone.value(),window.urlParams&&window.urlParams.locale&&(s.language=urlParams.locale),a=n.enabled("charting_library_base")?o.snapshotUrl||"https://www.tradingview.com/snapshot/":"/snapshot/",$.post(a,s,function(t){t?e(t):i()}).fail(function(){i()})}var a=i(403);s.prototype.chartAboutToBeSaved=function(){return this._chartAboutToBeSavedDelegate},s.prototype.chartSaved=function(){return this._chartSavedDelegate},s.prototype.whenReadyToSave=function(t){var e,i,o=this._chartWidgetCollection,n=o.activeChartWidget.value(),s=n.model().mainSeries();s.symbolInfo()&&!s.hasDelayedSymbolIntervalChange()?t():(e=null,i=null,e=function(){s.onSymbolError().unsubscribe(null,i,!0),t()},i=function(){s.onSymbolResolved().unsubscribe(null,e,!0)},s.onSymbolResolved().subscribe(null,e,!0),s.onSymbolError().subscribe(null,i,!0))},s.prototype.saveToJSON=function(){return this._fillSavingInfo(!1,!0)},s.prototype._fillAsyncInfo=function(t,e,i){function o(e){t.content=JSON.stringify($.extend(!0,s,e)),n.resolve(t)}var n,s=JSON.parse(t.content),r=this._chartWidgetCollection;return e||(i=!0),n=$.Deferred(),i?r.asyncState(!!e).then(o):r.activeChartWidget.value().asyncState(!!e).then(o),n.promise()},s.prototype._fillSavingInfo=function(t,e,i){var o,n,s,r,a,l,h,c,d,p,u,_,f,m;if(t||(e=!0),o={publish_request_id:Math.random().toString(36).substring(2)},n=this._chartWidgetCollection,s=n.activeChartWidget.value(),r=n.metaInfo,a=s.model().mainSeries(),l=a.properties(),
h=a.symbolInfo(),!a||!r||!h)throw new ReferenceError("Missed required data");for(r.id.value()&&(o.id=r.id.value()),o.name=r.name.value()||"",o.description=r.description.value()||"",o.resolution=a.properties().interval.value(),o.symbol_type=h.type||"",o.exchange=h.exchange||"",o.listed_exchange=h.listed_exchange||"",a.isSpread()?(c=h.legs[0],d=h.base_name[0],d=d.split(":")[1],o.symbol=c,o.short_name=d,o.expression=h.full_name):(p=h.ticker||l.symbol.value(),u=l.shortName.value(),o.symbol=p,o.short_name=u),_=[],f=0,m=h.legs.length;f'+c+""),d={html:!0}),e.showError(n||$.t("Error occured while publishing"),d)),a.hWnd&&(a.hWnd.close(),a.hWnd=null))}var n,s,r,a=this;a.publishInProgress||(n=a._fillSavingInfo(!0,e&&e.publishAllLayout,!0),a._fillAsyncInfo(n,!0,e&&e.publishAllLayout).then(function(e){var o=t.scriptPublication;new Promise(function(e,i){o?ScriptLib.publishNew(o.scriptSource,o.scriptProtection).done(function(i){delete t.scriptPublication,o.scriptProtection===TVScript.Access.ACCESS_CLOSED_NEEDS_AUTH&&PinePerm.add(window.user.username,i.pineId),e(i.publishedstudyscript_id)}).fail(function(){i()}):e()}).then(function(o){o&&(t.publishedstudyscript_id=o),$.ajax({url:"/publishchart/",type:"post",dataType:"text",data:$.extend({},e,t),complete:i})})}),a.publishInProgress=!0,e.onWidget&&!e.ideaUrl||""!==t.name&&""!==t.description&&t.description.length<=4e3&&t.name.length<=64&&($.cookie("publish_request_id",n.publish_request_id,{path:"/"}),s="/loading/",e.ideaUrl&&(r=urlParams.createUrlParams({ideaUrl:e.ideaUrl}),s="/loading?"+r),a.hWnd=window.open(s,"_blank")))},s._saveChart=function(t,e,i,o,n){var s=i,r=o;return s=function(t){e.id.value()||(e.id.setValue(t),e.uid.setValue(t)),"function"==typeof i&&i()},a.saveChart(t.name,t.short_name,t.resolution,t,e,s,r)},s.prototype.saveChartSilently=function(t,e,i,o){
var n=this._chartWidgetCollection.metaInfo,r=this._fillSavingInfo(e);if(o=o||{},o.chartName&&(r.name=o.chartName),r.name&&0!==r.name.length||!o.defaultChartName||(r.name=o.defaultChartName),!r.name)return void console.warn("Saving chart with empty name is not allowed");$(window).on("beforeunload.savechart",function(){return $.t("Your chart is being saved, please wait a moment before you leave this page.")}),this._chartAboutToBeSavedDelegate.fire(),s._saveChart(r,n,function(){this._chartWidgetCollection.metaInfo.name.setValue(r.name),this._chartSavedDelegate.fire(!0),t&&t(n)}.bind(this),function(){this._chartSavedDelegate.fire(!1),i&&i.apply(null,arguments)}.bind(this),o),$(window).off("beforeunload.savechart")},e.ChartSaver=s,e.takeSnapshot=r}).call(e,i(56),i(72),i(1))},function(t,e,i){"use strict";t.exports=i(401)},function(t,e,i){(function(e){"use strict";function o(t,e){d.invalidateStudyTemplatesList(),d.removeStudyTemplate(t,e)}function n(t){this._options=t||{},this._chartWidgetCollection=this._options.chartWidgetCollection,this._SAVE_AS_TITLE=$.t("Save Study Template As..."),this._list=[],this._$wrapper=null,this._favoredList=null,this._loaded=!1,this._onFirstLoad=new e,this.onFavoriteListResize=new e,loginStateChange.subscribe(this,this.onLoginStateChange)}var s=i(405).FavoredList,r=i(408),a=r.SaveRenameDialog,l=r.CheckboxField,h=r.AutocompleteField,c=i(433).createConfirmDialog,d=i(403),p=i(65).trackEvent;n.prototype.onLoginStateChange=function(){d.invalidateStudyTemplatesList(),this.refreshFavoriteDropdownMenu()},n.prototype.appendMenuButtonTo=function(t){t&&(this._$wrapper=t,this._generateFavoriteList())},n.prototype.refreshStudyTemplateList=function(t){var e=this;d.getStudyTemplatesList(function(i){e._list=i||[],"function"==typeof t&&t()})},n.prototype._generateFavoriteList=function(){var t=this;this._favoredList=new s("StudyTemplates",t._listPreparedForFavorite(),{addClass:"study-template-widget",popupAddClass:"study-template-popup",notShowActive:!0,svg:!1,popupSpacing:this._options.popupSpacing,notShowQuicks:this._options.notShowQuicks,tooltip:$.t("Study Templates"),addTooltipClass:"apply-common-tooltip"}),t.refreshFavoriteDropdownMenu(),this._favoredList.element().appendTo(this._$wrapper),this._favoredList.onSelect().subscribe(t,function(t){t!==this._SAVE_AS_TITLE&&this.applyStudyTemplate(t)}),this._favoredList.onSelect().subscribe(t,function(t){t===this._SAVE_AS_TITLE&&this.showSaveAsDiaolg()}),this._favoredList.onResize().subscribe(t._chartWidgetCollection,t._chartWidgetCollection.updateLayout),this._favoredList.onResize().subscribe(this.onFavoriteListResize,this.onFavoriteListResize.fire),this._favoredList.onOpen().subscribe(t,function(){t.refreshFavoriteDropdownMenu()})},n.prototype._listPreparedForFavorite=function(t){var e,o,n,s,r;return t=t||this._list,e=this,o=this.plainList("default"),n=this.plainList("custom"),s=[{id:e._SAVE_AS_TITLE,title:e._SAVE_AS_TITLE,addClass:"special",toQuickButtonStyle:{display:"none"}},{separator:!0}],r=function(t,o){return $.map(t,function(t){var n={id:t,title:$.t(t),
svg:$(i(407)).attr({width:13,height:13}),favoriteButton:{icon:{},title:t,addClass:"apply-common-tooltip"}};return o&&(n.drop=function(){this.deleteStudyTemplate(t)}.bind(e)),n})},n.length&&(s=s.concat(r(n,!0)).concat([{separator:!0}])),s=s.concat(r(o))},n.prototype.applyStudyTemplate=function(t){function e(e){p("GUI","Load Study Template"),i.model().model().restoreStudyTemplate(JSON.parse(e.content),t),i.updateSeriesControlUI()}var i=this._chartWidgetCollection.activeChartWidget.value();TVSettings.setValue("defaultStudyTemplate",t),d.getStudyTemplateContent(t,e)},n.prototype.showSaveAsDiaolg=function(){var t=this,e=this._chartWidgetCollection.activeChartWidget.value(),i=function(i,o){var n,s,r,a,l,h;i=TradingView.clean(i),n=JSON.stringify(e.model().model().studyTemplate(o)),s={name:i,content:n},r=-1!==$.inArray(i,t.plainList()),a=function(){var e=function(e){e.error||(TVSettings.setValue("defaultStudyTemplate",i),d.invalidateStudyTemplatesList(),t.refreshFavoriteDropdownMenu())};d.saveStudyTemplate(s,e)},r?(l=$.t("Study Template '{0}' already exists. Do you really want to replace it?").format(i),h=c({type:"modal",content:l}),h.on("action:yes",function(t){a(),t.close()}),h.open()):a()};runOrSignIn(function(){var o="text",n="bool";t.refreshStudyTemplateList(function(){new a({fields:[new h({name:o,label:$.t("Template name")+":",error:$.t("Please enter template name"),source:t.list(),valueField:"name",textField:"name",maxLength:64}),new l({name:n,label:$.t("Save Interval"),hint:$.t('When selecting this checkbox the study template will set "__interval__" interval on a chart',{interval:e.model().model().mainSeries().interval()})})],title:$.t("Save Study Template As")}).show().then(function(t){i(t[o],t[n])})})},{source:"Study templates save as",sourceMeta:"Chart"})},n.prototype.refreshFavoriteDropdownMenu=function(){var t=this,e=this._favoredList;e&&t.refreshStudyTemplateList(function(){e.reload(t._listPreparedForFavorite()),e.element().hasClass("active")&&(e.element().trigger("click"),e.openMenu())})},n.prototype.deleteStudyTemplate=function(t){var e=this,i=$.t("Do you really want to delete Study Template '{0}' ?").format(t);runOrSignIn(function(){var n=c({type:"modal",content:i});n.on("action:yes",function(i){e._favoredList.removeById(t),i.actionLoader("yes","start"),o(t,function(){setTimeout(function(){e.refreshFavoriteDropdownMenu(),i.actionLoader("yes","stop"),i.close()},0)})}),n.open()},{source:"Study templates delete"})},n.prototype.container=function(){return this._favoredList?this._favoredList.element():null},n.prototype.list=function(){return this._list},n.prototype.plainList=function(t){return"default"===t?$.map(jQuery.grep(this._list,function(t){return!!t.is_default}),function(t){return t.name}):"custom"===t?$.map(jQuery.grep(this._list,function(t){return!t.is_default}),function(t){return t.name}):$.map(this._list,function(t){return t.name})},t.exports=n}).call(e,i(56))},function(t,e,i){"use strict";var o,n,s,r,a,l,h,c;i(26),i(5),o=i(55),n=i(58),s=i(406),r=i(62),a=i(56),l=i(407),h=i(177),c=function(){
function t(t,e,i){return void 0===i&&(i={}),this._container=$(''),this._quickContainer=$(' ').appendTo(this._container),this._onChange=new a,this._onSelect=new a,this._onResize=new a,this._onOpen=new a,this._active=null,this._data=[],this._list=[],this._quicks=[],this._options=i=i,this._name=t,i.addClass&&this._container.addClass(i.addClass),this._submenu=$('").appendTo(this._container),i.tooltip&&(this._submenu.attr("title",i.tooltip),i.addTooltipClass&&this._submenu.addClass(i.addTooltipClass)),this._load(e),s.bindPopupMenu(this._container,null,{addClass:"narrow favored-list "+(i.popupAddClass||""),direction:"down",event:"popup-menu",popupSpacing:i.popupSpacing,reverse:!0,svg:null==i.svg||i.svg}),this._submenu.on("click",this.openMenu.bind(this)),n.TVXWindowEvents.on(t+"-change",this._onChangeInAnotherTab.bind(this)),this}return t.prototype.element=function(){return this._container},t.prototype.onChange=function(){return this._onChange},t.prototype.onSelect=function(){return this._onSelect},t.prototype.onResize=function(){return this._onResize},t.prototype.onOpen=function(){return this._onOpen},t.prototype.setValue=function(t){var e=this._getItemByValue(t);this._setActive(e)},t.prototype.value=function(){return this._active?this._active.data.value:void 0},t.prototype.removeById=function(t){var e=this,i=this._data.filter(function(e){return!e.separator&&e.id!==t});this._list.forEach(function(i){i.data.id===t&&e._toggleFavorite(i,!1)}),this.reload(i)},t.prototype.reload=function(t){this._quickContainer.empty(),this._load(t)},t.prototype.openMenu=function(){this._submenu.parent().hasClass("active")||this._onOpen.fire(),this._submenu.trigger("popup-menu",[this._data])},t.prototype._onChangeInAnotherTab=function(){this.reload(this._data)},t.prototype._load=function(t){var e=this;this._options.showJustDefaultQuicks?this._quicks=this._options.defaultFavorites||[]:this._options.notShowQuicks?this._quicks=[]:this._quicks=o.getJSON(this._name+".quicks",this._options.defaultFavorites||[]),this._list=[],t.filter(function(t){return!t.separator}).forEach(function(t,i){var o,n={data:t,drop:function(){n.data.drop&&n.data.drop()},favorite_button:null,index:i,isFavorite:function(){return e._quicks.indexOf(t.id)>-1},markFavorite:function(){n.toQuickButton&&n.toQuickButton.attr("title",$.t("Remove from favorites")).addClass("quicked")},svg:t.svg&&$(t.svg).clone(),toQuickButton:e._options.notShowQuicks?null:$('').append($(l).attr({height:16,width:16})),toggleFavorite:function(t,i){var o=void 0!==t?t:!n.isFavorite();o?n.markFavorite():n.unmarkFavorite(),e._toggleFavorite(n,o,i)},unmarkFavorite:function(){n.toQuickButton&&n.toQuickButton.attr("title",$.t("Add to favorites")).removeClass("quicked")}};n.data.toQuickButtonStyle&&n.toQuickButton&&n.toQuickButton.css(n.data.toQuickButtonStyle),e._list.push(n),t.action=e._change.bind(e,n),t.active=e._options.notShowActive?function(){return!1
}:function(){return!(!e._active||n!==e._active)},t.buttons=[],e._options.notShowQuicks||t.buttons.push({el:n.toQuickButton,handler:function(t){n.toggleFavorite(),t.preventDefault(),t.stopPropagation()}}),n.data.drop&&(o=$("").addClass("delete").attr("title",$.t("Delete")).html(h),e._options.notShowQuicks&&o.css("right","7px"),t.buttons.push({el:o,handler:function(t){n.drop(),t.stopPropagation()}})),n.toggleFavorite(n.isFavorite(),!0)}),this._data=t,this._options.notShowActive||this._addActive(this._list[0]),this._onResize.fire()},t.prototype._toggleFavorite=function(t,e,i){if(!this._options.notShowQuicks||this._options.showJustDefaultQuicks){if(e){t.favorite_button=this._createButton(t);var o=this._lastFavoriteButton(t);o?t.favorite_button.insertAfter(o.favorite_button):t.favorite_button.prependTo(this._quickContainer)}else i||this._removeButton(t);i||(e?-1===this._quicks.indexOf(t.data.id)&&this._quicks.push(t.data.id):this._quicks.indexOf(t.data.id)>-1&&this._quicks.splice(this._quicks.indexOf(t.data.id),1),this._saveFavorite(),this._markActive(),this._onResize.fire())}},t.prototype._lastFavoriteButton=function(t){for(var e=t.index-1;e>=0;e--)if(this._list[e]&&this._list[e].favorite_button)return this._list[e];return null},t.prototype._saveFavorite=function(){this._options.notShowQuicks||(o.setJSON(this._name+".quicks",this._quicks),n.TVXWindowEvents.emit(this._name+"-change"))},t.prototype._createButton=function(t){var e=this,i=t.data.favoriteButton,o=$("").data("item",t);return i.addClass&&o.addClass(i.addClass),i.title&&o.prop("title",r.clean(i.title+"",!0)),t.svg&&$(t.svg).clone().appendTo(o),o.on("click",function(i){e._change(t),0===e._quicks.length&&e.openMenu(),i.preventDefault()}),o},t.prototype._removeButton=function(t){t.favorite_button&&(t.favorite_button.remove(),t.favorite_button=null)},t.prototype._markActive=function(t){var e,i,o=this;this._options.notShowActive||(e=null,this._active&&(t=this._active,t.isFavorite()?(i=this._quickContainer.find(".just_active"),this._btnToggleActiveView(i,!1)):(e=this._addActive(t),0!==this._quicks.length&&this._btnToggleActiveView(e,!0))),this._list.forEach(function(e){t!==e||0===o._quicks.length?o._btnToggleActiveView(e.favorite_button,!1):e.favorite_button&&o._btnToggleActiveView(t.favorite_button,!0)}),e&&e.hasClass("selected")?this._container.addClass("not-favored-active"):this._container.removeClass("not-favored-active"))},t.prototype._btnToggleActiveView=function(t,e){t&&(e?t.addClass("selected"):t.removeClass("selected"))},t.prototype._addActive=function(t){return this._quickContainer.find(".just_active").remove(),this._createButton(t).appendTo(this._quickContainer).addClass("just_active")},t.prototype._setActive=function(t){return this._active!==t&&(this._active=t,this._markActive(),!0)},t.prototype._change=function(t){this._onSelect.fire(t.data.id),this._setActive(t)&&this._onChange.fire(t.data.id)},t.prototype._getItemByValue=function(t){for(var e in this._list)if(this._list[e].data.id===t)return this._list[e]
;throw Error("undefined value "+t+" in FavoredList")},t}(),e.FavoredList=c},function(t,e,i){"use strict";var o,n=function(t,e,o){var s,r,a,l,h,c;t=$(t),o=o||{},o.activeClass=o.activeClass||"",s=(o.event||"click")+".popup-menu",o.hideEvent&&(r=o.hideEvent+".popup-menu"),a=function(){},l=a,h={},c=function(s,r,c){function d(e){var i=$(e.target).parents().andSelf();i.is(f)||i.is(t)||i.is(".charts-popup-tab-headers, .charts-popup-itemheader")||l()}function p(t){var e=$(t.target).parents().andSelf();e.is(".charts-popup-tab-headers, .charts-popup-itemheader")||o.notCloseOnButtons&&e.is(".icon-delete")||l()}function u(e,s,r){var a,l,h,c,d,p,_,m,g,v,y,b,w,S,T;if(e instanceof n.TabGroup){if(!e.tabs||!e.tabs.length)return;return 1!==e.tabs.length||e.tabs[0].title?(a=$('').appendTo(r),l=$('').appendTo(a),h=null,void $.each(e.tabs||[],function(t,i){var o,n;i.items&&i.items.length&&(o=$('').hide().appendTo(a),$.each(i.items,function(){u(this,void 0,o)}),n=$(' ').text(e.title)):e.separator?(p=$(' '),void r.append(p)):(p=$(' '),e.url&&p.attr("href",e.url),e.target&&p.attr("target",e.target),s||p.addClass("first"),"function"==typeof e.active?e.active(e)&&p.addClass("active"):e.active&&p.addClass("active"),e.addClass&&p.addClass(e.addClass),e.addData&&p.data(e.addData),e.disabled&&p.addClass("disabled"),"function"==typeof e.action&&(_=e.action,m=function(t){$(t.target).parents().andSelf().is(S)||(_.apply(p,arguments),!e.url&&t&&"function"==typeof t.preventDefault&&t.preventDefault())},o.upAction?p.bind("mouseup",m):p.bind("click",m)),
e.date?(g=$('').appendTo(p),$('').text(e.date||"").appendTo(p)):e.icon&&!o.svg?(v=$('').appendTo(p),v.css("background-image",e.icon.image||""),e.icon.offset&&v.css("background-position","string"==typeof e.icon.offset?e.icon.offset:e.icon.offset.x+"px "+e.icon.offset.y+"px"),g=$('').appendTo(p)):!0===o.svg&&e.svg?(o.wrapIcon?p.append($('').append(e.svg)):p.append(e.svg),g=$('').appendTo(p)):e.iconClass?(p.append($('').addClass(e.iconClass)),g=$('').appendTo(p)):g=$('').appendTo(p),e.html?g.html(e.html):g.text(TradingView.clean(e.title,!0)||""),y=$('').appendTo(p),e.shortcut&&y.text(e.shortcut.keys),"function"==typeof e.deleteAction&&(b=e.deleteAction,w=e.deleteAction.title||$.t("Delete"),S=$(''),S.html(i(177)),S.attr("title",w),S.on("click",function(t){b.apply(p,arguments),t.preventDefault()}),p.append(S)),e.buttons instanceof Array&&e.buttons.length&&e.buttons.forEach(function(t){t.el instanceof $||(t.el=$(t.el)),t.el.appendTo(p),t.handler&&t.el.on("click",function(e){t.handler.apply(p,arguments)})}),void 0!==e.counter&&(T=e.counterBlue?"blue":"",$('').text(e.counter+"").addClass(T).appendTo(p)),r.append(p),void t.data("popup-menu",r))}var _,f,m,g,v,y,b,w,S,T,C,x,P,L,k,I,A,E,M,D,V,O,B,R,N,F,z=r||e;if("function"==typeof z&&(z=z()),$(this).hasClass("open")||$(this).hasClass("active"))return s.preventDefault(),l(),void(_=h.scrollTop);switch(l=function(){h.scrollTop=f.scrollTop(),f.remove(),t.removeClass("active open "+o.activeClass),t.data("popup-menu",null),$(document).off("click",p),$(document).off("mousedown",d),Modernizr.touch&&$(document).off("touchstart.chartgui",d),$(document).off("selectstart.popup-menu"),l=a,o.onRemove&&o.onRemove()},t.addClass("active open "+o.activeClass),f=$(' |