commit 2019-10-30 08:47:29.378809

Indicators are slided when zooming chart #4456
This commit is contained in:
Jenkins
2019-10-30 11:47:31 +03:00
parent 87df4df525
commit e2e37b550a
33 changed files with 49 additions and 49 deletions

File diff suppressed because one or more lines are too long

View File

@@ -541,26 +541,26 @@ c._studyEngine.purgeRangeExtensionData(e),c._studyEngine.recreateSources(t.name,
time:i[t][1],index:i[t][2]};return e},JSServer.ChartApi.prototype._dispathNotification=function(e){var t,i,n,o,r,s,a,l,c,h,u=e.params.shift();if(this._notificationHandlers[u])switch(e.method){case"timescale_update":t=e.params[0],i=e.params[1],n=this._convertTimescaleResponse(i),n.clear=0===i.changes.length&&0===i.marks.length,this._sessions[u].onMessage({method:"timescale_update",params:n});for(o in t)r={},r.customId=o,r.plots=t[o].series,t[o].ns&&(r.nonseries=t[o].ns),r.turnaround=t[o].turnaround,s={method:"data_update",params:r},this._invokeNotificationHandler(u,o,s);break;case"tickmark_update":n=this._convertTimescaleResponse(e.params[0]),n.changes=[],this._sessions[u].onMessage({method:"timescale_update",params:n});break;case"data_update":for(o in e.params[0]){a=e.params[0][o],r={},r.customId=o,r.plots=a.series?a.series:a.plots,r.turnaround=a.turnaround,"s"in a&&"ns"in a&&(r.plots=a.s,r.nonseries=a.ns);for(l=0;l<r.plots.length;l++)for(c in r.plots[l].value)1e100===r.plots[l].value[c]&&(r.plots[l].value[c]=void 0);s={method:"data_update",params:r},this._invokeNotificationHandler(u,o,s)}break;case"index_update":for(o in e.params[0])s={method:"index_update",params:e.params[0][o]},this._invokeNotificationHandler(u,o,s);break;case"critical_error":d.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._sessions[u].onMessage({method:"critical_error",params:e.params});break;case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[u].onMessage({method:e.method,params:e.params});break;default:h=e.params[0],this._invokeNotificationHandler(u,h,e)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var n=this._notificationHandlers[e][t];void 0!==n&&n&&this._invokeHandler(n.handler,i),"series_deleted"!==i.method&&"study_deleted"!==i.method||delete this._notificationHandlers[e][t]}},JSServer.ChartApi.prototype.searchSymbols=function(e,t,i,n,o,r,s,a,l,c){0===e.length&&0===t.length&&0===i.length&&c([]),this._studyEngine.searchSymbols(e,t,i,c)},JSServer.ChartApi.prototype._notifySessions=function(e){var t,i;for(t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;i=this._sessions[t],"function"==typeof i.onMessage&&i.onMessage(e)}},JSServer.ChartApi.prototype.unpack=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},JSServer.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},JSServer.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},JSServer.ChartApi.prototype.quoteAddSymbols=function(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter(function(e){return!!e})),this._studyEngine.quoteAddSymbols(e,t)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(e,t){ time:i[t][1],index:i[t][2]};return e},JSServer.ChartApi.prototype._dispathNotification=function(e){var t,i,n,o,r,s,a,l,c,h,u=e.params.shift();if(this._notificationHandlers[u])switch(e.method){case"timescale_update":t=e.params[0],i=e.params[1],n=this._convertTimescaleResponse(i),n.clear=0===i.changes.length&&0===i.marks.length,this._sessions[u].onMessage({method:"timescale_update",params:n});for(o in t)r={},r.customId=o,r.plots=t[o].series,t[o].ns&&(r.nonseries=t[o].ns),r.turnaround=t[o].turnaround,s={method:"data_update",params:r},this._invokeNotificationHandler(u,o,s);break;case"tickmark_update":n=this._convertTimescaleResponse(e.params[0]),n.changes=[],this._sessions[u].onMessage({method:"timescale_update",params:n});break;case"data_update":for(o in e.params[0]){a=e.params[0][o],r={},r.customId=o,r.plots=a.series?a.series:a.plots,r.turnaround=a.turnaround,"s"in a&&"ns"in a&&(r.plots=a.s,r.nonseries=a.ns);for(l=0;l<r.plots.length;l++)for(c in r.plots[l].value)1e100===r.plots[l].value[c]&&(r.plots[l].value[c]=void 0);s={method:"data_update",params:r},this._invokeNotificationHandler(u,o,s)}break;case"index_update":for(o in e.params[0])s={method:"index_update",params:e.params[0][o]},this._invokeNotificationHandler(u,o,s);break;case"critical_error":d.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._sessions[u].onMessage({method:"critical_error",params:e.params});break;case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[u].onMessage({method:e.method,params:e.params});break;default:h=e.params[0],this._invokeNotificationHandler(u,h,e)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var n=this._notificationHandlers[e][t];void 0!==n&&n&&this._invokeHandler(n.handler,i),"series_deleted"!==i.method&&"study_deleted"!==i.method||delete this._notificationHandlers[e][t]}},JSServer.ChartApi.prototype.searchSymbols=function(e,t,i,n,o,r,s,a,l,c){0===e.length&&0===t.length&&0===i.length&&c([]),this._studyEngine.searchSymbols(e,t,i,c)},JSServer.ChartApi.prototype._notifySessions=function(e){var t,i;for(t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;i=this._sessions[t],"function"==typeof i.onMessage&&i.onMessage(e)}},JSServer.ChartApi.prototype.unpack=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},JSServer.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},JSServer.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},JSServer.ChartApi.prototype.quoteAddSymbols=function(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter(function(e){return!!e})),this._studyEngine.quoteAddSymbols(e,t)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(e,t){
return this._studyEngine.quoteRemoveSymbols(e,t)},JSServer.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},JSServer.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},JSServer.ChartApi.prototype.depthCreateSession=function(e){return this._studyEngine.depthCreateSession(e)},JSServer.ChartApi.prototype.depthDeleteSession=function(e){return this._studyEngine.depthDeleteSession(e)},JSServer.ChartApi.prototype.depthSetSymbol=function(e,t){return this._studyEngine.depthSetSymbol(e,t)},JSServer.ChartApi.prototype.depthClearSymbol=function(e){},JSServer.ChartApi.prototype.depthSetScale=function(e,t){},JSServer.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return new this.StudiesAccessController(this._studyEngine,e&&JSON.parse(e)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){var t,i,n=null;for(t=0;t<this._studiesAccess.tools.length;++t)if(i=this._studiesAccess.tools[t],i.name===e||i===e){n=i;break}return n},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter(function(e){var t=this._findTool(e.description);return"black"===this._studiesAccess.type?!t||t.grayed:!!t},this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.alignTimePoint=function(e,t,i){return this._studyEngine.alignTimePoint(e,t,i)},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},u(JSServer.ChartApi,"JSServer.ChartApi",c,"ChartApiInterface"),e.exports=JSServer.ChartApi},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyError",function(){return o}),n=i(1),o=function(e){function t(t){var i=e.call(this,t)||this;return i.studyError=!0,i}return n.c(t,e),t}(Error)},function(e,t,i){"use strict";(function(t,n){function o(e){var t=e.findIndex(function(e){return e.index!==_});return 0===t?e:e.slice(t)}function r(e,i){var n=t.get_timezone(i.timezone),o=new b.Session;return o.init(n,i.session),y.Symbol.newBarBuilder(e,o,o)}function s(e){function t(e){console.warn("SymbolInfo validation: "+e)}var i,o;if(e.has_empty_bars&&n.enabled("disable_resolution_rebuild")&&t('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)'),(void 0===e.minmov||e.minmov<=0)&&t("minmov must be positive"),(void 0===e.pricescale||e.pricescale<=0)&&t("pricescale must be positive"),void 0!==e.name&&0!==e.name.length||t("name must be non-empty string"),void 0!==e.session&&0!==e.session.length||t("session must be non-empty string"), return this._studyEngine.quoteRemoveSymbols(e,t)},JSServer.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},JSServer.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},JSServer.ChartApi.prototype.depthCreateSession=function(e){return this._studyEngine.depthCreateSession(e)},JSServer.ChartApi.prototype.depthDeleteSession=function(e){return this._studyEngine.depthDeleteSession(e)},JSServer.ChartApi.prototype.depthSetSymbol=function(e,t){return this._studyEngine.depthSetSymbol(e,t)},JSServer.ChartApi.prototype.depthClearSymbol=function(e){},JSServer.ChartApi.prototype.depthSetScale=function(e,t){},JSServer.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return new this.StudiesAccessController(this._studyEngine,e&&JSON.parse(e)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){var t,i,n=null;for(t=0;t<this._studiesAccess.tools.length;++t)if(i=this._studiesAccess.tools[t],i.name===e||i===e){n=i;break}return n},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter(function(e){var t=this._findTool(e.description);return"black"===this._studiesAccess.type?!t||t.grayed:!!t},this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.alignTimePoint=function(e,t,i){return this._studyEngine.alignTimePoint(e,t,i)},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},u(JSServer.ChartApi,"JSServer.ChartApi",c,"ChartApiInterface"),e.exports=JSServer.ChartApi},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyError",function(){return o}),n=i(1),o=function(e){function t(t){var i=e.call(this,t)||this;return i.studyError=!0,i}return n.c(t,e),t}(Error)},function(e,t,i){"use strict";(function(t,n){function o(e){var t=e.findIndex(function(e){return e.index!==_});return 0===t?e:e.slice(t)}function r(e,i){var n=t.get_timezone(i.timezone),o=new b.Session;return o.init(n,i.session),y.Symbol.newBarBuilder(e,o,o)}function s(e){function t(e){console.warn("SymbolInfo validation: "+e)}var i,o;if(e.has_empty_bars&&n.enabled("disable_resolution_rebuild")&&t('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)'),(void 0===e.minmov||e.minmov<=0)&&t("minmov must be positive"),(void 0===e.pricescale||e.pricescale<=0)&&t("pricescale must be positive"),void 0!==e.name&&0!==e.name.length||t("name must be non-empty string"),void 0!==e.session&&0!==e.session.length||t("session must be non-empty string"),
void 0===e.timezone||0===e.timezone.length?t("timezone must be non-empty string"):"exchange"!==e.timezone&&p(e.timezone)||"UTC"!==e.timezone&&t('unsupported timezone "{0}"'.format(e.timezone)),void 0!==e.intraday_multipliers)if(i=e.intraday_multipliers,Array.isArray(i))for(o=0;o<i.length;++o)"string"!=typeof i[o]&&t('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(o+1,i[o],typeof i[o]));else t("intraday_multipliers must be array");(e.supported_resolutions||[]).filter(function(e){return!w.isValid(e)}).forEach(function(e){t("supported_resolutions field contains invalid value: "+e)})}function a(e){var t,i;if(e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.full_name||(e.full_name=e.symbol||(e.exchange?e.exchange+":"+e.name:e.name)),e.pro_name||(e.pro_name=e.full_name),e.data_status||(e.data_status="streaming"),e.ticker||(e.ticker=e.symbol||e.name),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.supported_resolutions)for(t=0;t<e.supported_resolutions.length;t++)i=w.parse(e.supported_resolutions[t]),i.isValid()&&(e.supported_resolutions[t]=i.value())}function l(e,t){null!=e.graphicsCmds&&null!=e.graphicsCmds.create&&null!=e.graphicsCmds.create.vertlines&&e.graphicsCmds.create.vertlines.forEach(function(e){e.data.forEach(t)})}function c(e,t){var i,n,o=e.length,r=t.length,s=0;for(i=0;i<o;++i){for(n=e[i];s<r&&t[s].value[0]<n;)++s;s>=r?e[i]=t[r-1].index:e[i]=t[s].index}}function h(e,t){var i,n;null!==t&&0!==t.length&&(i={},T(e,function(e){x(e)&&Object.keys(e).forEach(function(t){t.endsWith("__t")&&(i[e[t]]=!0)})},{visitInstances:!0}),n=Object.keys(i).map(Number).sort(function(e,t){return e-t}),n.forEach(function(e,t){i[e]=t}),Object.assign(e,T(e,function(e){return x(e)&&Object.keys(e).forEach(function(t){t.endsWith("__t")&&(e[t.slice(0,-3)]=i[e[t]])}),e},{visitInstances:!0})),c(n,t),e.indexes=n)}function u(e,t){var i,n;null!==t&&0!==t.length&&(i={},l(e.data,function(e){i[e.time]=!0}),n=Object.keys(i).map(Number).sort(function(e,t){return e-t}),n.forEach(function(e,t){i[e]=t}),l(e.data,function(e){e.index=i[e.time]}),c(n,t),e.indexes=n)}var d,p,_,f,m=i(671),y=i(25),g=i(672),v=i(674),S=i(675),b=i(37),w=i(15).Interval,P=i(31),T=i(676).visitObject,x=i(12).isObject;i(183),i(297),d=i(677).DatafeedRequestsCachedProcessor,p=i(200).timezoneIsAvailable,_=-5e6,f=function(e){function t(e,t,i){return function(n){var o,a;n&&n.count()&&(o=r(t,e),a=1e3*s.getCurrentUTCTime(),o.moveTo(a),o.indexOfBar(a)>=0&&n.setLastBarClosed(!1)),i(n)}}function i(e,i,n,o,r){return s._cachedDatafeed.subscribe(e,i,n,t(e,i,o),r)}function n(e){return s._cachedDatafeed.unsubscribe(e)}function o(e,t,i){s.resolveSymbol(e,t,i)}var s=this;this._studiesCache={},this._sessionsLastDataCache={},this._metainfoCache=[],this._barsCoefficientsCache={},this._extrapolationManager=v,this._externalDatafeed=e,this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._callbacks={}, void 0===e.timezone||0===e.timezone.length?t("timezone must be non-empty string"):"exchange"!==e.timezone&&p(e.timezone)||"UTC"!==e.timezone&&t('unsupported timezone "{0}"'.format(e.timezone)),void 0!==e.intraday_multipliers)if(i=e.intraday_multipliers,Array.isArray(i))for(o=0;o<i.length;++o)"string"!=typeof i[o]&&t('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(o+1,i[o],typeof i[o]));else t("intraday_multipliers must be array");(e.supported_resolutions||[]).filter(function(e){return!w.isValid(e)}).forEach(function(e){t("supported_resolutions field contains invalid value: "+e)})}function a(e){var t,i;if(e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.full_name||(e.full_name=e.symbol||(e.exchange?e.exchange+":"+e.name:e.name)),e.pro_name||(e.pro_name=e.full_name),e.data_status||(e.data_status="streaming"),e.ticker||(e.ticker=e.symbol||e.name),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.supported_resolutions)for(t=0;t<e.supported_resolutions.length;t++)i=w.parse(e.supported_resolutions[t]),i.isValid()&&(e.supported_resolutions[t]=i.value())}function l(e,t){null!=e.graphicsCmds&&null!=e.graphicsCmds.create&&null!=e.graphicsCmds.create.vertlines&&e.graphicsCmds.create.vertlines.forEach(function(e){e.data.forEach(t)})}function c(e,t){var i,n,o=e.length,r=t.length,s=0;for(i=0;i<o;++i){for(n=e[i];s<r&&t[s].value[0]<n;)++s;s>=r?e[i]=t[r-1].index:e[i]=t[s].index}}function h(e,t){var i,n;null!==t&&0!==t.length&&(i={},T(e,function(e){x(e)&&Object.keys(e).forEach(function(t){t.endsWith("__t")&&(i[e[t]]=!0)})},{visitInstances:!0}),n=Object.keys(i).map(Number).sort(function(e,t){return e-t}),n.forEach(function(e,t){i[e]=t}),Object.assign(e,T(e,function(e){return x(e)&&Object.keys(e).forEach(function(t){t.endsWith("__t")&&(e[t.slice(0,-3)]=i[e[t]])}),e},{visitInstances:!0})),c(n,t),e.indexes=n)}function u(e,t){var i,n;null!==t&&0!==t.length&&(i={},l(e.data,function(e){i[e.time]=!0}),n=Object.keys(i).map(Number).sort(function(e,t){return e-t}),n.forEach(function(e,t){i[e]=t}),l(e.data,function(e){e.index=i[e.time]}),c(n,t),e.indexes=n)}var d,p,_,f,m=i(671),y=i(25),g=i(672),v=i(674),S=i(675),b=i(37),w=i(15).Interval,P=i(31),T=i(676).visitObject,x=i(12).isObject;i(183),i(297),d=i(677).DatafeedRequestsCachedProcessor,p=i(200).timezoneIsAvailable,_=-5e6,f=function(e){function t(e,t,i){return function(n){var o,a;n&&n.count()&&(o=r(t,e),a=1e3*s.getCurrentUTCTime(),o.moveTo(a),o.indexOfBar(a)>=0&&n.setLastBarClosed(!1)),i(n)}}function i(e,i,n,o,r){return s._cachedDatafeed.subscribe(e,i,n,t(e,i,o),r)}function n(e){return s._cachedDatafeed.unsubscribe(e)}function o(e,t,i){s.resolveSymbol(e,t,i)}var s=this;this._studiesCache={},this._sessionsLastDataCache={},this._metainfoCache=[],this._barsCoefficientsCache={},this._extrapolationManager=v,this._externalDatafeed=e,this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._callbacks={},
this._serverTimeOffset=0,s._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),s._datafeedConfiguration=s._adoptConfigurationData(window.configurationData),s._fireEvent("configuration_received"),s._externalDatafeed.getServerTime&&s._externalDatafeed.getServerTime(function(e){s._serverTimeOffset=e-(new Date).valueOf()/1e3}),this._pointsetsManager=S,this._rangeExtensionData={},this._quotesInfo=[],this._depthInfo=[],this._fullNameSymbolInfoMap={},this._endOfData={},this._computeStudyCounter=0,this._cachedDatafeed=new d(e,f.createDWMAligner),this._extendedRange=function(e){return s._rangeExtensionData[e]&&s._rangeExtensionData[e].summary},this._extendedRangeForStudy=function(e){var t=s._rangeExtensionData[e];return t?t.summary+t.realtimeBarsCount:0},this._extendedTime=function(e){return s._rangeExtensionData[e]&&s._rangeExtensionData[e].time},g.setupFeed({resolve:o,subscribe:i,unsubscribe:n,calculateHistoryDepth:this._externalDatafeed.calculateHistoryDepth?this._externalDatafeed.calculateHistoryDepth.bind(this._externalDatafeed):void 0})},f.createDWMAligner=function(e,i,n){var o=t.get_timezone(i),r=new b.Session;return r.init(o,n),b.createDWMAligner(e,r)},f.prototype._barsCoefficients=function(e,t){if(0!==e.indexOf("="))return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},f.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null},f.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={}},f.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},f.prototype._logMessage=function(e){n.enabled("charting_library_debug_mode")&&console.log(e)},f.prototype._extendRange=function(e,t){this._rangeExtensionData[e]||(this._rangeExtensionData[e]={}),void 0===this._rangeExtensionData[e].summary&&(this._rangeExtensionData[e].summary=0),this._rangeExtensionData[e].summary+=t},f.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},f.prototype._fireEvent=function(e,t,i){var n,o;if(this._callbacks.hasOwnProperty(e)){for(n=this._callbacks[e],o=0;o<n.length;++o)n[o](t);i||(this._callbacks[e]=[])}},f.prototype._adoptConfigurationData=function(e){var t,i,n,o=TradingView.merge({},e),r=o.supported_resolutions;if(!r||0===r.length)return o.supported_resolutions=void 0,o;for(t=[],i=0;i<r.length;i++){if(n=r[i],-1!==t.indexOf(n))throw Error("Duplicating resolution `"+n+"`");t.push(n)}return o.supported_resolutions=t,o},f.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supported_resolutions},f.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},f.prototype.supportedExchangesList=function(){return this._datafeedConfiguration.exchanges||[]},f.prototype.futuresRegex=function(){return this._datafeedConfiguration.futures_regex||/$a/},f.prototype._findStudyObject=function(e){ this._serverTimeOffset=0,s._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),s._datafeedConfiguration=s._adoptConfigurationData(window.configurationData),s._fireEvent("configuration_received"),s._externalDatafeed.getServerTime&&s._externalDatafeed.getServerTime(function(e){s._serverTimeOffset=e-(new Date).valueOf()/1e3}),this._pointsetsManager=S,this._rangeExtensionData={},this._quotesInfo=[],this._depthInfo=[],this._fullNameSymbolInfoMap={},this._endOfData={},this._computeStudyCounter=0,this._cachedDatafeed=new d(e,f.createDWMAligner),this._extendedRange=function(e){return s._rangeExtensionData[e]&&s._rangeExtensionData[e].summary},this._extendedRangeForStudy=function(e){var t=s._rangeExtensionData[e];return t?(t.summary||0)+(t.realtimeBarsCount||0):0},this._extendedTime=function(e){return s._rangeExtensionData[e]&&s._rangeExtensionData[e].time},g.setupFeed({resolve:o,subscribe:i,unsubscribe:n,calculateHistoryDepth:this._externalDatafeed.calculateHistoryDepth?this._externalDatafeed.calculateHistoryDepth.bind(this._externalDatafeed):void 0})},f.createDWMAligner=function(e,i,n){var o=t.get_timezone(i),r=new b.Session;return r.init(o,n),b.createDWMAligner(e,r)},f.prototype._barsCoefficients=function(e,t){if(0!==e.indexOf("="))return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},f.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null},f.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={}},f.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},f.prototype._logMessage=function(e){n.enabled("charting_library_debug_mode")&&console.log(e)},f.prototype._extendRange=function(e,t){this._rangeExtensionData[e]||this.purgeRangeExtensionData(e),void 0===this._rangeExtensionData[e].summary&&(this._rangeExtensionData[e].summary=0),this._rangeExtensionData[e].summary+=t},f.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},f.prototype._fireEvent=function(e,t,i){var n,o;if(this._callbacks.hasOwnProperty(e)){for(n=this._callbacks[e],o=0;o<n.length;++o)n[o](t);i||(this._callbacks[e]=[])}},f.prototype._adoptConfigurationData=function(e){var t,i,n,o=TradingView.merge({},e),r=o.supported_resolutions;if(!r||0===r.length)return o.supported_resolutions=void 0,o;for(t=[],i=0;i<r.length;i++){if(n=r[i],-1!==t.indexOf(n))throw Error("Duplicating resolution `"+n+"`");t.push(n)}return o.supported_resolutions=t,o},f.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supported_resolutions},f.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},f.prototype.supportedExchangesList=function(){return this._datafeedConfiguration.exchanges||[]},f.prototype.futuresRegex=function(){return this._datafeedConfiguration.futures_regex||/$a/},f.prototype._findStudyObject=function(e){
var t=e.split("@")[0],i=JSServer.studyLibrary.filter(function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t});if(0===i.length)throw Error("Study `"+e+"` not found");return i[0]},f.prototype.getMarks=function(e,t,i,n,o){var r,s={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),r=this,this._externalDatafeed.getMarks(e,t,i,function(t){var i,a,l=t.map(function(e){return e.time=parseInt(e.time),e});r._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,o,JSON.stringify(l))),i=f.createDWMAligner(o,e.timezone,e.session),a=l.map(function(e){return e.tickmark=null!==i?i.tradingDayToSessionStart(1e3*e.time)/1e3:e.time,e.direction=s[e.color],e.onClicked=function(){P.emit("onMarkClick",e.id)},e.label=!!e.label&&e.label[0],e}),n(a)},o))},f.prototype.getTimescaleMarks=function(e,t,i,n,o){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var r=this;this._externalDatafeed.getTimescaleMarks(e,t,i,function(t){var i,s;r._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,o,JSON.stringify(t))),i=f.createDWMAligner(o,e.timezone,e.session),s=t.map(function(e){return e.tickmark=null!==i?i.tradingDayToSessionStart(1e3*e.time)/1e3:e.time,e}),n(s)},o)}},f.prototype._computeStudy=function(e,t,i,n,o,r,s,a,l,c,h,u){function d(e){var t,i;return e<a()?_:0===(t=g.length)?0:(i=g[t-1].index,i===_?0:i+1)}function p(e,t,i){var n,o,r,s,a=e.time,l="number"==typeof t?[t]:t;for(n=0;n<l.length;++n)o=l[n],o&&"object"==typeof o&&(v["plot_"+n]=o.offset,o=o.value,S++),"number"==typeof o&&isNaN(o)&&(o=void 0),l[n]=o;r=g.length-1,s=r<0||a>g[r].value[0],s?g.push({index:d(a),value:[a].concat(l)}):g[r].value=[a].concat(l),f||c([g[g.length-1]],s,g.length,v,i)}var f=!0,m=this._computeStudyCounter++,g=[],v={},S=0,b=!1,w=!1,P=this,T=function(a){var c;if(y.Symbol.parsePeriod(n).isIntraday&&!a.has_intraday)return void h("Unsupported resolution. Did you forget to set has_intraday to true?");try{if(c=new y.StudyEngine({tickerid:i,symbolInfo:a,period:n,body:t,sessionId:e,onErrorCallback:h,rangeExtension:s,input:function(e){return r[e]},out:function(e,t){p(e,t,a)},nonseriesOut:function(e,t){w=!0,u(t,a)},setNoMoreData:function(){b=!0},recalc:function(e,i){f=!1,g.endOfData=b,w&&!(g.length>0)||t.error&&null!==t.error()||l(g,S>0?v:void 0,a,i)}}),!P._studiesCache[e]||!P._studiesCache[e][o])throw Error("This should never happen");P._studiesCache[e][o].engine=c}catch(e){if(!e.studyError)throw e;h(e.message)}},x=function(e){h(e)},C=function(){return P._studiesCache[e]&&P._studiesCache[e][o]&&P._studiesCache[e][o].activeResolve===m} var t=e.split("@")[0],i=JSServer.studyLibrary.filter(function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t});if(0===i.length)throw Error("Study `"+e+"` not found");return i[0]},f.prototype.getMarks=function(e,t,i,n,o){var r,s={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),r=this,this._externalDatafeed.getMarks(e,t,i,function(t){var i,a,l=t.map(function(e){return e.time=parseInt(e.time),e});r._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,o,JSON.stringify(l))),i=f.createDWMAligner(o,e.timezone,e.session),a=l.map(function(e){return e.tickmark=null!==i?i.tradingDayToSessionStart(1e3*e.time)/1e3:e.time,e.direction=s[e.color],e.onClicked=function(){P.emit("onMarkClick",e.id)},e.label=!!e.label&&e.label[0],e}),n(a)},o))},f.prototype.getTimescaleMarks=function(e,t,i,n,o){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var r=this;this._externalDatafeed.getTimescaleMarks(e,t,i,function(t){var i,s;r._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,o,JSON.stringify(t))),i=f.createDWMAligner(o,e.timezone,e.session),s=t.map(function(e){return e.tickmark=null!==i?i.tradingDayToSessionStart(1e3*e.time)/1e3:e.time,e}),n(s)},o)}},f.prototype._computeStudy=function(e,t,i,n,o,r,s,a,l,c,h,u){function d(e){var t,i;return e<a()?_:0===(t=g.length)?0:(i=g[t-1].index,i===_?0:i+1)}function p(e,t,i){var n,o,r,s,a=e.time,l="number"==typeof t?[t]:t;for(n=0;n<l.length;++n)o=l[n],o&&"object"==typeof o&&(v["plot_"+n]=o.offset,o=o.value,S++),"number"==typeof o&&isNaN(o)&&(o=void 0),l[n]=o;r=g.length-1,s=r<0||a>g[r].value[0],s?g.push({index:d(a),value:[a].concat(l)}):g[r].value=[a].concat(l),f||c([g[g.length-1]],s,g.length,v,i)}var f=!0,m=this._computeStudyCounter++,g=[],v={},S=0,b=!1,w=!1,P=this,T=function(a){var c;if(y.Symbol.parsePeriod(n).isIntraday&&!a.has_intraday)return void h("Unsupported resolution. Did you forget to set has_intraday to true?");try{if(c=new y.StudyEngine({tickerid:i,symbolInfo:a,period:n,body:t,sessionId:e,onErrorCallback:h,rangeExtension:s,input:function(e){return r[e]},out:function(e,t){p(e,t,a)},nonseriesOut:function(e,t){w=!0,u(t,a)},setNoMoreData:function(){b=!0},recalc:function(e,i){f=!1,g.endOfData=b,w&&!(g.length>0)||t.error&&null!==t.error()||l(g,S>0?v:void 0,a,i)}}),!P._studiesCache[e]||!P._studiesCache[e][o])throw Error("This should never happen");P._studiesCache[e][o].engine=c}catch(e){if(!e.studyError)throw e;h(e.message)}},x=function(e){h(e)},C=function(){return P._studiesCache[e]&&P._studiesCache[e][o]&&P._studiesCache[e][o].activeResolve===m}
;P._studiesCache[e][o].activeResolve=m,this.resolveSymbol(i,function(){C()&&T.apply(P,arguments)},function(){C()&&x.apply(P,arguments)})},f.prototype._createStudy=function(e,t,i,n,r,s,a){function l(e){var t,i,o;if(Array.isArray(e))return e;for(t=[],i=p._studiesCache[n][r].metainfo.inputs,o=0;o<i.length;o++)t[o]=e[i[o].id];return t}function c(i,a,l){i=o(i),TradingView.ChartapiMessagerInstances[n].onDataUpdate(r,s,p._convertBarsTimeToUnix(i),a,l,p._extendedRange(e,t)),TradingView.ChartapiMessagerInstances[n].onStudyCompleted(r,s)}var d,p=this;a=l(a),TradingView.ChartapiMessagerInstances[n].onStudyLoading(r,s),d=null,p._computeStudy(n,i,e,t,r,a,{getRangeExtensionCount:p._extendedRangeForStudy.bind(this,n),getRangeExtensionTime:p._extendedTime.bind(this,n)},function(){if(null===d){var e=p._sessionsLastDataCache[n][0];if(void 0===e)return 1/0;d=e.value[0]}return d},function(e,t,i){c(e,t?{data:{offsets:t}}:null,i)},function(i,a,l,c,h){i=o(i);var u=c?{data:{offsets:c}}:null;TradingView.ChartapiMessagerInstances[n].onDataUpdate(r,s,p._convertBarsTimeToUnix(i),u,h,p._extendedRange(e,t))},function(e){TradingView.ChartapiMessagerInstances[n].onStudyError(r,s,e)},function(e,t){var i;switch(e.type){case"projection":this._updateProjectionData(n,r,s,e);break;case"study_graphics":i={data:e.data,indexes:[]},u(i,p._sessionsLastDataCache[n]),c([],i,t);break;case"non_series_data":i={data:e.data,indexes:[]},h(i,p._sessionsLastDataCache[n]),c([],i,t);break;default:console.warn("unsupported non-series data type for study "+e.type)}}.bind(this))},f.prototype.stopSources=function(e){var t,i;for(t in this._studiesCache[e])(i=this._studiesCache[e][t])&&(i.engine&&i.engine.stop(),i.activeResolve=-1);g.unsubscribeUnused()},f.prototype.recreateSources=function(e,t,i,n){var o,r;this.stopSources(i);for(o in this._studiesCache[i])(r=this._studiesCache[i][o])&&(r.symbol=e,r.resolution=t,"series"===r.type&&this.createSeries(e,t,i,o,r.turnaround,n));for(o in this._studiesCache[i])(r=this._studiesCache[i][o])&&"study"===r.type&&this._createStudy(e,t,r.studyObject,i,o,r.turnaround,r.inputs)},f.prototype.removeStudy=function(e,t){this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),g.unsubscribeUnused()),this._studiesCache[e][t]=null},f.prototype.removeSeries=function(e,t){this.removeStudy(e,t)},f.prototype.recomputeStudy=function(e,t,i,n){var o=this._studiesCache[i][e];if(!o)throw Error("This should never happen");o.inputs=t,o.turnaround=n,o.engine&&o.engine.stop(),this._createStudy(o.symbol,o.resolution,o.studyObject,i,e,n,t)},f.prototype._convertBarsTimeToUnix=function(e){var t,i,n=[];for(t=0;t<e.length;++t)i={index:e[t].index,value:[].concat(e[t].value)},i.value[0]/=1e3,n.push(i);return n.endOfData=e.endOfData,n},f.prototype.createStudy=function(e,t,i,n,o,r,s){var a=this._findStudyObject(r),l=new a.constructor;this._studiesCache[i]=this._studiesCache[i]||{},this._studiesCache[i][n]={studyObject:l,symbol:e,resolution:t,guid:n,type:"study",inputs:s,metainfo:a.metainfo,turnaround:o}, ;P._studiesCache[e][o].activeResolve=m,this.resolveSymbol(i,function(){C()&&T.apply(P,arguments)},function(){C()&&x.apply(P,arguments)})},f.prototype._createStudy=function(e,t,i,n,r,s,a){function l(e){var t,i,o;if(Array.isArray(e))return e;for(t=[],i=p._studiesCache[n][r].metainfo.inputs,o=0;o<i.length;o++)t[o]=e[i[o].id];return t}function c(i,a,l){i=o(i),TradingView.ChartapiMessagerInstances[n].onDataUpdate(r,s,p._convertBarsTimeToUnix(i),a,l,p._extendedRange(e,t)),TradingView.ChartapiMessagerInstances[n].onStudyCompleted(r,s)}var d,p=this;a=l(a),TradingView.ChartapiMessagerInstances[n].onStudyLoading(r,s),d=null,p._computeStudy(n,i,e,t,r,a,{getRangeExtensionCount:p._extendedRangeForStudy.bind(this,n),getRangeExtensionTime:p._extendedTime.bind(this,n)},function(){if(null===d){var e=p._sessionsLastDataCache[n][0];if(void 0===e)return 1/0;d=e.value[0]}return d},function(e,t,i){c(e,t?{data:{offsets:t}}:null,i)},function(i,a,l,c,h){i=o(i);var u=c?{data:{offsets:c}}:null;TradingView.ChartapiMessagerInstances[n].onDataUpdate(r,s,p._convertBarsTimeToUnix(i),u,h,p._extendedRange(e,t))},function(e){TradingView.ChartapiMessagerInstances[n].onStudyError(r,s,e)},function(e,t){var i;switch(e.type){case"projection":this._updateProjectionData(n,r,s,e);break;case"study_graphics":i={data:e.data,indexes:[]},u(i,p._sessionsLastDataCache[n]),c([],i,t);break;case"non_series_data":i={data:e.data,indexes:[]},h(i,p._sessionsLastDataCache[n]),c([],i,t);break;default:console.warn("unsupported non-series data type for study "+e.type)}}.bind(this))},f.prototype.stopSources=function(e){var t,i;for(t in this._studiesCache[e])(i=this._studiesCache[e][t])&&(i.engine&&i.engine.stop(),i.activeResolve=-1);g.unsubscribeUnused()},f.prototype.recreateSources=function(e,t,i,n){var o,r;this.stopSources(i);for(o in this._studiesCache[i])(r=this._studiesCache[i][o])&&(r.symbol=e,r.resolution=t,"series"===r.type&&this.createSeries(e,t,i,o,r.turnaround,n));for(o in this._studiesCache[i])(r=this._studiesCache[i][o])&&"study"===r.type&&this._createStudy(e,t,r.studyObject,i,o,r.turnaround,r.inputs)},f.prototype.removeStudy=function(e,t){this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),g.unsubscribeUnused()),this._studiesCache[e][t]=null},f.prototype.removeSeries=function(e,t){this.removeStudy(e,t)},f.prototype.recomputeStudy=function(e,t,i,n){var o=this._studiesCache[i][e];if(!o)throw Error("This should never happen");o.inputs=t,o.turnaround=n,o.engine&&o.engine.stop(),this._createStudy(o.symbol,o.resolution,o.studyObject,i,e,n,t)},f.prototype._convertBarsTimeToUnix=function(e){var t,i,n=[];for(t=0;t<e.length;++t)i={index:e[t].index,value:[].concat(e[t].value)},i.value[0]/=1e3,n.push(i);return n.endOfData=e.endOfData,n},f.prototype.createStudy=function(e,t,i,n,o,r,s){var a=this._findStudyObject(r),l=new a.constructor;this._studiesCache[i]=this._studiesCache[i]||{},this._studiesCache[i][n]={studyObject:l,symbol:e,resolution:t,guid:n,type:"study",inputs:s,metainfo:a.metainfo,turnaround:o},
this._createStudy(e,t,l,i,n,o,s)},f.prototype.purgeRangeExtensionData=function(e){e?this._rangeExtensionData[e]={summary:0,realtimeBarsCount:0}:this._rangeExtensionData={}},f.prototype.ensureExtendedTo=function(e,t,i){var n,o=this._studiesCache[t][e];if(!o)throw Error("This should never happen");this.purgeRangeExtensionData(t),this._rangeExtensionData[t]||(this._rangeExtensionData[t]={}),this._rangeExtensionData[t].time=i,n=this,setTimeout(function(){n.recreateSources(o.symbol,o.resolution,t,!0)},0)},f.prototype.extendSeriesRange=function(e,t,i){var n,o,r,s,a=this._studiesCache[t][e];if(!a)throw Error("This should never happen");if(this._isEndOfData(t,e,a.turnaround))return n=a.engine.runner.host.symbolInfo.data_status,void setTimeout(function(){TradingView.ChartapiMessagerInstances[t].onSeriesCompleted(e,a.turnaround,n)},0);i+=10,o=this._barsCoefficients(a.symbol,a.resolution),r=o.barsCoefficient||1,this._extendRange(t,i*r),o.barsCoefficient||(o.expectedBarsCount=this._extendedRange(t)),s=this,setTimeout(function(){s.recreateSources(a.symbol,a.resolution,t,!0)},0)},f.prototype._updateProjectionData=function(e,t,i,n){var o=n.barsetSize?this._convertBarsTimeToUnix([{index:n.barsetSize-1,exTime:n.lastBar?n.lastBar[0]/1e3:0,value:n.lastBar}]):null;TradingView.ChartapiMessagerInstances[e].onProjectionUpdate(t,i,n,o)},f.prototype.updateSeriesTurnaround=function(e,t,i){this._studiesCache[e]||(this._studiesCache[e]={}),this._studiesCache[e][t]||(this._studiesCache[e][t]={}),this._studiesCache[e][t].type="series",this._studiesCache[e][t].turnaround=i},f.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},f.prototype.createSeries=function(e,t,i,o,r,s){function a(e,n,o){l._extrapolationManager.storage(i,e.full_name,t).setLastBarTime(n,o)}var l,c=e,h=new y.OHLCV;this._studiesCache[i]=this._studiesCache[i]||{},this._sessionsLastDataCache[i]=null,this._studiesCache[i][o]={symbol:e,resolution:t,studyObject:h,guid:o,type:"series",turnaround:r},TradingView.ChartapiMessagerInstances[i].onSeriesLoading(o,r),l=this,this._computeStudy(i,h,c,t,o,[],{getRangeExtensionCount:l._extendedRange.bind(this,i),getRangeExtensionTime:l._extendedTime.bind(this,i)},function(){return-1/0},function(n,c,h,u){var d,p,_,f,m,y;if(!l._studiesCache[i][o])throw Error("This should never happen");if(l._sessionsLastDataCache[i]=n,d=l._convertBarsTimeToUnix(n),p=d.length>0?1e3*d[0].value[0]:void 0,u.nextTime&&(!p||u.nextTime<p/1e3))return void l.ensureExtendedTo(o,i,u.nextTime);0!==d.length&&(_=l._barsCoefficients(e,t),_.expectedBarsCount&&_.barsCount&&(_.barsCoefficient=Math.min(Math.max(_.barsCoefficient||1,parseInt(_.expectedBarsCount/(d.length-_.barsCount)+.5)),100)),_.barsCount=d.length,f=d[d.length-1],a(h,d.length-1,1e3*f.value[0]),l.rebuildExtrapolatedData(i,e.name,t,h,1e3*f.value[0]),s&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r),TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,d,h,0),m=l._extrapolationManager.storage(i,h.full_name,t), this._createStudy(e,t,l,i,n,o,s)},f.prototype.purgeRangeExtensionData=function(e){e?this._rangeExtensionData[e]={summary:0,realtimeBarsCount:0}:this._rangeExtensionData={}},f.prototype.ensureExtendedTo=function(e,t,i){var n,o=this._studiesCache[t][e];if(!o)throw Error("This should never happen");this.purgeRangeExtensionData(t),this._rangeExtensionData[t]||(this._rangeExtensionData[t]={}),this._rangeExtensionData[t].time=i,n=this,setTimeout(function(){n.recreateSources(o.symbol,o.resolution,t,!0)},0)},f.prototype.extendSeriesRange=function(e,t,i){var n,o,r,s,a=this._studiesCache[t][e];if(!a)throw Error("This should never happen");if(this._isEndOfData(t,e,a.turnaround))return n=a.engine.runner.host.symbolInfo.data_status,void setTimeout(function(){TradingView.ChartapiMessagerInstances[t].onSeriesCompleted(e,a.turnaround,n)},0);i+=10,o=this._barsCoefficients(a.symbol,a.resolution),r=o.barsCoefficient||1,this._extendRange(t,i*r),o.barsCoefficient||(o.expectedBarsCount=this._extendedRange(t)),s=this,setTimeout(function(){s.recreateSources(a.symbol,a.resolution,t,!0)},0)},f.prototype._updateProjectionData=function(e,t,i,n){var o=n.barsetSize?this._convertBarsTimeToUnix([{index:n.barsetSize-1,exTime:n.lastBar?n.lastBar[0]/1e3:0,value:n.lastBar}]):null;TradingView.ChartapiMessagerInstances[e].onProjectionUpdate(t,i,n,o)},f.prototype.updateSeriesTurnaround=function(e,t,i){this._studiesCache[e]||(this._studiesCache[e]={}),this._studiesCache[e][t]||(this._studiesCache[e][t]={}),this._studiesCache[e][t].type="series",this._studiesCache[e][t].turnaround=i},f.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},f.prototype.createSeries=function(e,t,i,o,r,s){function a(e,n,o){l._extrapolationManager.storage(i,e.full_name,t).setLastBarTime(n,o)}var l,c=e,h=new y.OHLCV;this._studiesCache[i]=this._studiesCache[i]||{},this._sessionsLastDataCache[i]=null,this._studiesCache[i][o]={symbol:e,resolution:t,studyObject:h,guid:o,type:"series",turnaround:r},TradingView.ChartapiMessagerInstances[i].onSeriesLoading(o,r),l=this,this._computeStudy(i,h,c,t,o,[],{getRangeExtensionCount:l._extendedRange.bind(this,i),getRangeExtensionTime:l._extendedTime.bind(this,i)},function(){return-1/0},function(n,c,h,u){var d,p,_,f,m,y;if(!l._studiesCache[i][o])throw Error("This should never happen");if(l._sessionsLastDataCache[i]=n,d=l._convertBarsTimeToUnix(n),p=d.length>0?1e3*d[0].value[0]:void 0,u.nextTime&&(!p||u.nextTime<p/1e3))return void l.ensureExtendedTo(o,i,u.nextTime);0!==d.length&&(_=l._barsCoefficients(e,t),_.expectedBarsCount&&_.barsCount&&(_.barsCoefficient=Math.min(Math.max(_.barsCoefficient||1,parseInt(_.expectedBarsCount/(d.length-_.barsCount)+.5)),100)),_.barsCount=d.length,f=d[d.length-1],a(h,d.length-1,1e3*f.value[0]),l.rebuildExtrapolatedData(i,e.name,t,h,1e3*f.value[0]),s&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r),TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,d,h,0),m=l._extrapolationManager.storage(i,h.full_name,t),
Promise.resolve().then(function(){l._pointsetsManager.broadcastPointsetsUpdates(h.full_name,t,n,m,h,function(e,t){TradingView.ChartapiMessagerInstances[i].onPointsetDataUpdate(e,r,t,h)})})),y=0===d.length||u&&u.endOfData,y&&(l._logMessage("Series has no more data on server: {0}".format(h.full_name)),l._setEndOfData(i,o,r),0===d.length&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r)),TradingView.ChartapiMessagerInstances[i].onSeriesCompleted(o,r,h.data_status)},function(e,n,s,c,h){var u,d=l._convertBarsTimeToUnix(e),p=d[d.length-1];if(n){if(l._rangeExtensionData[i]||l.purgeRangeExtensionData(i),l._rangeExtensionData[i].realtimeBarsCount+=1,!l._studiesCache[i][o])throw Error("This should never happen");u=s-1,l._logMessage("New bar arrived: symbol {0}, bar {1}".format(h.full_name,JSON.stringify(p))),TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,[p],h,u),a(h,u,1e3*p.value[0]),l.rebuildExtrapolatedData(i,h.full_name,t,h,1e3*p.value[0])}else l._logMessage("Last bar update: symbol {0}, bar {1}".format(h.full_name,JSON.stringify(p))),TradingView.ChartapiMessagerInstances[i].onDataUpdate(o,r,d,null,h);l._fireEvent("realtime_tick",e[e.length-1],!0)},function(e){l._logMessage("Series error: {0}".format(e)),TradingView.ChartapiMessagerInstances[i].onSeriesError(o,e),n.enabled("clear_bars_on_series_error")&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r)},function(e,n){var s,c,h,u,d,p,_,f;if("projection"!==e.type)throw Error("unexpected non-series data type for series "+e.type);if(s=e.projectionTime/1e3,c=-1,(e.data||[]).forEach(function(e){c=Math.max(c,e[0]||0)}),c=Math.min(c,100),h=e.barsetSize,s&&c>=0&&h&&e.lastBar){for(u=[],d=0;d<=c;d++)u.push(s+.001*d);p=e.lastBar.slice(0),p[0]=p[0]/1e3,TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,[{index:h-1,value:p}],n,h-1,u),_=h+c,f=1e3*Math.trunc(u[c]),a(n,_,f),l.rebuildExtrapolatedData(i,n.full_name,t,n,f)}l._updateProjectionData(i,o,r,e)})},f.prototype.onMoreTickmarksRequested=function(e,t,i,n,o){this._extrapolationManager.storage(e,i.full_name,n).onTickmarksNeeded(i,o)},f.prototype.removePointset=function(e){this._pointsetsManager.removePointset(e)},f.prototype.rebuildExtrapolatedData=function(e,t,i,n,o){this._extrapolationManager.storage(e,n.full_name,i).rebuild(o,n)},f.prototype.createPointset=function(e,t,i,n,o,r){var s=this._extrapolationManager.storage(e,n.full_name,o);this._pointsetsManager.createPointset(t,i,o,r,s,n)},f.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map(function(e){return e.metainfo})),this._metainfoCache},f.prototype.searchSymbols=function(e,t,i,n){function o(e){r._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),n(e)}this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));var r=this;this._externalDatafeed.searchSymbols(e,t,i,o)},f.prototype.resolveSymbol=function(e,t,i){var n,o=g.parseSymbol(e).symbol Promise.resolve().then(function(){l._pointsetsManager.broadcastPointsetsUpdates(h.full_name,t,n,m,h,function(e,t){TradingView.ChartapiMessagerInstances[i].onPointsetDataUpdate(e,r,t,h)})})),y=0===d.length||u&&u.endOfData,y&&(l._logMessage("Series has no more data on server: {0}".format(h.full_name)),l._setEndOfData(i,o,r),0===d.length&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r)),TradingView.ChartapiMessagerInstances[i].onSeriesCompleted(o,r,h.data_status)},function(e,n,s,c,h){var u,d=l._convertBarsTimeToUnix(e),p=d[d.length-1];if(n){if(l._rangeExtensionData[i]||l.purgeRangeExtensionData(i),void 0===l._rangeExtensionData[i].realtimeBarsCount&&(l._rangeExtensionData[i].realtimeBarsCount=0),l._rangeExtensionData[i].realtimeBarsCount+=1,!l._studiesCache[i][o])throw Error("This should never happen");u=s-1,l._logMessage("New bar arrived: symbol {0}, bar {1}".format(h.full_name,JSON.stringify(p))),TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,[p],h,u),a(h,u,1e3*p.value[0]),l.rebuildExtrapolatedData(i,h.full_name,t,h,1e3*p.value[0])}else l._logMessage("Last bar update: symbol {0}, bar {1}".format(h.full_name,JSON.stringify(p))),TradingView.ChartapiMessagerInstances[i].onDataUpdate(o,r,d,null,h);l._fireEvent("realtime_tick",e[e.length-1],!0)},function(e){l._logMessage("Series error: {0}".format(e)),TradingView.ChartapiMessagerInstances[i].onSeriesError(o,e),n.enabled("clear_bars_on_series_error")&&TradingView.ChartapiMessagerInstances[i].onSeriesClearData(o,r)},function(e,n){var s,c,h,u,d,p,_,f;if("projection"!==e.type)throw Error("unexpected non-series data type for series "+e.type);if(s=e.projectionTime/1e3,c=-1,(e.data||[]).forEach(function(e){c=Math.max(c,e[0]||0)}),c=Math.min(c,100),h=e.barsetSize,s&&c>=0&&h&&e.lastBar){for(u=[],d=0;d<=c;d++)u.push(s+.001*d);p=e.lastBar.slice(0),p[0]=p[0]/1e3,TradingView.ChartapiMessagerInstances[i].onTimescaleUpdate(o,r,[{index:h-1,value:p}],n,h-1,u),_=h+c,f=1e3*Math.trunc(u[c]),a(n,_,f),l.rebuildExtrapolatedData(i,n.full_name,t,n,f)}l._updateProjectionData(i,o,r,e)})},f.prototype.onMoreTickmarksRequested=function(e,t,i,n,o){this._extrapolationManager.storage(e,i.full_name,n).onTickmarksNeeded(i,o)},f.prototype.removePointset=function(e){this._pointsetsManager.removePointset(e)},f.prototype.rebuildExtrapolatedData=function(e,t,i,n,o){this._extrapolationManager.storage(e,n.full_name,i).rebuild(o,n)},f.prototype.createPointset=function(e,t,i,n,o,r){var s=this._extrapolationManager.storage(e,n.full_name,o);this._pointsetsManager.createPointset(t,i,o,r,s,n)},f.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map(function(e){return e.metainfo})),this._metainfoCache},f.prototype.searchSymbols=function(e,t,i,n){function o(e){r._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),n(e)}this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));var r=this;this._externalDatafeed.searchSymbols(e,t,i,o)},
;this._resolveRequests[o]?n=this._resolveRequests[o]:(n=this.resolveSymbolInternal(o),this._resolveRequests[o]=n),n.done(t).fail(i)},f.prototype.resolveSymbolInternal=function(e){var t,i=this,n=$.Deferred();return this._logMessage("Symbol resolve requested: `{0}` ".format(e)),t=!0,this._externalDatafeed.resolveSymbol(e,function(o){t&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),i._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(e,JSON.stringify(o))),a(o),s(o),i._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(e,JSON.stringify(o))),i._fullNameSymbolInfoMap[o.full_name]=o,n.resolve(o)},function(t){i._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(e,t)),n.reject(t)}),t=!1,n.promise()},f.prototype._createMarketStatusWatchers=function(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});var i=this;t.forEach(function(t){void 0===i._marketStatusWatchers[e][t]&&(i._marketStatusWatchers[e][t]=new m(i,e,t))})},f.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach(function(i){t._marketStatusWatchers[e][i].stop()}),this._marketStatusWatchers[e]={}},f.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},f.prototype._startQuotesSubscription=function(e){function t(t,i){var n=r._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||n&&n.marketStatus(),t.values.pricescale=i.pricescale,t.values.minmov=i.minmov,t.values.minmove2=i.minmove2||0,t.values.fractional=i.fractional||!1,n&&t.v.cs&&n.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function i(e){e.forEach(function(e){void 0!==o[e.n]?null!==o[e.n]&&t(e,o[e.n]):r.resolveSymbol(e.n,function(i){o[e.n]=i,t(e,i)},function(){o[e.n]=null})})}var o={},r=this,s=this._quotesInfo[e].symbols;0!==s.length&&(this._externalDatafeed.getQuotes&&!n.enabled("charting_library")?this._externalDatafeed.getQuotes(s,function(t){r._quotesInfo[e]&&(i(t),r._quotesInfo[e].listenerGUID=e,r._externalDatafeed.subscribeQuotes(s,r._quotesInfo[e].fastSymbols,i,r._quotesInfo[e].listenerGUID))},function(e){}):!this._externalDatafeed.getQuotes&&n.enabled("trading_terminal")&&setTimeout(function(){i(s.map(function(e){return{n:e,s:"ok",v:{}}}))}),this._createMarketStatusWatchers(e,s))},f.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},f.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},f.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null}, f.prototype.resolveSymbol=function(e,t,i){var n,o=g.parseSymbol(e).symbol;this._resolveRequests[o]?n=this._resolveRequests[o]:(n=this.resolveSymbolInternal(o),this._resolveRequests[o]=n),n.done(t).fail(i)},f.prototype.resolveSymbolInternal=function(e){var t,i=this,n=$.Deferred();return this._logMessage("Symbol resolve requested: `{0}` ".format(e)),t=!0,this._externalDatafeed.resolveSymbol(e,function(o){t&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),i._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(e,JSON.stringify(o))),a(o),s(o),i._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(e,JSON.stringify(o))),i._fullNameSymbolInfoMap[o.full_name]=o,n.resolve(o)},function(t){i._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(e,t)),n.reject(t)}),t=!1,n.promise()},f.prototype._createMarketStatusWatchers=function(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});var i=this;t.forEach(function(t){void 0===i._marketStatusWatchers[e][t]&&(i._marketStatusWatchers[e][t]=new m(i,e,t))})},f.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach(function(i){t._marketStatusWatchers[e][i].stop()}),this._marketStatusWatchers[e]={}},f.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},f.prototype._startQuotesSubscription=function(e){function t(t,i){var n=r._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||n&&n.marketStatus(),t.values.pricescale=i.pricescale,t.values.minmov=i.minmov,t.values.minmove2=i.minmove2||0,t.values.fractional=i.fractional||!1,n&&t.v.cs&&n.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function i(e){e.forEach(function(e){void 0!==o[e.n]?null!==o[e.n]&&t(e,o[e.n]):r.resolveSymbol(e.n,function(i){o[e.n]=i,t(e,i)},function(){o[e.n]=null})})}var o={},r=this,s=this._quotesInfo[e].symbols;0!==s.length&&(this._externalDatafeed.getQuotes&&!n.enabled("charting_library")?this._externalDatafeed.getQuotes(s,function(t){r._quotesInfo[e]&&(i(t),r._quotesInfo[e].listenerGUID=e,r._externalDatafeed.subscribeQuotes(s,r._quotesInfo[e].fastSymbols,i,r._quotesInfo[e].listenerGUID))},function(e){}):!this._externalDatafeed.getQuotes&&n.enabled("trading_terminal")&&setTimeout(function(){i(s.map(function(e){return{n:e,s:"ok",v:{}}}))}),this._createMarketStatusWatchers(e,s))},f.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},f.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},f.prototype.quoteDeleteSession=function(e){
f.prototype.quoteSetFields=function(e,t){},f.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},f.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter(function(e){return t.indexOf(e)<0}),this._restartQuotesSubscription(e)},f.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},f.prototype.quoteHibernateAll=function(e){},f.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},f.prototype._startDepthSubscription=function(e){function t(e){return e.map(function(e){return{p:e.price,v:e.volume}})}function i(e){var i={};return i.s=r,i.bids=t(e.bids),i.asks=t(e.asks),i}function n(t){t.snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([i(t)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([i(t)]))}var o=this,r=this._depthInfo[e].symbol;r&&this._fullNameSymbolInfoMap[r]&&this._externalDatafeed.subscribeDepth&&(o._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(r,function(t){o._depthInfo[e]&&n(t)}))},f.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},f.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},f.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},f.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},f.prototype._filteredSymbols=function(e){var t=[];return e.forEach(function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)}),t},f.prototype._isEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;return!!this._endOfData[n]},f.prototype._setEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;this._endOfData[n]=!0},f.prototype.alignTimePoint=function(e,t,i){return n.enabled("disable_resolution_rebuild")?e:r(t,i).alignTimeIfPossible(1e3*e)/1e3},f.prototype.serverTimeOffset=function(){return this._serverTimeOffset},f.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},e.exports=f}).call(t,i(35),i(5))},function(e,t,i){"use strict";(function(t){var n=i(37),o={},r=function(e,i,r){function s(){var e={};e.symbolname=_,e.status="ok",e.values={},e.values.current_session=d,o[_]=d,TradingView.ChartapiMessagerInstances[f].onQuotesData([f].concat([e]))}function a(e,i,o){var r=t.get_timezone(i);c=(new n.Session).init(r,e),h=o,m=setInterval(l,6e4),l(),s()}function l(){var e,t;if(c){if(h)return void(d="out_of_session");e=n.isTradingNow(new Date,c),t=e?"market":"out_of_session",t!==d&&(d=t,s())}}var c,h,u={},d=o[r]||"out_of_session",p=!1,_=r,f=i,m=null;return e.resolveSymbol(r,function(e){p||a(e.session,e.timezone,e.expired)},function(){}), this._stopQuotesSubscription(e),this._quotesInfo[e]=null},f.prototype.quoteSetFields=function(e,t){},f.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},f.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter(function(e){return t.indexOf(e)<0}),this._restartQuotesSubscription(e)},f.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},f.prototype.quoteHibernateAll=function(e){},f.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},f.prototype._startDepthSubscription=function(e){function t(e){return e.map(function(e){return{p:e.price,v:e.volume}})}function i(e){var i={};return i.s=r,i.bids=t(e.bids),i.asks=t(e.asks),i}function n(t){t.snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([i(t)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([i(t)]))}var o=this,r=this._depthInfo[e].symbol;r&&this._fullNameSymbolInfoMap[r]&&this._externalDatafeed.subscribeDepth&&(o._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(r,function(t){o._depthInfo[e]&&n(t)}))},f.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},f.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},f.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},f.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},f.prototype._filteredSymbols=function(e){var t=[];return e.forEach(function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)}),t},f.prototype._isEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;return!!this._endOfData[n]},f.prototype._setEndOfData=function(e,t,i){var n=e+"!"+t+"@"+i;this._endOfData[n]=!0},f.prototype.alignTimePoint=function(e,t,i){return n.enabled("disable_resolution_rebuild")?e:r(t,i).alignTimeIfPossible(1e3*e)/1e3},f.prototype.serverTimeOffset=function(){return this._serverTimeOffset},f.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},e.exports=f}).call(t,i(35),i(5))},function(e,t,i){"use strict";(function(t){var n=i(37),o={},r=function(e,i,r){function s(){var e={};e.symbolname=_,e.status="ok",e.values={},e.values.current_session=d,o[_]=d,TradingView.ChartapiMessagerInstances[f].onQuotesData([f].concat([e]))}function a(e,i,o){var r=t.get_timezone(i);c=(new n.Session).init(r,e),h=o,m=setInterval(l,6e4),l(),s()}function l(){var e,t;if(c){if(h)return void(d="out_of_session");e=n.isTradingNow(new Date,c),t=e?"market":"out_of_session",t!==d&&(d=t,s())}}var c,h,u={},d=o[r]||"out_of_session",p=!1,_=r,f=i,m=null
u.stop=function(){p=!0,m&&clearInterval(m)},u.marketStatus=function(){return d},u};e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";(function(t){var n=i(673).HeikenAshi,o=i(15).Interval,r=function(){function e(e){this.host=e,this.cache={}}function r(e){var t=e.indexOf(",");return-1===t?e:e.slice(0,t)}function s(e,t,i,n,o,r,s){return o+e+t+i+(a(n)?"_":"")+r+"_"+s}function a(e){return e.has_empty_bars||e.force_session_rebuild}function l(e){if(0!==e.indexOf("="))return{symbol:e};var t;try{t=JSON.parse(e.slice(1))}catch(t){return{symbol:e}}return t.type&&(0===t.type.indexOf("BarSetHeikenAshi@tv-basicstudies-")?t.builder=new n:console.error("unknown builder type: "+t.type)),"string"!=typeof t.symbol&&(t.session=t.symbol.session||t.session,t.symbol=t.symbol.symbol),t}function c(t){e.instance=new e(t),p.setupFeed(e.instance)}var h,u,d,p=i(25),_=i(37),f=p.Symbol,m=p.StudyEngine,y=p.BarBuilder,g=p.BarSet;return e.prototype.getCache=function(e){return this.cache[e]},e.prototype.putCache=function(e,t){this.cache[e]=t},e.prototype.subscribe=function(e,t,i,n,o,r,a,l,c,h){var u=s(e,t,i,a,l,n,h),d=this.getCache(u);return d||(d=this.createItem(e,t,i,a,c,l,n,h),this.putCache(u,d)),d.listeners.addListener(o,r),{key:u,listener:o}},e.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},e.prototype.removeUnused=function(){var e,t,i,n,o,r=[];for(e in this.cache)this.cache[e]&&(t=this.cache[e],0===t.listeners.listenersCount()&&r.push(e));if(0!==r.length){for(i=0;i<r.length;i++)n=r[i],o=this.cache[n],this.cache[n]=null,o.stop();this.removeUnused()}},e.prototype.rebuildFrom=function(e,t,i){var n,o,r,s,a=f.parsePeriod(e),l=f.parsePeriod(t);if(""!==a.resolution&&!a.isSeconds){if(i.has_weekly_and_monthly)return a.resolution;if(void 0===i.has_daily||i.has_daily)return"D";""!==l.resolution&&(l.resolution="",l.interval=i.intraday_multipliers?i.intraday_multipliers[0]:1)}if(a.isIntraday&&void 0!==i.has_intraday&&!i.has_intraday)return"";if(a.isSeconds&&!i.has_seconds)return"";if(n=""!==a.resolution?l.interval:""===l.resolution?Math.min(a.interval,l.interval):a.interval,(o=a.isIntraday?i.intraday_multipliers:i.seconds_multipliers)&&-1===o.indexOf(n)){for(r=o.length-1;r>=0;r--)if(s=+o[r],n%s==0)return s+(a.isSeconds?"S":"");return""}return n+(a.isSeconds?"S":"")},e.prototype.createItem=function(e,t,i,n,s,c,p,_){var f,m,g,v,S,b,w,P=new d,T=l(e);return T.builder?new u(P,T.symbol,t,i,T.builder,n,s,c):(f=r(t),m=this.rebuildFrom(f,r(i),n),g=a(n),!o.isEqual(f,m)||g?(v=n.has_empty_bars,S=$.extend({},n),g&&(S.has_empty_bars=!1,S.force_session_rebuild=!1),void 0!==_&&(b=o.parse(f).inMilliseconds()/o.parse(m).inMilliseconds(),_*=Math.ceil(b)),new u(P,T.symbol,t,m,new y(t,v),S,s,c,p,_)):(w=T.session&&"extended"!==T.session,new h(P,T.symbol,t,i,w,this.host,n,s,p,_)))},h=function(e,t,i,n,o,s,a,l,c,h){this.listeners=e,this.host=s;var u=this;this.host.resolve(t,function(e){o&&e.regular_session&&(e.session=e.regular_session);var s=u.calculateFromTo(e,c||n||i,t,l,h) ;return e.resolveSymbol(r,function(e){p||a(e.session,e.timezone,e.expired)},function(){}),u.stop=function(){p=!0,m&&clearInterval(m)},u.marketStatus=function(){return d},u};e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";(function(t){var n=i(673).HeikenAshi,o=i(15).Interval,r=function(){function e(e){this.host=e,this.cache={}}function r(e){var t=e.indexOf(",");return-1===t?e:e.slice(0,t)}function s(e,t,i,n,o,r,s){return o+e+t+i+(a(n)?"_":"")+r+"_"+s}function a(e){return e.has_empty_bars||e.force_session_rebuild}function l(e){if(0!==e.indexOf("="))return{symbol:e};var t;try{t=JSON.parse(e.slice(1))}catch(t){return{symbol:e}}return t.type&&(0===t.type.indexOf("BarSetHeikenAshi@tv-basicstudies-")?t.builder=new n:console.error("unknown builder type: "+t.type)),"string"!=typeof t.symbol&&(t.session=t.symbol.session||t.session,t.symbol=t.symbol.symbol),t}function c(t){e.instance=new e(t),p.setupFeed(e.instance)}var h,u,d,p=i(25),_=i(37),f=p.Symbol,m=p.StudyEngine,y=p.BarBuilder,g=p.BarSet;return e.prototype.getCache=function(e){return this.cache[e]},e.prototype.putCache=function(e,t){this.cache[e]=t},e.prototype.subscribe=function(e,t,i,n,o,r,a,l,c,h){var u=s(e,t,i,a,l,n,h),d=this.getCache(u);return d||(d=this.createItem(e,t,i,a,c,l,n,h),this.putCache(u,d)),d.listeners.addListener(o,r),{key:u,listener:o}},e.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},e.prototype.removeUnused=function(){var e,t,i,n,o,r=[];for(e in this.cache)this.cache[e]&&(t=this.cache[e],0===t.listeners.listenersCount()&&r.push(e));if(0!==r.length){for(i=0;i<r.length;i++)n=r[i],o=this.cache[n],this.cache[n]=null,o.stop();this.removeUnused()}},e.prototype.rebuildFrom=function(e,t,i){var n,o,r,s,a=f.parsePeriod(e),l=f.parsePeriod(t);if(""!==a.resolution&&!a.isSeconds){if(i.has_weekly_and_monthly)return a.resolution;if(void 0===i.has_daily||i.has_daily)return"D";""!==l.resolution&&(l.resolution="",l.interval=i.intraday_multipliers?i.intraday_multipliers[0]:1)}if(a.isIntraday&&void 0!==i.has_intraday&&!i.has_intraday)return"";if(a.isSeconds&&!i.has_seconds)return"";if(n=""!==a.resolution?l.interval:""===l.resolution?Math.min(a.interval,l.interval):a.interval,(o=a.isIntraday?i.intraday_multipliers:i.seconds_multipliers)&&-1===o.indexOf(n)){for(r=o.length-1;r>=0;r--)if(s=+o[r],n%s==0)return s+(a.isSeconds?"S":"");return""}return n+(a.isSeconds?"S":"")},e.prototype.createItem=function(e,t,i,n,s,c,p,_){var f,m,g,v,S,b,w,P=new d,T=l(e);return T.builder?new u(P,T.symbol,t,i,T.builder,n,s,c):(f=r(t),m=this.rebuildFrom(f,r(i),n),g=a(n),!o.isEqual(f,m)||g?(v=n.has_empty_bars,S=$.extend({},n),g&&(S.has_empty_bars=!1,S.force_session_rebuild=!1),void 0!==_&&(b=o.parse(f).inMilliseconds()/o.parse(m).inMilliseconds(),_*=Math.ceil(b)),new u(P,T.symbol,t,m,new y(t,v),S,s,c,p,_)):(w=T.session&&"extended"!==T.session,new h(P,T.symbol,t,i,w,this.host,n,s,p,_)))},h=function(e,t,i,n,o,s,a,l,c,h){this.listeners=e,this.host=s;var u=this;this.host.resolve(t,function(e){
;u.subs=u.host.subscribe(e,r(i),s,function(e){u.listeners.fire(e)},function(e){u.listeners.onError(e)})},function(e){u.listeners.onError(e)})},h.prototype._createDWMAligner=function(e,i){var n=t.get_timezone(i.timezone),o=new _.Session;return o.init(n,i.session),f.newBarBuilder(e,o,o)},h.prototype.stop=function(){this.subs&&this.host.unsubscribe(this.subs)},h.prototype.calculateFromTo=function(e,i,n,o,r){var s,a,l,c,h,u,d,p,m=f.parsePeriod(i),y=(new Date).valueOf(),g=e.expired?t.cal_to_utc(t.get_timezone(e.timezone),new Date(1e3*e.expiration_date))||y:y;return""===m.resolution?(a=m.interval,l="D"):"S"===m.resolution?(a=10*m.interval,l=""):(c="D"===m.resolution?1:"W"===m.resolution?5:30,a=12*c*m.interval,l="M"),m.range?(a=m.range.interval,l=m.range.resolution):this.host.calculateHistoryDepth&&(h=this.host.calculateHistoryDepth(i,l,a))&&(a=h.intervalBack||a,l=void 0===h.resolutionBack?l:h.resolutionBack),u=e.sessionString||e.session,s=_.alignPeriodsBack(u,l,a,1,g),o&&o.getRangeExtensionTime&&(d=o.getRangeExtensionTime())&&(s=Math.min(1e3*d,s)),p=Math.ceil(1.5*r),o&&o.getRangeExtensionCount&&(p+=o.getRangeExtensionCount()),p>0&&(s=_.alignPeriodsBack(u,m.resolution,m.interval,p,s)),{from:s,to:g+6e4}},u=function(e,t,i,n,o,r,s,a,l,c){if(this.listeners=e,this.isRecalculated=!1,""===n)return console.error("unsupported resolution for rebuild: "+i),void this.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=r;var h=this;this.engine=new m({tickerid:t,period:n,periodBase:i,body:o,sessionId:a,symbolInfo:r,rangeExtension:s,periodForInitialRange:l,additionalBarsCount:c,recalc:function(e,t){h._recalc(t)},out:function(e,t){h._out(e,t)},nonseriesOut:function(e,t){h._nonseriesOut(e,t)},setNoMoreData:function(){h.barset&&(h.barset.endOfData=!0)},onErrorCallback:function(e){h.listeners.onError(e)}})},u.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")},u.prototype._recalc=function(e){this.isRecalculated&&console.error("recalc called twice!"),this.barset||(this.barset=new g(this.symbolInfo)),e&&(this.barset.nextTime=e.nextTime,this.barset.endOfData=e.endOfData),this.listeners.fire(this.barset),this.isRecalculated=!0},u.prototype._nonseriesOut=function(e,t){var i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this.barset?this.barset.count():0,i.lastBar=this.barset?this.barset.bar(this.barset.count()-1):null,this.listeners.fire(i,!0)},u.prototype._out=function(e,t){var i,n,o,r,s,a,l,c=t[0];if(!isNaN(c)){if(i={time:c,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7],this.barset||(this.barset=new g(e.info)),(o=t[8])instanceof Array)for(r=0;r<o.length;r++)s=t[9],a=o[r],l={time:a,open:s,high:s,low:s,close:s,volume:0,updatetime:a},this.barset.add(l,!0),this.isRecalculated&&this.listeners.fire(this.barset);this.barset.add(i,n),this.barset.isBarClosed=n,this.isRecalculated&&this.listeners.fire(this.barset)}},d=function(){this.listeners=[]},d.prototype.listenersCount=function(){ o&&e.regular_session&&(e.session=e.regular_session);var s=u.calculateFromTo(e,c||n||i,t,l,h);u.subs=u.host.subscribe(e,r(i),s,function(e){u.listeners.fire(e)},function(e){u.listeners.onError(e)})},function(e){u.listeners.onError(e)})},h.prototype._createDWMAligner=function(e,i){var n=t.get_timezone(i.timezone),o=new _.Session;return o.init(n,i.session),f.newBarBuilder(e,o,o)},h.prototype.stop=function(){this.subs&&this.host.unsubscribe(this.subs)},h.prototype.calculateFromTo=function(e,i,n,o,r){var s,a,l,c,h,u,d,p,m=f.parsePeriod(i),y=(new Date).valueOf(),g=e.expired?t.cal_to_utc(t.get_timezone(e.timezone),new Date(1e3*e.expiration_date))||y:y;return""===m.resolution?(a=m.interval,l="D"):"S"===m.resolution?(a=10*m.interval,l=""):(c="D"===m.resolution?1:"W"===m.resolution?5:30,a=12*c*m.interval,l="M"),m.range?(a=m.range.interval,l=m.range.resolution):this.host.calculateHistoryDepth&&(h=this.host.calculateHistoryDepth(i,l,a))&&(a=h.intervalBack||a,l=void 0===h.resolutionBack?l:h.resolutionBack),u=e.sessionString||e.session,s=_.alignPeriodsBack(u,l,a,1,g),o&&o.getRangeExtensionTime&&(d=o.getRangeExtensionTime())&&(s=Math.min(1e3*d,s)),p=Math.ceil(1.5*r),o&&o.getRangeExtensionCount&&(p+=o.getRangeExtensionCount()),p>0&&(s=_.alignPeriodsBack(u,m.resolution,m.interval,p,s)),{from:s,to:g+6e4}},u=function(e,t,i,n,o,r,s,a,l,c){if(this.listeners=e,this.isRecalculated=!1,""===n)return console.error("unsupported resolution for rebuild: "+i),void this.listeners.onError("unsupported resolution for rebuild: "+i);this.symbolInfo=r;var h=this;this.engine=new m({tickerid:t,period:n,periodBase:i,body:o,sessionId:a,symbolInfo:r,rangeExtension:s,periodForInitialRange:l,additionalBarsCount:c,recalc:function(e,t){h._recalc(t)},out:function(e,t){h._out(e,t)},nonseriesOut:function(e,t){h._nonseriesOut(e,t)},setNoMoreData:function(){h.barset&&(h.barset.endOfData=!0)},onErrorCallback:function(e){h.listeners.onError(e)}})},u.prototype.stop=function(){this.engine?this.engine.stop():console.error("Internal library error 0x1")},u.prototype._recalc=function(e){this.isRecalculated&&console.error("recalc called twice!"),this.barset||(this.barset=new g(this.symbolInfo)),e&&(this.barset.nextTime=e.nextTime,this.barset.endOfData=e.endOfData),this.listeners.fire(this.barset),this.isRecalculated=!0},u.prototype._nonseriesOut=function(e,t){var i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this.barset?this.barset.count():0,i.lastBar=this.barset?this.barset.bar(this.barset.count()-1):null,this.listeners.fire(i,!0)},u.prototype._out=function(e,t){var i,n,o,r,s,a,l,c=t[0];if(!isNaN(c)){if(i={time:c,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7],this.barset||(this.barset=new g(e.info)),(o=t[8])instanceof Array)for(r=0;r<o.length;r++)s=t[9],a=o[r],l={time:a,open:s,high:s,low:s,close:s,volume:0,updatetime:a},this.barset.add(l,!0),this.isRecalculated&&this.listeners.fire(this.barset);this.barset.add(i,n),this.barset.isBarClosed=n,this.isRecalculated&&this.listeners.fire(this.barset)}},d=function(){
return this.listeners.reduce(function(e,t){return e+(t?1:0)},0)},d.prototype.addListener=function(e,t){this.listeners.push({dataListener:e,onErrorCallback:t}),this.barset&&e(this.barset),this.errorMsg&&t(this.errorMsg)},d.prototype.removeListener=function(e){var t,i=this.listeners.filter(function(t){return t.dataListener===e});0!==i.length&&(t=this.listeners.indexOf(i[0]),delete this.listeners[t])},d.prototype.onError=function(e){var t,i,n,o;for(this.errorMsg=e||"unspecified error",t=this.listeners,i=t.length,n=0;n<i;n++)(o=t[n])&&o.onErrorCallback&&o.onErrorCallback(e)},d.prototype.fire=function(e,t){var i,n,o,r;for(t||(this.barset=e),i=this.listeners,n=i.length,o=0;o<n;o++)(r=i[o])&&r.dataListener(e)},{setupFeed:c,parseSymbol:l,unsubscribeUnused:function(){e.instance.removeUnused()}}}();e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"HeikenAshi",function(){return o}),n=i(25),i.n(n),o=function(){function e(){}return e.prototype.main=function(e){var t,i,o,r,s=e.new_var(n.Std.open(e)),a=e.new_var(n.Std.close(e)),l=s.get(1),c=a.get(1),h=n.Std.ohlc4(e),u=n.Std.na(s.get(1))?(n.Std.open(e)+n.Std.close(e))/2:(l+c)/2;return s.set(u),a.set(h),t=n.Std.max(n.Std.high(e),n.Std.max(u,h)),i=n.Std.min(n.Std.low(e),n.Std.min(u,h)),o=n.Std.volume(e),r=e.symbol,[r.time,u,t,i,h,o,r.updatetime,r.isBarClosed]},e}()},function(e,t,i){"use strict";var n=function(){function e(e,t,i){return e+","+t+","+i}function t(t,i,n){delete o[e(t,i,n)]}function n(t,i,n){function s(e){return"undefined"!=typeof TradingView&&TradingView.ChartapiMessagerInstances?o[e]=new a(TradingView.ChartapiMessagerInstances[t],l.pureResolution):o[e]=new a(null,l.pureResolution),o[e]}var l=r.Symbol.parsePeriod(n),c=e(t,i,l.pureResolution);return o[c]?o[c]:s(c)}var o={},r=i(25),s=i(37),a=function(e,t,i){this._chartApiMessager=e,this._lastRealBarTime=null,this._lastRealBarIndex=null,this._resolution=t,this._extrapolatedBarsCache=[],this._onReadyCallbacks=[],this._requestedAmountOfBars=0,this._maxDepth=i||100};return a.prototype.ready=function(){return null!==this._lastRealBarIndex},a.prototype.rebuild=function(e,t){this._lastRealBarTime=e;var i=Math.max(this._extrapolatedBarsCache.length,this._requestedAmountOfBars);this._extrapolatedBarsCache=[],this.ensureExtrapolatedToBar(t,i)},a.prototype.historyExtrapolator=function(){return void 0===this._historyExtrapolator&&(this._historyExtrapolator=new a(null,this._resolution,Math.max(this._maxDepth,1500))),this._historyExtrapolator},a.prototype.getPointTimeUTC=function(e,t,i){var n,o;return 0===t?e:!this.ready()||e<this._lastRealBarTime/1e3?(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().getPointTimeUTC(e,t,i)):(n=0===this._extrapolatedBarsCache.length||e===this._lastRealBarTime/1e3,o=n?-1:this.indexOfBar(e,i)-this._lastRealBarIndex-1,this.ensureExtrapolatedToBar(i,o+t+1),this._extrapolatedBarsCache[o+t])},a.prototype.findDistanceInBars=function(e,t,i){return e===t?0:(this.historyExtrapolator().setLastBarTime(0,1e3*e), this.listeners=[]},d.prototype.listenersCount=function(){return this.listeners.reduce(function(e,t){return e+(t?1:0)},0)},d.prototype.addListener=function(e,t){this.listeners.push({dataListener:e,onErrorCallback:t}),this.barset&&e(this.barset),this.errorMsg&&t(this.errorMsg)},d.prototype.removeListener=function(e){var t,i=this.listeners.filter(function(t){return t.dataListener===e});0!==i.length&&(t=this.listeners.indexOf(i[0]),delete this.listeners[t])},d.prototype.onError=function(e){var t,i,n,o;for(this.errorMsg=e||"unspecified error",t=this.listeners,i=t.length,n=0;n<i;n++)(o=t[n])&&o.onErrorCallback&&o.onErrorCallback(e)},d.prototype.fire=function(e,t){var i,n,o,r;for(t||(this.barset=e),i=this.listeners,n=i.length,o=0;o<n;o++)(r=i[o])&&r.dataListener(e)},{setupFeed:c,parseSymbol:l,unsubscribeUnused:function(){e.instance.removeUnused()}}}();e.exports=r}).call(t,i(35))},function(e,t,i){"use strict";var n,o;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"HeikenAshi",function(){return o}),n=i(25),i.n(n),o=function(){function e(){}return e.prototype.main=function(e){var t,i,o,r,s=e.new_var(n.Std.open(e)),a=e.new_var(n.Std.close(e)),l=s.get(1),c=a.get(1),h=n.Std.ohlc4(e),u=n.Std.na(s.get(1))?(n.Std.open(e)+n.Std.close(e))/2:(l+c)/2;return s.set(u),a.set(h),t=n.Std.max(n.Std.high(e),n.Std.max(u,h)),i=n.Std.min(n.Std.low(e),n.Std.min(u,h)),o=n.Std.volume(e),r=e.symbol,[r.time,u,t,i,h,o,r.updatetime,r.isBarClosed]},e}()},function(e,t,i){"use strict";var n=function(){function e(e,t,i){return e+","+t+","+i}function t(t,i,n){delete o[e(t,i,n)]}function n(t,i,n){function s(e){return"undefined"!=typeof TradingView&&TradingView.ChartapiMessagerInstances?o[e]=new a(TradingView.ChartapiMessagerInstances[t],l.pureResolution):o[e]=new a(null,l.pureResolution),o[e]}var l=r.Symbol.parsePeriod(n),c=e(t,i,l.pureResolution);return o[c]?o[c]:s(c)}var o={},r=i(25),s=i(37),a=function(e,t,i){this._chartApiMessager=e,this._lastRealBarTime=null,this._lastRealBarIndex=null,this._resolution=t,this._extrapolatedBarsCache=[],this._onReadyCallbacks=[],this._requestedAmountOfBars=0,this._maxDepth=i||100};return a.prototype.ready=function(){return null!==this._lastRealBarIndex},a.prototype.rebuild=function(e,t){this._lastRealBarTime=e;var i=Math.max(this._extrapolatedBarsCache.length,this._requestedAmountOfBars);this._extrapolatedBarsCache=[],this.ensureExtrapolatedToBar(t,i)},a.prototype.historyExtrapolator=function(){return void 0===this._historyExtrapolator&&(this._historyExtrapolator=new a(null,this._resolution,Math.max(this._maxDepth,1500))),this._historyExtrapolator},a.prototype.getPointTimeUTC=function(e,t,i){var n,o;return 0===t?e:!this.ready()||e<this._lastRealBarTime/1e3?(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().getPointTimeUTC(e,t,i)):(n=0===this._extrapolatedBarsCache.length||e===this._lastRealBarTime/1e3,o=n?-1:this.indexOfBar(e,i)-this._lastRealBarIndex-1,this.ensureExtrapolatedToBar(i,o+t+1),this._extrapolatedBarsCache[o+t])},a.prototype.findDistanceInBars=function(e,t,i){
this.historyExtrapolator().indexOfBar(t,i))},a.prototype.indexOfBar=function(e,t){this._ensureExtrapolatedToTime(t,1e3*e);var i=s.lower_bound(this._extrapolatedBarsCache,e,function(e,t){return e>t?1:e<t?-1:0});return-1===i?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(e,t){var i,n,o;if(!this._lastRealBarTime)throw Error("No real bars known, so cannot extrapolate anything");if(!(i=t(this._lastRealBarTime))||0===i.length)return void(null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,this._extrapolatedBarsCache,e,this._resolution));for(n=0;n<i.length;++n)i[n]=i[n]/1e3;for(i[0]===this._lastRealBarTime/1e3&&(i=i.slice(1)),this._extrapolatedBarsCache=i,o=i.slice(0),o.sort(),n=0;n<o.length-1;++n)o[n]===o[n+1]&&console.error("Duplicating extrapolated bars: duplicated "+new Date(1e3*o[n]));null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,i,e,this._resolution)},a.prototype.onTickmarksNeeded=function(e,t){if(this.ready())this.ensureExtrapolatedToBar(e,t);else{var i=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(e,t)})}},a.prototype.ensureExtrapolatedToBar=function(e,t){var i=this;return this._requestedAmountOfBars=t,this._extrapolateData(e,function(n){return i._extrapolatedBarsCache.length>=t||!i._shouldExtrapolateMore()?null:s.extrapolateBarsFrontByCount(i.newBarBuilder(e),n,t)})},a.prototype._ensureExtrapolatedToTime=function(e,t){var i=this;return this._extrapolateData(e,function(n){var o,r;return n>=t||!i._shouldExtrapolateMore()?null:(o=2e3,r=s.extrapolateBarsFrontToTime(i.newBarBuilder(e),n,t,o),r[r.length-1]<t&&console.warn("Extrapolation error: not enough data created"),r)})},a.prototype.newBarBuilder=function(e){var t=r.Symbol.newSession(e.timezone,e.session);return r.Symbol.newBarBuilder(this._resolution,t)},a.prototype._shouldExtrapolateMore=function(){return this._extrapolatedBarsCache.length<this._maxDepth},a.prototype.setLastBarTime=function(e,t){(null===this._lastRealBarIndex||this._lastRealBarIndex===e&&this._lastRealBarTime!==t)&&(this._extrapolatedBarsCache=[]),this._extrapolatedBarsCache&&this._extrapolatedBarsCache.length&&this._lastRealBarIndex!==e&&(this._lastRealBarIndex>e?this._extrapolatedBarsCache=[]:this._lastRealBarTime!==t&&this._extrapolatedBarsCache.shift(e-this._lastRealBarIndex)),this._lastRealBarIndex=e,this._lastRealBarTime=t;for(var i=0;i<this._onReadyCallbacks.length;++i)this._onReadyCallbacks[i]();this._onReadyCallbacks=[]},{remove:t,storage:n}}();e.exports=n},function(e,t,i){"use strict";(function(t){var n=i(37),o=i(15).Interval,r=function(){function e(e,t){return e}function r(e,t){var i=m.get_timezone(e.timezone),o=new n.Session;return o.init(i,e.session),f.Symbol.newBarBuilder(t,o,o)}function s(t,i,n,o,r,s){var a,l,c,h,u=e(i,n);for(p.hasOwnProperty(u)||(p[u]=[]),a=[],l=0;l<o.length;++l)o[l][1]<0&&(o[l][1]=0),0!==o[l][1]?(c=r.getPointTimeUTC(o[l][0],o[l][1],s), return e===t?0:(this.historyExtrapolator().setLastBarTime(0,1e3*e),this.historyExtrapolator().indexOfBar(t,i))},a.prototype.indexOfBar=function(e,t){this._ensureExtrapolatedToTime(t,1e3*e);var i=s.lower_bound(this._extrapolatedBarsCache,e,function(e,t){return e>t?1:e<t?-1:0});return-1===i?i:this._lastRealBarIndex+i+1},a.prototype._extrapolateData=function(e,t){var i,n,o;if(!this._lastRealBarTime)throw Error("No real bars known, so cannot extrapolate anything");if(!(i=t(this._lastRealBarTime))||0===i.length)return void(null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,this._extrapolatedBarsCache,e,this._resolution));for(n=0;n<i.length;++n)i[n]=i[n]/1e3;for(i[0]===this._lastRealBarTime/1e3&&(i=i.slice(1)),this._extrapolatedBarsCache=i,o=i.slice(0),o.sort(),n=0;n<o.length-1;++n)o[n]===o[n+1]&&console.error("Duplicating extrapolated bars: duplicated "+new Date(1e3*o[n]));null!==this._lastRealBarIndex&&null!==this._chartApiMessager&&this._chartApiMessager.onTickmarksUpdated(this._lastRealBarIndex+1,i,e,this._resolution)},a.prototype.onTickmarksNeeded=function(e,t){if(this.ready())this.ensureExtrapolatedToBar(e,t);else{var i=this;this._onReadyCallbacks.push(function(){i.ensureExtrapolatedToBar(e,t)})}},a.prototype.ensureExtrapolatedToBar=function(e,t){var i=this;return this._requestedAmountOfBars=t,this._extrapolateData(e,function(n){return i._extrapolatedBarsCache.length>=t||!i._shouldExtrapolateMore()?null:s.extrapolateBarsFrontByCount(i.newBarBuilder(e),n,t)})},a.prototype._ensureExtrapolatedToTime=function(e,t){var i=this;return this._extrapolateData(e,function(n){var o,r;return n>=t||!i._shouldExtrapolateMore()?null:(o=2e3,r=s.extrapolateBarsFrontToTime(i.newBarBuilder(e),n,t,o),r[r.length-1]<t&&console.warn("Extrapolation error: not enough data created"),r)})},a.prototype.newBarBuilder=function(e){var t=r.Symbol.newSession(e.timezone,e.session);return r.Symbol.newBarBuilder(this._resolution,t)},a.prototype._shouldExtrapolateMore=function(){return this._extrapolatedBarsCache.length<this._maxDepth},a.prototype.setLastBarTime=function(e,t){(null===this._lastRealBarIndex||this._lastRealBarIndex===e&&this._lastRealBarTime!==t)&&(this._extrapolatedBarsCache=[]),this._extrapolatedBarsCache&&this._extrapolatedBarsCache.length&&this._lastRealBarIndex!==e&&(this._lastRealBarIndex>e?this._extrapolatedBarsCache=[]:this._lastRealBarTime!==t&&this._extrapolatedBarsCache.shift(e-this._lastRealBarIndex)),this._lastRealBarIndex=e,this._lastRealBarTime=t;for(var i=0;i<this._onReadyCallbacks.length;++i)this._onReadyCallbacks[i]();this._onReadyCallbacks=[]},{remove:t,storage:n}}();e.exports=n},function(e,t,i){"use strict";(function(t){var n=i(37),o=i(15).Interval,r=function(){function e(e,t){return e}function r(e,t){var i=m.get_timezone(e.timezone),o=new n.Session;return o.init(i,e.session),f.Symbol.newBarBuilder(t,o,o)}function s(t,i,n,o,r,s){var a,l,c,h,u=e(i,n);for(p.hasOwnProperty(u)||(p[u]=[]),a=[],l=0;l<o.length;++l)o[l][1]<0&&(o[l][1]=0),
a.push(c)):o[l][0]&&a.push(o[l][0]);h={guid:t,points:a},p[u].push(h)}function a(e){var t,i,n;for(t in p)for(i=p[t],n=0;n<i.length;++n)if(i[n].guid===e)return void i.splice(n,1)}function l(e,t,i,n,o){var r,s,a,l=[];for(r=0;r<e.points.length;++r){if(null==(s=e.points[r]))return null;if(null===(a=h(t,s,i,n,o)))return null;l.push({index:r,value:[a,s]})}return l}function c(t,i,n,o,r,s){var a,c,h,u,d=e(t,i);if(p.hasOwnProperty(d))for(a=p[d].length,c=0;c<a;++c)h=p[d][c],null!==(u=l(h,n,o,r,i))&&s(h.guid,u)}function h(e,t,i,o,s){var a,l;return 1e3*(t=r(o,s).alignTimeIfPossible(1e3*t)/1e3)<e[0].value[0]?-d(o,s,t,e[0].value[0]/1e3,i):(a=n.lower_bound(e,1e3*t,function(e,t){return e.value[0]>t?1:e.value[0]<t?-1:0}))>=0&&t<e[e.length-1].value[0]?(e[a].value[0]/1e3!==t&&0!==a&&a--,e[a].index):(l=i.indexOfBar(t,o),-1===l?null:l)}function u(e,t,i,n,o){function r(e,t){var i=new Date(1e3*e),n=new Date(1e3*t),o=12*(n.getFullYear()-i.getFullYear());return o-=i.getMonth()+1,o+=n.getMonth(),o<=0?0:o}var s,a,l,c,h,u,d,p,_,f,y,g,v,S,b;if(t.isMonths())s=r(n,o)/t.multiplier();else if(t.isWeeks())a=Math.ceil((o-n)/604800),s=Math.ceil(a/t.multiplier());else{if(l=m.utc_to_cal(i.timezone,+new Date(1e3*n)),c=m.utc_to_cal(i.timezone,+new Date(1e3*o)),(h=(o-n)/86400)>4*(7-i.spec.weekEndsCount()))d=h/7,u=d*(7-i.spec.weekEndsCount());else{for(p=0,_={},f=l;f.valueOf()<=c.valueOf();f=m.add_days_considering_dst(i.timezone,f,1))y=m.get_day_of_week(f),void 0===_[y]&&(_[y]=i.spec.isWeekEnd(y)),_[y]&&p++;u=h-p}if(t.isDays())s=Math.ceil(u/t.multiplier());else{if(g=t.isHours()?60*t.multiplier()*60:t.isSeconds()?t.multiplier():60*t.multiplier(),h<1&&(v=i.spec.findSessionEntry(m.get_day_of_week(l),m.get_minutes_from_midnight(l)),S=i.spec.findSessionEntry(m.get_day_of_week(c),m.get_minutes_from_midnight(c)),v===S))return Math.ceil((o-n)/g);y=i.spec.entries()[0].dayOfWeek(),b=60*i.spec.entries().reduce(function(e,t){return e+(t.dayOfWeek()===y?t.length():0)},0),s=Math.ceil(u*b/g)}}return s}function d(e,t,i,s,a){var l,c,h=new o(t),d=m.get_timezone(e.timezone),p=new n.Session;return p.init(d,e.session),l=r(e,t),i=l.alignTimeIfPossible(1e3*i)/1e3,s=l.alignTimeIfPossible(1e3*s)/1e3,i>=s?0:(c=u(e,h,p,i,s),c>=1e3?c:a.findDistanceInBars(i,s,e))}var p={},_="undefined"!=typeof window?window:t,f=i(25),m=_.PineJsCalendar?_.PineJsCalendar:i(35);return{createPointset:s,removePointset:a,broadcastPointsetsUpdates:c,tests:{approxBarsInterval:u,indexOfTime:h}}}();e.exports=r}).call(t,i(99))},function(e,t,i){"use strict";function n(e,t,i){return Object(a.isArray)(e)?o(e,t,i):Object(a.isObject)(e)&&(Object(a.isHashObject)(e)||i&&i.visitInstances)?r(e,t,i):e}function o(e,t,i){return e.map(function(e){var o=n(e,t,i),r=t(o);return void 0!==r?r:o})}function r(e,t,i){var o={};return Object.keys(e).forEach(function(r){var s=n(e[r],t,i),a=t(s);o[r]=void 0!==a?a:s}),o}function s(e,t,i){var o=n(e,t,i),r=t(o);return void 0!==r?r:o}var a;Object.defineProperty(t,"__esModule",{value:!0}),t.visitObject=s,a=i(12),i.n(a)},function(e,t,i){"use strict";function n(e,t){return e.ticker+"_"+t} 0!==o[l][1]?(c=r.getPointTimeUTC(o[l][0],o[l][1],s),a.push(c)):o[l][0]&&a.push(o[l][0]);h={guid:t,points:a},p[u].push(h)}function a(e){var t,i,n;for(t in p)for(i=p[t],n=0;n<i.length;++n)if(i[n].guid===e)return void i.splice(n,1)}function l(e,t,i,n,o){var r,s,a,l=[];for(r=0;r<e.points.length;++r){if(null==(s=e.points[r]))return null;if(null===(a=h(t,s,i,n,o)))return null;l.push({index:r,value:[a,s]})}return l}function c(t,i,n,o,r,s){var a,c,h,u,d=e(t,i);if(p.hasOwnProperty(d))for(a=p[d].length,c=0;c<a;++c)h=p[d][c],null!==(u=l(h,n,o,r,i))&&s(h.guid,u)}function h(e,t,i,o,s){var a,l;return 1e3*(t=r(o,s).alignTimeIfPossible(1e3*t)/1e3)<e[0].value[0]?-d(o,s,t,e[0].value[0]/1e3,i):(a=n.lower_bound(e,1e3*t,function(e,t){return e.value[0]>t?1:e.value[0]<t?-1:0}))>=0&&t<e[e.length-1].value[0]?(e[a].value[0]/1e3!==t&&0!==a&&a--,e[a].index):(l=i.indexOfBar(t,o),-1===l?null:l)}function u(e,t,i,n,o){function r(e,t){var i=new Date(1e3*e),n=new Date(1e3*t),o=12*(n.getFullYear()-i.getFullYear());return o-=i.getMonth()+1,o+=n.getMonth(),o<=0?0:o}var s,a,l,c,h,u,d,p,_,f,y,g,v,S,b;if(t.isMonths())s=r(n,o)/t.multiplier();else if(t.isWeeks())a=Math.ceil((o-n)/604800),s=Math.ceil(a/t.multiplier());else{if(l=m.utc_to_cal(i.timezone,+new Date(1e3*n)),c=m.utc_to_cal(i.timezone,+new Date(1e3*o)),(h=(o-n)/86400)>4*(7-i.spec.weekEndsCount()))d=h/7,u=d*(7-i.spec.weekEndsCount());else{for(p=0,_={},f=l;f.valueOf()<=c.valueOf();f=m.add_days_considering_dst(i.timezone,f,1))y=m.get_day_of_week(f),void 0===_[y]&&(_[y]=i.spec.isWeekEnd(y)),_[y]&&p++;u=h-p}if(t.isDays())s=Math.ceil(u/t.multiplier());else{if(g=t.isHours()?60*t.multiplier()*60:t.isSeconds()?t.multiplier():60*t.multiplier(),h<1&&(v=i.spec.findSessionEntry(m.get_day_of_week(l),m.get_minutes_from_midnight(l)),S=i.spec.findSessionEntry(m.get_day_of_week(c),m.get_minutes_from_midnight(c)),v===S))return Math.ceil((o-n)/g);y=i.spec.entries()[0].dayOfWeek(),b=60*i.spec.entries().reduce(function(e,t){return e+(t.dayOfWeek()===y?t.length():0)},0),s=Math.ceil(u*b/g)}}return s}function d(e,t,i,s,a){var l,c,h=new o(t),d=m.get_timezone(e.timezone),p=new n.Session;return p.init(d,e.session),l=r(e,t),i=l.alignTimeIfPossible(1e3*i)/1e3,s=l.alignTimeIfPossible(1e3*s)/1e3,i>=s?0:(c=u(e,h,p,i,s),c>=1e3?c:a.findDistanceInBars(i,s,e))}var p={},_="undefined"!=typeof window?window:t,f=i(25),m=_.PineJsCalendar?_.PineJsCalendar:i(35);return{createPointset:s,removePointset:a,broadcastPointsetsUpdates:c,tests:{approxBarsInterval:u,indexOfTime:h}}}();e.exports=r}).call(t,i(99))},function(e,t,i){"use strict";function n(e,t,i){return Object(a.isArray)(e)?o(e,t,i):Object(a.isObject)(e)&&(Object(a.isHashObject)(e)||i&&i.visitInstances)?r(e,t,i):e}function o(e,t,i){return e.map(function(e){var o=n(e,t,i),r=t(o);return void 0!==r?r:o})}function r(e,t,i){var o={};return Object.keys(e).forEach(function(r){var s=n(e[r],t,i),a=t(s);o[r]=void 0!==a?a:s}),o}function s(e,t,i){var o=n(e,t,i),r=t(o);return void 0!==r?r:o}var a;Object.defineProperty(t,"__esModule",{value:!0}),t.visitObject=s,a=i(12),i.n(a)},function(e,t,i){
function o(e){return new Date(e).toISOString()}var r,s,a,l,c,h;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DatafeedRequestsCachedProcessor",function(){return h}),r=i(15),s=i(78),a=i(25),i.n(a),l=i(5),i.n(l),i(86),c=function(){function e(e,t,i,n){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._datafeed=e,this._symbolInfo=t,this._resolution=i,this._dwmAligner=n}return e.prototype.destroy=function(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed},e.prototype.addSubscription=function(e,t,i){var n=this,o=this._getNextSubscriptionId(),r=Math.floor(e.from/1e3),s=Math.floor(e.to/1e3);return this._pendingSubscribers.push({key:o,range:{from:r,to:s},onHistoryCallback:t,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){return n._processPendingSubscribers()},0),o},e.prototype.removeSubscription=function(e){var t,i=this,n=this._pendingSubscribers.find(function(t){return t.key===e});return n?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(n),1):(t=this._subscribers.find(function(t){return t.key===e}))?(this._subscribers.splice(this._subscribers.indexOf(t),1),void(this._subscribers.length||(this._symbolInfo.expired||this._symbolInfo.expiration_date?this._unsubscribeRealtime():this._resetCacheTimeout=setTimeout(function(){i._purgeCacheDelayed(),i._unsubscribeRealtime()})))):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._purgeCacheDelayed=function(){this._logMessage("Reset cache"),this._needPurgeCache=!0,this._clearResetCacheTimeout()},e.prototype._logMessage=function(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._clearResetCacheTimeout=function(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)},e.prototype._purgeCache=function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1},e.prototype._processPendingSubscribers=function(){var e,t,i,n,s,a,l=this,c=this._pendingSubscribers;if(c.length){if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage("Processing pending subscribers, count="+c.length),this._needPurgeCache&&this._purgeCache(),this._errorMessage)return e=this._errorMessage,this._logMessage("Return error: "+e),this._pendingSubscribers=[],void c.forEach(function(t){t.onErrorCallback(e)});if(t=c.reduce(function(e,t){return Math.min(t.range.from,e)},1/0),this._logMessage('Leftmost requested "from" is '+o(1e3*t)), "use strict";function n(e,t){return e.ticker+"_"+t}function o(e){return new Date(e).toISOString()}var r,s,a,l,c,h;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"DatafeedRequestsCachedProcessor",function(){return h}),r=i(15),s=i(78),a=i(25),i.n(a),l=i(5),i.n(l),i(86),c=function(){function e(e,t,i,n){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._gaps=[],this._needPurgeCache=!1,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._datafeed=e,this._symbolInfo=t,this._resolution=i,this._dwmAligner=n}return e.prototype.destroy=function(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed},e.prototype.addSubscription=function(e,t,i){var n=this,o=this._getNextSubscriptionId(),r=Math.floor(e.from/1e3),s=Math.floor(e.to/1e3);return this._pendingSubscribers.push({key:o,range:{from:r,to:s},onHistoryCallback:t,onErrorCallback:i}),this._clearResetCacheTimeout(),setTimeout(function(){return n._processPendingSubscribers()},0),o},e.prototype.removeSubscription=function(e){var t,i=this,n=this._pendingSubscribers.find(function(t){return t.key===e});return n?void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(n),1):(t=this._subscribers.find(function(t){return t.key===e}))?(this._subscribers.splice(this._subscribers.indexOf(t),1),void(this._subscribers.length||(this._symbolInfo.expired||this._symbolInfo.expiration_date?this._unsubscribeRealtime():this._resetCacheTimeout=setTimeout(function(){i._purgeCacheDelayed(),i._unsubscribeRealtime()})))):void console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._purgeCacheDelayed=function(){this._logMessage("Reset cache"),this._needPurgeCache=!0,this._clearResetCacheTimeout()},e.prototype._logMessage=function(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log("FEED [{0}|{1}]: {2}".format(this._symbolInfo.name,this._resolution,e))},e.prototype._clearResetCacheTimeout=function(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)},e.prototype._purgeCache=function(){this._cache={bars:[]},this._gaps=[],this._errorMessage=null,this._needPurgeCache=!1,this._leftDate=null,this._endOfData=!1},e.prototype._processPendingSubscribers=function(){var e,t,i,n,s,a,l=this,c=this._pendingSubscribers;if(c.length){if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage("Processing pending subscribers, count="+c.length),this._needPurgeCache&&this._purgeCache(),this._errorMessage)return e=this._errorMessage,this._logMessage("Return error: "+e),this._pendingSubscribers=[],void c.forEach(function(t){t.onErrorCallback(e)});if(t=c.reduce(function(e,t){return Math.min(t.range.from,e)},1/0),
(!this._leftDate||t<this._leftDate)&&(i=new r.Interval(this._resolution),n=(i.inMilliseconds(Date.now())||0)/1e3,s=!this._leftDate,a=!s&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t<n,(s||!a)&&!this._endOfData))return void this._ensureRequestedTo(t);this._pendingSubscribers=[],c.forEach(function(e){var t=l._moveSubscriberToRealtime(e);l._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()}},e.prototype._moveSubscriberToRealtime=function(e){var t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t},e.prototype._subscribeRealtimeIfNeeded=function(){!this._subscribers.length||this._realtimeOn||this._symbolInfo.expired||this._symbolInfo.expiration_date||this._subscribeRealtime()},e.prototype._subscribeRealtime=function(){var e,t,i=this;this._symbolInfo.expired||this._realtimeOn||(e=function(e){i._dwmAligner&&(e.time=i._dwmAligner.tradingDayToSessionStart(e.time)),i._putToCacheNewBar(e),i._subscribers.forEach(function(t){var i=t.barset;if(null===i)throw Error("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},t=function(){i._unsubscribeRealtime();var e=i._leftDate;i._purgeCache(),e&&i._ensureRequestedTo(e)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,e,n(this._symbolInfo,this._resolution),t),this._logMessage("Subscribed to realtime"))},e.prototype._unsubscribeRealtime=function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(n(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)},e.prototype._returnHistoryDataToSubscriber=function(e,t){var i,n,r=e.range,s=l.enabled("cl_feed_return_all_data")?this._createBarset(this._leftDate||r.from):this._createBarset(r.from);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),o(s.bars[0].time),o(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,i=this._inGapNextTime(r.from),i?(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*i))),s.nextTime=i):0===s.count()&&(n=this._cache.bars.length&&this._cache.bars[this._cache.bars.length-1].time/1e3)&&r.from>n&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*n))),s.nextTime=n||void 0),this._endOfData&&null!==this._leftDate&&e.range.from<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)},e.prototype._createBarset=function(e){var t=Object(s.lowerbound)(this._cache.bars,1e3*e,function(e,t){return e.time<t});return new a.BarSet(this._symbolInfo,this._cache.bars.slice(t))},e.prototype._ensureRequestedTo=function(t){var i,n,r,s=this;if(this._leftDate&&this._leftDate<t)return void this._processPendingSubscribers();i=!this._leftDate,this._requesting=!0,n=t,r=this._leftDate?this._leftDate-1:this._symbolInfo.expiration_date||Math.floor(e._now()/1e3),this._leftDate=t,this._logMessage("Requesting data: [{0} ... {1}] ".format(o(1e3*n),o(1e3*r))), this._logMessage('Leftmost requested "from" is '+o(1e3*t)),(!this._leftDate||t<this._leftDate)&&(i=new r.Interval(this._resolution),n=(i.inMilliseconds(Date.now())||0)/1e3,s=!this._leftDate,a=!s&&!!this._cache.bars.length&&this._cache.bars[0].time/1e3-t<n,(s||!a)&&!this._endOfData))return void this._ensureRequestedTo(t);this._pendingSubscribers=[],c.forEach(function(e){var t=l._moveSubscriberToRealtime(e);l._returnHistoryDataToSubscriber(e,t)}),this._subscribeRealtimeIfNeeded()}},e.prototype._moveSubscriberToRealtime=function(e){var t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t},e.prototype._subscribeRealtimeIfNeeded=function(){!this._subscribers.length||this._realtimeOn||this._symbolInfo.expired||this._symbolInfo.expiration_date||this._subscribeRealtime()},e.prototype._subscribeRealtime=function(){var e,t,i=this;this._symbolInfo.expired||this._realtimeOn||(e=function(e){i._dwmAligner&&(e.time=i._dwmAligner.tradingDayToSessionStart(e.time)),i._putToCacheNewBar(e),i._subscribers.forEach(function(t){var i=t.barset;if(null===i)throw Error("subscirber.barset is null");i.add(e),t.onHistoryCallback(i)})},t=function(){i._unsubscribeRealtime();var e=i._leftDate;i._purgeCache(),e&&i._ensureRequestedTo(e)},this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,e,n(this._symbolInfo,this._resolution),t),this._logMessage("Subscribed to realtime"))},e.prototype._unsubscribeRealtime=function(){!this._symbolInfo.expired&&this._realtimeOn&&(this._datafeed.unsubscribeBars(n(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)},e.prototype._returnHistoryDataToSubscriber=function(e,t){var i,n,r=e.range,s=l.enabled("cl_feed_return_all_data")?this._createBarset(this._leftDate||r.from):this._createBarset(r.from);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),o(s.bars[0].time),o(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,i=this._inGapNextTime(r.from),i?(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*i))),s.nextTime=i):0===s.count()&&(n=this._cache.bars.length&&this._cache.bars[this._cache.bars.length-1].time/1e3)&&r.from>n&&(this._logMessage("Request {0} is in gap, nextTime = {1}".format(e.key,o(1e3*n))),s.nextTime=n||void 0),this._endOfData&&null!==this._leftDate&&e.range.from<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)},e.prototype._createBarset=function(e){var t=Object(s.lowerbound)(this._cache.bars,1e3*e,function(e,t){return e.time<t});return new a.BarSet(this._symbolInfo,this._cache.bars.slice(t))},e.prototype._ensureRequestedTo=function(t){var i,n,r,s=this;if(this._leftDate&&this._leftDate<t)return void this._processPendingSubscribers();i=!this._leftDate,this._requesting=!0,n=t,r=this._leftDate?this._leftDate-1:this._symbolInfo.expiration_date||Math.floor(e._now()/1e3),this._leftDate=t,
this._datafeed.getBars(this._symbolInfo,this._resolution,n,r,function(e,t){s._requesting=!1,s._processBars(e,t)},function(e){s._requesting=!1,s._errorMessage=e||null,s._processPendingSubscribers()},i)},e.prototype._processBars=function(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?this._processFullBarset(e,t):this._processEmptyBarset(t),this._processPendingSubscribers()},e.prototype._processEmptyBarset=function(t){this._logMessage("Receiving bars: barset is empty"),t&&t.nextTime?(this._logMessage("Next time received: `{0}`".format(o(1e3*t.nextTime))),this._addGap(t.nextTime),this._leftDate=Math.min(this._leftDate||e._now()/1e3,t.nextTime+1)):t&&t.noData?(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3)):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned")},e.prototype._processFullBarset=function(e,t){var i=e[0].time,n=e[e.length-1].time;this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(e.length,o(i),o(n))),null!==this._leftDate&&i<1e3*this._leftDate&&!l.enabled("cl_feed_return_all_data")&&this._logMessage("Returned more data than needed"),this._putToCache(e)?null!==this._leftDate&&this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")},e.prototype._addGap=function(t){var i;this._gaps.find(function(e){return e.from===t})||(i=(this._cache.bars.length?this._cache.bars[0].time:e._now())/1e3,this._gaps.push({from:t,to:i}))},e.prototype._inGapNextTime=function(e){var t=this._gaps.find(function(t){return t.from<e&&t.to>e});return t?t.from:null},e.prototype._getNextSubscriptionId=function(){return this._nextSubscriptionId++},e.prototype._checkBars=function(e,t){var i,n;if(void 0===t&&(t=!1),l.enabled("charting_library_debug_mode"))for(i=1;i<e.length;i++)e[i].time<=e[i-1].time&&(n="Wrong bars time: time {0} of bar {1} should be more than time {2} of bar {3}".format(e[i].time,i,e[i-1].time,i-1),t&&this._dwmAligner&&(n+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),console.error(n))},e.prototype._putToCache=function(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){var t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time this._logMessage("Requesting data: [{0} ... {1}] ".format(o(1e3*n),o(1e3*r))),this._datafeed.getBars(this._symbolInfo,this._resolution,n,r,function(e,t){s._requesting=!1,s._processBars(e,t)},function(e){s._requesting=!1,s._errorMessage=e||null,s._processPendingSubscribers()},i)},e.prototype._processBars=function(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?this._processFullBarset(e,t):this._processEmptyBarset(t),this._processPendingSubscribers()},e.prototype._processEmptyBarset=function(t){this._logMessage("Receiving bars: barset is empty"),t&&t.nextTime?(this._logMessage("Next time received: `{0}`".format(o(1e3*t.nextTime))),this._addGap(t.nextTime),this._leftDate=Math.min(this._leftDate||e._now()/1e3,t.nextTime+1)):t&&t.noData?(this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._cache.bars[0].time/1e3)):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned")},e.prototype._processFullBarset=function(e,t){var i=e[0].time,n=e[e.length-1].time;this._logMessage("Receiving bars: total {0} bars in [{1} ... {2}] ".format(e.length,o(i),o(n))),null!==this._leftDate&&i<1e3*this._leftDate&&!l.enabled("cl_feed_return_all_data")&&this._logMessage("Returned more data than needed"),this._putToCache(e)?null!==this._leftDate&&this._cache.bars.length&&this._leftDate>this._cache.bars[0].time/1e3&&(this._leftDate=this._cache.bars[0].time/1e3):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&console.warn("noData should be set when there is no data in the requested period and earlier only")},e.prototype._addGap=function(t){var i;this._gaps.find(function(e){return e.from===t})||(i=(this._cache.bars.length?this._cache.bars[0].time:e._now())/1e3,this._gaps.push({from:t,to:i}))},e.prototype._inGapNextTime=function(e){var t=this._gaps.find(function(t){return t.from<e&&t.to>e});return t?t.from:null},e.prototype._getNextSubscriptionId=function(){return this._nextSubscriptionId++},e.prototype._checkBars=function(e,t){var i,n;if(void 0===t&&(t=!1),l.enabled("charting_library_debug_mode"))for(i=1;i<e.length;i++)e[i].time<=e[i-1].time&&(n="Wrong bars time: time {0} of bar {1} should be more than time {2} of bar {3}".format(e[i].time,i,e[i-1].time,i-1),t&&this._dwmAligner&&(n+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),console.error(n))},e.prototype._putToCache=function(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){
;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=e.concat(this._cache.bars),this._checkBars(this._cache.bars,!0),!0},e.prototype._putToCacheNewBar=function(e){var t=this._cache.bars.length,i=e.time,n=0===t?NaN:this._cache.bars[t-1].time;0===t||n<i?this._cache.bars.push(e):n===i?this._cache.bars[t-1]=e:console.error("putToCacheNewBar: time violation, previous bar time: "+o(n)+" should be less or equal to new time: "+o(i))},e.prototype._alignBarsTime=function(e){if(this._dwmAligner)for(var t=0;t<e.length;t++)e[t].time=this._dwmAligner.tradingDayToSessionStart(e[t].time)},e._now=function(){return Date.now()+6e4},e}(),h=function(){function e(e,t){this._threads={},this._datafeed=e,this._dwmAlignerCreator=t}return e.prototype.destroy=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={},delete this._datafeed},e.prototype.purgeCache=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={}},e.prototype.subscribe=function(e,t,i,o,r){var s,a=n(e,t);return this._threads[a]||(this._threads[a]=this._createThread(e,t)),s=this._threads[a].addSubscription(i,o,r),a+'"'+s},e.prototype.unsubscribe=function(e){var t,i,n=e.split('"');if(2!==n.length)return void console.warn("Wrong guid format");t=n[0],i=parseInt(n[1]),this._threads.hasOwnProperty(t)?this._threads[t].removeSubscription(i):console.warn("Data thread doesnt exist: "+e)},e.prototype._createThread=function(e,t){return new c(this._datafeed,e,t,this._dwmAlignerCreator(t,e.timezone,e.session))},e.prototype._forEachThread=function(e){var t=this;Object.keys(this._threads).forEach(function(i){return e(i,t._threads[i])})},e}()},function(e,t,i){"use strict";(function(t,n){function o(e,i,n,o){this._chartWidgetCollection=e,this._chartApiInstance=i,this._saveChartService=n,this._loadChartService=o,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._activeChangedChangedDelegate=new t,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=new WeakMap}var r=i(62).linking,s=i(679),a=i(109).layouts,l=i(31),c=i(89),h=i(32),u=i(61),d=i(67),p=i(4),_=i(209).createNoticeDialog,f=i(83).createConfirmDialog,m=i(298),y=i(685).ThemesApi;o.prototype.subscribe=function(e,t){l.subscribe(e,t)},o.prototype.unsubscribe=function(e,t){l.unsubscribe(e,t)},o.prototype.onContextMenu=function(e){l.subscribe("onContextMenu",function(t){t.callback(e(t.unixtime,t.price))})},o.prototype.onGrayedObjectClicked=function(e){l.subscribe("onGrayedObjectClicked",e)},o.prototype.activeChart=function(){return this._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())},o.prototype._getChartWidgetApi=function(e){var t=this._chartWidgets.get(e);return void 0===t&&(t=new s(e),this._chartWidgets.set(e,t)),t},o.prototype.onActiveChartChanged=function(){ var t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=e.concat(this._cache.bars),this._checkBars(this._cache.bars,!0),!0},e.prototype._putToCacheNewBar=function(e){var t=this._cache.bars.length,i=e.time,n=0===t?NaN:this._cache.bars[t-1].time;0===t||n<i?this._cache.bars.push(e):n===i?this._cache.bars[t-1]=e:console.error("putToCacheNewBar: time violation, previous bar time: "+o(n)+" should be less or equal to new time: "+o(i))},e.prototype._alignBarsTime=function(e){if(this._dwmAligner)for(var t=0;t<e.length;t++)e[t].time=this._dwmAligner.tradingDayToSessionStart(e[t].time)},e._now=function(){return Date.now()+6e4},e}(),h=function(){function e(e,t){this._threads={},this._datafeed=e,this._dwmAlignerCreator=t}return e.prototype.destroy=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={},delete this._datafeed},e.prototype.purgeCache=function(){this._forEachThread(function(e,t){return t.destroy()}),this._threads={}},e.prototype.subscribe=function(e,t,i,o,r){var s,a=n(e,t);return this._threads[a]||(this._threads[a]=this._createThread(e,t)),s=this._threads[a].addSubscription(i,o,r),a+'"'+s},e.prototype.unsubscribe=function(e){var t,i,n=e.split('"');if(2!==n.length)return void console.warn("Wrong guid format");t=n[0],i=parseInt(n[1]),this._threads.hasOwnProperty(t)?this._threads[t].removeSubscription(i):console.warn("Data thread doesnt exist: "+e)},e.prototype._createThread=function(e,t){return new c(this._datafeed,e,t,this._dwmAlignerCreator(t,e.timezone,e.session))},e.prototype._forEachThread=function(e){var t=this;Object.keys(this._threads).forEach(function(i){return e(i,t._threads[i])})},e}()},function(e,t,i){"use strict";(function(t,n){function o(e,i,n,o){this._chartWidgetCollection=e,this._chartApiInstance=i,this._saveChartService=n,this._loadChartService=o,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._activeChangedChangedDelegate=new t,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this)),this._chartWidgets=new WeakMap}var r=i(62).linking,s=i(679),a=i(109).layouts,l=i(31),c=i(89),h=i(32),u=i(61),d=i(67),p=i(4),_=i(209).createNoticeDialog,f=i(83).createConfirmDialog,m=i(298),y=i(685).ThemesApi;o.prototype.subscribe=function(e,t){l.subscribe(e,t)},o.prototype.unsubscribe=function(e,t){l.unsubscribe(e,t)},o.prototype.onContextMenu=function(e){l.subscribe("onContextMenu",function(t){t.callback(e(t.unixtime,t.price))})},o.prototype.onGrayedObjectClicked=function(e){l.subscribe("onGrayedObjectClicked",e)},o.prototype.activeChart=function(){return this._getChartWidgetApi(this._chartWidgetCollection.activeChartWidget.value())},o.prototype._getChartWidgetApi=function(e){var t=this._chartWidgets.get(e);return void 0===t&&(t=new s(e),
return this._activeChangedChangedDelegate},o.prototype.changeSymbol=function(e,t,i){r.interval.setValue(t),r.symbol.setValue(e),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(e){this._chartWidgetCollection.layout.setValue(e)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.layoutName=function(){return this._chartWidgetCollection.metaInfo.name.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(e){if(void 0===e&&(e=0),e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])},o.prototype.getSymbolInterval=function(e){var t={symbol:r.symbol.value(),interval:r.interval.value()};return e&&e(t),t},o.prototype.saveChart=function(e){var t=this;this._saveChartService.whenReadyToSave(function(){var i=t._saveChartService.saveToJSON();return e&&e(JSON.parse(i.content))})},o.prototype.loadChart=function(e){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),r.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(e){return!e.is_hidden_study}).map(function(e){return e.name||e.description})},o.prototype.getSavedCharts=function(e){d.getCharts(e)},o.prototype.loadChartFromServer=function(e){d.loadChart(e)},o.prototype.saveChartToServer=function(e,t,i,n){this._saveChartService.saveChartSilently(e,i,t,n)},o.prototype.removeChartFromServer=function(e,t){d.removeChart(e,t)},o.prototype.getIntervals=function(){var e=[],t=u.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),u.mergeResolutions(e,t)},o.prototype.closePopupsAndDialogs=function(){var e,t,n=document.querySelectorAll("._tv-dialog-title-close");for(e=0;e<n.length;e++)n[e].click();t=i.c[690],t&&t.exports.closeAllDialogs(),c.hideAll()},o.prototype.selectLineTool=function(e){m.supportedLineTools[e]&&(e=m.supportedLineTools[e].name,h.tool.value()!==e&&h.tool.setValue(e))},o.prototype.selectedLineTool=function(){var e,t=Object.keys(m.supportedLineTools),i=h.tool.value();for(e=0;e<t.length;++e)if(m.supportedLineTools[t[e]].name===i)return t[e];return""},o.prototype.lockAllDrawingTools=function(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new n(h.lockDrawings().value()),this._lockDrawingsWatchedValue.subscribe(function(e){h.lockDrawings().setValue(e)}),h.lockDrawings().subscribe(this,function(){this._lockDrawingsWatchedValue.setValue(h.lockDrawings().value())})),this._lockDrawingsWatchedValue}, this._chartWidgets.set(e,t)),t},o.prototype.onActiveChartChanged=function(){return this._activeChangedChangedDelegate},o.prototype.changeSymbol=function(e,t,i){r.interval.setValue(t),r.symbol.setValue(e),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)},o.prototype.setLayout=function(e){this._chartWidgetCollection.layout.setValue(e)},o.prototype.layout=function(){return this._chartWidgetCollection.layout.value()},o.prototype.layoutName=function(){return this._chartWidgetCollection.metaInfo.name.value()},o.prototype.chartsCount=function(){return a[this.layout()].count},o.prototype.chart=function(e){if(void 0===e&&(e=0),e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])},o.prototype.getSymbolInterval=function(e){var t={symbol:r.symbol.value(),interval:r.interval.value()};return e&&e(t),t},o.prototype.saveChart=function(e){var t=this;this._saveChartService.whenReadyToSave(function(){var i=t._saveChartService.saveToJSON();return e&&e(JSON.parse(i.content))})},o.prototype.loadChart=function(e){this._chartApiInstance.purgeCache(),this._chartApiInstance._studyEngine.stopSources(),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),r.symbol.setValue(this.activeChart().symbol()),l.emit("chart_loaded")},o.prototype.getStudiesList=function(){return this._chartApiInstance.allStudiesMetadata().filter(function(e){return!e.is_hidden_study}).map(function(e){return e.name||e.description})},o.prototype.getSavedCharts=function(e){d.getCharts(e)},o.prototype.loadChartFromServer=function(e){d.loadChart(e)},o.prototype.saveChartToServer=function(e,t,i,n){this._saveChartService.saveChartSilently(e,i,t,n)},o.prototype.removeChartFromServer=function(e,t){d.removeChart(e,t)},o.prototype.getIntervals=function(){var e=[],t=u.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),u.mergeResolutions(e,t)},o.prototype.closePopupsAndDialogs=function(){var e,t,n=document.querySelectorAll("._tv-dialog-title-close");for(e=0;e<n.length;e++)n[e].click();t=i.c[690],t&&t.exports.closeAllDialogs(),c.hideAll()},o.prototype.selectLineTool=function(e){m.supportedLineTools[e]&&(e=m.supportedLineTools[e].name,h.tool.value()!==e&&h.tool.setValue(e))},o.prototype.selectedLineTool=function(){var e,t=Object.keys(m.supportedLineTools),i=h.tool.value();for(e=0;e<t.length;++e)if(m.supportedLineTools[t[e]].name===i)return t[e];return""},o.prototype.lockAllDrawingTools=function(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new n(h.lockDrawings().value()),this._lockDrawingsWatchedValue.subscribe(function(e){h.lockDrawings().setValue(e)}),h.lockDrawings().subscribe(this,function(){
o.prototype.hideAllDrawingTools=function(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new n(h.hideAllDrawings().value()),this._hideDrawingsWatchedValue.subscribe(function(e){h.hideAllDrawings().setValue(e)}),h.hideAllDrawings().subscribe(this,function(){this._hideDrawingsWatchedValue.setValue(h.hideAllDrawings().value())})),this._hideDrawingsWatchedValue},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(e){function t(){i&&(i(),i=null)}e=e||{};var i=e.callback;_({title:e.title,content:e.body||""}).then(function(e){e.on("action:ok",t),e.on("afterClose",t),e.open()})},o.prototype.showConfirmDialog=function(e){function t(e){i&&(i(e),i=null)}if(e=e||{},!e.callback)throw Error("callback must be exist");var i=e.callback;f({title:e.title,content:e.body||""}).then(function(e){e.on("action:yes",t.bind(null,!0)),e.on("action:no",t.bind(null,!1)),e.on("afterClose",t.bind(null,!1)),e.open()})},o.prototype.logs=function(){return{getLogHistory:p.getLogHistory,enable:p.loggingOn,disable:p.loggingOff}},o.prototype.showLoadChartDialog=function(){var e=this._loadChartService;e&&e.showLoadDialog()},o.prototype.showSaveAsChartDialog=function(){var e=this._saveChartService;e&&window.runOrSignIn(function(){e.saveChartAs()})},o.prototype.themes=function(){return new y({chartWidgetCollection:this._chartWidgetCollection})},o.prototype.undoRedoState=function(){return this._chartWidgetCollection.undoHistory.state()},o.prototype.takeScreenshot=function(){this._chartWidgetCollection.takeScreenshot()},e.exports=o}).call(t,i(8),i(16))},function(e,t,i){"use strict";(function(t){function n(e){var t,i,n=Object.keys(y),o=n.length;for(t=0;t<o;++t)if(i=n[t],y[i].name===e)return i;return null}function o(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}var r=i(7).ensureNotNull,s=i(680),a=i(162).applyOverridesToStudy,l=i(26),c=i(681).LineDataSourceApi,h=i(682).StudyApi,u=i(683).PaneApi,d=i(3).DefaultProperty,p=i(335).availableIcons,_=i(37),f=i(15).Interval,m=i(35),y=i(298).supportedLineTools,g=i(292).showTooManyStudiesNotice,v=i(12).isNumber,S=i(684).onSeriesCompletedOrErrorReceived,b=function(e){this._chartWidget=e,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap};b.prototype._getPaneApi=function(e){var t=this._panes.get(e);return void 0===t&&(t=new u(e),this._panes.set(e,t)),t},b.prototype._getStudyApi=function(e){var t=this._studies.get(e);return void 0===t&&(t=new h(e,this._chartWidget.model().model()),this._studies.set(e,t)),t},b.prototype._getLineDataSourceApi=function(e){var t=this._lineDataSources.get(e);return void 0===t&&(t=new c(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){ this._lockDrawingsWatchedValue.setValue(h.lockDrawings().value())})),this._lockDrawingsWatchedValue},o.prototype.hideAllDrawingTools=function(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new n(h.hideAllDrawings().value()),this._hideDrawingsWatchedValue.subscribe(function(e){h.hideAllDrawings().setValue(e)}),h.hideAllDrawings().subscribe(this,function(){this._hideDrawingsWatchedValue.setValue(h.hideAllDrawings().value())})),this._hideDrawingsWatchedValue},o.prototype.mainSeriesPriceFormatter=function(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()},o.prototype.showNoticeDialog=function(e){function t(){i&&(i(),i=null)}e=e||{};var i=e.callback;_({title:e.title,content:e.body||""}).then(function(e){e.on("action:ok",t),e.on("afterClose",t),e.open()})},o.prototype.showConfirmDialog=function(e){function t(e){i&&(i(e),i=null)}if(e=e||{},!e.callback)throw Error("callback must be exist");var i=e.callback;f({title:e.title,content:e.body||""}).then(function(e){e.on("action:yes",t.bind(null,!0)),e.on("action:no",t.bind(null,!1)),e.on("afterClose",t.bind(null,!1)),e.open()})},o.prototype.logs=function(){return{getLogHistory:p.getLogHistory,enable:p.loggingOn,disable:p.loggingOff}},o.prototype.showLoadChartDialog=function(){var e=this._loadChartService;e&&e.showLoadDialog()},o.prototype.showSaveAsChartDialog=function(){var e=this._saveChartService;e&&window.runOrSignIn(function(){e.saveChartAs()})},o.prototype.themes=function(){return new y({chartWidgetCollection:this._chartWidgetCollection})},o.prototype.undoRedoState=function(){return this._chartWidgetCollection.undoHistory.state()},o.prototype.takeScreenshot=function(){this._chartWidgetCollection.takeScreenshot()},e.exports=o}).call(t,i(8),i(16))},function(e,t,i){"use strict";(function(t){function n(e){var t,i,n=Object.keys(y),o=n.length;for(t=0;t<o;++t)if(i=n[t],y[i].name===e)return i;return null}function o(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}var r=i(7).ensureNotNull,s=i(680),a=i(162).applyOverridesToStudy,l=i(26),c=i(681).LineDataSourceApi,h=i(682).StudyApi,u=i(683).PaneApi,d=i(3).DefaultProperty,p=i(335).availableIcons,_=i(37),f=i(15).Interval,m=i(35),y=i(298).supportedLineTools,g=i(292).showTooManyStudiesNotice,v=i(12).isNumber,S=i(684).onSeriesCompletedOrErrorReceived,b=function(e){this._chartWidget=e,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap};b.prototype._getPaneApi=function(e){var t=this._panes.get(e);return void 0===t&&(t=new u(e),this._panes.set(e,t)),t},b.prototype._getStudyApi=function(e){var t=this._studies.get(e);return void 0===t&&(t=new h(e,this._chartWidget.model().model()),this._studies.set(e,t)),t},b.prototype._getLineDataSourceApi=function(e){var t=this._lineDataSources.get(e);return void 0===t&&(t=new c(e,this._chartWidget.model().model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:function(e){
var n=i.normalizeBarIndex(e.index);return{price:e.price,time:t.projectTime(n.time_t,n.offset)}})}.bind(this)}),this._lineDataSources.set(e,t)),t},b.prototype._makeSubscriptionFromDelegate=function(e){var t=$.extend({},e);return delete t.fire,t},b.prototype.executeActionById=function(e){this._chartWidget.executeActionById(e)},b.prototype.getCheckableActionState=function(e){return this._chartWidget.getCheckableActionState(e)},b.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},b.prototype.clearMarks=function(){this._chartWidget.clearMarks()},b.prototype.symbol=function(){return this._chartWidget.getSymbol()},b.prototype.symbolExt=function(){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}:null},b.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},b.prototype.setSymbol=function(e,i){function n(e){e||i()}if(e!==this.symbol()||t.enabled("same_data_requery")){var o=this._chartWidget.model().mainSeries().dataEvents();return i&&S(o,n),this._chartWidget.setSymbol(e)}},b.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},b.prototype.setResolution=function(e,t){function i(e){e||t()}if((e=e.toUpperCase())!==this.resolution()){var n=this._chartWidget.model().mainSeries().dataEvents();return t&&S(n,i),this._chartWidget.setResolution(e)}},b.prototype.setEntityVisibility=function(e,t){var i,n;console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead"),(i=this._chartWidget.model().model().dataSourceForId(e))&&(n=i.properties())&&n.visible&&n.visible.setValue(t)},b.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(e){return{id:e.id(),name:e._metaInfo.description}})},b.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(e){return{id:e.id(),name:n(e.toolname)}}).filter(function(e){return null!==e.name})},b.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},b.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},b.prototype.removeEntity=function(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);if(!t)return void console.warn("Can't find a source with id: "+e);this._chartWidget.model().chartModel().removeSource(t,!0)},b.prototype.createStudyTemplate=function(e){return this._chartWidget.model().model().studyTemplate(e.saveInterval)},b.prototype.applyStudyTemplate=function(e){this._chartWidget.model().model().restoreStudyTemplate(e,""+1e3*Math.random())},b.prototype.setVisibleRange=function(e,i){var n,o,r,s;if(void 0===e||!e.from||!e.to||isNaN(e.from)||isNaN(e.to))return void console.warn("Wrong time range: "+JSON.stringify(e)+'. Expected an object with "from" and "to" numeric values.');n=this._chartWidget.model().model(),o=n.mainSeries(),r=[parseInt(e.from),parseInt(e.to)], var t=this._chartWidget.model().mainSeries().syncModel(),i=this._chartWidget.model().timeScale();return e.map(function(e){var n=i.normalizeBarIndex(e.index);return{price:e.price,time:t.projectTime(n.time_t,n.offset)}})}.bind(this)}),this._lineDataSources.set(e,t)),t},b.prototype._makeSubscriptionFromDelegate=function(e){var t=$.extend({},e);return delete t.fire,t},b.prototype.executeActionById=function(e){this._chartWidget.executeActionById(e)},b.prototype.getCheckableActionState=function(e){return this._chartWidget.getCheckableActionState(e)},b.prototype.refreshMarks=function(){this._chartWidget.refreshMarks()},b.prototype.clearMarks=function(){this._chartWidget.clearMarks()},b.prototype.symbol=function(){return this._chartWidget.getSymbol()},b.prototype.symbolExt=function(){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}:null},b.prototype.resolution=function(){return this._chartWidget.model().mainSeries().properties().interval.value()},b.prototype.setSymbol=function(e,i){function n(e){e||i()}if(e!==this.symbol()||t.enabled("same_data_requery")){var o=this._chartWidget.model().mainSeries().dataEvents();return i&&S(o,n),this._chartWidget.setSymbol(e)}},b.prototype.resetData=function(){this._chartWidget.model().mainSeries().rerequestData()},b.prototype.setResolution=function(e,t){function i(e){e||t()}if((e=e.toUpperCase())!==this.resolution()){var n=this._chartWidget.model().mainSeries().dataEvents();return t&&S(n,i),this._chartWidget.setResolution(e)}},b.prototype.setEntityVisibility=function(e,t){var i,n;console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead"),(i=this._chartWidget.model().model().dataSourceForId(e))&&(n=i.properties())&&n.visible&&n.visible.setValue(t)},b.prototype.getAllStudies=function(){return this._chartWidget.model().model().allStudies().map(function(e){return{id:e.id(),name:e._metaInfo.description}})},b.prototype.getAllShapes=function(){return this._chartWidget.model().model().allLineTools().map(function(e){return{id:e.id(),name:n(e.toolname)}}).filter(function(e){return null!==e.name})},b.prototype.removeAllShapes=function(){this._chartWidget.removeAllDrawingTools()},b.prototype.removeAllStudies=function(){this._chartWidget.removeAllStudies()},b.prototype.removeEntity=function(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);if(!t)return void console.warn("Can't find a source with id: "+e);this._chartWidget.model().chartModel().removeSource(t,!0)},b.prototype.createStudyTemplate=function(e){return this._chartWidget.model().model().studyTemplate(e.saveInterval)},b.prototype.applyStudyTemplate=function(e){this._chartWidget.model().model().restoreStudyTemplate(e,""+1e3*Math.random())},b.prototype.setVisibleRange=function(e,i){var n,o,r,s;if(void 0===e||!e.from||!e.to||isNaN(e.from)||isNaN(e.to))return void console.warn("Wrong time range: "+JSON.stringify(e)+'. Expected an object with "from" and "to" numeric values.')
s=f.isDWM(o.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(r):r,e.from=s[0],e.to=s[1],this._chartWidget.setVisibleTimeRange(e.from,e.to,i)},b.prototype.getVisibleRange=function(){var e,t,i,n,o,r,s={from:0,to:0},a=this._chartWidget.model().timeScale(),l=a.visibleBars();return null===l?s:(e=this._chartWidget.model().mainSeries(),null===(t=e.syncModel())?s:null===e.data().last()?s:(i=e.data().last(),n=l.lastBar()-i.index,o=n<=0,r=o?a.indexToTimePoint(l.lastBar()):t.projectTime(i.value[TradingView.TIME_PLOT],n),s.from=+a.indexToTimePoint(Math.max(0,l.firstBar()))||0,s.to=+r||0,s))},b.prototype.getVisiblePriceRange=function(){return this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null},b.prototype._createTradingPrimitive=function(e,t){function i(){var e=TradingView.CLOSE_PLOT,t=r(n._chartWidget.model().mainSeries().bars().last());return{index:t.index,price:t.value[e]}}var n=this,o=this._chartWidget.model().model(),s=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(s,i(),e)._adapter},b.prototype.createOrderLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)},b.prototype.createPositionLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)},b.prototype.createExecutionShape=function(e){var e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)},b.prototype.createShape=function(e,t){return this.createMultipointShape([e],t)},b.prototype._alignPoints=function(e){var t,i,n=this._chartWidget.model().model(),o=n.mainSeries(),r=o.symbolInfo(),s=m.get_timezone(r.timezone);return n.timeScale().isEmpty()?e:(t=(new _.Session).init(s,r.session),i=_.createDWMAligner(o.interval(),t),null===i?e:e.map(function(e){return e?(i.moveTo(1e3*e),i.startOfBar(0)/1e3):e}))},b.prototype._convertUserPointsToDataSource=function(e){function i(e,t,i){var n,o,r,s=h.closestIndexLeft(e)||0,a={index:s},l=h.valueAt(s);return e>l&&(n=c.syncModel().distance(l,e),n.success&&(a.index=a.index+n.result)),v(t)?a.price=t:(o=["open","high","low","close"],r=i?o.indexOf(i)+1:1,r<=0&&(r=1),a.price=u.valueAt(s)[r]),a}var n,o,r,s,a,l=this._chartWidget.model().model(),c=l.mainSeries(),h=l.timeScale().points(),u=c.data();if(l.timeScale().isEmpty())return null;for(n=e.map(function(e){return e.time}),o=f.isDWM(c.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(n):n,r=[],s=0;s<e.length;s++)a=e[s],r.push(i(o[s],a.price,a.channel));return r},b.prototype.createMultipointShape=function(e,t,i){var n,r,s,a,l,c,h,u=t.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),_=this._chartWidget.model().model(),f=_.mainSeries();if(!_.timeScale().isEmpty()){if(n=_.paneForSource(f),r=this._convertUserPointsToDataSource(e),s=y[t.shape]||y.flag,s.onlySelectable)throw Error('Cannot create "'+t.shape+'" shape') ;n=this._chartWidget.model().model(),o=n.mainSeries(),r=[parseInt(e.from),parseInt(e.to)],s=f.isDWM(o.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(r):r,e.from=s[0],e.to=s[1],this._chartWidget.setVisibleTimeRange(e.from,e.to,i)},b.prototype.getVisibleRange=function(){var e,t,i,n,o,r,s={from:0,to:0},a=this._chartWidget.model().timeScale(),l=a.visibleBars();return null===l?s:(e=this._chartWidget.model().mainSeries(),null===(t=e.syncModel())?s:null===e.data().last()?s:(i=e.data().last(),n=l.lastBar()-i.index,o=n<=0,r=o?a.indexToTimePoint(l.lastBar()):t.projectTime(i.value[TradingView.TIME_PLOT],n),s.from=+a.indexToTimePoint(Math.max(0,l.firstBar()))||0,s.to=+r||0,s))},b.prototype.getVisiblePriceRange=function(){return this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null},b.prototype._createTradingPrimitive=function(e,t){function i(){var e=TradingView.CLOSE_PLOT,t=r(n._chartWidget.model().mainSeries().bars().last());return{index:t.index,price:t.value[e]}}var n=this,o=this._chartWidget.model().model(),s=o.paneForSource(o.mainSeries());return(t?o:this._chartWidget.model()).createLineTool(s,i(),e)._adapter},b.prototype.createOrderLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)},b.prototype.createPositionLine=function(e){var e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)},b.prototype.createExecutionShape=function(e){var e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)},b.prototype.createShape=function(e,t){return this.createMultipointShape([e],t)},b.prototype._alignPoints=function(e){var t,i,n=this._chartWidget.model().model(),o=n.mainSeries(),r=o.symbolInfo(),s=m.get_timezone(r.timezone);return n.timeScale().isEmpty()?e:(t=(new _.Session).init(s,r.session),i=_.createDWMAligner(o.interval(),t),null===i?e:e.map(function(e){return e?(i.moveTo(1e3*e),i.startOfBar(0)/1e3):e}))},b.prototype._convertUserPointsToDataSource=function(e){function i(e,t,i){var n,o,r,s=h.closestIndexLeft(e)||0,a={index:s},l=h.valueAt(s);return e>l&&(n=c.syncModel().distance(l,e),n.success&&(a.index=a.index+n.result)),v(t)?a.price=t:(o=["open","high","low","close"],r=i?o.indexOf(i)+1:1,r<=0&&(r=1),a.price=u.valueAt(s)[r]),a}var n,o,r,s,a,l=this._chartWidget.model().model(),c=l.mainSeries(),h=l.timeScale().points(),u=c.data();if(l.timeScale().isEmpty())return null;for(n=e.map(function(e){return e.time}),o=f.isDWM(c.interval())&&!t.enabled("disable_resolution_rebuild")?this._alignPoints(n):n,r=[],s=0;s<e.length;s++)a=e[s],r.push(i(o[s],a.price,a.channel));return r},b.prototype.createMultipointShape=function(e,t,i){var n,r,s,a,l,c,h,u=t.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),_=this._chartWidget.model().model(),f=_.mainSeries();if(!_.timeScale().isEmpty()){if(n=_.paneForSource(f),r=this._convertUserPointsToDataSource(e),s=y[t.shape]||y.flag,s.onlySelectable)throw Error('Cannot create "'+t.shape+'" shape')
;if("LineToolPolyline"===s.name)r[0].price===r[r.length-1].price&&r[0].index===r[r.length-1].index||r.push(r[0]);else if("LineToolIcon"===s.name){if(t.icon=t.icon||t.overrides&&t.overrides.icon,!t.hasOwnProperty("icon"))throw Error("icon must be specified in options");if(-1===p.indexOf(t.icon))throw Error("icon value must be valid");t.overrides=t.overrides||{},t.overrides.icon=t.icon}if(a=new d(s.name.toLowerCase()),t.overrides)for(l in t.overrides)a[l]?a[l].setValue(t.overrides[l]):o(s.name)&&-1!==["profitLevel","stopLevel"].indexOf(l)&&a.addProperty(l,t.overrides[l]);if(s.supportsText&&t.text&&a.text.setValue(t.text),c=u.createLineTool(n,r[0],s.name,a),c.pointsCount()!==r.length&&-1!==c.pointsCount())throw Error("Wrong points count for "+t.shape+". Required "+c.pointsCount());for(h=1;h<r.length&&this._chartWidget.model().lineBeingCreated();h++)u.coninueCreatingLine(r[h],{},h<r.length-1);return t.lock&&c.setUserEditEnabled(!1),t.disableSelection&&(c.customization.disableSelection=!0),t.disableSave&&(c.customization.disableSave=!0),t.hasOwnProperty("showInObjectsTree")&&(c.customization.showInObjectsTree=t.showInObjectsTree),t.zOrder&&("top"===t.zOrder?u.bringToFront(c):"bottom"===t.zOrder&&u.sendToBack(c)),c.id()}},b.prototype.getShapeById=function(e){var t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw Error("There is no such shape");return this._getLineDataSourceApi(t)},b.prototype.createStudy=function(e,t,i,n,o,c,h){var u,d,p,_,f,m;return h=h||{},h.checkLimit&&!this._chartWidget.model().canCreateStudy()?(g(),null):(e=e.toLowerCase(),u=this._chartWidget.model().chartModel(),d=l.findStudyMetaInfoByDescription(u.studiesMetaData(),e),d=$.extend({},d),delete d.state,d?(p={},n&&(p.inputs=s.getStudyRecordFromArray([e].concat(n),this._chartWidget).inputs),_=u.insertStudy(d,p,t,null,h.priceScale),c&&a(_,c),f=r(u.paneForSource(_)),m=f.priceScaleName(_.priceScale()),u.setPriceScaleVisibility(m,!0),i&&_.setUserEditEnabled(!1),o&&o(_.id()),_.id()):(console.warn("Study `"+e+"` not found."),null))},b.prototype.getStudyById=function(e){var t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw Error("There is no such study");return this._getStudyApi(t)},b.prototype.chartType=function(){return this._chartWidget.model().mainSeries().properties().style.value()},b.prototype.setChartType=function(e){this._chartWidget.model().mainSeries().properties().style.setValue(e)},b.prototype.priceFormatter=function(){return this._chartWidget.model().mainSeries().priceScale().formatter()},b.prototype.onDataLoaded=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())},b.prototype.onSymbolChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())},b.prototype.onIntervalChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())},b.prototype.onVisibleRangeChanged=function(){ ;if("LineToolPolyline"===s.name)r[0].price===r[r.length-1].price&&r[0].index===r[r.length-1].index||r.push(r[0]);else if("LineToolIcon"===s.name){if(t.icon=t.icon||t.overrides&&t.overrides.icon,!t.hasOwnProperty("icon"))throw Error("icon must be specified in options");if(-1===p.indexOf(t.icon))throw Error("icon value must be valid");t.overrides=t.overrides||{},t.overrides.icon=t.icon}if(a=new d(s.name.toLowerCase()),t.overrides)for(l in t.overrides)a[l]?a[l].setValue(t.overrides[l]):o(s.name)&&-1!==["profitLevel","stopLevel"].indexOf(l)&&a.addProperty(l,t.overrides[l]);if(s.supportsText&&t.text&&a.text.setValue(t.text),c=u.createLineTool(n,r[0],s.name,a),c.pointsCount()!==r.length&&-1!==c.pointsCount())throw Error("Wrong points count for "+t.shape+". Required "+c.pointsCount());for(h=1;h<r.length&&this._chartWidget.model().lineBeingCreated();h++)u.coninueCreatingLine(r[h],{},h<r.length-1);return t.lock&&c.setUserEditEnabled(!1),t.disableSelection&&(c.customization.disableSelection=!0),t.disableSave&&(c.customization.disableSave=!0),t.hasOwnProperty("showInObjectsTree")&&(c.customization.showInObjectsTree=t.showInObjectsTree),t.zOrder&&("top"===t.zOrder?u.bringToFront(c):"bottom"===t.zOrder&&u.sendToBack(c)),c.id()}},b.prototype.getShapeById=function(e){var t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw Error("There is no such shape");return this._getLineDataSourceApi(t)},b.prototype.createStudy=function(e,t,i,n,o,c,h){var u,d,p,_,f,m;return h=h||{},h.checkLimit&&!this._chartWidget.model().canCreateStudy()?(g(),null):(e=e.toLowerCase(),u=this._chartWidget.model().chartModel(),d=l.findStudyMetaInfoByDescription(u.studiesMetaData(),e),d=$.extend({},d),delete d.state,d?(p={},n&&(p.inputs=s.getStudyRecordFromArray([e].concat(n),this._chartWidget).inputs),_=u.insertStudy(d,p,t,null,h.priceScale),c&&a(_,c),f=r(u.paneForSource(_)),m=f.priceScaleName(_.priceScale()),u.setPriceScaleVisibility(m,!0),i&&_.setUserEditEnabled(!1),o&&o(_.id()),_.id()):(console.warn("Study `"+e+"` not found."),null))},b.prototype.getStudyById=function(e){var t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw Error("There is no such study");return this._getStudyApi(t)},b.prototype.chartType=function(){return this._chartWidget.model().mainSeries().properties().style.value()},b.prototype.setChartType=function(e){this._chartWidget.model().mainSeries().properties().style.setValue(e)},b.prototype.priceFormatter=function(){return this._chartWidget.model().mainSeries().priceScale().formatter()},b.prototype.onDataLoaded=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())},b.prototype.onSymbolChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())},b.prototype.onIntervalChanged=function(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())},b.prototype.onVisibleRangeChanged=function(){
return this._makeSubscriptionFromDelegate(this._chartWidget.model().timeScale().visibleBarsChanged())},b.prototype.dataReady=function(e){var t=!this._chartWidget.model()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t},b.prototype.crossHairMoved=function(e){this._makeSubscriptionFromDelegate(this._chartWidget.model().chartModel().crossHairMoved()).subscribe(null,e)},b.prototype.setTimezone=function(e){this._chartWidget.setTimezone(e)},b.prototype.getPanes=function(){return this._chartWidget.model().chartModel().panes().map(function(e){return this._getPaneApi(e)},this)},b.prototype.exportData=function(e){var t=this._chartWidget;return new Promise(function(n){i.e(26).then(function(o){var r=i(821).exportData;n(r(t.model().chartModel(),e))}.bind(null,i)).catch(i.oe)})},b.prototype.canZoomOut=function(){return!this._chartWidget.model().zoomStack().isEmpty()},b.prototype.zoomOut=function(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()},e.exports=b}).call(t,i(5))},function(e,t,i){"use strict";var n=function(){function e(e){return e.is_price_study}function t(e,t){var i,n=t.slice(0).toLowerCase();if(e){for(i=0;i<e.length;++i)if(e[i].description.toLowerCase()===n||e[i].shortDescription.toLowerCase()===n)return e[i];throw Error("Can't find metainfo for `"+t+"`")}throw Error("There is no studies metainfo at all")}function i(e){return e.inputs.map(function(e){return{id:e.id,type:e.type,name:e.name}})}function n(n,o){var r,a,l,c,h,u,d,p,_;if(!Array.isArray(n))return r=t(o.model().studiesMetaData(),n),{id:r.id,overlay:e(r)};for(a=n.slice(0),l=a[0],r=t(o.model().studiesMetaData(),l),c=e(r),h=i(r),d=a.splice(1),p=0;p<d.length;++p)u||(u={}),_=s[h[p].type]||s.string,u[h[p].id]=_(d[p]);return{id:r.id,name:l,overlay:c,inputs:u}}function o(e,n,o){function r(e){return e.name.toLowerCase()===a}var s,a,l,c=t(o.model().studiesMetaData(),e),h=i(c),u={};for(s in n)a=s.toLowerCase(),l=h.filter(r),0!==l.length?(l=l[0],u[l.id]=n[s]):console.warn("Uknown input `"+s+"` of `"+e+"`");return{id:c.id,name:e,inputs:u}}var r={},s={bool:function(e){return!!e},integer:function(e){return parseInt(e)},float:function(e){return parseFloat(e)},string:function(e){return e}};return r.getStudyRecordFromArray=function(e,t){return t=t||chartWidget,n(e,t)},r.getStudyRecordFromObject=function(e,t,i){return i=i||chartWidget,o(e,t,i)},r}();e.exports=n},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"LineDataSourceApi",function(){return r}),n=i(12),i.n(n),o=["alwaysShowStats","clonable","entryPrice","interval","lastUpdateTime","points","singleChartOnly","snapTo45Degrees","stopPrice","symbol","targetPrice"],r=function(){function e(e,t,i){this._source=e,this._model=t,this._pointsConverter=i}return e.prototype.isSelectionEnabled=function(){return this._source.isSelectionEnabled()},e.prototype.setSelectionEnabled=function(e){this._source.setSelectionEnabled(e)},e.prototype.isSavingEnabled=function(){ return this._makeSubscriptionFromDelegate(this._chartWidget.model().timeScale().visibleBarsChanged())},b.prototype.dataReady=function(e){var t=!this._chartWidget.model()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t},b.prototype.crossHairMoved=function(e){this._makeSubscriptionFromDelegate(this._chartWidget.model().chartModel().crossHairMoved()).subscribe(null,e)},b.prototype.setTimezone=function(e){this._chartWidget.setTimezone(e)},b.prototype.getPanes=function(){return this._chartWidget.model().chartModel().panes().map(function(e){return this._getPaneApi(e)},this)},b.prototype.exportData=function(e){var t=this._chartWidget;return new Promise(function(n){i.e(26).then(function(o){var r=i(821).exportData;n(r(t.model().chartModel(),e))}.bind(null,i)).catch(i.oe)})},b.prototype.canZoomOut=function(){return!this._chartWidget.model().zoomStack().isEmpty()},b.prototype.zoomOut=function(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()},e.exports=b}).call(t,i(5))},function(e,t,i){"use strict";var n=function(){function e(e){return e.is_price_study}function t(e,t){var i,n=t.slice(0).toLowerCase();if(e){for(i=0;i<e.length;++i)if(e[i].description.toLowerCase()===n||e[i].shortDescription.toLowerCase()===n)return e[i];throw Error("Can't find metainfo for `"+t+"`")}throw Error("There is no studies metainfo at all")}function i(e){return e.inputs.map(function(e){return{id:e.id,type:e.type,name:e.name}})}function n(n,o){var r,a,l,c,h,u,d,p,_;if(!Array.isArray(n))return r=t(o.model().studiesMetaData(),n),{id:r.id,overlay:e(r)};for(a=n.slice(0),l=a[0],r=t(o.model().studiesMetaData(),l),c=e(r),h=i(r),d=a.splice(1),p=0;p<d.length;++p)u||(u={}),_=s[h[p].type]||s.string,u[h[p].id]=_(d[p]);return{id:r.id,name:l,overlay:c,inputs:u}}function o(e,n,o){function r(e){return e.name.toLowerCase()===a}var s,a,l,c=t(o.model().studiesMetaData(),e),h=i(c),u={};for(s in n)a=s.toLowerCase(),l=h.filter(r),0!==l.length?(l=l[0],u[l.id]=n[s]):console.warn("Uknown input `"+s+"` of `"+e+"`");return{id:c.id,name:e,inputs:u}}var r={},s={bool:function(e){return!!e},integer:function(e){return parseInt(e)},float:function(e){return parseFloat(e)},string:function(e){return e}};return r.getStudyRecordFromArray=function(e,t){return t=t||chartWidget,n(e,t)},r.getStudyRecordFromObject=function(e,t,i){return i=i||chartWidget,o(e,t,i)},r}();e.exports=n},function(e,t,i){"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"LineDataSourceApi",function(){return r}),n=i(12),i.n(n),o=["alwaysShowStats","clonable","entryPrice","interval","lastUpdateTime","points","singleChartOnly","snapTo45Degrees","stopPrice","symbol","targetPrice"],r=function(){function e(e,t,i){this._source=e,this._model=t,this._pointsConverter=i}return e.prototype.isSelectionEnabled=function(){return this._source.isSelectionEnabled()},e.prototype.setSelectionEnabled=function(e){this._source.setSelectionEnabled(e)},e.prototype.isSavingEnabled=function(){
return this._source.isSavedInChart()},e.prototype.setSavingEnabled=function(e){this._source.setSavingInChartEnabled(e)},e.prototype.isShowInObjectsTreeEnabled=function(){return this._source.showInObjectTree()},e.prototype.setShowInObjectsTreeEnabled=function(e){this._source.setShowInObjectsTreeEnabled(e)},e.prototype.isUserEditEnabled=function(){return this._source.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._source.setUserEditEnabled(e)},e.prototype.bringToFront=function(){this._model.bringToFront(this._source)},e.prototype.sendToBack=function(){this._model.sendToBack(this._source)},e.prototype.getProperties=function(){return this._source.properties().state(o,!0)},e.prototype.setProperties=function(e){this._setProps(this._source.properties(),e,"")},e.prototype.getPoints=function(){return this._pointsConverter.dataSourcePointsToPriced(this._source.points())},e.prototype.setPoints=function(e){var t,i,n=this._source.pointsCount(),o=-1===n?this._source.points().length:n;if(o!==e.length)throw Error("Wrong points count. Required="+o);for(t=this._pointsConverter.apiPointsToDataSource(e),i=0;i<t.length;++i)this._source.setPoint(i,t[i])},e.prototype._setProps=function(e,t,i){var o,r,s;for(o in t)t.hasOwnProperty(o)&&(r=0===i.length?o:i+"."+o,e.hasOwnProperty(o)?(s=t[o],Object(n.isHashObject)(s)?this._setProps(e[o],s,r):e[o].setValue(s)):console.warn('Unknown property "'+r+'"'))},e}()},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyApi",function(){return s}),n=i(1),i(11),o=i(7),i.n(o),r=i(162),s=function(){function e(e,t){this._study=e,this._model=t}return e.prototype.isUserEditEnabled=function(){return this._study.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._study.setUserEditEnabled(e)},e.prototype.getInputsInfo=function(){return this._study.metaInfo().inputs.map(function(e){return n.a({},e,{localizedName:void 0!==e.name?window.t(e.name,{context:"input"}):""})})},e.prototype.getInputValues=function(){var e=this._study.inputs();return Object.keys(e).map(function(t){return{id:t,value:e[t]}})},e.prototype.setInputValues=function(e){var t,i,n,o=this.getInputValues(),r=function(e){void 0!==o.find(function(t){return t.id===e.id})?s._study.properties().inputs[e.id].setValue(e.value):console.warn('There is no such input: "'+e.id+'"')},s=this;for(t=0,i=e;t<i.length;t++)n=i[t],r(n)},e.prototype.mergeUp=function(){this._model.mergeSourceUp(this._study),this._showStudyPriceScale()},e.prototype.mergeDown=function(){this._model.mergeSourceDown(this._study),this._showStudyPriceScale()},e.prototype.unmergeUp=function(){this._model.unmergeSourceUp(this._study),this._showStudyPriceScale()},e.prototype.unmergeDown=function(){this._model.unmergeSourceDown(this._study),this._showStudyPriceScale()},e.prototype.changePriceScale=function(e){var t,i,n,r=Object(o.ensureNotNull)(this._model.paneForSource(this._study)),s=null;switch(e){case"left":s=r.priceScaleByName("left");break;case"right":s=r.priceScaleByName("right");break;case"no-scale": return this._source.isSavedInChart()},e.prototype.setSavingEnabled=function(e){this._source.setSavingInChartEnabled(e)},e.prototype.isShowInObjectsTreeEnabled=function(){return this._source.showInObjectTree()},e.prototype.setShowInObjectsTreeEnabled=function(e){this._source.setShowInObjectsTreeEnabled(e)},e.prototype.isUserEditEnabled=function(){return this._source.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._source.setUserEditEnabled(e)},e.prototype.bringToFront=function(){this._model.bringToFront(this._source)},e.prototype.sendToBack=function(){this._model.sendToBack(this._source)},e.prototype.getProperties=function(){return this._source.properties().state(o,!0)},e.prototype.setProperties=function(e){this._setProps(this._source.properties(),e,"")},e.prototype.getPoints=function(){return this._pointsConverter.dataSourcePointsToPriced(this._source.points())},e.prototype.setPoints=function(e){var t,i,n=this._source.pointsCount(),o=-1===n?this._source.points().length:n;if(o!==e.length)throw Error("Wrong points count. Required="+o);for(t=this._pointsConverter.apiPointsToDataSource(e),i=0;i<t.length;++i)this._source.setPoint(i,t[i])},e.prototype._setProps=function(e,t,i){var o,r,s;for(o in t)t.hasOwnProperty(o)&&(r=0===i.length?o:i+"."+o,e.hasOwnProperty(o)?(s=t[o],Object(n.isHashObject)(s)?this._setProps(e[o],s,r):e[o].setValue(s)):console.warn('Unknown property "'+r+'"'))},e}()},function(e,t,i){"use strict";var n,o,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i.d(t,"StudyApi",function(){return s}),n=i(1),i(11),o=i(7),i.n(o),r=i(162),s=function(){function e(e,t){this._study=e,this._model=t}return e.prototype.isUserEditEnabled=function(){return this._study.userEditEnabled()},e.prototype.setUserEditEnabled=function(e){this._study.setUserEditEnabled(e)},e.prototype.getInputsInfo=function(){return this._study.metaInfo().inputs.map(function(e){return n.a({},e,{localizedName:void 0!==e.name?window.t(e.name,{context:"input"}):""})})},e.prototype.getInputValues=function(){var e=this._study.inputs();return Object.keys(e).map(function(t){return{id:t,value:e[t]}})},e.prototype.setInputValues=function(e){var t,i,n,o=this.getInputValues(),r=function(e){void 0!==o.find(function(t){return t.id===e.id})?s._study.properties().inputs[e.id].setValue(e.value):console.warn('There is no such input: "'+e.id+'"')},s=this;for(t=0,i=e;t<i.length;t++)n=i[t],r(n)},e.prototype.mergeUp=function(){this._model.mergeSourceUp(this._study),this._showStudyPriceScale()},e.prototype.mergeDown=function(){this._model.mergeSourceDown(this._study),this._showStudyPriceScale()},e.prototype.unmergeUp=function(){this._model.unmergeSourceUp(this._study),this._showStudyPriceScale()},e.prototype.unmergeDown=function(){this._model.unmergeSourceDown(this._study),this._showStudyPriceScale()},e.prototype.changePriceScale=function(e){var t,i,n,r=Object(o.ensureNotNull)(this._model.paneForSource(this._study)),s=null;switch(e){case"left":s=r.priceScaleByName("left");break;case"right":s=r.priceScaleByName("right");break;case"no-scale":

View File

@@ -1,4 +1,4 @@
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n,r,o=window.webpackJsonp;window.webpackJsonp=function(n,i,a){for(var s,u,l,c=0,f=[];c<n.length;c++)u=n[c],r[u]&&f.push(r[u][0]),r[u]=0;for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s]);for(o&&o(n,i,a);f.length;)f.shift()();if(a)for(c=0;c<a.length;c++)l=t(t.s=a[c]);return l},n={},r={34:0},t.e=function(e){function n(){a.onerror=a.onload=null,clearTimeout(s);var t=r[e];0!==t&&(t&&t[1](Error("Loading chunk "+e+" failed.")),r[e]=void 0)}var o,i,a,s,u=r[e];return 0===u?new Promise(function(e){e()}):u?u[2]:(o=new Promise(function(t,n){u=r[e]=[t,n]}),u[2]=o,i=document.getElementsByTagName("head")[0],a=document.createElement("script"),a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,t.nc&&a.setAttribute("nonce",t.nc),a.src=t.p+""+({0:"lt-pane-views",1:"chart-widget-gui",2:"create-dialog",3:"floating-toolbars",4:"take-chart-image-dialog-impl",5:"drawing-toolbar",6:"ds-property-pages",7:"restricted-toolset",8:"objecttreedialog",9:"go-to-date-dialog-impl",10:"load-chart-layout-dialog",11:"ie-fallback-logos",12:"chart-bottom-toolbar",13:"symbol-info-dialog-impl",14:"add-compare-dialog",15:"study-market",16:"confirm-inputs-dialog",17:"editobjectdialog",18:"header-toolbar",19:"confirm-symbol-input-dialog",20:"symbolsearch",21:"change-interval-dialog",23:"lazy-velocity",24:"study-pane-views",25:"series-pane-views",26:"export-data",27:"propertypagesfactory",28:"hammerjs",29:"library",30:"line-tools-icons",31:"lazy-jquery-ui",32:"series-icons-map"}[e]||e)+"."+{0:"92236c4fd18131ce41f4",1:"67de12c05d134554ff1c",2:"b388c187425e521c5a70",3:"348bec38a5b37a3f388f",4:"8581642b95a39228d178",5:"b5c7b558d29b0ded0e45",6:"0ec3f0e39331586d5be1",7:"a0f7780efd28528934ba",8:"b9fa79f3c22b36c514bf",9:"193ed211cd4f2c07f45e",10:"7bca15b478667d4a383c",11:"ecdc2f1255ecbff1dc5f",12:"7bbb5f176039f7d3dc2b",13:"6812ea9f986a1db1a6a9",14:"99e6e22e5d6b137269e9",15:"c4fcdd9f755d64995795",16:"acb4dc0e002888e741f5",17:"6741e8ad1a77a4388d0f",18:"95cfaecb949c7e2261e3",19:"741858b9ef54b3611d31",20:"e22809c43539f903c28a",21:"90d98fd5c50c9ae968da",22:"d344a511955b43dbefcc",23:"b369bcf3fef7b3d24234",24:"a750dba6fc5340758064",25:"9ee45674170ad7836ba4",26:"c8730af5d9a5f56fecc4",27:"42f63d141baef6e836f7",28:"9f017652d0f77438961c",29:"11e673c7c583dd935841",30:"d4bcd6d038b2fea6feed",31:"d97968c821f676a52e9b",32:"359d3b9b312cf5f56733",33:"bf2a2fc98cda3004cc87"}[e]+".js",s=setTimeout(n,12e4),a.onerror=a.onload=n,i.appendChild(a),o)},t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="bundles/",t.p=window.WEBPACK_PUBLIC_PATH||t.p,t.oe=function(e){throw console.error(e),e},t(t.s=360)}([,,,,,,,,,,function(e,t,n){ !function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n,r,o=window.webpackJsonp;window.webpackJsonp=function(n,i,a){for(var s,u,l,c=0,f=[];c<n.length;c++)u=n[c],r[u]&&f.push(r[u][0]),r[u]=0;for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s]);for(o&&o(n,i,a);f.length;)f.shift()();if(a)for(c=0;c<a.length;c++)l=t(t.s=a[c]);return l},n={},r={34:0},t.e=function(e){function n(){a.onerror=a.onload=null,clearTimeout(s);var t=r[e];0!==t&&(t&&t[1](Error("Loading chunk "+e+" failed.")),r[e]=void 0)}var o,i,a,s,u=r[e];return 0===u?new Promise(function(e){e()}):u?u[2]:(o=new Promise(function(t,n){u=r[e]=[t,n]}),u[2]=o,i=document.getElementsByTagName("head")[0],a=document.createElement("script"),a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,t.nc&&a.setAttribute("nonce",t.nc),a.src=t.p+""+({0:"lt-pane-views",1:"chart-widget-gui",2:"create-dialog",3:"floating-toolbars",4:"take-chart-image-dialog-impl",5:"drawing-toolbar",6:"ds-property-pages",7:"restricted-toolset",8:"objecttreedialog",9:"go-to-date-dialog-impl",10:"load-chart-layout-dialog",11:"ie-fallback-logos",12:"chart-bottom-toolbar",13:"symbol-info-dialog-impl",14:"add-compare-dialog",15:"study-market",16:"confirm-inputs-dialog",17:"editobjectdialog",18:"header-toolbar",19:"confirm-symbol-input-dialog",20:"symbolsearch",21:"change-interval-dialog",23:"lazy-velocity",24:"study-pane-views",25:"series-pane-views",26:"export-data",27:"propertypagesfactory",28:"hammerjs",29:"library",30:"line-tools-icons",31:"lazy-jquery-ui",32:"series-icons-map"}[e]||e)+"."+{0:"92236c4fd18131ce41f4",1:"67de12c05d134554ff1c",2:"b388c187425e521c5a70",3:"348bec38a5b37a3f388f",4:"8581642b95a39228d178",5:"b5c7b558d29b0ded0e45",6:"0ec3f0e39331586d5be1",7:"a0f7780efd28528934ba",8:"b9fa79f3c22b36c514bf",9:"193ed211cd4f2c07f45e",10:"7bca15b478667d4a383c",11:"ecdc2f1255ecbff1dc5f",12:"7bbb5f176039f7d3dc2b",13:"6812ea9f986a1db1a6a9",14:"99e6e22e5d6b137269e9",15:"c4fcdd9f755d64995795",16:"acb4dc0e002888e741f5",17:"6741e8ad1a77a4388d0f",18:"95cfaecb949c7e2261e3",19:"741858b9ef54b3611d31",20:"e22809c43539f903c28a",21:"90d98fd5c50c9ae968da",22:"d344a511955b43dbefcc",23:"b369bcf3fef7b3d24234",24:"a750dba6fc5340758064",25:"9ee45674170ad7836ba4",26:"c8730af5d9a5f56fecc4",27:"42f63d141baef6e836f7",28:"9f017652d0f77438961c",29:"05d97551e2b48003a680",30:"d4bcd6d038b2fea6feed",31:"d97968c821f676a52e9b",32:"359d3b9b312cf5f56733",33:"bf2a2fc98cda3004cc87"}[e]+".js",s=setTimeout(n,12e4),a.onerror=a.onload=n,i.appendChild(a),o)},t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="bundles/",t.p=window.WEBPACK_PUBLIC_PATH||t.p,t.oe=function(e){throw console.error(e),e},t(t.s=360)}([,,,,,,,,,,function(e,t,n){
var r=n(22),o=n(90),i=n(74),a=n(75),s=n(55),u="prototype",l=function(e,t,n){var c,f,p,d,h=e&l.F,g=e&l.G,m=e&l.S,y=e&l.P,v=e&l.B,b=g?r:m?r[t]||(r[t]={}):(r[t]||{})[u],w=g?o:o[t]||(o[t]={}),x=w[u]||(w[u]={});g&&(n=t);for(c in n)f=!h&&b&&void 0!==b[c],p=(f?b:n)[c],d=v&&f?s(p,r):y&&"function"==typeof p?s(Function.call,p):p,b&&a(b,c,p,e&l.U),w[c]!=p&&i(w,c,d),y&&x[c]!=p&&(x[c]=p)};r.core=o,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";function r(e){window.t=e}function o(e){s.$||(s.$={}),s.$.t=e}function i(e){return e?(window._tv_languages||{})[e]||null:null}function a(){document.body&&document.body.dispatchEvent(new c.CustomEvent("tradingview-i18next-initialized"))}var s,u,l,c,f,p,d,h,g;Object.defineProperty(t,"__esModule",{value:!0}),s=window,u=function(e,t){return e},r(u),o(u),l=n(237),c=n(240),n.d(t,"translate",function(){return u}),p={translate:u},window.__tradingviewI18nextInited||(d=window.language||null,h=i(d),d&&h||(console.error("No translation data"),d="en",h=i("en")),d&&h?(g={interpolation:{prefix:"__",suffix:"__"},keySeparator:":::",lng:d,nsSeparator:":::",resources:(f={},f[d]={translation:h},f)},l.init(g,a),p.translate=l.t.bind(l),r(p.translate),o(p.translate)):a(),window.__tradingviewI18nextInited=!0)},,,function(e,t){function n(e){var t,n,r=kt[e]={};for(e=e.split(/\s+/),t=0,n=e.length;t<n;t++)r[e[t]]=!0;return r}function r(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(D,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:_t.isNumeric(n)?+n:M.test(n)?_t.parseJSON(n):n)}catch(e){}_t.data(e,t,n)}else n=void 0}return n}function o(e){for(var t in e)if(("data"!==t||!_t.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(e,t,n){var r=t+"defer",o=t+"queue",i=t+"mark",a=_t._data(e,r);!a||"queue"!==n&&_t._data(e,o)||"mark"!==n&&_t._data(e,i)||setTimeout(function(){_t._data(e,o)||_t._data(e,i)||(_t.removeData(e,r,!0),a.fire())},0)}function a(){return!1}function s(){return!0}function u(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function l(e,t,n){if(t=t||0,_t.isFunction(t))return _t.grep(e,function(e,r){return!!t.call(e,r,e)===n});if(t.nodeType)return _t.grep(e,function(e,r){return e===t===n});if("string"==typeof t){var r=_t.grep(e,function(e){return 1===e.nodeType});if(ie.test(t))return _t.filter(t,r,!n);t=_t.filter(t,r)}return _t.grep(e,function(e,r){return _t.inArray(e,t)>=0===n})}function c(e){var t=le.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function f(e,t){return _t.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e,t){if(1===t.nodeType&&_t.hasData(e)){var n,r,o,i=_t._data(e),a=_t._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;r<o;r++)_t.event.add(t,n,s[n][r])}a.data&&(a.data=_t.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(), var r=n(22),o=n(90),i=n(74),a=n(75),s=n(55),u="prototype",l=function(e,t,n){var c,f,p,d,h=e&l.F,g=e&l.G,m=e&l.S,y=e&l.P,v=e&l.B,b=g?r:m?r[t]||(r[t]={}):(r[t]||{})[u],w=g?o:o[t]||(o[t]={}),x=w[u]||(w[u]={});g&&(n=t);for(c in n)f=!h&&b&&void 0!==b[c],p=(f?b:n)[c],d=v&&f?s(p,r):y&&"function"==typeof p?s(Function.call,p):p,b&&a(b,c,p,e&l.U),w[c]!=p&&i(w,c,d),y&&x[c]!=p&&(x[c]=p)};r.core=o,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";function r(e){window.t=e}function o(e){s.$||(s.$={}),s.$.t=e}function i(e){return e?(window._tv_languages||{})[e]||null:null}function a(){document.body&&document.body.dispatchEvent(new c.CustomEvent("tradingview-i18next-initialized"))}var s,u,l,c,f,p,d,h,g;Object.defineProperty(t,"__esModule",{value:!0}),s=window,u=function(e,t){return e},r(u),o(u),l=n(237),c=n(240),n.d(t,"translate",function(){return u}),p={translate:u},window.__tradingviewI18nextInited||(d=window.language||null,h=i(d),d&&h||(console.error("No translation data"),d="en",h=i("en")),d&&h?(g={interpolation:{prefix:"__",suffix:"__"},keySeparator:":::",lng:d,nsSeparator:":::",resources:(f={},f[d]={translation:h},f)},l.init(g,a),p.translate=l.t.bind(l),r(p.translate),o(p.translate)):a(),window.__tradingviewI18nextInited=!0)},,,function(e,t){function n(e){var t,n,r=kt[e]={};for(e=e.split(/\s+/),t=0,n=e.length;t<n;t++)r[e[t]]=!0;return r}function r(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(D,"-$1").toLowerCase();if("string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:_t.isNumeric(n)?+n:M.test(n)?_t.parseJSON(n):n)}catch(e){}_t.data(e,t,n)}else n=void 0}return n}function o(e){for(var t in e)if(("data"!==t||!_t.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(e,t,n){var r=t+"defer",o=t+"queue",i=t+"mark",a=_t._data(e,r);!a||"queue"!==n&&_t._data(e,o)||"mark"!==n&&_t._data(e,i)||setTimeout(function(){_t._data(e,o)||_t._data(e,i)||(_t.removeData(e,r,!0),a.fire())},0)}function a(){return!1}function s(){return!0}function u(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function l(e,t,n){if(t=t||0,_t.isFunction(t))return _t.grep(e,function(e,r){return!!t.call(e,r,e)===n});if(t.nodeType)return _t.grep(e,function(e,r){return e===t===n});if("string"==typeof t){var r=_t.grep(e,function(e){return 1===e.nodeType});if(ie.test(t))return _t.filter(t,r,!n);t=_t.filter(t,r)}return _t.grep(e,function(e,r){return _t.inArray(e,t)>=0===n})}function c(e){var t=le.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function f(e,t){return _t.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e,t){if(1===t.nodeType&&_t.hasData(e)){var n,r,o,i=_t._data(e),a=_t._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;r<o;r++)_t.event.add(t,n,s[n][r])}a.data&&(a.data=_t.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),
t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?t.outerHTML=e.outerHTML:"input"!==n||"checkbox"!==e.type&&"radio"!==e.type?"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(_t.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached"))}function h(e){return void 0!==e.getElementsByTagName?e.getElementsByTagName("*"):void 0!==e.querySelectorAll?e.querySelectorAll("*"):[]}function g(e){"checkbox"!==e.type&&"radio"!==e.type||(e.defaultChecked=e.checked)}function m(e){var t=(e.nodeName||"").toLowerCase();"input"===t?g(e):"script"!==t&&void 0!==e.getElementsByTagName&&_t.grep(e.getElementsByTagName("input"),g)}function y(e){var t=bt.createElement("div");return ke.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function v(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o="width"===t?1:0,i=4;if(r>0){if("border"!==n)for(;o<i;o+=2)n||(r-=parseFloat(_t.css(e,"padding"+Ae[o]))||0),"margin"===n?r+=parseFloat(_t.css(e,n+Ae[o]))||0:r-=parseFloat(_t.css(e,"border"+Ae[o]+"Width"))||0;return r+"px"}if(r=Me(e,t),(r<0||null==r)&&(r=e.style[t]),Oe.test(r))return r;if(r=parseFloat(r)||0,n)for(;o<i;o+=2)r+=parseFloat(_t.css(e,"padding"+Ae[o]))||0,"padding"!==n&&(r+=parseFloat(_t.css(e,"border"+Ae[o]+"Width"))||0),"margin"===n&&(r+=parseFloat(_t.css(e,n+Ae[o]))||0);return r+"px"}function b(e){return function(t,n){if("string"!=typeof t&&(n=t,t="*"),_t.isFunction(n))for(var r,o,i,a=t.toLowerCase().split(Xe),s=0,u=a.length;s<u;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function w(e,t,n,r,o,i){o=o||t.dataTypes[0],i=i||{},i[o]=!0;for(var a,s=e[o],u=0,l=s?s.length:0,c=e===Je;u<l&&(c||!a);u++)"string"==typeof(a=s[u](t,n,r))&&(!c||i[a]?a=void 0:(t.dataTypes.unshift(a),a=w(e,t,n,r,a,i)));return!c&&a||i["*"]||(a=w(e,t,n,r,"*",i)),a}function x(e,t){var n,r,o=_t.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);r&&_t.extend(!0,e,r)}function _(e,t,n,r){if(_t.isArray(t))_t.each(t,function(t,o){n||Fe.test(e)?r(e,o):_(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==_t.type(t))r(e,t);else for(var o in t)_(e+"["+o+"]",t[o],n,r)}function k(e,t,n){var r,o,i,a,s=e.contents,u=e.dataTypes,l=e.responseFields;for(o in l)o in n&&(t[l[o]]=n[o]);for(;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("content-type"));if(r)for(o in s)if(s[o]&&s[o].test(r)){u.unshift(o);break}if(u[0]in n)i=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){i=o;break}a||(a=o)}i=i||a}if(i)return i!==u[0]&&u.unshift(i),n[i]}function T(e,t){e.dataFilter&&(t=e.dataFilter(t,e.dataType));var n,r,o,i,a,s,u,l,c=e.dataTypes,f={},p=c.length,d=c[0];for(n=1;n<p;n++){if(1===n)for(r in e.converters)"string"==typeof r&&(f[r.toLowerCase()]=e.converters[r]);if(i=d,"*"===(d=c[n]))d=i;else if("*"!==i&&i!==d){ t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?t.outerHTML=e.outerHTML:"input"!==n||"checkbox"!==e.type&&"radio"!==e.type?"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(_t.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached"))}function h(e){return void 0!==e.getElementsByTagName?e.getElementsByTagName("*"):void 0!==e.querySelectorAll?e.querySelectorAll("*"):[]}function g(e){"checkbox"!==e.type&&"radio"!==e.type||(e.defaultChecked=e.checked)}function m(e){var t=(e.nodeName||"").toLowerCase();"input"===t?g(e):"script"!==t&&void 0!==e.getElementsByTagName&&_t.grep(e.getElementsByTagName("input"),g)}function y(e){var t=bt.createElement("div");return ke.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function v(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o="width"===t?1:0,i=4;if(r>0){if("border"!==n)for(;o<i;o+=2)n||(r-=parseFloat(_t.css(e,"padding"+Ae[o]))||0),"margin"===n?r+=parseFloat(_t.css(e,n+Ae[o]))||0:r-=parseFloat(_t.css(e,"border"+Ae[o]+"Width"))||0;return r+"px"}if(r=Me(e,t),(r<0||null==r)&&(r=e.style[t]),Oe.test(r))return r;if(r=parseFloat(r)||0,n)for(;o<i;o+=2)r+=parseFloat(_t.css(e,"padding"+Ae[o]))||0,"padding"!==n&&(r+=parseFloat(_t.css(e,"border"+Ae[o]+"Width"))||0),"margin"===n&&(r+=parseFloat(_t.css(e,n+Ae[o]))||0);return r+"px"}function b(e){return function(t,n){if("string"!=typeof t&&(n=t,t="*"),_t.isFunction(n))for(var r,o,i,a=t.toLowerCase().split(Xe),s=0,u=a.length;s<u;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function w(e,t,n,r,o,i){o=o||t.dataTypes[0],i=i||{},i[o]=!0;for(var a,s=e[o],u=0,l=s?s.length:0,c=e===Je;u<l&&(c||!a);u++)"string"==typeof(a=s[u](t,n,r))&&(!c||i[a]?a=void 0:(t.dataTypes.unshift(a),a=w(e,t,n,r,a,i)));return!c&&a||i["*"]||(a=w(e,t,n,r,"*",i)),a}function x(e,t){var n,r,o=_t.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);r&&_t.extend(!0,e,r)}function _(e,t,n,r){if(_t.isArray(t))_t.each(t,function(t,o){n||Fe.test(e)?r(e,o):_(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==_t.type(t))r(e,t);else for(var o in t)_(e+"["+o+"]",t[o],n,r)}function k(e,t,n){var r,o,i,a,s=e.contents,u=e.dataTypes,l=e.responseFields;for(o in l)o in n&&(t[l[o]]=n[o]);for(;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("content-type"));if(r)for(o in s)if(s[o]&&s[o].test(r)){u.unshift(o);break}if(u[0]in n)i=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){i=o;break}a||(a=o)}i=i||a}if(i)return i!==u[0]&&u.unshift(i),n[i]}function T(e,t){e.dataFilter&&(t=e.dataFilter(t,e.dataType));var n,r,o,i,a,s,u,l,c=e.dataTypes,f={},p=c.length,d=c[0];for(n=1;n<p;n++){if(1===n)for(r in e.converters)"string"==typeof r&&(f[r.toLowerCase()]=e.converters[r]);if(i=d,"*"===(d=c[n]))d=i;else if("*"!==i&&i!==d){
if(a=i+" "+d,!(s=f[a]||f["* "+d])){l=void 0;for(u in f)if(o=u.split(" "),(o[0]===i||"*"===o[0])&&(l=f[o[1]+" "+d])){u=f[u],!0===u?s=l:!0===l&&(s=u);break}}s||l||_t.error("No conversion from "+a.replace(" "," to ")),!0!==s&&(t=s?s(t):l(u(t)))}}return t}function E(){try{return new window.XMLHttpRequest}catch(e){}}function C(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function S(){return setTimeout(O,0),gt=_t.now()}function O(){gt=void 0}function N(e,t){var n={};return _t.each(ht.concat.apply([],ht.slice(0,t)),function(){n[this]=e}),n}function P(e){if(!ut[e]){var t=bt.body,n=_t("<"+e+">").appendTo(t),r=n.css("display");n.remove(),"none"!==r&&""!==r||(lt||(lt=bt.createElement("iframe"),lt.frameBorder=lt.width=lt.height=0),t.appendChild(lt),ct&&lt.createElement||(ct=(lt.contentWindow||lt.contentDocument).document,ct.write((_t.support.boxModel?"<!doctype html>":"")+"<html><body>"),ct.close()),n=ct.createElement(e),ct.body.appendChild(n),r=_t.css(n,"display"),t.removeChild(lt)),ut[e]=r}return ut[e]}function j(e){return _t.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}var A,M,D,L,R,F,I,H,U,W,B,z,q,$,V,K,X,G,Q,Y,J,Z,ee,te,ne,re,oe,ie,ae,se,ue,le,ce,fe,pe,de,he,ge,me,ye,ve,be,we,xe,_e,ke,Te,Ee,Ce,Se,Oe,Ne,Pe,je,Ae,Me,De,Le,Re,Fe,Ie,He,Ue,We,Be,ze,qe,$e,Ve,Ke,Xe,Ge,Qe,Ye,Je,Ze,et,tt,nt,rt,ot,it,at,st,ut,lt,ct,ft,pt,dt,ht,gt,mt,yt,vt,bt=window.document,wt=window.navigator,xt=window.location,_t=function(){function e(){if(!i.isReady){try{bt.documentElement.doScroll("left")}catch(t){return void setTimeout(e,1)}i.ready()}}var t,n,r,o,i=function(e,n){return new i.fn.init(e,n,t)},a=window.jQuery,s=window.$,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,l=/\S/,c=/^\s+/,f=/\s+$/,p=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,d=/^[\],:{}\s]*$/,h=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,g=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,y=/(webkit)[ \/]([\w.]+)/,v=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,x=/-([a-z]|[0-9])/gi,_=/^-ms-/,k=function(e,t){return(t+"").toUpperCase()},T=wt.userAgent,E=Object.prototype.toString,C=Object.prototype.hasOwnProperty,S=Array.prototype.push,O=Array.prototype.slice,N=String.prototype.trim,P=Array.prototype.indexOf,j={};return i.fn=i.prototype={constructor:i,init:function(e,t,n){var r,o,a,s;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("body"===e&&!t&&bt.body)return this.context=bt,this[0]=bt.body,this.selector=e,this.length=1,this;if("string"==typeof e){if(!(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:u.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1])return t=t instanceof i?t[0]:t,s=t?t.ownerDocument||t:bt,a=p.exec(e),a?i.isPlainObject(t)?(e=[bt.createElement(a[1])],i.fn.attr.call(e,t,!0)):e=[s.createElement(a[1])]:(a=i.buildFragment([r[1]],[s]),e=(a.cacheable?i.clone(a.fragment):a.fragment).childNodes),i.merge(this,e);if((o=bt.getElementById(r[2]))&&o.parentNode){ if(a=i+" "+d,!(s=f[a]||f["* "+d])){l=void 0;for(u in f)if(o=u.split(" "),(o[0]===i||"*"===o[0])&&(l=f[o[1]+" "+d])){u=f[u],!0===u?s=l:!0===l&&(s=u);break}}s||l||_t.error("No conversion from "+a.replace(" "," to ")),!0!==s&&(t=s?s(t):l(u(t)))}}return t}function E(){try{return new window.XMLHttpRequest}catch(e){}}function C(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function S(){return setTimeout(O,0),gt=_t.now()}function O(){gt=void 0}function N(e,t){var n={};return _t.each(ht.concat.apply([],ht.slice(0,t)),function(){n[this]=e}),n}function P(e){if(!ut[e]){var t=bt.body,n=_t("<"+e+">").appendTo(t),r=n.css("display");n.remove(),"none"!==r&&""!==r||(lt||(lt=bt.createElement("iframe"),lt.frameBorder=lt.width=lt.height=0),t.appendChild(lt),ct&&lt.createElement||(ct=(lt.contentWindow||lt.contentDocument).document,ct.write((_t.support.boxModel?"<!doctype html>":"")+"<html><body>"),ct.close()),n=ct.createElement(e),ct.body.appendChild(n),r=_t.css(n,"display"),t.removeChild(lt)),ut[e]=r}return ut[e]}function j(e){return _t.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}var A,M,D,L,R,F,I,H,U,W,B,z,q,$,V,K,X,G,Q,Y,J,Z,ee,te,ne,re,oe,ie,ae,se,ue,le,ce,fe,pe,de,he,ge,me,ye,ve,be,we,xe,_e,ke,Te,Ee,Ce,Se,Oe,Ne,Pe,je,Ae,Me,De,Le,Re,Fe,Ie,He,Ue,We,Be,ze,qe,$e,Ve,Ke,Xe,Ge,Qe,Ye,Je,Ze,et,tt,nt,rt,ot,it,at,st,ut,lt,ct,ft,pt,dt,ht,gt,mt,yt,vt,bt=window.document,wt=window.navigator,xt=window.location,_t=function(){function e(){if(!i.isReady){try{bt.documentElement.doScroll("left")}catch(t){return void setTimeout(e,1)}i.ready()}}var t,n,r,o,i=function(e,n){return new i.fn.init(e,n,t)},a=window.jQuery,s=window.$,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,l=/\S/,c=/^\s+/,f=/\s+$/,p=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,d=/^[\],:{}\s]*$/,h=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,g=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,y=/(webkit)[ \/]([\w.]+)/,v=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,x=/-([a-z]|[0-9])/gi,_=/^-ms-/,k=function(e,t){return(t+"").toUpperCase()},T=wt.userAgent,E=Object.prototype.toString,C=Object.prototype.hasOwnProperty,S=Array.prototype.push,O=Array.prototype.slice,N=String.prototype.trim,P=Array.prototype.indexOf,j={};return i.fn=i.prototype={constructor:i,init:function(e,t,n){var r,o,a,s;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("body"===e&&!t&&bt.body)return this.context=bt,this[0]=bt.body,this.selector=e,this.length=1,this;if("string"==typeof e){if(!(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:u.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1])return t=t instanceof i?t[0]:t,s=t?t.ownerDocument||t:bt,a=p.exec(e),a?i.isPlainObject(t)?(e=[bt.createElement(a[1])],i.fn.attr.call(e,t,!0)):e=[s.createElement(a[1])]:(a=i.buildFragment([r[1]],[s]),e=(a.cacheable?i.clone(a.fragment):a.fragment).childNodes),i.merge(this,e);if((o=bt.getElementById(r[2]))&&o.parentNode){