"use strict";const fejnNumber=require("fejn-number"),klinecharts=require("klinecharts"),utils=require("./shared/fejn-kline.8ad7d13a.cjs"),getStyles=t=>{const e=utils.styles[t]||utils.styles.dark;return{grid:{show:!0,horizontal:{show:!0,size:1,color:e.grid,style:klinecharts.LineType.Dashed,dashedValue:[2,2]},vertical:{show:!0,size:1,color:e.grid,style:klinecharts.LineType.Dashed,dashedValue:[2,2]}},candle:{type:klinecharts.CandleType.CandleSolid,bar:{upColor:e.up,downColor:e.down,noChangeColor:e.up,upBorderColor:e.up,downBorderColor:e.down,noChangeBorderColor:e.up,upWickColor:e.up,downWickColor:e.down,noChangeWickColor:e.up},area:{lineSize:2,lineColor:"#2196F3",value:"close",smooth:!0,backgroundColor:[{offset:0,color:"rgba(33, 150, 243, 0.01)"},{offset:1,color:"rgba(33, 150, 243, 0.2)"}],point:{show:!0,color:"blue",radius:4,rippleColor:"0.3",rippleRadius:8,animation:!0,animationDuration:1e3}},priceMark:{show:!0,high:{show:!0,color:e.price_mark,textOffset:4,textSize:e.text_size,textFamily:e.family,textWeight:"normal"},low:{show:!0,color:e.price_mark,textOffset:4,textSize:e.text_size,textFamily:e.family,textWeight:"normal"},last:{show:!0,upColor:e.up,downColor:e.down,noChangeColor:e.up,line:{show:!0,style:klinecharts.LineType.Dashed,dashedValue:[4,4],size:.4},text:{show:!0,style:klinecharts.PolygonType.Fill,size:e.text_size,paddingLeft:7,paddingTop:3,paddingRight:5,paddingBottom:2,borderStyle:klinecharts.LineType.Solid,borderSize:1,borderColor:"transparent",borderDashedValue:[2,2],color:"#FFFFFF",family:e.family,weight:"normal",borderRadius:2}}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:klinecharts.TooltipShowRule.Always,showType:klinecharts.TooltipShowType.Standard,custom:[],defaultValue:"n/a",rect:{position:"fixed",paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,offsetLeft:4,offsetTop:4,offsetRight:4,offsetBottom:4,borderRadius:4,borderSize:1,borderColor:"#f2f3f5",color:"#FEFEFE"},text:{size:11,family:e.family,weight:"normal",color:e.tooltip_color,marginLeft:12,marginTop:12,marginRight:-6,marginBottom:0},icons:[]}},indicator:{ohlc:{upColor:e.up_opacity,downColor:e.down_opacity,noChangeColor:e.up_opacity},bars:[{style:klinecharts.PolygonType.Fill,borderStyle:klinecharts.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:e.up_opacity,downColor:e.down_opacity,noChangeColor:e.up_opacity}],lines:[{style:klinecharts.LineType.Solid,smooth:!1,size:.4,dashedValue:[2,2],color:"#FF9600"},{style:klinecharts.LineType.Solid,smooth:!1,size:.4,dashedValue:[2,2],color:"#935EBD"},{style:klinecharts.LineType.Solid,smooth:!1,size:.4,dashedValue:[2,2],color:"#2196F3"},{style:klinecharts.LineType.Solid,smooth:!1,size:.4,dashedValue:[2,2],color:"#E11D74"},{style:klinecharts.LineType.Solid,smooth:!1,size:.4,dashedValue:[2,2],color:"#01C5C4"}],circles:[{style:klinecharts.PolygonType.Fill,borderStyle:klinecharts.LineType.Solid,borderSize:1,borderDashedValue:[2,2],upColor:e.up_opacity,downColor:e.down_opacity,noChangeColor:e.up_opacity}],lastValueMark:{show:!1,text:{show:!1,style:klinecharts.PolygonType.Fill,color:"#FFFFFF",size:e.text_size,family:e.family,weight:"normal",borderStyle:klinecharts.LineType.Solid,borderSize:1,borderDashedValue:[2,2],paddingLeft:7,paddingTop:3,paddingRight:5,paddingBottom:2,borderRadius:2}},tooltip:{offsetLeft:4,offsetTop:6,offsetRight:4,offsetBottom:6,showRule:klinecharts.TooltipShowRule.Always,showType:klinecharts.TooltipShowType.Standard,showName:!0,showParams:!0,defaultValue:"n/a",text:{size:12,family:e.family,weight:"normal",color:e.tooltip_color,marginTop:12,marginRight:-6,marginBottom:0,marginLeft:12},icons:[]}},xAxis:{show:!0,size:"auto",axisLine:{show:!0,color:e.scales_line,size:1},tickText:{show:!0,color:e.scales_text,family:e.family,weight:"normal",size:e.text_size,marginStart:3,marginEnd:6},tickLine:{show:!0,size:1,length:3,color:e.scales_line}},yAxis:{show:!0,size:"auto",position:klinecharts.YAxisPosition.Right,type:klinecharts.YAxisType.Normal,inside:!1,reverse:!1,axisLine:{show:!0,color:e.scales_line,size:1},tickText:{show:!0,color:e.scales_text,family:e.family,weight:"normal",size:e.text_size,marginStart:3,marginEnd:6},tickLine:{show:!0,size:1,length:3,color:e.scales_line}},separator:{size:1,color:e.scales_line,fill:!0,activeBackgroundColor:"rgba(230, 230, 230, .15)"},crosshair:{show:!0,horizontal:{show:!0,line:{show:!0,style:klinecharts.LineType.Dashed,dashedValue:[6,6],size:1,color:e.cross_line},text:{show:!0,style:klinecharts.PolygonType.Fill,color:e.crosshair,size:e.text_size,family:e.family,weight:"normal",borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:e.crosshair_bg,borderRadius:2,paddingLeft:7,paddingRight:5,paddingTop:3,paddingBottom:2,backgroundColor:e.crosshair_bg}},vertical:{show:!0,line:{show:!0,style:klinecharts.LineType.Dashed,dashedValue:[6,6],size:1,color:"#888888"},text:{show:!0,style:klinecharts.PolygonType.Fill,color:"#FFFFFF",size:e.text_size,family:e.family,weight:"normal",borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderColor:e.crosshair_bg,borderRadius:2,paddingLeft:2,paddingRight:2,paddingTop:3,paddingBottom:2,backgroundColor:e.crosshair_bg}}},overlay:{point:{color:"#1677FF",borderColor:"rgba(22, 119, 255, 0.35)",borderSize:1,radius:5,activeColor:"#1677FF",activeBorderColor:"rgba(22, 119, 255, 0.35)",activeBorderSize:3,activeRadius:5},line:{style:klinecharts.LineType.Solid,smooth:!1,color:"#1677FF",size:1,dashedValue:[2,2]},rect:{style:klinecharts.PolygonType.Fill,color:"rgba(22, 119, 255, 0.25)",borderColor:"#1677FF",borderSize:1,borderRadius:0,borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2]},polygon:{style:klinecharts.PolygonType.Fill,color:"#1677FF",borderColor:"#1677FF",borderSize:1,borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2]},circle:{style:klinecharts.PolygonType.Fill,color:"rgba(22, 119, 255, 0.25)",borderColor:"#1677FF",borderSize:1,borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2]},arc:{style:klinecharts.LineType.Solid,color:"#1677FF",size:1,dashedValue:[2,2]},text:{color:"#1677FF",size:12,family:e.family,weight:"normal",borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2],borderSize:0,borderRadius:2,borderColor:"#1677FF",paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,backgroundColor:"transparent"},rectText:{style:klinecharts.PolygonType.Fill,color:"#FFFFFF",size:12,family:e.family,weight:"normal",borderStyle:klinecharts.LineType.Solid,borderDashedValue:[2,2],borderSize:1,borderRadius:2,borderColor:"#1677FF",paddingLeft:4,paddingRight:4,paddingTop:4,paddingBottom:4,backgroundColor:"#1677FF"}}}},n={o:"O",h:"H",l:"L",c:"C"},c={[utils.Lang["en-US"]]:n,[utils.Lang["vi-VN"]]:n,[utils.Lang["es-ES"]]:n,[utils.Lang["id-ID"]]:n,[utils.Lang["zh-CN"]]:{o:"\u5F00=",h:"\u9AD8=",l:"\u4F4E=",c:"\u6536="},[utils.Lang["zh-TW"]]:{o:"\u958B=",h:"\u9AD8=",l:"\u4F4E=",c:"\u6536="},[utils.Lang["ja-JP"]]:{o:"\u59CB\u5024",h:"\u9AD8\u5024",l:"\u5B89\u5024",c:"\u7D42\u5024"},[utils.Lang["ru-RU"]]:{o:"\u041E\u0422\u041A\u0420",h:"\u041C\u0410\u041A\u0421",l:"\u041C\u0418\u041D",c:"\u0417\u0410\u041A\u0420"},[utils.Lang["tr-TR"]]:{o:"A",h:"Y",l:"D",c:"K"},[utils.Lang["pt-BR"]]:{o:"Abr",h:"M\xE1x.",l:"M\xEDn.",c:"Fch"},[utils.Lang["fr-FR"]]:{o:"O",h:"H",l:"B",c:"C"},[utils.Lang["th-TH"]]:{o:"\u0E40\u0E1B\u0E34\u0E14",h:"\u0E2A\u0E39\u0E07",l:"\u0E15\u0E48\u0E33",c:"\u0E1B\u0E34\u0E14"},[utils.Lang["ko-KR"]]:{o:"\uC2DC",h:"\uACE0",l:"\uC800",c:"\uC885"}};function w(t){const{data:e,pricePrecision:i,locale:p}=t,h=c[utils.Lang[p]],r=fejnNumber.minus(e.close,e.open),_=fejnNumber.times(fejnNumber.div(r,e.open),100),a=fejnNumber.lt(r,0)?t.downColor:t.upColor,l=`${fejnNumber.gt(r,0)?"+":""}${fejnNumber.toFixed(r,i,7)}`,g=`(${fejnNumber.gt(_,0)?"+":""}${fejnNumber.toFixed(_,2,7)}%)`;return[{title:h.o,value:{text:fejnNumber.toFixed(e.open,i),color:a}},{title:h.h,value:{text:fejnNumber.toFixed(e.high,i),color:a}},{title:h.l,value:{text:fejnNumber.toFixed(e.low,i),color:a}},{title:h.c,value:{text:fejnNumber.toFixed(e.close,i),color:a}},{title:"",value:{text:`${l} ${g}`,color:a}}]}function L(t,e){if(typeof t=="string"&&!t.length)throw new Error("Dom id \u4E0D\u80FD\u4E3A\u7A7A");e.styles||(e.styles=getStyles(e?.theme||utils.theme)),e.locale=utils.Lang[e.locale]||utils.lang;const i=klinecharts.init(t,e);if(!i)return null;i.$updateTooltip=()=>{const{candle:h}=i.getStyles();h.tooltip.custom=({current:r},{bar:_})=>{const a={data:r,pricePrecision:i.getPriceVolumePrecision().price,locale:i.getLocale(),upColor:_.upColor,downColor:_.downColor};return w(a)},i.setStyles({candle:h})},i.$setTheme=h=>{const r=getStyles(h);r&&i.setStyles(r)};const p=()=>{const h=new ResizeObserver(()=>{setTimeout(()=>{i.resize()},0)});i.getDom()&&h.observe(i.getDom())};return i.$addDefaultMa=()=>{i.getIndicatorByPaneId("candle_pane","MA")&&i.removeIndicator("candle_pane","MA"),i.createIndicator({name:"MA",calcParams:[10,30,60]},!1,{id:"candle_pane",dragEnabled:!0})},i.$addVol=()=>{i.getIndicatorByPaneId("default_vol","VOL")&&i.removeIndicator("default_vol","VOL"),i.createIndicator({name:"VOL",calcParams:[20],precision:i.getPriceVolumePrecision().volume,figures:[{key:"ma1",title:"",type:"line"},{key:"volume",title:"",type:"bar",baseValue:0,styles({current:h},r,{bars:_}){const{close:a,open:l}=h.kLineData||{close:0,open:0},{upColor:g,downColor:S}=_[0];return{color:fejnNumber.lt(fejnNumber.minus(a,l),0)?S:g}}}]},!1,{id:"default_vol"})},i.$screenshot=()=>{const h=i.getConvertPictureUrl(!0),r=new Image,_=window.open("","_blank");r.src=h,_?.document.write(r.outerHTML),_?.document.close()},i.$setGraph=h=>{const r=i.getStyles();r.candle.type=utils.graphs.simple_map[h]||utils.graphs.simple_map[1],i.setStyles(r)},p(),i.$updateTooltip(),i.setLeftMinVisibleBarCount(2),i.setRightMinVisibleBarCount(2),i.setOffsetRightDistance(42),i.setBarSpace(6.2),i.setPaneOptions({id:"candle_pane",gap:{top:.3}}),e.showMa&&i.$addDefaultMa(),e.showVol&&i.$addVol(),i}function m$1(t,e){const i={...t};for(const p in e)typeof t[p]!="object"||t[p]===null||Array.isArray(t[p])?e[p]!==void 0&&(i[p]=e[p]):i[p]=m$1(t[p],e[p]);return i}const I={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:[]}},y=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 f$1=!1;function b$1(){return"CL v26.003 (internal id e793d706 @ 2023-10-05T20:27:44.510Z)"}const A=class{constructor(t){var e,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");!((e=t.overrides)===null||e===void 0)&&e["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=m$1(I,t),((i=this._options.theme)!==null&&i!==void 0?i:"light").toLowerCase()==="dark"&&this._options.loading_screen===void 0&&(this._options.loading_screen={backgroundColor:"#131722"}),this._options.debug&&(f$1||(f$1=!0,console.log("Using CL v26.003 (internal id e793d706 @ 2023-10-05T20:27:44.510Z)"))),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(i=>{i.createShortcutAction(t,e)})}subscribe(t,e){this._doWhenInnerApiLoaded(i=>{i.subscribe(t,e)})}unsubscribe(t,e){this._doWhenInnerApiLoaded(i=>{i.unsubscribe(t,e)})}chart(t){return this._innerAPI().chart(t)}getLanguage(){return this._options.locale}setSymbol(t,e,i){this._innerAPI().changeSymbol(t,e,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._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,i){this._innerAPI().saveChartToServer(t,e,i)}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=m$1(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()}activeChartIndex(){return this._innerAPI().activeChartIndex()}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)}setDateRangeLinkingEnabled(t){this._innerAPI().setDateRangeLinkingEnabled(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()}watermark(){return this._innerAPI().watermark()}customSymbolStatus(){return this._innerWindow().customSymbolStatus()}setCSSCustomProperty(t,e){if(t.startsWith("--")===!1)throw new Error("customPropertyName should begin with a double hyphen");this._innerWindow().document.body.style.setProperty(t,e)}getCSSCustomPropertyValue(t){if(t.startsWith("--")===!1)throw new Error("customPropertyName should begin with a double hyphen");const e=this._innerWindow().document.body;return e.style.getPropertyValue(t)||getComputedStyle(e).getPropertyValue(t)}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",P&&setTimeout(()=>{this._iFrame.style.height=window.innerHeight+"px"},30))}_create(){var t,e;const i=(e=(t=this._options.enabled_features)===null||t===void 0?void 0:t.includes("iframe_loading_compatibility_mode"))!==null&&e!==void 0&&e,[p,h]=this._render(!i),r=this._options.container,_=typeof r=="string"?document.getElementById(r):r;if(_===null)throw new Error(`There is no such element - #${this._options.container}`);_.innerHTML=p,this._iFrame=_.querySelector(`#${this._id}`);const a=this._iFrame;i&&(a.contentWindow?(a.contentWindow.document.open(),a.contentWindow.document.write(h),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(l=>{const g=()=>{a.removeEventListener("load",g,!1),l()};a.addEventListener("load",g,!1)}),this._innerWindowLoaded.then(()=>{try{this._innerWindow().widgetReady(()=>{this._ready=!0;for(const l of this._readyHandlers)try{l.call(this)}catch(g){console.error(g)}this._innerWindow().initializationFinished()})}catch(l){if(l instanceof Error&&/widgetReady is not a function/.test(l.message))throw new Error(`There was an error when loading the library. Usually this error means the library failed to load its static files. Check that the library files are available at ${window.location.host}/${this._options.library_path||""} or correct the library_path option.`)}})}_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,rss_news_title:this._options.rss_news_title,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 r=encodeURIComponent(this._options.locale);y.findIndex(_=>_.language===r)>=0||(console.warn("locale isn't supported. Using default of `en`."),this._options.locale="en")}const i=function(r,_){var a;const l=new URL(`${r||""}`,location.href).href,g=JSON.parse('["bundles/runtime.0809a655c13b333b6a76.js","bundles/__LANG__.5008.e5d7d914577969582fa4.js","bundles/3515.2f722d33cebe31a154b1.css","bundles/9401.4792ed983286dcafa79b.js","bundles/library.847f247511d3f9997d72.js"]'),S=encodeURIComponent(_),F=(a=y.find(v=>v.language===S))!==null&&a!==void 0?a:{iso:"en",dir:"ltr"},z=`lang="${F.iso}" dir="${F.dir}"`;return`<\/script>`):C.endsWith(".css")&&k.push(``);return[...x,...k].join(` `)}(g,F.dir==="rtl",S)} `,localeLanguage:S,htmlAttrs:z,libraryPath:l}).htmlAttrs}>