(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[30128],{128563:(e,t,s)=>{e.exports=[{name:s.tf(null,void 0,s(695271)),value:"",search_type:"undefined"},{name:s.tf(null,void 0,s(426294)),value:"stocks",search_type:"stocks"},{name:s.tf(null,void 0,s(301992)),value:"funds",search_type:"funds"},{name:s.tf(null,void 0,s(468631)),value:"futures",search_type:"futures"},{name:s.tf(null,void 0,s(324241)),value:"forex",search_type:"forex"},{name:s.tf(null,void 0,s(494695)),value:"cfd",search_type:"cfd"},{name:s.tf(null,void 0,s(612760)),value:"bitcoin,crypto",search_type:"crypto"},{name:s.tf(null,void 0,s(433468)),value:"index",search_type:"index"},{name:s.tf(null,void 0,s(290368)),value:"bond",search_type:"bond"},{name:s.tf(null,void 0,s(337556)),value:"economic",search_type:"economic"}]},448203:(e,t,s)=>{"use strict";s.r(t),s.d(t,{TVChartApiBase:()=>R});var n=s(12481),o=s(203308),r=s(822914),i=s(650151),a=s(778016),d=s(244842),c=s(268222),u=s(401580);class h{constructor(e){this._cache=e}async getValue(e){const t=await this._cache.match(e);if(!t)return null;return"application/json"===(0,i.ensureNotNull)(t.headers.get("Content-Type"))?t.json():t.text()}async setValue(e,t){return"string"==typeof t?this._cache.put(e,new Response(t,{headers:{"content-type":"text/plain"}})):this._cache.put(e,new Response(JSON.stringify(t),{headers:{"content-type":"application/json"}}))}}class l{constructor(){this._data=new Map}async getValue(e){var t;return null!==(t=this._data.get(e))&&void 0!==t?t:null}async setValue(e,t){this._data.set(e,t)}}var _=s(678515),p=s(201089),m=s(175203),f=s(833813);function y(e){return e.index=e.i,e.value=e.v,delete e.i,delete e.v,e}function g(e){for(const t of Object.keys(e))e[t].t&&(e[t].turnaround=e[t].t),e[t].s&&!e[t].series&&(e[t].series=e[t].s.map(y)),e[t].st&&!e[t].series&&(e[t].series=e[t].st.map(y))}class v{set_broker(e){return[e]}set_data_quality(){return["low"]}quote_create_session(e){return[e]}quote_delete_session(e){return[e]}quote_set_fields(e,t){return[e].concat(t)}quote_add_symbols(e,t){return[e].concat(t)}quote_remove_symbols(e,t){return[e].concat(t)}quote_fast_symbols(e,t){return[e].concat(t)}quote_hibernate_all(e){return[e]}depth_create_session(e,t,s){return[e,t,s]}depth_delete_session(e){return[e]}depth_set_symbol(e,t){return[e,t]}depth_clear_symbol(e){return[e]}depth_set_scale(e,t){return[e,t]}chart_create_session(e,t){return[e,t?"disable_statistics":""]}chart_delete_session(e){return[e]}set_auth_token(e){return[e]}set_locale(e,t){return[e,t]}switch_timezone(e,t){return[e,t]}resolve_symbol(e,t,s){return[e,t,s]}create_series(e,t,s,n,o,r,i){return[e,t,s=s||"",n,o,r,i]}remove_series(e,t){return[e,t]}modify_series(e,t,s,n,o,r){return[e,t,s=s||"",n,o,r]}request_more_data(e,t,s){return[e,t,s]}request_studies_metadata(e){return[e]}create_study(e,t,s,n,o,r){return[e,t,s=s||"",n,o].concat(r)}create_child_study(e,t,s,n,o,r){return this.create_study(e,t,s,n,o,r)}child_study_rebind(e,t,s,n,o,r){return[e,t,s=s||"",n,o].concat(r)}remove_study(e,t){return[e,t]}modify_study(e,t,s,n){ return[e,t,s=s||""].concat(n)}create_pointset(e,t,s,n,o,r){return[e,t,s=s||"",n,o].concat(r)}modify_pointset(e,t,s,n){return[e,t,s=s||""].concat(n)}remove_pointset(e,t){return[e,t]}request_more_tickmarks(e,t,s){return[e,t,s]}get_first_bar_time(e,t,s){return[e,t,s]}replay_create_session(e){return[e]}replay_delete_session(e){return[e]}replay_reset(e,t,s){return[e,t,s]}replay_start(e,t,s){return[e,t,s]}replay_stop(e,t){return[e,t]}replay_step(e,t,s){return[e,t,s]}replay_add_series(e,t,s,n){return[e,t,s,n]}replay_remove_series(e,t,s,n){return[e,t,s,n]}replay_set_resolution(e,t,s){return[e,t,s]}convertTimescaleResponse(e){const t=e.marks.map((e=>({span:e[0],time:e[1],index:e[2]}))),s=void 0===e.index_diff?[]:e.index_diff.map((e=>({old:e[0],new:e[1]})));return{...e,marks:t,index_diff:s}}getDataUpdateObjects(e){return this.getTimescaleObjects(e)}getTimescaleObjects(e){return e.params[0]}getTimescaleChangeset(e){return e.params[1]}prepareDataUpdateObjects(e,t,s){for(const n of Object.keys(t)){const o=t[n],r={customId:n,turnaround:o.turnaround,plots:o.series?o.series:o.plots};o.ns&&(r.nonseries=o.ns),o.lbs&&(r.lastBar={closeTime:o.lbs.bar_close_time});for(const e of r.plots)for(let t=0;t{S.logNormal("Last 30 seconds:"+q(this._trafficStats.lastChunk)+" Since last connect:"+q(this._trafficStats.sinceConnect)+" Total traffic:"+q(this._trafficStats.total)),this._trafficStats.lastChunk=0}),3e4),this._connectionsLimitReached.subscribe((e=>{e&&this.disconnect()}))}connect(e){this._connectOnlyOptions=e,this._wsBackendConnection.isConnected()||this._wsBackendConnection.isConnecting()||this._wsBackendConnection.connect()}disconnect(){this._wsBackendConnection.disconnect()}availablePriceSources(){return Promise.resolve([])}connectionBanInfo(){return this._banInfo.readonly()}connectionsLimitReached(){return this._connectionsLimitReached.readonly()}serverTime(){return Math.round(this._serverTimeBasePoint+performance.now())}compensateConnectionLag(e){const t=this.serverTime(),s=Math.floor(e-t);s>0&&(this._serverTimeBasePoint+=s)}async requestMetadata(){return null===this._metadataDeferredPromise&&(this._metadataDeferredPromise=(0,c.createDeferredPromise)(),this._metadataDeferredPromise.promise.finally((()=>{this._metadataDeferredPromise=null})),this._requestMetadata()),this._metadataDeferredPromise.promise}setLoadNew(e){this._loadNewBars=!!e}canCreateStudy(e){if(!(0,a.enabled)(f.ProductFeatures.STUDY_ON_STUDY))return!1;const t=(0,i.ensureNotNull)((0,a.getConfig)(f.ProductFeatures.STUDY_ON_STUDY));return!0===e?this._childStudyCounterthis._sendRequest("modify_study",[e,t,s,n])),500,{maxWait:550});return this._modifyStudyMap.set(u,r),null===(c=r(e,t,s,o))||void 0===c||c}}unpack(e){return this._dataHandleModule.unpack(e)}sendRequest(e,t){return this._sendRequest(e,t)}_init(){this._notificationHandlers={},this._studyCounter=0,this._childStudyCounter=0,this._modifyStudyMap=new Map}_onMessage(e){this._calcTrafficStats(e);const t=this.unpack(e);"t_ms"in t&&(0,o.default)(t.t_ms)&&window.ChartApiInstance.compensateConnectionLag(t.t_ms), "protocol_switched"!==t.method?"protocol_error"!==t.method?this._dispatchNotification(t,e):this._processProtocolError(t):this._chartApiLog.logError("Unexpected protocol changing request, try skipping. Requested protocol:"+t.params[0])}async _processedMetadata(e){const t=(0,i.ensureNotNull)(this._metadataDeferredPromise),s=await this._initCachePromise,n=window.pro.hash(),o=d.enabled("widget"),a=o?"studies_metadata_widget":"studies_metadata";try{if(await s.setValue(a,(0,r.default)(e)),this._chartApiLog.logNormal("Updated studies_metadata cache"),!o)try{await s.setValue("pro_hash",(0,r.default)(n)),this._chartApiLog.logNormal("Updated pro_hash cache")}catch(e){t.reject(),this._chartApiLog.logError("Cannot update pro_hash cache, reason: "+e)}}catch(e){t.reject(),this._chartApiLog.logError("Cannot update studies_metadata cache, reason: "+e)}t.resolve((0,r.default)(e))}async _requestMetadata(){const e=this._makeNextRequestId();C.logNormal(`Requesting metainfo #${e}`);const t=(0,i.ensureNotNull)(this._metadataDeferredPromise),s=window.pro,n=s.hash(),o=d.enabled("widget"),a=o?"studies_metadata_widget":"studies_metadata";this._chartApiLog.logNormal("Requesting pro hash");let c=!1;try{const i=await this._initCachePromise,d=await i.getValue("pro_hash");if(null!==d&&d===n||o){this._chartApiLog.logNormal("Pro hash has not changed, requesting from local");const o=await i.getValue(a),d=null!==o&&o.params[1].hash||null;if(null===d||null===this._metadataServerHash||this._metadataServerHash!==d)this._chartApiLog.logNormal("Metadata hash has changed (cached:'"+d+"', server:'"+this._metadataServerHash+"'')"),c=this._requestMetadataFromServer(e);else{if(!s.hasPackage("tv-volumebyprice")||void 0!==o.params[1].metainfo.find((e=>e.id.includes("@tv-volumebyprice"))))return this._chartApiLog.logNormal("Using studies_metadata from browser cache"),void t.resolve((0,r.default)(o));this._chartApiLog.logNormal("De-sync detected! pro.hash contains VbPR studies, but data from cache doesn't and pro.hash isn't changed, pro.hash="+n),c=this._requestMetadataFromServer(e)}}else this._chartApiLog.logNormal("Pro hash has changed (cached: '"+d+"', current:'"+n+"')"),c=this._requestMetadataFromServer(e)}catch(t){this._chartApiLog.logError("Cannot get studies_metadata, reason: "+t),c=this._requestMetadataFromServer(e)}finally{c||t.reject(),C.logNormal(`Requesting studies metadata #${e} finished`)}}_makeNextRequestId(){return"metadata_"+this._metadataRequestNextNumber++}_processProtocolError(e){const t=e.params[0];this._chartApiLog.logError(`Protocol error. Reason=${t}.`),"banned"!==t&&"banned by user_id"!==t&&"banned by ip"!==t||(this._banInfo.setValue({reason:t}),this.disconnect()),this._connectionsLimitReached.setValue("user connections limit reached"===t)}_requestMetadataFromServer(e){return this._chartApiLog.logNormal("Request studies_metadata from server"),this._sendRequest("request_studies_metadata",[e])}_bindSocketEvents(){this.connectDfd=new Promise(((e,t)=>{this._wsBackendConnection.on("connect",(()=>{this._onConnect(),e()})), this._wsBackendConnection.on("message",this._onMessage.bind(this)),this._wsBackendConnection.on("disconnect",(()=>{this._authTokenDfd&&(this._authTokenDfd=null),this._onDataProblemsPromiseErrback&&this._onDataProblemsPromiseErrback(),this._isConnected=!1,this._studyCounter=0,this._childStudyCounter=0,this._notifySessions({method:"disconnected",params:[]}),this._banInfo.value()||(this._metadataDeferredPromise=null),this._disconnectCount=(this._disconnectCount||0)+1,this._wsBackendConnection.isConnected()&&(this._telemetryDisconnectTimeout=setTimeout((()=>{m.telemetry.sendChartReport("disconnect")}),5e3),this._wsBackendConnection.isMaxReconnects()&&(this._notifySessions({method:"reconnect_bailout",params:[]}),t(),m.telemetry.sendChartReport("reconnect_bailout")))}))}))}_calcTrafficStats(e){const t=e.length;this._trafficStats.total+=t,this._trafficStats.sinceConnect+=t,this._trafficStats.lastChunk+=t}}},84461:(e,t,s)=>{"use strict";var n=s(389137).declareClassAsPureInterface;function o(){}TradingView.WEB_SOCKET_WAS_CONNECTED=!1,o.prototype.defaultResolutions=function(){},o.prototype.availableCurrencies=function(){},o.prototype.availableUnits=function(){},o.prototype.supportedSymbolsTypes=function(){},o.prototype.symbolsGrouping=function(){},o.prototype.quoteCreateSession=function(e){},o.prototype.quoteDeleteSession=function(e){},o.prototype.quoteSetFields=function(e,t){},o.prototype.quoteAddSymbols=function(e,t){},o.prototype.quoteRemoveSymbols=function(e,t){},o.prototype.quoteFastSymbols=function(e,t){},o.prototype.depthCreateSession=function(e,t,s){},o.prototype.depthDeleteSession=function(e){},o.prototype.depthSetSymbol=function(e,t){},o.prototype.depthClearSymbol=function(e){},o.prototype.depthSetScale=function(e,t){},o.prototype.chartCreateSession=function(e,t){},o.prototype.chartDeleteSession=function(e){},o.prototype.createSession=function(e,t){},o.prototype.removeSession=function(e){},o.prototype.connected=function(){},o.prototype.connect=function(){},o.prototype.disconnect=function(){},o.prototype.switchTimezone=function(e,t){},o.prototype.resolveSymbol=function(e,t,s,n){},o.prototype.createSeries=function(e,t,s,n,o,r,i,a){},o.prototype.removeSeries=function(e,t,s){},o.prototype.modifySeries=function(e,t,s,n,o,r,i){},o.prototype.requestMoreData=function(e,t,s,n){},o.prototype.requestMetadata=function(e){},o.prototype.canCreateStudy=function(e,t){},o.prototype.createStudy=function(e,t,s,n,o,r,i){},o.prototype.getStudyCounter=function(){},o.prototype.rebindStudy=function(e,t,s,n,o,r,i,a){},o.prototype.removeStudy=function(e,t,s){},o.prototype.modifyStudy=function(e,t,s,n,o){},o.prototype.createPointset=function(e,t,s,n,o,r,i){},o.prototype.modifyPointset=function(e,t,s,n,o){},o.prototype.removePointset=function(e,t,s){},o.prototype.requestMoreTickmarks=function(e,t,s,n){},o.prototype.requestFirstBarTime=function(e,t,s,n){},o.prototype._invokeHandler=function(e,t){},o.prototype._sendRequest=function(e,t){},o.prototype._onMessage=function(e){},o.prototype._dispatchNotification=function(e){}, o.prototype._invokeNotificationHandler=function(e,t,s){},o.prototype._notifySessions=function(e){},o.prototype.unpack=function(e){},o.prototype.searchSymbols=function(e,t,s,n,o,r,i,a,d,c){},o.prototype.getMarks=function(e,t,s,n,o){},o.prototype.getTimescaleMarks=function(e,t,s,n,o){},n(o,"ChartApiInterface"),e.exports.ChartApiInterface=o},730128:(e,t,s)=>{"use strict";e=s.nmd(e);var n=!1,o=!1,r=!1,i=s(84461).ChartApiInterface;const{HandlerInfo:a}=s(61378);var d=s(799402).AuthToken,c=s(66974),u=s(175203).telemetry,h=s(244842),l=s(846540),_=s(389137).requireFullInterfaceImplementation,p=s(125226).isFeatureEnabled,m=s(314802).isOnMobileAppPage,f=s(230648).ResponseMethods,y=s(201089),g=s(638456).onWidget,v=y.getLogger("ChartApi.Core",{color:"#706"}),b=y.getLogger("ChartApi.ChartSession",{color:"#706"}),w=y.getLogger("ChartApi.ChartSession",{highRate:!0,maxCount:100,color:"#706"}),C=y.getLogger("ChartApi.ChartSession",{maxCount:0,color:"#706"}),S=y.getLogger("ChartApi.ChartSession",{maxCount:50,color:"#706"}),k=y.getLogger("ChartApi.QuoteSession",{maxCount:50,color:"#660"}),q=y.getLogger("ChartApi.QuoteSession",{highRate:!0,maxCount:10,color:"#660"}),R=s(128563),T=s(928691).errorToString,M=s(120780).fetch,D=s(389743),N=s(315347).TIMEFRAMETYPE,{getLogoUrlResolver:P,LogoSize:A}=s(849204);const{TVChartApiBase:I}=s(448203);var H=p("broker_id_session"),L=!m("any"),E=p("tick_intervals")&&!g(),B=null;function x(){if(null===B){const e=document.querySelector('link[rel~="conversions-config"]'),t=new URL(e.href);B=M(t.toString(),{method:"GET"}).then((function(e){if(!e.ok)throw new Error("Response status is not success");return e.json()})).then((e=>{const t=P();return e.currencies.forEach((e=>{void 0!==e.logoid&&(e.logoUrl=t.getSymbolLogoUrl(e.logoid,A.Medium))})),e}))}return B}function O(e){if(null===e)return"";if(e.type===N.PeriodBack){var t=e.value;return"YTD"!==t&&"D"===t.slice(-1)&&(t=t.slice(0,-1)),t}return"r,"+e.from+":"+e.to}function Q(e){return(e/1e3).toFixed(2)+" seconds."}class U extends I{constructor(e){super(e,v),this._notificationHandlers={},this._sessions={},this._pendingMessagesQueue=[]}defaultResolutions(){var e=["1","3","5","15","30","45","60","120","180","240","1D","1W","1M","3M","6M","12M","1R","10R","100R","1000R"];if(!h.enabled("widget")){var t=["1S","5S","10S","15S","30S"];return E&&(t=["1T","10T","100T","1000T"].concat(t)),t.concat(e)}return e}availableCurrencies(){return x().then((e=>e.currencies))}availableUnits(){return x().then((e=>{const t={};for(const s of e.units)t[s.type]||(t[s.type]=[]),t[s.type].push(s);return t}))}supportedSymbolsTypes(){return"bovespa"===TradingView.widgetCustomer?R.filter((function(e){return-1!==["","stock","futures","index"].indexOf(e.value)})):"cme"===TradingView.widgetCustomer?R.filter((function(e){return e.value!==l.types.QUANDL})):R}symbolsGrouping(){return{futures:/^(.+?)([12]!|\w\d{4})?$/}}enableLowQualityMode(){this._lowQualityEnabled=!0,this._sendLowQualityModeIfEnabled()}_sendLowQualityModeIfEnabled(){ this._lowQualityEnabled&&this.connected()&&this._sendRequest("set_data_quality",[])}quoteCreateSession(e){return this._sendRequest("quote_create_session",[e])}quoteDeleteSession(e){return this._sendRequest("quote_delete_session",[e])}quoteSetFields(e,t){return this._sendRequest("quote_set_fields",[e,t])}quoteAddSymbols(e,t){return this._sendRequest("quote_add_symbols",[e,t])}quoteRemoveSymbols(e,t){return this._sendRequest("quote_remove_symbols",[e,t])}quoteFastSymbols(e,t){return this._sendRequest("quote_fast_symbols",[e,t])}quoteHibernateAll(e){return this._sendRequest("quote_hibernate_all",[e])}depthCreateSession(e,t,s){return this._sendRequest("depth_create_session",[e,t,s])}depthDeleteSession(e){return this._sendRequest("depth_delete_session",[e])}depthSetSymbol(e,t){return this._sendRequest("depth_set_symbol",[e,t])}depthClearSymbol(e){return this._sendRequest("depth_clear_symbol",[e])}depthSetScale(e,t){return this._sendRequest("depth_set_scale",[e,t])}chartCreateSession(e,t){return this._sendRequest("chart_create_session",[e,t])}chartDeleteSession(e){return this._sendRequest("chart_delete_session",[e])}createSession(e,t){this._sessions[e]=t,this._notificationHandlers[e]={},this.connected()&&this._isAuthTokenLoaded&&t.onMessage({method:"connected",params:[]})}removeSession(e){delete this._sessions[e],delete this._notificationHandlers[e]}connected(){return!!this._isConnected}setBroker(e){return e===this._brokerId||(this._brokerId=e,this._sendBrokerIdToSession(this._brokerId))}disconnectReason(e){ return 1e3===e?"Normal closure, meaning that the purpose for which the connection was established has been fulfilled.":1001===e?'An endpoint is "going away", such as a server going down or a browser having navigated away from a page.':1002===e?"An endpoint is terminating the connection due to a protocol error":1003===e?"An endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).":1004===e?"Reserved. The specific meaning might be defined in the future.":1005===e?"No status code was actually present.":1006===e?"The connection was closed abnormally, e.g., without sending or receiving a Close control frame":1007===e?"An endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [http://tools.ietf.org/html/rfc3629] data within a text message).":1008===e?'An endpoint is terminating the connection because it has received a message that "violates its policy". This reason is given either if there is no other sutible reason, or if there is a need to hide specific details about the policy.':1009===e?"An endpoint is terminating the connection because it has received a message that is too big for it to process.":1010===e?"An endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake.
Specifically, the extensions that are needed are: "+event.reason:1011===e?"A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.":1015===e?"The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).":"Unknown reason"}_sendBrokerIdToSession(e){return!H||this._sendRequest("set_broker",[e])}_getAuthTokenDfd(e){if(this._loadNewBars)return Promise.resolve("load_new_token");if(h.enabled("widget")||-1!==window.location.search.indexOf("widget_token")||-1!==window.location.hash.indexOf("widget_token")){var t=window.TradingView&&window.TradingView.widgetCustomer||"";return Promise.resolve(D[t]||"widget_user_token")}if(!window.is_authenticated)return Promise.resolve("unauthorized_user_token");var s=this;if(!s._authTokenManager){var n=new d;s._authTokenManager=n,s._authTokenManager.invalidated.subscribe(null,(function(e){s._authTokenManager.get().then((function(e){e&&s.connected()&&s._sendRequest("set_auth_token",[e])}))}))}return s._authTokenManager.get(e)}_onConnect(){if(!this.connected()){this._trafficStats.sinceConnect=0,this._isAuthTokenLoaded=!1;var e=this;if(this._connectOnlyOptions=this._connectOnlyOptions||{},this._authTokenDfd=this._getAuthTokenDfd(this._connectOnlyOptions.tokenGrabSession),this._connectOnlyOptions={},this.sessionid=this._wsBackendConnection.getSessionId(),this.sessionid&&!this._isConnected){ this._pendingMessagesQueue=[],this._sendingQueuedRequestsCount=0,this._isConnected=!0,this._banInfo.setValue(null),this._connectionsLimitReached.setValue(!1);var t=JSON.parse(this.sessionid);this._sendLowQualityModeIfEnabled(),this._metadataServerHash=t.studies_metadata_hash||null;var s=this._wsBackendConnection.getConnectionEstablished();try{this._serverTimeBasePoint=Math.round(t.timestampMs-s)}catch(e){this._serverTimeBasePoint=Date.now()-performance.now()}if(v.logInfo("Time shift with server: "+Q(this.serverTime()-Date.now())),this._authTokenDfd){this._sendingQueuedRequestsCount+=1,v.logInfo("Wait for auth token before send messages");var n=this._authTokenDfd;n.then((function(t){if(null!==e._authTokenDfd&&e._authTokenDfd===n){if(v.logNormal("Auth token request is finished, token: "+Boolean(t)),e._authTokenDfd=null,t){const s=[{method:"set_auth_token",args:[t]}];if(L){const e=window.initData&&window.initData.currentLocaleInfo;e&&s.push({method:"set_locale",args:[e.iso,e.flag.toUpperCase()]})}e._pendingMessagesQueue.unshift(...s)}e._onSendingQueueRequestFinished(),e._isAuthTokenLoaded=!0,e._notifySessions({method:"connected",params:[]})}else v.logNormal("Comes auth token after requesting new token or after socket disconnected")})).catch((function(e){v.logNormal(T(e))}))}else v.logWarn("Deferred auth token object is not valid"),this._isAuthTokenLoaded=!0;""!==this._brokerId&&this._sendBrokerIdToSession(this._brokerId);var r=this._wsBackendConnection.getConnectionStart();TradingView.WEB_SOCKET_WAS_CONNECTED=!0,u.setSessionInfo(this.sessionid),u.sendChartReport("websocket_connected"),u.sendChartReport("websocket_connection_time_frame",{value:s-r}),u.sendChartReport("reconnect_count_frame",{value:this._wsBackendConnection.getReconnectCount()}),u.sendChartReport("redirect_count_frame",{value:this._wsBackendConnection.getRedirectCount()}),o||(o=!0,u.sendChartReport("before_websocket_connection_time_frame",{value:r})),this._wsBackendConnection.resetCounters(),clearTimeout(this._telemetryDisconnectTimeout)}}}switchTimezone(e,t){return this._sendRequest("switch_timezone",[e,t])}resolveSymbol(e,t,s,n){return u.timeCounters.series["resolve_symbol_"+e]=window.performance.now(),this._notificationHandlers[e][t]=new a(n,t),this._sendRequest("resolve_symbol",[e,t,s])}createSeries(e,t,s,n,o,r,i,d){this._notificationHandlers[e][t]=new a(d,t),u.timeCounters.series.marks.push("create_series_"+e);const c=O(i);return this._sendRequest("create_series",[e,t,s,n,o,r,c])}removeSeries(e,t){return delete this._notificationHandlers[e][t],this._sendRequest("remove_series",[e,t])}modifySeries(e,t,s,n,o,r,i,d){this._notificationHandlers[e][t]=new a(d,t);const c=O(i);return this._sendRequest("modify_series",[e,t,s,n,o,c])}requestMoreData(e,t,s,n){if("number"!=typeof s)throw new Error("unsupported request to load more data, bars="+s);return this._notificationHandlers[e][t]=new a(n,t),this._sendRequest("request_more_data",[e,t,s])}authTokenManager(){return this._authTokenManager}removeStudy(e,t,s){const n=e+t;delete this._notificationHandlers[e][t], this._modifyStudyMap.has(n)&&this._modifyStudyMap.get(n).flush();var o=this._sendRequest("remove_study",[e,t]);return!1!==o&&(this._modifyStudyMap.delete(n),this._studyCounter--,s&&this._childStudyCounter--,o)}createPointset(e,t,s,n,o,r,i){return this._notificationHandlers[e][t]=new a(i,t),this._sendRequest("create_pointset",[e,t,s,n,o,r])}modifyPointset(e,t,s,n,o){return this._notificationHandlers[e][t]=new a(o,t),this._sendRequest("modify_pointset",[e,t,s,n])}removePointset(e,t,s){return this._notificationHandlers[e][t]=new a(s,t),this._sendRequest("remove_pointset",[e,t])}requestMoreTickmarks(e,t,s,n){return this._notificationHandlers[e][t]=new a(n,t),this._sendRequest("request_more_tickmarks",[e,t,s])}requestFirstBarTime(e,t,s,n){return this._notificationHandlers[e][t]=new a(n,t),this._sendRequest("get_first_bar_time",[e,t,s])}redirectCount(){return this._wsBackendConnection.getRedirectCount()}disconnectCount(){return this._disconnectCount||0}_invokeHandler(e,t){e&&e(t)}_flushPendingMessages(){v.logInfo("Flush pending messages. Count="+this._pendingMessagesQueue.length),this._pendingMessagesQueue.forEach((function(e){this._sendRequest(e.method,e.args)}),this),this._pendingMessagesQueue=[]}_sendRequest(e,t){if(0!==this._sendingQueuedRequestsCount)return this._pendingMessagesQueue.push({method:e,args:t}),!0;var s=this._dataHandleModule[e].apply(this._dataHandleModule,t),n={m:e,p:s},o=JSON.stringify(n);if(s.length>0){var r=s[0];r.startsWith("qs_")?k.logNormal("send: "+o):r.startsWith("cs_")&&b.logNormal("send: "+o)}else v.logNormal("send: "+o);var i=this._dataHandleModule.prepareEncodeMessage(e,s);return this._wsBackendConnection.send(i)}_onSendingQueueRequestFinished(){this._sendingQueuedRequestsCount-=1,v.logInfo("Sending queue request finished. Remaining pending requests="+this._sendingQueuedRequestsCount),this._sendingQueuedRequestsCount<0&&v.logError("Invalid queue state="+this._sendingQueuedRequestsCount),0===this._sendingQueuedRequestsCount&&this._flushPendingMessages()}_convertTimescaleResponse(e){return this._dataHandleModule.convertTimescaleResponse(e)}_appendDuration(e,t){return e?t+", duration: "+Q(this.serverTime()-1e3*e):t}_dispatchNotification(e,t){if("request_data_problems"===e.method&&this._onDataProblemsPromiseCb)this._onDataProblemsPromiseCb(e.params);else if("studies_metadata"!==e.method||null===this._metadataDeferredPromise){var s=e.params.shift();if(this._notificationHandlers[s]){var o=e.params[0];if("symbol_resolved"===e.method){var i=e.params[1].full_name;u.sendChartReport("symbol_resolved",{count:1,additional:{symbol:i}});var a=u.timeCounters.series["resolve_symbol_"+s];"number"==typeof a&&u.sendChartReport("symbol_resolve_time_frame",{value:window.performance.now()-a,additional:{symbol:i}})}if(["series_error","series_completed"].includes(e.method)&&u.timeCounters.series.marks.length>0){var d="create_series_"+s,c=u.timeCounters.series.marks.indexOf(d);c>=0&&u.timeCounters.series.marks.splice(c,1)}r||"series_error"!==e.method||(r=!0);var h=this._wsBackendConnection.getConnectionEstablished() ;if(null!==h&&"series_completed"===e.method&&(r||(r=!0,u.sendChartReport("first_series_full_time_frame",{value:window.performance.now()-h}),u.timeCounters.series.marks=[]),n||(n=!0,u.sendChartReport("page_full_load_time_frame",{value:window.performance.now()}))),s.startsWith("cs_")){var l="recv: "+t;"data_update"===e.method?(l=y.isHighRateEnabled()?l:l.slice(0,500),w.logNormal(this._appendDuration(e.time,l))):"study_loading"===e.method?C.logNormal(this._appendDuration(e.time,l)):"tickmark_update"===e.method?S.logNormal(this._appendDuration(e.time,l)):b.logNormal(this._appendDuration(e.time,l))}if(s.startsWith("qs_"))("quote_symbol_data"===e.method?q.logNormal:k.logNormal)("recv: "+t);switch(e.method){case"timescale_update":var _=this._dataHandleModule.getTimescaleObjects(e),p=this._dataHandleModule.getTimescaleChangeset(e);(m=this._convertTimescaleResponse(p)).clear=0===m.changes.length&&0===m.index_diff.length&&0===m.marks.length,this._sessions[s].onMessage({method:"timescale_update",params:m}),this._dataHandleModule.prepareDataUpdateObjects(s,_,function(e,t,s){this._invokeNotificationHandler(e,t,s)}.bind(this));break;case"tickmark_update":var m;(m=this._convertTimescaleResponse(e.params[0])).changes=[],this._sessions[s].onMessage({method:"timescale_update",params:m});break;case"data_update":_=this._dataHandleModule.getDataUpdateObjects(e);this._dataHandleModule.prepareDataUpdateObjects(s,_,function(e,t,s){this._invokeNotificationHandler(e,t,s)}.bind(this));break;case"index_update":for(var g in e.params[0]){var R={method:"index_update",params:e.params[0][g]};this._invokeNotificationHandler(s,g,R)}break;case"critical_error":v.logInfo(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),u.sendChartReport("critical_error"),this._sessions[s].onMessage({method:"critical_error",params:e.params});break;case"timescale_completed":case"quote_symbol_data":case"quote_list_fields":case"quote_completed":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[s].onMessage({method:e.method,params:e.params});break;case"clear_data":for(var T in e.params[0])this._invokeNotificationHandler(s,T,{method:"clear_data",params:e.params[0][T]});break;case f.point:case f.resolutions:case f.endOfData:case f.instanceId:case f.error:case f.ok:this._sessions[s].onMessage(e);break;case"series_timeframe":e.params[4]=function(e){if(null==e)return null;var t=/r,(\d+):(\d+)/.exec(e);return null!==t?{from:Number(t[1]),to:Number(t[2]),type:N.TimeRange}:{value:e,type:N.PeriodBack}}(e.params[4]),this._invokeNotificationHandler(s,o,e);break;case"symbol_resolved":!function(e){if(void 0===e.corrections){var t=e.subsessions.find((function(t){return t.id===e.subsession_id}));void 0!==t&&(e.corrections=t["session-correction"])}}(e.params[1]),this._invokeNotificationHandler(s,o,e);break;default:this._invokeNotificationHandler(s,o,e)}}}else this._processedMetadata(e)}_isStrategy(e,t){var s=this._notificationHandlers[e][t];return s&&s.handler&&s.handler.isTVScriptStrategy} _invokeNotificationHandler(e,t,s){if(void 0!==t){var n=this._notificationHandlers[e][t];void 0!==n&&this._invokeHandler(n.handler,s)}}_notifySessions(e){for(var t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;var s=this._sessions[t];"function"==typeof s.onMessage&&s.onMessage(e)}}searchSymbols(e,t,s,n,o,r,i,a,d,h){var _=this;this._symbolSearchRequest&&this._symbolSearchRequest.abort();var p=location.protocol+"//"+window.SS_HOST;c.isProd()?p+="/symbol_search/":p+="/local_search/",window.SS_URL&&(p=window.SS_URL);var m={text:e,exchange:t,type:s,hl:o,lang:n};window.SS_DOMAIN_PARAMETER&&(m.domain=window.SS_DOMAIN_PARAMETER),r&&(m.strict=1),s===l.types.QUANDL&&(p="https://quandlapi.tradingview.com/api/v3/datasets.json",m={query:e,database_code:t}),i&&(m.broker=i,a&&(m.tradable=!0),d&&(m.unhide=d));var f=Object.keys(m).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(m[e])})).join("&"),y=new XMLHttpRequest;y.open("GET",p+"?"+f);var g=window.performance.now();function v(){u.sendChartReport("symbol_search_time_frame",{value:window.performance.now()-g})}function b(){v(),u.sendChartReport("symbol_search_http_error"),_._symbolSearchRequest=null}y.addEventListener("load",(function(){var e=JSON.parse(y.responseText);h&&h(e),v(),u.sendChartReport("symbol_search_http_status",{value:y.status}),_._symbolSearchRequest=null})),y.addEventListener("error",b),y.addEventListener("timeout",b),this._symbolSearchRequest=y,y.send()}getMarks(e,t,s,n,o){throw Error("This method is not implemented")}getTimescaleMarks(e,t,s,n,o){throw Error("This method is not implemented")}getPingInfo(){return this._wsBackendConnection.getPingInfo()}requestDataProblems(){return this._requestDataProblemsPromise||(this._requestDataProblemsPromise=this.connectDfd.then((()=>new Promise(((e,t)=>{this._onDataProblemsPromiseErrback=t,this._sendRequest("request_data_problems",[])?this._onDataProblemsPromiseCb=e:t()})))).finally((()=>{this._requestDataProblemsPromise=null}))),this._requestDataProblemsPromise}getStudyCounter(){return this._studyCounter}}_(U,"TVChartApi",i,"ChartApiInterface"),window.ChartApiInstance=new U(window.WSBackendConnection),e&&e.exports&&(e.exports=U)},61378:(e,t,s)=>{"use strict";s.r(t),s.d(t,{HandlerInfo:()=>n});class n{constructor(e,t){this.handler=e,this.customId=t}}},230648:(e,t,s)=>{"use strict";var n,o;s.d(t,{ResponseMethods:()=>n}),function(e){e.error="replay_error",e.point="replay_point",e.ok="replay_ok",e.resolutions="replay_resolutions",e.endOfData="replay_data_end",e.instanceId="replay_instance_id"}(n||(n={})),function(e){e.tooSmallDelay="too_small_delay",e.alreadyInAutoplay="already_in_autoplay",e.nothingToStop="nothing_to_stop",e.pointTooDeep="point_too_deep",e.alreadyInSession="already_in_session",e.thereIsNoSuchSeries="no_series",e.notAllowedInAutoplay="not_allow_in_autoplay",e.invalidResolution="invalid_resolution"}(o||(o={}))},928691:(e,t,s)=>{"use strict";function n(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t} return"string"==typeof e?e.toString():JSON.stringify(e)}s.d(t,{errorToString:()=>n})}}]);