From 7430464cb2fabfbbd03288ecafcb5cd4ae36b720 Mon Sep 17 00:00:00 2001 From: "jenkins@tradingview.com" Date: Thu, 16 Sep 2021 11:42:12 +0000 Subject: [PATCH] Release v20.029 (from c7e6d52b) --- ...477abd4.html => ar-tv-chart.c7e6d52b.html} | 2 +- ...123.js => library.83b78f9d405377ddcb47.js} | 106 +++++++++--------- charting_library/charting_library.cjs.js | 2 +- charting_library/charting_library.d.ts | 3 +- charting_library/charting_library.esm.js | 2 +- charting_library/charting_library.js | 2 +- .../charting_library.standalone.js | 2 +- ...477abd4.html => cs-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => da_DK-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => de-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => el-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => en-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => es-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => et_EE-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => fa-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => fr-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => he_IL-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => hu_HU-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => id_ID-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => it-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => ja-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => ko-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => ms_MY-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => nl_NL-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => no-tv-chart.c7e6d52b.html} | 2 +- charting_library/package.json | 2 +- ...477abd4.html => pl-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => pt-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => ro-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => ru-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => sk_SK-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => sv-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => th-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => tr-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => vi-tv-chart.c7e6d52b.html} | 2 +- ...477abd4.html => zh-tv-chart.c7e6d52b.html} | 2 +- ...abd4.html => zh_TW-tv-chart.c7e6d52b.html} | 2 +- 37 files changed, 90 insertions(+), 89 deletions(-) rename charting_library/{ar-tv-chart.a477abd4.html => ar-tv-chart.c7e6d52b.html} (99%) rename charting_library/bundles/{library.dc248d220304cd937123.js => library.83b78f9d405377ddcb47.js} (93%) rename charting_library/{cs-tv-chart.a477abd4.html => cs-tv-chart.c7e6d52b.html} (99%) rename charting_library/{da_DK-tv-chart.a477abd4.html => da_DK-tv-chart.c7e6d52b.html} (99%) rename charting_library/{de-tv-chart.a477abd4.html => de-tv-chart.c7e6d52b.html} (99%) rename charting_library/{el-tv-chart.a477abd4.html => el-tv-chart.c7e6d52b.html} (99%) rename charting_library/{en-tv-chart.a477abd4.html => en-tv-chart.c7e6d52b.html} (99%) rename charting_library/{es-tv-chart.a477abd4.html => es-tv-chart.c7e6d52b.html} (99%) rename charting_library/{et_EE-tv-chart.a477abd4.html => et_EE-tv-chart.c7e6d52b.html} (99%) rename charting_library/{fa-tv-chart.a477abd4.html => fa-tv-chart.c7e6d52b.html} (99%) rename charting_library/{fr-tv-chart.a477abd4.html => fr-tv-chart.c7e6d52b.html} (99%) rename charting_library/{he_IL-tv-chart.a477abd4.html => he_IL-tv-chart.c7e6d52b.html} (99%) rename charting_library/{hu_HU-tv-chart.a477abd4.html => hu_HU-tv-chart.c7e6d52b.html} (99%) rename charting_library/{id_ID-tv-chart.a477abd4.html => id_ID-tv-chart.c7e6d52b.html} (99%) rename charting_library/{it-tv-chart.a477abd4.html => it-tv-chart.c7e6d52b.html} (99%) rename charting_library/{ja-tv-chart.a477abd4.html => ja-tv-chart.c7e6d52b.html} (99%) rename charting_library/{ko-tv-chart.a477abd4.html => ko-tv-chart.c7e6d52b.html} (99%) rename charting_library/{ms_MY-tv-chart.a477abd4.html => ms_MY-tv-chart.c7e6d52b.html} (99%) rename charting_library/{nl_NL-tv-chart.a477abd4.html => nl_NL-tv-chart.c7e6d52b.html} (99%) rename charting_library/{no-tv-chart.a477abd4.html => no-tv-chart.c7e6d52b.html} (99%) rename charting_library/{pl-tv-chart.a477abd4.html => pl-tv-chart.c7e6d52b.html} (99%) rename charting_library/{pt-tv-chart.a477abd4.html => pt-tv-chart.c7e6d52b.html} (99%) rename charting_library/{ro-tv-chart.a477abd4.html => ro-tv-chart.c7e6d52b.html} (99%) rename charting_library/{ru-tv-chart.a477abd4.html => ru-tv-chart.c7e6d52b.html} (99%) rename charting_library/{sk_SK-tv-chart.a477abd4.html => sk_SK-tv-chart.c7e6d52b.html} (99%) rename charting_library/{sv-tv-chart.a477abd4.html => sv-tv-chart.c7e6d52b.html} (99%) rename charting_library/{th-tv-chart.a477abd4.html => th-tv-chart.c7e6d52b.html} (99%) rename charting_library/{tr-tv-chart.a477abd4.html => tr-tv-chart.c7e6d52b.html} (99%) rename charting_library/{vi-tv-chart.a477abd4.html => vi-tv-chart.c7e6d52b.html} (99%) rename charting_library/{zh-tv-chart.a477abd4.html => zh-tv-chart.c7e6d52b.html} (99%) rename charting_library/{zh_TW-tv-chart.a477abd4.html => zh_TW-tv-chart.c7e6d52b.html} (99%) diff --git a/charting_library/ar-tv-chart.a477abd4.html b/charting_library/ar-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/ar-tv-chart.a477abd4.html rename to charting_library/ar-tv-chart.c7e6d52b.html index f995cfa3..7ffb5208 100644 --- a/charting_library/ar-tv-chart.a477abd4.html +++ b/charting_library/ar-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/bundles/library.dc248d220304cd937123.js b/charting_library/bundles/library.83b78f9d405377ddcb47.js similarity index 93% rename from charting_library/bundles/library.dc248d220304cd937123.js rename to charting_library/bundles/library.83b78f9d405377ddcb47.js index f94d1a06..ca43b7b5 100644 --- a/charting_library/bundles/library.dc248d220304cd937123.js +++ b/charting_library/bundles/library.83b78f9d405377ddcb47.js @@ -222,7 +222,7 @@ e.pro_name||(e.pro_name=e.full_name),e.data_status||(e.data_status="streaming"), r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function r(e){e.forEach((function(e){void 0!==t[e.n]?null!==t[e.n]&&s(e,t[e.n]):i._resolveSymbolByName(e.n,null,(function(i){t[e.n]=i,s(e,i)}),(function(){t[e.n]=null}))}))}var n=this._quotesInfo[e].symbols;0!==n.length&&(this._externalDatafeed.getQuotes&&!w.enabled("charting_library")?this._externalDatafeed.getQuotes(n,(function(t){i._quotesInfo[e]&&(r(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(n,i._quotesInfo[e].fastSymbols,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&w.enabled("trading_terminal")&&setTimeout((function(){r(n.map((function(e){return{n:e,s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,n))},P.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},P.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},P.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},P.prototype.quoteSetFields=function(e,t){},P.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},P.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},P.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},P.prototype.quoteHibernateAll=function(e){},P.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},P.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},P.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},P.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},P.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},P.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},P.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},P.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i ;return!!this._endOfData[s]},P.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},P.prototype.serverTimeOffset=function(){return this._serverTimeOffset},P.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},P.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},e.exports=P},EX27:function(e,t,i){"use strict";var s=i("IiTo"),r=i("LxhU").Interval,n=i("EJcV"),o=i("MrEN"),a=i("XzZr"),l=a.ChartApiInterface,c=a.HandlerInfo,h=i("ogJP").requireFullInterfaceImplementation,u=i("txPx").getLogger("Chart.ChartApiLocal"),d=i("uDHo").TIMEFRAMETYPE,p=i("OLhd").createDwmAligner;function _(e,t,i){if(e[t])if(void 0!==i)e[t][i]&&(clearTimeout(e[t][i]),delete e[t][i]);else{for(var s in e[t])e[t].hasOwnProperty(s)&&_(e,t,s);delete e[t]}}function m(e,t,i,s){_(e,t,i),e[t]||(e[t]={}),e[t][i]=s}TradingView.STUDY_COUNT_LIMIT=210,JSServer.ChartApi=function(e){this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._seriesTimers={},this._studyTimers={},this._seriesTurnarounds={},this._connected=!1,this._enabled=!1,this._studyEngine=new n(e),this._callbacks={},this._symbolIdCache={},this._seriesIdCache={},this._enableLogging=!1,this._enabledMoreBarsRequest=!0,this._serverTimeOffset=0;var t=this;this._studyEngine.on("configuration_received",(function(){t._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",(function(e){var i={time:e.value[0]/1e3,open:e.value[1],high:e.value[2],low:e.value[3],close:e.value[4],volume:e.value[5]};t._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={}},JSServer.ChartApi.prototype._makeSymbolKey=function(e,t){if(!e||!t)throw Error("incorrect identifiers");return e+"_"+t},JSServer.ChartApi.prototype._makeSeriesKey=function(e,t){if(!e||!t)throw Error("incorrect identifiers");return e+"_"+t},JSServer.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},JSServer.ChartApi.prototype.purgeCache=function(e){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache(),this._symbolIdCache={},this._seriesIdCache={}},JSServer.ChartApi.prototype.setAdditionalBarsRequestEnabled=function(e){this._enabledMoreBarsRequest=e},JSServer.ChartApi.prototype.defaultWatchlistSymbols=function(){return this._watchlistSettings.default_symbols},JSServer.ChartApi.prototype.defaultResolutions=function(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]},JSServer.ChartApi.prototype.availableCurrencies=function(){var e=this._studyEngine.supportedCurrencies().map((function(e){return{id:e,code:e,convertible:!0}}));return Promise.resolve(e)},JSServer.ChartApi.prototype.availableUnits=function(){return Promise.resolve(this._studyEngine.supportedUnits())},JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()}, JSServer.ChartApi.prototype.supportedExchangesList=function(){return this._studyEngine.supportedExchangesList()},JSServer.ChartApi.prototype.symbolsGrouping=function(){return this._studyEngine.symbolsGrouping()},JSServer.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},JSServer.ChartApi.prototype._logMessage=function(e){this._enableLogging&&console.log(e)},JSServer.ChartApi.prototype.unsubscribe=function(e,t){var i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)},JSServer.ChartApi.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},JSServer.ChartApi.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){var s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(var r=0;rd||(r&&l.timeMs!==h._studyEngine.getSeriesLastBarTime(e,t)&&(r.applyDefaultRightMargin=!1,r.percentRightMargin=0),TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,c,u,d,r),n&&setTimeout(n,0))}}}if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*i))u();else{ +this._studyEngine.resolveSymbol(i,(function(s){s.errmsg?o(t,s.errmsg):(n._symbolIdCache[n._makeSymbolKey(e,t)]={requestedSymbol:i,symbolInfo:s,status:"ok"},n._fireEvent("symbol_resolved",{symbolInfo:s,symbolId:t,session:e},!0),n._fireEvent(n._makeSymbolKey(e,t)+"_resolved",s),TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s))}),(function(e){o(t,e)}))},JSServer.ChartApi.prototype._doWhenSymbolIdIsReady=function(e,t,i){var s=this,r=!0;function n(){r&&(i({requestedSymbol:s._symbolIdCache[s._makeSymbolKey(e,t)].requestedSymbol,symbolInfo:s._symbolIdCache[s._makeSymbolKey(e,t)].symbolInfo}),r=!1,s.unsubscribe(s._makeSymbolKey(e,t)+"_resolved",n),s.unsubscribe(s._makeSymbolKey(e,t)+"_resolve_fail",n))}this._symbolIdCache[this._makeSymbolKey(e,t)]?n():(this.on(this._makeSymbolKey(e,t)+"_resolved",n),this.on(this._makeSymbolKey(e,t)+"_resolve_fail",n))},JSServer.ChartApi.prototype._doWhenSeriesDataReceived=function(e,t){TradingView.ChartapiMessagerInstances[e].seriesCompleted.subscribe(null,t,!0)},JSServer.ChartApi.prototype._doWhenSeriesSymbolIdIsReady=function(e,t,i,s){var r=this,n=this._seriesIdCache[e+"_"+t].symbolId;function o(){var t;i({requestedSymbol:(t=r._symbolIdCache[r._makeSymbolKey(e,n)]).requestedSymbol,symbolInfo:t.symbolInfo})}function a(){r.unsubscribe("symbol_resolved",c),r.unsubscribe("resolve_fail",l)}function l(t){t.symbolId===n&&t.session===e&&(a(),s&&s())}function c(t){t.symbolId===n&&t.session===e&&(a(),o())}this._symbolIdCache[this._makeSymbolKey(e,n)]?o():(this.on("symbol_resolved",c),this.on("resolve_fail",l))},JSServer.ChartApi.prototype.createSeries=function(e,t,i,s,r,n,o,a){i=i||"";var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==o&&l._applyTimeFrame(e,s,t,i,o),a(r)}),t),this._seriesIdCache[e+"_"+t]={symbolId:s,resolution:r,timeframe:o,turnaround:i},this._seriesTurnarounds[e][t]=i,this._doWhenSeriesSymbolIdIsReady(e,t,(function(s){l._seriesTurnarounds[e][t]===i&&l._studyEngine.createSeries(s.requestedSymbol,r,e,t,i,{countBack:n||300})}))},JSServer.ChartApi.prototype.removeSeries=function(e,t,i){this._notificationHandlers[e][t]=new c(i,t),this._studyEngine.removeSeries(e,t),_(this._seriesTimers,e,t)},JSServer.ChartApi.prototype.setVisibleTimeRange=function(e,t,i,s,r,n){var o=i,a=!0!==(r=r||{}).applyDefaultRightMargin&&void 0===r.percentRightMargin&&void 0!==s?s:null,l=p(this._studyEngine.getSeriesInterval(e,t),this._studyEngine.getSeriesSymbolInfo(e,t));null!==l&&(o=l.timeToSessionStart(1e3*o)/1e3,null!==a&&(a=l.timeToSessionStart(1e3*a)/1e3));var c=this._seriesIdCache[e+"_"+t].turnaround,h=this;function u(){var i=h._studyEngine.sessionTimeScale(e);if(null!==i){var s,l=i.indexOfTime(1e3*o);if(null===a)s=i.lastSessionBarIndex();else{var u=i.indexOfTime(1e3*a);s=u&&u.index}if(null!==l&&null!==s){var d=l.index;l.timeMs<1e3*o&&(d+=1),d>s||(TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,c,d,s,r),n&&setTimeout(n,0))}}}if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*i))u();else{ var d=TradingView.ChartapiMessagerInstances[e].seriesCompleted,_=TradingView.ChartapiMessagerInstances[e].seriesError;void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=setTimeout(function(){delete this._setVisibleRangeTimeout[e],d.subscribe(null,m,!0),_.subscribe(null,f,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*i)}.bind(this),0)}function m(e,i){e===t&&i===c&&(d.unsubscribe(null,m),_.unsubscribe(null,f),u())}function f(e,i){e===t&&i===c&&d.unsubscribe(null,m)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,n,o){var a,l;if(o.type===d.PeriodBack){var c=this._studyEngine.getSeriesLastBarTime(e,i);if(null===c)return;l=c/1e3;var h=r.parse(o.value),u=this._symbolIdCache[this._makeSymbolKey(e,t)].symbolInfo;a=s.alignPeriodsBack(u.session,u.holidays,u.corrections,h.letter(),h.multiplier(),1,c)/1e3;var _=p(this._studyEngine.getSeriesInterval(e,i),u);null!==_&&(l=_.timeToExchangeTradingDay(1e3*l)/1e3,a=_.timeToExchangeTradingDay(1e3*a)/1e3)}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,a,l,{applyDefaultRightMargin:!0})},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){i=i||"";var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==n&&(l._applyTimeFrame(e,s,t,i,n),n=null),o(r)}),t),this._seriesTurnarounds[e][t]=i,a&&(this._seriesIdCache[this._makeSeriesKey(e,a)]=null),this._seriesIdCache[this._makeSymbolKey(e,t)]={symbolId:s,resolution:r,turnaround:i},this._doWhenSeriesSymbolIdIsReady(e,t,(function(s){l._studyEngine.modifySeries(e,t,s.requestedSymbol,r,i)}))},JSServer.ChartApi.prototype.requestMoreData=function(e,t){if(this._enabledMoreBarsRequest){var i=this,s=setTimeout((function(){i._studyEngine.extendSeriesRange(e,t)}),0);m(this._seriesTimers,e,"requestMoreData",s)}},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.setWatchlistSettings=function(e){this._watchlistSettings=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(e,t,i){this._notificationHandlers[e][t]=new c(i,t);var s=this.studiesAccessController.getEnabledTools();TradingView.ChartapiMessagerInstances[e].onRequestMetadata(t,s)},JSServer.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounterthis._searchCharts?(!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=Object(s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchChartsLoadDebounced=null,this._searchCharts.feedBySymbol.call(this._searchCharts,e)):()=>{};!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=Object(s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchCharts.feedBySymbol(e)}_mainSeries(){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");return this._activeChartWidget.model().mainSeries()}_properties(){return this._mainSeries().properties()}_symbolProperty(){return this._properties().symbol}_intervalProperty(){return this._properties().interval}_watchedSymbolListener(e){this._symbolProperty().value()!==e&&this._chartWidgetCollection.setSymbol(e)}_sendSnowplowAnalytics(){if(!window.user.do_not_track)throw new Error("unsupported")}_onSymbolPropertyChange(){const e=this._symbolProperty().value()!==this._watchedSymbol.value();this._watchedSymbol.setValue(this._symbolProperty().value()),e&&this._chartWidgetCollection.setSymbol(this._symbolProperty().value())}_onSymbolResolved(e){const t=this._mainSeries().symbolInfo();t&&this._applyValuesFromSymbolInfo(t)}_applyValuesFromSymbolInfo(e){const t=e.pro_name||o.enabled("trading_terminal")&&(e.full_name||e.name)||"";this._proSymbol.setValue(t),e.aliases&&this._symbolNamesList.setValue(e.aliases)}_updateSeriesSymbolInfo(){this._seriesShortSymbol.setValue(this._properties().shortName.value());const e=this._mainSeries().symbolInfo();e?(this._applyValuesFromSymbolInfo(e),e.hasOwnProperty("supported_resolutions")?this._watchedSupportedResolutions.setValue(e.supported_resolutions):this._watchedSupportedResolutions.setValue(void 0),this._watchedIntraday.setValue(!!e.has_intraday),this._watchedSeconds.setValue(!!e.has_seconds),this._watchedTicks.setValue(!!e.has_ticks)):(this._watchedIntraday.deleteValue(),this._watchedSeconds.deleteValue(),this._watchedTicks.deleteValue(),this._proSymbol.deleteValue())}_watchedIntervalListener(e){this._intervalProperty().value()!==e&&this._chartWidgetCollection.setResolution(e)}_onIntervalPropertyChange(){const e=this._intervalProperty().value()!==this._watchedInterval.value();this._watchedInterval.setValue(this._intervalProperty().value()),e&&this._chartWidgetCollection.setResolution(this._intervalProperty().value())}_onChartModelCreated(e){if(!this._activeChartWidget)throw new Error("ChartWidget is undefined");this._chartWidgetBindingState=c.BoundToModel,this._activeChartWidget.modelCreated().unsubscribe(this,this._onChartModelCreated);const t=this._symbolProperty();t.subscribe(this,this._onSymbolPropertyChange),this._watchedSymbol.setValue(t.value()),this._watchedSymbol.subscribe(this._watchedSymbolListenerBound);const i=this._mainSeries() ;i.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),this._watchedSymbol.hook=e=>(i.symbolSameAsCurrent(e)&&(e=i.symbol()),e),i.dataEvents().symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolError().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().symbolGroupNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),i.dataEvents().extendedHoursNotPermitted().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo();const s=this._intervalProperty();s.subscribe(this,this._onIntervalPropertyChange),this._watchedInterval.setValue(s.value()),this._watchedInterval.subscribe(this._watchedIntervalListenerBound),this._activeChartWidget.readOnly()&&(this._watchedSymbol.writeLock=!0)}}window.TradingView=window.TradingView||{};const u=new h;window.TradingView.Linking=u},PYn8:function(e,t,i){"use strict";i.r(t),i.d(t,"LineToolThreeDrivers",(function(){return o}));var s=i("Ocx9"),r=i("Ss5c"),n=i("j3hX");class o extends r.LineDataSource{constructor(e,t){const s=t||o.createProperties();super(e,s),i.e("lt-pane-views").then(i.bind(null,"S6aM")).then(t=>{this._setPaneViews([new t.LineToolThreeDrivesPaneView(this,e)])})}pointsCount(){return 7}name(){return"Three Drives Pattern"}properties(){return super.properties()}static createProperties(e){const t=new s.DefaultProperty("linetoolthreedrivers",e);return o._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"aMeN")).then(e=>e.PatternWithoutBackgroundDefinitionsViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors")}}},PdIz:function(e,t,i){"use strict";i.r(t),i.d(t,"StudyPlotShapesPaneView",(function(){return c}));var s=i("CLNU"),r=i("Tmoa"),n=i("Zy3/"),o=i("vq8G"),a=i("Nu4p"),l=i("GSwP");class c extends l.a{renderer(){const e=this._study.properties().styles[this._plotName];return e.visible&&e.visible.value()&&this._scalesReady()?(this._invalidated&&(this._updateRenderer(e),this._invalidated=!1),this._renderer):null}_updateRenderer(e){this._updateImpl();const t=this._model.timeScale(),i={},l=this._getTranspValue(),c=t.barSpacing();let h;if(e.size){const t=e.size.value();h=this._calculateShapeHeight(25,t)}else h=Math.round(c/2);h=Math.max(h,1);const u=e.location.value(),d=Object(r.generateColor)(e.color.value(),l),p=l>19?l-10:0,_=this._calculateVerticalOffset(u,Math.round(1.5*h));i.barSpacing=c,i.items=this.items(),i.color=d,i.borderColor=Object(r.generateColor)(e.color.value(),p),i.height=h,i.vertOffset=_;const m=e.plottype.value(),f=a.a[m],g=new n.CompositeRenderer,v=e.text?e.text.value():void 0 ;if(void 0!==v&&""!==v.trim()){let t=v.trim().replace(/\\n/gm,"\n");t=Object(s.cleanButAmpersand)(t,!0),i.text=t,i.fontSize=12;const n=e.textColor?e.textColor.value():void 0;i.textColor=n?Object(r.generateColor)(n,l):d}g.append(super._createRenderer(f.paneRendererClass,i)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=_,g.append(new o.SelectionRenderer(this._selectionData))),this._renderer=g}}},Q19o:function(e,t,i){"use strict";var s=i("Eyy1").ensureNotNull,r=i("jA0t"),n=i("9iCb").applyOverridesToStudy,o=i("0YCj"),a=i("5JMW"),l=a.LineDataSourceApi,c=a.isLineToolRiskReward,h=i("N1UO").StudyApi,u=i("ltKl").SeriesApi,d=i("QrSB").SelectionApi,p=i("mf9N").PaneApi,_=i("OLhd").createDwmAligner,m=i("LxhU").Interval,f=i("2jXJ").supportedLineTools,g=i("vwKG").showTooManyStudiesNotice,v=i("ogJP").isNumber,b=i("vu5c").onSeriesCompletedOrErrorReceived,S=i("CW80").createLineToolProperties,y=i("96Yh").lineToolEntityInfo,w=i("lReN").LineToolsGroupControllerApi,C=i("ocrj").RemoveSourcesCommand,P=i("e92V").isLineDrawnWithPressedButton,x=i("FDyI").ChartWidgetApiBase,T=i("mMWL");function M(e,t){return t.map((function(t){return e.dataSourceForId(t)}))}e.exports=class extends x{constructor(e,t){super(e),this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap,this._activateChart=t,this._selectionApi=null,this._chartWidget.onAboutToBeDestroyed().subscribe(this,this._destroy,!0),this._chartWidget.withModel(this,(function(){this._chartWidget.model().timeScale().visibleBarsStrictRangeChanged().subscribe(this,this._onVisibleBarsChanged)}))}id(){return this._chartWidget.id()}_getPaneApi(e){var t=this._panes.get(e);return void 0===t&&(t=new p(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){var t=this._studies.get(e);return void 0===t&&(t=new h(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){var t=this._lineDataSources.get(e);return void 0===t&&(t=new l(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:function(e){var t=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();return e.map((function(e){var s=i.normalizeBarIndex(e.index);return{price:e.price,time:t.projectTime(s.time_t,s.offset)}}))}.bind(this)}),this._lineDataSources.set(e,t)),t}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(){this._chartWidget.clearMarks()}symbol(){return this._chartWidget.getSymbol()}symbolExt(){var e=this._chartWidget.model().mainSeries().symbolInfo();return e?{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type,pro_name:e.pro_name}:null}resolution(){ -return this._chartWidget.model().mainSeries().properties().interval.value()}setSymbol(e,t){if(e!==this.symbol()){var i=this._chartWidget.model().mainSeries().dataEvents();t&&b(i,(function(e){e||t()})),this._activateChart(),this._chartWidget.setSymbol(e)}}resetData(){this._chartWidget.model().mainSeries().rerequestData()}setResolution(e,t){var i=m.normalize(e);if(null!==i&&i!==this.resolution()){var s=this._chartWidget.model().mainSeries().dataEvents();t&&b(s,(function(e){e||t()})),this._activateChart(),this._chartWidget.setResolution(i)}}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");var i=this._chartWidget.model().model().dataSourceForId(e);if(i){var s=i.properties();s&&s.visible&&s.visible.setValue(t)}}availableZOrderOperations(e){var t=M(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}insertAfter(e,t){var i=this._chartWidget.model().model(),s=M(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertAfter(s,r)}insertBefore(e,t){var i=this._chartWidget.model().model(),s=M(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertBefore(s,r)}bringForward(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}showPropertiesDialog(e){var t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error("Study or shape "+e+" does not exist");this._chartWidget.showChartPropertiesForSource(t)}getAllShapes(){return this._chartWidget.model().model().allLineTools().map(y).filter((function(e){return null!==e.name}))}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}removeEntity(e,t){var i=this._chartWidget.model().chartModel().dataSourceForId(e);i?t&&t.disableUndo?new C(this._chartWidget.model().chartModel(),[i],"").redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn("Can't find a source with id: "+e)}removeEntityWithUndo(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);this._chartWidget.model().removeSource(t,!1)}selection(){return null===this._selectionApi&&(this._selectionApi=new d(this._chartWidget.model().model())),this._selectionApi}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}drawOnAllCharts(e){T.drawOnAllCharts.setValue(e)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}setVisibleRange(e,t){if(void 0!==e&&!isNaN(e.from)&&!isNaN(e.to)){var i=void 0!==t&&"function"==typeof t,s=new Promise(function(s){this._chartWidget.setVisibleTimeRange(e.from,e.to,i?{}:t,s)}.bind(this)) -;return i&&(console.warn("setVisibleRange now returns a Promise object and don't accept callback as the last argument"),s.then(t)),s}console.warn("Wrong time range: "+JSON.stringify(e)+'. Expected an object with "from" and "to" numeric values.')}getVisibleRange(){var e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;var r=this._chartWidget.model().mainSeries(),n=r.syncModel();if(null===n)return e;var o=s(r.data().last()),a=i.lastBar()-o.index,l=a<=0?t.indexToTimePoint(i.lastBar()):n.projectTime(o.value[TradingView.TIME_PLOT],a);if(e.from=+t.indexToTimePoint(Math.max(0,i.firstBar()))||0,e.to=+l||0,m.isDWM(r.interval())){var c=_(r.interval(),r.symbolInfo());null!==c&&(e.from=c.timeToExchangeTradingDay(1e3*e.from)/1e3,e.to=c.timeToExchangeTradingDay(1e3*e.to)/1e3)}return e}getVisiblePriceRange(){return console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null}scrollPosition(){return this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return this._chartWidget.model().timeScale().defaultRightOffsetProperty().value()}_createTradingPrimitive(e,t){var i=this;var r,n,o=this._chartWidget.model().model(),a=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(a,(r=TradingView.CLOSE_PLOT,{index:(n=s(i._chartWidget.model().mainSeries().bars().last())).index,price:n.value[r]}),e)._adapter}createOrderLine(e){e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)}createPositionLine(e){e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)}createExecutionShape(e){e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)}createShape(e,t){return this.createMultipointShape([e],t)}_alignPoints(e){var t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval();if(t.timeScale().isEmpty()||!m.isDWM(s))return e;var r=_(s,i.symbolInfo());return null===r?e:e.map((function(e){return r.timeToSessionStart(1e3*e)/1e3}))}_convertUserPointsToDataSource(e){var t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),r=i.data();if(t.timeScale().isEmpty())return null;var n=e.map((function(e){return e.time||0})),o=this._alignPoints(n);function a(e,t,n){var o=s.closestIndexLeft(e)||0,a={index:o},l=s.valueAt(o);if(e>l&&o===s.lastIndex()){var c=i.syncModel().distance(l,e);c.success&&(a.index=a.index+c.result)}if(v(t))a.price=t;else{var h=n?["open","high","low","close"].indexOf(n)+1:1;h<=0&&(h=1),a.price=r.valueAt(o)[h]}return a}for(var l=[],c=0;c2)throw new Error("Wrong points count for "+t.shape+". Required 1 or 2");2===l.length&&(p.startChanging(1,l[1]),p.setPoint(1,l[1]),p.endChanging())}else{var _=p.pointsCount();if(_!==l.length&&-1!==_)throw new Error("Wrong points count for "+t.shape+". Required "+_);for(var m=P(h.name),g=1;gthis._minValue&&e.maxValue(){e.map(s.bind(null,this._model)).forEach(e=>t.addSourceToSelection(e))}):this.add([e])}canBeAddedToSelection(e){const t=s(this._model,e);return this._model.selection().canBeAddedToSelection(t)}set(e){Array.isArray(e)?this._model.selectionMacro(t=>{t.clearSelection(),e.map(s.bind(null,this._model)).forEach(e=>t.addSourceToSelection(e))}):this.set([e])}remove(e){Array.isArray(e)?this._model.selectionMacro(t=>{e.map(s.bind(null,this._model)).forEach(e=>t.removeSourceFromSelection(e))}):this.remove([e])}contains(e){const t=s(this._model,e);return this._model.selection().isSelected(t)}allSources(){return this._model.selection().dataSources().map(e=>e.id())}isEmpty(){return this._model.selection().isEmpty()}clear(){this._model.selectionMacro(e=>{e.clearSelection()})}onChanged(){return this._model.onSelectedSourceChanged()}}},Qtjj:function(e,t,i){"use strict";i.r(t),i.d(t,"TimeSynchronizer",(function(){return l}));var s=i("LxhU"),r=i("jCNj"),n=i.n(r),o=i("IiTo");let a=null;class l{constructor(e,t){var i,r -;this._sourceTargetBarBuilder=null,this._cache=new Map,this._source=e,this._target=t,this._isResolutionTheSame=s.Interval.isEqual(e.getResolution(),t.getResolution()),this._isSessionTheSame=(i=e.getSymbolInfo(),r=t.getSymbolInfo(),i.timezone===r.timezone&&i.session===r.session),this._shouldCorrectTradingDay=s.Interval.isDWM(e.getResolution())&&!this._isSessionTheSame}sourceTimeToTargetTime(e){if(this._isSessionTheSame&&this._isResolutionTheSame)return e;if(!this._source.isValid()||!this._target.isValid())return e;let t=this._cache.get(e);if(void 0===t){let i=1e3*e;if(this._shouldCorrectTradingDay){let e=n.a.utc_to_cal(this._source.getSession().timezone,i);e=this._source.getSession().spec.correctTradingDay(e);const t=new Date(e);n.a.set_hms(t,0,0,0,0,this._source.getSession().timezone),i=t.valueOf()}const s=this._sourceTargetBuilder();s.moveTo(i);const r=s.indexOfBar(i);t=s.startOfBar(Math.max(0,r))/1e3,this._cache.set(e,t)}return t}_sourceTargetBuilder(){if(null===this._sourceTargetBarBuilder){const e=this._isSessionTheSame?this._target.getSession():(null===a&&(a=new o.SessionInfo("Etc/UTC","24x7")),a);this._sourceTargetBarBuilder=Object(o.newBarBuilder)(this._target.getResolution(),this._target.getSession(),e)}return this._sourceTargetBarBuilder}}},RDDl:function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("Ocx9").DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e("lt-pane-views").then(i.t.bind(null,"VghZ",7)).then(({PriceRangePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Price Range"}static createProperties(e){var t=new r("linetoolpricerange",e);return n._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"Ax76"))).GeneralDatePriceRangeDefinitionsViewModel}static _configureProperties(e){s._configureProperties(e)}}t.LineToolPriceRange=n},RDU5:function(e,t,i){"use strict";i.r(t),i.d(t,"UndoCommand",(function(){return s}));class s{constructor(e,t=!0){this._customFlags={},this._text=e,this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},RTYN:function(e,t,i){"use strict";i.r(t),i.d(t,"PositionAveragePriceAxisView",(function(){return r}));var s=i("4TVt");class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},RXmj:function(e,t,i){"use strict";(function(e){var s=i("FIi8").deepExtend,r=i("ogJP").deepEquals,n=i("zUrt").backend;window.t("The publication preview could not be loaded. Please disable your browser extensions and try again.");function o(t){this._chartWidgetCollection=t,this._chartAboutToBeSavedDelegate=new e,this._chartSavedDelegate=new e,this._prevChartState=null,this._chartHasBeenModified=new e,this._chartSizeLimitExceededDelegate=new e} -function a(e,t){e.content=JSON.stringify(t)}o.prototype.chartHasBeenModified=function(){return this._chartHasBeenModified},o.prototype.chartSizeLimitExceeded=function(){return this._chartSizeLimitExceededDelegate},o.prototype.chartAboutToBeSaved=function(){return this._chartAboutToBeSavedDelegate},o.prototype.chartSaved=function(){return this._chartSavedDelegate},o.prototype.whenReadyToSave=function(e){var t=this._chartWidgetCollection.activeChartWidget.value().model().mainSeries();if(t.symbolInfo()&&!t.hasDelayedSymbolIntervalChange())e();else{var i,s=null;i=function(){t.dataEvents().symbolError().unsubscribe(null,s,!0),e()},s=function(){t.dataEvents().symbolResolved().unsubscribe(null,i,!0)},t.dataEvents().symbolResolved().subscribe(null,i,!0),t.dataEvents().symbolError().subscribe(null,s,!0)}},o.prototype.saveToJSON=function(){var e=this._getCommonSavingInfo(!1);return a(e,this._getChartWidgetCollectionState(!1,!0)),e},o.prototype._fillAsyncInfo=function(e,t){var i=JSON.parse(e.content),r=this._chartWidgetCollection;return(t?r.asyncState():r.activeChartWidget.value().asyncState()).then((function(t){return e.content=JSON.stringify(s(i,t)),e}))},o.prototype._getChartWidgetCollectionState=function(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)},o.prototype._getCommonSavingInfo=function(e){var t={},i=this._chartWidgetCollection,s=i.activeChartWidget.value(),r=i.metaInfo,n=s.model().mainSeries(),o=n.properties(),a=n.symbolInfo();if(r.id.value()&&(t.id=r.id.value()),t.name=r.name.value()||"",t.description=r.description.value()||"",t.resolution=n.properties().interval.value(),t.symbol_type=null!==a&&a.type||"",t.exchange=null!==a&&a.exchange||"",t.listed_exchange=null!==a&&a.listed_exchange||"",null!==a&&n.isSpread()){var l=a.legs[0],c=a.base_name[0];c=c.split(":")[1],t.symbol=l,t.short_name=c,t.expression=a.full_name}else t.symbol=null!==a&&a.ticker||o.symbol.value(),t.short_name=o.shortName.value();if(null!==a){for(var h=[],u=0,d=a.legs.length;u{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handler.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._clickPosition) -;i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._handler=t,this._options=Object(n.merge)(Object(n.clone)(c),i||{}),this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handler.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=_(e.changedTouches,Object(r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=p(e),null!==this._startPinchMiddlePoint)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(u(t),Object(r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handler.touchMoveEvent),Object(o.a)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return -;const t=this._touchMouseMoveWithDownInfo(u(e),Object(r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=_(e.changedTouches,Object(r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=p(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handler.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(u(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||this._processTouchEvent(i,this._handler.tapEvent);0===this._tapCount&&Object(o.a)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,Object(o.a)(e))}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),s.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handler.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return;const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=p(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=u(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(), -this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handler.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=u(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;s.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=u(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=u(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));{const e=this._target.ownerDocument,t=e=>{this._handler.mouseDownOutsideEvent&&(e.target&&this._target.contains(e.target)||this._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",t)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}s.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),Object(o.b)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(l,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",()=>{},{passive:!1})}_initPinch(){void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",e=>this._checkPinchState(e.touches),{passive:!0}),this._target.addEventListener("touchmove",e=>{if(2===e.touches.length&&null!==this._startPinchMiddlePoint&&void 0!==this._handler.pinchEvent){const t=d(e.touches[0],e.touches[1])/this._startPinchDistance -;this._handler.pinchEvent(this._startPinchMiddlePoint,t),Object(o.a)(e)}},{passive:!1}),this._target.addEventListener("touchend",e=>{this._checkPinchState(e.touches)}))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){const t=this._target.getBoundingClientRect()||{left:0,top:0};this._startPinchMiddlePoint={x:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,y:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this._startPinchDistance=d(e[0],e[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent(),this._clearLongTapTimeout()}_stopPinch(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.mouseLeaveEvent),this._acceptMouseLeave=!s.CheckMobile.iOS()}_longTapHandler(e){const t=_(e.touches,Object(r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handler.longTapEvent),this._processTouchEvent(i,this._handler.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if(Object(o.a)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:p(e){"touchstart"!==e.type&&Object(o.a)(e)}}}}function u(e){return{x:e.pageX,y:e.pageY}}function d(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function p(e){return e.timeStamp||performance.now()}function _(e,t){for(let i=0;ie.HighlighterDefinitionsViewModel)}_loadPaneViews(e){i.e("lt-pane-views").then(i.bind(null,"uRW3")).then(t=>{this._setPaneViews([new t.HighlighterPaneView(this,e)])})}static _configureProperties(e){r.a._configureProperties(e)}}},Si3H:function(e,t,i){"use strict";i.r(t);var s=i("Eyy1"),r=i("0YCj"),n=i.n(r),o=i("ogJP");i.d(t,"migrateMetaInfoAndPropState",(function(){return l}));const a=[new class{targetMetaInfoVersion(){return 47}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=47,!t.defaults||void 0===t.defaults.precision)return void(i.format={type:"inherit"});const s=t.defaults&&t.defaults.precision,r=Object(o.isNumber)(s)?s:parseInt(s);0===r?i.format={type:"volume"}:isFinite(r)?i.format={type:"price",precision:r}:i.format={type:"inherit"},delete t.defaults.precision}migratePropState(e){}},new class{targetMetaInfoVersion(){return 50}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=50,void 0===t.defaults||void 0===t.defaults.ohlcPlots||void 0===t.ohlcPlots)return;const r=t.ohlcPlots,n=t.defaults.ohlcPlots,o=Object(s.ensureDefined)(Object(s.ensureDefined)(i.defaults).ohlcPlots);for(const s of Object.keys(n)){const e=n[s];if("ohlc_candles"===e.plottype){let t=!1;const i=r[s];void 0!==i&&(t=!!i.drawBorder,delete i.drawBorder),o[s]=Object.assign({borderColor:"#000000",drawBorder:t},e)}}}migratePropState(e){}}];function l(e,t){const i=n.a.versionOf(e),r=e;void 0===r._serverMetaInfoVersion&&(r._serverMetaInfoVersion=i),a.forEach(r=>{i<0||i>=r.targetMetaInfoVersion()||(r.migrateMetaInfo(e),void 0!==t&&r.migratePropState(t),Object(s.assert)(e._metainfoVersion===r.targetMetaInfoVersion()))})}a.sort((function(e,t){return e.targetMetaInfoVersion()-t.targetMetaInfoVersion()}))},SqfW:function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return o}));var s=i("tqok"),r=i("hsV8");function n(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===s.a?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function o(e,t,i){const s=Object(r.ensureTimePointIndexIndex)(i.indexOf(e.index));return Object.assign(Object.assign({id:t},e),{index:s})}},Ss5c:function(e,t,i){"use strict";var s=i("Eyy1").ensureDefined,r=i("aO4+").Point,n=i("dOnf").deepCopy,o=i("4TVt").LineToolPriceAxisView,a=i("fJhV").LineDataSourceTimeAxisView,l=i("mMWL"),c=i("LxhU").Interval,h=i("pPtI").getServerInterval,u=i("txPx").getLogger("Chart.LineDataSource"),d=i("FQhm"),p=i("aIyQ"),_=i("tc+8"),m=i("Kxc7"),f=i("0qMc").lineToolsLocalizedNames,g=m.enabled("datasource_copypaste"),v=i("ng+v").LineDataSourceBase,b={frozen:!1,visible:!0,intervalsVisibilities:{ticks:!0,seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1, -minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,weeksFrom:1,weeksTo:52,months:!0,monthsFrom:1,monthsTo:12,ranges:!0}};class S extends v{constructor(e,t){super(e,t),this._onTemplateApplying=new p,this._onTemplateApplied=new p,this._properties.hasChild("symbol")||this._properties.addChild("symbol",new _(e.mainSeries().symbol())),this._properties.hasChild("interval")||this._properties.addChild("interval",new _(e.mainSeries().interval())),this.calcIsActualSymbol(),this._properties.intervalsVisibilities.listeners().subscribe(this,S.prototype.calcIsActualSymbol);var i=this;if(this._properties.listeners().subscribe(this,(function(){i.propertiesChanged()})),this._createPointsProperties(),this.pointsCount()>0)for(var s=0;s=i.multiplier()&&(t=e.key)})),t}priceScale(){return this._ownerSource?this._ownerSource.m_priceScale:null}symbol(){return this._properties.symbol.value()}properties(){return this._properties}isSavedInStudyTemplates(){return!1}state(e){var t={type:TradingView.className(this.constructor),id:this.id(),state:this.properties().state(this._propertiesStateExclusions()),points:n(this._timePoint),zorder:this.zorder(),linkKey:this.linkKey};return delete t.state.points,e&&(t.indexes=this._points),this.ownerSource()&&(t.ownerSource=this.ownerSource().id()),this.isFixed()&&(t.positionPercents=this._positionPercents||this.calcPositionPercents()),"version"in this&&1!==this.version&&(t.version=this.version),this.hasAlert.value()&&(t.alertId=this._alertId),t}_propertiesStateExclusions(){return null}template(){return this.properties().preferences()}applyTemplate(e){this._onTemplateApplying.fire(e),this._applyTemplateImpl(e),this.calcIsActualSymbol(),this.updateAllViews(),this.model().lightUpdate(),this._onTemplateApplied.fire()}_applyTemplateImpl(e){var t=this.properties() -;t.mergePreferences(e),t.saveDefaults(),this.propertiesChanged()}clearData(){this._points=[]}denormalizeTimePoints(){for(var e=[],t=0;t0&&(this._points=e)}restorePoints(e,t,i){this._timePoint=n(e),this._points=t,i||this.denormalizeTimePoints()}restoreExternalState(e){this.properties().mergeAndFire(e)}restorePositionPercents(e){this._positionPercents=e}getLinkKey(){return this.linkKey||null}updateAllViewsAndRedraw(){this.updateAllViews(),this._model.updateSource(this)}propertiesChanged(e){this.calcIsActualInterval(),this.updateAllViewsAndRedraw(),e||this._syncLineStyleIfNeeded()}_syncLineStyleIfNeeded(){if(!this._syncLineStyleMuted&&this.linkKey){var e=this.properties().state(this._syncStateExclusions);delete e.interval,l.changeLineStyle({linkKey:this.linkKey,state:e,model:this._model})}}_muteSyncLineStyle(){this._syncLineStyleMuted=!0}_unmuteSyncLineStyleWithoutApplyingChanges(){this.propertiesChanged(),this._syncLineStyleMuted=!1}points(){for(var e=[],t=0;t0&&this.normalizePoints(),0!==this._timePoint.length))){this._currentPointsetId=++S._pointSetId;for(var e=this._model.mainSeries().seriesSource().symbolInstanceId(),t=[],i=0;i{this._setPaneViews([new e(this,this.model())])}),this.properties().childs().reverse.subscribe(this,this._reversePoints)}pointsCount(){return 2}name(){return"Gann Square Fixed"}properties(){return super.properties()}axisPoints(){const e=this.points(),t=this.getScreenPoints();return e.length<2||t.length<2?[]:[e[0],this.screenPointToPoint(t[1])]}getScreenPoints(){const e=this.points();if(e.length<2)return[];const t=this._calcAngle();if(null===t)return[] -;const[i,r]=e,n=this.pointToScreenPoint(i)[0],o=this.pointToScreenPoint(r)[0],a=Math.sqrt(Math.pow(n.x-o.x,2)+Math.pow(n.y-o.y,2)),l=new s.Point(Math.cos(t),-Math.sin(t)),c=l.normalized(),h=c.x<0?-1:1,u=c.y<0?-1:1;return[n.addScaled(l,a),n.add(new s.Point(5*a*h,5*a*u))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;se.GannComplexAndFixedDefinitionsViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0&&(n=-n),n}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this.normalizePoints(),this.restart()}}},TG9i:function(e,t,i){"use strict";i.r(t),i.d(t,"HHistDataWindowView",(function(){return d}));var s=i("Eyy1"),r=i("ivNn"),n=i("4miz"),o=i("nEwK"),a=i("qFKp"),l=i("e92V"),c=i("mMWL");const h=a.CheckMobile.any(),u=window.t("n/a");class d extends n.b{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._header=this._study.title(!0) -;const i=this._study.metaInfo().graphics.hhists;if(void 0===i)return;let r=0;for(const n in i){if(!i.hasOwnProperty(n))continue;const e=Object(s.ensureDefined)(i[n]);e.titles.length>r&&(r=e.titles.length)}r>1&&r++;const o=this._na();for(let s=0;s{s<=t&&(null===i||s>i)&&(i=s)}),i}(e,t);if(null===s)return null;const r=e.get(s);if(!r||0===r.size)return null;return function(e,t){let i=null;return e.forEach(e=>{e.priceLow<=t&&t{if(t1&&t===h.colors.childCount()){const t=a.rate.reduce((e,t)=>e+t,0);return e.setValue(u.format(t)),void e.setColor(h.valuesColor.value())}e.setValue("")}})}}},TMWk:function(e,t,i){"use strict";var s=i("Eyy1").assert,r=i("ogJP").clone,n=i("GVHu").Study,o=i("k9/m").PlotList,a=i("w4Ji").studyPlotFunctionMap,l=i("w4Ji").studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var u=!1;s&&(u=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),u?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(), -this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this.m_data=new o(a(this._metaInfo),l));var i=this.m_data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this.m_data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this.m_data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},TTFo:function(e,t,i){"use strict";i.r(t),i.d(t,"fromPercent",(function(){return n})),i.d(t,"toPercent",(function(){return o})),i.d(t,"toPercentRange",(function(){return a})),i.d(t,"fromIndexedTo100",(function(){return l})),i.d(t,"toIndexedTo100",(function(){return c})),i.d(t,"toIndexedTo100Range",(function(){return h})),i.d(t,"toLog",(function(){return u})),i.d(t,"fromLog",(function(){return d}));var s=i("Qb4w"),r=i("Hr11");function n(e,t){return t<0&&(e=-e),e/100*t+t}function o(e,t){const i=100*(e-t)/t;return t<0?-i:i}function a(e,t){const i=o(e.minValue(),t),r=o(e.maxValue(),t);return new s.PriceRange(i,r)}function l(e,t){return t<0&&(e=-e),(e-=100)/100*t+t}function c(e,t){const i=100*(e-t)/t+100;return t<0?-i:i}function h(e,t){const i=c(e.minValue(),t),r=c(e.maxValue(),t);return new s.PriceRange(i,r)}function u(e){const t=Math.abs(e);if(t<1e-8)return 0;const i=Object(r.log10)(t+1e-4)+4;return e<0?-i:i}function d(e){const t=Math.abs(e);if(t<1e-8)return 0;const i=Math.pow(10,t-4)-1e-4;return e<0?-i:i}},TcSq:function(e,t,i){"use strict";function s(e){return e===r(e)}function r(e){const t=e.indexOf("$"),i=e.indexOf("@");return t<0&&i>=0?null:e.substring(Math.max(t+1,0),i>=0?i:e.length)}function n(e){return e.startsWith("PUB;")}function o(e){return e.startsWith("USER;")}function a(e){return e.startsWith("STD;")}function l(e){return e.includes("Candlestick%1Pattern%1")}i.r(t),i.d(t,"isPineIdString",(function(){return s})),i.d(t,"extractPineId",(function(){return r})),i.d(t,"isPublishedPineId",(function(){return n})),i.d(t,"isCustomPineId",(function(){return o})),i.d(t,"isStandardPineId",(function(){return a})),i.d(t,"isCandleStickId",(function(){return l}))},TlGQ:function(e,t,i){"use strict";i.r(t),i.d(t,"visitObject",(function(){return n}));var s=i("ogJP");function r(e,t,i){return Object(s.isArray)(e)?function(e,t,i){return e.map(e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s})}(e,t,i):Object(s.isObject)(e)&&(Object(s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach(n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o}),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},TmNs:function(e,t,i){"use strict";i.r(t) -;var s=i("KcY8"),r=i("Eyy1"),n=i("jFln"),o=i("8Uy/"),a=i("gAom");class l{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,l,c){if(!this._data.visible)return;let h=this._commonData.coordinate;void 0!==this._commonData.fixedCoordinate&&(h=this._commonData.fixedCoordinate),e.lineWidth=Math.max(1,Math.floor(Object(r.ensureDefined)(this._data.linewidth)*c)),e.lineCap="butt",Object(n.setLineStyle)(e,void 0===this._data.linestyle?o.LINESTYLE_DOTTED:this._data.linestyle),e.strokeStyle=this._commonData.textColor,Object(a.drawHorizontalLine)(e,Math.round(h*c),0,Math.ceil(s*c))}height(e){return 0}}i.d(t,"PriceLineAxisView",(function(){return c})),i.d(t,"SeriesPriceLineAxisView",(function(){return h})),i.d(t,"StudyPriceLineAxisView",(function(){return u}));class c extends s.a{constructor(e){super(e||l)}ignoreAlignment(){return!0}_updateRendererData(e,t,i){if(t.visible=!1,e.visible=!1,!this._isVisible())return;const s=this._value();s.noData||(i.background="",i.textColor=this._priceLineColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate,e.linewidth=this._lineWidth(),e.linestyle=this._lineStyle(),e.backgroundAreaVisible=this._backgroundAreaVisible(),e.backgroundAreaColor=this._backgroundAreaColor(),e.backgroundAreaHeight=this._backgroundAreaHeight(),e.visible=!0)}_lineStyle(){return o.LINESTYLE_DOTTED}_backgroundAreaVisible(){return!1}_backgroundAreaColor(){return""}_backgroundAreaHeight(){return 0}}class h extends c{constructor(e){super(),this._series=e}_value(){return this._series.lastValueData(void 0,!0)}_priceLineColor(e){return this._series.priceLineColor(e)}_lineWidth(){return this._series.properties().priceLineWidth.value()}_isVisible(){const e=this._series.model().properties().scalesProperties.showSeriesLastValue.value();return this._series.properties().showPriceLine.value()&&e}}class u extends c{constructor(e,t){super(),this._study=e,this._plotname=t}_value(){return this._study.lastValueData(this._plotname,!0)}_lineWidth(){return this._study.properties().styles[this._plotname].linewidth.value()}_lineStyle(){return o.LINESTYLE_DOTTED}_priceLineColor(e){return e}_isVisible(){const e=this._study.model().properties().scalesProperties.showStudyLastValue.value();return this._study.properties().styles[this._plotname].trackPrice.value()&&e}}},Tmoa:function(e,t,i){"use strict";i.r(t),i.d(t,"generateColor",(function(){return r})),i.d(t,"alphaToTransparency",(function(){return n})),i.d(t,"transparencyToAlpha",(function(){return o})),i.d(t,"resetTransparency",(function(){return a})),i.d(t,"getLuminance",(function(){return l})),i.d(t,"isHexColor",(function(){return c})),i.d(t,"colorFromBackground",(function(){return h})),i.d(t,"gradientColorAtPercent",(function(){return u})),i.d(t,"isColorDark",(function(){return d})),i.d(t,"rgbaFromInteger",(function(){return p})),i.d(t,"rgbaToInteger",(function(){return _})),i.d(t,"colorToInteger",(function(){return m}));var s=i("eJTA");function r(e,t,i){if(t=t||0, -!c(e))return i?Object(s.rgbaToString)(Object(s.rgba)(Object(s.parseRgb)(e),Object(s.normalizeAlphaComponent)(o(t)))):e;const[r,n,a]=Object(s.parseRgb)(e),l=Object(s.normalizeAlphaComponent)(o(t));return Object(s.rgbaToString)([r,n,a,l])}function n(e){return 100*(1-e)}function o(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function a(e){return"transparent"===e||c(e)?e:Object(s.rgbaToString)(Object(s.rgba)(Object(s.parseRgb)(e),Object(s.normalizeAlphaComponent)(1)))}function l(e){const t=Object(s.parseRgb)(e).map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function c(e){return 0===e.indexOf("#")}function h(e){return"black"===Object(s.rgbToBlackWhiteString)(Object(s.parseRgb)(e),150)?"#ffffff":"#000000"}function u(e,t,i){const[r,n,o,a]=Object(s.parseRgba)(e),[l,c,h,u]=Object(s.parseRgba)(t),d=Object(s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(u-a));return Object(s.rgbaToString)(d)}function d(e){return l(a(e))<.5}function p(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function _(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function m(e){const t=Object(s.tryParseRgba)(e);return null===t?0:_(t)}},TohL:function(e,t,i){"use strict";i.r(t),i.d(t,"LineToolArrowMark",(function(){return l})),i.d(t,"LineToolArrowMarkLeft",(function(){return c})),i.d(t,"LineToolArrowMarkUp",(function(){return h})),i.d(t,"LineToolArrowMarkRight",(function(){return u})),i.d(t,"LineToolArrowMarkDown",(function(){return d}));var s=i("Ocx9"),r=i("Ss5c"),n=i("tc+8"),o=i.n(n),a=i("j3hX");class l extends r.LineDataSource{constructor(e,t,s){const r=t||l.createProperties(null,s);super(e,r),this._textPaneView=null,i.e("lt-pane-views").then(i.bind(null,"ct+2")).then(({ArrowMarkPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}paneViews(e){const t=super.paneViews();return null!==t&&this._textPaneView&&t.push(this._textPaneView),t}pointsCount(){return 1}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new s.DefaultProperty(t,e);return l._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"5sLb")).then(e=>e.ArrowMarkDefinitionsViewModel)}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().arrowColor])),e.addChild("textsColors",new a.LineToolColorsProperty([e.childs().color])),e.hasChild("text")||e.addChild("text",new o.a("")),e.addExclusion("text")}}l.version=2;class c extends l{constructor(e,t){super(e,t,"linetoolarrowmarkleft")}direction(){return"left"}name(){return"Arrow Mark Left"}textAlignParams(){return{horzAlign:"left", -vertAlign:"middle",offsetX:22,offsetY:3}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkleft")}}class h extends l{constructor(e,t){super(e,t,"linetoolarrowmarkup")}direction(){return"up"}name(){return"Arrow Mark Up"}textAlignParams(){return{horzAlign:"center",vertAlign:"top",offsetX:0,offsetY:20}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkup")}}class u extends l{constructor(e,t){super(e,t,"linetoolarrowmarkright")}direction(){return"right"}name(){return"Arrow Mark Right"}textAlignParams(){return{horzAlign:"right",vertAlign:"middle",offsetX:22,offsetY:3,forceTextAlign:!0}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkright")}}class d extends l{constructor(e,t){super(e,t,"linetoolarrowmarkdown")}direction(){return"down"}name(){return"Arrow Mark Down"}textAlignParams(){return{horzAlign:"center",vertAlign:"bottom",offsetX:0,offsetY:20}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkdown")}}},"U0+/":function(e,t,i){"use strict";i.r(t),i.d(t,"StudyMetaInfoRepository",(function(){return h}));i("YFKU");var s=i("Eyy1"),r=i("0YCj"),n=i.n(r),o=i("Si3H"),a=i("lCO3"),l=i("txPx");const c=Object(l.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});class h{constructor(e){this._nextRequestNumber=1,this._rawStudiesMetaInfo=[],this._isReady=!1,this._metaInfoQueryQueue=[],this._javaMetaInfoQueryQueue=[],this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._gateway=e}requestMetaInfo(){this._requestStarted();const e=this._makeNextRequestId();return c.logNormal("Requesting metainfo #"+e),new Promise(t=>{c.logNormal("Requesting studies metadata #"+e),this._gateway.requestMetadata(e,i=>{c.logNormal(`Requesting studies metadata #${e} finished`);const s=i.params[1].metainfo.slice();this._processLibraryMetaInfo(s),this._requestFinished(),t()})})}findById(e){if(!this._isReady)return this._enqueueMetaInfoQuery(e);const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}findAllJavaStudies(){return this._isReady?Promise.resolve(this._javaStudiesMetaInfo):this._enqueueJavaMetaInfoQuery()}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}getMigrations(){return this._studiesMigrations}addPineMetaInfo(e){return d(this._pineMetaInfoCache,e)}_processMigrations(e){throw new Error("not implemented")}_processSiteMetaInfo(e,t){throw new Error("not implemented")}_processLibraryMetaInfo(e){for(const t of e)u(t),d(this._javaStudiesMetaInfo,t);this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:i{this._metaInfoQueryQueue.push({studyDescriptor:e,resolver:t})})}_enqueueJavaMetaInfoQuery(){return new Promise(e=>{this._javaMetaInfoQueryQueue.push({resolver:e})})}_processPendingMetaInfoQueries(){for(;this._metaInfoQueryQueue.length;){const e=this._metaInfoQueryQueue.shift();this.findById(e.studyDescriptor).then(e.resolver)}}_processPendingFullMetaInfoQueries(){for(;this._javaMetaInfoQueryQueue.length;){this._javaMetaInfoQueryQueue.shift().resolver(this._javaStudiesMetaInfo)}}_findStudyMetaInfo(e){return"java"===e.type?this._javaStudiesMetaInfo.find(t=>t.id===e.studyId)||null:this._pineMetaInfoCache.find(t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||Object(s.ensureDefined)(t.pine).version===e.pineVersion))||null}_makeNextRequestId(){return"metadata_"+this._nextRequestNumber++}_compilePine(e){throw new Error("unsupported")}}function u(e){e.description_localized=window.t(e.description,{context:"study"})}function d(e,t){const i=new n.a(t);Object(o.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex(e=>e.id===i.id);if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?a.Version.parse(t.pine.version):null,o=void 0!==i.pine?a.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}},UAFa:function(e,t,i){"use strict";i.r(t);var s=i("i6cO"),r=i("23IT"),n=i("Eyy1");const o=new Map([[s.ColorerType.Main,"color"],[s.ColorerType.Text,"textColor"],[s.ColorerType.Border,"borderColor"],[s.ColorerType.Wick,"wickColor"],[s.ColorerType.Up,"colorup"],[s.ColorerType.Down,"colordown"]]);class a{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?Object(s.clearStyle)(t):Object(s.createEmptyStyle)();return o.forEach((e,t)=>{this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())}),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}class l{constructor(e,t,i,s){this._palettes=new Map,this._metaInfo=e,this._properties=t,this._indexes=s,this._plotStyle=t.styles[i];const r=Object(n.ensureDefined)(this._metaInfo.palettes);s.forEach((t,i)=>{const s=e.plots[t];if(s&&"palette"in s){const e=r[s.palette],t=this._properties.palettes[s.palette];e&&t&&this._palettes.set(i,{palette:e,props:t})}})}getPlotPointStyle(e,t){const i=t?Object(s.clearStyle)(t):Object(s.createEmptyStyle)();if(this._palettes.has(s.ColorerType.Main)){const t=Object(n.ensureDefined)(this._indexes.get(s.ColorerType.Main)),r=e[t+1];if(null!=r){const e=Object(n.ensureDefined)(this._palettes.get(s.ColorerType.Main)),t=e.palette,o=e.props,a=Object(n.ensureDefined)(t.valToIndex?t.valToIndex[r]:r),l=o.colors[a];i.lineWidth=l.width.value(),i.lineStyle=l.style.value()}} -return Object.keys(s.ColorerType).forEach(t=>{const s=parseInt(t);if(this._palettes.has(s)){const t=Object(n.ensureDefined)(this._indexes.get(s)),r=e[t+1];if(null!=r){const e=Object(n.ensureDefined)(this._palettes.get(s)),t=Object(n.ensureDefined)(e.palette.valToIndex?e.palette.valToIndex[r]:r),o=e.props.colors[t];i.colors[s]=o.color.value()}else i.colors[s]="transparent"}else if(this._plotStyle){const e=o.get(s);void 0!==e&&this._plotStyle[e]&&(i.colors[s]=this._plotStyle[e].value())}}),i}getDefaultPlotPointStyle(){const e=Object(n.ensureDefined)(this._palettes.get(s.ColorerType.Main)).props.colors[0];if(null!=e){return{colors:[e.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineWidth:e.width.value()}}return null}isColorDefined(){return!!this._palettes.size}singleColor(){return!1}}var c=i("Tmoa");class h{constructor(e){this._indexes=e}getPlotPointStyle(e,t){const i=t?Object(s.clearStyle)(t):Object(s.createEmptyStyle)();return this._indexes.forEach((t,s)=>{const r=e[t+1];if(null!=r){const e=Object(c.rgbaFromInteger)(r);i.colors[s]=e}else i.colors[s]="transparent"}),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}}i.d(t,"createStudyPlotColorProvider",(function(){return d}));const u=new Map([[s.ColorerType.Main,function(e,t){const i=Object(r.isColorerPlot)(t)||Object(r.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Text,function(e,t){const i=Object(r.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Background,function(e,t){return Object(r.isBgColorerPlot)(t)&&t.id===e}],[s.ColorerType.Border,function(e,t){const i=Object(r.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Wick,function(e,t){const i=Object(r.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Up,function(e,t){const i=Object(r.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Down,function(e,t){const i=Object(r.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function d(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex(e=>e.id===t),r=new Map;return i.forEach((e,i)=>{u.forEach((s,n)=>{s(t,e)&&r.set(n,i)})}),{plotIndex:-1===s?null:s,colorers:r}}(e,i);if(s.size)return e.isRGB?new h(s):new l(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new a(e[i]);const s=t.styles[i];return new a(s)}}},UCMi:function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("Ocx9").DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e("lt-pane-views").then(i.t.bind(null,"UcQu",7)).then(({DateAndPriceRangePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Date and Price Range"}static createProperties(e){var t=new r("linetooldateandpricerange",e);return n._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"Ax76"))).GeneralDatePriceRangeDefinitionsViewModel} -static _configureProperties(e){s._configureProperties(e)}}t.LineToolDateAndPriceRange=n},UCjq:function(e,t,i){"use strict";i.r(t);var s=i("YFKU"),r=i("Eyy1"),n=i("aO4+"),o=i("qFKp"),a=i("VaSN"),l=i("FQhm"),c=i("ogJP"),h=i("FIi8"),u=i("VdBB"),d=i("vTIA"),p=i("KnF9"),_=i("3ClC"),m=i("GxN8"),f=i("CW80"),g=i("mMWL"),v=i("bOGh"),b=i("fTGZ"),S=i("ikwP"),y=i("gAom"),w=i("mE5r"),C=i("1IXQ");function P(e,t){return e.position-t.position}function x(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}class T{constructor(e,t,i,s){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._terminated=!1,this._minSpeed=e,this._maxSpeed=t,this._dumpingCoeff=i,this._minMove=s}addPosition(e,t){if(null!==this._position1){if(this._position1.time===t)return void(this._position1.position=e);if(Math.abs(this._position1.position-e)50)return;let i=0;const s=x(this._position1,this._position2,this._maxSpeed),r=P(this._position1,this._position2),n=[s],o=[r];if(i+=r,null!==this._position3){const e=x(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=P(this._position2,this._position3);if(n.push(e),o.push(t),i+=t,null!==this._position4){const e=x(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=P(this._position3,this._position4);n.push(e),o.push(t),i+=t}}}}let a=0;for(let l=0;lthis._state&&this._chartModel().lightUpdate(),this._topCanvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._chart=e,this._state=t,this._options=Object(c.merge)(Object(c.clone)(ie),i),this._paneWidgetsSharedState=s,this._state&&(this._state.onDestroyed().subscribe(this,this._onStateDestroyed,!0),this._state.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged));const r={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(r.contextMenu=this._options.priceScaleContextMenu);const n=(e,t,i,s,n)=>new C.PriceAxisWidget(this,this._chartUndoModel(),i,t,e,r,s,n),o=e.properties().childs().scalesProperties,l=this._chartModel().rendererOptionsProvider(),h={backgroundBasedTheme:e.backgroundBasedTheme(), -rendererOptionsProvider:l,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value()},u={showLabels:!1};this._lhsPriceAxisesContainer=new w.a(o,"left",n,h,u),this._rhsPriceAxisesContainer=new w.a(o,"right",n,h,u),this._paneCell=document.createElement("td"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=Object(S.createBoundCanvas)(this._div,new S.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const d=this._canvasBinding.canvas;d.style.position="absolute",d.style.left="0",d.style.top="0",this._topCanvasBinding=Object(S.createBoundCanvas)(this._div,new S.Size(16,16)),this._topCanvasBinding.subscribeCanvasConfigured(this._topCanvasConfiguredHandler);const p=this._topCanvasBinding.canvas;p.style.position="absolute",p.style.left="0",p.style.top="0",this._rowElement=document.createElement("tr"),this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(),Object(z.a)().subscribe(this._onMagnetStateChangedListener),Object(q.c)().subscribe(this._onShiftKeyStateChangedListener)}destroy(){this._chart.onPaneWidgetDestroyed(this),this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeCanvasConfigured(this._topCanvasConfiguredHandler),this._topCanvasBinding.destroy(),this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),null!==this._hideNotMainSourcesInLegendSpawn&&this._hideNotMainSourcesInLegendSpawn.destroy(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&(this.state().onDestroyed().unsubscribeAll(this),this.state().dataSourcesCollectionChanged().unsubscribeAll(this)),Object(z.a)().unsubscribe(this._onMagnetStateChangedListener),Object(q.c)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this)}size(){return this._size}setSize(e){Object(r.assert)(e.w>=0&&e.h>=0,"Try to set invalid size to PaneWidget "+JSON.stringify(e)),this._size.equals(e)||(this._size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._topCanvasBinding.resizeCanvas({width:e.w,height:e.h}),this._paneCell.style.width=e.w+"px", -this._paneCell.style.height=e.h+"px",this._div.style.width=e.w+"px",this._div.style.height=e.h+"px",this._rowElement.classList.toggle("js-hidden",0===e.h),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.w))}width(){return this._size.w}height(){return this._size.h}backgroundColor(){return this._chartModel().backgroundColor().value()}processDoubleClickOnSource(e,t){e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}setCursorForTool(e,t,i){const s=g.tool.value();if(t&&t.control()&&e)return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case j.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case j.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case j.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case j.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case j.PaneCursorType.Default:this._setCursorClassName("default");break;case j.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case j.PaneCursorType.Grabbing:this._setCursorClassName("grabbing")}return}if(Object(g.toolIsCursor)(s)){if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}if("eraser"===s)return void this._setCursorClassName("eraser");if("zoom"===s)return void this._setCursorClassName("zoom-in");const r=g.cursorTool.value();"dot"!==r?"arrow"!==r?this._setCursorClassName(""):this._setCursorClassName("default"):this._setCursorClassName("dot")}showContextMenuForSelection(e){const t=this._chartUndoModel().selection();if(t.isEmpty())return;const i=t.dataSources().filter(e=>e.hasContextMenu());this.showContextMenuForSources(i,e)}async showContextMenuForSources(e,t,i){if(!e.length)return Promise.resolve(null);const s=e[0],r=Object(c.merge)(Object(c.clone)(this._options.contextMenu),i||{}),n=new E.ActionsProvider(this._chart,r);if(s===this._chartUndoModel().crossHairSource())return s.handleContextMenuEvent(t),Promise.resolve(null);{const i=await n.contextMenuActionsForSources(e);return 0===i.length?Promise.resolve(null):k.ContextMenuManager.createMenu(i).then(e=>(e.show(t),e))}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return Object(r.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&(this.state().onDestroyed().unsubscribeAll(this),this.state().dataSourcesCollectionChanged().unsubscribeAll(this)),this._state=e,this.hasState()&&(this.state().onDestroyed().subscribe(this,this._onStateDestroyed,!0), -this.state().dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),this.updatePriceAxisWidgets()))}getScreenshotData(e){const t=[],i=[];let s,r=[];const n=this.state().sourcesByGroup().allExceptSpecialSources().slice().reverse(),o=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();if(o.showLegend.value()||(null==e?void 0:e.showCollapsedLegend))for(const a of n){const n=a.statusView();Object(_.isStudy)(a)?a.properties().visible.value()&&n&&o.showStudyTitles.value()&&(t.push(a.statusProvider((null==e?void 0:e.status)||{}).text()),i.push(a.valuesProvider().getValues(null))):a===this._chartModel().mainSeries()&&n&&o.showSeriesTitle.value()&&(s=a.statusProvider((null==e?void 0:e.status)||{}).text(),r=a.valuesProvider().getValues(null))}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvas.toDataURL(),canvas:this._canvasBinding.canvas,contentWidth:this._size.w,contentHeight:this._size.h,studies:t,studiesValues:i,containsMainSeries:this.containsMainSeries(),mainSeriesText:s,mainSeriesValues:r}}hardResetCanvas(){this._size.equals(new S.Size(0,0))||(Object(S.hardResizeCanvas)(this._canvasBinding,this._size),Object(S.hardResizeCanvas)(this._topCanvasBinding,this._size),this._lhsPriceAxisesContainer.hardResetCanvas(),this._rhsPriceAxisesContainer.hardResetCanvas())}updatePriceAxisWidgets(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount(),s=this.state(),r=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(r,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}update(){this.hasState()&&(this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e=G.InvalidationLevel.None){this.hasState()&&null!==this._legendWidget&&(e===G.InvalidationLevel.Full?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e,t){this._themedTopColor=e,this._themedBottomColor=t,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvas}hasCanvas(e){return this._canvasBinding.canvas===e||this._topCanvasBinding.canvas===e}pinchStartEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),this._options.handleScale.pinch&&(this._terminateActiveAnimations(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this)))}pinchEvent(e,t){ -if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return;const i=10*(t-this._prevPinchScale);this._prevPinchScale=t,this._chartModel().zoomTime(e.x,i,!0),this._prevPinchScale=t}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){this._onMouseEvent(),this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this.hasState()&&(this._chart.setActivePaneWidget(this),this._mouseDownOrTouchStartEvent(e),this._mouseOrTouchMoveEvent(e)))}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){var t,i;if(this._chart.readOnly())return;const s=this._dataSourceAtPoint(e.localX,e.localY);if(null===s||s.isCustom||null===s.source)return;if(((null===(t=s.hittest)||void 0===t?void 0:t.result())||0)<=u.HitTestResult.MOVEPOINT_BACKGROUND)return;const n=new p.EnvironmentState(e),o=null===(i=s.hittest)||void 0===i?void 0:i.eraseMarker();if(n.control()&&void 0!==o&&s.source.processErase)return void s.source.processErase(this._chartUndoModel(),o);const a=this._chartUndoModel();a.selection().isSelected(s.source)||a.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(Object(r.ensureNotNull)(s.source))}),this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._longTap=!0,null===this._startTrackPoint&&this._trackingModeShouldBeActive()&&this.startTrackingMode(new n.Point(e.localX,e.localY),new n.Point(e.localX,e.localY),new p.EnvironmentState(e)))}mouseEnterEvent(e){this._onMouseEvent(),this.hasState()&&(this._chart.setActivePaneWidget(this),this._setCursorPosition(e.localX,e.localY,new p.EnvironmentState(e)))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){ -this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(){this._processOutsideClick({hittest:null,isCustom:!1,renderer:null,source:null})}cancelZoom(){this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this._startChangeLineToolParams=null,this._startMoveLineToolParams=null,this._chartUndoModel().selectionMacro(e=>e.clearSelection()),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this._setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e,t){if(!this._chartUndoModel()||!this.hasState())return;this._state&&(e.priceScaleSideMaxLevel("left")>G.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>G.InvalidationLevel.Cursor)&&(this._recalculatePriceScales(),this._chartModel().updateCrosshairPositionByOriginCoords()),this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left")),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right"));const i=e.fullInvalidation();if(i!==G.InvalidationLevel.None){if(i>G.InvalidationLevel.Cursor){const e=Object(r.ensureNotNull)(this._canvasBinding.canvas.getContext("2d"));e.setTransform(1,0,0,1,0,0);const i=this._canvasRenderParams();this._drawBackground(e,i),this._state&&(this._drawSources(e,i),this._drawBarsMarks(e,i,t))}if(this._state){const e=Object(r.ensureNotNull)(this._topCanvasBinding.canvas.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=this._topCanvasRenderParams();e.clearRect(0,0,Math.ceil(this._size.w*t.pixelRatio),Math.ceil(this._size.h*t.pixelRatio)),this._drawCrossHair(e,t),this._drawActiveLineTools(e,t)}}}pasteImageAsLineTool(e){var t;const i=this._chartModel().timeScale(),s=i.width(),n=Object(r.ensureNotNull)(this._state).height(),o=Object(r.ensureNotNull)(this._state).defaultPriceScale(),a=Object(r.ensureNotNull)(Object(r.ensureNotNull)(o.mainSource()).firstValue()),l={price:o.coordinateToPrice(n/2,a),index:i.coordinateToIndex(s/2)},c=Object(f.createLineToolProperties)("LineToolImage");null===(t=c.child("url"))||void 0===t||t.setValue(e),this._chartUndoModel().createLineTool(Object(r.ensureNotNull)(this._state),l,"LineToolImage",c)}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0){ -const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(),this.setCursorForTool()}cancelMeasuring(){this._chartUndoModel().crossHairSource().clearMeasure(),Object(g.resetToCursor)(),this.setCursorForTool()}_topCanvasRenderParams(){return{pixelRatio:this._topCanvasBinding.pixelRatio,physicalWidth:this._topCanvasBinding.canvas.width,physicalHeight:this._topCanvasBinding.canvas.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_canvasRenderParams(){return{pixelRatio:this._canvasBinding.pixelRatio,physicalWidth:this._canvasBinding.canvas.width,physicalHeight:this._canvasBinding.canvas.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,r){return!(!Object(g.toolIsMeasure)(g.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,i),s=this._chartModel().magnet().align(s,r,this.state()),t.startMeasuring({price:s,index:r},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?Object(g.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const r=this._chart.model().model().zoomEnabled();if("zoom"===g.tool.value()&&r){const r=this._chartUndoModel(),n=r.timeScale().indexToCoordinate(i)-.5*r.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,s),this._chartModel().crossHairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),s=Object(r.ensureNotNull)(t.mainDataSource()).firstValue(),n=i.coordinateToPrice(e.localY,Object(r.ensureNotNull)(s)),o=this._chartUndoModel(),a=Math.round(o.timeScale().coordinateToIndex(e.localX)),l=Object(r.ensureNotNull)(this._firstZoomPoint);a!==l.index&&o.zoomToViewport(l.index,a,l.price,n,t),this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,Object(g.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if(e.source&&"eraser"===g.tool.value()&&!e.isCustom&&(!(i=e.source)||!i.customization||!i.customization.disableErasing)){const i=this._chartUndoModel();if(null!==e.hittest&&(Object(f.isLineTool)(e.source)||Object(_.isStudy)(e.source))){const s=e.hittest.eraseMarker();return t.control()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1} -_tryStartChangingLineTool(e,t,i,s){var n,o;if(e.isTouch&&null!==this._startTrackPoint)return!1;if((!e.isTouch||!this._preventSourceChange)&&t.hittest&&Object(f.isLineTool)(t.source)&&t.hittest.result()===u.HitTestResult.CHANGEPOINT){const a=this._chartUndoModel(),l=Object(r.ensure)(null===(n=this.state().mainDataSource())||void 0===n?void 0:n.firstValue()),c=Object(r.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,l);a.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(t.source)});const h=a.model().magnet().align(c,s,this.state()),u=null===(o=t.hittest.data())||void 0===o?void 0:o.pointIndex;return this._startChangeLineToolParams={source:t.source,startPoint:{index:s,price:h},screenPoint:{x:e.localX,y:e.localY},pointIndex:u,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.control()){const t=this._chartUndoModel().selection().dataSources().filter(e=>e.cloneable());if(s&&s.cloneable()&&t.push(s),t.length>0)return this._clonningAtMoveLineTools=t.map(e=>e.id()),this._startCloningPoint=new n.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t){const i=this._chartUndoModel(),s=this._chartModel();if(t.control()&&this._clonningAtMoveLineTools){const o=new n.Point(e.localX,e.localY),a=Object(r.ensureNotNull)(this._startCloningPoint).subtract(o).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=s.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const s=this.cloneLineTools(l,!0).map(e=>Object(r.ensureNotNull)(i.model().dataSourceForId(e)));i.selectionMacro(e=>{e.clearSelection(),s.forEach(t=>{e.addSourceToSelection(t)})});const o=new n.Point(e.localX,e.localY),a=Object(r.ensureNotNull)(s[0].priceScale()),c=Object(r.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:i.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,Object(r.ensureNotNull)(c))};i.startMovingSources(s,{logical:h,screen:o},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){var o,a;if(!this.hasState())return;const l=this._chartUndoModel();let c=!1,h=null;const u=g.tool.value();Object(g.hideAllDrawings)().value()&&Object(g.hideAllIndicators)().setValue(!1),Object(g.hideAllDrawings)().setValue(!1),Object(g.lockDrawings)().setValue(!1),e.isTouch&&(Object(f.isLineToolName)(u)&&!Object(B.isLineDrawnWithPressedButton)(u)||l.lineBeingCreated())&&this._initToolCreationModeParams(e);const d=l.lineBeingCreated();if(d&&!Object(B.isLineDrawnWithPressedButton)(d.toolname)){const u=Object(r.ensure)(null===(o=d.ownerSource())||void 0===o?void 0:o.firstValue());if(e.isTouch){if(!this._startTouchPoint){this._startTouchPoint=new n.Point(e.pageX,e.pageY);const t=d.points(),i=t[t.length-1],s=l.timeScale().indexToCoordinate(i.index),o=Object(r.ensureNotNull)(d.priceScale()).priceToCoordinate(i.price,u);return void(this._initCrossHairPosition=new n.Point(s,o))}}else{h=d;const n=l.model().paneForSource(d);if(n!==this._state&&null!==n){ -const i=this._externalPaneXCoord(n,e.localX),s=this._externalPaneYCoord(n,e.localY);c=l.continueCreatingLine({index:Math.round(l.timeScale().coordinateToIndex(i)),price:Object(r.ensure)(null===(a=d.priceScale())||void 0===a?void 0:a.coordinateToPrice(s,u))},t)}else{const e=l.model().magnet().align(s,i,this.state());c=l.continueCreatingLine({index:i,price:e},t)}}}else if(!e.isTouch||Object(B.isLineDrawnWithPressedButton)(u)){const e={index:i,price:l.model().magnet().align(s,i,this.state())};h=l.createLineTool(this.state(),e,u),l.lineBeingCreated()||(c=!0)}h&&l.selectionMacro(e=>e.addSourceToSelection(Object(r.ensureNotNull)(h))),c&&h&&(this._finishTool(h),e.preventDefault())}_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let r=null;if(null===t.source||t.source.isSelectionEnabled()){let n=e.isTouch?Boolean(t.hittest&&t.hittest.result()>=u.HitTestResult.MOVEPOINT_BACKGROUND):Boolean(t.hittest&&t.hittest.result()>u.HitTestResult.MOVEPOINT_BACKGROUND);this._preventSourceChange&&(n=!1),s.selectionMacro(e=>{var s;n&&t.source?(i.control()||e.selection().isSelected(t.source)||e.clearSelection(),i.control()&&e.selection().isSelected(t.source)?(r=t.source,e.removeSourceFromSelection(t.source)):e.addSourceToSelection(t.source,(null===(s=null==t?void 0:t.hittest)||void 0===s?void 0:s.data())||void 0),e.selection().allSources().length>1&&Object(F.trackEvent)("GUI","Multiselect","Click Select")):i.control()||e.clearSelection()})}return r}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,t)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e)._setCursorPosition(t,i,s)}_setCursorPosition(e,t,i){this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){var t;null===(t=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY)).hittest)||void 0===t||t.tryCallMouseUpOrTouchEndHandler(e)}_crossHairShouldBeVisible(){const e=this._chartModel().crossHairSource();return Object(f.isLineToolName)(g.tool.value())||Object(g.toolIsMeasure)(g.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){let i=null,s=null,r=null;if(!this.hasState())return null;const o=this.state(),a=o.height(),l=o.width();let c=!1;const h=(e,t,n,o)=>{const a=r?r.result():0;e.result()>a&&(r=e,i=t,s=n,c=o)},u=this._canvasRenderParams(),p=new n.Point(e,t),_=this._chartUndoModel() -;this._hitTestChartSources(u,[_.crossHairSource()],p,h),this._hitTestCustomSources(u,o.customSources(d.a.Topmost),p,h);const m=o.sourcesByGroup();this._hitTestChartSources(u,m.tradingSources(),p,h),this._hitTestCustomSources(u,o.customSources(d.a.Foreground),p,h);const f=[...this._chartModel().multiPaneSources(o),...m.hitTestSources()];if(this._hitTestChartSources(u,f,p,h),this.containsMainSeries()){const e=_.barsMarksSources();for(let h=0;h=0;--r){const l=t[r],c=l.paneViews(n);if(0!==c.length)for(let t=c.length-1;t>=0;--t){const r=c[t].renderer(o,a);if(null!==r){const t=r.hitTest(i,e);null!==t&&s(t,l,r,!0)}}}}_hitTestChartSources(e,t,i,s){const n=Object(r.ensureNotNull)(this._state),o=n.height(),a=n.width();for(let r=t.length;0{if((null===n||n.terminated())&&(null===o||o.terminated()))return;const e=Date.now();let t=null===n||n.finished(e);const i=null===o||o.finished(e);if(null!==n&&!n.terminated()){const i=r.rightOffset();s.scrollTimeTo(n.getPosition(e)),i===r.rightOffset()&&(t=!0,this._scrollXAnimation=null)}null===o||o.terminated()||null===this._scrollPriceScale||s.scrollPriceTo(this.state(),this._scrollPriceScale,o.getPosition(e)),t&&i?this._finishScroll():requestAnimationFrame(a)};requestAnimationFrame(a)}return t}_terminateActiveAnimations(){const e=Date.now(),t=null===this._scrollXAnimation||this._scrollXAnimation.finished(e),i=null===this._scrollYAnimation||this._scrollYAnimation.finished(e);null===this._scrollXAnimation&&null===this._scrollYAnimation||t&&i||this._finishScroll(),null!==this._scrollXAnimation&&(this._scrollXAnimation.terminate(),this._scrollXAnimation=null), -null!==this._scrollYAnimation&&(this._scrollYAnimation.terminate(),this._scrollYAnimation=null)}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||Object(f.isLineToolName)(g.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint}_isSelectBarModeEnabled(){return this._chartUndoModel().crossHairSource().selectBarMode().value()}_preventCrossHairMove(){return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e){const t=this._chartUndoModel(),i=g.tool.value();if(Object(g.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),t.selectionMacro(t=>{t.addSourceToSelection(e)}),Object(B.isTextToolName)(i)){const i=t.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,R.TabNames.text,void 0,i)}this._lastFinishedToolId=e.id(),Object(V.c)(e)}_alignSourcesThatBeingMoved(e,t,i,s){const r=this._chartUndoModel(),o=r.timeScale().coordinateToIndex(t);r.model().sourcesBeingMoved().forEach(e=>{const a=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());null!==a&&(this.setCursorForTool(),r.moveSources({screen:new n.Point(t,i),logical:{index:o,price:a}},s))})}_resetMeasureIfRequired(){this._needResetMeasureLater&&(Object(g.resetToCursor)(),this._needResetMeasureLater=!1)}_drawBackground(e,t){const i=Math.ceil(t.pixelRatio*this._size.w),s=Math.ceil(t.pixelRatio*this._size.h),r=this._chartModel(),n=r.backgroundTopColor().value(),o=r.backgroundColor().value();n===o?Object(S.clearRect)(e,0,0,i+1,s+1,o):Object(y.clearRectWithGradient)(e,0,0,i+1,s+1,n,o)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;const s=this.state();if(!s.containsMainSeries())return;const r=i.paneViews(),n=s.height(),o=s.width();for(const a of r){e.save();const i=a.renderer(n,o);i&&i.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crossHairSource();!i.visible&&Object(g.lockTimeAxis)().value()&&(i.setLockedPosition(Object(r.ensureNotNull)(this._state)),i.updateAllViews()),this._drawSourceImpl(e,t,Q,$,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved()].filter(e=>!!e);for(const r of s){(i.paneForSource(r)===this.state()||r.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,Q,$,r)}}_drawSources(e,t){const i=this.state(),s=i.model(),r=i.sourcesByGroup(),n=r.tradingSources(),o=[...s.multiPaneSources(i),...r.generalSources()],a=r.phantomSources(),l=i.customSources(d.a.Background).slice(),h=i.customSources(d.a.Foreground).slice(),u=i.customSources(d.a.Topmost).slice();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,Q,$,s.gridSource()),this._drawWatermark(e,t);for(const c of l)this._drawSourceImpl(e,t,Q,X,c);for(const c of o)this._drawSourceImpl(e,t,Q,X,c) -;for(const c of h)this._drawSourceImpl(e,t,Q,X,c);for(const c of a)this._drawSourceImpl(e,t,Q,X,c);const p=new Set;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved()].filter(c.notNull).forEach(e=>p.add(e.id()));let _=s.hoveredSource();null!==_&&(Z(_)||Object(f.isLineTool)(_)&&p.has(_.id())||Object(m.a)(_)&&!o.includes(_)?_=null:p.add(_.id()));const g=s.selection().allSources().filter(e=>!(Object(m.a)(e)&&!o.includes(e))&&(!p.has(e.id())&&!Z(e)));g.forEach(e=>p.add(e.id()));{for(const s of l)this._drawSourceImpl(e,t,Q,$,s,p);for(const s of o)this._drawSourceImpl(e,t,Q,$,s,p);for(const s of h)this._drawSourceImpl(e,t,Q,$,s,p);const i=s.activeStrategySource().value();i&&this.containsMainSeries()&&this._drawSourceImpl(e,t,te,$,i)}for(const c of n)this._drawSourceImpl(e,t,Q,X,c);for(const c of u)this._drawSourceImpl(e,t,Q,X,c);for(const c of o)this._drawSourceImpl(e,t,ee,$,c,p);for(const c of h)this._drawSourceImpl(e,t,ee,$,c,p);for(const c of n)this._drawSourceImpl(e,t,Q,$,c,p);for(const c of u)this._drawSourceImpl(e,t,Q,$,c,p);for(const c of g)this._drawSourceImpl(e,t,Q,$,c);for(const c of g)this._drawSourceImpl(e,t,ee,$,c);_&&(this._drawSourceImpl(e,t,Q,$,_),this._drawSourceImpl(e,t,ee,$,_));for(const c of a)this._drawSourceImpl(e,t,Q,$,c,p);{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,r,n){if(n&&n.has(r.id()))return;const o=this.state(),a=o.height(),l=o.width(),c=i(r,this.state());if(c)for(const h of c){const i=h.renderer(a,l);i&&(e.save(),s(i,e,t),e.restore())}}_drawBarsMarks(e,t,i){if(this.containsMainSeries()&&!i){const i=this._chartUndoModel().barsMarksSources();for(const s of i)this._drawSourceImpl(e,t,Q,$,s)}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof v.a))return!1;if(t.isEmpty())return!1;const i=t.commands()[0];return i instanceof A.PriceScaleChangeUndoCommand||i instanceof O.a}_onStateDestroyed(){this.setState(null)}_getHideNotMainSourcesValue(){return re&&!this._chart.isActive()&&!this._chart.crossHairSyncEnabled()}_onDataSourcesCollectionChanged(){this._startMoveLineToolParams=null}_processMouseEnterLeaveMoveHandlers(e,t){var i,s,r,n;null!==this._prevHoveredHittest&&this._prevHoveredHittest.renderer!==e.renderer&&(Object(u.tryCallHandler)(t,null===(s=null===(i=this._prevHoveredHittest.hittest)||void 0===i?void 0:i.data())||void 0===s?void 0:s.mouseLeaveHandler),this._prevHoveredHittest=null),t.isTouch||(e.hittest&&(null===(r=this._prevHoveredHittest)||void 0===r?void 0:r.renderer)!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t),this._prevHoveredHittest=e),null===(n=e.hittest)||void 0===n||n.tryCallMouseMoveHandler(t))}_startChangeOrMoveLineToolIfNeeded(){if(null!==this._startChangeLineToolParams){const e=this._startChangeLineToolParams -;this._chartUndoModel().startChangingLinetool(e.source,e.startPoint,e.pointIndex,e.envState)}if(null!==this._startMoveLineToolParams){const e=this._startMoveLineToolParams;this._chartUndoModel().startMovingSources(e.source,e.startPoint,e.itemIndex,e.envState)}this._startMoveLineToolParams=null,this._startChangeLineToolParams=null}_trackingModeShouldBeActive(){return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e){let t=null;const i=this._chartModel();if(e.source&&(t=e.isCustom?i.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==t){const e=this._lastClickedSource.id,t=this._lastClickedSource.isCustom?i.customSourceForName(e):i.dataSourceForId(e);null!==t&&t.onClickOutside&&(t.onClickOutside(),this._chartModel().updateSource(t))}this._lastClickedSource=null!==t?{id:t,isCustom:e.isCustom}:null}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,n=this._chartUndoModel();this._processOutsideClick(Object(r.ensureNotNull)(i)),!this._isSelectBarModeEnabled()||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||n.crossHairSource().trySelectCurrentBar(),(null===(t=null==i?void 0:i.hittest)||void 0===t?void 0:t.tryCallClickOrTapHandler(e))&&n.model().updateSource(Object(r.ensureNotNull)(s)),!e.isTouch||this._isSelectBarModeEnabled()||i&&i.source===n.crossHairSource()||this._tryExitTrackingMode(),s instanceof b.BarsMarksContainer&&i&&i.hittest&&i.hittest.data()&&s.onClicked(Object(r.ensureNotNull)(i.hittest).data()),s&&Object(f.isLineTool)(s)&&Object(l.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e){var t;if(e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null,!this.hasState())return;if(this._terminateActiveAnimations(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}Object(l.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),e.isTouch||this._updateCommonTooltip(null);const i=this._chartUndoModel(),s=new p.EnvironmentState(e);i.mainSeries().clearGotoDateResult(),this.hideInplaceEditor();const o=this.state().defaultPriceScale();if(o.isEmpty()||i.timeScale().isEmpty())return;const c=i.crossHairSource();if(!e.isTouch&&!Object(B.isLineDrawnWithPressedButton)(g.tool.value())){const t=i.lineBeingCreated(),r=null!==t?i.model().paneForSource(t):null -;null!==r&&r!==this._state?this._setCursorPositionOnExternalPane(r,e.localX,e.localY,s):this._setCursorPosition(e.localX,e.localY,s)}e.isTouch&&Object(f.isLineToolName)(g.tool.value())&&(Object(B.isLineDrawnWithPressedButton)(g.tool.value())||null!==c.pane?Object(B.isLineDrawnWithPressedButton)(g.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const h=Object(r.ensureNotNull)(this.state().mainDataSource()).firstValue();if(null===h){const t=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));return void(this._chart.readOnly()||(this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,s),t.source&&t.source instanceof D.PriceDataSource&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this)))}const d=o.coordinateToPrice(e.localY,h),_=this._chartModel().timeScale().coordinateToIndex(e.localX);if(c.startMeasurePoint()&&c.endMeasurePoint()&&c.clearMeasure(),s.shift()&&Object(g.toolIsCursor)(g.tool.value())&&i.selection().isEmpty()&&g.tool.setValue("measure"),!e.isTouch&&this._tryStartMeasure(e,c,s,d,_))return;if(!e.isTouch&&this._tryFinishMeasure(e,c))return;if(this._tryFinishZoom(e))return;if(this._tryStartZoom(e,d,_,s))return;e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=c.currentPoint(),this._startTrackPoint=new n.Point(e.localX,e.localY)):this._isSelectBarModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new n.Point(e.localX,e.localY),new n.Point(e.localX,e.localY),new p.EnvironmentState(e)));const m=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));if(e.isTouch&&(this._preventSourceChange=null===m.source||!i.selection().isSelected(m.source)),!this._isSelectBarModeEnabled()&&!this._isScrolling){if(e.isTouch&&(Object(g.toolIsMeasure)(g.tool.value())||null!==c.measurePane()))return void this._initToolCreationModeParams(e);if(Object(f.isLineToolName)(g.tool.value())||i.lineBeingCreated())return s.shift()||i.selectionMacro(e=>e.clearSelection()),void this._mouseDownEventForLineTool(e,s,_,d)}if(null===(t=m.hittest)||void 0===t||t.tryCallMouseDownOrTouchStartHandler(e),!this._chart.readOnly()){const t=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,m,s);if(m.hittest&&m.source){const t=m.hittest.data();if(m.isCustom){if(m.hittest.hasPressedMoveHandler(e))return void i.model().setCustomSourceMovingHitTestData(t)}else if((null==t?void 0:t.areaName)===u.AreaName.SourceItemMove){const s=null==t?void 0:t.itemIndex;if(void 0!==s)return void i.startCustomMoving(m.source,s,e)}}if(this._tryHandleEraserMouseDown(m,s))return;const r=m.source&&Object(f.isLineTool)(m.source)&&m.source.isLocked&&m.source.isLocked();if(!(Object(g.lockDrawings)().value()||r)&&!m.isCustom){if(m.source&&m.source.userEditEnabled&&!m.source.userEditEnabled())return;if(this._tryStartChangingLineTool(e,m,s,_))return;if(m.hittest&&((v=m.hittest.result())===u.HitTestResult.MOVEPOINT||v===u.HitTestResult.MOVEPOINT_BACKGROUND&&Object(a.lastEventIsTouch)())){ -if(this._tryStartCloning(e,m,s,t))return;if(this._tryStartMovingLineTool(e,m,s,_))return}}if(m.source&&m.source instanceof D.PriceDataSource&&m.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(m.source,this))return}var v;m&&m.hittest&&m.hittest.result()===u.HitTestResult.REGULAR||(this._processing=!0)}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;const s=e.isTouch&&null!==this._startTrackPoint,n=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveLineToolParams=null,this._startChangeLineToolParams=null;const o=this._chartUndoModel(),c=o.model().customSourceMovingHitTestData();null!==c||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const h=o.model(),d=h.crossHairSource();if(d.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(d.selection());o.selectionMacro(t=>{e.forEach(e=>{t.addSourceToSelection(e)})}),d.clearSelection(),Object(F.trackEvent)("GUI","Multiselect","Area Select")}Object(l.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const _=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const m=new p.EnvironmentState(e),v=g.tool.value();if(e.isTouch&&!_&&(Object(g.toolIsMeasure)(v)||null!==d.measurePane())){if(null===d.measurePane()&&d.pane!==this._state)return void this._setCursorPosition(e.localX,e.localY);if(this._tryStartMeasure(e,d,m,d.price,d.index))return;if(this._tryFinishMeasure(e,d))return}if(e.isTouch&&!_&&!Object(B.isLineDrawnWithPressedButton)(v)&&Object(f.isLineToolName)(v)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(d.pane!==this._state)return void this._setCursorPosition(e.localX,e.localY,m);const i=d.currentPoint(),s=this.state().defaultPriceScale(),n=Object(r.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:s.coordinateToPrice(i.y,n)},l=Object(r.ensureNotNull)(o.createLineTool(this.state(),a,v));return o.selectionMacro(e=>{e.addSourceToSelection(l)}),o.lineBeingCreated()||(this._finishTool(l),e.preventDefault()),void(this._startTouchPoint=null)}const b=o.lineBeingCreated();if(b&&!Object(B.isLineDrawnWithPressedButton)(b.toolname)&&e.isTouch&&this._startTouchPoint){if(this._startTouchPoint=null,!_){const t=b.points()[b.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new p.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(b),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed()&&o.endCustomMoving(),null!==c&&(c.beingMoved&&(Object(u.tryCallHandler)(e,c.mouseUpHandler,c.touchEndHandler),this.setCursorForTool()),h.setCustomSourceMovingHitTestData(null)),h.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition()) -;if(Object(B.isLineDrawnWithPressedButton)(v)&&!this._isSelectBarModeEnabled()){const t=o.lineBeingCreated();null!==t&&(Object(V.c)(t),t.finish());const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const n=Object(r.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=s.coordinateToPrice(e.localY,n),l={index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(l)}if(h.sourcesBeingMoved().length)return o.endMovingSource(!1),h.sourcesBeingMoved().forEach(e=>{this.setCursorForTool(e)}),void h.invalidate(G.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=this._dataSourceAtPoint(e.localX,e.localY),i=e.localX>=0&&e.localXu.HitTestResult.MOVEPOINT_BACKGROUND||Object(a.lastEventIsTouch)())&&o.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(Object(r.ensureNotNull)(t.source))})}e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=i.crossHairSource(),o=e.localX,a=e.localY;this._prevMoveEventPosition=new n.Point(o,a);const l=new p.EnvironmentState(e);if(null!==this._firstZoomPoint)return void this._processMouseMoveWhileZoom(e,l);let c=!1;if(!(this._chart.readOnly()||this._editDialog&&this._editDialog.visible().value())){const s=g.tool.value();let r=null;if(!this._processing&&(Object(g.toolIsCursor)(s)||"eraser"===s||l.control()||!i.lineBeingCreated())){const e=t&&t.source,n=t&&t.hittest&&t.hittest.data();c=Boolean(n&&n.hideCrosshairLinesOnHover)||!!e&&Object(f.isLineTool)(e)&&-1!==J.indexOf(e.toolname), -t.hittest&&t.hittest.result()>u.HitTestResult.MOVEPOINT_BACKGROUND?(r=t.source,t.source&&t.source.isHoveredEnabled()&&("eraser"!==s||t.source!==i.mainSeries())?i.model().setHoveredSource(t.source,t.hittest.data()):i.model().setHoveredSource(null,null)):i.model().setHoveredSource(null,null)}if(this._options.sourceSelectionEnabled)if(this._isSelectBarModeEnabled())this._setCursorClassName("pointer");else{const e=t.hittest&&t.hittest.data(),i=e&&e.cursorType;this.setCursorForTool(r,l,null===i?void 0:i)}if(e.isTouch||this._updateCommonTooltip(t),null!==t.hittest&&t.hittest.hasPressedMoveHandler(e)){switch((t.hittest.data()||{}).cursorType){case j.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case j.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case j.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case j.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize")}}}if(this._preventCrossHairMove()&&this._clearCursorPosition(),s.setLinesShouldBeHidden(c),this._chart.readOnly()&&this._options.sourceSelectionEnabled&&(t.source&&t.source.isHoveredEnabled()?i.model().setHoveredSource(t.source,t.hittest&&t.hittest.data()):i.model().setHoveredSource(null,null)),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,o,a,l)}e.isTouch||this._setCursorPosition(o,a,l)}_pressedMouseOrTouchMoveEvent(e){var t;if(!this.hasState()||this._pinching)return;this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const i=new p.EnvironmentState(e),s=this._chartUndoModel(),o=s.crossHairSource(),a=e.localX,l=e.localY;if(this._prevMoveEventPosition=new n.Point(a,l),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const c=g.tool.value();if(e.isTouch&&this._startTouchPoint&&Object(f.isLineToolName)(c)&&!Object(B.isLineDrawnWithPressedButton)(c)&&!s.lineBeingCreated()&&!this._isSelectBarModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const h=o.measurePane();if(e.isTouch&&this._startTouchPoint&&(Object(g.toolIsMeasure)(c)||null!==h))return void this._updateCrosshairPositionInToolCreationMode(e,h||this.state());const d=s.lineBeingCreated();if(e.isTouch&&d&&!Object(B.isLineDrawnWithPressedButton)(d.toolname)){if(this._startTouchPoint){const t=Object(r.ensureNotNull)(s.lineBeingCreated()),i=Object(r.ensureNotNull)(s.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=Object(r.ensureNotNull)(this._initCrossHairPosition),t=new n.Point(a,l).subtract(this._startTrackPoint),s=e.add(t);this._setCursorPosition(s.x,s.y,i)}else e.isTouch&&this._preventCrossHairMove()||this._setCursorPosition(a,l,i) -;const _=this._isSelectBarModeEnabled();if(Object(f.isLineToolName)(c)&&!Object(B.isLineDrawnWithPressedButton)(c)&&!_&&!i.control())return;if(Object(B.isLineDrawnWithPressedButton)(c)&&!_){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const o=s.lineBeingCreated();if(!o)return;const a=new n.Point(e.localX,e.localY),l=Object(r.ensure)(null===(t=o.ownerSource())||void 0===t?void 0:t.firstValue());return a.price=i.coordinateToPrice(e.localY,l),a.index=Math.round(s.timeScale().coordinateToIndex(e.localX)),void s.continueCreatingLine(a)}if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(s.timeScale().isEmpty())return;const m=this._options.handleScroll;if((!m.pressedMouseMove||e.isTouch)&&(!m.horzTouchDrag&&!m.vertTouchDrag||!e.isTouch))return;if(s.customMoveBeingProcessed())return void s.processCustomMove(e);const v=s.model().customSourceMovingHitTestData();if(null!==v&&(s.model().processingCustomSourceMove(),Object(u.tryCallHandler)(e,v.pressedMouseMoveHandler,v.touchMoveHandler),!Object(u.shouldDefaultActionBeExecuted)(e,v,"pressedMouseMoveHandler","touchMoveHandler")))return;if(s.model().lineBeingEdited())return this._setCursorPosition(a,l,i),void this.setCursorForTool();if(s.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(s.model().sourcesBeingMoved(),e.localX,e.localY,i);if(this._tryFinishClonning(e,new p.EnvironmentState(e)))return;const b=Object(g.toolIsMeasure)(c)||o.startMeasurePoint()&&o.endMeasurePoint();this._chart.readOnly()||!i.control()||Object(f.isLineToolName)(c)||b?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this._setCursorPosition(e.localX,e.localY,new p.EnvironmentState(e))):this._isSelecting||(o.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t,i;if(!this.hasState())return;const s=this._chartUndoModel();s&&(e.isTouch||null!==s.crossHairSource().measurePane()||this._clearCursorPosition(),s.model().setHoveredSource(null,null),null!==this._prevHoveredHittest&&(Object(u.tryCallHandler)(e,null===(i=null===(t=this._prevHoveredHittest.hittest)||void 0===t?void 0:t.data())||void 0===i?void 0:i.mouseLeaveHandler),this._prevHoveredHittest=null),e.isTouch||this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget())}_mouseDoubleClickOrDoubleTapEvent(e){var t;if(!this.hasState())return;const i=!this._chart.readOnly()&&!Object(f.isLineToolName)(g.tool.value())&&Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY))||null;if(null===i)return;if(i.isCustom)return void(null===(t=i.hittest)||void 0===t||t.tryCallDblClickOrDblTapHandler(e));let s=i.hittest&&i.source||null;s&&i.hittest&&i.hittest.result()<=u.HitTestResult.MOVEPOINT_BACKGROUND&&!e.isTouch&&(s=null),s&&!s.isSelectionEnabled()&&(s=null), +return this._chartWidget.model().mainSeries().properties().interval.value()}setSymbol(e,t){if(e!==this.symbol()){var i=this._chartWidget.model().mainSeries().dataEvents();t&&b(i,(function(e){e||t()})),this._activateChart(),this._chartWidget.setSymbol(e)}}resetData(){this._chartWidget.model().mainSeries().rerequestData()}setResolution(e,t){var i=m.normalize(e);if(null!==i&&i!==this.resolution()){var s=this._chartWidget.model().mainSeries().dataEvents();t&&b(s,(function(e){e||t()})),this._activateChart(),this._chartWidget.setResolution(i)}}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");var i=this._chartWidget.model().model().dataSourceForId(e);if(i){var s=i.properties();s&&s.visible&&s.visible.setValue(t)}}availableZOrderOperations(e){var t=M(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}insertAfter(e,t){var i=this._chartWidget.model().model(),s=M(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertAfter(s,r)}insertBefore(e,t){var i=this._chartWidget.model().model(),s=M(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertBefore(s,r)}bringForward(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){var t=M(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}showPropertiesDialog(e){var t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error("Study or shape "+e+" does not exist");this._chartWidget.showChartPropertiesForSource(t)}getAllShapes(){return this._chartWidget.model().model().allLineTools().map(y).filter((function(e){return null!==e.name}))}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}removeEntity(e,t){var i=this._chartWidget.model().chartModel().dataSourceForId(e);i?t&&t.disableUndo?new C(this._chartWidget.model().chartModel(),[i],"").redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn("Can't find a source with id: "+e)}removeEntityWithUndo(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);this._chartWidget.model().removeSource(t,!1)}selection(){return null===this._selectionApi&&(this._selectionApi=new d(this._chartWidget.model().model())),this._selectionApi}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}drawOnAllCharts(e){T.drawOnAllCharts.setValue(e)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}setVisibleRange(e,t){return new Promise(function(i){this._chartWidget.setVisibleTimeRange(e.from,e.to,t,i)}.bind(this))}getVisibleRange(){var e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e +;var r=this._chartWidget.model().mainSeries(),n=r.syncModel();if(null===n)return e;var o=s(r.data().last()),a=i.lastBar()-o.index,l=a<=0?t.indexToTimePoint(i.lastBar()):n.projectTime(o.value[TradingView.TIME_PLOT],a);if(e.from=+t.indexToTimePoint(Math.max(0,i.firstBar()))||0,e.to=+l||0,m.isDWM(r.interval())){var c=_(r.interval(),r.symbolInfo());null!==c&&(e.from=c.timeToExchangeTradingDay(1e3*e.from)/1e3,e.to=c.timeToExchangeTradingDay(1e3*e.to)/1e3)}return e}getVisiblePriceRange(){return console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null}scrollPosition(){return this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return this._chartWidget.model().timeScale().defaultRightOffsetProperty().value()}_createTradingPrimitive(e,t){var i=this;var r,n,o=this._chartWidget.model().model(),a=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(a,(r=TradingView.CLOSE_PLOT,{index:(n=s(i._chartWidget.model().mainSeries().bars().last())).index,price:n.value[r]}),e)._adapter}createOrderLine(e){e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)}createPositionLine(e){e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)}createExecutionShape(e){e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)}createShape(e,t){return this.createMultipointShape([e],t)}_alignPoints(e){var t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval();if(t.timeScale().isEmpty()||!m.isDWM(s))return e;var r=_(s,i.symbolInfo());return null===r?e:e.map((function(e){return r.timeToSessionStart(1e3*e)/1e3}))}_convertUserPointsToDataSource(e){var t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),r=i.data();if(t.timeScale().isEmpty())return null;var n=e.map((function(e){return e.time||0})),o=this._alignPoints(n);function a(e,t,n){var o=s.closestIndexLeft(e)||0,a={index:o},l=s.valueAt(o);if(e>l&&o===s.lastIndex()){var c=i.syncModel().distance(l,e);c.success&&(a.index=a.index+c.result)}if(v(t))a.price=t;else{var h=n?["open","high","low","close"].indexOf(n)+1:1;h<=0&&(h=1),a.price=r.valueAt(o)[h]}return a}for(var l=[],c=0;c2)throw new Error("Wrong points count for "+t.shape+". Required 1 or 2");2===l.length&&(p.startChanging(1,l[1]),p.setPoint(1,l[1]),p.endChanging())}else{var _=p.pointsCount();if(_!==l.length&&-1!==_)throw new Error("Wrong points count for "+t.shape+". Required "+_);for(var m=P(h.name),g=1;gthis._minValue&&e.maxValue(){e.map(s.bind(null,this._model)).forEach(e=>t.addSourceToSelection(e))}):this.add([e])}canBeAddedToSelection(e){const t=s(this._model,e);return this._model.selection().canBeAddedToSelection(t)}set(e){Array.isArray(e)?this._model.selectionMacro(t=>{t.clearSelection(),e.map(s.bind(null,this._model)).forEach(e=>t.addSourceToSelection(e))}):this.set([e])}remove(e){Array.isArray(e)?this._model.selectionMacro(t=>{e.map(s.bind(null,this._model)).forEach(e=>t.removeSourceFromSelection(e))}):this.remove([e])}contains(e){const t=s(this._model,e);return this._model.selection().isSelected(t)}allSources(){return this._model.selection().dataSources().map(e=>e.id())}isEmpty(){return this._model.selection().isEmpty()}clear(){this._model.selectionMacro(e=>{e.clearSelection()})}onChanged(){return this._model.onSelectedSourceChanged()}}},Qtjj:function(e,t,i){"use strict";i.r(t),i.d(t,"TimeSynchronizer",(function(){return l}));var s=i("LxhU"),r=i("jCNj"),n=i.n(r),o=i("IiTo");let a=null;class l{constructor(e,t){var i,r;this._sourceTargetBarBuilder=null,this._cache=new Map,this._source=e,this._target=t,this._isResolutionTheSame=s.Interval.isEqual(e.getResolution(),t.getResolution()),this._isSessionTheSame=(i=e.getSymbolInfo(),r=t.getSymbolInfo(),i.timezone===r.timezone&&i.session===r.session), +this._shouldCorrectTradingDay=s.Interval.isDWM(e.getResolution())&&!this._isSessionTheSame}sourceTimeToTargetTime(e){if(this._isSessionTheSame&&this._isResolutionTheSame)return e;if(!this._source.isValid()||!this._target.isValid())return e;let t=this._cache.get(e);if(void 0===t){let i=1e3*e;if(this._shouldCorrectTradingDay){let e=n.a.utc_to_cal(this._source.getSession().timezone,i);e=this._source.getSession().spec.correctTradingDay(e);const t=new Date(e);n.a.set_hms(t,0,0,0,0,this._source.getSession().timezone),i=t.valueOf()}const s=this._sourceTargetBuilder();s.moveTo(i);const r=s.indexOfBar(i);t=s.startOfBar(Math.max(0,r))/1e3,this._cache.set(e,t)}return t}_sourceTargetBuilder(){if(null===this._sourceTargetBarBuilder){const e=this._isSessionTheSame?this._target.getSession():(null===a&&(a=new o.SessionInfo("Etc/UTC","24x7")),a);this._sourceTargetBarBuilder=Object(o.newBarBuilder)(this._target.getResolution(),this._target.getSession(),e)}return this._sourceTargetBarBuilder}}},RDDl:function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("Ocx9").DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e("lt-pane-views").then(i.t.bind(null,"VghZ",7)).then(({PriceRangePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Price Range"}static createProperties(e){var t=new r("linetoolpricerange",e);return n._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"Ax76"))).GeneralDatePriceRangeDefinitionsViewModel}static _configureProperties(e){s._configureProperties(e)}}t.LineToolPriceRange=n},RDU5:function(e,t,i){"use strict";i.r(t),i.d(t,"UndoCommand",(function(){return s}));class s{constructor(e,t=!0){this._customFlags={},this._text=e,this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},RTYN:function(e,t,i){"use strict";i.r(t),i.d(t,"PositionAveragePriceAxisView",(function(){return r}));var s=i("4TVt");class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},RXmj:function(e,t,i){"use strict";(function(e){var s=i("FIi8").deepExtend,r=i("ogJP").deepEquals,n=i("zUrt").backend;window.t("The publication preview could not be loaded. Please disable your browser extensions and try again.");function o(t){this._chartWidgetCollection=t,this._chartAboutToBeSavedDelegate=new e,this._chartSavedDelegate=new e,this._prevChartState=null,this._chartHasBeenModified=new e,this._chartSizeLimitExceededDelegate=new e}function a(e,t){e.content=JSON.stringify(t)}o.prototype.chartHasBeenModified=function(){return this._chartHasBeenModified},o.prototype.chartSizeLimitExceeded=function(){return this._chartSizeLimitExceededDelegate},o.prototype.chartAboutToBeSaved=function(){ +return this._chartAboutToBeSavedDelegate},o.prototype.chartSaved=function(){return this._chartSavedDelegate},o.prototype.whenReadyToSave=function(e){var t=this._chartWidgetCollection.activeChartWidget.value().model().mainSeries();if(t.symbolInfo()&&!t.hasDelayedSymbolIntervalChange())e();else{var i,s=null;i=function(){t.dataEvents().symbolError().unsubscribe(null,s,!0),e()},s=function(){t.dataEvents().symbolResolved().unsubscribe(null,i,!0)},t.dataEvents().symbolResolved().subscribe(null,i,!0),t.dataEvents().symbolError().subscribe(null,s,!0)}},o.prototype.saveToJSON=function(){var e=this._getCommonSavingInfo(!1);return a(e,this._getChartWidgetCollectionState(!1,!0)),e},o.prototype._fillAsyncInfo=function(e,t){var i=JSON.parse(e.content),r=this._chartWidgetCollection;return(t?r.asyncState():r.activeChartWidget.value().asyncState()).then((function(t){return e.content=JSON.stringify(s(i,t)),e}))},o.prototype._getChartWidgetCollectionState=function(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)},o.prototype._getCommonSavingInfo=function(e){var t={},i=this._chartWidgetCollection,s=i.activeChartWidget.value(),r=i.metaInfo,n=s.model().mainSeries(),o=n.properties(),a=n.symbolInfo();if(r.id.value()&&(t.id=r.id.value()),t.name=r.name.value()||"",t.description=r.description.value()||"",t.resolution=n.properties().interval.value(),t.symbol_type=null!==a&&a.type||"",t.exchange=null!==a&&a.exchange||"",t.listed_exchange=null!==a&&a.listed_exchange||"",null!==a&&n.isSpread()){var l=a.legs[0],c=a.base_name[0];c=c.split(":")[1],t.symbol=l,t.short_name=c,t.expression=a.full_name}else t.symbol=null!==a&&a.ticker||o.symbol.value(),t.short_name=o.shortName.value();if(null!==a){for(var h=[],u=0,d=a.legs.length;u{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handler.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._handler=t,this._options=Object(n.merge)(Object(n.clone)(c),i||{}),this._init()} +destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handler.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=_(e.changedTouches,Object(r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=p(e),null!==this._startPinchMiddlePoint)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(u(t),Object(r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handler.touchMoveEvent),Object(o.a)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(u(e),Object(r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e) +;this._processMouseEvent(t,this._handler.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=_(e.changedTouches,Object(r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=p(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handler.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(u(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||this._processTouchEvent(i,this._handler.tapEvent);0===this._tapCount&&Object(o.a)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,Object(o.a)(e))}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),s.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(u(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handler.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return;const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=p(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=u(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handler.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500), +this._tapPosition=u(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;s.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=u(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=u(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));{const e=this._target.ownerDocument,t=e=>{this._handler.mouseDownOutsideEvent&&(e.target&&this._target.contains(e.target)||this._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",t)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}s.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),Object(o.b)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(l,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",()=>{},{passive:!1})}_initPinch(){void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",e=>this._checkPinchState(e.touches),{passive:!0}),this._target.addEventListener("touchmove",e=>{if(2===e.touches.length&&null!==this._startPinchMiddlePoint&&void 0!==this._handler.pinchEvent){const t=d(e.touches[0],e.touches[1])/this._startPinchDistance;this._handler.pinchEvent(this._startPinchMiddlePoint,t),Object(o.a)(e)}},{passive:!1}),this._target.addEventListener("touchend",e=>{this._checkPinchState(e.touches)}))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1), +2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){const t=this._target.getBoundingClientRect()||{left:0,top:0};this._startPinchMiddlePoint={x:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,y:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this._startPinchDistance=d(e[0],e[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent(),this._clearLongTapTimeout()}_stopPinch(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.mouseLeaveEvent),this._acceptMouseLeave=!s.CheckMobile.iOS()}_longTapHandler(e){const t=_(e.touches,Object(r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handler.longTapEvent),this._processTouchEvent(i,this._handler.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if(Object(o.a)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handler.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:p(e){"touchstart"!==e.type&&Object(o.a)(e)}}}}function u(e){return{x:e.pageX,y:e.pageY}}function d(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function p(e){return e.timeStamp||performance.now()}function _(e,t){for(let i=0;ie.HighlighterDefinitionsViewModel)}_loadPaneViews(e){i.e("lt-pane-views").then(i.bind(null,"uRW3")).then(t=>{this._setPaneViews([new t.HighlighterPaneView(this,e)])})}static _configureProperties(e){r.a._configureProperties(e)}}},Si3H:function(e,t,i){"use strict";i.r(t);var s=i("Eyy1"),r=i("0YCj"),n=i.n(r),o=i("ogJP");i.d(t,"migrateMetaInfoAndPropState",(function(){return l}));const a=[new class{targetMetaInfoVersion(){return 47}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=47,!t.defaults||void 0===t.defaults.precision)return void(i.format={type:"inherit"});const s=t.defaults&&t.defaults.precision,r=Object(o.isNumber)(s)?s:parseInt(s);0===r?i.format={type:"volume"}:isFinite(r)?i.format={type:"price",precision:r}:i.format={type:"inherit"},delete t.defaults.precision}migratePropState(e){}},new class{targetMetaInfoVersion(){return 50}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=50,void 0===t.defaults||void 0===t.defaults.ohlcPlots||void 0===t.ohlcPlots)return;const r=t.ohlcPlots,n=t.defaults.ohlcPlots,o=Object(s.ensureDefined)(Object(s.ensureDefined)(i.defaults).ohlcPlots);for(const s of Object.keys(n)){const e=n[s];if("ohlc_candles"===e.plottype){let t=!1;const i=r[s];void 0!==i&&(t=!!i.drawBorder,delete i.drawBorder),o[s]=Object.assign({borderColor:"#000000",drawBorder:t},e)}}}migratePropState(e){}}];function l(e,t){const i=n.a.versionOf(e),r=e;void 0===r._serverMetaInfoVersion&&(r._serverMetaInfoVersion=i),a.forEach(r=>{i<0||i>=r.targetMetaInfoVersion()||(r.migrateMetaInfo(e),void 0!==t&&r.migratePropState(t),Object(s.assert)(e._metainfoVersion===r.targetMetaInfoVersion()))})}a.sort((function(e,t){return e.targetMetaInfoVersion()-t.targetMetaInfoVersion()}))},SqfW:function(e,t,i){"use strict";i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return o}));var s=i("tqok"),r=i("hsV8");function n(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===s.a?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function o(e,t,i){const s=Object(r.ensureTimePointIndexIndex)(i.indexOf(e.index));return Object.assign(Object.assign({id:t},e),{index:s})}},Ss5c:function(e,t,i){"use strict";var s=i("Eyy1").ensureDefined,r=i("aO4+").Point,n=i("dOnf").deepCopy,o=i("4TVt").LineToolPriceAxisView,a=i("fJhV").LineDataSourceTimeAxisView,l=i("mMWL"),c=i("LxhU").Interval,h=i("pPtI").getServerInterval,u=i("txPx").getLogger("Chart.LineDataSource"),d=i("FQhm"),p=i("aIyQ"),_=i("tc+8"),m=i("Kxc7"),f=i("0qMc").lineToolsLocalizedNames,g=m.enabled("datasource_copypaste"),v=i("ng+v").LineDataSourceBase,b={frozen:!1,visible:!0,intervalsVisibilities:{ticks:!0,seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1,minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,weeksFrom:1,weeksTo:52,months:!0,monthsFrom:1,monthsTo:12,ranges:!0}};class S extends v{constructor(e,t){super(e,t),this._onTemplateApplying=new p, +this._onTemplateApplied=new p,this._properties.hasChild("symbol")||this._properties.addChild("symbol",new _(e.mainSeries().symbol())),this._properties.hasChild("interval")||this._properties.addChild("interval",new _(e.mainSeries().interval())),this.calcIsActualSymbol(),this._properties.intervalsVisibilities.listeners().subscribe(this,S.prototype.calcIsActualSymbol);var i=this;if(this._properties.listeners().subscribe(this,(function(){i.propertiesChanged()})),this._createPointsProperties(),this.pointsCount()>0)for(var s=0;s=i.multiplier()&&(t=e.key)})),t}priceScale(){return this._ownerSource?this._ownerSource.m_priceScale:null}symbol(){return this._properties.symbol.value()}properties(){return this._properties}isSavedInStudyTemplates(){return!1}state(e){var t={type:TradingView.className(this.constructor),id:this.id(),state:this.properties().state(this._propertiesStateExclusions()),points:n(this._timePoint),zorder:this.zorder(),linkKey:this.linkKey};return delete t.state.points,e&&(t.indexes=this._points),this.ownerSource()&&(t.ownerSource=this.ownerSource().id()),this.isFixed()&&(t.positionPercents=this._positionPercents||this.calcPositionPercents()),"version"in this&&1!==this.version&&(t.version=this.version),this.hasAlert.value()&&(t.alertId=this._alertId),t}_propertiesStateExclusions(){return null}template(){return this.properties().preferences()}applyTemplate(e){this._onTemplateApplying.fire(e),this._applyTemplateImpl(e),this.calcIsActualSymbol(),this.updateAllViews(),this.model().lightUpdate(),this._onTemplateApplied.fire()}_applyTemplateImpl(e){var t=this.properties();t.mergePreferences(e),t.saveDefaults(),this.propertiesChanged()}clearData(){this._points=[]}denormalizeTimePoints(){for(var e=[],t=0;t0&&(this._points=e)}restorePoints(e,t,i){this._timePoint=n(e),this._points=t,i||this.denormalizeTimePoints()}restoreExternalState(e){this.properties().mergeAndFire(e)}restorePositionPercents(e){this._positionPercents=e}getLinkKey(){return this.linkKey||null}updateAllViewsAndRedraw(){this.updateAllViews(),this._model.updateSource(this)}propertiesChanged(e){this.calcIsActualInterval(),this.updateAllViewsAndRedraw(),e||this._syncLineStyleIfNeeded()}_syncLineStyleIfNeeded(){if(!this._syncLineStyleMuted&&this.linkKey){var e=this.properties().state(this._syncStateExclusions);delete e.interval,l.changeLineStyle({linkKey:this.linkKey,state:e,model:this._model})}}_muteSyncLineStyle(){this._syncLineStyleMuted=!0}_unmuteSyncLineStyleWithoutApplyingChanges(){this.propertiesChanged(),this._syncLineStyleMuted=!1}points(){for(var e=[],t=0;t0&&this.normalizePoints(),0!==this._timePoint.length))){this._currentPointsetId=++S._pointSetId;for(var e=this._model.mainSeries().seriesSource().symbolInstanceId(),t=[],i=0;i{this._setPaneViews([new e(this,this.model())])}),this.properties().childs().reverse.subscribe(this,this._reversePoints)}pointsCount(){return 2}name(){return"Gann Square Fixed"}properties(){return super.properties()}axisPoints(){const e=this.points(),t=this.getScreenPoints();return e.length<2||t.length<2?[]:[e[0],this.screenPointToPoint(t[1])]}getScreenPoints(){const e=this.points();if(e.length<2)return[];const t=this._calcAngle();if(null===t)return[];const[i,r]=e,n=this.pointToScreenPoint(i)[0],o=this.pointToScreenPoint(r)[0],a=Math.sqrt(Math.pow(n.x-o.x,2)+Math.pow(n.y-o.y,2)),l=new s.Point(Math.cos(t),-Math.sin(t)),c=l.normalized(),h=c.x<0?-1:1,u=c.y<0?-1:1;return[n.addScaled(l,a),n.add(new s.Point(5*a*h,5*a*u))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount() +;for(let s=0;se.GannComplexAndFixedDefinitionsViewModel)}static _configureProperties(e){r.LineDataSource._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0&&(n=-n),n}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this.normalizePoints(),this.restart()}}},TG9i:function(e,t,i){"use strict";i.r(t),i.d(t,"HHistDataWindowView",(function(){return d}));var s=i("Eyy1"),r=i("ivNn"),n=i("4miz"),o=i("nEwK"),a=i("qFKp"),l=i("e92V"),c=i("mMWL");const h=a.CheckMobile.any(),u=window.t("n/a");class d extends n.b{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._header=this._study.title(!0);const i=this._study.metaInfo().graphics.hhists;if(void 0===i)return;let r=0;for(const n in i){if(!i.hasOwnProperty(n))continue;const e=Object(s.ensureDefined)(i[n]);e.titles.length>r&&(r=e.titles.length)}r>1&&r++;const o=this._na();for(let s=0;s{s<=t&&(null===i||s>i)&&(i=s)}),i}(e,t);if(null===s)return null;const r=e.get(s);if(!r||0===r.size)return null;return function(e,t){let i=null;return e.forEach(e=>{e.priceLow<=t&&t{if(t1&&t===h.colors.childCount()){const t=a.rate.reduce((e,t)=>e+t,0);return e.setValue(u.format(t)),void e.setColor(h.valuesColor.value())}e.setValue("")}})}}},TMWk:function(e,t,i){"use strict";var s=i("Eyy1").assert,r=i("ogJP").clone,n=i("GVHu").Study,o=i("k9/m").PlotList,a=i("w4Ji").studyPlotFunctionMap,l=i("w4Ji").studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var u=!1;s&&(u=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),u?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this.m_data=new o(a(this._metaInfo),l));var i=this.m_data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this.m_data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){ +new c(e.strategyIndex,e.targetIndex,i).rebuildData(this.m_data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},TTFo:function(e,t,i){"use strict";i.r(t),i.d(t,"fromPercent",(function(){return n})),i.d(t,"toPercent",(function(){return o})),i.d(t,"toPercentRange",(function(){return a})),i.d(t,"fromIndexedTo100",(function(){return l})),i.d(t,"toIndexedTo100",(function(){return c})),i.d(t,"toIndexedTo100Range",(function(){return h})),i.d(t,"toLog",(function(){return u})),i.d(t,"fromLog",(function(){return d}));var s=i("Qb4w"),r=i("Hr11");function n(e,t){return t<0&&(e=-e),e/100*t+t}function o(e,t){const i=100*(e-t)/t;return t<0?-i:i}function a(e,t){const i=o(e.minValue(),t),r=o(e.maxValue(),t);return new s.PriceRange(i,r)}function l(e,t){return t<0&&(e=-e),(e-=100)/100*t+t}function c(e,t){const i=100*(e-t)/t+100;return t<0?-i:i}function h(e,t){const i=c(e.minValue(),t),r=c(e.maxValue(),t);return new s.PriceRange(i,r)}function u(e){const t=Math.abs(e);if(t<1e-8)return 0;const i=Object(r.log10)(t+1e-4)+4;return e<0?-i:i}function d(e){const t=Math.abs(e);if(t<1e-8)return 0;const i=Math.pow(10,t-4)-1e-4;return e<0?-i:i}},TcSq:function(e,t,i){"use strict";function s(e){return e===r(e)}function r(e){const t=e.indexOf("$"),i=e.indexOf("@");return t<0&&i>=0?null:e.substring(Math.max(t+1,0),i>=0?i:e.length)}function n(e){return e.startsWith("PUB;")}function o(e){return e.startsWith("USER;")}function a(e){return e.startsWith("STD;")}function l(e){return e.includes("Candlestick%1Pattern%1")}i.r(t),i.d(t,"isPineIdString",(function(){return s})),i.d(t,"extractPineId",(function(){return r})),i.d(t,"isPublishedPineId",(function(){return n})),i.d(t,"isCustomPineId",(function(){return o})),i.d(t,"isStandardPineId",(function(){return a})),i.d(t,"isCandleStickId",(function(){return l}))},TlGQ:function(e,t,i){"use strict";i.r(t),i.d(t,"visitObject",(function(){return n}));var s=i("ogJP");function r(e,t,i){return Object(s.isArray)(e)?function(e,t,i){return e.map(e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s})}(e,t,i):Object(s.isObject)(e)&&(Object(s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach(n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o}),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},TmNs:function(e,t,i){"use strict";i.r(t);var s=i("KcY8"),r=i("Eyy1"),n=i("jFln"),o=i("8Uy/"),a=i("gAom");class l{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,l,c){if(!this._data.visible)return;let h=this._commonData.coordinate;void 0!==this._commonData.fixedCoordinate&&(h=this._commonData.fixedCoordinate),e.lineWidth=Math.max(1,Math.floor(Object(r.ensureDefined)(this._data.linewidth)*c)),e.lineCap="butt", +Object(n.setLineStyle)(e,void 0===this._data.linestyle?o.LINESTYLE_DOTTED:this._data.linestyle),e.strokeStyle=this._commonData.textColor,Object(a.drawHorizontalLine)(e,Math.round(h*c),0,Math.ceil(s*c))}height(e){return 0}}i.d(t,"PriceLineAxisView",(function(){return c})),i.d(t,"SeriesPriceLineAxisView",(function(){return h})),i.d(t,"StudyPriceLineAxisView",(function(){return u}));class c extends s.a{constructor(e){super(e||l)}ignoreAlignment(){return!0}_updateRendererData(e,t,i){if(t.visible=!1,e.visible=!1,!this._isVisible())return;const s=this._value();s.noData||(i.background="",i.textColor=this._priceLineColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate,e.linewidth=this._lineWidth(),e.linestyle=this._lineStyle(),e.backgroundAreaVisible=this._backgroundAreaVisible(),e.backgroundAreaColor=this._backgroundAreaColor(),e.backgroundAreaHeight=this._backgroundAreaHeight(),e.visible=!0)}_lineStyle(){return o.LINESTYLE_DOTTED}_backgroundAreaVisible(){return!1}_backgroundAreaColor(){return""}_backgroundAreaHeight(){return 0}}class h extends c{constructor(e){super(),this._series=e}_value(){return this._series.lastValueData(void 0,!0)}_priceLineColor(e){return this._series.priceLineColor(e)}_lineWidth(){return this._series.properties().priceLineWidth.value()}_isVisible(){const e=this._series.model().properties().scalesProperties.showSeriesLastValue.value();return this._series.properties().showPriceLine.value()&&e}}class u extends c{constructor(e,t){super(),this._study=e,this._plotname=t}_value(){return this._study.lastValueData(this._plotname,!0)}_lineWidth(){return this._study.properties().styles[this._plotname].linewidth.value()}_lineStyle(){return o.LINESTYLE_DOTTED}_priceLineColor(e){return e}_isVisible(){const e=this._study.model().properties().scalesProperties.showStudyLastValue.value();return this._study.properties().styles[this._plotname].trackPrice.value()&&e}}},Tmoa:function(e,t,i){"use strict";i.r(t),i.d(t,"generateColor",(function(){return r})),i.d(t,"alphaToTransparency",(function(){return n})),i.d(t,"transparencyToAlpha",(function(){return o})),i.d(t,"resetTransparency",(function(){return a})),i.d(t,"getLuminance",(function(){return l})),i.d(t,"isHexColor",(function(){return c})),i.d(t,"colorFromBackground",(function(){return h})),i.d(t,"gradientColorAtPercent",(function(){return u})),i.d(t,"isColorDark",(function(){return d})),i.d(t,"rgbaFromInteger",(function(){return p})),i.d(t,"rgbaToInteger",(function(){return _})),i.d(t,"colorToInteger",(function(){return m}));var s=i("eJTA");function r(e,t,i){if(t=t||0,!c(e))return i?Object(s.rgbaToString)(Object(s.rgba)(Object(s.parseRgb)(e),Object(s.normalizeAlphaComponent)(o(t)))):e;const[r,n,a]=Object(s.parseRgb)(e),l=Object(s.normalizeAlphaComponent)(o(t));return Object(s.rgbaToString)([r,n,a,l])}function n(e){return 100*(1-e)}function o(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function a(e){ +return"transparent"===e||c(e)?e:Object(s.rgbaToString)(Object(s.rgba)(Object(s.parseRgb)(e),Object(s.normalizeAlphaComponent)(1)))}function l(e){const t=Object(s.parseRgb)(e).map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function c(e){return 0===e.indexOf("#")}function h(e){return"black"===Object(s.rgbToBlackWhiteString)(Object(s.parseRgb)(e),150)?"#ffffff":"#000000"}function u(e,t,i){const[r,n,o,a]=Object(s.parseRgba)(e),[l,c,h,u]=Object(s.parseRgba)(t),d=Object(s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(u-a));return Object(s.rgbaToString)(d)}function d(e){return l(a(e))<.5}function p(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function _(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function m(e){const t=Object(s.tryParseRgba)(e);return null===t?0:_(t)}},TohL:function(e,t,i){"use strict";i.r(t),i.d(t,"LineToolArrowMark",(function(){return l})),i.d(t,"LineToolArrowMarkLeft",(function(){return c})),i.d(t,"LineToolArrowMarkUp",(function(){return h})),i.d(t,"LineToolArrowMarkRight",(function(){return u})),i.d(t,"LineToolArrowMarkDown",(function(){return d}));var s=i("Ocx9"),r=i("Ss5c"),n=i("tc+8"),o=i.n(n),a=i("j3hX");class l extends r.LineDataSource{constructor(e,t,s){const r=t||l.createProperties(null,s);super(e,r),this._textPaneView=null,i.e("lt-pane-views").then(i.bind(null,"ct+2")).then(({ArrowMarkPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)})}paneViews(e){const t=super.paneViews();return null!==t&&this._textPaneView&&t.push(this._textPaneView),t}pointsCount(){return 1}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new s.DefaultProperty(t,e);return l._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"5sLb")).then(e=>e.ArrowMarkDefinitionsViewModel)}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().arrowColor])),e.addChild("textsColors",new a.LineToolColorsProperty([e.childs().color])),e.hasChild("text")||e.addChild("text",new o.a("")),e.addExclusion("text")}}l.version=2;class c extends l{constructor(e,t){super(e,t,"linetoolarrowmarkleft")}direction(){return"left"}name(){return"Arrow Mark Left"}textAlignParams(){return{horzAlign:"left",vertAlign:"middle",offsetX:22,offsetY:3}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkleft")}}class h extends l{constructor(e,t){super(e,t,"linetoolarrowmarkup")}direction(){return"up"}name(){return"Arrow Mark Up"}textAlignParams(){return{horzAlign:"center",vertAlign:"top",offsetX:0,offsetY:20}}static createProperties(e){ +return l.createProperties(e,"linetoolarrowmarkup")}}class u extends l{constructor(e,t){super(e,t,"linetoolarrowmarkright")}direction(){return"right"}name(){return"Arrow Mark Right"}textAlignParams(){return{horzAlign:"right",vertAlign:"middle",offsetX:22,offsetY:3,forceTextAlign:!0}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkright")}}class d extends l{constructor(e,t){super(e,t,"linetoolarrowmarkdown")}direction(){return"down"}name(){return"Arrow Mark Down"}textAlignParams(){return{horzAlign:"center",vertAlign:"bottom",offsetX:0,offsetY:20}}static createProperties(e){return l.createProperties(e,"linetoolarrowmarkdown")}}},"U0+/":function(e,t,i){"use strict";i.r(t),i.d(t,"StudyMetaInfoRepository",(function(){return h}));i("YFKU");var s=i("Eyy1"),r=i("0YCj"),n=i.n(r),o=i("Si3H"),a=i("lCO3"),l=i("txPx");const c=Object(l.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});class h{constructor(e){this._nextRequestNumber=1,this._rawStudiesMetaInfo=[],this._isReady=!1,this._metaInfoQueryQueue=[],this._javaMetaInfoQueryQueue=[],this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._gateway=e}requestMetaInfo(){this._requestStarted();const e=this._makeNextRequestId();return c.logNormal("Requesting metainfo #"+e),new Promise(t=>{c.logNormal("Requesting studies metadata #"+e),this._gateway.requestMetadata(e,i=>{c.logNormal(`Requesting studies metadata #${e} finished`);const s=i.params[1].metainfo.slice();this._processLibraryMetaInfo(s),this._requestFinished(),t()})})}findById(e){if(!this._isReady)return this._enqueueMetaInfoQuery(e);const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}findAllJavaStudies(){return this._isReady?Promise.resolve(this._javaStudiesMetaInfo):this._enqueueJavaMetaInfoQuery()}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}getMigrations(){return this._studiesMigrations}addPineMetaInfo(e){return d(this._pineMetaInfoCache,e)}_processMigrations(e){throw new Error("not implemented")}_processSiteMetaInfo(e,t){throw new Error("not implemented")}_processLibraryMetaInfo(e){for(const t of e)u(t),d(this._javaStudiesMetaInfo,t);this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:i{this._metaInfoQueryQueue.push({studyDescriptor:e,resolver:t})})}_enqueueJavaMetaInfoQuery(){return new Promise(e=>{this._javaMetaInfoQueryQueue.push({resolver:e})})} +_processPendingMetaInfoQueries(){for(;this._metaInfoQueryQueue.length;){const e=this._metaInfoQueryQueue.shift();this.findById(e.studyDescriptor).then(e.resolver)}}_processPendingFullMetaInfoQueries(){for(;this._javaMetaInfoQueryQueue.length;){this._javaMetaInfoQueryQueue.shift().resolver(this._javaStudiesMetaInfo)}}_findStudyMetaInfo(e){return"java"===e.type?this._javaStudiesMetaInfo.find(t=>t.id===e.studyId)||null:this._pineMetaInfoCache.find(t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||Object(s.ensureDefined)(t.pine).version===e.pineVersion))||null}_makeNextRequestId(){return"metadata_"+this._nextRequestNumber++}_compilePine(e){throw new Error("unsupported")}}function u(e){e.description_localized=window.t(e.description,{context:"study"})}function d(e,t){const i=new n.a(t);Object(o.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex(e=>e.id===i.id);if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?a.Version.parse(t.pine.version):null,o=void 0!==i.pine?a.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}},UAFa:function(e,t,i){"use strict";i.r(t);var s=i("i6cO"),r=i("23IT"),n=i("Eyy1");const o=new Map([[s.ColorerType.Main,"color"],[s.ColorerType.Text,"textColor"],[s.ColorerType.Border,"borderColor"],[s.ColorerType.Wick,"wickColor"],[s.ColorerType.Up,"colorup"],[s.ColorerType.Down,"colordown"]]);class a{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?Object(s.clearStyle)(t):Object(s.createEmptyStyle)();return o.forEach((e,t)=>{this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())}),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}class l{constructor(e,t,i,s){this._palettes=new Map,this._metaInfo=e,this._properties=t,this._indexes=s,this._plotStyle=t.styles[i];const r=Object(n.ensureDefined)(this._metaInfo.palettes);s.forEach((t,i)=>{const s=e.plots[t];if(s&&"palette"in s){const e=r[s.palette],t=this._properties.palettes[s.palette];e&&t&&this._palettes.set(i,{palette:e,props:t})}})}getPlotPointStyle(e,t){const i=t?Object(s.clearStyle)(t):Object(s.createEmptyStyle)();if(this._palettes.has(s.ColorerType.Main)){const t=Object(n.ensureDefined)(this._indexes.get(s.ColorerType.Main)),r=e[t+1];if(null!=r){const e=Object(n.ensureDefined)(this._palettes.get(s.ColorerType.Main)),t=e.palette,o=e.props,a=Object(n.ensureDefined)(t.valToIndex?t.valToIndex[r]:r),l=o.colors[a];i.lineWidth=l.width.value(),i.lineStyle=l.style.value()}}return Object.keys(s.ColorerType).forEach(t=>{const s=parseInt(t);if(this._palettes.has(s)){const t=Object(n.ensureDefined)(this._indexes.get(s)),r=e[t+1];if(null!=r){const e=Object(n.ensureDefined)(this._palettes.get(s)),t=Object(n.ensureDefined)(e.palette.valToIndex?e.palette.valToIndex[r]:r),o=e.props.colors[t];i.colors[s]=o.color.value()}else i.colors[s]="transparent" +}else if(this._plotStyle){const e=o.get(s);void 0!==e&&this._plotStyle[e]&&(i.colors[s]=this._plotStyle[e].value())}}),i}getDefaultPlotPointStyle(){const e=Object(n.ensureDefined)(this._palettes.get(s.ColorerType.Main)).props.colors[0];if(null!=e){return{colors:[e.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineWidth:e.width.value()}}return null}isColorDefined(){return!!this._palettes.size}singleColor(){return!1}}var c=i("Tmoa");class h{constructor(e){this._indexes=e}getPlotPointStyle(e,t){const i=t?Object(s.clearStyle)(t):Object(s.createEmptyStyle)();return this._indexes.forEach((t,s)=>{const r=e[t+1];if(null!=r){const e=Object(c.rgbaFromInteger)(r);i.colors[s]=e}else i.colors[s]="transparent"}),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}}i.d(t,"createStudyPlotColorProvider",(function(){return d}));const u=new Map([[s.ColorerType.Main,function(e,t){const i=Object(r.isColorerPlot)(t)||Object(r.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Text,function(e,t){const i=Object(r.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Background,function(e,t){return Object(r.isBgColorerPlot)(t)&&t.id===e}],[s.ColorerType.Border,function(e,t){const i=Object(r.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Wick,function(e,t){const i=Object(r.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Up,function(e,t){const i=Object(r.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[s.ColorerType.Down,function(e,t){const i=Object(r.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function d(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex(e=>e.id===t),r=new Map;return i.forEach((e,i)=>{u.forEach((s,n)=>{s(t,e)&&r.set(n,i)})}),{plotIndex:-1===s?null:s,colorers:r}}(e,i);if(s.size)return e.isRGB?new h(s):new l(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new a(e[i]);const s=t.styles[i];return new a(s)}}},UCMi:function(e,t,i){"use strict";var s=i("Ss5c").LineDataSource,r=i("Ocx9").DefaultProperty;class n extends s{constructor(e,t){super(e,t||n.createProperties()),i.e("lt-pane-views").then(i.t.bind(null,"UcQu",7)).then(({DateAndPriceRangePaneView:e})=>{this._setPaneViews([new e(this,this._model)])})}pointsCount(){return 2}name(){return"Date and Price Range"}static createProperties(e){var t=new r("linetooldateandpricerange",e);return n._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(33),i.e("lt-property-pages-with-definitions")]).then(i.bind(null,"Ax76"))).GeneralDatePriceRangeDefinitionsViewModel}static _configureProperties(e){s._configureProperties(e)}}t.LineToolDateAndPriceRange=n},UCjq:function(e,t,i){"use strict";i.r(t) +;var s=i("YFKU"),r=i("Eyy1"),n=i("aO4+"),o=i("qFKp"),a=i("VaSN"),l=i("FQhm"),c=i("ogJP"),h=i("FIi8"),u=i("VdBB"),d=i("vTIA"),p=i("KnF9"),_=i("3ClC"),m=i("GxN8"),f=i("CW80"),g=i("mMWL"),v=i("bOGh"),b=i("fTGZ"),S=i("ikwP"),y=i("gAom"),w=i("mE5r"),C=i("1IXQ");function P(e,t){return e.position-t.position}function x(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}class T{constructor(e,t,i,s){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._terminated=!1,this._minSpeed=e,this._maxSpeed=t,this._dumpingCoeff=i,this._minMove=s}addPosition(e,t){if(null!==this._position1){if(this._position1.time===t)return void(this._position1.position=e);if(Math.abs(this._position1.position-e)50)return;let i=0;const s=x(this._position1,this._position2,this._maxSpeed),r=P(this._position1,this._position2),n=[s],o=[r];if(i+=r,null!==this._position3){const e=x(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=P(this._position2,this._position3);if(n.push(e),o.push(t),i+=t,null!==this._position4){const e=x(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=P(this._position3,this._position4);n.push(e),o.push(t),i+=t}}}}let a=0;for(let l=0;lthis._state&&this._chartModel().lightUpdate(),this._topCanvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._chart=e,this._state=t,this._options=Object(c.merge)(Object(c.clone)(ie),i),this._paneWidgetsSharedState=s,this._state&&(this._state.onDestroyed().subscribe(this,this._onStateDestroyed,!0),this._state.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged));const r={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(r.contextMenu=this._options.priceScaleContextMenu);const n=(e,t,i,s,n)=>new C.PriceAxisWidget(this,this._chartUndoModel(),i,t,e,r,s,n),o=e.properties().childs().scalesProperties,l=this._chartModel().rendererOptionsProvider(),h={backgroundBasedTheme:e.backgroundBasedTheme(),rendererOptionsProvider:l,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(), +getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value()},u={showLabels:!1};this._lhsPriceAxisesContainer=new w.a(o,"left",n,h,u),this._rhsPriceAxisesContainer=new w.a(o,"right",n,h,u),this._paneCell=document.createElement("td"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=Object(S.createBoundCanvas)(this._div,new S.Size(16,16)),this._canvasBinding.subscribeCanvasConfigured(this._canvasConfiguredHandler);const d=this._canvasBinding.canvas;d.style.position="absolute",d.style.left="0",d.style.top="0",this._topCanvasBinding=Object(S.createBoundCanvas)(this._div,new S.Size(16,16)),this._topCanvasBinding.subscribeCanvasConfigured(this._topCanvasConfiguredHandler);const p=this._topCanvasBinding.canvas;p.style.position="absolute",p.style.left="0",p.style.top="0",this._rowElement=document.createElement("tr"),this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(),Object(z.a)().subscribe(this._onMagnetStateChangedListener),Object(q.c)().subscribe(this._onShiftKeyStateChangedListener)}destroy(){this._chart.onPaneWidgetDestroyed(this),this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeCanvasConfigured(this._topCanvasConfiguredHandler),this._topCanvasBinding.destroy(),this._canvasBinding.unsubscribeCanvasConfigured(this._canvasConfiguredHandler),this._canvasBinding.destroy(),null!==this._hideNotMainSourcesInLegendSpawn&&this._hideNotMainSourcesInLegendSpawn.destroy(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&(this.state().onDestroyed().unsubscribeAll(this),this.state().dataSourcesCollectionChanged().unsubscribeAll(this)),Object(z.a)().unsubscribe(this._onMagnetStateChangedListener),Object(q.c)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this)}size(){return this._size}setSize(e){Object(r.assert)(e.w>=0&&e.h>=0,"Try to set invalid size to PaneWidget "+JSON.stringify(e)),this._size.equals(e)||(this._size=e,this._canvasBinding.resizeCanvas({width:e.w,height:e.h}),this._topCanvasBinding.resizeCanvas({width:e.w,height:e.h}),this._paneCell.style.width=e.w+"px",this._paneCell.style.height=e.h+"px",this._div.style.width=e.w+"px",this._div.style.height=e.h+"px", +this._rowElement.classList.toggle("js-hidden",0===e.h),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.w))}width(){return this._size.w}height(){return this._size.h}backgroundColor(){return this._chartModel().backgroundColor().value()}processDoubleClickOnSource(e,t){e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}setCursorForTool(e,t,i){const s=g.tool.value();if(t&&t.control()&&e)return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case j.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case j.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case j.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case j.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case j.PaneCursorType.Default:this._setCursorClassName("default");break;case j.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case j.PaneCursorType.Grabbing:this._setCursorClassName("grabbing")}return}if(Object(g.toolIsCursor)(s)){if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}if("eraser"===s)return void this._setCursorClassName("eraser");if("zoom"===s)return void this._setCursorClassName("zoom-in");const r=g.cursorTool.value();"dot"!==r?"arrow"!==r?this._setCursorClassName(""):this._setCursorClassName("default"):this._setCursorClassName("dot")}showContextMenuForSelection(e){const t=this._chartUndoModel().selection();if(t.isEmpty())return;const i=t.dataSources().filter(e=>e.hasContextMenu());this.showContextMenuForSources(i,e)}async showContextMenuForSources(e,t,i){if(!e.length)return Promise.resolve(null);const s=e[0],r=Object(c.merge)(Object(c.clone)(this._options.contextMenu),i||{}),n=new E.ActionsProvider(this._chart,r);if(s===this._chartUndoModel().crossHairSource())return s.handleContextMenuEvent(t),Promise.resolve(null);{const i=await n.contextMenuActionsForSources(e);return 0===i.length?Promise.resolve(null):k.ContextMenuManager.createMenu(i).then(e=>(e.show(t),e))}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return Object(r.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&(this.state().onDestroyed().unsubscribeAll(this),this.state().dataSourcesCollectionChanged().unsubscribeAll(this)),this._state=e,this.hasState()&&(this.state().onDestroyed().subscribe(this,this._onStateDestroyed,!0),this.state().dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),this.updatePriceAxisWidgets()))} +getScreenshotData(e){const t=[],i=[];let s,r=[];const n=this.state().sourcesByGroup().allExceptSpecialSources().slice().reverse(),o=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();if(o.showLegend.value()||(null==e?void 0:e.showCollapsedLegend))for(const a of n){const n=a.statusView();Object(_.isStudy)(a)?a.properties().visible.value()&&n&&o.showStudyTitles.value()&&(t.push(a.statusProvider((null==e?void 0:e.status)||{}).text()),i.push(a.valuesProvider().getValues(null))):a===this._chartModel().mainSeries()&&n&&o.showSeriesTitle.value()&&(s=a.statusProvider((null==e?void 0:e.status)||{}).text(),r=a.valuesProvider().getValues(null))}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvas.toDataURL(),canvas:this._canvasBinding.canvas,contentWidth:this._size.w,contentHeight:this._size.h,studies:t,studiesValues:i,containsMainSeries:this.containsMainSeries(),mainSeriesText:s,mainSeriesValues:r}}hardResetCanvas(){this._size.equals(new S.Size(0,0))||(Object(S.hardResizeCanvas)(this._canvasBinding,this._size),Object(S.hardResizeCanvas)(this._topCanvasBinding,this._size),this._lhsPriceAxisesContainer.hardResetCanvas(),this._rhsPriceAxisesContainer.hardResetCanvas())}updatePriceAxisWidgets(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount(),s=this.state(),r=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(r,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}update(){this.hasState()&&(this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e=G.InvalidationLevel.None){this.hasState()&&null!==this._legendWidget&&(e===G.InvalidationLevel.Full?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e,t){this._themedTopColor=e,this._themedBottomColor=t,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvas}hasCanvas(e){return this._canvasBinding.canvas===e||this._topCanvasBinding.canvas===e}pinchStartEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),this._options.handleScale.pinch&&(this._terminateActiveAnimations(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this)))}pinchEvent(e,t){if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return +;const i=10*(t-this._prevPinchScale);this._prevPinchScale=t,this._chartModel().zoomTime(e.x,i,!0),this._prevPinchScale=t}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){this._onMouseEvent(),this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this.hasState()&&(this._chart.setActivePaneWidget(this),this._mouseDownOrTouchStartEvent(e),this._mouseOrTouchMoveEvent(e)))}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){var t,i;if(this._chart.readOnly())return;const s=this._dataSourceAtPoint(e.localX,e.localY);if(null===s||s.isCustom||null===s.source)return;if(((null===(t=s.hittest)||void 0===t?void 0:t.result())||0)<=u.HitTestResult.MOVEPOINT_BACKGROUND)return;const n=new p.EnvironmentState(e),o=null===(i=s.hittest)||void 0===i?void 0:i.eraseMarker();if(n.control()&&void 0!==o&&s.source.processErase)return void s.source.processErase(this._chartUndoModel(),o);const a=this._chartUndoModel();a.selection().isSelected(s.source)||a.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(Object(r.ensureNotNull)(s.source))}),this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._longTap=!0,null===this._startTrackPoint&&this._trackingModeShouldBeActive()&&this.startTrackingMode(new n.Point(e.localX,e.localY),new n.Point(e.localX,e.localY),new p.EnvironmentState(e)))}mouseEnterEvent(e){this._onMouseEvent(),this.hasState()&&(this._chart.setActivePaneWidget(this),this._setCursorPosition(e.localX,e.localY,new p.EnvironmentState(e)))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(){this._processOutsideClick({hittest:null,isCustom:!1,renderer:null,source:null})}cancelZoom(){ +this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this._startChangeLineToolParams=null,this._startMoveLineToolParams=null,this._chartUndoModel().selectionMacro(e=>e.clearSelection()),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this._setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e,t){if(!this._chartUndoModel()||!this.hasState())return;this._state&&(e.priceScaleSideMaxLevel("left")>G.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>G.InvalidationLevel.Cursor)&&(this._recalculatePriceScales(),this._chartModel().updateCrosshairPositionByOriginCoords()),this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left")),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right"));const i=e.fullInvalidation();if(i!==G.InvalidationLevel.None){if(i>G.InvalidationLevel.Cursor){const e=Object(r.ensureNotNull)(this._canvasBinding.canvas.getContext("2d"));e.setTransform(1,0,0,1,0,0);const i=this._canvasRenderParams();this._drawBackground(e,i),this._state&&(this._drawSources(e,i),this._drawBarsMarks(e,i,t))}if(this._state){const e=Object(r.ensureNotNull)(this._topCanvasBinding.canvas.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=this._topCanvasRenderParams();e.clearRect(0,0,Math.ceil(this._size.w*t.pixelRatio),Math.ceil(this._size.h*t.pixelRatio)),this._drawCrossHair(e,t),this._drawActiveLineTools(e,t)}}}pasteImageAsLineTool(e){var t;const i=this._chartModel().timeScale(),s=i.width(),n=Object(r.ensureNotNull)(this._state).height(),o=Object(r.ensureNotNull)(this._state).defaultPriceScale(),a=Object(r.ensureNotNull)(Object(r.ensureNotNull)(o.mainSource()).firstValue()),l={price:o.coordinateToPrice(n/2,a),index:i.coordinateToIndex(s/2)},c=Object(f.createLineToolProperties)("LineToolImage");null===(t=c.child("url"))||void 0===t||t.setValue(e),this._chartUndoModel().createLineTool(Object(r.ensureNotNull)(this._state),l,"LineToolImage",c)}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0){const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(), +this.setCursorForTool()}cancelMeasuring(){this._chartUndoModel().crossHairSource().clearMeasure(),Object(g.resetToCursor)(),this.setCursorForTool()}_topCanvasRenderParams(){return{pixelRatio:this._topCanvasBinding.pixelRatio,physicalWidth:this._topCanvasBinding.canvas.width,physicalHeight:this._topCanvasBinding.canvas.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_canvasRenderParams(){return{pixelRatio:this._canvasBinding.pixelRatio,physicalWidth:this._canvasBinding.canvas.width,physicalHeight:this._canvasBinding.canvas.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,r){return!(!Object(g.toolIsMeasure)(g.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,i),s=this._chartModel().magnet().align(s,r,this.state()),t.startMeasuring({price:s,index:r},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?Object(g.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const r=this._chart.model().model().zoomEnabled();if("zoom"===g.tool.value()&&r){const r=this._chartUndoModel(),n=r.timeScale().indexToCoordinate(i)-.5*r.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,s),this._chartModel().crossHairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),s=Object(r.ensureNotNull)(t.mainDataSource()).firstValue(),n=i.coordinateToPrice(e.localY,Object(r.ensureNotNull)(s)),o=this._chartUndoModel(),a=Math.round(o.timeScale().coordinateToIndex(e.localX)),l=Object(r.ensureNotNull)(this._firstZoomPoint);a!==l.index&&o.zoomToViewport(l.index,a,l.price,n,t),this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,Object(g.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if(e.source&&"eraser"===g.tool.value()&&!e.isCustom&&(!(i=e.source)||!i.customization||!i.customization.disableErasing)){const i=this._chartUndoModel();if(null!==e.hittest&&(Object(f.isLineTool)(e.source)||Object(_.isStudy)(e.source))){const s=e.hittest.eraseMarker();return t.control()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1}_tryStartChangingLineTool(e,t,i,s){var n,o;if(e.isTouch&&null!==this._startTrackPoint)return!1;if((!e.isTouch||!this._preventSourceChange)&&t.hittest&&Object(f.isLineTool)(t.source)&&t.hittest.result()===u.HitTestResult.CHANGEPOINT){ +const a=this._chartUndoModel(),l=Object(r.ensure)(null===(n=this.state().mainDataSource())||void 0===n?void 0:n.firstValue()),c=Object(r.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,l);a.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(t.source)});const h=a.model().magnet().align(c,s,this.state()),u=null===(o=t.hittest.data())||void 0===o?void 0:o.pointIndex;return this._startChangeLineToolParams={source:t.source,startPoint:{index:s,price:h},screenPoint:{x:e.localX,y:e.localY},pointIndex:u,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.control()){const t=this._chartUndoModel().selection().dataSources().filter(e=>e.cloneable());if(s&&s.cloneable()&&t.push(s),t.length>0)return this._clonningAtMoveLineTools=t.map(e=>e.id()),this._startCloningPoint=new n.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t){const i=this._chartUndoModel(),s=this._chartModel();if(t.control()&&this._clonningAtMoveLineTools){const o=new n.Point(e.localX,e.localY),a=Object(r.ensureNotNull)(this._startCloningPoint).subtract(o).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=s.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const s=this.cloneLineTools(l,!0).map(e=>Object(r.ensureNotNull)(i.model().dataSourceForId(e)));i.selectionMacro(e=>{e.clearSelection(),s.forEach(t=>{e.addSourceToSelection(t)})});const o=new n.Point(e.localX,e.localY),a=Object(r.ensureNotNull)(s[0].priceScale()),c=Object(r.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:i.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,Object(r.ensureNotNull)(c))};i.startMovingSources(s,{logical:h,screen:o},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){var o,a;if(!this.hasState())return;const l=this._chartUndoModel();let c=!1,h=null;const u=g.tool.value();Object(g.hideAllDrawings)().value()&&Object(g.hideAllIndicators)().setValue(!1),Object(g.hideAllDrawings)().setValue(!1),Object(g.lockDrawings)().setValue(!1),e.isTouch&&(Object(f.isLineToolName)(u)&&!Object(B.isLineDrawnWithPressedButton)(u)||l.lineBeingCreated())&&this._initToolCreationModeParams(e);const d=l.lineBeingCreated();if(d&&!Object(B.isLineDrawnWithPressedButton)(d.toolname)){const u=Object(r.ensure)(null===(o=d.ownerSource())||void 0===o?void 0:o.firstValue());if(e.isTouch){if(!this._startTouchPoint){this._startTouchPoint=new n.Point(e.pageX,e.pageY);const t=d.points(),i=t[t.length-1],s=l.timeScale().indexToCoordinate(i.index),o=Object(r.ensureNotNull)(d.priceScale()).priceToCoordinate(i.price,u);return void(this._initCrossHairPosition=new n.Point(s,o))}}else{h=d;const n=l.model().paneForSource(d);if(n!==this._state&&null!==n){const i=this._externalPaneXCoord(n,e.localX),s=this._externalPaneYCoord(n,e.localY);c=l.continueCreatingLine({index:Math.round(l.timeScale().coordinateToIndex(i)), +price:Object(r.ensure)(null===(a=d.priceScale())||void 0===a?void 0:a.coordinateToPrice(s,u))},t)}else{const e=l.model().magnet().align(s,i,this.state());c=l.continueCreatingLine({index:i,price:e},t)}}}else if(!e.isTouch||Object(B.isLineDrawnWithPressedButton)(u)){const e={index:i,price:l.model().magnet().align(s,i,this.state())};h=l.createLineTool(this.state(),e,u),l.lineBeingCreated()||(c=!0)}h&&l.selectionMacro(e=>e.addSourceToSelection(Object(r.ensureNotNull)(h))),c&&h&&(this._finishTool(h),e.preventDefault())}_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let r=null;if(null===t.source||t.source.isSelectionEnabled()){let n=e.isTouch?Boolean(t.hittest&&t.hittest.result()>=u.HitTestResult.MOVEPOINT_BACKGROUND):Boolean(t.hittest&&t.hittest.result()>u.HitTestResult.MOVEPOINT_BACKGROUND);this._preventSourceChange&&(n=!1),s.selectionMacro(e=>{var s;n&&t.source?(i.control()||e.selection().isSelected(t.source)||e.clearSelection(),i.control()&&e.selection().isSelected(t.source)?(r=t.source,e.removeSourceFromSelection(t.source)):e.addSourceToSelection(t.source,(null===(s=null==t?void 0:t.hittest)||void 0===s?void 0:s.data())||void 0),e.selection().allSources().length>1&&Object(F.trackEvent)("GUI","Multiselect","Click Select")):i.control()||e.clearSelection()})}return r}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this._setCursorPosition(e.localX,e.localY,t)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e)._setCursorPosition(t,i,s)}_setCursorPosition(e,t,i){this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){var t;null===(t=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY)).hittest)||void 0===t||t.tryCallMouseUpOrTouchEndHandler(e)}_crossHairShouldBeVisible(){const e=this._chartModel().crossHairSource();return Object(f.isLineToolName)(g.tool.value())||Object(g.toolIsMeasure)(g.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){let i=null,s=null,r=null;if(!this.hasState())return null;const o=this.state(),a=o.height(),l=o.width();let c=!1;const h=(e,t,n,o)=>{const a=r?r.result():0;e.result()>a&&(r=e,i=t,s=n,c=o)},u=this._canvasRenderParams(),p=new n.Point(e,t),_=this._chartUndoModel();this._hitTestChartSources(u,[_.crossHairSource()],p,h),this._hitTestCustomSources(u,o.customSources(d.a.Topmost),p,h);const m=o.sourcesByGroup();this._hitTestChartSources(u,m.tradingSources(),p,h), +this._hitTestCustomSources(u,o.customSources(d.a.Foreground),p,h);const f=[...this._chartModel().multiPaneSources(o),...m.hitTestSources()];if(this._hitTestChartSources(u,f,p,h),this.containsMainSeries()){const e=_.barsMarksSources();for(let h=0;h=0;--r){const l=t[r],c=l.paneViews(n);if(0!==c.length)for(let t=c.length-1;t>=0;--t){const r=c[t].renderer(o,a);if(null!==r){const t=r.hitTest(i,e);null!==t&&s(t,l,r,!0)}}}}_hitTestChartSources(e,t,i,s){const n=Object(r.ensureNotNull)(this._state),o=n.height(),a=n.width();for(let r=t.length;0{if((null===n||n.terminated())&&(null===o||o.terminated()))return;const e=Date.now();let t=null===n||n.finished(e);const i=null===o||o.finished(e);if(null!==n&&!n.terminated()){const i=r.rightOffset();s.scrollTimeTo(n.getPosition(e)),i===r.rightOffset()&&(t=!0,this._scrollXAnimation=null)}null===o||o.terminated()||null===this._scrollPriceScale||s.scrollPriceTo(this.state(),this._scrollPriceScale,o.getPosition(e)),t&&i?this._finishScroll():requestAnimationFrame(a)};requestAnimationFrame(a)}return t}_terminateActiveAnimations(){const e=Date.now(),t=null===this._scrollXAnimation||this._scrollXAnimation.finished(e),i=null===this._scrollYAnimation||this._scrollYAnimation.finished(e);null===this._scrollXAnimation&&null===this._scrollYAnimation||t&&i||this._finishScroll(),null!==this._scrollXAnimation&&(this._scrollXAnimation.terminate(),this._scrollXAnimation=null),null!==this._scrollYAnimation&&(this._scrollYAnimation.terminate(),this._scrollYAnimation=null)}_preventScroll(){ +return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||Object(f.isLineToolName)(g.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint}_isSelectBarModeEnabled(){return this._chartUndoModel().crossHairSource().selectBarMode().value()}_preventCrossHairMove(){return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e){const t=this._chartUndoModel(),i=g.tool.value();if(Object(g.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),t.selectionMacro(t=>{t.addSourceToSelection(e)}),Object(B.isTextToolName)(i)){const i=t.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,R.TabNames.text,void 0,i)}this._lastFinishedToolId=e.id(),Object(V.c)(e)}_alignSourcesThatBeingMoved(e,t,i,s){const r=this._chartUndoModel(),o=r.timeScale().coordinateToIndex(t);r.model().sourcesBeingMoved().forEach(e=>{const a=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());null!==a&&(this.setCursorForTool(),r.moveSources({screen:new n.Point(t,i),logical:{index:o,price:a}},s))})}_resetMeasureIfRequired(){this._needResetMeasureLater&&(Object(g.resetToCursor)(),this._needResetMeasureLater=!1)}_drawBackground(e,t){const i=Math.ceil(t.pixelRatio*this._size.w),s=Math.ceil(t.pixelRatio*this._size.h),r=this._chartModel(),n=r.backgroundTopColor().value(),o=r.backgroundColor().value();n===o?Object(S.clearRect)(e,0,0,i+1,s+1,o):Object(y.clearRectWithGradient)(e,0,0,i+1,s+1,n,o)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;const s=this.state();if(!s.containsMainSeries())return;const r=i.paneViews(),n=s.height(),o=s.width();for(const a of r){e.save();const i=a.renderer(n,o);i&&i.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crossHairSource();!i.visible&&Object(g.lockTimeAxis)().value()&&(i.setLockedPosition(Object(r.ensureNotNull)(this._state)),i.updateAllViews()),this._drawSourceImpl(e,t,Q,$,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved()].filter(e=>!!e);for(const r of s){(i.paneForSource(r)===this.state()||r.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,Q,$,r)}}_drawSources(e,t){const i=this.state(),s=i.model(),r=i.sourcesByGroup(),n=r.tradingSources(),o=[...s.multiPaneSources(i),...r.generalSources()],a=r.phantomSources(),l=i.customSources(d.a.Background).slice(),h=i.customSources(d.a.Foreground).slice(),u=i.customSources(d.a.Topmost).slice();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,Q,$,s.gridSource()),this._drawWatermark(e,t);for(const c of l)this._drawSourceImpl(e,t,Q,X,c);for(const c of o)this._drawSourceImpl(e,t,Q,X,c);for(const c of h)this._drawSourceImpl(e,t,Q,X,c);for(const c of a)this._drawSourceImpl(e,t,Q,X,c);const p=new Set +;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved()].filter(c.notNull).forEach(e=>p.add(e.id()));let _=s.hoveredSource();null!==_&&(Z(_)||Object(f.isLineTool)(_)&&p.has(_.id())||Object(m.a)(_)&&!o.includes(_)?_=null:p.add(_.id()));const g=s.selection().allSources().filter(e=>!(Object(m.a)(e)&&!o.includes(e))&&(!p.has(e.id())&&!Z(e)));g.forEach(e=>p.add(e.id()));{for(const s of l)this._drawSourceImpl(e,t,Q,$,s,p);for(const s of o)this._drawSourceImpl(e,t,Q,$,s,p);for(const s of h)this._drawSourceImpl(e,t,Q,$,s,p);const i=s.activeStrategySource().value();i&&this.containsMainSeries()&&this._drawSourceImpl(e,t,te,$,i)}for(const c of n)this._drawSourceImpl(e,t,Q,X,c);for(const c of u)this._drawSourceImpl(e,t,Q,X,c);for(const c of o)this._drawSourceImpl(e,t,ee,$,c,p);for(const c of h)this._drawSourceImpl(e,t,ee,$,c,p);for(const c of n)this._drawSourceImpl(e,t,Q,$,c,p);for(const c of u)this._drawSourceImpl(e,t,Q,$,c,p);for(const c of g)this._drawSourceImpl(e,t,Q,$,c);for(const c of g)this._drawSourceImpl(e,t,ee,$,c);_&&(this._drawSourceImpl(e,t,Q,$,_),this._drawSourceImpl(e,t,ee,$,_));for(const c of a)this._drawSourceImpl(e,t,Q,$,c,p);{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,r,n){if(n&&n.has(r.id()))return;const o=this.state(),a=o.height(),l=o.width(),c=i(r,this.state());if(c)for(const h of c){const i=h.renderer(a,l);i&&(e.save(),s(i,e,t),e.restore())}}_drawBarsMarks(e,t,i){if(this.containsMainSeries()&&!i){const i=this._chartUndoModel().barsMarksSources();for(const s of i)this._drawSourceImpl(e,t,Q,$,s)}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof v.a))return!1;if(t.isEmpty())return!1;const i=t.commands()[0];return i instanceof A.PriceScaleChangeUndoCommand||i instanceof O.a}_onStateDestroyed(){this.setState(null)}_getHideNotMainSourcesValue(){return re&&!this._chart.isActive()&&!this._chart.crossHairSyncEnabled()}_onDataSourcesCollectionChanged(){this._startMoveLineToolParams=null}_processMouseEnterLeaveMoveHandlers(e,t){var i,s,r,n;null!==this._prevHoveredHittest&&this._prevHoveredHittest.renderer!==e.renderer&&(Object(u.tryCallHandler)(t,null===(s=null===(i=this._prevHoveredHittest.hittest)||void 0===i?void 0:i.data())||void 0===s?void 0:s.mouseLeaveHandler),this._prevHoveredHittest=null),t.isTouch||(e.hittest&&(null===(r=this._prevHoveredHittest)||void 0===r?void 0:r.renderer)!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t),this._prevHoveredHittest=e),null===(n=e.hittest)||void 0===n||n.tryCallMouseMoveHandler(t))}_startChangeOrMoveLineToolIfNeeded(){if(null!==this._startChangeLineToolParams){const e=this._startChangeLineToolParams;this._chartUndoModel().startChangingLinetool(e.source,e.startPoint,e.pointIndex,e.envState)} +if(null!==this._startMoveLineToolParams){const e=this._startMoveLineToolParams;this._chartUndoModel().startMovingSources(e.source,e.startPoint,e.itemIndex,e.envState)}this._startMoveLineToolParams=null,this._startChangeLineToolParams=null}_trackingModeShouldBeActive(){return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e){let t=null;const i=this._chartModel();if(e.source&&(t=e.isCustom?i.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==t){const e=this._lastClickedSource.id,t=this._lastClickedSource.isCustom?i.customSourceForName(e):i.dataSourceForId(e);null!==t&&t.onClickOutside&&(t.onClickOutside(),this._chartModel().updateSource(t))}this._lastClickedSource=null!==t?{id:t,isCustom:e.isCustom}:null}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,n=this._chartUndoModel();this._processOutsideClick(Object(r.ensureNotNull)(i)),!this._isSelectBarModeEnabled()||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||n.crossHairSource().trySelectCurrentBar(),(null===(t=null==i?void 0:i.hittest)||void 0===t?void 0:t.tryCallClickOrTapHandler(e))&&n.model().updateSource(Object(r.ensureNotNull)(s)),!e.isTouch||this._isSelectBarModeEnabled()||i&&i.source===n.crossHairSource()||this._tryExitTrackingMode(),s instanceof b.BarsMarksContainer&&i&&i.hittest&&i.hittest.data()&&s.onClicked(Object(r.ensureNotNull)(i.hittest).data()),s&&Object(f.isLineTool)(s)&&Object(l.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e){var t;if(e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null,!this.hasState())return;if(this._terminateActiveAnimations(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}Object(l.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),e.isTouch||this._updateCommonTooltip(null);const i=this._chartUndoModel(),s=new p.EnvironmentState(e);i.mainSeries().clearGotoDateResult(),this.hideInplaceEditor();const o=this.state().defaultPriceScale();if(o.isEmpty()||i.timeScale().isEmpty())return;const c=i.crossHairSource();if(!e.isTouch&&!Object(B.isLineDrawnWithPressedButton)(g.tool.value())){const t=i.lineBeingCreated(),r=null!==t?i.model().paneForSource(t):null;null!==r&&r!==this._state?this._setCursorPositionOnExternalPane(r,e.localX,e.localY,s):this._setCursorPosition(e.localX,e.localY,s)} +e.isTouch&&Object(f.isLineToolName)(g.tool.value())&&(Object(B.isLineDrawnWithPressedButton)(g.tool.value())||null!==c.pane?Object(B.isLineDrawnWithPressedButton)(g.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const h=Object(r.ensureNotNull)(this.state().mainDataSource()).firstValue();if(null===h){const t=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));return void(this._chart.readOnly()||(this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,s),t.source&&t.source instanceof D.PriceDataSource&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this)))}const d=o.coordinateToPrice(e.localY,h),_=this._chartModel().timeScale().coordinateToIndex(e.localX);if(c.startMeasurePoint()&&c.endMeasurePoint()&&c.clearMeasure(),s.shift()&&Object(g.toolIsCursor)(g.tool.value())&&i.selection().isEmpty()&&g.tool.setValue("measure"),!e.isTouch&&this._tryStartMeasure(e,c,s,d,_))return;if(!e.isTouch&&this._tryFinishMeasure(e,c))return;if(this._tryFinishZoom(e))return;if(this._tryStartZoom(e,d,_,s))return;e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=c.currentPoint(),this._startTrackPoint=new n.Point(e.localX,e.localY)):this._isSelectBarModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new n.Point(e.localX,e.localY),new n.Point(e.localX,e.localY),new p.EnvironmentState(e)));const m=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));if(e.isTouch&&(this._preventSourceChange=null===m.source||!i.selection().isSelected(m.source)),!this._isSelectBarModeEnabled()&&!this._isScrolling){if(e.isTouch&&(Object(g.toolIsMeasure)(g.tool.value())||null!==c.measurePane()))return void this._initToolCreationModeParams(e);if(Object(f.isLineToolName)(g.tool.value())||i.lineBeingCreated())return s.shift()||i.selectionMacro(e=>e.clearSelection()),void this._mouseDownEventForLineTool(e,s,_,d)}if(null===(t=m.hittest)||void 0===t||t.tryCallMouseDownOrTouchStartHandler(e),!this._chart.readOnly()){const t=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,m,s);if(m.hittest&&m.source){const t=m.hittest.data();if(m.isCustom){if(m.hittest.hasPressedMoveHandler(e))return void i.model().setCustomSourceMovingHitTestData(t)}else if((null==t?void 0:t.areaName)===u.AreaName.SourceItemMove){const s=null==t?void 0:t.itemIndex;if(void 0!==s)return void i.startCustomMoving(m.source,s,e)}}if(this._tryHandleEraserMouseDown(m,s))return;const r=m.source&&Object(f.isLineTool)(m.source)&&m.source.isLocked&&m.source.isLocked();if(!(Object(g.lockDrawings)().value()||r)&&!m.isCustom){if(m.source&&m.source.userEditEnabled&&!m.source.userEditEnabled())return;if(this._tryStartChangingLineTool(e,m,s,_))return;if(m.hittest&&((v=m.hittest.result())===u.HitTestResult.MOVEPOINT||v===u.HitTestResult.MOVEPOINT_BACKGROUND&&Object(a.lastEventIsTouch)())){if(this._tryStartCloning(e,m,s,t))return;if(this._tryStartMovingLineTool(e,m,s,_))return}} +if(m.source&&m.source instanceof D.PriceDataSource&&m.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(m.source,this))return}var v;m&&m.hittest&&m.hittest.result()===u.HitTestResult.REGULAR||(this._processing=!0)}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;const s=e.isTouch&&null!==this._startTrackPoint,n=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveLineToolParams=null,this._startChangeLineToolParams=null;const o=this._chartUndoModel(),c=o.model().customSourceMovingHitTestData();null!==c||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const h=o.model(),d=h.crossHairSource();if(d.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(d.selection());o.selectionMacro(t=>{e.forEach(e=>{t.addSourceToSelection(e)})}),d.clearSelection(),Object(F.trackEvent)("GUI","Multiselect","Area Select")}Object(l.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const _=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const m=new p.EnvironmentState(e),v=g.tool.value();if(e.isTouch&&!_&&(Object(g.toolIsMeasure)(v)||null!==d.measurePane())){if(null===d.measurePane()&&d.pane!==this._state)return void this._setCursorPosition(e.localX,e.localY);if(this._tryStartMeasure(e,d,m,d.price,d.index))return;if(this._tryFinishMeasure(e,d))return}if(e.isTouch&&!_&&!Object(B.isLineDrawnWithPressedButton)(v)&&Object(f.isLineToolName)(v)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(d.pane!==this._state)return void this._setCursorPosition(e.localX,e.localY,m);const i=d.currentPoint(),s=this.state().defaultPriceScale(),n=Object(r.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:s.coordinateToPrice(i.y,n)},l=Object(r.ensureNotNull)(o.createLineTool(this.state(),a,v));return o.selectionMacro(e=>{e.addSourceToSelection(l)}),o.lineBeingCreated()||(this._finishTool(l),e.preventDefault()),void(this._startTouchPoint=null)}const b=o.lineBeingCreated();if(b&&!Object(B.isLineDrawnWithPressedButton)(b.toolname)&&e.isTouch&&this._startTouchPoint){if(this._startTouchPoint=null,!_){const t=b.points()[b.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new p.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(b),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed()&&o.endCustomMoving(),null!==c&&(c.beingMoved&&(Object(u.tryCallHandler)(e,c.mouseUpHandler,c.touchEndHandler),this.setCursorForTool()),h.setCustomSourceMovingHitTestData(null)),h.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if(Object(B.isLineDrawnWithPressedButton)(v)&&!this._isSelectBarModeEnabled()){ +const t=o.lineBeingCreated();null!==t&&(Object(V.c)(t),t.finish());const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const n=Object(r.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=s.coordinateToPrice(e.localY,n),l={index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(l)}if(h.sourcesBeingMoved().length)return o.endMovingSource(!1),h.sourcesBeingMoved().forEach(e=>{this.setCursorForTool(e)}),void h.invalidate(G.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=this._dataSourceAtPoint(e.localX,e.localY),i=e.localX>=0&&e.localXu.HitTestResult.MOVEPOINT_BACKGROUND||Object(a.lastEventIsTouch)())&&o.selectionMacro(e=>{e.clearSelection(),e.addSourceToSelection(Object(r.ensureNotNull)(t.source))})}e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY));this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=i.crossHairSource(),o=e.localX,a=e.localY;this._prevMoveEventPosition=new n.Point(o,a);const l=new p.EnvironmentState(e);if(null!==this._firstZoomPoint)return void this._processMouseMoveWhileZoom(e,l);let c=!1;if(!(this._chart.readOnly()||this._editDialog&&this._editDialog.visible().value())){const s=g.tool.value();let r=null;if(!this._processing&&(Object(g.toolIsCursor)(s)||"eraser"===s||l.control()||!i.lineBeingCreated())){const e=t&&t.source,n=t&&t.hittest&&t.hittest.data();c=Boolean(n&&n.hideCrosshairLinesOnHover)||!!e&&Object(f.isLineTool)(e)&&-1!==J.indexOf(e.toolname),t.hittest&&t.hittest.result()>u.HitTestResult.MOVEPOINT_BACKGROUND?(r=t.source, +t.source&&t.source.isHoveredEnabled()&&("eraser"!==s||t.source!==i.mainSeries())?i.model().setHoveredSource(t.source,t.hittest.data()):i.model().setHoveredSource(null,null)):i.model().setHoveredSource(null,null)}if(this._options.sourceSelectionEnabled)if(this._isSelectBarModeEnabled())this._setCursorClassName("pointer");else{const e=t.hittest&&t.hittest.data(),i=e&&e.cursorType;this.setCursorForTool(r,l,null===i?void 0:i)}if(e.isTouch||this._updateCommonTooltip(t),null!==t.hittest&&t.hittest.hasPressedMoveHandler(e)){switch((t.hittest.data()||{}).cursorType){case j.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case j.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case j.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case j.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize")}}}if(this._preventCrossHairMove()&&this._clearCursorPosition(),s.setLinesShouldBeHidden(c),this._chart.readOnly()&&this._options.sourceSelectionEnabled&&(t.source&&t.source.isHoveredEnabled()?i.model().setHoveredSource(t.source,t.hittest&&t.hittest.data()):i.model().setHoveredSource(null,null)),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,o,a,l)}e.isTouch||this._setCursorPosition(o,a,l)}_pressedMouseOrTouchMoveEvent(e){var t;if(!this.hasState()||this._pinching)return;this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const i=new p.EnvironmentState(e),s=this._chartUndoModel(),o=s.crossHairSource(),a=e.localX,l=e.localY;if(this._prevMoveEventPosition=new n.Point(a,l),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const c=g.tool.value();if(e.isTouch&&this._startTouchPoint&&Object(f.isLineToolName)(c)&&!Object(B.isLineDrawnWithPressedButton)(c)&&!s.lineBeingCreated()&&!this._isSelectBarModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const h=o.measurePane();if(e.isTouch&&this._startTouchPoint&&(Object(g.toolIsMeasure)(c)||null!==h))return void this._updateCrosshairPositionInToolCreationMode(e,h||this.state());const d=s.lineBeingCreated();if(e.isTouch&&d&&!Object(B.isLineDrawnWithPressedButton)(d.toolname)){if(this._startTouchPoint){const t=Object(r.ensureNotNull)(s.lineBeingCreated()),i=Object(r.ensureNotNull)(s.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=Object(r.ensureNotNull)(this._initCrossHairPosition),t=new n.Point(a,l).subtract(this._startTrackPoint),s=e.add(t);this._setCursorPosition(s.x,s.y,i)}else e.isTouch&&this._preventCrossHairMove()||this._setCursorPosition(a,l,i);const _=this._isSelectBarModeEnabled() +;if(Object(f.isLineToolName)(c)&&!Object(B.isLineDrawnWithPressedButton)(c)&&!_&&!i.control())return;if(Object(B.isLineDrawnWithPressedButton)(c)&&!_){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const o=s.lineBeingCreated();if(!o)return;const a=new n.Point(e.localX,e.localY),l=Object(r.ensure)(null===(t=o.ownerSource())||void 0===t?void 0:t.firstValue());return a.price=i.coordinateToPrice(e.localY,l),a.index=Math.round(s.timeScale().coordinateToIndex(e.localX)),void s.continueCreatingLine(a)}if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(s.timeScale().isEmpty())return;const m=this._options.handleScroll;if((!m.pressedMouseMove||e.isTouch)&&(!m.horzTouchDrag&&!m.vertTouchDrag||!e.isTouch))return;if(s.customMoveBeingProcessed())return void s.processCustomMove(e);const v=s.model().customSourceMovingHitTestData();if(null!==v&&(s.model().processingCustomSourceMove(),Object(u.tryCallHandler)(e,v.pressedMouseMoveHandler,v.touchMoveHandler),!Object(u.shouldDefaultActionBeExecuted)(e,v,"pressedMouseMoveHandler","touchMoveHandler")))return;if(s.model().lineBeingEdited())return this._setCursorPosition(a,l,i),void this.setCursorForTool();if(s.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(s.model().sourcesBeingMoved(),e.localX,e.localY,i);if(this._tryFinishClonning(e,new p.EnvironmentState(e)))return;const b=Object(g.toolIsMeasure)(c)||o.startMeasurePoint()&&o.endMeasurePoint();this._chart.readOnly()||!i.control()||Object(f.isLineToolName)(c)||b?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this._setCursorPosition(e.localX,e.localY,new p.EnvironmentState(e))):this._isSelecting||(o.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t,i;if(!this.hasState())return;const s=this._chartUndoModel();s&&(e.isTouch||null!==s.crossHairSource().measurePane()||this._clearCursorPosition(),s.model().setHoveredSource(null,null),null!==this._prevHoveredHittest&&(Object(u.tryCallHandler)(e,null===(i=null===(t=this._prevHoveredHittest.hittest)||void 0===t?void 0:t.data())||void 0===i?void 0:i.mouseLeaveHandler),this._prevHoveredHittest=null),e.isTouch||this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget())}_mouseDoubleClickOrDoubleTapEvent(e){var t;if(!this.hasState())return;const i=!this._chart.readOnly()&&!Object(f.isLineToolName)(g.tool.value())&&Object(r.ensureNotNull)(this._dataSourceAtPoint(e.localX,e.localY))||null;if(null===i)return;if(i.isCustom)return void(null===(t=i.hittest)||void 0===t||t.tryCallDblClickOrDblTapHandler(e));let s=i.hittest&&i.source||null;s&&i.hittest&&i.hittest.result()<=u.HitTestResult.MOVEPOINT_BACKGROUND&&!e.isTouch&&(s=null),s&&!s.isSelectionEnabled()&&(s=null), s?this.processDoubleClickOnSource(s,i.hittest?i.hittest:void 0):this._chart.readOnly()||Object(f.isLineToolName)(g.tool.value())||this._chartUndoModel().lineBeingCreated()||!this._chartUndoModel().selection().isEmpty()||this._chart.toggleMaximizePane(this)}_contextMenuEvent(e){var t;const i=this._chartUndoModel();if(i.crossHairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return i.crossHairSource().clearMeasure(),void Object(g.resetToCursor)(!0);if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),this.hideInplaceEditor())return;if(!Object(g.toolIsCursor)(g.tool.value())||this._isSelectBarModeEnabled()){if(e.isTouch)return;return Object(g.resetToCursor)(!0),this.setCursorForTool(),void(i.lineBeingCreated()&&i.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const s=this._dataSourceAtPoint(e.localX,e.localY),r=s?s.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const n=s&&s.hittest?s.hittest.result():0,o=n>=u.HitTestResult.REGULAR||n>=u.HitTestResult.MOVEPOINT_BACKGROUND&&e.isTouch;this._chart.updateActions(),i.selectionMacro(t=>{null!==r&&o?t.selection().isSelected(r)||(t.clearSelection(),t.addSourceToSelection(r)):(this._options.contextMenu.general&&this._contextMenu(e).then(t=>{t.show(e)}),t.clearSelection())}),s&&o&&null!==r&&(Object(m.a)(r)&&r.hasContextMenu()?r.isSelectionEnabled()?this.showContextMenuForSelection(e):this.showContextMenuForSources([r],e):null===(t=s.hittest)||void 0===t||t.tryCallContextMenuHandler(e))}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crossHairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new n.Point(e.localX,e.localY),new n.Point(i.x,e.localY),new p.EnvironmentState(e))}}_contextMenu(e){const t=e=>e instanceof W.Separator,i=this._customActions(),s=this._initActions(e).filter(e=>null!==e);i.remove.forEach(e=>{for(let t=0;t0;n--)t(r[n])&&t(r[n-1])&&r.splice(n,1);return r.length&&t(r[0])&&r.splice(0,1),r.length&&t(r[r.length-1])&&r.splice(r.length-1,1),k.ContextMenuManager.createMenu(r,{statName:"ChartContextMenu"})}_initActions(e){var t;const i=this._chart.actions(),r=[];r.push(i.chartReset),r.push(new W.Separator),N.enabled("datasource_copypaste")&&!this.state().isEmpty()&&(r.push(new W.Action({label:Object(s.t)("Paste %s").replace("%s","").trim(),shortcutHint:Object(U.humanReadableHash)(U.Modifiers.Mod+86), statName:"Paste",onExecute:()=>this._chart.chartWidgetCollection().clipboard.uiRequestPaste(this.state())})),r.push(new W.Separator)),r[r.length-1]instanceof W.Separator||r.push(new W.Separator);return window.widgetbar&&(!window.widgetbar._customization||window.widgetbar._customization.watchlist)&&i.addToWatchlist&&r.push(i.addToWatchlist),N.enabled("text_notes")&&r.push(i.addToTextNotes),r[r.length-1]instanceof W.Separator||r.push(new W.Separator),r.push(this._createLockTimeAxisAction(e)),r.push(new W.Separator),r.push(Object(E.createLinesAction)(this._chart)),N.enabled("charting_library_base")||r.push(i.applyColorTheme),r[r.length-1]instanceof W.Separator||r.push(new W.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(r.push(i.applyStudiesToAllCharts),r.push(new W.Separator)),r.push(i.paneRemoveAllDrawingTools),r.push(i.paneRemoveAllStudies),r.push(new W.Separator),(null===(t=window.pro)||void 0===t?void 0:t.hasPackage("mtp-mtpredictor"))&&this.state().containsMainSeries()&&r.push(Object(E.createMTPredictorActions)(this._chart,this.state(),this._contextMenuX,this._contextMenuY),new W.Separator),r.push(i.hideAllMarks),r.push(new W.Separator),N.enabled("show_chart_property_page")&&r.push(i.chartProperties),r[r.length-1]instanceof W.Separator&&r.pop(),r}_loadAndCreateLegendWidget(){Promise.all([i.e(77),i.e(10),i.e("chart-widget-gui")]).then(i.bind(null,"sAH5")).then(e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=Object(h.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!o.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,marketStatus:this._options.marketStatusWidget||{},dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled};const s=new I.a(this._getHideNotMainSourcesValue());this._hideNotMainSourcesInLegendSpawn=Object(L.a)(()=>({}),this._chart.chartWidgetCollection().activeChartWidget,this._chart.chartWidgetCollection().lock.crosshair),this._hideNotMainSourcesInLegendSpawn.subscribe(()=>{s.setValue(this._getHideNotMainSourcesValue())}),this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme(),s,i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),updateActions:this._chart.updateActions.bind(this._chart),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart)}),this._div.appendChild(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size), this._legendWidget.updateThemedColors(this._themedTopColor);for(const n of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(n,Object(r.ensureDefined)(this._customLegendWidgetsFactoryMap.get(n)))})}_loadAndCreatePaneControlsWidget(){Promise.all([Promise.all([i.e(77),i.e(10),i.e("chart-widget-gui")]).then(i.bind(null,"lvAK")),Promise.all([i.e(77),i.e(10),i.e("chart-widget-gui")]).then(i.bind(null,"MjAr"))]).then(([e,t])=>{if(this._isDestroyed)return;const i=e.PaneControlsWidget;this._paneControls=new i(this._chartUndoModel(),this,{backgroundThemeName:this._chart.backgroundTopTheme()},{toggleMaximizePane:this._chart.toggleMaximizePane.bind(this._chart)},this._div),this._paneControls.updateWidgetModeByWidth(this._size.w),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new t.default(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement())})}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+Y+K;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive()&&this._isToolActionActiveOnPane(!0)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(p.EnvironmentState.create(Object(q.c)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&Object(f.isLineToolName)(g.tool.value())&&t.crossHairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?this._alignSourcesThatBeingMoved(s,t,i,e):this._setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&(!e.userEditEnabled||e.userEditEnabled()))if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(R.TabNames.symbol);else if(Object(f.isLineTool)(e)||Object(_.isStudy)(e)){let i;const s=null==t?void 0:t.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=se.get(e))}this._chart.showChartPropertiesForSource(e,i).then(e=>{this._editDialog=e})}}_initToolCreationModeParams(e){this._startTouchPoint=new n.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crossHairSource() @@ -387,10 +387,10 @@ this._priceDencity=e.height()/Object(s.ensureNotNull)(e.priceRange()).length(),t n.prototype._updateLength=function(){if(this.isAvailable)this.length=this.localStorage.length;else{var e,t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},n.prototype.key=function(e){return this.isAvailable?this.localStorage.key(e):Object.keys(this.localStorage)[e]},n.prototype.getItem=function(e){return this.isAvailable?this.localStorage.getItem(e):void 0===this.localStorage[e]?null:this.localStorage[e]},n.prototype.setItem=function(e,t){this.isAvailable?this.localStorage.setItem(e,t):this.localStorage[e]=t,this._updateLength()},n.prototype.removeItem=function(e){this.isAvailable?this.localStorage.removeItem(e):delete this.localStorage[e],this._updateLength()},n.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()};var o=function(e){this.storage=e};o.prototype.getItem=function(e){return Promise.resolve(this.storage.getItem(e))},o.prototype.setItem=function(e,t){return Promise.resolve(this.storage.setItem(e,t))},window.TVLocalStorage=new n,window.TVLocalStorageAsync=new o(window.TVLocalStorage),e.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},VaSN:function(e,t,i){"use strict";i.r(t),i.d(t,"lastEventIsTouch",(function(){return n})),i.d(t,"lastEventIsMouse",(function(){return o})),i.d(t,"setLastEventIsTouch",(function(){return a}));var s=i("qFKp");let r=Object(s.supportTouch)();function n(){return r}function o(){return r}function a(e){r=e}},VdBB:function(e,t,i){"use strict";function s(e,t,i){if(e.isTouch){if(void 0!==i)return!0}else if(void 0!==t)return!0;return!1}function r(e,t,i){if(e.isTouch){if(void 0!==i)return i(e),!0}else if(void 0!==t)return t(e),!0;return!1}function n(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}var o;i.r(t),i.d(t,"hasMouseOrTouchHandler",(function(){return s})),i.d(t,"tryCallHandler",(function(){return r})),i.d(t,"shouldDefaultActionBeExecuted",(function(){return n})),i.d(t,"AreaName",(function(){return o})),i.d(t,"HitTestResult",(function(){return a})),function(e){e.Style="Style",e.Text="Text",e.SourceItemMove="SourceItemMove"}(o||(o={}));class a{constructor(e,t,i){this._result=e,this._data=t||null,this._eraseMarker=i}result(){return this._result}data(){return this._data}hasPressedMoveHandler(e){return null!==this._data&&s(e,this._data.pressedMouseMoveHandler,this._data.touchMoveHandler)}tryCallMouseDownOrTouchStartHandler(e){return null!==this._data&&r(e,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e){return null!==this._data&&r(e,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e){return null!==this._data&&r(e,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e){return null!==this._data&&r(e,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e){return null!==this._data&&r(e,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e){ return null!==this._data&&r(e,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e){return null!==this._data&&r(e,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e){return null!==this._data&&r(e,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}a.MOVEPOINT_BACKGROUND=1,a.REGULAR=2,a.MOVEPOINT=3,a.CHANGEPOINT=4,a.CUSTOM=5},Vdly:function(e,t,i){"use strict";(function(e){i("qFKp");i("wVAQ").fetch;var t=i("dTSQ").regExpEscape,s=i("FBuY").TVXWindowEvents,r=i("VVxS").TVLocalStorage,n=i("aIyQ"),o=i("Kxc7"),a=["s.tradingview.com","betacdn.tradingview.com"],l=o.enabled("use_localstorage_for_settings"),c=window.TVSettings=function(){var e=!1,i=null;function h(){return!i&&l}try{e=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(I){}if(e){var u={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},d=function(e,t,i){var s=u[e];return null==s?t:s},p=function(){};return{loaded:!1,loadedModel:!1,getValue:d,getJSON:d,getBool:d,getFloat:d,getInt:d,setValue:p,setJSON:p,remove:p,keys:function(){return Object.keys(u)},keysMask:function(){return[]},sync:p,onSync:{subscribe:function(){}}}}window.environment;var _,m=TradingView.onWidget()?"tradingview-widget":"tradingview",f={},g=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^domepanel.visible$/,/^orderpanel.visible$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/,/^trading\.orderWidgetMode\./,/^symbolWatermark$/,/^pinereference\.size$/,/^pinereference\.position$/,/^hint\.+/];function v(e){return m+"."+e}function b(e,t){var i=f[e];return null==i?t:i}function S(e,t,i){i=i||{};var s=""+t;return f[e]!==s&&(f[e]=s,w(e)),i.forceFlush&&!_&&(_=setTimeout((function(){_=void 0,C()}),10)),c}function y(e,t){return t=t||{},null!=f[e]&&(delete f[e],w(e)),t.forceFlush&&C(),c}function w(e){if(i)null==f[e]?i.removeValue(e):i.setValue(e,f[e]);else if(h())try{null==f[e]?r.removeItem(v(e)):r.setItem(v(e),f[e])}catch(I){}else 0;s.emit("settings",JSON.stringify({key:e,value:f[e]}))}function C(e){}function P(){return Object.keys(f)}function x(e){for(var t=0;t=0;n--)e.test(s[n])&&r.push(s[n]),e.lastIndex=0;return r},sync:function(e){null!==e?(i?T(i.initialSettings||{}):h()?(function(){if(TradingView.onWidget()&&a.includes(window.location.host))for(var e=r.length;e--;){var t=r.key(e);if(0===t.indexOf("tradingview.")){var i=t.replace("tradingview.",m+".");r.setItem(i,r.getItem(t)),r.removeItem(t)}}}(),function(){f={};for(var e=m+".",t=!o.enabled("save_chart_properties_to_local_storage"),i=r.length;i--;){var s=r.key(i);if(s&&s.substring(0,e.length)===e){var n=s.substring(e.length);t&&!x(n)||(f[n]=r.getItem(s))}}}()):T(e||{}),M.fire()):!0},onSync:M,setSettingsAdapter:function(e){i=e}}}();e&&e.exports&&(e.exports=c)}).call(this,i("YuTi")(e))},VgjZ:function(e,t,i){"use strict";i.r(t),i.d(t,"PriceAxisRendererOptionsProvider",(function(){return n}));var s=i("XlJ7"),r=i("zDbI");class n{constructor(e){this._rendererOptions={borderSize:1,tickLength:5,fontSize:NaN,font:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,lineSpacing:0},this._chartModel=e}options(){const e=this._rendererOptions,t=this._chartModel.properties(),i=t.scalesProperties.fontSize.value();return e.fontSize!==i&&(e.fontSize=i,e.font=Object(s.makeFont)(i,r.CHART_FONT_FAMILY,""),e.paddingTop=2.5/12*i,e.paddingBottom=e.paddingTop,e.paddingInner=i/12*e.tickLength,e.paddingOuter=i/12*e.tickLength,e.lineSpacing=2/12*i),e.color=t.scalesProperties.textColor.value(),e.paneBackgroundColor=t.paneProperties.background.value(),this._rendererOptions}}},ViuT:function(e,t,i){"use strict";i.r(t);var s=i("Eyy1"),r=i("Kxc7"),n=i("jCNj"),o=i("Y7w9"),a=i("OLhd"),l=i("tqok"),c=i("/bs+");function h(e){return 60*e*60*1e3}function u(e){return 60*e*1e3}const d=[{divisor:1,weight:20},{divisor:(p=1,1e3*p),weight:19},{divisor:u(1),weight:20},{divisor:u(5),weight:21},{divisor:u(30),weight:22},{divisor:h(1),weight:30},{divisor:h(3),weight:31},{divisor:h(6),weight:32},{divisor:h(12),weight:33}];var p;function _(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=d.length-1;e>=0;--e)if(Math.floor(i/d[e].divisor)!==Math.floor(s/d[e].divisor))return d[e].weight}return 20}function m(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[] -;for(;s=t.length?(n.push({old:s,new:l.a}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.a)return e.old-t.old;if(e.new===l.a)return-1;if(t.new===l.a)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1})}function f(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}i.d(t,"SessionTimeScale",(function(){return v}));const g=r.enabled("end_of_period_timescale_marks");class v{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._seriesIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._seriesIds.clear(),this._sortedTimePoints=[],{baseIndex:0,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=Object(o.lowerbound)(this._sortedTimePoints,e,(e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN}));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let s=e;sf(e,i+t));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:Object(n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)} -fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=Object(o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),(e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return l.a;i=t.timeMs!==e?t.index+1:t.index}return Object(s.assert)(i>t,"data must have unique sorted times"),t=i,i})}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceSeriesBarsTimesTail(e,t){if(0===t.length)return null;if(!this._seriesIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=Object(o.lowerbound)(this._sortedTimePoints,t[0],(e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN}));for(let o=s;oe.timeMs-t.timeMs);const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){let i=0!==this._pointDataByTimePoint.size;if(this._seriesIds.has(e))if(1===this._seriesIds.size)i=!1,this._pointDataByTimePoint.clear();else for(const c of this._sortedTimePoints)c.pointData.series.delete(e);this._addBarsTimesToSeries(e,t,!1);const s=this._seriesIds.size;0===t.length?this._seriesIds.delete(e):this._seriesIds.add(e),i&&this._cleanupPointsData(this._sortedTimePoints);const r=sthis._seriesIds.size,o=r&&2===this._seriesIds.size||n&&1===this._seriesIds.size,a=[];this._pointDataByTimePoint.forEach((e,t)=>{a.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})}),a.sort((e,t)=>e.timeMs-t.timeMs);const l=this._updateTimeScalePoints(a);return this._applyTimeScaleChanges(l,o)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToSeries(e,t,i){const s=i?[]:null;for(const r of t){ -const t=this._pointDataByTimePoint.get(r);if(void 0===t){const t=new Set;t.add(e);const i={index:0,series:t};this._pointDataByTimePoint.set(r,i),null!==s&&s.push({timeMs:r,pointData:i})}else t.series.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return Object(o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.series.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let s=0;se.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[r].timeMs!==s.timeMs&&-1===i&&(i=r)}const s=t+e.length;if(i=b(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map(e=>({old:e.old+t,new:e.new===l.a?e.new:e.new+t}));{const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:0,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[] -;for(let r=e.pointsIndex;r=t.length?(n.push({old:s,new:l.a}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.a)return e.old-t.old;if(e.new===l.a)return-1;if(t.new===l.a)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1})}function f(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}i.d(t,"SessionTimeScale",(function(){return v}));const g=r.enabled("end_of_period_timescale_marks");class v{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._seriesIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._seriesIds.clear(),this._sortedTimePoints=[],{baseIndex:0,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=Object(o.lowerbound)(this._sortedTimePoints,e,(e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN}));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let s=e;sf(e,i+t));return r.concat(n)}setTimezone(e){ +this._displayTimezone="exchange"===e?null:Object(n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=Object(o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),(e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return l.a;i=t.timeMs!==e?t.index+1:t.index}return Object(s.assert)(i>t,"data must have unique sorted times"),t=i,i})}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceSeriesBarsTimesTail(e,t){if(0===t.length)return null;if(!this._seriesIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=Object(o.lowerbound)(this._sortedTimePoints,t[0],(e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN}));for(let o=s;oe.timeMs-t.timeMs);const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){let i=0!==this._pointDataByTimePoint.size;if(this._seriesIds.has(e))if(1===this._seriesIds.size)i=!1,this._pointDataByTimePoint.clear();else for(const c of this._sortedTimePoints)c.pointData.series.delete(e);this._addBarsTimesToSeries(e,t,!1);const s=this._seriesIds.size;0===t.length?this._seriesIds.delete(e):this._seriesIds.add(e),i&&this._cleanupPointsData(this._sortedTimePoints);const r=sthis._seriesIds.size,o=r&&2===this._seriesIds.size||n&&1===this._seriesIds.size,a=[];this._pointDataByTimePoint.forEach((e,t)=>{a.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})}),a.sort((e,t)=>e.timeMs-t.timeMs);const l=this._updateTimeScalePoints(a);return this._applyTimeScaleChanges(l,o)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex() +;this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToSeries(e,t,i){const s=i?[]:null;for(const r of t){const t=this._pointDataByTimePoint.get(r);if(void 0===t){const t=new Set;t.add(e);const i={index:0,series:t};this._pointDataByTimePoint.set(r,i),null!==s&&s.push({timeMs:r,pointData:i})}else t.series.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return Object(o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.series.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let s=0;se.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[r].timeMs!==s.timeMs&&-1===i&&(i=r)}const s=t+e.length;if(i=b(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map(e=>({old:e.old+t,new:e.new===l.a?e.new:e.new+t}));{const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0), +0===this._sortedTimePoints.length)return{baseIndex:0,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let r=e.pointsIndex;r{this._destroyed||this._processPendingSubscribers()},0),s}removeSubscription(e){const t=this._pendingSubscribers.find(t=>t.key===e);if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find(t=>t.key===e);if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=setTimeout(()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()},this._resetCacheTimePeriod)));console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}_logMessage(e,t){if(a.enabled("charting_library_debug_mode")||t){const t=this._symbolInfo.currency_code,i=this._symbolInfo.unit_id;console.log(`FEED [${this._symbolInfo.name}|${this._resolution}${t?"|"+t:""}${i?"|"+i:""}]: ${e}`)}}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){ return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=Object(s.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,r=Object(n.lowerbound)(this._cache.bars,i,(e,t)=>e.time{e.onErrorCallback(t)})}let t=this._normalizeRange(e[0].range);for(const i of e.map(e=>this._normalizeRange(e.range)))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${d(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach(t=>{const i=t.barset;if(null===i)throw new Error("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},u(this._symbolInfo,this._resolution),()=>{this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null!==e&&this._ensureRequestedTo({to:e,countBack:0})}),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(u(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i) diff --git a/charting_library/charting_library.cjs.js b/charting_library/charting_library.cjs.js index dfa8bd50..870ce7c7 100644 --- a/charting_library/charting_library.cjs.js +++ b/charting_library/charting_library.cjs.js @@ -1 +1 @@ -"use strict";function e(t,i){const n=Object.assign({},t);for(const o in i)"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=e(t[o],i[o]);return n}Object.defineProperty(exports,"__esModule",{value:!0});const t={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},i={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function n(){return"CL v20.028 (internal id a477abd4 @ 2021-09-10T14:51:52.459Z)"}const o=class{constructor(n){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!n.datafeed)throw new Error("Datafeed is not defined");if(this._options=e(i,n),n.preset){const e=t[n.preset];e?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(e.disabled_features):this._options.disabled_features=e.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(e.enabled_features):this._options.enabled_features=e.enabled_features):console.warn("Unknown preset: `"+n.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(t){this._options=e(this._options,{overrides:t}),this._innerWindow().applyOverrides(t)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.a477abd4.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};window.TradingView=window.TradingView||{},window.TradingView.version=n,exports.version=n,exports.widget=o; +"use strict";function e(t,i){const n=Object.assign({},t);for(const o in i)"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=e(t[o],i[o]);return n}Object.defineProperty(exports,"__esModule",{value:!0});const t={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},i={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function n(){return"CL v20.029 (internal id c7e6d52b @ 2021-09-16T11:38:03.852Z)"}const o=class{constructor(n){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!n.datafeed)throw new Error("Datafeed is not defined");if(this._options=e(i,n),n.preset){const e=t[n.preset];e?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(e.disabled_features):this._options.disabled_features=e.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(e.enabled_features):this._options.enabled_features=e.enabled_features):console.warn("Unknown preset: `"+n.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(t){this._options=e(this._options,{overrides:t}),this._innerWindow().applyOverrides(t)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.c7e6d52b.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};window.TradingView=window.TradingView||{},window.TradingView.version=n,exports.version=n,exports.widget=o; diff --git a/charting_library/charting_library.d.ts b/charting_library/charting_library.d.ts index 0cf2c329..b8db65ed 100644 --- a/charting_library/charting_library.d.ts +++ b/charting_library/charting_library.d.ts @@ -180,6 +180,7 @@ export declare type SeriesEventType = "price_scale_changed"; export declare type SeriesFormat = "price" | "volume"; export declare type SeriesPriceScale = "new-left" | "new-right" | "no-scale" | EntityId; export declare type ServerTimeCallback = (serverTime: number) => void; +export declare type SetVisibleTimeRange = Omit & Partial>; export declare type ShapePoint = StickedPoint | PricedPoint | TimePoint; export declare type ShapesGroupId = Nominal; export declare type SingleChartLayoutType = "s"; @@ -859,7 +860,7 @@ export interface IChartWidgetApi { onChartTypeChanged(): ISubscription<(chartType: SeriesStyle) => void>; dataReady(callback: () => void): boolean; crossHairMoved(): ISubscription<(params: CrossHairMovedEventParams) => void>; - setVisibleRange(range: VisibleTimeRange, options?: SetVisibleRangeOptions): Promise; + setVisibleRange(range: SetVisibleTimeRange, options?: SetVisibleRangeOptions): Promise; setSymbol(symbol: string, callback: () => void): void; setResolution(resolution: ResolutionString, callback: () => void): void; resetData(): void; diff --git a/charting_library/charting_library.esm.js b/charting_library/charting_library.esm.js index 039bbd2e..8744276e 100644 --- a/charting_library/charting_library.esm.js +++ b/charting_library/charting_library.esm.js @@ -1 +1 @@ -function e(t,i){const n=Object.assign({},t);for(const o in i)"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=e(t[o],i[o]);return n}const t={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},i={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function n(){return"CL v20.028 (internal id a477abd4 @ 2021-09-10T14:51:52.459Z)"}const o=class{constructor(n){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!n.datafeed)throw new Error("Datafeed is not defined");if(this._options=e(i,n),n.preset){const e=t[n.preset];e?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(e.disabled_features):this._options.disabled_features=e.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(e.enabled_features):this._options.enabled_features=e.enabled_features):console.warn("Unknown preset: `"+n.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(t){this._options=e(this._options,{overrides:t}),this._innerWindow().applyOverrides(t)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.a477abd4.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};window.TradingView=window.TradingView||{},window.TradingView.version=n;export{n as version,o as widget}; +function e(t,i){const n=Object.assign({},t);for(const o in i)"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=e(t[o],i[o]);return n}const t={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},i={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function n(){return"CL v20.029 (internal id c7e6d52b @ 2021-09-16T11:38:03.852Z)"}const o=class{constructor(n){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!n.datafeed)throw new Error("Datafeed is not defined");if(this._options=e(i,n),n.preset){const e=t[n.preset];e?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(e.disabled_features):this._options.disabled_features=e.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(e.enabled_features):this._options.enabled_features=e.enabled_features):console.warn("Unknown preset: `"+n.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(t){this._options=e(this._options,{overrides:t}),this._innerWindow().applyOverrides(t)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.c7e6d52b.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};window.TradingView=window.TradingView||{},window.TradingView.version=n;export{n as version,o as widget}; diff --git a/charting_library/charting_library.js b/charting_library/charting_library.js index 90f32001..0a47e0c9 100644 --- a/charting_library/charting_library.js +++ b/charting_library/charting_library.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TradingView={})}(this,(function(e){"use strict";function t(e,i){const n=Object.assign({},e);for(const o in i)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=t(e[o],i[o]);return n}const i={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function o(){return"CL v20.028 (internal id a477abd4 @ 2021-09-10T14:51:52.459Z)"}const s=class{constructor(e){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");if(this._options=t(n,e),e.preset){const t=i[e.preset];t?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(t.disabled_features):this._options.disabled_features=t.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(t.enabled_features):this._options.enabled_features=t.enabled_features):console.warn("Unknown preset: `"+e.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(e){this._options=t(this._options,{overrides:e}),this._innerWindow().applyOverrides(e)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.a477abd4.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};window.TradingView=window.TradingView||{},window.TradingView.version=o,e.version=o,e.widget=s,Object.defineProperty(e,"__esModule",{value:!0})})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TradingView={})}(this,(function(e){"use strict";function t(e,i){const n=Object.assign({},e);for(const o in i)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=t(e[o],i[o]);return n}const i={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function o(){return"CL v20.029 (internal id c7e6d52b @ 2021-09-16T11:38:03.852Z)"}const s=class{constructor(e){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");if(this._options=t(n,e),e.preset){const t=i[e.preset];t?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(t.disabled_features):this._options.disabled_features=t.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(t.enabled_features):this._options.enabled_features=t.enabled_features):console.warn("Unknown preset: `"+e.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(e){this._options=t(this._options,{overrides:e}),this._innerWindow().applyOverrides(e)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.c7e6d52b.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};window.TradingView=window.TradingView||{},window.TradingView.version=o,e.version=o,e.widget=s,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/charting_library/charting_library.standalone.js b/charting_library/charting_library.standalone.js index 65c64072..29a2bbe9 100644 --- a/charting_library/charting_library.standalone.js +++ b/charting_library/charting_library.standalone.js @@ -1 +1 @@ -var TradingView=function(e){"use strict";function t(e,i){const n=Object.assign({},e);for(const o in i)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=t(e[o],i[o]);return n}const i={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function o(){return"CL v20.028 (internal id a477abd4 @ 2021-09-10T14:51:52.459Z)"}const s=class{constructor(e){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");if(this._options=t(n,e),e.preset){const t=i[e.preset];t?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(t.disabled_features):this._options.disabled_features=t.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(t.enabled_features):this._options.enabled_features=t.enabled_features):console.warn("Unknown preset: `"+e.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(e){this._options=t(this._options,{overrides:e}),this._innerWindow().applyOverrides(e)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.a477abd4.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};return window.TradingView=window.TradingView||{},window.TradingView.version=o,e.version=o,e.widget=s,e}({}); +var TradingView=function(e){"use strict";function t(e,i){const n=Object.assign({},e);for(const o in i)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==i[o]&&(n[o]=i[o]):n[o]=t(e[o],i[o]);return n}const i={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}};function o(){return"CL v20.029 (internal id c7e6d52b @ 2021-09-16T11:38:03.852Z)"}const s=class{constructor(e){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");if(this._options=t(n,e),e.preset){const t=i[e.preset];t?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(t.disabled_features):this._options.disabled_features=t.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(t.enabled_features):this._options.enabled_features=t.enabled_features):console.warn("Unknown preset: `"+e.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._innerAPI().onGrayedObjectClicked(e)}onShortcut(e,t){this._innerWindow().createShortcutAction(e,t)}subscribe(e,t){this._innerAPI().subscribe(e,t)}unsubscribe(e,t){this._innerAPI().unsubscribe(e,t)}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._innerAPI().closePopupsAndDialogs()}selectLineTool(e){this._innerAPI().selectLineTool(e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e){this._innerAPI().saveChart(e)}load(e,t){this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._innerAPI().onContextMenu(e)}createButton(e){return this._innerWindow().createButton(e)}showNoticeDialog(e){this._innerAPI().showNoticeDialog(e)}showConfirmDialog(e){this._innerAPI().showConfirmDialog(e)}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(e){this._options=t(this._options,{overrides:e}),this._innerWindow().applyOverrides(e)}applyStudiesOverrides(e){this._innerWindow().applyStudiesOverrides(e)}watchList(){return this._innerAPI().watchlist()}activeChart(){return this._innerAPI().activeChart()}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}changeTheme(e,t){this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._innerAPI().takeScreenshot()}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")}_create(){const e=this._render();this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const t=this._options.container_id||this._options.container,i="string"==typeof t?document.getElementById(t):t;if(null===i)throw new Error(`There is no such element - #${this._options.container}`);i.innerHTML=e,this._iFrame=i.querySelector(`#${this._id}`);const n=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(n.style.width="100%",this._options.fullscreen||(n.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((e=>{const t=()=>{n.removeEventListener("load",t,!1),e()};n.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}))}_render(){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");const t=(this._options.library_path||"")+`${encodeURIComponent(this._options.locale)}-tv-chart.c7e6d52b.html#symbol=`+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return''}};return window.TradingView=window.TradingView||{},window.TradingView.version=o,e.version=o,e.widget=s,e}({}); diff --git a/charting_library/cs-tv-chart.a477abd4.html b/charting_library/cs-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/cs-tv-chart.a477abd4.html rename to charting_library/cs-tv-chart.c7e6d52b.html index 34ab60a1..760e4ad6 100644 --- a/charting_library/cs-tv-chart.a477abd4.html +++ b/charting_library/cs-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/da_DK-tv-chart.a477abd4.html b/charting_library/da_DK-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/da_DK-tv-chart.a477abd4.html rename to charting_library/da_DK-tv-chart.c7e6d52b.html index 919ea47e..3a768a78 100644 --- a/charting_library/da_DK-tv-chart.a477abd4.html +++ b/charting_library/da_DK-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/de-tv-chart.a477abd4.html b/charting_library/de-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/de-tv-chart.a477abd4.html rename to charting_library/de-tv-chart.c7e6d52b.html index 53ca233f..28cc0b04 100644 --- a/charting_library/de-tv-chart.a477abd4.html +++ b/charting_library/de-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/el-tv-chart.a477abd4.html b/charting_library/el-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/el-tv-chart.a477abd4.html rename to charting_library/el-tv-chart.c7e6d52b.html index 299189ff..0ad2a1b2 100644 --- a/charting_library/el-tv-chart.a477abd4.html +++ b/charting_library/el-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/en-tv-chart.a477abd4.html b/charting_library/en-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/en-tv-chart.a477abd4.html rename to charting_library/en-tv-chart.c7e6d52b.html index 3b304577..1bcd8fc4 100644 --- a/charting_library/en-tv-chart.a477abd4.html +++ b/charting_library/en-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/es-tv-chart.a477abd4.html b/charting_library/es-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/es-tv-chart.a477abd4.html rename to charting_library/es-tv-chart.c7e6d52b.html index a06bfab8..f0c9e579 100644 --- a/charting_library/es-tv-chart.a477abd4.html +++ b/charting_library/es-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/et_EE-tv-chart.a477abd4.html b/charting_library/et_EE-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/et_EE-tv-chart.a477abd4.html rename to charting_library/et_EE-tv-chart.c7e6d52b.html index 77ec6a00..6f4a60ee 100644 --- a/charting_library/et_EE-tv-chart.a477abd4.html +++ b/charting_library/et_EE-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/fa-tv-chart.a477abd4.html b/charting_library/fa-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/fa-tv-chart.a477abd4.html rename to charting_library/fa-tv-chart.c7e6d52b.html index e9383a6b..dc7af82a 100644 --- a/charting_library/fa-tv-chart.a477abd4.html +++ b/charting_library/fa-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/fr-tv-chart.a477abd4.html b/charting_library/fr-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/fr-tv-chart.a477abd4.html rename to charting_library/fr-tv-chart.c7e6d52b.html index 18c0f05d..9e09a5b1 100644 --- a/charting_library/fr-tv-chart.a477abd4.html +++ b/charting_library/fr-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/he_IL-tv-chart.a477abd4.html b/charting_library/he_IL-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/he_IL-tv-chart.a477abd4.html rename to charting_library/he_IL-tv-chart.c7e6d52b.html index cc25e599..5881f426 100644 --- a/charting_library/he_IL-tv-chart.a477abd4.html +++ b/charting_library/he_IL-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/hu_HU-tv-chart.a477abd4.html b/charting_library/hu_HU-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/hu_HU-tv-chart.a477abd4.html rename to charting_library/hu_HU-tv-chart.c7e6d52b.html index 09181070..4d583331 100644 --- a/charting_library/hu_HU-tv-chart.a477abd4.html +++ b/charting_library/hu_HU-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/id_ID-tv-chart.a477abd4.html b/charting_library/id_ID-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/id_ID-tv-chart.a477abd4.html rename to charting_library/id_ID-tv-chart.c7e6d52b.html index aadcae97..8ee1080a 100644 --- a/charting_library/id_ID-tv-chart.a477abd4.html +++ b/charting_library/id_ID-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/it-tv-chart.a477abd4.html b/charting_library/it-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/it-tv-chart.a477abd4.html rename to charting_library/it-tv-chart.c7e6d52b.html index 7ef3a73d..8d6da4b8 100644 --- a/charting_library/it-tv-chart.a477abd4.html +++ b/charting_library/it-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/ja-tv-chart.a477abd4.html b/charting_library/ja-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/ja-tv-chart.a477abd4.html rename to charting_library/ja-tv-chart.c7e6d52b.html index 6d4b6871..9b68d0e5 100644 --- a/charting_library/ja-tv-chart.a477abd4.html +++ b/charting_library/ja-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/ko-tv-chart.a477abd4.html b/charting_library/ko-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/ko-tv-chart.a477abd4.html rename to charting_library/ko-tv-chart.c7e6d52b.html index ed9da147..e4a6213a 100644 --- a/charting_library/ko-tv-chart.a477abd4.html +++ b/charting_library/ko-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/ms_MY-tv-chart.a477abd4.html b/charting_library/ms_MY-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/ms_MY-tv-chart.a477abd4.html rename to charting_library/ms_MY-tv-chart.c7e6d52b.html index e5158d5b..0e0f224d 100644 --- a/charting_library/ms_MY-tv-chart.a477abd4.html +++ b/charting_library/ms_MY-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/nl_NL-tv-chart.a477abd4.html b/charting_library/nl_NL-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/nl_NL-tv-chart.a477abd4.html rename to charting_library/nl_NL-tv-chart.c7e6d52b.html index 55ac4021..65f621cb 100644 --- a/charting_library/nl_NL-tv-chart.a477abd4.html +++ b/charting_library/nl_NL-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/no-tv-chart.a477abd4.html b/charting_library/no-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/no-tv-chart.a477abd4.html rename to charting_library/no-tv-chart.c7e6d52b.html index 7f65d000..1b76e7a2 100644 --- a/charting_library/no-tv-chart.a477abd4.html +++ b/charting_library/no-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/package.json b/charting_library/package.json index f7146886..e3cd92ad 100644 --- a/charting_library/package.json +++ b/charting_library/package.json @@ -1,6 +1,6 @@ { "private": true, - "description": "CL v20.028 (internal id a477abd4 @ 2021-09-10T14:51:52.459Z)", + "description": "CL v20.029 (internal id c7e6d52b @ 2021-09-16T11:38:03.852Z)", "type": "module", "main": "charting_library.cjs.js", "module": "charting_library.esm.js", diff --git a/charting_library/pl-tv-chart.a477abd4.html b/charting_library/pl-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/pl-tv-chart.a477abd4.html rename to charting_library/pl-tv-chart.c7e6d52b.html index ebc49076..99888753 100644 --- a/charting_library/pl-tv-chart.a477abd4.html +++ b/charting_library/pl-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/pt-tv-chart.a477abd4.html b/charting_library/pt-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/pt-tv-chart.a477abd4.html rename to charting_library/pt-tv-chart.c7e6d52b.html index d3a35e2c..be61c8fa 100644 --- a/charting_library/pt-tv-chart.a477abd4.html +++ b/charting_library/pt-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/ro-tv-chart.a477abd4.html b/charting_library/ro-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/ro-tv-chart.a477abd4.html rename to charting_library/ro-tv-chart.c7e6d52b.html index 730f5453..01426643 100644 --- a/charting_library/ro-tv-chart.a477abd4.html +++ b/charting_library/ro-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/ru-tv-chart.a477abd4.html b/charting_library/ru-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/ru-tv-chart.a477abd4.html rename to charting_library/ru-tv-chart.c7e6d52b.html index f01adbb1..443cda14 100644 --- a/charting_library/ru-tv-chart.a477abd4.html +++ b/charting_library/ru-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/sk_SK-tv-chart.a477abd4.html b/charting_library/sk_SK-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/sk_SK-tv-chart.a477abd4.html rename to charting_library/sk_SK-tv-chart.c7e6d52b.html index 28cfdeea..7f2a1a7d 100644 --- a/charting_library/sk_SK-tv-chart.a477abd4.html +++ b/charting_library/sk_SK-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/sv-tv-chart.a477abd4.html b/charting_library/sv-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/sv-tv-chart.a477abd4.html rename to charting_library/sv-tv-chart.c7e6d52b.html index 457723eb..f94af3c4 100644 --- a/charting_library/sv-tv-chart.a477abd4.html +++ b/charting_library/sv-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/th-tv-chart.a477abd4.html b/charting_library/th-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/th-tv-chart.a477abd4.html rename to charting_library/th-tv-chart.c7e6d52b.html index 49e1f027..a6615c56 100644 --- a/charting_library/th-tv-chart.a477abd4.html +++ b/charting_library/th-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/tr-tv-chart.a477abd4.html b/charting_library/tr-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/tr-tv-chart.a477abd4.html rename to charting_library/tr-tv-chart.c7e6d52b.html index 7384606a..40e3d98b 100644 --- a/charting_library/tr-tv-chart.a477abd4.html +++ b/charting_library/tr-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/vi-tv-chart.a477abd4.html b/charting_library/vi-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/vi-tv-chart.a477abd4.html rename to charting_library/vi-tv-chart.c7e6d52b.html index a9261989..8b5322fb 100644 --- a/charting_library/vi-tv-chart.a477abd4.html +++ b/charting_library/vi-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/zh-tv-chart.a477abd4.html b/charting_library/zh-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/zh-tv-chart.a477abd4.html rename to charting_library/zh-tv-chart.c7e6d52b.html index 35edeafd..939d4769 100644 --- a/charting_library/zh-tv-chart.a477abd4.html +++ b/charting_library/zh-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/charting_library/zh_TW-tv-chart.a477abd4.html b/charting_library/zh_TW-tv-chart.c7e6d52b.html similarity index 99% rename from charting_library/zh_TW-tv-chart.a477abd4.html rename to charting_library/zh_TW-tv-chart.c7e6d52b.html index fa4b050b..e09a8dc3 100644 --- a/charting_library/zh_TW-tv-chart.a477abd4.html +++ b/charting_library/zh_TW-tv-chart.c7e6d52b.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file