/* Minification failed. Returning unminified contents.
(1,269-272): run-time error JS1009: Expected '}': ...
(1,269): run-time error JS1004: Expected ';'
(1,402-407): run-time error JS1006: Expected ')': const
(1,402-407): run-time error JS1006: Expected ')': const
(1,402): run-time error JS1004: Expected ';'
(1,21246-21247): run-time error JS1002: Syntax error: }
(1,21247-21248): run-time error JS1195: Expected expression: )
(1,21248-21249): run-time error JS1195: Expected expression: )
(51,56-58): run-time error JS1006: Expected ')': =>
(51,55): run-time error JS1004: Expected ';'
(53,50): run-time error JS1004: Expected ';'
(56,30): run-time error JS1004: Expected ';'
(69,14-15): run-time error JS1195: Expected expression: )
(90,51): run-time error JS1004: Expected ';'
(704,33-36): run-time error JS1009: Expected '}': ...
(705,37): run-time error JS1004: Expected ';'
(705,37-38): run-time error JS1195: Expected expression: :
(706,42): run-time error JS1004: Expected ';'
(706,42-43): run-time error JS1195: Expected expression: :
(707,42): run-time error JS1004: Expected ';'
(707,42-43): run-time error JS1195: Expected expression: :
(708,48): run-time error JS1004: Expected ';'
(708,48-49): run-time error JS1195: Expected expression: :
(709,41): run-time error JS1004: Expected ';'
(709,41-42): run-time error JS1195: Expected expression: :
(710,46): run-time error JS1004: Expected ';'
(710,46-47): run-time error JS1195: Expected expression: :
(711,55): run-time error JS1004: Expected ';'
(711,55-56): run-time error JS1195: Expected expression: :
(712,40): run-time error JS1004: Expected ';'
(712,40-41): run-time error JS1195: Expected expression: :
(713,49): run-time error JS1004: Expected ';'
(713,49-50): run-time error JS1195: Expected expression: :
(714,54): run-time error JS1004: Expected ';'
(714,54-55): run-time error JS1195: Expected expression: :
(715,45): run-time error JS1004: Expected ';'
(715,45-46): run-time error JS1195: Expected expression: :
(717,46): run-time error JS1004: Expected ';'
(717,46-47): run-time error JS1195: Expected expression: :
(718,50): run-time error JS1004: Expected ';'
(718,50-51): run-time error JS1195: Expected expression: :
(719,39): run-time error JS1004: Expected ';'
(719,39-40): run-time error JS1195: Expected expression: :
(720,41): run-time error JS1004: Expected ';'
(720,41-42): run-time error JS1195: Expected expression: :
(721,40): run-time error JS1004: Expected ';'
(721,40-41): run-time error JS1195: Expected expression: :
(722,49): run-time error JS1004: Expected ';'
(722,49-50): run-time error JS1195: Expected expression: :
(723,54): run-time error JS1004: Expected ';'
(723,54-55): run-time error JS1195: Expected expression: :
(724,42): run-time error JS1004: Expected ';'
(724,42-43): run-time error JS1195: Expected expression: :
(725,53): run-time error JS1004: Expected ';'
(725,53-54): run-time error JS1195: Expected expression: :
(726,55): run-time error JS1004: Expected ';'
(726,55-56): run-time error JS1195: Expected expression: :
(727,47): run-time error JS1004: Expected ';'
(727,47-48): run-time error JS1195: Expected expression: :
(728,49): run-time error JS1004: Expected ';'
(728,49-50): run-time error JS1195: Expected expression: :
(729,39): run-time error JS1004: Expected ';'
(729,39-40): run-time error JS1195: Expected expression: :
(730,29-30): run-time error JS1195: Expected expression: }
(733,21-22): run-time error JS1006: Expected ')': }
(732,26): run-time error JS1004: Expected ';'
(733,22-23): run-time error JS1195: Expected expression: )
(734,21-22): run-time error JS1195: Expected expression: .
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TradingView={})}(this,(function(t){"use strict";function e(t,n){const i={...t};for(const o in n)"object"!=typeof t[o]||null===t[o]||Array.isArray(t[o])?void 0!==n[o]&&(i[o]=n[o]):i[o]=e(t[o],n[o]);return i}const n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,news:!1,datawindow:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[],indicators:[],drawingTools:[]}},i=JSON.parse('[{"iso":"ar","dir":"rtl","language":"ar"},{"iso":"pt","dir":"ltr","language":"pt"},{"iso":"ca","dir":"ltr","language":"ca_ES"},{"iso":"cs","dir":"ltr","language":"cs"},{"iso":"de","dir":"ltr","language":"de"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"es","dir":"ltr","language":"es"},{"iso":"fa","dir":"rtl","language":"fa"},{"iso":"fr","dir":"ltr","language":"fr"},{"iso":"he","dir":"rtl","language":"he_IL"},{"iso":"hu","dir":"ltr","language":"hu_HU"},{"iso":"id","dir":"ltr","language":"id_ID"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"it","dir":"ltr","language":"it"},{"iso":"ja","dir":"ltr","language":"ja"},{"iso":"ko","dir":"ltr","language":"ko"},{"iso":"ms","dir":"ltr","language":"ms_MY"},{"iso":"pl","dir":"ltr","language":"pl"},{"iso":"ru","dir":"ltr","language":"ru"},{"iso":"sv","dir":"ltr","language":"sv"},{"iso":"th","dir":"ltr","language":"th"},{"iso":"tr","dir":"ltr","language":"tr"},{"iso":"vi","dir":"ltr","language":"vi"},{"iso":"zh-Hans","dir":"ltr","language":"zh"},{"iso":"zh-Hant","dir":"ltr","language":"zh_TW"},{"iso":"el","dir":"ltr","language":"el"},{"iso":"nl","dir":"ltr","language":"nl_NL"},{"iso":"ro","dir":"ltr","language":"ro"}]');let o=!1;function s(){return"CL v25.000 (internal id 1394882f @ 2023-05-22T15:05:42.670Z)"}const r=class{constructor(t){var i;if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!t.datafeed)throw new Error("Datafeed is not defined");(null===(i=t.overrides)||void 0===i?void 0:i["mainSeriesProperties.priceAxisProperties.lockScale"])&&(console.warn("mainSeriesProperties.priceAxisProperties.lockScale can not be set to true within the widget constructor"),delete t.overrides["mainSeriesProperties.priceAxisProperties.lockScale"]),this._options=e(n,t),"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._options.debug&&(o||(o=!0,console.log("Using CL v25.000 (internal id 1394882f @ 2023-05-22T15:05:42.670Z)"))),this._create()}setDebugMode(t){this._innerAPI().setDebugMode(t)}onChartReady(t){this._ready?t.call(this):this._readyHandlers.push(t)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(t){this._doWhenInnerApiLoaded((e=>{e.onGrayedObjectClicked(t)}))}onShortcut(t,e){this._doWhenInnerWindowLoaded((n=>{n.createShortcutAction(t,e)}))}subscribe(t,e){this._doWhenInnerApiLoaded((n=>{n.subscribe(t,e)}))}unsubscribe(t,e){this._doWhenInnerApiLoaded((n=>{n.unsubscribe(t,e)}))}chart(t){return this._innerAPI().chart(t)}getLanguage(){return this._options.locale}setSymbol(t,e,n){this._innerAPI().changeSymbol(t,e,n)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._doWhenInnerApiLoaded((t=>{t.closePopupsAndDialogs()}))}selectLineTool(t,e){this._innerAPI().selectLineTool(t,e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(t){this._innerAPI().saveChart(t)}load(t,e){this._innerAPI().loadChart({json:t,extendedData:e})}getSavedCharts(t){this._innerAPI().getSavedCharts(t)}loadChartFromServer(t){this._innerAPI().loadChartFromServer(t)}saveChartToServer(t,e,n){this._innerAPI().saveChartToServer(t,e,n)}removeChartFromServer(t,e){this._innerAPI().removeChartFromServer(t,e)}onContextMenu(t){this._doWhenInnerApiLoaded((e=>{e.onContextMenu(t)}))}createButton(t){return this._innerWindow().createButton(t)}createDropdown(t){return this._innerWindow().createDropdown(t)}showNoticeDialog(t){this._doWhenInnerApiLoaded((e=>{e.showNoticeDialog(t)}))}showConfirmDialog(t){this._doWhenInnerApiLoaded((e=>{e.showConfirmDialog(t)}))}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}getStudyInputs(t){return this._innerAPI().getStudyInputs(t)}getStudyStyles(t){return this._innerAPI().getStudyStyles(t)}addCustomCSSFile(t){this._innerWindow().addCustomCSSFile(t)}applyOverrides(t){this._options=e(this._options,{overrides:t}),this._doWhenInnerWindowLoaded((e=>{e.applyOverrides(t)}))}applyStudiesOverrides(t){this._doWhenInnerWindowLoaded((e=>{e.applyStudiesOverrides(t)}))}watchList(){return this._innerAPI().watchlist()}news(){return this._innerAPI().news()}widgetbar(){return this._innerAPI().widgetbar()}activeChart(){return this._innerAPI().activeChart()}setActiveChart(t){return this._innerAPI().setActiveChart(t)}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(t){this._innerAPI().setLayout(t)}layoutName(){return this._innerAPI().layoutName()}changeTheme(t,e){return this._innerWindow().changeTheme(t,e)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._doWhenInnerApiLoaded((t=>{t.takeScreenshot()}))}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllCharts(t){this._innerAPI().drawOnAllCharts(t)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(t){this._innerAPI().setIntervalLinkingEnabled(t)}setTimeFrame(t){this._innerAPI().setTimeFrame(t)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}dateRangeSync(){return this._innerAPI().dateRangeSync()}setFeatureEnabled(t,e){this._innerAPI().setFeatureEnabled(t,e)}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(t){return this._innerAPI().takeClientScreenshot(t)}navigationButtonsVisibility(){return this._innerWindow().getNavigationButtonsVisibility()}paneButtonsVisibility(){return this._innerWindow().getPaneButtonsVisibility()}dateFormat(){return this._innerWindow().getDateFormat()}timeHoursFormat(){return this._innerWindow().getTimeHoursFormat()}currencyAndUnitVisibility(){return this._innerWindow().getCurrencyAndUnitVisibility()}supportedChartTypes(){return this._innerAPI().supportedChartTypes()}linking(){return this._innerAPI().linking}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_doWhenInnerWindowLoaded(t){this._ready?t(this._innerWindow()):this._innerWindowLoaded.then((()=>{t(this._innerWindow())}))}_doWhenInnerApiLoaded(t){this._doWhenInnerWindowLoaded((e=>{e.doWhenApiIsReady((()=>t(this._innerAPI())))}))}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px",a&&setTimeout((()=>{this._iFrame.style.height=window.innerHeight+"px"}),30))}_create(){var t,e;const n=null!==(e=null===(t=this._options.enabled_features)||void 0===t?void 0:t.includes("iframe_loading_compatibility_mode"))&&void 0!==e&&e,[i,o]=this._render(!n);this._options.container_id&&console.warn("`container_id` is now deprecated. Please use `container` instead to either still pass a string or an `HTMLElement`.");const s=this._options.container_id||this._options.container,r="string"==typeof s?document.getElementById(s):s;if(null===r)throw new Error(`There is no such element - #${this._options.container}`);r.innerHTML=i,this._iFrame=r.querySelector(`#${this._id}`);const a=this._iFrame;n&&(a.contentWindow?(a.contentWindow.document.open(),a.contentWindow.document.write(o),a.contentWindow.document.close()):console.warn("Unable to locate contentWindow for the created iframe. Please try disabling the `iframe_loading_compatibility_mode` featureset.")),(this._options.autosize||this._options.fullscreen)&&(a.style.width="100%",this._options.fullscreen||(a.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((t=>{const e=()=>{a.removeEventListener("load",e,!1),t()};a.addEventListener("load",e,!1)})),this._innerWindowLoaded.then((()=>{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(t){console.error(t)}this._innerWindow().initializationFinished()}))}))}_render(t){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode,customTranslateFunction:this._options.custom_translate_function,symbolSearchComplete:this._options.symbol_search_complete,contextMenu:this._options.context_menu,settingsOverrides:this._options.settings_overrides,timeframe:this._options.timeframe,customTimezones:this._options.custom_timezones},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");if(this._options.library_path&&!this._options.library_path.endsWith("/")&&console.warn("library_path option should contain a trailing forward slash"),this._options.locale){const t=encodeURIComponent(this._options.locale);i.findIndex((e=>e.language===t))>=0||(console.warn("locale isn't supported. Using default of `en`."),this._options.locale="en")}const n=function(t,e){var n;const o=new URL(`${t||""}`,location.href).href,s=JSON.parse('["bundles/runtime.04214899cac17f000613.js","bundles/__LANG__.137.72f123ce0fa2a1d14aff.js","bundles/6783.6a1bfc6cd105f6a266ca.css","bundles/6783.6a1bfc6cd105f6a266ca.rtl.css","bundles/6151.129f302a262c92b6bcf4.js","bundles/library.6297b1e4665eaf652aeb.js"]'),r=encodeURIComponent(e),a=null!==(n=i.find((t=>t.language===r)))&&void 0!==n?n:{iso:"en",dir:"ltr"},d=`lang="${a.iso}" dir="${a.dir}"`,l=`\n${function(t,e,n){if(void 0===t)return"";const i=[],o=[],s=/\.css$/i,r=/\.rtl\.css$/i;for(const a of t)a.endsWith(".js")?i.push(`<script defer crossorigin="anonymous" src="${a.replace("__LANG__",n)}"><\/script>`):s.test(a)&&e===r.test(a)&&o.push(`<link type="text/css" href="${a}" rel="stylesheet"/>`);return[...i,...o].join("\n")}(s,"rtl"===a.dir,r)}\n`;return`<!DOCTYPE html><html ${(h={bundles:l,localeLanguage:r,htmlAttrs:d,libraryPath:o}).htmlAttrs}><head><base href="${h.libraryPath}"><meta charset="utf-8"><script>window===window.parent&&(location.href="about:blank")<\/script> ${h.bundles} </head><body class="chart-page unselectable on-widget"><div class="loading-indicator" id="loading-indicator"></div><script>var JSServer={},__initialEnabledFeaturesets=["charting_library"]<\/script><script>(function() {\n\t\twindow.urlParams = (function () {\n\t\t\tvar match,\n\t\t\t\tpl\t = /\\+/g,  // Regex for replacing addition symbol with a space\n\t\t\t\tsearch = /([^&=]+)=?([^&]*)/g,\n\t\t\t\tdecode = function (s) { return decodeURIComponent(s.replace(pl, ' ')).replace(/<\\/?[^>]+(>|$)/g, ''); },\n\t\t\t\tquery = function() {\n\t\t\t\t\t// We don't use hash on the url because: safari 13 throws an error if you attempt this\n\t\t\t\t\t// on a blob, and safari 14 will strip hash from blob urls.\n\t\t\t\t\tif (frameElement && frameElement.dataset.widgetOptions) {\n\t\t\t\t\t\treturn frameElement.dataset.widgetOptions;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow "Unexpected use of this page";\n\t\t\t\t\t}\n\t\t\t\t}(),\n\t\t\t\tresult = {};\n\n\t\t\twhile (match = search.exec(query)) {\n\t\t\t\tresult[decode(match[1])] = decode(match[2]);\n\t\t\t}\n\n\t\t\tvar additionalSettingsObject = window.parent[result.uid];\n\n\t\t\tvar customObjectNames = ['datafeed', 'customFormatters', 'brokerFactory', 'save_load_adapter', 'customTranslateFunction', 'contextMenu'];\n\n\t\t\tfor (var p in additionalSettingsObject) {\n\t\t\t\tif (customObjectNames.indexOf(p) === -1) {\n\t\t\t\t\tresult[p] = JSON.stringify(additionalSettingsObject[p]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\twindow.locale = urlParams.locale;\n\t\twindow.language = urlParams.locale; // a very big attention needed here\n\t\twindow.customTranslateFunction = window.parent[urlParams.uid].customTranslateFunction;\n\n\t\twindow.addCustomCSSFile = function(href) {\n\t\t\tvar link = document.createElement('link');\n\t\t\tlink.setAttribute('type', 'text/css');\n\t\t\tlink.setAttribute('rel', 'stylesheet');\n\t\t\tlink.setAttribute('href', href);\n\t\t\tlink.setAttribute('cross-origin', 'anonymous');\n\n\t\t\twindow.loadedCustomCss = new Promise((resolve) => {\n\t\t\t\tlink.onload = resolve;\n\t\t\t\tlink.onerror = resolve;\n\t\t\t});\n\t\t\tdocument.body.appendChild(link);\n\t\t};\n\n\t\twindow.loadedCustomCss = Promise.resolve();\n\t\tif (!!urlParams.customCSS) {\n\t\t\twindow.addCustomCSSFile(urlParams.customCSS);\n\t\t}\n\n\t\tvar loadingScreenParams = {};\n\n\t\tif (typeof urlParams.loading_screen === 'string') {\n\t\t\ttry {\n\t\t\t\tloadingScreenParams = JSON.parse(urlParams.loading_screen);\n\t\t\t} catch(e) {}\n\t\t}\n\n\t\tvar loadingIndicatorElement = document.getElementById('loading-indicator');\n\n\t\tif (loadingScreenParams.backgroundColor) {\n\t\t\tloadingIndicatorElement.style = 'background-color: ' + loadingScreenParams.backgroundColor;\n\t\t}\n\n\t\t!function(){"use strict";var t,e=new WeakMap;!function(t){t[t.Element=1]="Element",t[t.Document=9]="Document"}(t||(t={}));var n={mini:"xsmall",xsmall:"xsmall",small:"small",medium:"medium",large:"large"};var i,s,o,r,l,c=(void 0===l&&(l=""),i='<div class="tv-spinner '.concat(l,'" role="progressbar"></div>'),o=function(n,i){var s,o;return s=null==i?document.documentElement:i.nodeType===t.Document?i.documentElement:i,e&&(o=e.get(s)),o||((o=s.ownerDocument.createRange()).selectNodeContents(s),e&&e.set(s,o)),o.createContextualFragment(n)}(i,s),null!==(r=o.firstElementChild)&&o.removeChild(r),r),a=function(){function t(t){this._shown=!1,this._el=c.cloneNode(!0),this.setSize(n[t||"large"])}return t.prototype.spin=function(t){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=t,void 0!==t&&t.appendChild(this._el)),this._shown=!0,this},t.prototype.stop=function(t){return t&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this},t.prototype.setStyle=function(t){var e=this;return Object.keys(t).forEach((function(n){var i=t[n];void 0!==i&&e._el.style.setProperty(n,i)})),this},t.prototype.style=function(){return this._el.style},t.prototype.setSize=function(t){var e=void 0!==t?"tv-spinner--size_".concat(t):"";return this._el.className="tv-spinner ".concat(e," ").concat(this._shown?"tv-spinner--shown":""),this},t.prototype.getEl=function(){return this._el},t.prototype.destroy=function(){this.stop(),delete this._el,delete this._container},t}();window.Spinner=a}();\n\n\n\t\tvar spinnerColor = (loadingScreenParams.foregroundColor) ? loadingScreenParams.foregroundColor : undefined;\n\n\t\tvar loadingSpinner = new Spinner('large').setStyle({\n\t\t\t'--tv-spinner-color': spinnerColor,\n\t\t\tzIndex: String(2e9),\n\t\t});\n\t\tloadingSpinner.getEl().classList.add('spinner');\n\t\tloadingSpinner.spin(loadingIndicatorElement);\n\t})();<\/script></body></html>`;var h}(this._options.library_path||"",this._options.locale);let o=new URL("about:blank");if(t){const t=new Blob([n],{type:"text/html"}),e=URL.createObjectURL(t);o=new URL(e)}const s="symbol="+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(this._options.toolbar_bg.replace("#","")):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.custom_font_family?"&customFontFamily="+encodeURIComponent(this._options.custom_font_family):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(this._options.debug))+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"")+(this._options.header_widget_buttons_mode?"&header_widget_buttons_mode="+encodeURIComponent(String(this._options.header_widget_buttons_mode)):"")+(this._options.time_scale?"&time_scale="+encodeURIComponent(JSON.stringify(this._options.time_scale)):"");return[`<iframe\n\t\tid="${this._id}" name="${this._id}" src="${o.href}" data-widget-options="${s}"\n\t\t${this._options.autosize||this._options.fullscreen?"":`width="${this._options.width}" height="${this._options.height}"`} title="Financial Chart" frameborder="0" allowTransparency="true" scrolling="no" allowfullscreen style="display:block;">\n\t</iframe>`,n]}};"undefined"!=typeof window&&(window.TradingView=window.TradingView||{},window.TradingView.version=s);const a=!("undefined"==typeof window||!window.navigator||!window.navigator.userAgent)&&window.navigator.userAgent.includes("CriOS");t.version=s,t.widget=r,Object.defineProperty(t,"__esModule",{value:!0})}));
;
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
        typeof define === 'function' && define.amd ? define(['exports'], factory) :
            (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Datafeeds = {}));
}(this, (function (exports) {
    'use strict';

    /**
     * If you want to enable logs from datafeed set it to `true`
     */
    function logMessage(message) {
    }
    function getErrorMessage(error) {
        if (error === undefined) {
            return '';
        }
        else if (typeof error === 'string') {
            return error;
        }
        return error.message;
    }

    class HistoryProvider {
        constructor(datafeedUrl, requester, limitedServerResponse) {
            this._datafeedUrl = datafeedUrl;
            this._requester = requester;
            this._limitedServerResponse = limitedServerResponse;
        }

        getBars(symbolInfo, resolution, periodParams) {          

            const requestParams = {
                symbol: symbolInfo.ticker || '',
                from: periodParams.from,
                to: periodParams.to,
                rs: resolution,
                ajust: withAdjust,
            };

            if (periodParams.countBack !== undefined) {
                requestParams.countback = periodParams.countBack;
            }
            if (symbolInfo.currency_code !== undefined) {
                requestParams.currencyCode = symbolInfo.currency_code;
            }
            if (symbolInfo.unit_id !== undefined) {
                requestParams.unitId = symbolInfo.unit_id;
            }
            return new Promise(async (resolve, reject) => {
                try {
                    const initialResponse = await this._requester.sendRequest(this._datafeedUrl, 'history', requestParams);
                    const result = this._processHistoryResponse(initialResponse);
                    if (this._limitedServerResponse) {
                        await this._processTruncatedResponse(result, requestParams);
                    }
                    resolve(result);

                }
                catch (e) {
                    if (e instanceof Error || typeof e === 'string') {
                        const reasonString = getErrorMessage(e);
                        // tslint:disable-next-line:no-console
                        console.warn(`HistoryProvider: getBars() failed, error=${reasonString}`);
                        reject(reasonString);
                    }
                }
            });
        }
        async _processTruncatedResponse(result, requestParams) {
            let lastResultLength = result.bars.length;

            try {
                while (this._limitedServerResponse &&
                    this._limitedServerResponse.maxResponseLength > 0 &&
                    this._limitedServerResponse.maxResponseLength === lastResultLength &&
                    requestParams.from < requestParams.to
                ) {
                    // adjust request parameters for follow-up request
                    if (requestParams.countback) {
                        requestParams.countback = requestParams.countback - lastResultLength;
                    }
                    if (this._limitedServerResponse.expectedOrder === 'earliestFirst') {
                        requestParams.from = Math.round(result.bars[result.bars.length - 1].time / 1000);
                    }
                    else {
                        requestParams.to = Math.round(result.bars[0].time / 1000);
                    }
                    const followupResponse = await this._requester.sendRequest(this._datafeedUrl, 'history', requestParams);
                    const followupResult = this._processHistoryResponse(followupResponse);
                    lastResultLength = followupResult.bars.length;
                    // merge result with results collected so far
                    if (this._limitedServerResponse.expectedOrder === 'earliestFirst') {
                        if (followupResult.bars[0].time === result.bars[result.bars.length - 1].time) {
                            // Datafeed shouldn't include a value exactly matching the `to` timestamp but in case it does
                            // we will remove the duplicate.
                            followupResult.bars.shift();
                        }
                        result.bars.push(...followupResult.bars);
                    }
                    else {
                        if (followupResult.bars[followupResult.bars.length - 1].time === result.bars[0].time) {
                            // Datafeed shouldn't include a value exactly matching the `to` timestamp but in case it does
                            // we will remove the duplicate.
                            followupResult.bars.pop();
                        }
                        result.bars.unshift(...followupResult.bars);
                    }
                }
            }
            catch (e) {
                /**
                 * Error occurred during followup request. We won't reject the original promise
                 * because the initial response was valid so we will return what we've got so far.
                 */
                if (e instanceof Error || typeof e === 'string') {
                    const reasonString = getErrorMessage(e);
                    // tslint:disable-next-line:no-console
                    console.warn(`HistoryProvider: getBars() warning during followup request, error=${reasonString}`);
                }
            }
        }

        _processHistoryResponse(response) {


            if (response.s !== 'ok' && response.s !== 'no_data') {
                throw new Error(response.errmsg);
            }
            const bars = [];
            const meta = {
                noData: false,
            };

            if (response.s === 'no_data') {
                meta.noData = true;
                meta.nextTime = response.nextTime;
            }

            else {

                const volumePresent = response.v !== undefined;
                const ohlPresent = response.o !== undefined;
                for (let i = 0; i < response.t.length; ++i) {
                    const barValue = {
                        time: response.t[i] * 1000,
                        close: parseFloat(response.c[i]),
                        open: parseFloat(response.c[i]),
                        high: parseFloat(response.c[i]),
                        low: parseFloat(response.c[i]),
                    };
                    if (ohlPresent) {
                        barValue.open = parseFloat(response.o[i]);
                        barValue.high = parseFloat(response.h[i]);
                        barValue.low = parseFloat(response.l[i]);
                    }
                    if (volumePresent) {
                        barValue.volume = parseFloat(response.v[i]);
                    }
                    bars.push(barValue);
                }

            }
            return {
                bars: bars,
                meta: meta,
            };
        }
    }

    class DataPulseProvider {
        constructor(historyProvider, updateFrequency) {
            this._subscribers = {};
            this._requestsPending = 0;
            this._historyProvider = historyProvider;
            setInterval(this._updateData.bind(this), updateFrequency);
        }
        subscribeBars(symbolInfo, resolution, newDataCallback, listenerGuid) {
            if (this._subscribers.hasOwnProperty(listenerGuid)) {
                return;
            }
            this._subscribers[listenerGuid] = {
                lastBarTime: null,
                listener: newDataCallback,
                resolution: resolution,
                symbolInfo: symbolInfo,
            };
            logMessage(`DataPulseProvider: subscribed for #${listenerGuid} - {${symbolInfo.name}, ${resolution}}`);
        }
        unsubscribeBars(listenerGuid) {
            delete this._subscribers[listenerGuid];
        }
        _updateData() {
            if (this._requestsPending > 0) {
                return;
            }
            this._requestsPending = 0;
            // eslint-disable-next-line guard-for-in
            for (const listenerGuid in this._subscribers) {
                this._requestsPending += 1;
                this._updateDataForSubscriber(listenerGuid)
                    .then(() => {
                        this._requestsPending -= 1;
                        logMessage(`DataPulseProvider: data for #${listenerGuid} updated successfully, pending=${this._requestsPending}`);
                    })
                    .catch((reason) => {
                        this._requestsPending -= 1;
                        logMessage(`DataPulseProvider: data for #${listenerGuid} updated with error=${getErrorMessage(reason)}, pending=${this._requestsPending}`);
                    });
            }
        }
        _updateDataForSubscriber(listenerGuid) {
            const subscriptionRecord = this._subscribers[listenerGuid];
            const rangeEndTime = parseInt((Date.now() / 1000).toString());
            // BEWARE: please note we really need 2 bars, not the only last one
            // see the explanation below. `10` is the `large enough` value to work around holidays
            const rangeStartTime = rangeEndTime - periodLengthSeconds(subscriptionRecord.resolution, 10);
            return this._historyProvider.getBars(subscriptionRecord.symbolInfo, subscriptionRecord.resolution, {
                from: rangeStartTime,
                to: rangeEndTime,
                countBack: 2,
                firstDataRequest: false,
            })
                .then((result) => {
                    this._onSubscriberDataReceived(listenerGuid, result);
                });
        }
        _onSubscriberDataReceived(listenerGuid, result) {
            // means the subscription was cancelled while waiting for data
            if (!this._subscribers.hasOwnProperty(listenerGuid)) {
                return;
            }
            const bars = result.bars;
            if (bars.length === 0) {
                return;
            }
            const lastBar = bars[bars.length - 1];
            const subscriptionRecord = this._subscribers[listenerGuid];
            if (subscriptionRecord.lastBarTime !== null && lastBar.time < subscriptionRecord.lastBarTime) {
                return;
            }
            const isNewBar = subscriptionRecord.lastBarTime !== null && lastBar.time > subscriptionRecord.lastBarTime;
            // Pulse updating may miss some trades data (ie, if pulse period = 10 secods and new bar is started 5 seconds later after the last update, the
            // old bar's last 5 seconds trades will be lost). Thus, at fist we should broadcast old bar updates when it's ready.
            if (isNewBar) {
                if (bars.length < 2) {
                    throw new Error('Not enough bars in history for proper pulse update. Need at least 2.');
                }
                const previousBar = bars[bars.length - 2];
                subscriptionRecord.listener(previousBar);
            }
            subscriptionRecord.lastBarTime = lastBar.time;
            subscriptionRecord.listener(lastBar);
        }
    }
    function periodLengthSeconds(resolution, requiredPeriodsCount) {
        let daysCount = 0;
        if (resolution === 'D' || resolution === '1D') {
            daysCount = requiredPeriodsCount;
        }
        else if (resolution === 'M' || resolution === '1M') {
            daysCount = 31 * requiredPeriodsCount;
        }
        else if (resolution === 'W' || resolution === '1W') {
            daysCount = 7 * requiredPeriodsCount;
        }
        else {
            daysCount = requiredPeriodsCount * parseInt(resolution) / (24 * 60);
        }
        return daysCount * 24 * 60 * 60;
    }

    class QuotesPulseProvider {
        constructor(quotesProvider) {
            this._subscribers = {};
            this._requestsPending = 0;
            this._timers = null;
            this._quotesProvider = quotesProvider;
        }
        subscribeQuotes(symbols, fastSymbols, onRealtimeCallback, listenerGuid) {
            this._subscribers[listenerGuid] = {
                symbols: symbols,
                fastSymbols: fastSymbols,
                listener: onRealtimeCallback,
            };
            this._createTimersIfRequired();
        }
        unsubscribeQuotes(listenerGuid) {
            delete this._subscribers[listenerGuid];
            if (Object.keys(this._subscribers).length === 0) {
                this._destroyTimers();
            }
        }
        _createTimersIfRequired() {
            if (this._timers === null) {
                const fastTimer = window.setInterval(this._updateQuotes.bind(this, 1 /* SymbolsType.Fast */), 10000 /* UpdateTimeouts.Fast */);
                const generalTimer = window.setInterval(this._updateQuotes.bind(this, 0 /* SymbolsType.General */), 60000 /* UpdateTimeouts.General */);
                this._timers = { fastTimer, generalTimer };
            }
        }
        _destroyTimers() {
            if (this._timers !== null) {
                clearInterval(this._timers.fastTimer);
                clearInterval(this._timers.generalTimer);
                this._timers = null;
            }
        }
        _updateQuotes(updateType) {
            if (this._requestsPending > 0) {
                return;
            }
            // eslint-disable-next-line guard-for-in
            for (const listenerGuid in this._subscribers) {
                this._requestsPending++;
                const subscriptionRecord = this._subscribers[listenerGuid];
                this._quotesProvider.getQuotes(updateType === 1 /* SymbolsType.Fast */ ? subscriptionRecord.fastSymbols : subscriptionRecord.symbols)
                    .then((data) => {
                        this._requestsPending--;
                        if (!this._subscribers.hasOwnProperty(listenerGuid)) {
                            return;
                        }
                        subscriptionRecord.listener(data);
                        logMessage(`QuotesPulseProvider: data for #${listenerGuid} (${updateType}) updated successfully, pending=${this._requestsPending}`);
                    })
                    .catch((reason) => {
                        this._requestsPending--;
                        logMessage(`QuotesPulseProvider: data for #${listenerGuid} (${updateType}) updated with error=${getErrorMessage(reason)}, pending=${this._requestsPending}`);
                    });
            }
        }
    }

    function extractField(data, field, arrayIndex, valueIsArray) {
        const value = data[field];
        if (Array.isArray(value) && (!valueIsArray || Array.isArray(value[0]))) {
            return value[arrayIndex];
        }
        return value;
    }
    function symbolKey(symbol, currency, unit) {
        // here we're using a separator that quite possible shouldn't be in a real symbol name
        return symbol + (currency !== undefined ? '_%|#|%_' + currency : '') + (unit !== undefined ? '_%|#|%_' + unit : '');
    }
    class SymbolsStorage {
        constructor(datafeedUrl, datafeedSupportedResolutions, requester) {
            this._exchangesList = ['BSE'];
            this._symbolsInfo = {};
            this._symbolsList = [];
            this._datafeedUrl = datafeedUrl;
            this._datafeedSupportedResolutions = datafeedSupportedResolutions;
            this._requester = requester;
            this._readyPromise = this._init();
            this._readyPromise.catch((error) => {
                // seems it is impossible
                // tslint:disable-next-line:no-console
                console.error(`SymbolsStorage: Cannot init, error=${error.toString()}`);
            });
        }
        // BEWARE: this function does not consider symbol's exchange
        resolveSymbol(symbolName, currencyCode, unitId) {
            return this._readyPromise.then(() => {
                const symbolInfo = this._symbolsInfo[symbolKey(symbolName, currencyCode, unitId)];
                if (symbolInfo === undefined) {
                    return Promise.reject('invalid symbol');
                }
                return Promise.resolve(symbolInfo);
            });
        }
        searchSymbols(searchString, exchange, symbolType, maxSearchResults) {
            return this._readyPromise.then(() => {
                const weightedResult = [];
                const queryIsEmpty = searchString.length === 0;
                searchString = searchString.toUpperCase();
                for (const symbolName of this._symbolsList) {
                    const symbolInfo = this._symbolsInfo[symbolName];
                    if (symbolInfo === undefined) {
                        continue;
                    }
                    if (symbolType.length > 0 && symbolInfo.type !== symbolType) {
                        continue;
                    }
                    if (exchange && exchange.length > 0 && symbolInfo.exchange !== exchange) {
                        continue;
                    }
                    const positionInName = symbolInfo.name.toUpperCase().indexOf(searchString);
                    const positionInDescription = symbolInfo.description.toUpperCase().indexOf(searchString);
                    if (queryIsEmpty || positionInName >= 0 || positionInDescription >= 0) {
                        const alreadyExists = weightedResult.some((item) => item.symbolInfo === symbolInfo);
                        if (!alreadyExists) {
                            const weight = positionInName >= 0 ? positionInName : 8000 + positionInDescription;
                            weightedResult.push({ symbolInfo: symbolInfo, weight: weight });
                        }
                    }
                }
                const result = weightedResult
                    .sort((item1, item2) => item1.weight - item2.weight)
                    .slice(0, maxSearchResults)
                    .map((item) => {
                        const symbolInfo = item.symbolInfo;
                        return {
                            symbol: symbolInfo.name,
                            full_name: symbolInfo.full_name,
                            description: symbolInfo.description,
                            exchange: symbolInfo.exchange,
                            params: [],
                            type: symbolInfo.type,
                            ticker: symbolInfo.name,
                        };
                    });
                return Promise.resolve(result);
            });
        }
        _init() {
            const promises = [];
            const alreadyRequestedExchanges = {};
            for (const exchange of this._exchangesList) {
                if (alreadyRequestedExchanges[exchange]) {
                    continue;
                }
                alreadyRequestedExchanges[exchange] = true;
                promises.push(this._requestExchangeData(exchange));
            }
            return Promise.all(promises)
                .then(() => {
                    this._symbolsList.sort();
                });
        }
        _requestExchangeData(exchange) {
            return new Promise((resolve, reject) => {
                this._requester.sendRequest(this._datafeedUrl, 'symbol_info', { group: exchange })
                    .then((response) => {
                        try {
                            this._onExchangeDataReceived(exchange, response);
                        }
                        catch (error) {
                            reject(error instanceof Error ? error : new Error(`SymbolsStorage: Unexpected exception ${error}`));
                            return;
                        }
                        resolve();
                    })
                    .catch((reason) => {
                        logMessage(`SymbolsStorage: Request data for exchange '${exchange}' failed, reason=${getErrorMessage(reason)}`);
                        resolve();
                    });
            });
        }
        _onExchangeDataReceived(exchange, data) {
            let symbolIndex = 0;
            try {
                const symbolsCount = data.symbol.length;
                const tickerPresent = data.ticker !== undefined;
                for (; symbolIndex < symbolsCount; ++symbolIndex) {
                    const symbolName = data.symbol[symbolIndex];
                    const listedExchange = extractField(data, 'exchange-listed', symbolIndex);
                    const tradedExchange = extractField(data, 'exchange-traded', symbolIndex);
                    const fullName = tradedExchange + ':' + symbolName;
                    const currencyCode = extractField(data, 'currency-code', symbolIndex);
                    const unitId = extractField(data, 'unit-id', symbolIndex);
                    const ticker = tickerPresent ? extractField(data, 'ticker', symbolIndex) : symbolName;
                    const symbolInfo = {
                        ticker: ticker,
                        name: symbolName,
                        base_name: [listedExchange + ':' + symbolName],
                        full_name: fullName,
                        listed_exchange: listedExchange,
                        exchange: tradedExchange,
                        currency_code: currencyCode,
                        original_currency_code: extractField(data, 'original-currency-code', symbolIndex),
                        unit_id: unitId,
                        original_unit_id: extractField(data, 'original-unit-id', symbolIndex),
                        unit_conversion_types: extractField(data, 'unit-conversion-types', symbolIndex, true),
                        description: extractField(data, 'description', symbolIndex),
                        has_intraday: definedValueOrDefault(extractField(data, 'has-intraday', symbolIndex), false),
                        has_no_volume: definedValueOrDefault(extractField(data, 'has-no-volume', symbolIndex), undefined),
                        visible_plots_set: definedValueOrDefault(extractField(data, 'visible-plots-set', symbolIndex), undefined),
                        minmov: extractField(data, 'minmovement', symbolIndex) || extractField(data, 'minmov', symbolIndex) || 0,
                        minmove2: extractField(data, 'minmove2', symbolIndex) || extractField(data, 'minmov2', symbolIndex),
                        fractional: extractField(data, 'fractional', symbolIndex),
                        pricescale: extractField(data, 'pricescale', symbolIndex),
                        type: extractField(data, 'type', symbolIndex),
                        session: extractField(data, 'session-regular', symbolIndex),
                        session_holidays: extractField(data, 'session-holidays', symbolIndex),
                        corrections: extractField(data, 'corrections', symbolIndex),
                        timezone: extractField(data, 'timezone', symbolIndex),
                        supported_resolutions: definedValueOrDefault(extractField(data, 'supported-resolutions', symbolIndex, true), this._datafeedSupportedResolutions),
                        has_daily: definedValueOrDefault(extractField(data, 'has-daily', symbolIndex), true),
                        intraday_multipliers: definedValueOrDefault(extractField(data, 'intraday-multipliers', symbolIndex, true), ['1', '5', '15', '30', '60']),
                        has_weekly_and_monthly: extractField(data, 'has-weekly-and-monthly', symbolIndex),
                        has_empty_bars: extractField(data, 'has-empty-bars', symbolIndex),
                        volume_precision: definedValueOrDefault(extractField(data, 'volume-precision', symbolIndex), 0),
                        format: 'price',
                    };
                    this._symbolsInfo[ticker] = symbolInfo;
                    this._symbolsInfo[symbolName] = symbolInfo;
                    this._symbolsInfo[fullName] = symbolInfo;
                    if (currencyCode !== undefined || unitId !== undefined) {
                        this._symbolsInfo[symbolKey(ticker, currencyCode, unitId)] = symbolInfo;
                        this._symbolsInfo[symbolKey(symbolName, currencyCode, unitId)] = symbolInfo;
                        this._symbolsInfo[symbolKey(fullName, currencyCode, unitId)] = symbolInfo;
                    }
                    this._symbolsList.push(symbolName);
                }
            }
            catch (error) {
                throw new Error(`SymbolsStorage: API error when processing exchange ${exchange} symbol #${symbolIndex} (${data.symbol[symbolIndex]}): ${Object(error).message}`);
            }
        }
    }
    function definedValueOrDefault(value, defaultValue) {
        return value !== undefined ? value : defaultValue;
    }

    function extractField$1(data, field, arrayIndex) {
        const value = data[field];
        return Array.isArray(value) ? value[arrayIndex] : value;
    }
    /**
     * This class implements interaction with UDF-compatible datafeed.
     * See [UDF protocol reference](@docs/connecting_data/UDF)
     */
    class UDFCompatibleDatafeedBase {
        constructor(datafeedURL, quotesProvider, requester, updateFrequency = 10 * 1000, limitedServerResponse) {
            this._configuration = defaultConfiguration();
            this._symbolsStorage = null;
            this._datafeedURL = datafeedURL;
            this._requester = requester;
            this._historyProvider = new HistoryProvider(datafeedURL, this._requester, limitedServerResponse);
            this._quotesProvider = quotesProvider;
            this._dataPulseProvider = new DataPulseProvider(this._historyProvider, updateFrequency);
            this._quotesPulseProvider = new QuotesPulseProvider(this._quotesProvider);
            this._configurationReadyPromise = this._requestConfiguration()
                .then((configuration) => {
                    if (configuration === null) {
                        configuration = defaultConfiguration();
                    }
                    this._setupWithConfiguration(configuration);
                });
        }
        onReady(callback) {
            this._configurationReadyPromise.then(() => {
                callback(this._configuration);
            });
        }
        getQuotes(symbols, onDataCallback, onErrorCallback) {
            this._quotesProvider.getQuotes(symbols).then(onDataCallback).catch(onErrorCallback);
        }
        subscribeQuotes(symbols, fastSymbols, onRealtimeCallback, listenerGuid) {
            this._quotesPulseProvider.subscribeQuotes(symbols, fastSymbols, onRealtimeCallback, listenerGuid);
        }
        unsubscribeQuotes(listenerGuid) {
            this._quotesPulseProvider.unsubscribeQuotes(listenerGuid);
        }
        getMarks(symbolInfo, from, to, onDataCallback, resolution) {
            if (!this._configuration.supports_marks) {
                return;
            }
            const requestParams = {
                symbol: symbolInfo.ticker || '',
                from: from,
                to: to,
                resolution: resolution,
                dnews: _dNews,
                lang: _lang,
            };
            this._send('marks', requestParams)
                .then((response) => {
                    if (!Array.isArray(response)) {
                        const result = [];
                        for (let i = 0; i < response.id.length; ++i) {
                            result.push({
                                id: extractField$1(response, 'id', i),
                                time: extractField$1(response, 'time', i),
                                color: extractField$1(response, 'color', i),
                                text: extractField$1(response, 'text', i),
                                label: extractField$1(response, 'label', i),
                                labelFontColor: extractField$1(response, 'labelFontColor', i),
                                minSize: extractField$1(response, 'minSize', i),
                                borderWidth: extractField$1(response, 'borderWidth', i),
                                hoveredBorderWidth: extractField$1(response, 'hoveredBorderWidth', i),
                                imageUrl: extractField$1(response, 'imageUrl', i),
                                showLabelWhenImageLoaded: extractField$1(response, 'showLabelWhenImageLoaded', i),
                            });
                        }
                        response = result;
                    }
                    onDataCallback(response);
                })
                .catch((error) => {
                    logMessage(`UdfCompatibleDatafeed: Request marks failed: ${getErrorMessage(error)}`);
                    onDataCallback([]);
                });
        }
        getTimescaleMarks(symbolInfo, from, to, onDataCallback, resolution) {
            if (!this._configuration.supports_timescale_marks) {
                return;
            }
            const requestParams = {
                symbol: symbolInfo.ticker || '',
                from: from,
                to: to,
                resolution: resolution,
                dnews: _dNews,
                lang: _lang,
            };
            this._send('timescale_marks', requestParams)
                .then((response) => {
                    if (!Array.isArray(response)) {
                        const result = [];
                        for (let i = 0; i < response.id.length; ++i) {
                            result.push({
                                id: extractField$1(response, 'id', i),
                                time: extractField$1(response, 'time', i),
                                color: extractField$1(response, 'color', i),
                                label: extractField$1(response, 'label', i),
                                tooltip: extractField$1(response, 'tooltip', i),
                                imageUrl: extractField$1(response, 'imageUrl', i),
                                showLabelWhenImageLoaded: extractField$1(response, 'showLabelWhenImageLoaded', i),
                            });
                        }
                        response = result;
                    }
                    onDataCallback(response);
                })
                .catch((error) => {
                    logMessage(`UdfCompatibleDatafeed: Request timescale marks failed: ${getErrorMessage(error)}`);
                    onDataCallback([]);
                });
        }
        getServerTime(callback) {
            if (!this._configuration.supports_time) {
                return;
            }
            this._send('time')
                .then((response) => {
                    const time = parseInt(response);
                    if (!isNaN(time)) {
                        callback(time);
                    }
                })
                .catch((error) => {
                    logMessage(`UdfCompatibleDatafeed: Fail to load server time, error=${getErrorMessage(error)}`);
                });
        }
        searchSymbols(userInput, exchange, symbolType, onResult) {
            if (this._configuration.supports_search) {
                const params = {
                    limit: 30 /* Constants.SearchItemsLimit */,
                    query: userInput.toUpperCase(),
                    type: symbolType,
                    exchange: exchange,
                };
                this._send('search', params)
                    .then((response) => {
                        if (response.s !== undefined) {
                            logMessage(`UdfCompatibleDatafeed: search symbols error=${response.errmsg}`);
                            onResult([]);
                            return;
                        }
                        onResult(response);
                    })
                    .catch((reason) => {
                        logMessage(`UdfCompatibleDatafeed: Search symbols for '${userInput}' failed. Error=${getErrorMessage(reason)}`);
                        onResult([]);
                    });
            }
            else {
                if (this._symbolsStorage === null) {
                    throw new Error('UdfCompatibleDatafeed: inconsistent configuration (symbols storage)');
                }
                this._symbolsStorage.searchSymbols(userInput, exchange, symbolType, 30 /* Constants.SearchItemsLimit */)
                    .then(onResult)
                    .catch(onResult.bind(null, []));
            }
        }
        resolveSymbol(symbolName, onResolve, onError, extension) {
            const currencyCode = extension && extension.currencyCode;
            const unitId = extension && extension.unitId;
            function onResultReady(symbolInfo) {
                onResolve(symbolInfo);
            }
            if (!this._configuration.supports_group_request) {
                const params = {
                    symbol: symbolName,
                };
                if (currencyCode !== undefined) {
                    params.currencyCode = currencyCode;
                }
                if (unitId !== undefined) {
                    params.unitId = unitId;
                }
                this._send('symbols', params)
                    .then((response) => {
                        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
                        if (response.s !== undefined) {
                            onError('unknown_symbol');
                        }
                        else {
                            const symbol = response.name;
                            const listedExchange = (_a = response.listed_exchange) !== null && _a !== void 0 ? _a : response['exchange-listed'];
                            const tradedExchange = (_b = response.exchange) !== null && _b !== void 0 ? _b : response['exchange-traded'];
                            const fullName = (_c = response.full_name) !== null && _c !== void 0 ? _c : `${tradedExchange}:${symbol}`;
                            const result = {
                                ...response,
                                name: symbol,
                                base_name: [listedExchange + ':' + symbol],
                                full_name: fullName,
                                listed_exchange: listedExchange,
                                exchange: tradedExchange,
                                currency_code: (_d = response.currency_code) !== null && _d !== void 0 ? _d : response['currency-code'],
                                original_currency_code: (_e = response.original_currency_code) !== null && _e !== void 0 ? _e : response['original-currency-code'],
                                unit_id: (_f = response.unit_id) !== null && _f !== void 0 ? _f : response['unit-id'],
                                original_unit_id: (_g = response.original_unit_id) !== null && _g !== void 0 ? _g : response['original-unit-id'],
                                unit_conversion_types: (_h = response.unit_conversion_types) !== null && _h !== void 0 ? _h : response['unit-conversion-types'],
                                has_intraday: (_k = (_j = response.has_intraday) !== null && _j !== void 0 ? _j : response['has-intraday']) !== null && _k !== void 0 ? _k : false,
                                // eslint-disable-next-line deprecation/deprecation
                                has_no_volume: (_l = response.has_no_volume) !== null && _l !== void 0 ? _l : response['has-no-volume'],
                                visible_plots_set: (_m = response.visible_plots_set) !== null && _m !== void 0 ? _m : response['visible-plots-set'],
                                minmov: (_p = (_o = response.minmovement) !== null && _o !== void 0 ? _o : response.minmov) !== null && _p !== void 0 ? _p : 0,
                                minmove2: (_r = (_q = response.minmovement2) !== null && _q !== void 0 ? _q : response.minmove2) !== null && _r !== void 0 ? _r : response.minmov2,
                                session: (_s = response.session) !== null && _s !== void 0 ? _s : response['session-regular'],
                                session_holidays: (_t = response.session_holidays) !== null && _t !== void 0 ? _t : response['session-holidays'],
                                supported_resolutions: (_w = (_v = (_u = response.supported_resolutions) !== null && _u !== void 0 ? _u : response['supported-resolutions']) !== null && _v !== void 0 ? _v : this._configuration.supported_resolutions) !== null && _w !== void 0 ? _w : [],
                                has_daily: (_y = (_x = response.has_daily) !== null && _x !== void 0 ? _x : response['has-daily']) !== null && _y !== void 0 ? _y : true,
                                intraday_multipliers: (_0 = (_z = response.intraday_multipliers) !== null && _z !== void 0 ? _z : response['intraday-multipliers']) !== null && _0 !== void 0 ? _0 : ['1', '5', '15', '30', '60'],
                                has_weekly_and_monthly: (_1 = response.has_weekly_and_monthly) !== null && _1 !== void 0 ? _1 : response['has-weekly-and-monthly'],
                                has_empty_bars: (_2 = response.has_empty_bars) !== null && _2 !== void 0 ? _2 : response['has-empty-bars'],
                                volume_precision: (_3 = response.volume_precision) !== null && _3 !== void 0 ? _3 : response['volume-precision'],
                                format: (_4 = response.format) !== null && _4 !== void 0 ? _4 : 'price',
                            };
                            onResultReady(result);
                        }
                    })
                    .catch((reason) => {
                        logMessage(`UdfCompatibleDatafeed: Error resolving symbol: ${getErrorMessage(reason)}`);
                        onError('unknown_symbol');
                    });
            }
            else {
                if (this._symbolsStorage === null) {
                    throw new Error('UdfCompatibleDatafeed: inconsistent configuration (symbols storage)');
                }
                this._symbolsStorage.resolveSymbol(symbolName, currencyCode, unitId).then(onResultReady).catch(onError);
            }
        }
        getBars(symbolInfo, resolution, periodParams, onResult, onError) {
            this._historyProvider.getBars(symbolInfo, resolution, periodParams)
                .then((result) => {
                    onResult(result.bars, result.meta);
                })
                .catch(onError);
        }
        subscribeBars(symbolInfo, resolution, onTick, listenerGuid, _onResetCacheNeededCallback) {
            this._dataPulseProvider.subscribeBars(symbolInfo, resolution, onTick, listenerGuid);
        }
        unsubscribeBars(listenerGuid) {
            this._dataPulseProvider.unsubscribeBars(listenerGuid);
        }
        _requestConfiguration() {
            return this._send('config')
                .catch((reason) => {
                    logMessage(`UdfCompatibleDatafeed: Cannot get datafeed configuration - use default, error=${getErrorMessage(reason)}`);
                    return null;
                });
        }
        _send(urlPath, params) {
            if (params == undefined)
                var params = {};
            if (urlPath == 'config') {
                params = {
                    withNews: (_dNews == "") ? false : true, lang: _lang
                };
            };
           
            return this._requester.sendRequest(this._datafeedURL, urlPath, params);
        }
        _setupWithConfiguration(configurationData) {
            this._configuration = configurationData;
            if (configurationData.exchanges === undefined) {
                configurationData.exchanges = [];
            }
            if (!configurationData.supports_search && !configurationData.supports_group_request) {
                throw new Error('Unsupported datafeed configuration. Must either support search, or support group request');
            }
            if (configurationData.supports_group_request || !configurationData.supports_search) {
                this._symbolsStorage = new SymbolsStorage(this._datafeedURL, configurationData.supported_resolutions || [], this._requester);
            }
            logMessage(`UdfCompatibleDatafeed: Initialized with ${JSON.stringify(configurationData)}`);
        }
    }
    function defaultConfiguration() {
        return {
            supports_search: false,
            supports_group_request: true,
            supported_resolutions: [
                '1',
                '5',
                '15',
                '30',
                '60',
                '1D',
                '1W',
                '1M',
            ],
            supports_marks: (_dNews == "") ? false : true,
            supports_timescale_marks: (_dNews == "") ? false : true,
        };
    }

    class QuotesProvider {
        constructor(datafeedUrl, requester) {
            this._datafeedUrl = datafeedUrl;
            this._requester = requester;
        }
        getQuotes(symbols) {
            return new Promise((resolve, reject) => {
                this._requester.sendRequest(this._datafeedUrl, 'quotes', { symbols: symbols })
                    .then((response) => {
                        if (response.s === 'ok') {
                            resolve(response.d);
                        }
                        else {
                            reject(response.errmsg);
                        }
                    })
                    .catch((error) => {
                        const errorMessage = getErrorMessage(error);
                        reject(`network error: ${errorMessage}`);
                    });
            });
        }
    }

    class Requester {
        constructor(headers) {
            if (headers) {
                this._headers = headers;
            }
        }
        sendRequest(datafeedUrl, urlPath, params) {
            if (params !== undefined) {
      
                const paramKeys = Object.keys(params);
                if (paramKeys.length !== 0) {
                    urlPath += '?';
                }
                urlPath += paramKeys.map((key) => {
                    return `${encodeURIComponent(key)}=${encodeURIComponent(params[key].toString())}`;
                }).join('&');
            }

            // Send user cookies if the URL is on the same origin as the calling script.
            const options = {
                credentials: 'same-origin', headers: {'X-SK-API': sk}  };
            if (this._headers !== undefined) {
                options.headers = this._headers;
            }
            // eslint-disable-next-line no-restricted-globals
            return fetch(`${datafeedUrl}/${urlPath}`, options)
                .then((response) => response.text())
                .then((responseTest) => JSON.parse(responseTest));
        }
    }

    class UDFCompatibleDatafeed extends UDFCompatibleDatafeedBase {
        constructor(datafeedURL, updateFrequency = 10 * 1000, limitedServerResponse) {
            const requester = new Requester();
            const quotesProvider = new QuotesProvider(datafeedURL, requester);
            super(datafeedURL, quotesProvider, requester, updateFrequency, limitedServerResponse);
        }
    }

    exports.UDFCompatibleDatafeed = UDFCompatibleDatafeed;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
;

var withAdjust = 0;
var withNews = false;
var withDivid = false;
var s_symbol;
var _dNews = "";
var w_dataFeedURL; // = "https://localhost:44341/api"; // "https://localhost:44324/api"; 
var w_updateFrecvency;
var w_debug;
var w_width;
var w_heigth;
var w_interval;
var w_theme;
var w_custom_css_url;
var w_disabled_features = [];
var w_enabled_features;
var w_supported_resolutions;
var w_timeframe;
var w_time_frames = [];
var w_overrides = {};
var w_withCustomBtnPriceAjust;
var w_withCustomBtnNews;
var w_withCustomBtnDivid;
var w_OneYear = false;
var _lang = "ro";
var w_autosize = false;
var w_studies_overrides = {};
var w_withHeader = true;
var _datafeed;
//var w_limitedServerResponse = { maxResponseLength: 1000, expectedOrder: 'latestFirst' };
//var _datafeed = new Datafeeds.UDFCompatibleDatafeed(w_dataFeedURL, 86400000);
var lastBarsReceived = 0;

function initViewChart(_symbol) {
    s_symbol = _symbol;
    widget = window.tvWidget = new TradingView.widget({
        debug: false,// (w_debug == "") ? false : w_debug,
        //fullscreen: true,
        width: (w_width == "") ? "100%" : w_width,
        heigth: (w_heigth == "") ? "100%" : w_heigth,
        symbol: _symbol,

        interval: w_interval,
        timeframe: w_timeframe, // '12M',
        time_frames: w_time_frames, // [{ text: "1d", value: "1D", resolution: "1" },{ text: "1w", value: "1W", resolution: "5" },{ text: "1m", value: "1M", resolution: "60" },{ text:"6m", value: "6M", resolution: "D" },{ text: "1y", value: "1Y", resolution: "D" },],

        container: "ChartContainerComplete",
        datafeed: _datafeed,
        //theme: (w_theme == "") ? "Light" : w_theme , //'Dark' sau 'Light'
        theme: "Light",
        supports_marks: (_dNews == "") ? false : true,
        supports_timescale_marks: false, // (_dNews == "") ? false : true,
        supports_time: true,
        timezone: "Europe/Bucharest" , //"Europe/Athens",
        locale: _lang,
        library_path: "/charting_library/",
        custom_css_url: w_custom_css_url,
        drawings_access: { type: 'black', tools: [{ name: "Regression Trend" }] },

        //supported_resolutions: w_supported_resolutions, // ['1', '5', '15', '30', '60', '1D', '1W', '1M', '6M', '12M'],

        autosize: w_autosize,
        enabled_features: w_enabled_features,
        disabled_features: w_disabled_features,
        numeric_formatting: (_lang == "ro") ? { decimal_sign: "," } : { decimal_sign: "." },
        custom_formatters: {
            dateFormatter: {
                format: function (date) {
                    if (_lang == "ro")
                        return ("0" + date.getDate()).slice(-2) + '-' + ("0" + (date.getMonth() + 1)).slice(-2) + '-' + date.getFullYear();
                    else
                        return date.getFullYear() + '-' + ("0" + (date.getMonth() + 1)).slice(-2) + '-' + ("0" + date.getDate()).slice(-2);
                }
            }
        },
        //  overrides: w_overrides, 
        //  overrides: $.extend(w_overrides, { 'mainSeriesProperties.haStyle.barColorsOnPrevClose': false }, { 'mainSeriesProperties.barStyle.barColorsOnPrevClose': false }, { 'mainSeriesProperties.candleStyle.barColorsOnPrevClose': false }),

        studies_overrides: w_studies_overrides

    });
    var tvIframe = $('#ChartContainerComplete').find(document.querySelectorAll("[name^=tradingview_]"));
    w_withCustomBtnPriceAjust = (w_withCustomBtnPriceAjust == null) ? false : w_withCustomBtnPriceAjust;
    w_withCustomBtnNews = (w_withCustomBtnNews == null) ? false : w_withCustomBtnNews;
    w_withCustomBtnDivid = (w_withCustomBtnDivid == null) ? false : w_withCustomBtnDivid;

    w_withHeader = (w_withCustomBtnPriceAjust == true || w_withCustomBtnNews == true || w_withCustomBtnDivid == true);

    widget.onChartReady(function () {
        widget.chart().applyOverrides($.extend(w_overrides, { 'mainSeriesProperties.haStyle.barColorsOnPrevClose': false }, { 'mainSeriesProperties.barStyle.barColorsOnPrevClose': false }, { 'mainSeriesProperties.candleStyle.barColorsOnPrevClose': false }));

        //widget.subscribe("add_compare", function () {
        //    widget.applyStudiesOverrides({ "Compare.Plot.color.0": '#' + Math.floor(Math.random() * 16777215).toString(16) });
        //});

        //change light to dark and reverse
        //var w_theme2 = (w_theme == 'Dark') ? 'Light' : 'Dark';
        //widget.onContextMenu(function () {
        //    return [
        //        {
        //            position: "top",
        //            text: "Change Theme to " + w_theme2 ,
        //            click: function () {
        //                w_theme = w_theme2;
        //                widget.changeTheme(w_theme2);
        //                widget.applyOverrides({"symbolWatermarkProperties.color": (w_theme == 'Light') ? "rgba(245, 245, 245, 0.9)" : "rgba(47, 50, 65, 1)" });
        //                w_theme2 = (w_theme == 'Dark') ? 'Light' : 'Dark';
        //            }
        //        },
        //        { text: "-", position: "top" },
        //        //{ text: "-Objects Tree..." },
        //    ];
        //});


        if (w_withHeader == true) {
            widget.headerReady().then(function () {

                let ww_overrides = {
                    "symbolWatermarkProperties.color": (w_theme == 'Light') ? "rgba(245, 245, 245, 0.9)" : "rgba(47, 50, 65, 1)",
                    "mainSeriesProperties.style": 1,
                    "paneProperties.topMargin": 15,
                    //"mainSeriesProperties.candleStyle.barColorsOnPrevClose": true,
                    //"mainSeriesProperties.haStyle.barColorsOnPrevClose": true,
                    //"mainSeriesProperties.barStyle.barColorsOnPrevClose":true
                };
                if (w_withCustomBtnPriceAjust == true) {
                    var customBtnPriceAjust = widget.createButton();
                    customBtnPriceAjust.id = "svgAjust";
                    customBtnPriceAjust.addEventListener('click', function () {
                        withAdjust = (withAdjust == 0) ? 1 : 0;
                        w_overrides = ww_overrides;
                        w_withCustomBtnPriceAjust = true;
                        initViewChart(s_symbol);
                        w_withHeader = true;

                    });
                }
                if (w_withCustomBtnNews == true) {
                    var customBtnNews = widget.createButton();
                    customBtnNews.id = "svgNews";
                    customBtnNews.addEventListener('click', function () {
                        withNews = !withNews;
                        _dNews = (withNews && withDivid) ? "A" : (withNews) ? "N" : (withDivid ? "D" : "")  // ce fel de stiri
                        _datafeed = new Datafeeds.UDFCompatibleDatafeed(w_dataFeedURL, w_updateFrecvency);
                        w_overrides = ww_overrides;
                        w_withCustomBtnNews = true;
                        initViewChart(s_symbol);
                        w_withHeader = true;
                    });
                }
                if (w_withCustomBtnDivid == true) {
                    var customBtnDivid = widget.createButton();
                    customBtnDivid.id = "svgDivid";
                    customBtnDivid.addEventListener('click', function () {
                        withDivid = !withDivid;
                        _dNews = (withNews && withDivid) ? "A" : (withNews) ? "N" : (withDivid ? "D" : "")
                        _datafeed = new Datafeeds.UDFCompatibleDatafeed(w_dataFeedURL, w_updateFrecvency);
                        w_overrides = ww_overrides;
                        w_withCustomBtnDivid = true;
                        initViewChart(s_symbol);
                        w_withHeader = true;
                    });
                }
                var tvIframe = document.querySelectorAll("[name^=tradingview_]");
                if (w_withHeader == true) {
                    $(tvIframe).height('500');
                }
                if (tvIframe.length == 1) {
                    var hcompare = $($(tvIframe)[0].contentWindow.document.getElementById('header-toolbar-compare')).find('.js-button-text')
                    if (hcompare.length == 1)
                        $(hcompare).text('');

                    var hindic = $($(tvIframe)[0].contentWindow.document.getElementById('header-toolbar-indicators')).find('.js-button-text')
                    if (hindic.length == 1)
                        $(hindic).text('');

                }
                if (w_withCustomBtnPriceAjust || w_withCustomBtnNews || w_withCustomBtnDivid) {
                    AddCustomBtns();
                }
            });
        }


        //  widget.chart().applyOverrides($.extend(w_overrides));
    });

    //var tvIframe = document.querySelectorAll("[name^=tradingview_]");
    function AddCustomBtns() {
        if (tvIframe.length == 1) {
            if (withAdjust == 0)
                SVGadd("svgAjust", _lang == "ro" ? "Preturi neajustate" : "Unadjusted prices", withAdjust);
            else
                SVGadd("svgAjust", _lang == "ro" ? "Preturi ajustate" : "Adjusted prices", withAdjust);
            SVGadd("svgNews", _lang == "ro" ? "Stiri" : "News", withNews);
            SVGadd("svgDivid", _lang == "ro" ? "Dividende" : "Dividends", withDivid);

            w_OneYear = true;
        }
    }

    function SVGadd(id, title, param) {
        var customBtn = $(tvIframe)[0].contentWindow.document.getElementById(id);
        if ($(customBtn).length == 1) {
            if (param == 1) {
                var _svgContainer = document.createElement("span");
                $(_svgContainer).attr("class", "icon-beK_KS0k-");
                $(_svgContainer).attr("style", "padding-left:10px");
                var _svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
                _svg.setAttributeNS(null, 'viewBox', '0 0 16 8');
                _svg.setAttributeNS(null, 'width', '16');
                _svg.setAttributeNS(null, 'height', '12');
                var _path = document.createElementNS("http://www.w3.org/2000/svg", "path");
                _path.setAttributeNS(null, 'fill', '#2cc1ad');
                _path.setAttributeNS(null, 'd', 'M0 1.475l7.396 6.04.596.485.593-.49L16 1.39 14.807 0 7.393 6.122 8.58 6.12 1.186.08z');
                _svg.appendChild(_path);
                $(customBtn).append($('<div>', { 'class': 'js-button-text text-1sK7vbvh-', 'html': title, 'style': 'color:#2cc1ad' }));
                _svgContainer.appendChild(_svg);
                var _pBtn = $(customBtn).parent();
                $(_pBtn).prepend(_svgContainer);
            }
            else
                $(customBtn).append($('<div>', { 'class': 'js-button-text text-1sK7vbvh-', 'html': title }));
        }
    }


}

//$(document).ready(    
    //function () {
    //    $('#header-toolbar-compare > div.js-button-text').text('');
    //    $('#header-toolbar-indicators > div.js-button-text').text('');
    //}
//);

;
