(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[84266,47365],{846778:(e,t,i)=>{"use strict";i.d(t,{showPasteLineToolHint:()=>d});var s=i(444372),r=i(62802),n=i(638456),o=i(470316),a=i(244842);const l=s.t(null,void 0,i(13262));function d(e,t){a.enabled("popup_hints")&&!n.CheckMobile.any()&&Promise.all([i.e(9817),i.e(93280),i.e(50690),i.e(26166)]).then(i.bind(i,410837)).then((i=>{const s=new i.ChartEventHintRenderer(e),n=l.format({shortcut:(0,o.humanReadableHash)(o.Modifiers.Mod+86)});let a=null;s.show(n,(()=>{null!==a&&(clearTimeout(a),a=null,r.setValue(t,!0,{forceFlush:!0}))})),a=setTimeout((()=>{a=null,s.hide()}),5e3)}))}},57761:(e,t,i)=>{"use strict";i.d(t,{OptionsDialogController:()=>o});var s=i(111393),r=i(583912);let n;class o extends s.DialogRenderer{constructor(){super(...arguments),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(e){const t=(null==e?void 0:e.symbol)?e.symbol:r.linking.proSymbol.value();this._load({...e,symbol:t}).then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return n||(n=new o),n}_load(e){return Promise.all([i.e(62253),i.e(22666),i.e(92108),i.e(92191),i.e(32109),i.e(9817),i.e(4015),i.e(38669),i.e(76592),i.e(5145),i.e(72639),i.e(89842),i.e(25190),i.e(36747),i.e(21625),i.e(61631),i.e(45896),i.e(52567),i.e(36953),i.e(80538),i.e(85418),i.e(49380),i.e(50690),i.e(59255),i.e(51004),i.e(88792),i.e(62526),i.e(23141),i.e(64198)]).then(i.bind(i,440288)).then((t=>{var i,s;return null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=new t.OptionsDialogRenderer(e),this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}},254526:(e,t,i)=>{"use strict";i.d(t,{SYMBOL_TYPE_BLACK_LIST:()=>s});const s=new Set(["spread","economic"])},250378:(e,t,i)=>{"use strict";i.d(t,{BadRequestErrorResponse:()=>r});var s=i(867023);class r extends s.ErrorResponse{constructor(e){super(e),this.name="BadRequestError",e.error?this.message=e.error:this.message="unknown error"}}},867023:(e,t,i)=>{"use strict";i.d(t,{ErrorResponse:()=>s});class s{constructor(e){this._status=e.status,this._statusText=e.statusText||""}getInfo(){return{name:this.name,status:this._status,statusText:this._statusText,message:this.message}}}},729030:(e,t,i)=>{"use strict";i.d(t,{getSymbolData:()=>l});var s=i(120780),r=i(438874),n=i(250378),o=i(685503),a=i(159954);function l(e,t,i,l=!0){const d=i.join(","),h=(0,r.getSymbolDataUrl)(t,d,l),u={signal:e,method:"GET",credentials:"include",headers:{Accept:"application/json"}};return(0,s.fetch)(h,u,{logOnErrorStatus:!1}).then((e=>{if(400===e.status){const{status:t,statusText:i}=e;return e.json().then((e=>{const s=e.errmsg;throw new n.BadRequestErrorResponse({status:t,statusText:i,error:s})}))}if(404===e.status){const{status:t,statusText:i}=e;return e.json().then((s=>{if("symbol_not_exists"===s.code){const e=s.errmsg;throw new a.SymbolDoesNotExistErrorResponse({status:t,statusText:i,error:e})}throw new o.HttpErrorResponse(e)}))} if(e.ok)return e.json().then((e=>e));throw new o.HttpErrorResponse(e)}))}},685503:(e,t,i)=>{"use strict";i.d(t,{HttpErrorResponse:()=>r});var s=i(867023);class r extends s.ErrorResponse{constructor(e){super(e),this.name="HttpErrorResponse",this._status>=200&&this._status<300?this.message=`Http failure during parsing for ${e.url||"(unknown url)"}`:this.message=`Http failure response for ${e.url||"(unknown url)"}: ${e.status} ${e.statusText}`}}},159954:(e,t,i)=>{"use strict";i.d(t,{SymbolDoesNotExistErrorResponse:()=>r});var s=i(867023);class r extends s.ErrorResponse{constructor(e){super(e),this.name="SymbolDoesNotExistError",this.message=e.error||"symbol does not exist"}}},438874:(e,t,i)=>{"use strict";function s(){return window.SCREENER_HOST||"https://scanner.tradingview.com"}function r(e,t){const i=s();return t?`${i}/${t}/`:1===e.length?`${i}/${e[0]}/`:`${i}/global/`}function n(e,t,i){return`${s()}/symbol?symbol=${e}&fields=${t}${i?"&no_404=true":""}`}i.d(t,{getBackendUrl:()=>r,getSymbolDataUrl:()=>n})},1500:(e,t,i)=>{"use strict";i.d(t,{solutionIds:()=>s}) ;const s=JSON.parse('{"EXTENDED_HOURS":43000502023,"PRE_MARKET":43000502023,"POST_MARKET":43000502023,"SPREAD_CHARTS":43000502298,"ALERTS":43000520149,"ALERT_ON_STRATEGY":43000481368,"ALERT_WEBHOOK":43000529348,"ALERT_DESCRIPTION_PLACEHOLDER":43000531021,"ALERT_RECEIVE_NOTIFICATIONS_OH_PHONE":43000474389,"ALERT_USE_ALTERNATIVE_EMAIL":43000474394,"ALERT_WEBHOOK_CREDENTIALS":43000722015,"VOLUME_PROFILE":43000502040,"VOLUME_PROFILE_INDICATOR":43000557450,"RENKO":43000502284,"KAGI":43000502272,"LINE_BREAK":43000502273,"PNF":43000502276,"FINANCIAL_DATA":43000543506,"BROKER_RATING":43000542490,"CRYPTO_MARKET_CAP":43000540941,"CRYPTO_PAYMENT":43000485536,"ALERT_ON_SPREAD":43000478406,"ALERT_ON_LOG_SCALE":43000690942,"ALERT_ON_CUSTOM_SCRIPT":43000478415,"ALERT_FUNCTION":43000597494,"SMS_VERIFICATION":43000553429,"MAGNET_MODE":43000537270,"PINE_CANNOT_DETERMINE":43000587849,"PRIVACY_SETTINGS":43000548335,"PUBLICATION_TYPE":43000609497,"SCRIPT_ACCESS":43000482573,"MEMORY_LIMITS_EXCEEDED":43000590233,"FREE_USER_FAQS":43000590947,"STRATEGY_UNREALISTIC_RESULTS":43000481029,"STRATEGY_FUTURE_DATA":43000614705,"STREAM_RULES":43000591348,"HOW_TO_USE_PAPER":43000516466,"HOW_TO_USE_CQG":43000516372,"HOW_TO_USE_OANDA":43000516375,"HOW_TO_USE_FOREXCOM":43000516374,"FAVORITE_IDEA":43000555216,"YOUTUBE_ERROR":43000612153,"AUTHORS_INSTRUCTIONS_PUBCLICATION":43000549951,"AUTHORS_INSTRUCTIONS_EDIT":43000614618,"SCRIPT_INSTRUCTIONS":43000482573,"BAR_REPLAY_UNAVAILABILITY":43000475470,"WHAT_IS_CBOE_BZX_EXCHANGE":43000473924,"GOPRO_UPGRADE_DESCRIPTION":43000473324,"GOPRO_DOWNGRADE_DESCRIPTION":43000485437,"FINANCIALS_OWNERSHIP":43000699479,"FINANCIALS_VALUATION_SUMMARY":43000699484,"FINANCIALS_VALUATION_RATIOS":43000699495,"FINANCIALS_GROWTH_AND_PROFITABILITY":43000699485,"FINANCIALS_REVENUE_TO_PROFIT_CONVERSION":43000699496,"FINANCIALS_REVENUE_BREAKDOWN_BY_SOURCE":43000699487,"FINANCIALS_REVENUE_BREAKDOWN_BY_COUNTRY":43000699497,"FINANCIALS_REVENUE_ESTIMATES":43000699489,"FINANCIALS_EARNINGS_ESTIMATES":43000699498,"FINANCIALS_DIVIDEND_SUMMARY":43000699500,"FINANCIALS_DIVIDEND_HISTORY":43000699501,"FINANCIALS_DEBT_LEVEL":43000699502,"FINANCIALS_POSITION":43000699503,"BROKERAGE_REVIEWS":43000591351,"CHANGE_SUBSCRIPTION":43000635806,"PINE_LIBRARY_INFO":43000638371,"HOW_TO_CREATE_A_STREAM":43000646171,"HOW_DO_I_UPDATE_DESKTOP_APP":43000647779,"TECHNICAL_RATINGS":43000614331,"BACKTESTING_WIDGET":43000562362,"BACKTESTING_NO_DATA":43000478450,"DEEP_BACKTESTING_WIDGET":43000670566,"DEEP_BACKTESTING":43000666199,"DEEP_BACKTESTING_AVAILABLE_DATA":43000668210,"BETA_BROKERS":43000673434,"VIDEO_UPLOAD_FAILED":43000666607,"VIDEO_DEVICE_ACCESS":43000677209,"PUBLIC_INVITE_ONLY_SCRIPTS":43000614617,"HOW_DOES_BRACKETS_MANAGEMENT_WORK":43000631987,"HOW_TO_SEE_THE_DEEPEST_HIST_DATA":43000687053,"I_CANT_SEE_ALL_HIST_DATA_ON_RES_LOWER_THAN_DAY":43000480679,"IDEAS_ON_CHART":43000694285,"GET_A_REFUND":43000485430,"USE_SETTLEMENT_AS_CLOSE_ON_DAILY_INTREVAL":43000685268,"ADJUST_FOR_CONTRACT_CHANGES":43000685266,"ADJUST_DATA_FOR_DIVIDENDS":43000590597,"WHY_IS_MY_ACCOUNT_BANNED":43000674726,"HOW_TO_PUBLISH_A_VIDEO_IDEA":43000476752,"WHAT_ARE_TRADINGVIEW_LIVE_STREAMS_BEST_PRACTICES":43000685377,"TELL_ME_MORE_ABOUT_THE_COMMUNITY_SCRIPTS":43000558522,"HOW_TO_POST_AWESOME_IDEAS_AND_GET_LOTS_OF_LIKES":43000603748,"ABOUT_EXPERT_PLAN":43000677382,"CONNECTIONS_LIMIT_EXCEEDED":43000693877,"ACCOUNT_RECOVERY":43000619597,"HOW_TO_SYNC_CHARTS_ON_LAYOUT":43000629992,"HOW_TO_SEE_BUILTIN_INDICATOR_SOURCE":43000481659,"HOW_CAN_I_GET_ACCESS_TO_STREAMS":43000685376,"MULTI_CHART_MODE":43000629990,"QUICK_SEARCH":43000659671,"WHATS_AN_INDICATOR":43000543626,"CHART_TYPES":43000703407,"DRAWING_TOOLS":43000703396,"CUSTOM_INTERVALS":43000543883,"CANDLESTICK_PATTERNS":43000584462,"MULTI_TIMEFRAME_CHARTS":43000502591,"BAR_REPLAY":43000712747,"PINE_SCRIPT":43000561836,"SCREENER_OVERVIEW":43000635796,"STREAMS_OBS_SETUP":43000639464,"AUTO_CHART_PATTERNS":43000690464,"HOW_TO_PROTECT_YOUR_ACCOUNT":43000582277,"PLUS_BUTTON":43000645256,"PLAN_UPGRADED_BUT_DATA_STILL_DELAYED":43000471705,"WHY_TAX_HAS_BEEN_ADDED_TO_MY_BILL":43000684741,"COMPARE_SYMBOLS_TOOL":43000543053,"SAVED_CHART":43000692404,"CUSTOM_INDICATOR":43000543048,"BIST_MIXED_SUBSCRIPTION":43000609137,"WHY_RENKO_NOT_WORK":43000711502,"ALERTS_SEPARATION_BY_TYPE":43000696403,"HOW_TO_SET_UP_ALERTS":43000595315,"PINE_SCRIPT_STRATEGIES":43000562362,"ECONOMIC_CALENDAR":43000707391,"DIFFERENCE_BETWEEN_PRO_AND_NONPRO_PLANS":43000677382,"HOW_TO_USE_MINDS":43000690226,"HOW_TO_USE_TRADINGVIEW_CHAT":43000604448,"PAPER_COMPETITION":43000593579,"PAPER_COMPETITION_ACCOUNT":43000721315,"PAPER_COMPETITION_PRIZE":43000721317,"PAPER_COMPETITION_FREE_ACCOUNT":43000721310,"PUBLISHING_AND_UPDATING_IDEAS":43000591338,"USING_MINDS":43000696301,"PUBLISH_VIDEO_IDEA":43000476752,"STREAM_GUIDE":43000646171}') },163482:(e,t,i)=>{"use strict";i.d(t,{TECHNICALS_QS_FIELDS:()=>s,TECHNICALS_SCREENER_COLUMNS:()=>l,requiredMAColumns:()=>o,requiredOscColumns:()=>n,requiredPivotsColumns:()=>a,requiredRecommendColumns:()=>r});const s=["type","listed_exchange","pricescale","typespecs","pro_name","short_name"],r=["Recommend.Other","Recommend.All","Recommend.MA"],n=["RSI","Stoch.K","CCI20","ADX","AO","Mom","MACD.macd","Stoch.RSI.K","W.R","BBPower","UO"],o=["EMA10","SMA10","EMA20","SMA20","EMA30","SMA30","EMA50","SMA50","EMA100","SMA100","EMA200","SMA200","Ichimoku.BLine","VWMA","HullMA9"],a=["Pivot.M.Classic.S3","Pivot.M.Classic.S2","Pivot.M.Classic.S1","Pivot.M.Classic.Middle","Pivot.M.Classic.R1","Pivot.M.Classic.R2","Pivot.M.Classic.R3","Pivot.M.Fibonacci.S3","Pivot.M.Fibonacci.S2","Pivot.M.Fibonacci.S1","Pivot.M.Fibonacci.Middle","Pivot.M.Fibonacci.R1","Pivot.M.Fibonacci.R2","Pivot.M.Fibonacci.R3","Pivot.M.Camarilla.S3","Pivot.M.Camarilla.S2","Pivot.M.Camarilla.S1","Pivot.M.Camarilla.Middle","Pivot.M.Camarilla.R1","Pivot.M.Camarilla.R2","Pivot.M.Camarilla.R3","Pivot.M.Woodie.S3","Pivot.M.Woodie.S2","Pivot.M.Woodie.S1","Pivot.M.Woodie.Middle","Pivot.M.Woodie.R1","Pivot.M.Woodie.R2","Pivot.M.Woodie.R3","Pivot.M.Demark.S1","Pivot.M.Demark.Middle","Pivot.M.Demark.R1"],l=[...r,...n,...o,...a]},719885:(e,t,i)=>{"use strict";i.d(t,{TechnicalsDialogController:()=>h});var s=i(583912),r=i(111393),n=i(680632),o=i(729030),a=i(254526),l=i(163482);let d;class h extends r.DialogRenderer{constructor(){super(...arguments),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}async show(e){const t=(null==e?void 0:e.symbol)?e.symbol:s.linking.proSymbol.value();if(null==e?void 0:e.snapshot){const{snapshot:i}=e,s=await this._loadModule();this._getDialog(s,{...e,symbol:t,...i,exchange:i.listed_exchange}).show()}else{const s=async()=>{const{snapshoter:e}=await i.e(51030).then(i.bind(i,795394));return e().getSnapshot(t,new Set(l.TECHNICALS_QS_FIELDS))},[r,n]=await Promise.all([this._loadModule(),s()]);if("error"===n.status)return void this._getDialog(r,{...e,symbol:t}).show();this._getDialog(r,{...e,symbol:t,...n.values,exchange:n.values.listed_exchange}).show()}}async canBeShown(e){const t=e||s.linking.proSymbol.value();if(!t)return!1;const r=new Set([...l.TECHNICALS_QS_FIELDS,"description"]),d=await(async()=>{const{snapshoter:e}=await i.e(51030).then(i.bind(i,795394));return e().getSnapshot(t,r)})();if("error"===d.status)return!1;const{values:{type:h,listed_exchange:u,description:c}}=d;if(!a.SYMBOL_TYPE_BLACK_LIST.has(h))try{const e=(0,n.getTickerSymbol)(t,h),i=await(0,o.getSymbolData)(null,e,["Recommend.All"]);return Boolean(i&&0!==Object.keys(i).length&&c&&u&&h)}catch(e){return!1}return!1}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return d||(d=new h),d}_getDialog(e,t){var i,s;return null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=new e.TechnicalsDialogRenderer(t),this._dialog.visible().subscribe(this._subscribe), this._dialog}_loadModule(){return Promise.all([i.e(37729),i.e(62253),i.e(22666),i.e(92108),i.e(5993),i.e(32109),i.e(9817),i.e(4015),i.e(53842),i.e(38669),i.e(5145),i.e(89842),i.e(25190),i.e(68992),i.e(36747),i.e(21625),i.e(61631),i.e(45896),i.e(52567),i.e(57215),i.e(94345),i.e(80538),i.e(25626),i.e(85418),i.e(39760),i.e(98625),i.e(23683),i.e(27825),i.e(81288),i.e(50690),i.e(23141),i.e(14985),i.e(71138)]).then(i.bind(i,449736))}}},528474:(e,t,i)=>{"use strict";i.d(t,{blendColors:()=>r});var s=i(724377);const r=(e,t)=>(0,s.rgbaToString)((0,s.blendRgba)((0,s.parseRgba)(e),(0,s.parseRgba)(t)))},675128:(e,t,i)=>{"use strict";function s(e){let t=null;return()=>(null===t&&(t=e()),t)}i.d(t,{lazyValue:()=>s})},626333:(e,t,i)=>{"use strict";function s(e,t=window){const i="theme-"+e,s=t.document.documentElement.classList;for(const e of Array.from(s))e.startsWith("theme-")&&e!==i&&s.remove(e);s.add(i)}i.d(t,{applyTheme:()=>s})},273058:(e,t,i)=>{"use strict";i.d(t,{EtfAnalysisDialogController:()=>n});var s=i(111393);let r;class n extends s.DialogRenderer{constructor(){super(...arguments),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(e){this._load(e).then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return r||(r=new n),r}_load(e){return Promise.all([i.e(68716),i.e(19515),i.e(9643),i.e(45393),i.e(62253),i.e(22666),i.e(92108),i.e(92191),i.e(32109),i.e(9817),i.e(4015),i.e(38669),i.e(5145),i.e(72639),i.e(89842),i.e(25190),i.e(68992),i.e(88548),i.e(81643),i.e(48986),i.e(36747),i.e(21625),i.e(61631),i.e(45896),i.e(40866),i.e(52567),i.e(35542),i.e(66886),i.e(84372),i.e(80538),i.e(85418),i.e(50254),i.e(89053),i.e(24510),i.e(89277),i.e(43981),i.e(72786),i.e(5490),i.e(66863),i.e(53724),i.e(96129),i.e(50690),i.e(19136),i.e(29508),i.e(23141),i.e(6827),i.e(65247),i.e(71765),i.e(58534)]).then(i.bind(i,973161)).then((t=>{var i,s;return null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=new t.EtfAnalysisDialogRenderer(e),this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}},232650:(e,t,i)=>{"use strict";i.d(t,{openFinancialsWebview:()=>u});var s=i(195269),r=i(675128),n=i(671040),o=i(6613) ;const a=new Set(["number_of_employees","web_site_url","founded","ceo","market_cap_basic","dividends_yield","price_earnings_ttm","earnings_per_share_basic_ttm","currency_code","fundamental_currency_code","float_shares_outstanding","total_shares_outstanding","total_revenue_fy_h","total_revenue_fq_h","total_revenue_fh_h","net_income_fy_h","net_income_fq_h","net_income_fh_h","total_assets_fy_h","total_assets_fq_h","total_assets_fh_h","total_liabilities_fy_h","total_liabilities_fq_h","total_liabilities_fh_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_operating_activities_fh_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_investing_activities_fh_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","cash_f_financing_activities_fh_h","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","interest_income_fy_h","interest_income_fq_h","interest_income_fh_h","non_interest_income_fy_h","non_interest_income_fq_h","non_interest_income_fh_h","earnings_release_date_fq_h","earnings_release_date_fy_h","earnings_release_date_fh_h","earnings_release_next_date_fq","earnings_release_next_date_fy","earnings_release_next_date_fh","earnings_release_next_time","earnings_release_next_date","is_next_earnings_release_date_estimated","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_next_fy","earnings_per_share_forecast_next_fh","earnings_per_share_forecast_fq_h","earnings_per_share_forecast_fy_h","earnings_per_share_forecast_fh_h","earnings_per_share_fq_h","earnings_per_share_fy_h","earnings_per_share_fh_h","earnings_fiscal_period_fq_h","earnings_fiscal_period_fy_h","earnings_fiscal_period_fh_h","next_earnings_fiscal_period_fq","next_earnings_fiscal_period_fy","next_earnings_fiscal_period_fh","revenue_fq_h","revenue_fy_h","revenue_fh_h","revenue_forecast_fq_h","revenue_forecast_fy_h","revenue_forecast_fh_h","revenue_forecast_next_fq","revenue_forecast_next_fy","revenue_forecast_next_fh","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","dividend_amount_h","total_revenue_fy","gross_profit_fy","ebitda_fy","ebit_fy","net_income_fy","fiscal_period_fy","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","total_debt_fy_h","total_debt_fq_h","total_debt_fh_h","free_cash_flow_fy_h","free_cash_flow_fq_h","free_cash_flow_fh_h","cash_n_equivalents_fy_h","cash_n_equivalents_fq_h","cash_n_equivalents_fh_h","loans_net_fy_h","loans_net_fq_h","loans_net_fh_h","total_deposits_fy_h","total_deposits_fq_h","total_deposits_fh_h","loan_loss_allowances_fy_h","loan_loss_allowances_fq_h","loan_loss_allowances_fh_h","insurance_reserves_fy_h","insurance_reserves_fq_h","insurance_reserves_fh_h","policy_claims_fy_h","policy_claims_fq_h","policy_claims_fh_h","premiums_earned_fy_h","premiums_earned_fq_h","premiums_earned_fh_h","common_equity_tier1_ratio_fy_h","common_equity_tier1_ratio_fq_h","common_equity_tier1_ratio_fh_h","tier1_capital_ratio_fy_h","tier1_capital_ratio_fq_h","tier1_capital_ratio_fh_h","total_capital_ratio_fy_h","total_capital_ratio_fq_h","total_capital_ratio_fh_h","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","reserve_to_total_capital_fy_h","reserve_to_total_capital_fq_h","reserve_to_total_capital_fh_h","unearned_premium_to_total_capital_fy_h","unearned_premium_to_total_capital_fq_h","unearned_premium_to_total_capital_fh_h","total_current_assets_fy","total_current_assets_fq","total_current_assets_fh","total_current_liabilities_fy","total_current_liabilities_fq","total_current_liabilities_fh","total_non_current_assets_fy","total_non_current_assets_fq","total_non_current_assets_fh","total_non_current_liabilities_fy","total_non_current_liabilities_fq","total_non_current_liabilities_fh","fiscal_period_fy","fiscal_period_fq","fiscal_period_fh","price_earnings_fq_h","price_earnings_fy_h","price_earnings_fh_h","price_sales_fq_h","price_sales_fy_h","price_sales_fh_h","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","market_cap_basic","diluted_net_income_ttm","total_revenue_ttm","price_earnings_current","price_sales_current","revenue_seg_by_business_h","revenue_seg_by_region_h","fiscal_period_fy","interest_income_fy","interest_income_fq","interest_income_fh","non_interest_income_fy","non_interest_income_fq","non_interest_income_fh","interest_expense_fy","interest_expense_fq","interest_expense_fh","loan_loss_provision_fy","loan_loss_provision_fq","loan_loss_provision_fh","non_interest_expense_fy","non_interest_expense_fq","non_interest_expense_fh","non_oper_income_fy","non_oper_income_fq","non_oper_income_fh","unusual_expense_inc_fy","unusual_expense_inc_fq","unusual_expense_inc_fh","pretax_income_fy","pretax_income_fq","pretax_income_fh","total_revenue_fy","total_revenue_fq","total_revenue_fh","gross_profit_fy","gross_profit_fq","gross_profit_fh","net_income_fy","net_income_fq","net_income_fh","cost_of_goods_fy","cost_of_goods_fq","cost_of_goods_fh","operating_expenses_fy","operating_expenses_fq","operating_expenses_fh","oper_income_fy","oper_income_fq","oper_income_fh","total_non_oper_income_fy","total_non_oper_income_fq","total_non_oper_income_fh","income_tax_fy","income_tax_fq","income_tax_fh","after_tax_other_income_fy","after_tax_other_income_fq","after_tax_other_income_fh","fiscal_period_fy","fiscal_period_fq","fiscal_period_fh","equity_in_earnings_fy","equity_in_earnings_fq","equity_in_earnings_fh","minority_interest_exp_fy","minority_interest_exp_fq","minority_interest_exp_fh","discontinued_operations_fy","discontinued_operations_fq","discontinued_operations_fh","fund_view_mode"]),l=(0, r.lazyValue)((()=>new n.QuoteSessionSnapshoter({name:"financials-webview-quotes",fields:[...a]})));let d;class h extends s.WebviewControllerBase{open(e){const t=this._createOpenRequest(s.WebviewPageName.Financials,e);l().getSnapshot(t.symbol(),a);t.execute().ChartQuoteSnapshotProvider={getQuoteSnapshot(){var e;const i=o.QUOTE_FIELDS_CACHE.get(t.symbol());return null!==(e=null==i?void 0:i.values)&&void 0!==e?e:{}}}}static getInstance(){return d||(d=new h),d}}function u(e){h.getInstance().open(e)}},497763:(e,t,i)=>{"use strict";i.d(t,{SERIES_COLORS:()=>r,getColorByIndex:()=>o,getItemByIndex:()=>n});var s=i(790188);const r=[s.colorsPalette["color-tv-blue-a200"],s.colorsPalette["color-sky-blue-300"],s.colorsPalette["color-banana-yellow-900"],s.colorsPalette["color-deep-blue-a100"],s.colorsPalette["color-banana-yellow-700"],s.colorsPalette["color-tv-blue-300"],s.colorsPalette["color-grapes-purple-a100"],s.colorsPalette["color-tv-blue-400"],s.colorsPalette["color-minty-green-300"],s.colorsPalette["color-berry-pink-300"],s.colorsPalette["color-tv-blue-a100"],s.colorsPalette["color-tan-orange-a200"],s.colorsPalette["color-iguana-green-400"],s.colorsPalette["color-ripe-red-400"],s.colorsPalette["color-sky-blue-300"],s.colorsPalette["color-banana-yellow-600"],s.colorsPalette["color-berry-pink-a200"],s.colorsPalette["color-tv-blue-200"],s.colorsPalette["color-banana-yellow-900"]];function n(e,t){const i=e[t%e.length];return i||e[0]}function o(e,t=r){return n(t,e)}},436901:(e,t,i)=>{"use strict";i.d(t,{DEFAULT_MAX_DATA_ARRAY_LENGTH:()=>s,FULL_MAX_DATA_ARRAY_LENGTH:()=>r});const s=5,r=7},610203:(e,t,i)=>{"use strict";i.d(t,{PeriodId:()=>s,convertFrequencyToPeriod:()=>_,generateTooltipValues:()=>C,getChartSeriesArray:()=>w,getDataFromQuotes:()=>S,getFinancialsDataFromQuotes:()=>R,getFinancialsSets:()=>m,getFormattedPeriodsEnds:()=>T,getHistoricPeriodsDataFromQuotes:()=>I,getPerformanceSet:()=>f,getPeriodData:()=>b,getPeriodDataFromFinancials:()=>P,getPeriodsDataFromQuotes:()=>x,isQuoteValuesNull:()=>M,pastPerformanceColors:()=>c});var s,r=i(650151),n=i(444372),o=i(157954),a=i(497763),l=i(530254),d=i(904310),h=i(436901),u=i(790188);!function(e){e.Year="FY",e.Quarter="FQ",e.HalfYear="FH"}(s||(s={}));const c=[u.colorsPalette["color-tv-blue-a200"],u.colorsPalette["color-sky-blue-300"]];function _(e){return e&&2===e?s.HalfYear:s.Quarter}function p(e){if(e)return["banking"===e?{title:n.t(null,void 0,i(1017)),fields:["interest_income","non_interest_income"]}:"total_revenue","net_income"]}function f(e){return{id:"income statements",title:n.t(null,void 0,i(663089)),chartType:"compare",marginTitle:n.t(null,void 0,i(861008)),fields:p(e)}}function m(e){return[{id:"income statements",title:n.t(null,void 0,i(506823)),chartType:"compare",marginTitle:n.t(null,void 0,i(861008)),fields:p(e)},{id:"balance sheet",title:n.t(null,void 0,i(730737)),chartType:"compare",marginTitle:n.t(null,void 0,i(981922)),fields:["total_assets","total_liabilities"]},{id:"cash flow",title:n.t(null,void 0,i(822755)),chartType:"lines", fields:["cash_f_operating_activities","cash_f_investing_activities","cash_f_financing_activities"]}]}function v(e){return e.hasOwnProperty("title")}function g(e){return v(e)?e.title:(0,r.ensureDefined)({total_revenue:n.t(null,void 0,i(259285)),net_income:n.t(null,void 0,i(485672)),total_assets:n.t(null,void 0,i(697554)),total_liabilities:n.t(null,void 0,i(475385)),cash_f_operating_activities:n.t(null,void 0,i(404621)),cash_f_investing_activities:n.t(null,void 0,i(418959)),cash_f_financing_activities:n.t(null,void 0,i(517831))}[e])}function y(e,t,i,s=h.DEFAULT_MAX_DATA_ARRAY_LENGTH){if(!v(e))return S(e,t,i,s);const r=e.fields.map((e=>S(e,t,i,s))),n=[];for(let e=0;et[e]));n.push(t.every((e=>null===e))?null:t.reduce(((e,t)=>e+(t||0)),0))}return n}function S(e,t,i,s=h.DEFAULT_MAX_DATA_ARRAY_LENGTH){const r=i[t];if(!r)return[];return r[e].slice(0,s).reverse()}function b(e,t,i=h.DEFAULT_MAX_DATA_ARRAY_LENGTH){const s=e[t];if(s)return s.slice(0,i).reverse()}function w(e,t,i,s=0,n){if(!e.fields)return[];switch(e.chartType){case"compare":const o=e.fields.map(((e,o)=>({type:"bar",name:g((0,r.ensureDefined)(e)),valueType:"numbers",values:y((0,r.ensureDefined)(e),t,(0,r.ensureDefined)(i)),defaultColor:(0,a.getColorByIndex)(o+s,n),showInLegend:!0,buildTooltip:C}))),l=o[0].values.map(((e,t)=>{const i=o[1].values[t];return null===e||null===i?null:0===e?0:i/e*100}));return o.push({type:"line",name:(0,r.ensureDefined)(e.marginTitle),valueType:"percents",values:l,defaultColor:(0,a.getColorByIndex)(e.fields.length+s),showInLegend:!0,buildTooltip:C}),o;case"lines":return e.fields.map(((e,n)=>({type:"line",name:g((0,r.ensureDefined)(e)),valueType:"numbers",values:y((0,r.ensureDefined)(e),t,(0,r.ensureDefined)(i)),defaultColor:(0,a.getColorByIndex)(n+s),showInLegend:!0,buildTooltip:C})));default:return[]}}function C(e,t,i,s,n=!0){const o=e.values[i];if(null===o)return null;const a=(0,l.format)(o,e.valueType);return[{title:n?(0,d.capitalizeFirstLetter)(e.name.toLowerCase()):e.name,color:null!=s?s:(0,r.ensureDefined)(e.defaultColor),value:a}]}function I(e){const{fiscal_period_fy_h:t,fiscal_period_fq_h:i,fiscal_period_fh_h:r}=e;if(t||i||r)return{[s.Year]:t,[s.Quarter]:i,[s.HalfYear]:r}}function x(e){const{fiscal_period_fy:t,fiscal_period_fq:i,fiscal_period_fh:r}=e;if(t||i||r)return{[s.Year]:t,[s.Quarter]:i,[s.HalfYear]:r}}function P(e){var t,i,r;if(!e)return;const n=null===(t=e[s.Year])||void 0===t?void 0:t.fiscal_period,o=null===(i=e[s.Quarter])||void 0===i?void 0:i.fiscal_period,a=null===(r=e[s.HalfYear])||void 0===r?void 0:r.fiscal_period;return n||o||a?{[s.Year]:n,[s.Quarter]:o,[s.HalfYear]:a}:void 0}function T(e,t,i){if(!e)return[];const r=function(e){const{fiscal_period_end_fy_h:t,fiscal_period_end_fq_h:i,fiscal_period_end_fh_h:r}=e;if(t||i||r)return{[s.Year]:t,[s.Quarter]:i,[s.HalfYear]:r}}(e);if(!r)return;const n=new o.DateFormatter("MMM yyyy"),a=r[t];return a?a.slice(0,i).reverse().map((e=>{if(!e)return"";const t=new Date(1e3*e);return n.formatLocal(t)})):[]}function R(e){ const{total_revenue_fy_h:t,total_revenue_fq_h:i,total_revenue_fh_h:r,net_income_fy_h:n,net_income_fq_h:o,net_income_fh_h:a,total_assets_fy_h:l,total_assets_fq_h:d,total_assets_fh_h:h,total_liabilities_fy_h:u,total_liabilities_fq_h:c,total_liabilities_fh_h:_,cash_f_operating_activities_fy_h:p,cash_f_operating_activities_fq_h:f,cash_f_operating_activities_fh_h:m,cash_f_investing_activities_fy_h:v,cash_f_investing_activities_fq_h:g,cash_f_investing_activities_fh_h:y,cash_f_financing_activities_fy_h:S,cash_f_financing_activities_fq_h:b,cash_f_financing_activities_fh_h:w,fiscal_period_fy_h:C,fiscal_period_fq_h:x,fiscal_period_fh_h:P,interest_income_fy_h:T,interest_income_fq_h:R,interest_income_fh_h:D,non_interest_income_fy_h:A,non_interest_income_fq_h:V,non_interest_income_fh_h:L,fund_view_mode:k}=e,B=I(e);if(B){const{[s.Year]:e,[s.Quarter]:I,[s.HalfYear]:N}=B,E=!e||"industrial"===k&&M(t),O=!I||"industrial"===k&&M(i),F=!N;return{[s.Year]:E?void 0:{total_revenue:t,net_income:n,total_assets:l,total_liabilities:u,cash_f_operating_activities:p,cash_f_investing_activities:v,cash_f_financing_activities:S,fiscal_period:C,interest_income:T,non_interest_income:A},[s.Quarter]:O?void 0:{total_revenue:i,net_income:o,total_assets:d,total_liabilities:c,cash_f_operating_activities:f,cash_f_investing_activities:g,cash_f_financing_activities:b,fiscal_period:x,interest_income:R,non_interest_income:V},[s.HalfYear]:F?void 0:{total_revenue:r,net_income:a,total_assets:h,total_liabilities:_,cash_f_operating_activities:m,cash_f_investing_activities:y,cash_f_financing_activities:w,fiscal_period:P,interest_income:D,non_interest_income:L}}}}function M(e){return!e||e.every((e=>null===e))}},713931:(e,t,i)=>{"use strict";i.d(t,{hideDetailsDialogs:()=>l});var s=i(57761),r=i(719885),n=i(988534),o=i(316478),a=i(273058);function l(e){"forecast"!==e&&function(){const e=o.ForecastDialogController.getInstance();e.visible()&&e.hide()}(),"technicals"!==e&&function(){const e=r.TechnicalsDialogController.getInstance();e.visible()&&e.hide()}(),"financials"!==e&&function(){const e=n.FinancialsDialogController.getInstance();e.visible()&&e.hide()}(),"options"!==e&&function(){const e=s.OptionsDialogController.getInstance();e.visible()&&e.hide()}(),"etf-analysis"!==e&&function(){const e=a.EtfAnalysisDialogController.getInstance();e.visible()&&e.hide()}()}},988534:(e,t,i)=>{"use strict";i.d(t,{FinancialsDialogController:()=>n});var s=i(111393);let r;class n extends s.DialogRenderer{constructor(){super(...arguments),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(e){this._load(e).then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return r||(r=new n),r}_load(e){ return Promise.all([i.e(68716),i.e(64505),i.e(62253),i.e(22666),i.e(92108),i.e(5993),i.e(92191),i.e(32109),i.e(9817),i.e(4015),i.e(53842),i.e(34465),i.e(69121),i.e(66639),i.e(30006),i.e(88194),i.e(38669),i.e(76592),i.e(5145),i.e(35649),i.e(72639),i.e(89842),i.e(25190),i.e(68992),i.e(88548),i.e(13423),i.e(81643),i.e(13152),i.e(91033),i.e(36747),i.e(84281),i.e(21625),i.e(61631),i.e(67080),i.e(45896),i.e(90684),i.e(40866),i.e(52567),i.e(57215),i.e(98149),i.e(94345),i.e(24215),i.e(36842),i.e(34186),i.e(163),i.e(35542),i.e(66886),i.e(84372),i.e(80538),i.e(85418),i.e(50254),i.e(24510),i.e(89277),i.e(28345),i.e(43981),i.e(32883),i.e(71838),i.e(20087),i.e(36493),i.e(78059),i.e(53724),i.e(43666),i.e(50690),i.e(19136),i.e(19359),i.e(29508),i.e(23141),i.e(6827),i.e(90803),i.e(65247),i.e(84528),i.e(24878)]).then(i.bind(i,273534)).then((t=>{var i,s;return null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=new t.FinancialsDialogRenderer(e),this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}},700134:(e,t,i)=>{"use strict";i.d(t,{showFinancialsDialog:()=>n});var s=i(988534),r=i(713931);function n(e){s.FinancialsDialogController.getInstance().show({...e,onOpen:()=>{(0,r.hideDetailsDialogs)("financials")}})}},316478:(e,t,i)=>{"use strict";i.d(t,{ForecastDialogController:()=>o});var s=i(111393),r=i(583912);let n;class o extends s.DialogRenderer{constructor(){super(...arguments),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(e){this._load(e).then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}async canBeShown(e){const t=e||r.linking.proSymbol.value(),s=new Set(["recommendation_mark","pro_name"]),n=await(async()=>{const{snapshoter:e}=await i.e(62495).then(i.bind(i,960669));return e().getSnapshot(t,s)})();return!("error"===n.status||!n.values.recommendation_mark)}static getInstance(){return n||(n=new o),n}_load(e){return Promise.all([i.e(68716),i.e(92659),i.e(62253),i.e(22666),i.e(92108),i.e(5993),i.e(32109),i.e(9817),i.e(4015),i.e(53842),i.e(38669),i.e(5145),i.e(72639),i.e(89842),i.e(25190),i.e(68992),i.e(88548),i.e(36747),i.e(39855),i.e(21625),i.e(61631),i.e(45896),i.e(40866),i.e(52567),i.e(57215),i.e(94345),i.e(35542),i.e(66886),i.e(80538),i.e(25626),i.e(85418),i.e(24510),i.e(89277),i.e(10690),i.e(43981),i.e(98625),i.e(17194),i.e(27825),i.e(36493),i.e(85301),i.e(50690),i.e(51004),i.e(19136),i.e(29508),i.e(23141),i.e(65247),i.e(14985),i.e(85080)]).then(i.bind(i,450602)).then((t=>{var i,s;return null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=new t.ForecastDialogRenderer(e),this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}},713668:e=>{e.exports={content:"content-tm3FiOQl",contentWithTab:"contentWithTab-tm3FiOQl",group:"group-tm3FiOQl",subtitle:"subtitle-tm3FiOQl",text:"text-tm3FiOQl",tabsWrapper:"tabsWrapper-tm3FiOQl",tabsContentWrapper:"tabsContentWrapper-tm3FiOQl", groupIcon:"groupIcon-tm3FiOQl",beforeMarketOpen:"beforeMarketOpen-tm3FiOQl",afterMarketClose:"afterMarketClose-tm3FiOQl",groupTitle:"groupTitle-tm3FiOQl",groupRow:"groupRow-tm3FiOQl",groupCell:"groupCell-tm3FiOQl",mob:"mob-tm3FiOQl",mini:"mini-tm3FiOQl",generalContent:"generalContent-tm3FiOQl"}},717496:(e,t,i)=>{"use strict";function s(e){return"FX_IDC:"+e.substring(e.indexOf(":")+1)}i.d(t,{addForexPrefix:()=>s})},680632:(e,t,i)=>{"use strict";i.d(t,{getTickerSymbol:()=>r});var s=i(717496);function r(e,t){return"forex"===t?(0,s.addForexPrefix)(e):e}},671040:(e,t,i)=>{"use strict";i.d(t,{QuoteSessionSnapshoter:()=>h});var s=i(433084),r=i(707957),n=i(266325),o=i(541558),a=i(6613),l=i(461909);const d=new Map([["change","ch"],["last_price","lp"],["change_percent","chp"]]);new Map([["ch","change"],["lp","last_price"],["chp","change_percent"]]);class h{constructor(e){if(this._onSymbolData=new r.Delegate,this._incomplete=new Set,this._connected=!1,this._batcher=null,this._handler=e=>{switch(e.method){case"connected":this._connected||(this._connected=!0,this._handleConnected());break;case"quote_symbol_data":this._connected&&this._handleSymbolData(e.params[0]);break;case"quote_completed":this._connected&&this._handleCompleteData(e.params[0]);break;case"disconnected":this._connected&&(this._connected=!1,this._batcher=null)}},0===e.fields.length)throw new Error('Support for empty "fields" array is not implemented');const{provider:t=s.QuoteSession}=e;this._fields=new Set(e.fields),this._session=new t(window.ChartApiInstance,["snapshoter",e.name,(0,o.randomHash)()].filter(Boolean).join("_")),this._session.connect(this._handler)}getSnapshotSync(e,t){const i=h.cache.get(e);return i&&this._isSnapshotReady(i,t)?i:null}getSnapshotsForAllSync(e,t){return e.map((e=>this.getSnapshotSync(e,t)))}getSnapshot(e,t,i){var s;const r=null!==(s=null==i?void 0:i.signal)&&void 0!==s?s:null;return new Promise(((i,s)=>{if(r&&r.aborted)throw(0,n.createAbortError)();const o=()=>{this._onSymbolData.unsubscribe(this,a),s((0,n.createAbortError)())},a=(s=e)=>{if(s!==e)return!1;const n=h.cache.get(e);return!(!n||!this._isSnapshotReady(n,t))&&(this._onSymbolData.unsubscribe(this,a),null==r||r.removeEventListener("abort",o),i(n),!0)};if(!a()&&(null==r||r.addEventListener("abort",o,{once:!0}),this._onSymbolData.subscribe(this,a),!this._incomplete.has(e))){if(this._incomplete.add(e),!this._connected)return;if(null===this._batcher){const t=this._batcher={symbols:new Set([e]),promise:Promise.resolve().then((()=>{this._batcher===t&&(this._session.quoteAddSymbols([...t.symbols]),this._batcher=null)}))}}else this._batcher.symbols.add(e)}}))}getSnapshotsForAll(e,t,i){return Promise.all(e.map((e=>this.getSnapshot(e,t,i))))}static relax(e){return e}static isSuccess(e){return"error"!==e.status}static hasAllFields(e,t){for(const i of Array.from(t))if(!e.hasOwnProperty(i))return!1;return!0}_isSnapshotReady(e,t){return"error"===e.status||this._hasAllFields(e,t)}_hasAllFields(e,t){return h.hasAllFields(e.values,Array.from(t))}_handleConnected(){if(this._fields.size>0){ const e=[...this._fields].map((e=>{var t;return null!==(t=d.get(e))&&void 0!==t?t:e}));this._session.quoteSetFields(e)}this._incomplete.size>0&&this._session.quoteAddSymbols([...this._incomplete])}_handleCompleteData(e){var t;const i=null!==(t=h.cache.get(e))&&void 0!==t?t:{symbolname:e,status:"ok",values:{}};h.cache.update(i,this._fields,!0),this._session.quoteRemoveSymbols([e]),this._incomplete.delete(e),this._onSymbolData.fire(e)}_handleSymbolData(e){(0,l.normalizeUpdateMode)(e.values);const t=e.symbolname;h.cache.update(e,this._fields,!1),"error"===e.status?this._handleCompleteData(t):this._onSymbolData.fire(t)}}h.cache=a.QUOTE_FIELDS_CACHE},983898:(e,t,i)=>{"use strict";function s(e,t,i){const s=e.get(t);return void 0!==s?s:(e.set(t,i),i)}function r(e,t,i){const s=e.get(t);if(void 0!==s)return s;const r=i();return e.set(t,r),r}function n(e,t,i,r){const n=s(e,t,new Map);return s(n,i,r)}function o(e,t,i,n){return r(s(e,t,new Map),i,n)}function a(e,t,i,r,n){const o=s(e,t,new Map),a=s(o,i,new Map);return s(a,r,n)}i.d(t,{AbstractMapContainer:()=>l,getDefault2:()=>n,getDefault2Lazy:()=>o,getDefault3:()=>a});class l{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}},674981:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>g,findFirst:()=>m,indexOf:()=>v,intersect:()=>_,join:()=>p,lowerbound:()=>o,lowerboundExt:()=>n,moveAfter:()=>u,moveBefore:()=>c,moveToHead:()=>h,removeItemFromArray:()=>f,subtract:()=>d,sum:()=>y,upperbound:()=>l});var s=i(650151);function r(e,t){return e>1,o=s+r;i(e(o),t)?(s=o+1,n-=r+1):n=r}return s}function o(e,t,i,s=0,r=e.length){return n((t=>e[t]),t,i,s,r)}function a(e,t,i=0,s=e.length){return o(e,t,r,i,s)}function l(e,t,i,s=0,r=e.length){let n=r-s;for(;0>1,o=s+r;i(t,e[o])?n=r:(s=o+1,n-=r+1)}return s}function d(e,t){return e.filter((e=>!t.includes(e)))}function h(e,t){const i=e.indexOf(t);return i<0?e.slice():[t].concat(e.slice(0,i)).concat(e.slice(i+1))}function u(e,t,i){const s=new Set(t),r=[],n=[],o=[];return e.forEach(((e,t)=>{s.has(e)?n.push(e):(r.push(e),o.push(t))})),i=i{s.has(e)?n.push(e):(r.push(e),o.push(t))})),i=i<=e.length-1?a(o,i):r.length,r.splice(i,0,...n),{newItems:r,movedItemsStartIndex:i}}function _(e,t){const i=new Set;return e.forEach((e=>{t.has(e)&&i.add(e)})),i}function p(e,t){const i=new Set(e);return t.forEach((e=>i.add(e))),i}function f(e,t){const i=e.indexOf(t);(0,s.assert)(-1!==i,"Item is not found"),e.splice(i,1)}function m(e,t){for(const i of e)if(t(i))return i;return null}function v(e,t){for(let i=0;ie+t),0)}},407478:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>n });var s=i(650151);function r(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}class n{constructor(e=0,t=1.3){this._cache=new Map,this._lastItem=null,this._firstItem=null,this._size=e,this._sizeLimited=e>0,this._capacityFactor=t}set(e,t){const i={key:e,value:t,prevItem:this._lastItem,nextItem:null};null!==this._lastItem&&(this._lastItem.nextItem=i);const s=this._cache.get(e);return void 0!==s&&(r(s),s===this._firstItem&&(this._firstItem=s.nextItem)),this._cache.set(e,i),this._lastItem=i,null===this._firstItem&&(this._firstItem=i),this._sizeLimited&&this._cache.size>this._size*this._capacityFactor&&this._removeExtraItems(),this}has(e){return this._cache.has(e)}get(e){var t;const i=this._cache.get(e);if(void 0===i)return i;if(i===this._firstItem&&(this._firstItem=null!==(t=i.nextItem)&&void 0!==t?t:i),i!==this._lastItem){r(i);const e=(0,s.ensureNotNull)(this._lastItem);e.nextItem=i,i.prevItem=e,i.nextItem=null,this._lastItem=i}return i.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(r(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,s.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{TranslatedString:()=>s});class s{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){return this._originalText}translatedText(){return this._translatedText}format(e){const t={},i={};for(const r of Object.keys(e)){const n=e[r];n instanceof s?(t[r]=n.originalText(),i[r]=n.translatedText()):(t[r]=n.toString(),i[r]=n.toString())}const r=this._originalText.format(t),n=this._translatedText.format(i);return new s(r,n)}}},938550:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>o});var s=i(401580),r=i(389137);function n(e,t){return(0,r.deepEquals)(e,t)[0]}class o extends s.WatchedValue{constructor(e,t=n){super(e),this._comparator=t}setValue(e,t){!1===this._comparator(this.value(),e)&&super.setValue(e,t)}}},607509:(e,t,i)=>{"use strict";var s;i.d(t,{ACTION_ID:()=>s}),function(e){e.UnknownAction="UnknownAction",e.ChartApplyIndicatorsToAllCharts="Chart.ApplyIndicatorsToAllCharts",e.ChartChangeTimeZone="Chart.ChangeTimeZone",e.ChartIndicatorPineSource="Chart.Indicator.PineSource",e.ChartDialogsShowChangeInterval="Chart.Dialogs.ShowChangeInterval",e.ChartDialogsShowChangeSymbol="Chart.Dialogs.ShowChangeSymbol",e.ChartDialogsShowCompareOrAddSymbol="Chart.Dialogs.ShowCompareOrAddSymbol",e.ChartDialogsShowGeneralSettings="Chart.Dialogs.ShowGeneralSettings",e.ChartDialogsShowGeneralSettingsSymbolTab="Chart.Dialogs.ShowGeneralSettings.SymbolTab",e.ChartDialogsShowGeneralScalesTab="Chart.Dialogs.ShowGeneralSettings.ScalesTab",e.ChartDialogsShowGoToDate="Chart.Dialogs.ShowGoToDate", e.ChartDialogsShowInsertIndicators="Chart.Dialogs.ShowInsertIndicators",e.ChartDialogsShowInsertFinancials="Chart.Dialogs.ShowInsertFinancials",e.ChartDialogsShowSymbolInfo="Chart.Dialogs.ShowSymbolInfo",e.ChartDrawingToolbarToggleVisibility="Chart.DrawingToolbar.ToggleVisibility",e.ChartLinesToggleBidAskLinesVisibility="Chart.Lines.ToggleBidAskLinesVisibility",e.ChartLinesToggleHighLowLinesVisibility="Chart.Lines.ToggleHighLowLinesVisibility",e.ChartLinesToggleAverageLineVisibility="Chart.Lines.ToggleAverageLineVisibility",e.ChartLinesTogglePrePostMarketLineVisibility="Chart.Lines.TogglePrePostMarketLineVisibility",e.ChartLinesToggleSeriesPrevCloseLineVisibility="Chart.Lines.ToggleSeriesPrevCloseLineVisibility",e.ChartLinesToggleSeriesPriceLineVisibility="Chart.Lines.ToggleSeriesPriceLineVisibility",e.ChartLineToolPitchforkChangeTypeToInside="Chart.LineTool.Pitchfork.ChangeTypeToInside",e.ChartLineToolPitchforkChangeTypeToModifiedSchiff="Chart.LineTool.Pitchfork.ChangeTypeToModifiedSchiff",e.ChartLineToolPitchforkChangeTypeToOriginal="Chart.LineTool.Pitchfork.ChangeTypeToOriginal",e.ChartLineToolPitchforkChangeTypeToSchiff="Chart.LineTool.Pitchfork.ChangeTypeToSchiff",e.ChartMarksToggleVisibility="Chart.Marks.ToggleVisibility",e.ChartMoveChartInLayout="Chart.MoveChartInLayout",e.ChartMoveChartInLayoutBack="Chart.MoveChartInLayout.Back",e.ChartMoveChartInLayoutForward="Chart.MoveChartInLayout.Forward",e.ChartObjectTreeShow="Chart.ObjectTree.Show",e.ChartDataWindowShow="Chart.DataWindow.Show",e.ChartPriceScaleLabelsToggleBidAskLabelsVisibility="Chart.PriceScale.Labels.ToggleBidAskLabelsVisibility",e.ChartPriceScaleLabelsToggleHighLowPriceLabelsVisibility="Chart.PriceScale.Labels.ToggleHighLowPriceLabelsVisibility",e.ChartPriceScaleLabelsToggleAveragePriceLabelVisibility="Chart.PriceScale.Labels.ToggleAveragePriceLabelVisibility",e.ChartPriceScaleLabelsToggleIndicatorsNameLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsNameLabelsVisibility",e.ChartPriceScaleLabelsToggleIndicatorsValueLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsValueLabelsVisibility",e.ChartPriceScaleLabelsTogglePrePostMarketLabelsVisibility="Chart.PriceScale.Labels.TogglePrePostMarketLabelsVisibility",e.ChartPriceScaleLabelsToggleSeriesLastValueVisibility="Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",e.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility="Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",e.ChartPriceScaleLabelsToggleSymbolPrevCloseValueVisibility="Chart.PriceScale.Labels.ToggleSymbolPrevCloseValueVisibility",e.ChartPriceScaleMergeAllScalesToLeft="Chart.PriceScale.MergeAllScalesToLeft",e.ChartPriceScaleMergeAllScalesToRight="Chart.PriceScale.MergeAllScalesToRight",e.ChartPriceScaleMoveToLeft="Chart.PriceScale.MoveToLeft",e.ChartPriceScaleMoveToRight="Chart.PriceScale.MoveToRight",e.ChartPriceScaleToggleAddOrderPlusButtonVisibility="Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",e.ChartPriceScaleToggleAutoScaleSeriesOnly="Chart.PriceScale.ToggleAutoScaleSeriesOnly", e.ChartPriceScaleToggleCountdownToBarCloseVisibility="Chart.PriceScale.ToggleCountdownToBarCloseVisibility",e.ChartRedo="Chart.Redo",e.ChartRemoveAllIndicators="Chart.RemoveAllIndicators",e.ChartRemoveAllIndicatorsAndLineTools="Chart.RemoveAllIndicatorsAndLineTools",e.ChartRemoveAllLineTools="Chart.RemoveAllLineTools",e.ChartToggleVisibilityAllLineTools="Chart.ToggleVisibility.AllLineTools",e.ChartScalesReset="Chart.Scales.Reset",e.ChartScalesToggleLockPriceToBarRatio="Chart.Scales.ToggleLockPriceToBarRatio",e.ChartSelectedObjectHide="Chart.SelectedObject.Hide",e.ChartSelectedObjectRemove="Chart.SelectedObject.Remove",e.ChartSelectedObjectShowSettingsDialog="Chart.SelectedObject.ShowSettingsDialog",e.ChartSelectedObjectToggleLocked="Chart.SelectedObject.ToggleLocked",e.ChartSeriesPriceScaleToggleAutoScale="Chart.Series.PriceScale.ToggleAutoScale",e.ChartSeriesPriceScaleToggleIndexedTo100="Chart.Series.PriceScale.ToggleIndexedTo100",e.ChartSeriesPriceScaleToggleInvertPriceScale="Chart.Series.PriceScale.ToggleInvertPriceScale",e.ChartSeriesPriceScaleToggleLogarithmic="Chart.Series.PriceScale.ToggleLogarithmic",e.ChartSeriesPriceScaleTogglePercentage="Chart.Series.PriceScale.TogglePercentage",e.ChartSeriesPriceScaleToggleRegular="Chart.Series.PriceScale.ToggleRegular",e.ChartSessionBreaksToggleVisibility="Chart.SessionBreaks.ToggleVisibility",e.ChartTimeScaleReset="Chart.TimeScale.Reset",e.ChartUndo="Chart.Undo",e.ChartThemeApply="Chart.Theme.Apply",e.ChartSourceIntervalsVisibility="Chart.Source.IntervalsVisibility",e.ChartSourceIntervalsVisibilityCurrentAndAbove="Chart.Source.IntervalsVisibility.CurrentAndAbove",e.ChartSourceIntervalsVisibilityCurrentAndBelow="Chart.Source.IntervalsVisibility.CurrentAndBelow",e.ChartSourceIntervalsVisibilityOnlyCurrent="Chart.Source.IntervalsVisibility.Current",e.ChartSourceIntervalsVisibilityAll="Chart.Source.IntervalsVisibility.All",e.Loading="Loading"}(s||(s={}))},373571:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Action:()=>a,Loader:()=>d,Separator:()=>l});var s=i(650151),r=i(707957),n=i(470316),o=i(541558);class a{constructor(e){this.type="action",this._destroyed=!1,this._binding=null,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:n,customActionOptions:l,customActionOptionsLoader:d,id:h=o.guid()}=e;(0,s.assert)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new r.Delegate,this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=null!=n?n:null,this._loadOptionsGetter&&(this._options.loading=!0),l&&(this._customAction=new a({actionId:t,options:l,optionsLoader:d,id:h}))}custom(){return this._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){return this._options.label||""}getSubItems(){return this._options.subItems||[]}isDisabled(){return!0===this._options.disabled}isActive(){return!0===this._options.active}isCheckable(){return!0===this._options.checkable}isChecked(){return!0===this._options.checked} isLoading(){return!0===this._options.loading}loadOptions(){return this._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){var e;return null!==(e=this._options.size)&&void 0!==e?e:"normal"}getPayload(){return this._options.payload}update(e){this._destroyed||(this._unbindShortcut(),e.hotkeyHash&&(this._options.shortcutHint=(0,n.humanReadableHash)(e.hotkeyHash)),this._options=Object.assign(this._options,e),this._bindShortcut(),this._onUpdate.fire(this))}onUpdate(){return this._onUpdate}getState(){return this.loadOptions(),{actionId:this._options.actionId,label:this.getLabel(),styledLabel:this._options.styledLabel,disabled:this.isDisabled(),active:this.isActive(),subItems:this.getSubItems(),checkable:this.isCheckable(),checked:this.isChecked(),loading:this.isLoading(),size:this.getSize(),doNotCloseOnClick:this._options.doNotCloseOnClick||!1,shortcutHint:this._options.shortcutHint,hint:this._options.hint,icon:this._options.icon,iconId:this._options.iconId,iconChecked:this._options.iconChecked,toolbox:this._options.toolbox,showToolboxOnHover:this._options.showToolboxOnHover||!1,statName:this._options.statName,name:this._options.name,invisibleHotkey:this._options.invisibleHotkey,noInteractive:this._options.noInteractive,jsxLabel:"jsxLabel"in this._options?this._options.jsxLabel:void 0,isRepeatAccepted:this._options.isRepeatAccepted}}getBinding(){return this._binding}setBinding(e){this._binding=e}destroy(){var e,t,i;this._destroyed=!0,this._onUpdate.destroy(),null!==this._binding&&this._binding.destroy(),this._unbindShortcut(),null===(t=(e=this._options).onDestroy)||void 0===t||t.call(e),null===(i=this._customAction)||void 0===i||i.destroy()}options(){return this._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;const e="string"==typeof this._options.label?this._options.label:this._options.name;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash,isRepeatAccepted:this._options.isRepeatAccepted,desc:e,handler:()=>this.execute(),isDisabled:()=>this.isDisabled()})}_unbindShortcut(){this._hotkeyAction&&(this._hotkeyAction.destroy(),delete this._hotkeyAction)}}class l{constructor(e){this.type="separator",this.id=o.guid(),this._hint=e}getHint(){return this._hint}}class d extends a{constructor(e){super({actionId:e,options:{}})}isLoading(){return!0}getSize(){return"big"}}},199471:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>b,addExclusionAreaByScope:()=>S,calcTextHorizontalShift:()=>g,clearRect:()=>c,createBoundCanvas:()=>m,createDisconnectedCanvas:()=>p,disableSelection:()=>y,drawScaled:()=>_,drawWithExclusionAreaByScope:()=>w,fillRect:()=>u,getBindingPixelRatio:()=>l,getContext2D:()=>d,getPrescaledContext2D:()=>h,measureText:()=>I,tryApplySuggestedCanvasBitmapSize:()=>v});var s=i(327714),r=i(650151),n=i(109154),o=i(31341),a=i(638456);function l(e){return(0,n.getCanvasDevicePixelRatio)(e.canvasElement)} function d(e){const t=(0,r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function h(e){const t=(0,r.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function u(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function c(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function _(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function p(e,t,i){const s=f(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function f(e){const t=e.createElement("canvas");return y(t),t}function m(e,t){const i=f((0,r.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=(0,s.bindCanvasElementBitmapSizeTo)(i,{type:"device-pixel-content-box",transform:(e,t)=>0===e.width||0===e.height?e:{width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}});return n.resizeCanvasElement(t),n}function v(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function g(e,t){return"center"===e.textAlign?0:(0,o.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function y(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function S(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e{"use strict";i.d(t,{showCustomUrlEventDialog:()=>a});var s=i(444372),r=i(779923);const n=s.t(null,void 0,i(468988)),o=s.t(null,void 0,i(620036));async function a(e){const{onConfirm:t,onClose:i,title:s,placeholderText:a}=e;return(0,r.showRename)({title:s,text:"",placeholder:a,mainButtonText:n,cancelButtonText:o,onRename:({newValue:e,dialogClose:i})=>{t(e),i()},onClose:i})}},111393:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>r});var s=i(401580);class r{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1)}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},109154:(e,t,i)=>{"use strict";function s(e){var t,i ;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},270294:(e,t,i)=>{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>r,CollectionViewMode:()=>o,chartWidgetCollectionService:()=>n});var s=i(564894);const r={id:"ChartWidgetCollectionService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}var o;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(o||(o={}))},572230:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>a,defaultInvalidationLevel:()=>o});var s,r=i(650151);class n{constructor(e=o){this._paneInvalidationLevel=o,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._legendWidgetInvalidated=!1,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidateLegendWidgetLayout(){this._legendWidgetInvalidated=!0}invalidatePriceScale(e,t,i){const s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,r=s.get(t)||o;s.set(t,Math.max(r,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}legendWidgetLayoutInvalidated(){return this._legendWidgetInvalidated||this._invalidationLevel===s.Full}getterForPriceScaleInvalidationLevelBySide(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||o,this._invalidationLevel)}priceScaleSideMaxLevel(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;let i=this._invalidationLevel;return t.size>0&&t.forEach((e=>{e>i&&(i=e)})),i}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._paneInvalidationLevel=Math.max(this._paneInvalidationLevel,e._paneInvalidationLevel),e._leftPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._leftPriceScalesInvalidationMap.get(t)||o;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||o;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})),this._legendWidgetInvalidated=this._legendWidgetInvalidated||e._legendWidgetInvalidated}}!function(e){e[e.None=0]="None",e[e.Cursor=1]="Cursor",e[e.Light=2]="Light",e[e.Full=3]="Full"}(s||(s={}));const o=s.None;class a{constructor(e=o){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeAxisInvalidationLevel=o,this._invalidatedPanes=new Map,this._additionalActions=[],this._timeScaleInvalidations=[],this._invalidationLevel=e}invalidateAll(e){this._invalidationLevel!==e&&(this._invalidationLevel=Math.max(this._invalidationLevel,e),this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})))}invalidateAllPane(e,t){ this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidateAll(t)}invalidatePriceScale(e,t,i,s){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e){this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e)}invalidatePanesOrder(){this._panesOrderChanged=!0}lockVisibleTimeRangeOnResize(){this._keepVisibleTimeRangeOnResize=!0}fullInvalidation(){return this._invalidationLevel}maxPaneInvalidation(){const e=[];return this._invalidatedPanes.forEach((t=>{e.push(t.fullInvalidation())})),Math.max(...e,this._invalidationLevel)}invalidateForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidateForTimeScale(){return Math.max(this._timeAxisInvalidationLevel,this._invalidationLevel)}validationActions(){return this._additionalActions}addValidationAction(e){this._additionalActions.push(e)}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._panesOrderChanged=this._panesOrderChanged||e._panesOrderChanged,this._keepVisibleTimeRangeOnResize=this._keepVisibleTimeRangeOnResize||e._keepVisibleTimeRangeOnResize,this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})),e._invalidatedPanes.forEach(((e,t)=>{this._invalidatedPanes.has(t)||this._invalidatedPanes.set(t,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e._timeAxisInvalidationLevel);for(let t=0;t0===e.type));if(-1!==i){const[s]=this._timeScaleInvalidations.splice(i,1) ;null===(t=(e=s.value).onFinish)||void 0===t||t.call(e,!1)}}}},86121:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(638456).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function r(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},226663:(e,t,i)=>{"use strict";i.d(t,{LollipopGroupIcons:()=>s,LollipopTooltipContentRow:()=>d});var s,r=i(50959),n=i(497754),o=i.n(n),a=i(83436),l=i(713668);function d(e){const{name:t,value:i,style:s,valueStyle:n,onValueClick:d,valueRightIcon:h,className:u}=e;return r.createElement("div",{className:o()(l.groupRow,u),style:s},t&&r.createElement("div",{className:l.groupCell},r.createElement("span",{className:l.text},t)),r.createElement("div",{className:l.groupCell},r.createElement("span",{className:l.text,style:n,onClick:d},i),h&&r.createElement(a.Icon,{icon:h.iconContent,className:o()(l.groupIcon,h.iconClass,"apply-common-tooltip"),title:h.tooltipText})))}!function(e){e[e.BeforeMarketOpen=l.beforeMarketOpen]="BeforeMarketOpen",e[e.AfterMarketClose=l.afterMarketClose]="AfterMarketClose"}(s||(s={}))},318041:(e,t,i)=>{"use strict";i.d(t,{TextImageCachesContainer:()=>a});var s=i(650151),r=i(983898),n=i(511131),o=i(600642);class a extends r.AbstractMapContainer{constructor(e){super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,font:a,lineSpacing:l=0}=e;if(!i||!t||!s)return null;const d=(0,n.makeFont)(t,a),h=(0,r.getDefault3)(this._map,l,s,d,new Map);let u=h.get(i);return void 0!==u||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([d,s,l,i]),u=new o.TextImageCache(i,e.bold,e.italic,a,t,s,l),h.set(i,u)),u}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,r,n]=e,o=(0,s.ensureDefined)(this._map.get(r)),a=(0,s.ensureDefined)(o.get(i)),l=(0,s.ensureDefined)(a.get(t));l.delete(n),0===l.size&&a.delete(t),0===a.size&&o.delete(i),0===o.size&&this._map.delete(r)}}},600642:(e,t,i)=>{"use strict";i.d(t,{HorizontalAlign:()=>s,TextImageCache:()=>h,VerticalAlign:()=>r});var s,r,n=i(327714),o=i(650151),a=i(511131),l=i(199471);!function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(r||(r={}));const d=(0,l.createDisconnectedCanvas)(document,(0,n.size)({width:0,height:0}),1);class h{constructor(e,t,i,s,r,n="center",l=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,a.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,r),this._fontSize=r,this._verticalPadding=~~(r/6),this._textAlign=n,this._lineSpacing=l;const h=(0,o.ensureNotNull)(d.getContext("2d"));h.font=this._font,h.textBaseline="top";let u=0;for(let e=0;e{for(const e of this._lines)o.strokeStyle&&i.strokeText(e,a,d),i.fillText(e,a,d),d+=this._fontSize,d+=this._lineSpacing})),i.restore()}}},195269:(e,t,i)=>{"use strict";i.d(t,{WebviewControllerBase:()=>n,WebviewPageName:()=>s});var s,r=i(583912);!function(e){e.Financials="financials",e.Forecast="forecast",e.Details="details",e.Technicals="technicals",e.EtfAnalysis="etf-analysis"}(s||(s={}));class n{_createOpenRequest(e,t=new URLSearchParams){var i;const s=null!==(i=t.get("symbol"))&&void 0!==i?i:r.linking.symbol.value();return t.set("symbol",s),{execute(){const i=new URL(`webview/${e}/`,location.origin);return i.search=t.toString(),window.open(i,"_blank")},symbol:()=>s}}}},938471:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const r of this._backColorers)r.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},593804:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(960521),r=i.n(s);function n(e,t){return r()(e).div(t).round(0,r().roundHalfUp).mul(t).toNumber()}},548587:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>r});var s=i(544421);function r(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 18:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(null!=t?t:"close");default:return(0,s.barFunction)("close","open")}}},65455:(e,t,i)=>{"use strict";function s(e,t,i=0){t.setValue(e.value());const s={};return e.subscribe(s,(e=>{t.setValue(e.value())})),1===i&&t.subscribe(s,(t=>{e.setValue(t.value())})),()=>{e.unsubscribeAll(s),1===i&&t.unsubscribeAll(s)}}i.d(t,{bindProperties:()=>s})},586784:(e,t,i)=>{"use strict";var s=i(511131).makeFont,r=i(511131).parseFont,n=i(201089).getLogger;const{drawPoly:o}=i(787123);var a=n("Model.ChartTradingUtils"),l={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])return this._parsedColorCache[e];var t=document.createElement("div");t.style.color=e;var i=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/i),s={r:i[1],g:i[2],b:i[3],a:i[4]||"1"} ;return this._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){var i=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){var s=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");var r=100*(1-s.a);i.setValue(Math.max(0,Math.min(r,100)))},getFontFromProperties:function(e,t,i,r){return s(t.value(),e.value(),r.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){var o=r(e);null!==o?(o.family.length>0&&t.setValue(o.family),i.setValue(o.size),s.setValue(o.bold),n.setValue(o.italic)):a.logError("Invalid font: "+e)},fontHeight:function(e){if(!this._fontHeightCache[e]){var t=document.createElement("span");t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;";var i=t.offsetHeight;document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)}return this._fontHeightCache[e]},drawPolyHoverOrPress:function(e,t,i,s){s?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",o(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",o(e,t,!0),e.restore())},repaint:function(e){e.lightUpdate()},roundToMinTick:function(e,t){var i=1/e.mainSource().base();return i*Math.round(t/i)}};e.exports=l},261066:(e,t,i)=>{"use strict";i.d(t,{currencyUnitVisibilityOptions:()=>a,currencyUnitVisibilityProperty:()=>o,migrateShowCurrencyAndShowUnitProperties:()=>h,restoreCurrencyUnitVisibilitySettingsValue:()=>l});var s=i(87053),r=i(62802),n=i.n(r);const{property:o,availableValues:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let d=!1;function h(e,t){d||(d=!0,void 0===n().getValue("PriceAxisCurrencyAndUnit.visibility")&&o().setValue(e||t?"alwaysOn":"alwaysOff"))}},790524:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>o,isMainSeriesState:()=>r,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(616117);function r(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function o(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return Boolean(e.type)&&(0,s.isStudyLineToolName)(e.type)}},996986:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>d,getTranslatedStringForSource:()=>l});var s=i(809796),r=i(541558),n=i(707957),o=i(811630),a=i(401580);function l(e,t){return new s.TranslatedString(t.name(),t.title(e))}class d{constructor(e){this._isDestroyed=!1,this._hasAlert=new a.WatchedValue(!1),this._alertCreationAvailable=new a.WatchedValue(o.alertsAvailable),this._zorder=0,this._priceScale=null,this._ownerSource=null,this._userEditEnabled=!0,this._priceScaleChanged=new n.Delegate,this._isSelectionEnabled=!0,this._instanceId=(0,r.randomHashN)(6),this._ownerSourceChanged=new n.Delegate,this._zOrderChanged=new n.Delegate,this._id=null!=e?e:(0,r.randomHashN)(6),o.alertsAvailable&&Promise.resolve().then((()=>{this._isDestroyed||this._hasAlert.subscribe(this._updateAlertCreationAvailable.bind(this),{callWithLast:!0}) }))}destroy(){this._isDestroyed=!0}id(){return this._id}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id=e}zorder(){return this._zorder}setZorder(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e,this._zOrderChanged.fire(e))}preferredZOrder(){return null}isSpeciallyZOrderedSource(){return!1}title(e){return this.name()}priceScale(){return this._priceScale}setPriceScale(e){this._priceScale=e,this._priceScaleChanged.fire(e)}priceScaleChanged(){return this._priceScaleChanged}ownerSource(){return this._ownerSource}setOwnerSource(e){const t=this._ownerSource;this._ownerSource=e,this._ownerSourceChanged.fire(t,e)}ownerSourceChanged(){return this._ownerSourceChanged}zOrderChanged(){return this._zOrderChanged}isSavedInChart(e){return!0}isSavedInStudyTemplates(){return!0}isRemovedByStudyTemplates(){return!0}hasContextMenu(){return!0}showInObjectTree(){return!0}setUserEditEnabled(e){this._userEditEnabled=e}userEditEnabled(){return this._userEditEnabled}canBeHidden(){return this.userEditEnabled()}isUserDeletable(){return this.userEditEnabled()}properties(){return null}isVisible(){return this.properties().visible.value()}dataWindowView(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(e){}paneViews(e){return null}labelPaneViews(){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(e){}getSourceIcon(){return null}state(e){return null}doesMovingAffectsUndo(){return!0}isMultiPaneAvailable(){return!1}isMultiPaneEnabled(){return!1}copiable(){return!1}cloneable(){return!1}movable(){return!1}isIncludedInAutoScale(){return!1}isHoveredEnabled(){return this.isSelectionEnabled()}showOnTopOnHovering(){return!0}isSelectionEnabled(){return this._isSelectionEnabled}setSelectionEnabled(e){this._isSelectionEnabled=e}firstValue(){return null}priceRange(e,t){return null}autoScaleInfo(e,t){return{range:this.priceRange(e,t)}}stateForAlert(){return null}canHasAlert(){return!1}hasAlert(){return this._hasAlert.readonly()}alertCreationAvailable(){return this._alertCreationAvailable.readonly()}hasStateForAlert(){return o.alertsAvailable}idForAlert(){return this._id}_getAlertCreationAvailable(){return o.alertsAvailable&&this.hasStateForAlert()}_updateAlertCreationAvailable(){o.alertsAvailable&&this._alertCreationAvailable.setValue(this._getAlertCreationAvailable())}}},177126:(e,t,i)=>{"use strict";i.d(t,{getDataVendorString:()=>r});var s=i(244842);function r(e){return null==e||s.enabled("bovespa_widget")?null:"QUANDL"===e.exchange?"Quandl.com":["BMFBOVESPA","BME","NAG","TSE","TFX","NZX","BCBA","TWSE","TASE","EURONEXT","TOCOM","BMV","SIX","SGX","GPW","SWB","BCS","WB","SZSE","BELEX","BAHRAIN","EGX","TADAWUL","BVL","LUXSE","DFM","BVC","NSENG","IDX","HSI","QSE","OSE"].includes(e.exchange)?"ICE Data Services":null}},782086:(e,t,i)=>{"use strict";i.d(t,{DataWindowItem:()=>s,DataWindowView:()=>r});class s{constructor(e,t,i,s=!1){this._visible=!0,this._id=e,this._title=t, this._value=i,this._unimportant=s}id(){return this._id}title(){return this._title}setTitle(e){this._title=e}text(){return this._value}value(){return this._value}setValue(e){this._value=e}visible(){return this._visible}setVisible(e){this._visible=e}color(){return this._color}setColor(e){this._color=e}unimportant(){return this._unimportant}}class r{constructor(){this._items=[],this._header="",this._title=""}header(){return this._header}title(){return this._title}items(){return this._items}update(){}}},853965:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DefaultProperty:()=>_,createDefaultsState:()=>h,saveDefaultProperties:()=>c});var s=i(822914),r=i(852290),n=i(702040),o=i(42292),a=i(190973),l=i(707957);function d(e,t){const i=(0,s.default)(e);return t.forEach((e=>(0,n.default)(i,e.split(".")))),i}function h(e,t,i,n){const a=e?o.defaults:o.factoryDefaults,l=t.startsWith("study_")?(0,s.default)(a("study")):{};let h=(0,s.default)(a(t,n));return t.startsWith("study_")&&h.inputs&&delete h.inputs.symbol,"linetoolicon"===t&&e&&(h.icon=(0,o.defaults)(t).icon),"linetooemoji"===t&&e&&(h.emoji=(0,o.defaults)(t).emoji),"linetoolsticker"===t&&e&&(h.sticker=(0,o.defaults)(t).sticker),h=d(h,i),(0,r.default)(l,h),l}let u=!1;function c(e){u=e}class _ extends a.default{constructor(e,t,i,s){super(function(e,t,i,s){let n;return void 0===s&&(s=!0),i?n=t:(n=h(s,e,[],null),t&&(0,r.default)(n,t)),n}(e,t,i,s)),this._exclusions=[],this._restoreFactoryDefaultsEvent=new l.Delegate,this._defaultName=e,this._useUserPreferences=null==s||s,this.listeners().subscribe(this,_.prototype.onPropertyChanged),this._restoreFactoryDefaultsEvent=new l.Delegate}applyTemplate(e,t){this.mergePreferences((0,r.default)((0,s.default)(t),e))}preferences(){return this.state(this._exclusions)}mergePreferences(e){this.mergeAndFire(d(e,this._exclusions))}addExclusion(e){this._exclusions.indexOf(e)<0&&this._exclusions.push(e)}removeExclusion(e){const t=this._exclusions.indexOf(e);-1!==t&&this._exclusions.splice(t,1)}restoreFactoryDefaults(){const e=h(!1,this._defaultName,this._exclusions,null);this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||(0,o.saveDefaults)(this._defaultName,void 0),this._restoreFactoryDefaultsEvent.fire()}onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}onPropertyChanged(e,t){this._exclusions.includes(t)||!u||this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this.saveDefaults()}saveDefaults(){this._useUserPreferences&&(0,o.saveDefaults)(this._defaultName,this.preferences())}clone(e){const t=new _(this._defaultName,this.state(),null==e?void 0:e.replaceByState,this._useUserPreferences);for(let e=0;e{"use strict";i.r(t),i.d(t,{SelectPointMode:()=>s,activePointSelectionMode:()=>$,barTimesUnderCursor:()=>Y,beenSetLineToolLastPoint:()=>L,cancelLineTool:()=>J,cancelledLineTool:()=>V,changeLineStyle:()=>de,changeLineTool:()=>ne,changedLineStyle:()=>z, changedLineTool:()=>O,continueLineTool:()=>Z,continuedLineTool:()=>A,copiedLineTool:()=>U,copyLineTool:()=>he,createLineTool:()=>X,createdLineTool:()=>D,crosshairLock:()=>S,cursorTool:()=>x,drawOnAllCharts:()=>we,drawOnAllChartsMode:()=>Ce,emojiTool:()=>C,finishChangingLineTool:()=>oe,finishLineTool:()=>le,finishMovingLineTool:()=>se,finishedChangingLineTool:()=>F,finishedLineTool:()=>W,finishedMovingLineTool:()=>N,hideAllDrawings:()=>ge,hideAllIndicators:()=>ye,hideMarksOnBars:()=>be,iconTool:()=>w,init:()=>fe,isDirectionalMovementActive:()=>M,isStudyEditingNow:()=>j,isToolCreatingNow:()=>P,isToolEditingNow:()=>T,isToolMovingNow:()=>R,lockDrawings:()=>Se,moveLineTool:()=>ie,movedLineTool:()=>B,properties:()=>ve,removeLineTool:()=>ae,removedLineTool:()=>H,resetToCursor:()=>p,restoreLineTool:()=>ue,restoreLineToolState:()=>ce,restoredLineTool:()=>G,restoredLineToolState:()=>q,runOnDrawingStateReady:()=>me,setLineToolLastPoint:()=>ee,startChangingLineTool:()=>re,startMovingLineTool:()=>te,startedChangingLineTool:()=>E,startedMovingLineTool:()=>k,stickerTool:()=>I,tool:()=>b,toolIsCursor:()=>c,toolIsMeasure:()=>_});var s,r=i(650151),n=i(152633),o=i(853965),a=i(401580),l=i(938550),d=i(707957),h=i(62802),u=i(251954);function c(e){return"cursor"===e||"arrow"===e||"dot"===e||"performance"===e}function _(e){return"measure"===e}function p(e=!1){if(!e&&f){if(f.childs().stayInDrawingMode.value())return}b.setValue(x.value())}!function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(s||(s={}));let f=null,m=null,v=null,g=null,y=null;const S=new l.WatchedObject(null),b=new a.WatchedValue,w=new a.WatchedValue,C=new a.WatchedValue,I=new a.WatchedValue,x=new a.WatchedValue,P=new a.WatchedValue(!1),T=new a.WatchedValue(!1),R=new a.WatchedValue(!1),M=new a.WatchedValue(!1),D=new d.Delegate,A=new d.Delegate,V=new d.Delegate,L=new d.Delegate,k=new d.Delegate,B=new d.Delegate,N=new d.Delegate,E=new d.Delegate,O=new d.Delegate,F=new d.Delegate,H=new d.Delegate,W=new d.Delegate,z=new d.Delegate,U=new d.Delegate,G=new d.Delegate,q=new d.Delegate,$=new a.WatchedValue(s.None),j=new a.WatchedValue(!1),Y=new Map;function K(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const Q={value:!1},X=K(D,Q),Z=K(A,Q),J=K(V,Q),ee=K(L,Q),te=K(k),ie=K(B),se=K(N),re=K(E),ne=K(O),oe=K(F),ae=K(H),le=K(W),de=K(z,Q),he=K(U,Q),ue=K(G),ce=K(q);let _e=!1,pe=[];function fe(){_e||(b.setValue(h.getValue("chart.cursorPreference","cursor")),b.subscribe((e=>c(e)&&x.setValue(e)),{callWithLast:!0}),x.subscribe((e=>{e&&"performance"!==e&&h.setValue("chart.cursorPreference",e)})),f=new o.DefaultProperty("drawings"),m=(0,n.createPrimitiveProperty)(),v=(0,n.createPrimitiveProperty)(),g=(0,n.createPrimitiveProperty)(),y=(0,n.createPrimitiveProperty)(),m.setValue(!1),v.setValue(!1),g.setValue(!1),y.setValue(!1),b.subscribe((e=>{(0,u.emit)("onSelectedLineToolChanged")})),_e=!0,pe.forEach((e=>e())),pe=[])}function me(e){_e?e():pe.push(e)}function ve(){return(0,r.ensureNotNull)(f)}function ge(){return(0,r.ensureNotNull)(m)} function ye(){return(0,r.ensureNotNull)(v)}function Se(){return(0,r.ensureNotNull)(g)}function be(){return(0,r.ensureNotNull)(y)}function we(){return ve().childs().drawOnAllCharts}function Ce(){return ve().childs().drawOnAllChartsMode}},551775:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},958067:(e,t,i)=>{"use strict";i.d(t,{availableDateFormats:()=>v,dateFormatFunctions:()=>f,defaultDateFormat:()=>g,getDateFormatWithWeekday:()=>m});var s=i(444372),r=i(39654),n=i(702053);const o={1:()=>s.t(null,void 0,i(795425)),2:()=>s.t(null,void 0,i(835050)),3:()=>s.t(null,void 0,i(651369)),4:()=>s.t(null,void 0,i(442762)),5:()=>s.t(null,{context:"short"},i(227991)),6:()=>s.t(null,void 0,i(715224)),7:()=>s.t(null,void 0,i(6215)),8:()=>s.t(null,void 0,i(38465)),9:()=>s.t(null,void 0,i(757902)),10:()=>s.t(null,void 0,i(73546)),11:()=>s.t(null,void 0,i(671230)),12:()=>s.t(null,void 0,i(92203))},a=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,l=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),d=e=>e.toLocaleDateString(window.language?(0,r.getIsoLanguageCodeFromLanguage)(window.language):void 0,{weekday:"short",timeZone:"UTC"}),h=(e,t)=>(0,n.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),u=(e,t)=>o[a(e,t)](),c=(e,t)=>(0,n.numberToStringWithLeadingZero)(a(e,t),2),_=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t)%100,2),p=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t),4),f={"dd MMM 'yy":(e,t)=>`${h(e,t)} ${u(e,t)} '${_(e,t)}`,"MMM 'yy":(e,t)=>`${u(e,t)} '${_(e,t)}`,"MMM dd, yyyy":(e,t)=>`${u(e,t)} ${h(e,t)}, ${p(e,t)}`,"MMM yyyy":(e,t)=>`${u(e,t)} ${p(e,t)}`,"MMM dd":(e,t)=>`${u(e,t)} ${h(e,t)}`,"dd MMM":(e,t)=>`${h(e,t)} ${u(e,t)}`,"yyyy-MM-dd":(e,t)=>`${p(e,t)}-${c(e,t)}-${h(e,t)}`,"yy-MM-dd":(e,t)=>`${_(e,t)}-${c(e,t)}-${h(e,t)}`,"yy/MM/dd":(e,t)=>`${_(e,t)}/${c(e,t)}/${h(e,t)}`,"yyyy/MM/dd":(e,t)=>`${p(e,t)}/${c(e,t)}/${h(e,t)}`,"dd-MM-yyyy":(e,t)=>`${h(e,t)}-${c(e,t)}-${p(e,t)}`,"dd-MM-yy":(e,t)=>`${h(e,t)}-${c(e,t)}-${_(e,t)}`,"dd/MM/yy":(e,t)=>`${h(e,t)}/${c(e,t)}/${_(e,t)}`,"dd/MM/yyyy":(e,t)=>`${h(e,t)}/${c(e,t)}/${p(e,t)}`,"MM/dd/yy":(e,t)=>`${c(e,t)}/${h(e,t)}/${_(e,t)}`,"MM/dd/yyyy":(e,t)=>`${c(e,t)}/${h(e,t)}/${p(e,t)}`};function m(e){return"ja"===window.language?(t,i)=>`${f[e](t,i)} (${d(t)})`:(t,i)=>`${d(t)} ${f[e](t,i)}`}const v=Object.keys(f),g=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},682103:(e,t,i)=>{"use strict";function s(e,t){const i=Math.floor(t/1e4)%1e4,s=Math.floor(t/100)%100-1,r=t%100;return e.format(new Date(Date.UTC(i,s,r)))}i.d(t,{formatYYYYMMDD:()=>s})},531094:(e,t,i)=>{"use strict";i.d(t,{getVolumeUnit:()=>r});var s=i(444372);function r(e){switch(e.volume_type){case"base":return e.base_currency;case"quote":return e.currency;case"tick":return s.t(null,void 0,i(130973))}}},995874:(e,t,i)=>{"use strict";function s(e,t){const i=Math.abs(Math.round(1e3*e)/1e3).toFixed(3).split("."),s=i[0];let r=i[1] ;return t||"0"!==r[r.length-1]||(r=r.slice(0,-1)),`${e<0?"−":""}${s}.${r}`}i.d(t,{roundToThirdDigit:()=>s})},570226:(e,t,i)=>{"use strict";i.d(t,{getPriceValueFormatterForSource:()=>l,getPriceValueFormatterForStudy:()=>d,shouldBeFormattedAsIndexedTo100:()=>o,shouldBeFormattedAsPercent:()=>n});var s=i(444331),r=i(981107);function n(e){const t=e.priceScale();return!(null===t||!t.isPercentage())&&(!(0,r.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function o(e){const t=e.priceScale();return!(null===t||!t.isIndexedTo100())&&(!(0,r.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function a(e){const t=e.priceScale();return o(e)&&null!==t?i=>{var s;return t.formatPriceIndexedTo100(i,null!==(s=e.firstValue())&&void 0!==s?s:100)}:n(e)&&null!==t?i=>{var s;return t.formatPricePercentage(i,null!==(s=e.firstValue())&&void 0!==s?s:100)}:null}function l(e){const t=a(e);if(t)return t;const i=e.formatter();return i.format.bind(i)}function d(e,t){const i=a(e);if(i)return i;const s=e.plotFormatter(t);return s.format.bind(s)}},315801:(e,t,i)=>{"use strict";function s(e,t,i){if(e.isTouch){if(void 0!==i)return i(e),!0}else if(void 0!==t)return t(e),!0;return!1}function r(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}var n,o;function a(e,t){return e&&t&&e.equals&&t.equals?e.equals(t):e===t}i.d(t,{AreaName:()=>n,HitTarget:()=>o,HitTestResult:()=>l,hitTestResultDataAreEqual:()=>a,shouldDefaultActionBeExecuted:()=>r,tryCallHandler:()=>s}),function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove"}(n||(n={})),function(e){e[e.MovePointBackground=1]="MovePointBackground",e[e.Regular=2]="Regular",e[e.MovePoint=3]="MovePoint",e[e.ChangePoint=4]="ChangePoint",e[e.Custom=5]="Custom"}(o||(o={}));class l{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}hasPressedMoveHandler(e){return null!==this._data&&function(e,t,i){if(e.isTouch){if(void 0!==i)return!0}else if(void 0!==t)return!0;return!1}(e,this._data.pressedMouseMoveHandler,this._data.touchMoveHandler)}tryCallMouseDownOrTouchStartHandler(e){return null!==this._data&&s(e,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e){return null!==this._data&&s(e,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e){return null!==this._data&&s(e,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e){return null!==this._data&&s(e,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e){return null!==this._data&&s(e,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e){return null!==this._data&&s(e,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e){return null!==this._data&&s(e,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e){ return null!==this._data&&s(e,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},955831:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(9524),r=i(458963);class n{constructor(){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",linewidth:1,linestyle:r.LINESTYLE_SOLID,visible:!1},this._lineRenderer=new s.HorizontalLineRenderer,this._invalidated=!0,this._lineRenderer.setData(this._lineRendererData)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._lineRenderer}}},982217:(e,t,i)=>{"use strict";var s;i.d(t,{TitleDisplayTarget:()=>s}),function(e){e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine"}(s||(s={}))},808068:(e,t,i)=>{"use strict";i.d(t,{intervalsVisibilitiesDefaults:()=>s});const s={ticks:!0,seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1,minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,weeksFrom:1,weeksTo:52,months:!0,monthsFrom:1,monthsTo:12,ranges:!0}},312449:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>n});var s=i(190973),r=i(395098);class n extends s.default{state(e){var t;return null!==(t=(0,r.nonDefaultIntervalsVisibilities)(super.state(e)))&&void 0!==t?t:void 0}storeStateIfUndefined(){return!1}}},395098:(e,t,i)=>{"use strict";i.d(t,{getIntervalsVisibilitiesForMode:()=>_,isActualInterval:()=>h,makeIntervalsVisibilitiesVisibleAtInterval:()=>l,mergeIntervalVisibilitiesDefaults:()=>c,nonDefaultIntervalsVisibilities:()=>u});var s=i(852290),r=i(822914),n=i(650151),o=i(223699),a=i(808068);function l(e,t){let i=t.multiplier();if(t.isTicks()&&(e.ticks=!0),t.isSeconds()&&(i<60?(e.seconds=!0,e.secondsFrom=Math.min(e.secondsFrom,i),e.secondsTo=Math.max(e.secondsTo,i)):(i=Math.floor(i/60),t=new o.Interval(o.ResolutionKind.Minutes,i))),t.isMinutes())if(i<60)e.minutes=!0,e.minutesFrom=Math.min(e.minutesFrom,i),e.minutesTo=Math.max(e.minutesTo,i);else{const t=Math.floor(i/60);e.hours=!0,e.hoursFrom=Math.min(e.hoursFrom,t),e.hoursTo=Math.max(e.hoursTo,t)}t.isDays()&&(e.days=!0,e.daysFrom=Math.min(e.daysFrom,i),e.daysTo=Math.max(e.daysTo,i)),t.isWeeks()&&(e.weeks=!0,e.weeksFrom=Math.min(e.weeksFrom,i),e.weeksTo=Math.max(e.weeksTo,i)),t.isMonths()&&(e.months=!0,e.monthsFrom=Math.min(e.monthsFrom,i),e.monthsTo=Math.max(e.monthsTo,i)),t.isRange()&&(e.ranges=!0)}function d(e,t,i,s){return e&&s>=t&&s<=i}function h(e,t){const i=t.childs();switch(e.kind()){case o.ResolutionKind.Ticks:return i.ticks.value();case o.ResolutionKind.Seconds:if(e.multiplier()<60)return d(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return d(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case o.ResolutionKind.Minutes:if(e.multiplier()<60)return d(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return d(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)} case o.ResolutionKind.Days:return d(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case o.ResolutionKind.Weeks:return d(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case o.ResolutionKind.Months:return d(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case o.ResolutionKind.Range:return i.ranges.value()}return(0,n.assert)(!1,`Unsupported resolution: ${e.value()}`),!1}function u(e){const t=Object.keys(e).filter((t=>a.intervalsVisibilitiesDefaults[t]!==e[t]));return 0===t.length?null:t.reduce(((t,i)=>(t[i]=e[i],t)),{})}function c(e){return(0,s.default)((0,r.default)(a.intervalsVisibilitiesDefaults),null!=e?e:{})}function _(e,t){if(0===t||e.isTicks()&&3===t||e.isRange()&&2===t)return c();let i=!1;const s={ticks:!1,seconds:!1,minutes:!1,hours:!1,days:!1,weeks:!1,months:!1,ranges:!1},r=e=>e.multiplier();return[{checker:e=>e.isTicks(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.ticks=!0}},{checker:e=>e.isSeconds()&&e.multiplier()<60,getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.seconds=!0,s.secondsFrom=e,s.secondsTo=t}},{checker:e=>e.isSeconds()&&e.multiplier()>=60,getIntervalMultiplier:e=>Math.floor(e.multiplier()/60),markIntervalAsVisible:(e,t)=>{s.minutes=!0,s.minutesFrom=e,s.minutesTo=t}},{checker:e=>e.isMinutes()&&e.multiplier()<60,getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.minutes=!0,s.minutesFrom=e,s.minutesTo=t}},{checker:e=>e.isMinutes()&&e.multiplier()>=60,getIntervalMultiplier:e=>Math.floor(e.multiplier()/60),markIntervalAsVisible:(e,t)=>{s.hours=!0,s.hoursFrom=e,s.hoursTo=t}},{checker:e=>e.isDays(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.days=!0,s.daysFrom=e,s.daysTo=t}},{checker:e=>e.isWeeks(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.weeks=!0,s.weeksFrom=e,s.weeksTo=t}},{checker:e=>e.isMonths(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.months=!0,s.monthsFrom=e,s.monthsTo=t}},{checker:e=>e.isRange(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.ranges=!0}}].forEach((s=>{if(s.checker(e)){i=!0;const r=s.getIntervalMultiplier(e);1===t?s.markIntervalAsVisible(r,r):3===t?s.markIntervalAsVisible(r,void 0):s.markIntervalAsVisible(void 0,r)}else(!i&&2===t||i&&3===t)&&s.markIntervalAsVisible(void 0,void 0)})),c(s)}},981107:(e,t,i)=>{"use strict";function s(e){const t=(null==e?void 0:e.symbolSource)&&e.symbolSource()===e,i=void 0!==(null==e?void 0:e.isActingAsSymbolSource);return t||i}function r(e){return s(e)&&"quotesProvider"in e}function n(e){return s(e)&&e.isActingAsSymbolSource().value()}i.d(t,{isActingAsSymbolSource:()=>n,isSymbolSource:()=>s,isSymbolSourceWithQuotesProvider:()=>r})},334652:(e,t,i)=>{"use strict";i.d(t,{alwaysShowLastPriceAndLastDayChange:()=>s,lastDayChangeAvailable:()=>r});i(244842);const s=!1,r=!0},941883:(e,t,i)=>{"use strict";i.d(t,{DateAndPriceBaseProperties:()=>_,allPropertiesStateKeysBase:()=>c,nonThemedFactoryDefaultsBase:()=>h,themedFactoryDefaultsBase:()=>u});var s=i(790188),r=i(61499),n=i(246733),o=i(808068),a=i(190973),l=i(404720) ;const d=(0,s.getHexColorByName)("color-tv-blue-500"),h={linewidth:2,fontsize:12,fillLabelBackground:!0,fillBackground:!0,backgroundTransparency:60,intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},customText:{visible:!1,fontsize:12,bold:!1,italic:!1}},u=new Map([[r.StdTheme.Light,{textcolor:(0,s.getHexColorByName)("color-black"),labelBackgroundColor:(0,s.getHexColorByName)("color-white"),linecolor:d,backgroundColor:(0,n.generateColor)(d,85),shadow:"rgba(0, 0, 0, 0.2)",customText:{color:d}}],[r.StdTheme.Dark,{textcolor:(0,s.getHexColorByName)("color-white"),labelBackgroundColor:(0,s.getHexColorByName)("color-cold-gray-800"),linecolor:d,backgroundColor:(0,n.generateColor)(d,85),shadow:"rgba(0, 0, 0, 0.4)",customText:{color:d}}]]),c=["customText.text"];class _ extends l.LineDataSourceThemedProperty{constructor({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,...i}){var s,r,n,o;super({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,templateKeys:[...e,...t,...c],...i}),this._textProperty=new a.default(null!==(n=null===(r=null===(s=i.state)||void 0===s?void 0:s.customText)||void 0===r?void 0:r.text)&&void 0!==n?n:""),null===(o=this.childs().customText)||void 0===o||o.addChild("text",this._textProperty)}template(){const e=super.template();return e.customText.text=this._textProperty.value(),e}}},953639:(e,t,i)=>{"use strict";i.d(t,{createIdeaLineToolByUrl:()=>_,isIdeaAuthorProfileImageUrl:()=>u,isIdeaUrl:()=>h});var s=i(650151),r=i(62802),n=i(66974),o=i(541558),a=i(461794),l=i(627817);const d=/^\/chart\/.+?\/([0-9a-zA-Z]{8})(-[-\w]+)?\/?$/;function h(e){try{const t=new URL(e);return((e=>"https:"===e.protocol&&e.hostname.endsWith(".tradingview.com"))(t)||(e=>!(0,n.isProd)()&&e.hostname.endsWith(window.location.hostname))(t))&&d.test(t.pathname)}catch(e){return!1}}function u(e){if(e.startsWith("data:image/svg+xml,"))return!0;try{const t=new URL(e),i=new URL(window.AWS_S3_CDN);return t.protocol===i.protocol&&t.hostname===i.hostname&&t.pathname.includes("/userpics/")}catch(e){return!1}}async function c(e){const t=new URL(`/api/v1/ideas/${i=e,(0,s.ensureNotNull)(d.exec(new URL(i).pathname))[1]}/`,location.href);var i;return fetch(t.toString()).then((e=>{if(!e.ok)throw new Error(`Error processing idea: ${e.statusText}`);return e.json()}))}function _(e,t,i=!1){return c(e).then((e=>{const n=function(e,t){var i;const r=(0,s.ensureDefined)(e.user);let n;r.avatars&&u(r.avatars.small)&&(n=r.avatars.small.startsWith("data:image/svg+xml,")?r.avatars.small:`${r.avatars.small.replace(window.AWS_S3_CDN,"")}?resetCache=true`);const o={avatarUrl:n,badges:null===(i=r.badges)||void 0===i?void 0:i.map((e=>e.name)),username:r.username};return{createdAt:e.created_timestamp,direction:e.direction,name:(0,a.clean)(e.name,!0),author:o,uuid:e.uuid}}(e),d={price:0,time_t:n.createdAt,offset:0},h=t.mainSeries(),c=(0,s.ensureNotNull)(t.model().paneForSource(h)),_=c.newLineToolZOrder(!0),p={type:"drawing",source:{id:(0,o.randomHashN)(6),zorder:_,type:"LineToolIdea",position:50,state:{interval:"1",...l.LineToolIdea.createProperties().state()},ideaData:n, symbol:h.symbol(),ownerSource:h.id(),points:[d]},geometry:[],modelId:t.model().id()},f=t.pasteLineTool(c,p,!0,!0);return i&&r.setValue("hint.pasteIdea",!0,{forceFlush:!0}),f.pointAdded().subscribe(null,(()=>t.scrollToLineTool(f)),!0),f}))}},396949:(e,t,i)=>{"use strict";i.d(t,{watchingDrawingStateForAddIdeaLineTool:()=>y});var s=i(444372),r=i(62802),n=i(345848),o=i(201089),a=i(167222),l=i(846778),d=i(270294),h=i(885482),u=i(543373),c=i(953639);const _=(0,o.getLogger)("Chart.IdeaDialog"),p=s.t(null,void 0,i(241246)),f=s.t(null,void 0,i(467466));let m=null;function v(e){"LineToolIdea"===e?(window.is_authenticated||(0,h.resetToCursor)(!0),(0,a.runOrSigninWithFeature)((()=>{h.tool.setValue("LineToolIdea"),m=(0,u.showCustomUrlEventDialog)({onConfirm:g,onClose:()=>{m=null,"LineToolIdea"===h.tool.value()&&(0,h.resetToCursor)(!0)},title:p,placeholderText:f}),(0,n.trackEvent)("Idea","Open idea dialog")}),{feature:"drawings",source:"Change drawing tool state"})):null!==m&&m.then((e=>e()))}function g(e){const t=(0,d.chartWidgetCollectionService)();if(null===t)return;if(!(0,c.isIdeaUrl)(e))return void _.logWarn(`Invalid idea url: ${e}`);const i=!Boolean(r.getBool("hint.pasteIdea")),s=t.activeChartWidget.value();(0,c.createIdeaLineToolByUrl)(e,s.model()).then((()=>{i&&(0,l.showPasteLineToolHint)(t.getContainer(),"hint.pasteIdea")}))}function y(){(0,h.runOnDrawingStateReady)((()=>{h.tool.subscribe(v)}))}},923237:(e,t,i)=>{"use strict";i.d(t,{commonLineToolPropertiesStateKeys:()=>s});const s=["symbolStateVersion","zOrderVersion","frozen","title","symbolInfo","interval","symbol","currencyId","unitId","visible"]},859353:(e,t,i)=>{"use strict";i.d(t,{watchingDrawingStateForAddImageLineTool:()=>p});var s=i(650151),r=i(62802),n=i(345848),o=i(167222),a=i(846778),l=i(270294),d=i(885482);async function h(e,t){return async function(e){return(await Promise.all([i.e(62253),i.e(22666),i.e(92108),i.e(92191),i.e(32109),i.e(9817),i.e(38669),i.e(76592),i.e(5145),i.e(25190),i.e(24215),i.e(22333),i.e(14127),i.e(95569),i.e(50690),i.e(14473),i.e(62526),i.e(77038)]).then(i.bind(i,595470))).renderImageDialog(e)}({onConfirm:e,onClose:t})}let u=null;function c(e){if("LineToolImage"!==e)return null==u||u.then((e=>e())),void(u=null);window.is_authenticated||(0,d.resetToCursor)(!0),(0,o.runOrSigninWithFeature)((()=>{d.tool.setValue("LineToolImage"),u=h(_,(()=>{null==u||u.then((e=>e())),u=null,"LineToolImage"===d.tool.value()&&(0,d.resetToCursor)(!0)})),(0,n.trackEvent)("Image","Open image dialog")}),{feature:"drawings",source:"Change drawing tool state"})}function _(e){const t=(0,l.chartWidgetCollectionService)();if(null===t)return;const i=!Boolean(r.getBool("hint.pasteImage")),n=t.activeChartWidget.value();n.model().pasteImageAsLineTool(e.url,e.blobUrl,(0,s.ensureNotNull)(n.model().model().paneForSource(n.model().mainSeries())),e.transparency),i&&(0,a.showPasteLineToolHint)(t.getContainer(),"hint.pasteImage")}function p(){(0,d.runOnDrawingStateReady)((()=>{d.tool.subscribe(c)}))}},653657:(e,t,i)=>{"use strict";function s(e){return"setSelectionRange"in e} i.d(t,{isInplaceTextLineSourcePaneView:()=>s})},253972:(e,t,i)=>{"use strict";i.d(t,{drawSelection:()=>n,getSymbolCoordinatesInfo:()=>r});var s=i(199471);function r(e,t,i,r,n){let o=0,a=0,d=0,h=0;for(let u=0;u{"use strict";var s;i.d(t,{isImageToolName:()=>u,isLineDrawnWithPressedButton:()=>l,isLineToolDrawWithoutPoints:()=>h,isLineToolFinishRequiredWhenCreatedByApi:()=>d,isLineToolName:()=>a,isStudyLineToolName:()=>o,isTextToolName:()=>c});var r=i(968361);const n=new Set(["LineStudyMtpAnalysis","LineStudyMtpDecisionPoint","LineStudyMtpRiskReward","LineStudyMtpElliotWaveMain","LineStudyMtpElliotWaveMajor","LineStudyMtpElliotWaveMinor","LineStudyMtpDownWave1OrA","LineStudyMtpDownWave2OrB","LineStudyMtpDownWave3","LineStudyMtpDownWave4","LineStudyMtpDownWave5","LineStudyMtpDownWaveC","LineStudyMtpUpWave1OrA","LineStudyMtpUpWave2OrB","LineStudyMtpUpWave3","LineStudyMtpUpWave4","LineStudyMtpUpWave5","LineStudyMtpUpWaveC"]);function o(e){let t="LineToolRegressionTrend"===e||"LineToolVbPFixed"===e||"LineToolFixedRangeVolumeProfile"===e||"LineToolAnchoredVolumeProfile"===e||"LineToolAnchoredVWAP"===e;return t||(t=function(e){return n.has(e)}(e)),t}function a(e){return e in(s||(s=i.t(r,2)))||o(e)}function l(e){return"LineToolBrush"===e||"LineToolHighlighter"===e}function d(e){return l(e)||"LineToolPath"===e||"LineToolPolyline"===e||"LineToolGhostFeed"===e}function h(e){return"LineToolTweet"===e||"LineToolIdea"===e||"LineToolImage"===e}function u(e){return"LineToolImage"===e}function c(e){switch(e){case"LineToolBalloon":case"LineToolComment":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":case"LineToolSignpost":return!0}return!1}},68626:(e,t,i)=>{"use strict";i.d(t,{LineDataSourcePointIndexProperty:()=>r});var s=i(190973);class r extends s.default{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){return this._lineSource.points()[this._pointIndex].index}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.index=e, this._lineSource.startChanging(this._pointIndex,t),this._setPointImpl(t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,"");const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)}_setPointImpl(e){this._lineSource.setPoint(this._pointIndex,e)}}},517067:(e,t,i)=>{"use strict";i.d(t,{LineDataSourcePointPriceProperty:()=>n});var s=i(650151),r=i(190973);class n extends r.default{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t,e.pointAdded().subscribe(this,(e=>{this._pointIndex===e&&this._listeners.fire(this,`${e}`)})),e.pointChanged().subscribe(this,(e=>{this._pointIndex===e&&this._listeners.fire(this,`${e}`)}))}value(){const e=this._lineSource.points()[this._pointIndex].price,t=(0,s.ensureNotNull)(this._lineSource.ownerSource()).formatter();if(t.parse){const i=t.format(e),s=t.parse(i);return s.res?s.value:e}return e}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(""+e),this._lineSource.startChanging(this._pointIndex,t),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,"");const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)}}},670023:(e,t,i)=>{"use strict";i.d(t,{PositionAveragePriceAxisView:()=>r});var s=i(837202);class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},917004:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{AlertStatus:()=>s,Direction:()=>r}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(s||(s={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(r||(r={}))},713599:(e,t,i)=>{"use strict";i.d(t,{SignpostPointIndexProperty:()=>r});var s=i(68626);class r extends s.LineDataSourcePointIndexProperty{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}},585130:(e,t,i)=>{"use strict";i.d(t,{SignpostPointPriceProperty:()=>r});var s=i(190973);class r extends s.default{constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,(()=>this.listeners().fire(this,""))),e.pointChanged().subscribe(this,(()=>this.listeners().fire(this,"")))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),this.listeners().fire(this,""),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1})}}},477227:(e,t,i)=>{"use strict";const s=i(821979).LineDataSource,r=i(593804).alignToStep;class n extends s{constructor(e,t){super(e,t),this.customization.forcePriceAxisLabel=!0,this.customization.disableErasing=!0,this.customization.showInObjectsTree=!1,this.setSelectionEnabled(!1)}isSynchronizable(){return!1}pointsCount(){return n.POINTS_COUNT}hasContextMenu(){return!1}state(){return null}startMoving(){super.startMoving.apply(this,arguments),this._cursorMoved=!1}endMoving(){ super.endMoving.apply(this,arguments),this._cursorMoved=!1}_correctPoints(e,t){this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price&&(this._cursorMoved=!0):this._cursorMoved=!1;for(var i=1/this.priceScale().mainSource().base(),s=0;s{"use strict";i.d(t,{watchingDrawingStateForAddTweetLineTool:()=>y});var s=i(444372),r=i(62802),n=i(345848),o=i(201089),a=i(167222),l=i(846778),d=i(270294),h=i(885482),u=i(543373),c=i(972375);const _=(0,o.getLogger)("Chart.TweetDialog"),p=s.t(null,void 0,i(100970)),f=s.t(null,void 0,i(735415));let m=null;function v(e){"LineToolTweet"===e?(window.is_authenticated||(0,h.resetToCursor)(!0),(0,a.runOrSigninWithFeature)((()=>{h.tool.setValue("LineToolTweet"),m=(0,u.showCustomUrlEventDialog)({onConfirm:g,onClose:()=>{m=null,"LineToolTweet"===h.tool.value()&&(0,h.resetToCursor)(!0)},title:p,placeholderText:f}),(0,n.trackEvent)("Tweet","Open tweet dialog")}),{feature:"drawings",source:"Change drawing tool state"})):null!==m&&m.then((e=>e()))}function g(e){const t=(0,d.chartWidgetCollectionService)();if(null===t)return;if(!(0,c.isTwitterUrl)(e))return void _.logWarn(`Invalid tweet url: ${e}`);const i=!Boolean(r.getBool("hint.pasteTweet")),s=t.activeChartWidget.value();(0,c.createTweetLineToolByUrl)(e,s.model()).then((()=>{i&&(0,l.showPasteLineToolHint)(t.getContainer(),"hint.pasteTweet")}))}function y(){(0,h.runOnDrawingStateReady)((()=>{h.tool.subscribe(v)}))}},986837:(e,t,i)=>{"use strict";i.d(t,{LollipopPaneView:()=>c});var s=i(327714),r=i(650151),n=i(86441),o=i(389137),a=i(142119),l=i(294162),d=i(758363),h=i(382778),u=i(315801);class c{constructor(e,t,i){this._invalidated=!1,this._renderer=new a.CompositeRenderer,this._textWidthCache=new l.TextWidthCache,this._stylesCache=null,this._lollipops={},this._lollipopsCounter=0,this._lastClickedId=null,this.onPaneBgChange=()=>{this._recreateStyles(this._model)},this._lastClickedId=null,this._model=e,this._source=t,this._clickHandler=i,this._recreateStyles(e),e.backgroundColor().subscribe(this.onPaneBgChange),e.mainSeries().onSymbolIntervalChanged().subscribe(this,this._onSymbolOrIntervalChanged)}destroy(){this._model.backgroundColor().unsubscribe(this.onPaneBgChange),this._model.mainSeries().onSymbolIntervalChanged().unsubscribeAll(this)}processClickOutside(e){var t;if(null===this._lastClickedId||!e)return void this.clearLastClicked();let i=null;if(function(e){return void 0!==e.touches}(e)){if(1!==e.touches.length)return;{const t=(0,r.ensureNotNull)(e.target).getBoundingClientRect(),s=e.touches[0] ;i=new n.Point(s.clientX-t.left,s.clientY-t.top)}}else i=new n.Point(e.offsetX,e.offsetY);const s=this._renderer.hitTest(i,{physicalHeight:0,physicalWidth:0,pixelRatio:1,cssHeight:0,cssWidth:0});null!==s&&(null===(t=s.data())||void 0===t?void 0:t.activeItem)===(0,r.ensureDefined)(this._lollipops[this._lastClickedId]).itemIndex||this.clearLastClicked()}clearLastClicked(){const e=null!==this._lastClickedId&&this._lollipops[this._lastClickedId]||null;null!==e&&(e.active=!1),this._lastClickedId=null}getLastClickedLollipopId(){return this._lastClickedId}update(){this._invalidated=!0}afterUpdate(e,t,i,s){}getStyle(e,t){let i=t;if(e.stack&&(i+="_stack:"+e.stack),"active"===i)return this._activeStyle;if("hovered"===i)return this._hoveredStyle;if("default"===i)return this._defaultStyle;if(this._stylesCache||(this._stylesCache={}),!this._stylesCache[i]){const s=(0,o.clone)("active"===t?this._activeStyle:"hovered"===t?this._hoveredStyle:this._defaultStyle);e.stack&&(s.lollipop.incHeight=25*e.stack),this._stylesCache[i]=s}return this._stylesCache[i]}hasTooltip(e){return!0}_getY(){let e=0;const t=this._model.panes();for(let i=t.length;i--;){const s=t[i];s.containsMainSeries()&&(e+=s.height())}return e}_showBarLine(e){return this.hasTooltip(e)&&(e.hovered||e.active)}_createRenderers(e){const{cssWidth:t,cssHeight:i}=e;this._renderer.clear();const o=(0,s.size)({width:t,height:i});for(const e in this._lollipops)if(this._lollipops.hasOwnProperty(e)){const t=(0,r.ensureDefined)(this._lollipops[e]);if(t.visible){const e=this._getLollipopStatus(t),i=this.getStyle(t,e),s={id:t.id,centerPoint:new n.Point(t.basePoint.x,t.basePoint.y-i.lollipop.bottom-i.lollipop.height/2-(i.lollipop.incHeight||0)),style:i,status:e},r={activeItem:t.itemIndex,hideCrosshairLinesOnHover:!0,clickHandler:this._lollipopMouseClickHandler.bind(this,s,o),tapHandler:this._lollipopMouseClickHandler.bind(this,s,o)};if(this._renderer.append(this._createRendererForLollipop(s,r)),this._showBarLine(t)){const{strokeStyle:e,lineStyle:s,lineWidth:r}=i.barLine,n={color:e,linestyle:s,linewidth:r,x:t.basePoint.x,top:0,bottom:t.basePoint.y-i.lollipop.bottom-i.lollipop.height},o=new d.VerticalLineRenderer;o.setData(n),this._renderer.insert(o,0)}}}}_recreateStyles(e){this._stylesCache=null}_createRendererForLollipop(e,t){return new h.LollipopRenderer(e,new u.HitTestResult(u.HitTarget.Custom,t),this._textWidthCache)}_onSymbolOrIntervalChanged(){this._lollipops={},this._lollipopsCounter=0,this._renderer.clear(),this.clearLastClicked()}_lollipopMouseClickHandler(e,t,i){i.preventDefault();const s=e.id;if(this._lastClickedId=this._lastClickedId===s?null:s,null===this._lastClickedId)return;const o={target:i.target,targetSize:t,point:new n.Point(e.centerPoint.x,e.centerPoint.y-e.style.lollipop.height/2-8),marginTop:15};this._clickHandler(o,(()=>{const e=(0,r.ensureDefined)(this._lollipops[s]);return this._createTooltipContent(e)}))}_getLollipopStatus(e){return e.active?"active":e.hovered?"hovered":"default"}}},964824:(e,t,i)=>{"use strict";i.r(t),i.d(t,{globalChangeEvent:()=>o, selectionChangeEvent:()=>h,sourceChangeEvent:()=>r,viewportChangeEvent:()=>l});var s=i(827147);function r(e){return(0,s.default)(e)?{type:"data-source-change",sourceId:e}:{type:"data-source-change",...e}}const n={type:"global-change"};function o(){return n}const a={type:"viewport-change"};function l(){return a}const d={type:"selection-change"};function h(){return d}},60897:(e,t,i)=>{"use strict";i.d(t,{notAvailable:()=>s});i(444372),i(244842);const s="∅"},742391:(e,t,i)=>{"use strict";i.d(t,{PanePriceAxisView:()=>n});var s=i(294162);class r{constructor(e){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._width=0,this._height=0,this._textWidthCache=e}setParams(e,t,i,s,r){this._priceAxisViewRenderer=e,this._rendererOptions=t,this._width=i,this._height=s,this._align=r}draw(e,t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(e,this._rendererOptions,this._textWidthCache,this._width,this._height,this._align,t.pixelRatio)}hitTest(e){var t,i;return void 0===(null===(t=this._priceAxisViewRenderer)||void 0===t?void 0:t.hitTest)?null:null===(i=this._priceAxisViewRenderer)||void 0===i?void 0:i.hitTest(e,this._width,this._align)}}class n{constructor(e,t,i){this._renderer=null,this._invalidated=!0,this._priceAxisView=e,this._textWidthCache=new s.TextWidthCache(100),this._dataSource=t,this._chartModel=i,this._fontSize=-1,this._panePriceAxisViewRenderer=new r(this._textWidthCache)}update(e){this._invalidated=!0}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_position(){const e=this._chartModel.crossHairSource(),t=this._dataSource===e?e.pane:this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=this._priceScale();if(null===i)return null;let s=t.priceScalePosition(i);return"overlay"===s&&(s=t.priceScalePosition(t.defaultPriceScale())),"overlay"===s?null:s}_updateImpl(e){this._renderer=null;const t=this._position();if(null===t)return;const i=this._chartModel.priceAxisRendererOptions();i.fontSize!==this._fontSize&&(this._fontSize=i.fontSize,this._textWidthCache.reset()),this._panePriceAxisViewRenderer.setParams(this._priceAxisView.paneRenderer(),i,e.cssWidth,e.cssHeight,t),this._renderer=this._panePriceAxisViewRenderer,this._invalidated=!1}_priceScale(){return this._dataSource.priceScale()}}},57372:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundItem:()=>l,AreaBackgroundItemsGroup:()=>o,AreaBackgroundRenderer:()=>d,CachedMap:()=>a});var s=i(650151),r=i(43192),n=i(632739);class o extends n.CachedContainer{constructor(e){super(),this.color=e}}class a{constructor(){this._map=new Map,this._usedKeys=new Set,this._invalidations=0}invalidateCache(){this._invalidations+=1,50===this._invalidations&&(this._deleteUnused(),this._invalidations=0),this._usedKeys.clear(),this._map.forEach(((e,t)=>e.invalidateCache()))}get(e){const t=this._map.get(e);return void 0!==t&&this._usedKeys.add(e),t}set(e,t){this._usedKeys.add(e),this._map.set(e,t)}[Symbol.iterator](){const e=Array.from(this._usedKeys)[Symbol.iterator]() ;return{[Symbol.iterator](){return this},next:()=>{const t=e.next();return t.value?{value:[t.value,(0,s.ensureDefined)(this._map.get(t.value))],done:!1}:{value:void 0,done:!0}}}}forEach(e){this._map.forEach(((t,i)=>{this._usedKeys.has(i)&&e(t,i)}))}delete(e){const t=this._map.get(e);void 0!==t&&t.invalidateCache(),this._usedKeys.delete(e)}_deleteUnused(){const e=[];this._map.forEach(((t,i)=>{this._usedKeys.has(i)||e.push(i)}));for(const t of e)this._map.delete(t)}}class l extends n.CachedContainer{constructor(){super(),this.points1=new n.CachedContainer,this.points2=new n.CachedContainer,this.push(this.points1),this.push(this.points2)}addPoints1Point(e,t){let i=this.points1.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points1.push(i)}addPoints2Point(e,t){let i=this.points2.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points2.push(i)}invalidateCache(){this.points1.invalidateCache(),this.points2.invalidateCache()}}class d extends r.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._data=null!=e?e:null}setData(e){this._data=e}hitTest(e,t){return null}_drawImpl(e){var t,i;if(null===this._data)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:n}=e,o=.25*this._data.barSpacing;for(const[,e]of this._data.colorAreas){s.beginPath();for(let t=0;t{"use strict";i.d(t,{PaneRendererArea:()=>o});var s=i(879617),r=i(9640),n=i(787123);class o extends s.PaneRendererLine{constructor(e){e.forceLineColor=!1,super(e)}_drawImpl(e){var t,i,o,a,l;const d=this._data;if(0===d.items.length)return;let h=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,u=(null!==(a=null===(o=this._data.visibleItemsRange)||void 0===o?void 0:o.endItemIndex)&&void 0!==a?a:this._data.items.length)-1;for(;h=0&&!(0,r.coordinateIsValid)(d.items[u].y);)u--;if(h>u)return;const{context:c,horizontalPixelRatio:_,verticalPixelRatio:p}=e;c.save(),c.scale(_,p),c.lineCap="round",c.strokeStyle=d.lineColor,c.lineWidth=d.lineWidth,(0,n.setLineStyle)(c,d.lineStyle),c.lineWidth=1 ;const f={},m=new s.PaneRendererLineItemsIterator(this._data.items,h,u+1,this._data.skipHoles);for(;m.next();){const e=m.currentValue();let t;t=(0,s.isValidPoint)(e)&&e.style?e.style.color:d.lineColor;const i=m.nextValue();if((0,s.isValidPoint)(i)&&(null==i?void 0:i.style)){const s=i.style.color;if(t!==s){const t=f[s]||[];t.push(e),f[s]=t}}const r=f[t]||[];r.push(e),f[t]=r}for(const e of Object.keys(f)){const t=f[e];c.beginPath();let i=0;for(let r=0;r{"use strict";i.d(t,{BitmapCoordinatesPaneRenderer:()=>r});var s=i(327714);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,(0,s.size)({width:t.cssWidth,height:t.cssHeight}),(0,s.size)({width:t.physicalWidth,height:t.physicalHeight})).useBitmapCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,(0,s.size)({width:t.cssWidth,height:t.cssHeight}),(0,s.size)({width:t.physicalWidth,height:t.physicalHeight})).useBitmapCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},142119:(e,t,i)=>{"use strict";i.d(t,{CompositeRenderer:()=>s});class s{constructor(){this._renderers=[],this._globalAlpha=1}setGlobalAlpha(e){this._globalAlpha=e}append(e){this._renderers.push(e)}insert(e,t){this._renderers.splice(t,0,e)}clear(){this._renderers.length=0}isEmpty(){return 0===this._renderers.length}draw(e,t){for(let i=0;i=0;s--){const r=this._renderers[s].hitTest(e,t);null!==r&&(null===i||r.target()>i.target())&&(i=r)}return i}doesIntersectWithBox(e){return this._renderers.some((t=>!!t.doesIntersectWithBox&&t.doesIntersectWithBox(e)))}}},787123:(e,t,i)=>{"use strict";i.r(t),i.d(t,{addHorizontalLineToPath:()=>h,addLineToPath:()=>I,addPixelPerfectLineToPath:()=>P,addVerticalLineToPath:()=>c,clearRectWithGradient:()=>l,clipPolygonByEdge:()=>R,computeDashPattern:()=>C,createCircle:()=>S,drawHorizontalLine:()=>u,drawLine:()=>x,drawPixelPerfectLine:()=>T,drawPoly:()=>b,drawRoundRect:()=>m,drawRoundRectWithInnerBorder:()=>v,drawVerticalLine:()=>_,fillRectInnerBorder:()=>d,fillRectWithBorder:()=>y,scaleDrawRoundRectRadii:()=>p,scaledDashPattern:()=>g,setLineStyle:()=>w});var s=i(86441),r=i(5531),n=i(458963),o=i(379048),a=i(199471) ;function l(e,t,i,s,r,n,o){e.save(),e.globalCompositeOperation="copy";const a=e.createLinearGradient(0,0,0,r);a.addColorStop(0,n),a.addColorStop(1,o),e.fillStyle=a,e.fillRect(t,i,s,r),e.restore()}function d(e,t,i,s,r,n){e.fillRect(t+n,i,s-2*n,n),e.fillRect(t+n,i+r-n,s-2*n,n),e.fillRect(t,i,n,r),e.fillRect(t+s-n,i,n,r)}function h(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(i,t+r),e.lineTo(s,t+r)}function u(e,t,i,s){e.beginPath(),h(e,t,i,s),e.stroke()}function c(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(t+r,i),e.lineTo(t+r,s)}function _(e,t,i,s){e.beginPath(),c(e,t,i,s),e.stroke()}function p(e,t){return Array.isArray(e)?e.map((e=>Math.round(e*t))):Math.round(e*t)}function f(e,t){return Array.isArray(e)?e.map((e=>0===e?e:e+t)):e+t}function m(e,t,i,s,r,n,o){let a,l,d,h;if(Array.isArray(n))if(2===n.length){const e=Math.max(0,n[0]),t=Math.max(0,n[1]);a=e,l=e,d=t,h=t}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");a=Math.max(0,n[0]),l=Math.max(0,n[1]),d=Math.max(0,n[2]),h=Math.max(0,n[3])}else{const e=Math.max(0,n);a=e,l=e,d=e,h=e}o||e.beginPath(),e.moveTo(t+a,i),e.lineTo(t+s-l,i),0!==l&&e.arcTo(t+s,i,t+s,i+l,l),e.lineTo(t+s,i+r-d),0!==d&&e.arcTo(t+s,i+r,t+s-d,i+r,d),e.lineTo(t+h,i+r),0!==h&&e.arcTo(t,i+r,t,i+r-h,h),e.lineTo(t,i+a),0!==a&&e.arcTo(t,i,t+a,i,a)}function v(e,t,i,s,r,n,a=0,l=0,d="",h=o.LineStyle.Solid){if(e.save(),!l||!d||d===n)return m(e,t,i,s,r,a),e.fillStyle=n,e.fill(),void e.restore();const u=l/2;if("transparent"!==n){const u="transparent"!==d&&h!==o.LineStyle.Solid;m(e,u?t:t+l,u?i:i+l,u?s:s-2*l,u?r:r-2*l,u?a:f(a,-l)),e.fillStyle=n,e.fill()}if("transparent"!==d){m(e,t+u,i+u,s-l,r-l,f(a,-u)),e.lineWidth=l,e.strokeStyle=d,w(e,h),e.closePath(),e.stroke()}e.restore()}function g(e,t){return t=Math.max(1,t),e.map((e=>e*t))}function y(e,t,i,s,r,o,l,d,h){const{context:c}=e,_=o%2/2,p=t+_,f=s+_;let m,v;if(d){const{borderMode:e,borderWidth:a,color:l,dashPattern:h,lineStyle:u}=d;switch(e){case"outer":{const e=-o/2-a/2,t=-a/2;v={left:p+e,right:f-e,top:i+t,bottom:r-t};break}case"center":{const e=a%2/2;v={left:t+e,right:s+e,top:i+e,bottom:r+e};break}case"inner":{const e=-o/2+a/2,t=a/2;v={left:p+e,right:f-e,top:i+t,bottom:r-t}}}c.strokeStyle=l,c.lineWidth=a;let _=-1;h?c.setLineDash(g(h,a)):void 0!==u&&(w(c,u),u===n.LINESTYLE_SOLID&&(_=1)),m={left:v.left+_*a/2,top:v.top+_*a/2,right:v.right-_*a/2,bottom:v.bottom-_*a/2}}if(l&&(c.fillStyle=l.color,m||(m={left:p-o/2,right:f+o/2,top:i,bottom:r}),c.fillRect(m.left,m.top,m.right-m.left,m.bottom-m.top)),h){const{lineWidth:n,lineColor:o,lineStyle:l,excludeBoundaries:d}=h;c.save(),c.lineCap="butt",c.lineWidth=n,c.strokeStyle=o,w(c,l);const _=()=>u(c,Math.floor((i+r)/2),t,s);d?(0,a.drawWithExclusionAreaByScope)(e,d,_):_(),c.restore()}v&&c.strokeRect(v.left,v.top,v.right-v.left,v.bottom-v.top)}function S(e,t,i,s){e.beginPath(),e.arc(t,i,s,0,2*Math.PI,!1),e.closePath()}function b(e,t,i){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const i of t)e.lineTo(i.x,i.y);e.closePath(),e.stroke(),i&&e.fill()}function w(e,t){let i=[] ;t!==n.LINESTYLE_SOLID&&(i=C(e.lineWidth,t)),e.setLineDash(i)}function C(e,t){return[[e,2*e],[5*e,6*e],[6*e,6*e],[e,4*e],[2*e,e]][t-1]}function I(e,t,i,s,r){e.moveTo(t,i),e.lineTo(s,r)}function x(e,t,i,s,r){isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)&&(e.beginPath(),I(e,t,i,s,r),e.stroke())}function P(e,t,i,s,r,n=1){t===s?c(e,Math.round(t*n),i*n,r*n):i===r?h(e,Math.round(i*n),t*n,s*n):I(e,t*n,i*n,s*n,r*n)}function T(e,t,i,s,r,n=1){e.beginPath(),P(e,t,i,s,r,n),e.stroke()}function R(e,t,i,n){const o=(0,s.equalPoints)(i,n[0])?(0,s.equalPoints)(i,n[1])?null:n[1]:n[0];return null!==e&&null!==o?(0,r.intersectPolygonAndHalfplane)(e,(0,s.halfplaneThroughPoint)((0,s.lineThroughPoints)(t,i),o)):null}},9524:(e,t,i)=>{"use strict";i.d(t,{HorizontalLineRenderer:()=>l});var s=i(315801),r=i(787123),n=i(9640),o=i(43192),a=i(199471);class l extends o.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._hitTest=new s.HitTestResult(s.HitTarget.Regular)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||!1===this._data.visible||null===this._hitTest)return null;const t=(0,n.interactionTolerance)().line,i=Math.abs(e.y-this._data.y)<=t+this._data.linewidth/2,s=void 0===this._data.left||this._data.left-e.x<=t,r=void 0===this._data.right||e.x-this._data.right<=t;return i&&s&&r?this._hitTest:null}_drawImpl(e){if(null===this._data||!1===this._data.visible)return;const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s,mediaSize:n}=e;if(this._data.y<-this._data.linewidth/2||this._data.y>n.height+this._data.linewidth/2)return;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(t,this._data.linestyle);const o=void 0!==this._data.left?Math.max(this._data.left,0):0,l=void 0!==this._data.right?Math.min(this._data.right,n.width):n.width,d=Math.round(this._data.y*s),h=Math.round(o*i),u=Math.round(l*i),c=this._data.excludeBoundaries;void 0!==c&&(0,a.addExclusionAreaByScope)(e,c),(0,r.drawHorizontalLine)(t,d,h,u)}}},20422:(e,t,i)=>{"use strict";function s(e,t){return e.pixelRatio===t.pixelRatio}i.d(t,{areEqualPaneRenderParams:()=>s})},879617:(e,t,i)=>{"use strict";i.d(t,{PaneRendererLine:()=>_,PaneRendererLineItemsIterator:()=>c,isValidPoint:()=>u});var s=i(650151),r=i(86441),n=i(204652),o=i(315801),a=i(9640),l=i(787123),d=i(43192);const h={y:NaN};function u(e){return null!==e&&!isNaN(e.y)}class c{constructor(e,t,i,r){this._calculatedPrev={index:null,currentBreakProcessed:!1,value:null},this._calculatedCurrent={index:null,currentBreakProcessed:!1,value:null},this._calculatedNext={index:null,currentBreakProcessed:!1,value:null},this._preallocatedVariable={index:null,currentBreakProcessed:!1,value:null},e.length&&((0,s.assert)(t<=i,"First index must be less or equal to last index"),(0,s.assert)(t2;){const t=Math.round((u+h)/2) ;this._data.items[t].center<=e.x?h=t:u=t}h=Math.max(1,h-1),u=Math.min(this._data.items.length-1,u+1);for(let t=h;t<=u;++t){const i=this._data.items[t-1],s=this._data.items[t],a=i.center,l=s.center;if((0,n.distanceToSegment)(new r.Point(a,i.y),new r.Point(l,s.y),new r.Point(e.x,e.y)).distance<=d)return this._data.hittest?this._data.hittest:new o.HitTestResult(o.HitTarget.Regular)}return null}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;t.scale(i,s),t.lineCap="round",t.lineJoin="round",t.strokeStyle=this._data.lineColor,t.fillStyle=this._data.lineColor,t.lineWidth=this._data.lineWidth,(0,l.setLineStyle)(t,this._data.lineStyle),(0,a.setValidLineStyle)(t,this._data.lineStyle),this._data.simpleMode?this._drawSimpleMode(t,i,s):this._drawLines(t)}_drawSimpleMode(e,t,i){var s,r,n,o;e.beginPath(),this._walkLine(e,this._data.items,!1,NaN),e.stroke();const a=this._data.lineWidth+2;if(this._data.withMarkers&&2*a=u;){const r=this._data.items[s];if(r){const s=Math.round(r.center*t)+l,n=r.y*i;e.moveTo(s,n),e.arc(s,n,d,0,h)}}e.fill()}}_walkLine(e,t,i,s,r){var n,o,a,l;if(!t)return;const d=.25*this._data.barSpacing;let h,_,p=null;const f=r?0:null!==(o=null===(n=this._data.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==o?o:0,m=r?t.length:Math.min(null!==(l=null===(a=this._data.visibleItemsRange)||void 0===a?void 0:a.endItemIndex)&&void 0!==l?l:t.length,t.length);if(f>m||f>=t.length)return;const v=new c(t,f,m,this._data.skipHoles);for(;v.next();){if(h=v.currentValue(),_=v.nextValue(),u(h)){const t=Math.round(h.center);p&&u(p)?(e.lineTo(t,h.y),i&&!u(_)&&e.lineTo(t,s)):_&&u(_)?i?(v.atStart()||e.lineTo(t,s),e.lineTo(t,h.y)):e.moveTo(t,h.y):i?(v.atStart()||e.lineTo(t-d,s),e.lineTo(t-d,h.y),e.lineTo(t+d,h.y),e.lineTo(t+d,s)):(e.moveTo(t-d,h.y),e.lineTo(t+d,h.y))}p=h}}_drawLines(e){var t,i,s,r;if(!this._data.items.length)return;let n,o,l=null;const d=.25*this._data.barSpacing;e.beginPath();const h=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,_=null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length;if(h>_||h>=this._data.items.length)return;const p=this._data.items[h];p&&e.moveTo(p.center,p.y);let f,m=e.strokeStyle,v=e.lineWidth;const g=new c(this._data.items,h,_,this._data.skipHoles);for(;g.next();){let t,i,s;l=g.prevValue(),n=g.currentValue(),o=g.nextValue();let r=!1;if(u(n)&&(n.style&&!this._data.forceLineColor?(t=n.style.color,i=n.style.width,s=n.style.style):(t=this._data.lineColor,i=this._data.lineWidth,s=this._data.lineStyle),this._data.ignorePaletteLineWidth&&(i=this._data.lineWidth), r=t!==m||i!==v||s!==f),r)if(m=t,v=i,f=s,e.stroke(),e.beginPath(),e.strokeStyle=t,e.lineWidth=i,(0,a.setValidLineStyle)(e,s),u(l))e.moveTo(l.center,l.y);else{const t=n;e.moveTo(t.center,t.y)}y=l,b=o,u(S=n)&&(u(y)?e.lineTo(S.center,S.y):b&&u(b)?e.moveTo(S.center,S.y):(e.moveTo(S.center-d,S.y),e.lineTo(S.center+d,S.y)))}var y,S,b;e.stroke()}}},382778:(e,t,i)=>{"use strict";i.d(t,{LollipopRenderer:()=>d});var s=i(934026),r=i(86441),n=i(458963),o=i(787123),a=i(199471),l=i(9640);class d{constructor(e,t,i){this._data=e,this._hittest=t,this._textWidthCache=i}draw(e,t){const i=t.pixelRatio,s=this._data.centerPoint,n=Math.round(s.x*i),o=Math.round(s.y*i),a=Math.max(1,Math.floor(i))%2/2,l=new r.Point(n+a,o-a);this._drawLollipop(e,l,t),this._drawLabel(e,l,t.pixelRatio)}hitTest(e,t){const i=(0,l.interactionTolerance)().esd,n=this._data.centerPoint.y-this._data.style.lollipop.height/2-i,o=this._data.centerPoint.x-this._data.style.lollipop.width/2-i,a=(0,r.box)(new r.Point(o,n),new r.Point(o+this._data.style.lollipop.width+2*i,n+this._data.style.lollipop.height+2*i));return(0,s.pointInBox)(e,a)?this._hittest:null}_drawLollipop(e,t,i){const s=this._data.style,r=i.pixelRatio,n=this._fillRadius(r);s.lollipop.fillCircle&&s.lollipop.backgroundColor&&this._drawFilledCircle(e,t,n,s.lollipop.backgroundColor);const o=Math.round(s.lollipop.lineWidth*r),a=n-Math.round(1*r+o/2);this._drawBorderLine(e,t,o,a),s.lollipop.fillCircle&&s.lollipop.fillStyle&&this._drawFilledCircle(e,t,a,s.lollipop.fillStyle)}_drawLabel(e,t,i){const s=this._data.style.lollipop.text,r=s.label;if(""===r)return;e.textAlign="center",e.textBaseline="middle",e.fillStyle=s.strokeStyle,e.font=s.font;const n=this._textWidthCache.yMidCorrection(e,r);e.translate(t.x,t.y+((s.deltaY||0)+n)*i),(0,a.drawScaled)(e,i,i,(()=>{e.fillText(r,0,0)}))}_fillRadius(e){const t=this._data.style,i=Math.max(1,Math.floor(e));let s=Math.round(t.lollipop.width*e);return s%2!=i%2&&(s+=1),s/2}_drawBorderLine(e,t,i,s){const r=this._data.style;e.strokeStyle=r.lollipop.strokeStyle,e.lineWidth=i,(0,o.setLineStyle)(e,n.LINESTYLE_SOLID),(0,o.createCircle)(e,t.x,t.y,s),e.stroke()}_drawFilledCircle(e,t,i,s){e.fillStyle=s,(0,o.createCircle)(e,t.x,t.y,i),e.fill()}}},710455:(e,t,i)=>{"use strict";i.d(t,{MediaCoordinatesPaneRenderer:()=>r});var s=i(327714);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,(0,s.size)({width:t.cssWidth,height:t.cssHeight}),(0,s.size)({width:t.physicalWidth,height:t.physicalHeight})).useMediaCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,(0,s.size)({width:t.cssWidth,height:t.cssHeight}),(0,s.size)({width:t.physicalWidth,height:t.physicalHeight})).useMediaCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},632739:(e,t,i)=>{"use strict";i.d(t,{CachedContainer:()=>r,ObjectValuesCache:()=>n});class s{constructor(e,t,i,s){this._items=e,this._actualLength=t,this._step=s?-1:1,this._currentIndex=i-this._step}[Symbol.iterator](){return this}next(){return this._currentIndex+=this._step, this._currentIndex>=this._actualLength||this._currentIndex<0?{value:void 0,done:!0}:{done:!1,value:this._items[this._currentIndex]}}}class r{constructor(){this._items=[],this._actualLength=0,this._invalidations=0}push(e){this._items.length===this._actualLength?this._items.push(e):this._items[this._actualLength]!==e&&(this._items[this._actualLength]=e),this._actualLength+=1}newItem(){const e=this._items.length>this._actualLength?this._items[this._actualLength]:null;return null!==e&&Boolean(e.invalidateCache)&&e.invalidateCache(),e}invalidateCache(){this._invalidations+=1,3e3===this._invalidations&&(this._items.splice(this._actualLength),this._invalidations=0),this._actualLength=0}at(e){return this._items[e]}data(){return this._items}length(){return this._actualLength}isEmpty(){return 0===this._actualLength}iterator(e,t){return new s(this._items,this._actualLength,e,t)}}class n extends r{constructor(){super(...arguments),this._startIndex=0}setStartIndex(e){this._startIndex=e}isValidIndex(e){return e>=this._startIndex}at(e){const t=e-this._startIndex;for(;t>=this._actualLength;)this._items.length<=t?this._items.push(this._newObject()):this._clearObject(this._items[this._actualLength]),this._actualLength+=1;return this._items[t]}}},627172:(e,t,i)=>{"use strict";i.d(t,{PaneRendererStepLine:()=>m,StepLineDecoration:()=>s});var s,r=i(204652),n=i(86441),o=i(246733),a=i(315801),l=i(9640),d=i(787123),h=i(43192),u=i(879617);!function(e){e[e.None=0]="None",e[e.Diamonds=1]="Diamonds"}(s||(s={}));class c{constructor(e){this._forceExtendFirstBar=!!e}initialize(e,t,i){var s,r,n,o;const{context:a,horizontalPixelRatio:l,verticalPixelRatio:h}=t,u=e.lineStyle;a.lineCap="butt",a.lineJoin="round";const c=Math.max(Math.floor(null!==(r=null===(s=i.style)||void 0===s?void 0:s.width)&&void 0!==r?r:e.lineWidth*l));void 0!==u&&(0,d.setLineStyle)(a,u);const _=c%2?.5:0;a.moveTo(Math.round(i.center*l)+_,Math.round(i.y*h)+_),a.strokeStyle=null!==(o=null===(n=i.style)||void 0===n?void 0:n.color)&&void 0!==o?o:e.lineColor,a.lineWidth=c}startFragment(e,t,i,s){e.beginPath();const r=i.firstItem&&i.extendToBarsEndings?t.center:t.left;e.moveTo(isNaN(r)?-50:r,t.y)}finishFragment(e,t,i){t&&i&&e.lineTo(t.left,i.y),e.stroke()}hitTest(e,t,i,s){var o,a;if(!(0,u.isValidPoint)(t))return!1;const d=null!==(a=null===(o=t.style)||void 0===o?void 0:o.width)&&void 0!==a?a:e.lineWidth,h=(0,l.interactionTolerance)().series+d/2,{left:c,y:_}=t,p=isNaN(c)?-50:c;let f,m;return i&&(0,u.isValidPoint)(i)?(f=i.left,m=i.y):(f=t.right,m=t.y),!(ps.x+h&&f>s.x+h)&&((0,r.distanceToSegment)((0,n.point)(p,_),(0,n.point)(f,_),s).distancethis._drawDecorationItem(e,t)))}_drawDecorationItem(e,t){var i,s,r,n,o,a,l,d,h,c;if(null===this._data||0===this._data.items.length)return;const{lineWidth:_,lineColor:p,items:f,visibleItemsRange:m,skipHoles:v,extendToBarsEndings:g}=this._data,{context:y,horizontalPixelRatio:S,verticalPixelRatio:b}=e;let w=Math.max(Math.floor((null!==(s=null===(i=f[0].style)||void 0===i?void 0:i.width)&&void 0!==s?s:_)*S)),C=w%2?.5:0;t.initialize(this._data,e,f[0]);const I=null!==(r=null==m?void 0:m.startItemIndex)&&void 0!==r?r:0,x=null!==(n=null==m?void 0:m.endItemIndex)&&void 0!==n?n:f.length;if(x<=I)return;let P,T,R;y.beginPath(),t.applyColor(y,null!==(a=null===(o=f[I].style)||void 0===o?void 0:o.color)&&void 0!==a?a:p),t.applyLineWidth(y,w);let M=!1;const D=new u.PaneRendererLineItemsIterator(f,I,x,v);for(;D.next();){ const i=D.currentValue();if(!(0,u.isValidPoint)(i)){P=void 0,M=!0;continue}const s=null!==(d=null===(l=i.style)||void 0===l?void 0:l.color)&&void 0!==d?d:p,r=null!==(c=null===(h=i.style)||void 0===h?void 0:h.width)&&void 0!==c?c:_,n=s!==T,o=r!==R,a={firstItem:D.currentValueIsFirst(),lastItem:D.currentValueIsLast(),extendToBarsEndings:g,valIsNotSameAsPrev:i.valIsNotSameAsPrev},f={y:Math.round(i.y*b)+C,left:Math.round(i.left*S)+C,center:Math.round(i.center*S)+C,right:Math.round(i.right*S)+C};(n||o||M)&&(T&&R&&t.finishFragment(y,f,P),n&&t.applyColor(y,s),o&&(w=Math.max(1,Math.floor(r*S)),C=w%2?.5:0,t.applyLineWidth(y,w)),t.startFragment(y,f,a,P),M=!1,T=s,R=r),t.drawItem(e,f,a,P),P=f}t.finishFragment(y)}}},535698:(e,t,i)=>{"use strict";i.d(t,{TextRenderer:()=>R,calculateLabelPosition:()=>_,fontSize:()=>x,getTextBoundaries:()=>p,needTextExclusionPath:()=>f,wordWrap:()=>m});var s=i(86441),r=i(650151),n=i(934026),o=i(31341),a=i(315801),l=i(787123),d=i(253972),h=i(389137),u=i(199471),c=i(458963);function _(e,t,i,r,n){const o=.5*(t.x+i.x);let a=i.y;return t.y>i.y?(a-=e.height/2+r.y,a=Math.max(e.height/2,a)):(a+=e.height/2+r.y,a=Math.min(n-e.height/2,a)),new s.Point(o,a)}function p(e,t,i){if(e.isOutOfScreen(t,i))return null;const s=e.getPolygonPoints();return 0===s.length?null:s}function f(e){const t=e.getLinesInfo().lines;if(t.length%2==0)return!1;if(""===t[Math.floor(t.length/2)].trim())return!1;return!0}function m(e,t,i=!0,s){s=(0,h.isString)(s)?parseInt(s):s,e+="";const r=!(0,h.isNumber)(s)||!isFinite(s)||s<=0?e.split(/\r\n|\r|\n|$/):e.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/),n=e.charAt(e.length-1);if(!i&&("\n"===n||"\r"===n||"\r\n"===n)||r[r.length-1]||r.pop(),!(0,h.isNumber)(s)||!isFinite(s)||s<=0)return r;const o=[];for(let e=0;e0&&(0,u.measureText)(a.slice(0,3*--e-1).join(""),t).width>s;);if(e>0)o.push(a.slice(0,3*e-1).join("")),a.splice(0,3*e);else{const e=a[0]+(a[1]||"");if(l=1===l?1:~~(s/(0,u.measureText)(e,t).width*e.length),(0,u.measureText)(e.substring(0,l),t).width<=s)for(;(0,u.measureText)(e.substring(0,l+1),t).width<=s;)l++;else for(;l>1&&(0,u.measureText)(e.substring(0,--l),t).width>s;);l<1&&(l=1),o.push(e.substring(0,l)),a[0]=e.substring(l),a[1]=""}if((0,u.measureText)(a.join(""),t).width<=s){o.push(a.join(""));break}}}return o}function v(e,t,i){if(0===i)return e.clone();const r=(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,n=(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y;return new s.Point(r,n)}function g(e,t){const i=Math.round(t+2*C(e)+2*b(e));return i%2?i+1:i}function y(e,t){return x(e)*t+I(e)*(t-1)+2*w(e)+2*S(e)}function S(e){return void 0!==e.boxPaddingVert?e.boxPaddingVert*T(e):void 0!==e.boxPadding?e.boxPadding*T(e):x(e)/3}function b(e){ return void 0!==e.boxPaddingHorz?e.boxPaddingHorz*T(e):void 0!==e.boxPadding?e.boxPadding*T(e):x(e)/3}function w(e){return(e.backgroundVertInflate||0)*T(e)}function C(e){return(e.backgroundHorzInflate||0)*T(e)}function I(e){return(e.padding||0)*T(e)}function x(e){return Math.ceil(P(e)*T(e))}function P(e){return e.fontsize||e.fontSize||30}function T(e){const t=Math.min(1,Math.max(.2,Math.min(e.scaleX||1,e.scaleY||1)));if(1===t)return t;const i=P(e);return Math.ceil(t*i)/i}class R{constructor(e,t){this._data=null,this._internalData=null,this._boxSize=null,this._polygonPoints=null,this._linesInfo=null,this._fontInfo=null,this._hittest=t||new a.HitTestResult(a.HitTarget.MovePoint,{areaName:a.AreaName.Text}),void 0!==e&&this.setData(e)}data(){return this._data}setData(e){null!==e?(e.horzTextAlign||(e.horzTextAlign=e.horzAlign),!function(e,t){if(null===e||null===t)return null===e==(null===t);if(void 0===e.points!=(void 0===t.points))return!1;if(void 0!==e.points&&void 0!==t.points){if(e.points.length!==t.points.length)return!1;for(let r=0;re){const i=(0,s.box)(new s.Point(0,0),new s.Point(e,t));return this.getPolygonPoints().every((e=>!(0,n.pointInBox)(e,i)))}return!1} setPoints(e,t){(0,r.ensureNotNull)(this._data).points=e,this._hittest=t||new a.HitTestResult(a.HitTarget.MovePoint)}fontStyle(e){return null===this._data?"":this._getFontInfo().fontStyle}lineHeight(){return null===this._data?0:x(this._data)}lineSpacing(){return null===this._data?0:I(this._data)}wordWrap(e,t,i){return m(e,i||this.fontStyle(),!0,t)}draw(e,t){if(null===this._data||void 0===this._data.points||0===this._data.points.length)return;if(this.isOutOfScreen(t.cssWidth,t.cssHeight))return;const i=t.pixelRatio,s=this._getInternalData(),r=this._getRotationPoint().scaled(i);e.save(),e.translate(r.x,r.y),e.rotate(this._data.angle||0),e.translate(-r.x,-r.y);const n=this._getFontInfo().fontSize;e.textBaseline=s.textBaseLine,e.textAlign=s.textAlign,e.font=this.fontStyle();const{scaledLeft:o,scaledRight:a,scaledTop:d,scaledBottom:h}=function(e,t){const i=Math.round(e.boxLeft*t),s=Math.round(e.boxTop*t);return{scaledLeft:i,scaledRight:i+Math.round(e.boxWidth*t),scaledTop:s,scaledBottom:s+Math.round(e.boxHeight*t)}}(s,i);if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){const t=this._data.borderWidth||Math.max(n/12,1),s=Math.round(t*i),r=s/2;let u=!1;if(this._data.boxShadow){e.save();const{shadowColor:t,shadowBlur:i,shadowOffsetX:s=0,shadowOffsetY:r=0}=this._data.boxShadow;e.shadowColor=t,e.shadowBlur=i,e.shadowOffsetX=s,e.shadowOffsetY=r,u=!0}if(this._data.backgroundRoundRect)this._data.backgroundColor&&((0,l.drawRoundRect)(e,o,d,a-o,h-d,this._data.backgroundRoundRect*i),e.fillStyle=this._data.backgroundColor,e.fill(),u&&(e.restore(),u=!1)),this._data.borderColor&&((0,l.drawRoundRect)(e,o-r,d-r,a-o+s,h-d+s,this._data.backgroundRoundRect*i+s),e.strokeStyle=this._data.borderColor,e.lineWidth=s,e.stroke(),u&&(e.restore(),u=!1));else if(this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.fillRect(o,d,a-o,h-d),u&&(e.restore(),u=!1)),this._data.borderColor||this._data.highlightBorder){let t;this._data.borderColor?(e.strokeStyle=this._data.borderColor,t=s):(e.strokeStyle=this._data.highlightBorderColor||this._data.color,(0,l.setLineStyle)(e,c.LINESTYLE_DASHED),t=Math.max(1,Math.floor(i))),e.lineWidth=t,e.beginPath(),e.moveTo(o-t/2,d-t/2),e.lineTo(o-t/2,h+t/2),e.lineTo(a+t/2,h+t/2),e.lineTo(a+t/2,d-t/2),e.lineTo(o-t/2,d-t/2),e.stroke(),u&&e.restore()}}this._drawSelectionIfNeeded(e,i),e.fillStyle=this._data.color;const _=(o+Math.round(s.textStart*i))/i,p=.05*n;let f=(d+Math.round((s.textTop+p)*i))/i;const m=I(this._data),v=this.getLinesInfo();for(const t of v.lines)(0,u.drawScaled)(e,i,i,(()=>e.fillText(t,_,f))),f+=n+m;e.restore()}getPolygonPoints(){if(null!==this._polygonPoints)return this._polygonPoints;if(null===this._data)return[];const e=this._data.angle||0,{boxLeft:t,boxTop:i,boxWidth:r,boxHeight:n}=this._getInternalData(),o=this._getRotationPoint();return this._polygonPoints=[v(new s.Point(t,i),o,e),v(new s.Point(t+r,i),o,e),v(new s.Point(t+r,i+n),o,e),v(new s.Point(t,i+n),o,e)],this._polygonPoints}getLinesInfo(){if(null===this._linesInfo){ const e=(0,r.ensureNotNull)(this._data);let t=this.wordWrap(e.text,e.wordWrapWidth);if(void 0!==e.maxHeight){const i=function(e){const t=(0,r.ensureDefined)(e.maxHeight),i=x(e),s=I(e);return Math.floor((t+s)/(i+s))}(e);t.length>i&&(t=t.slice(0,i))}this._linesInfo={linesMaxWidth:this._getLinesMaxWidth(t),lines:t}}return this._linesInfo}positionToCoordinate(e){const t=(0,r.ensureNotNull)(this._data),i=this._getInternalData(),s=this.getLinesInfo(),n=w(t)+S(t),{x:o,y:a,lineNumber:l}=(0,d.getSymbolCoordinatesInfo)(e,s.lines,t.text,x(t),this.fontStyle());return{x:o+i.boxLeft+i.textStart,y:a+i.boxTop+n,lineNumber:l}}_getInternalData(){if(null!==this._internalData)return this._internalData;const e=(0,r.ensureNotNull)(this._data),t=this._getBoxSize(),i=t.boxWidth,s=t.boxHeight,n=(0,r.ensureDefined)(e.points)[0];let a=n.y;switch(e.vertAlign){case"bottom":a-=s+e.offsetY;break;case"middle":a-=s/2;break;case"top":a+=e.offsetY}let l=n.x;const d=b(e),h=S(e),u=C(e)+d;let c;const _=a+(w(e)+h)+x(e)/2;let p;switch(e.horzAlign){case"left":l+=e.offsetX;break;case"center":l-=i/2;break;case"right":l-=i+e.offsetX}switch((0,r.ensureDefined)(e.horzTextAlign)){case"left":p="start",c=l+u,(0,o.isRtl)()&&(e.forceTextAlign?p="left":(c=l+i-u,p="right"));break;case"center":p="center",c=l+i/2;break;case"right":p="end",c=l+i-u,(0,o.isRtl)()&&e.forceTextAlign&&(p="right")}return this._internalData={boxLeft:l,boxTop:a,boxWidth:i,boxHeight:s,textStart:c-l,textTop:_-a,textAlign:p,textBaseLine:"middle"},this._internalData}_getFontInfo(){if(null===this._fontInfo){const e=(0,r.ensureNotNull)(this._data),t=x(e),i=(e.bold?"bold ":"")+(e.italic?"italic ":"")+t+"px "+e.font;this._fontInfo={fontStyle:i,fontSize:t}}return this._fontInfo}_drawSelectionIfNeeded(e,t){const i=(0,r.ensureNotNull)(this._data),s=x((0,r.ensureNotNull)(this._data));if(i.selectionHighlight){const r=this.positionToCoordinate(i.selectionHighlight.start),n=this.positionToCoordinate(i.selectionHighlight.end),o=this._getInternalData();(0,d.drawSelection)(e,t,{lines:this.getLinesInfo().lines,text:i.text,leftTop:r,rightTop:n,firstLineStart:o.boxLeft+o.textStart,lastLineEnd:o.boxLeft+o.textStart,color:i.selectionHighlight.color,font:this.fontStyle(),lineHeight:s})}}_getLinesMaxWidth(e){const t=this.fontStyle();if(null!==this._data&&this._data.wordWrapWidth&&!this._data.forceCalculateMaxLineWidth)return this._data.wordWrapWidth*T(this._data);let i=0;for(const s of e)i=Math.max(i,(0,u.measureText)(s,t).width);return i}_getBoxSize(){if(null===this._boxSize){const e=this.getLinesInfo(),t=(0,r.ensureNotNull)(this._data);this._boxSize={boxWidth:g(t,e.linesMaxWidth),boxHeight:y(t,e.lines.length)}}return this._boxSize}_getRotationPoint(){const{boxLeft:e,boxTop:t,boxWidth:i,boxHeight:n}=this._getInternalData(),{horzAlign:o,vertAlign:a}=(0,r.ensureNotNull)(this._data);let l,d;switch(o){case"center":l=e+i/2;break;case"left":l=e;break;case"right":l=e+i}switch(a){case"middle":d=t+n/2;break;case"top":d=t;break;case"bottom":d=t+n}return new s.Point(l,d)}}},541801:(e,t,i)=>{"use strict";i.d(t,{ TrendLineRenderer:()=>_,drawArrow:()=>c});var s=i(650151),r=i(204652),n=i(855152),o=i(315801),a=i(787123),l=i(9640),d=i(199471),h=i(458963);function u(e,t,i,s,r){t.save(),t.fillStyle="#000000",t.beginPath(),t.arc(e.x*r,e.y*r,i*r,0,2*Math.PI,!1),t.fill(),s.strokeWidth&&(t.lineWidth=s.strokeWidth,t.stroke()),t.restore()}function c(e,t,i,s,r,n=!1){if(t.subtract(e).length()<1)return;const o=(0,l.getArrowPoints)(e,t,s,n,!0).slice(0,2);let a=null;for(let e=0;e1)&&i.moveTo(t.x*r,t.y*r),i.lineTo(s.x*r,s.y*r),a=s}}class _{constructor(){this._data=null,this._hittest=new o.HitTestResult(o.HitTarget.MovePoint)}setData(e){this._data=e}setHitTest(e){this._hittest=e}draw(e,t){const i=this._data;if(null===i)return;if("points"in i&&i.points.length<2)return;const s=t.pixelRatio;void 0!==i.excludeBoundaries&&(e.save(),(0,d.addExclusionArea)(e,t,i.excludeBoundaries));const{linestyle:r,lineCap:n=(r===h.LINESTYLE_SOLID?"round":"butt")}=i;e.lineCap=n,e.lineJoin="round",e.strokeStyle=i.color,e.lineWidth=Math.max(1,Math.floor(i.linewidth*s)),(0,a.setLineStyle)(e,r);const o=i.points[0],l=i.points[1];let u=[];e.beginPath(),i.overlayLineEndings?u=[o.clone(),l.clone()]:this._drawEnds(e,[o,l],i.linewidth,s);const c=this._extendAndClipLineSegment(o,l,t);null!==c&&i.linewidth>0&&(0,a.addPixelPerfectLineToPath)(e,c[0].x,c[0].y,c[1].x,c[1].y,s),i.overlayLineEndings&&this._drawEnds(e,u,i.linewidth,s),e.stroke(),void 0!==i.excludeBoundaries&&e.restore()}hitTest(e,t){const i=this._data;if(null===i)return null;if("points"in i&&i.points.length<2)return null;const s=(0,l.interactionTolerance)().line,n=i.points[0],o=i.points[1],a=this._extendAndClipLineSegment(n,o,t);if(null!==a){if((0,r.distanceToSegment)(a[0],a[1],e).distance<=s)return this._hittest}return null}_extendAndClipLineSegment(e,t,i){const r=(0,s.ensureNotNull)(this._data);return(0,l.extendAndClipLineSegment)(e,t,i.cssWidth,i.cssHeight,r.extendleft,r.extendright)}_drawEnds(e,t,i,r){const o=t[0],a=t[1],l=(0,s.ensureNotNull)(this._data);switch(l.leftend){case n.LineEnd.Arrow:c(a,o,e,i,r);break;case n.LineEnd.Circle:u(o,e,i,(0,s.ensureDefined)(l.endstyle),r)}switch(l.rightend){case n.LineEnd.Arrow:c(o,a,e,i,r);break;case n.LineEnd.Circle:u(a,e,i,(0,s.ensureDefined)(l.endstyle),r)}}}},758363:(e,t,i)=>{"use strict";i.d(t,{VerticalLineRenderer:()=>l});var s=i(315801),r=i(787123),n=i(9640),o=i(199471),a=i(43192);class l extends a.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._hitTest=new s.HitTestResult(s.HitTarget.MovePoint)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||null===this._hitTest)return null;const t=(0,n.interactionTolerance)().line,i=Math.abs(e.x-this._data.x)<=t+this._data.linewidth/2,s=void 0===this._data.top||this._data.top-e.y<=t,r=void 0===this._data.bottom||e.y-this._data.bottom<=t;return i&&s&&r?this._hitTest:null}_drawImpl(e){if(null===this._data||this._data.linewidth<=0)return ;const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s,mediaSize:n}=e;if(this._data.x<-this._data.linewidth/2||this._data.x>n.width+this._data.linewidth/2)return;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(t,this._data.linestyle);const a=void 0!==this._data.top?Math.max(this._data.top,0):0,l=void 0!==this._data.bottom?Math.min(this._data.bottom,n.height):n.height,d=Math.round(this._data.x*i),h=Math.floor(a*s),u=Math.ceil(l*s),c=this._data.excludeBoundaries;void 0!==c&&(0,o.addExclusionAreaByScope)(e,c),(0,r.drawVerticalLine)(t,d,h,u)}}},888929:(e,t,i)=>{"use strict";i.d(t,{sortSources:()=>r,sortSourcesPreOrdered:()=>s});const s={LatestUpdates:10000001,BarMarks:10000002,TimeScaleMarks:10000003,ChartEventsSource:10000004,Dividends:10000005,Splits:10000006,Earnings:10000007,RollDates:10000008,FutureContractExpiration:10000009,LineToolOrder:10000010,LineToolPosition:10000011,LineToolExecution:10000012,AlertLabelInactive:10000013,AlertLabel:10000014};function r(e){return[...e].sort(((e,t)=>e.zorder()-t.zorder()))}},601183:(e,t,i)=>{"use strict";i.d(t,{PriceAxisViewRenderer:()=>c,hittestByData:()=>u});var s=i(86441),r=i(934026),n=i(86121),o=i(31341),a=i(199471),l=i(315801),d=i(787123);const h=new Path2D("M4.09.93c.4.16.75.4 1.02.73a5.47 5.47 0 0 0-3.78 3.27A2.5 2.5 0 0 1 3.2.77c.31 0 .61.06.89.16Zm8.24 3.35a2.5 2.5 0 0 0-3.27-3.23c-.38.16-.7.4-.97.7a5.47 5.47 0 0 1 3.56 3.5c.3-.26.53-.6.68-.97Zm-3.15-.84a4.5 4.5 0 1 0-5.5 7.12 4.5 4.5 0 0 0 5.5-7.12ZM6 4h1v4H4V7h2V4Z");function u(e,t){var i;const o=(0,n.lastMouseOrTouchEventInfo)().isTouch?10:0,a=e.hitTestData;if(void 0===a||!e.visible)return null;const{itemBox:d,clickHandler:h,tooltip:u}=a;if(d){const n=(0,s.box)(new s.Point(d.min.x-o,d.min.y-o),new s.Point(d.max.x+o,d.max.y+o));if((0,r.pointInBox)(t,n))return new l.HitTestResult(null!==(i=e.hitTarget)&&void 0!==i?i:l.HitTarget.Custom,{clickHandler:null==h?void 0:h.bind(null,t),tapHandler:null==h?void 0:h.bind(null,t),hoverModelFromAxis:a.hoverModelFromAxis,activeItem:a.activeItem,tooltip:u})}return null}class c{constructor(e,t){this._bodyBox=null,this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}lastDrawnBodyBox(){return this._bodyBox}draw(e,t,i,r,n,l,h){var u,c,_,p;const f=this._data;if(!f.visible||this._isOutOfScreen(t,n))return;const m=this._commonData,v=void 0!==f.labelIcon,g=t.borderSize,y=t.paddingTop+m.additionalPaddingTop,S=t.paddingBottom+m.additionalPaddingBottom,b=t.paddingInner,w=f.ignoreAdditionalPaddingInner?0:t.additionalPaddingInner,C=t.paddingOuter,I=t.fontSize;let x=f.text,P=f.textColor||m.textColor,T=f.secondLine||"",R=m.secondLineTextColor||P,M=f.thirdLine||"";const D=m.thirdLineTextColor||P;0===T.length&&(T=M,R=D,M=""),0===x.length&&(x=T,P=R,T=M,R=D,M=""),e.save(),void 0!==m.globalAlpha&&(e.globalAlpha*=m.globalAlpha),e.font=t.font ;const A=i.yMidCorrection(e,x)*h,V=Math.ceil(i.measureText(e,x)),L=I+y+S,k=(null!==(u=f.labelIconMinWidth)&&void 0!==u?u:0)*h,B=Boolean(T),N=Boolean(M),E=B?Math.ceil(i.measureText(e,T)):0,O=N?Math.ceil(i.measureText(e,M)):0,F=g+b+C+V+w,H=E>0?g+b+C+E+w:0,W=O>0?g+b+C+O+w:0,z=Math.max(F,H,W),U=Math.max(1,Math.floor(h));let G=Math.round(L*h);G%2!=U%2&&(G+=1);const q=Math.round((I+t.lineSpacing)*h),$=Math.round(2*(I+t.lineSpacing)*h),j=Math.max(1,Math.floor(g*h)),Y=f.separatorVisible?j:0,K=f.borderVisible?j:0,Q=v?Math.max(G,k):Math.round(z*h),X=Math.round(w*h),Z=Math.ceil(r*h),J=Math.ceil(b*h),ee=Math.round((null!==(c=m.fixedCoordinate)&&void 0!==c?c:m.coordinate)*h)-Math.floor(.5*h),te=Math.floor(ee+U/2-G/2),ie=te+G,se="right"===l,re=void 0!==f.xCoord?Math.round(f.xCoord*h)+(se?1:-1)*Math.round(Q/2):se?Z-Y:Y,ne=Z;let oe,ae=re;const le=null!==(_=f.backgroung)&&void 0!==_?_:m.background;e.fillStyle=le;const de=2*h;if(e.textAlign=se?"right":"left",e.textBaseline="middle",se?(ae=re-Q,oe=re-X-J-1):(ae=re+Q,oe=re+X+J),this._bodyBox=null,x||v){const i=N?G+$:B?G+q:G,r=null!==(p=m.borderColor)&&void 0!==p?p:le,n=void 0!==f.xCoord?de:0;if(((t,r,o)=>{if(se){(0,d.drawRoundRectWithInnerBorder)(e,ae,te,Q,i,t,f.overridenRadius?(0,d.scaleDrawRoundRectRadii)(f.overridenRadius,h):[de,n,n,de],K,r,o);const a=(0,s.point)(ae/h,te/h),l=a.add((0,s.point)(Q/h,i/h));this._bodyBox=(0,s.box)(a,l)}else{(0,d.drawRoundRectWithInnerBorder)(e,re,te,Q,i,t,f.overridenRadius?(0,d.scaleDrawRoundRectRadii)(f.overridenRadius,h):[n,de,de,n],K,r,o);const a=(0,s.point)(re/h,te/h),l=a.add((0,s.point)(Q/h,i/h));this._bodyBox=(0,s.box)(a,l)}})(le,r,m.borderStyle),f.separatorVisible&&(e.fillStyle=t.paneBackgroundColor,e.fillRect(se?ne-Y:0,te,Y,ie-te)),v){switch(f.labelIcon){case 0:this._drawPlusIcon(e,re,ae,te,ee,ie,U);break;case 1:this._drawClockExistingAlertIcon(e,re,ae,h,te,i)}return void e.restore()}e.save(),e.translate(oe,(te+ie)/2+A),(0,a.drawScaled)(e,h,h,(()=>{e.fillStyle=P,e.fillText(x,0,0)})),e.restore()}B&&(e.fillStyle=R,e.save(),e.translate(oe,(te+ie)/2+A+q),(0,a.drawScaled)(e,h,h,(()=>{e.fillText((0,o.startWithLTR)(T),0,0)})),e.restore()),N&&(e.fillStyle=D,e.save(),e.translate(oe,(te+ie)/2+A+$),(0,a.drawScaled)(e,h,h,(()=>{e.fillText((0,o.startWithLTR)(M),0,0)})),e.restore()),e.restore()}topBottomTotalHeight(e){const t=this._lines();if(!this._data.visible||0===t)return{top:0,bottom:0,total:0};const i=e.fontSize/2+e.paddingTop+this._commonData.additionalPaddingTop,s=(t-.5)*e.fontSize+(t-1)*e.lineSpacing+e.paddingBottom+this._commonData.additionalPaddingBottom;return{top:i,bottom:s,total:i+s}}hitTest(e){return u(this._data,e)}_drawPlusIcon(e,t,i,s,r,n,o){e.fillStyle=this._commonData.textColor,e.strokeStyle=this._commonData.textColor,e.lineWidth=o;const a=Math.abs(t-i);let l=Math.round(.35*a);l%2!=o%2&&(l+=1);let d=Math.round(.65*a);d%2!=o%2&&(d+=1);const h=Math.floor((a-l)/2),u=Math.min(t,i),c=u+Math.floor(a/2-o/2);e.fillRect(u+h,r,l,o),e.fillRect(c,s+h,o,l),e.beginPath(),e.arc(c+o/2,r+o/2,d/2,0,2*Math.PI,!1),e.stroke()} _drawClockExistingAlertIcon(e,t,i,s,r,n){e.fillStyle=this._commonData.textColor;const o=Math.abs(t-i),a=Math.min(t,i),l=o/(23*s),d=12*s*l,u=10.73*s*l,c=Math.floor((o-d)/2),_=Math.floor((n-u)/2)-1;e.save(),e.translate(a+c,r+_),e.scale(s*l,s*l),e.fill(h),e.restore()}_lines(){const e=this._data;return(e.text?1:0)+(e.secondLine?1:0)+(e.thirdLine?1:0)}_isOutOfScreen(e,t){var i;const s=this._commonData,r=null!==(i=s.fixedCoordinate)&&void 0!==i?i:s.coordinate,{total:n}=this.topBottomTotalHeight(e),o=n/this._lines();return r-o/2-3>t||r+(n-o/2)+3<0}}},229765:(e,t,i)=>{"use strict";i.d(t,{PriceAxisView:()=>n});var s=i(601183),r=i(246733);class n{constructor(e){this._commonRendererData={coordinate:0,textColor:"#FFF",background:"#000",additionalPaddingBottom:0,additionalPaddingTop:0},this._axisRendererData={text:"",visible:!1,separatorVisible:!1,borderVisible:!1,ignoreAdditionalPaddingInner:!1},this._paneRendererData={text:"",visible:!1,separatorVisible:!0,borderVisible:!1,ignoreAdditionalPaddingInner:!0},this._invalidated=!0,this._active=!1,this._axisRenderer=new(e||s.PriceAxisViewRenderer)(this._axisRendererData,this._commonRendererData),this._paneRenderer=new(e||s.PriceAxisViewRenderer)(this._paneRendererData,this._commonRendererData)}setActive(e){this._active=e}text(){return this._updateRendererDataIfNeeded(),this._axisRendererData.text}secondLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.secondLine}thirdLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.thirdLine}background(){return this._updateRendererDataIfNeeded(),this._commonRendererData.background}color(){return this._updateRendererDataIfNeeded(),this.generateTextColor(this.background())}generateTextColor(e){return(0,r.colorFromBackground)(e)}coordinate(){return this._updateRendererDataIfNeeded(),this._commonRendererData.coordinate}floatCoordinate(){var e;return this._updateRendererDataIfNeeded(),null!==(e=this._commonRendererData.floatCoordinate)&&void 0!==e?e:this._commonRendererData.coordinate}update(e){this._invalidated=!0}topBottomTotalHeight(e){this._updateRendererDataIfNeeded();const{top:t,bottom:i,total:s}=this._axisRenderer.topBottomTotalHeight(e),{top:r,bottom:n,total:o}=this._paneRenderer.topBottomTotalHeight(e);return{top:Math.max(t,r),bottom:Math.max(i,n),total:Math.max(s,o)}}getFixedCoordinate(){return this._commonRendererData.fixedCoordinate||0}setFixedCoordinate(e){this._commonRendererData.fixedCoordinate=e}isVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible||this._paneRendererData.visible}isAxisLabelVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible}isPaneLabelVisible(){return this._updateRendererDataIfNeeded(),this._paneRendererData.visible}renderer(){return this._updateRendererDataIfNeeded(),this._axisRenderer}paneRenderer(){return this._updateRendererDataIfNeeded(),this._paneRenderer}setPaneRendererLabelIcon(e){this._paneRendererData.labelIcon=e}setPaneLabelVisible(e){this._paneRendererData.visible=e,this._invalidated=!0} ignoreAlignment(){return!1}_updateRendererDataIfNeeded(){this._invalidated&&(this._commonRendererData.fixedCoordinate=void 0,this._updateRendererData(this._axisRendererData,this._paneRendererData,this._commonRendererData),this._invalidated=!1)}}},974655:(e,t,i)=>{"use strict";i.d(t,{PriceDataSource:()=>a,isPriceDataSource:()=>o});var s=i(996986),r=i(707957),n=i(981107);function o(e){return e instanceof a}class a extends s.DataSource{constructor(e,t){super(t),this._formatterChanged=new r.Delegate,this._priceStepChanged=new r.Delegate,this._currencyChanged=new r.Delegate,this._unitChanged=new r.Delegate,this._priceRangeReadyChanged=new r.Delegate,this._priceStep=null,this._priceRangeReady=!0,this._model=e}base(){return 0}model(){return this._model}currencyChanged(){return this._currencyChanged}isCurrencySource(){return!0}isDisplayedInLegend(){return!0}unitChanged(){return this._unitChanged}isUnitSource(){return!0}priceRange(e,t){return null}isDraggable(){return!0}priceLineColor(e){return e}formatterChanged(){return this._formatterChanged}priceStep(e){return this._priceStep}priceStepChanged(){return this._priceStepChanged}isIncludedInAutoScale(){return!0}correctScaleMargins(e){return e}priceRangeReady(){return this._priceRangeReady}priceRangeReadyChanged(){return this._priceRangeReadyChanged}disablePriceRangeReady(){const e=this.priceScale();null===e||e.isAutoScale()||e.mainSource()!==this||(this._priceRangeReady=!1,e.recalculatePriceRangeOnce()),this._priceRangeReadyChanged.fire(!1)}statusView(){return null}legendView(){return null}marketStatusModel(){return null}dataUpdatedModeModel(){return null}dataProblemModel(){return null}_enablePriceRangeReady(){this._priceRangeReady=!0,this._priceRangeReadyChanged.fire(!0)}_onSourceCurrencyChanged(){(0,n.isActingAsSymbolSource)(this)||this._currencyChanged.fire()}_onSourceUnitChanged(){(0,n.isActingAsSymbolSource)(this)||this._unitChanged.fire()}_onSourcePriceRangeReadyChanged(e){(0,n.isActingAsSymbolSource)(this)||e||this.disablePriceRangeReady()}}},506387:(e,t,i)=>{"use strict";i.d(t,{PriceLineAxisView:()=>l,SeriesPriceLineAxisView:()=>d,StudyPriceLineAxisView:()=>h});var s=i(229765),r=i(650151),n=i(458963),o=i(787123);class a{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,a,l,d){var h;if(!this._data.visible)return;const u=null!==(h=this._commonData.fixedCoordinate)&&void 0!==h?h:this._commonData.coordinate;e.lineWidth=Math.max(1,Math.floor((0,r.ensureDefined)(this._data.linewidth)*d)),e.lineCap="butt",(0,o.setLineStyle)(e,void 0===this._data.linestyle?n.LINESTYLE_DOTTED:this._data.linestyle),e.strokeStyle=this._commonData.textColor,(0,o.drawHorizontalLine)(e,Math.round(u*d),0,Math.ceil(s*d))}topBottomTotalHeight(e){return{top:0,bottom:0,total:0}}}class l extends s.PriceAxisView{constructor(e){super(e||a)}ignoreAlignment(){return!0}_updateRendererData(e,t,i){if(t.visible=!1,e.visible=!1,!this._isVisible())return;const s=this._value();s.noData||(i.background="",i.textColor=this._priceLineColor(s.color),i.coordinate=s.coordinate, i.floatCoordinate=s.floatCoordinate,e.linewidth=this._lineWidth(),e.linestyle=this._lineStyle(),e.backgroundAreaVisible=this._backgroundAreaVisible(),e.backgroundAreaColor=this._backgroundAreaColor(),e.backgroundAreaHeight=this._backgroundAreaHeight(),e.visible=!0)}_lineStyle(){return n.LINESTYLE_DOTTED}_backgroundAreaVisible(){return!1}_backgroundAreaColor(){return""}_backgroundAreaHeight(){return 0}}class d extends l{constructor(e){super(),this._series=e}_value(){return this._series.lastValueData(void 0,!0)}_priceLineColor(e){return this._series.priceLineColor(e)}_lineWidth(){return this._series.properties().childs().priceLineWidth.value()}_isVisible(){const e=this._series.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._series.properties().childs().showPriceLine.value()&&e}}class h extends l{constructor(e,t){super(),this._study=e,this._plotname=t}_value(){return this._study.lastValueData(this._plotname,!0)}_lineWidth(){return this._study.properties().childs().styles.childs()[this._plotname].childs().linewidth.value()}_lineStyle(){return n.LINESTYLE_DOTTED}_priceLineColor(e){return e}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showStudyLastValue.value(),t=this._study.isPlotVisibleAt(this._plotname,1);return this._study.properties().childs().styles.childs()[this._plotname].childs().trackPrice.value()&&e&&t}}},740086:(e,t,i)=>{"use strict";i.d(t,{fromIndexedTo100:()=>d,fromLog:()=>_,fromPercent:()=>o,getCurrentModePriceText:()=>m,getOppositeModePriceText:()=>v,logFormulaForPriceRange:()=>p,logFormulasAreSame:()=>f,toIndexedTo100:()=>h,toIndexedTo100Range:()=>u,toLog:()=>c,toPercent:()=>a,toPercentRange:()=>l});var s=i(291784),r=i(678515);const n={logicalOffset:4,coordOffset:1e-4};function o(e,t){return t<0&&(e=-e),e/100*t+t}function a(e,t){const i=100*(e-t)/(t||1);return t<0?-i:i}function l(e,t){const i=a(e.minValue(),t),r=a(e.maxValue(),t);return new s.PriceRange(i,r)}function d(e,t){return t<0&&(e=-e),(e-=100)/100*t+t}function h(e,t){const i=100*(e-t)/t+100;return t<0?-i:i}function u(e,t){const i=h(e.minValue(),t),r=h(e.maxValue(),t);return new s.PriceRange(i,r)}function c(e,t){const i=Math.min(10**305-t.coordOffset,Math.abs(e));if(i<1e-25)return 0;const s=(0,r.log10)(i+t.coordOffset)+t.logicalOffset;return e<0?-s:s}function _(e,t){const i=Math.abs(e);if(i<1e-15)return 0;const s=Math.pow(10,Math.min(i-t.logicalOffset,305))-t.coordOffset;return e<0?-s:s}function p(e){if(null===e)return n;const t=Math.abs(e.maxValue()-e.minValue());if(t>=1||t<1e-15)return n;const i=Math.ceil(Math.abs(Math.log10(t))),s=n.logicalOffset+i;return{logicalOffset:s,coordOffset:1/Math.pow(10,s)}}function f(e,t){return e.logicalOffset===t.logicalOffset&&e.coordOffset===t.coordOffset}function m(e,t){return e.isPercentage()?t.formattedPricePercentage:e.isIndexedTo100()?t.formattedPriceIndexedTo100:t.formattedPriceAbsolute}function v(e,t){return e.isPercentage()||e.isIndexedTo100()?t.formattedPriceAbsolute:t.formattedPricePercentage}},291784:(e,t,i)=>{ "use strict";i.d(t,{PriceRange:()=>n,mergePriceRanges:()=>o});var s=i(389137);const r=(0,i(201089).getLogger)("Chart.PriceRange");class n{constructor(e,t){if(null!==e&&"object"==typeof e){const t=e;this._minValue=t.m_minValue,this._maxValue=t.m_maxValue}else{const i=e;this._minValue=i,void 0!==t&&(this._maxValue=t)}}equals(e){return this._minValue===e._minValue&&this._maxValue===e._maxValue}clone(){return new n(this._minValue,this._maxValue)}minValue(){return this._minValue}setMinValue(e){this._minValue=e}maxValue(){return this._maxValue}setMaxValue(e){this._maxValue=e}length(){return this._maxValue-this._minValue}isEmpty(){return this._maxValue===this._minValue||this._maxValue!=this._maxValue||this._minValue!=this._minValue}serialize(){return{m_maxValue:this._maxValue,m_minValue:this._minValue}}state(){return{max:this._maxValue,min:this._minValue}}merge(e){return new n(Math.min(this.minValue(),e.minValue()),Math.max(this.maxValue(),e.maxValue()))}apply(e,t){this._minValue=Math.min(this._minValue,e),this._maxValue=Math.max(this._maxValue,t)}set(e,t){this._minValue=e,this._maxValue=t}scaleAroundCenter(e){if(!(0,s.isNumber)(e))return void r.logDebug("PriceRange.scaleAroundCenter: invalid coeff");if(0===this._maxValue-this._minValue)return;const t=.5*(this._maxValue+this._minValue);let i=this._maxValue-t,n=this._minValue-t;i*=e,n*=e,this._maxValue=t+i,this._minValue=t+n}shift(e){(0,s.isNumber)(e)?(this._maxValue+=e,this._minValue+=e):r.logDebug("PriceRange.shift: invalid coeff")}containsStrictly(e){return e.minValue()>this._minValue&&e.maxValue()e?t?e.merge(t):e:t),null)}},152633:(e,t,i)=>{"use strict";i.d(t,{createPrimitiveProperty:()=>r});var s=i(190973);function r(e){return new s.default(e)}},738232:(e,t,i)=>{"use strict";i.d(t,{ThemedDefaultProperty:()=>b,extractAllPropertiesKeys:()=>v,extractState:()=>g,factoryDefaultsForCurrentTheme:()=>y});var s=i(852290),r=i(571059),n=i(316230),o=i(598279),a=i(138651),l=i(650151),d=i(62802),h=i(103221),u=i(331633),c=i(86746),_=i(190973),p=i(42292),f=i(707957);const m=(0,i(201089).getLogger)("ThemedDefaults");function v(e){const t=Object.keys(e),i=[];return t.forEach((t=>{const s=e[t];if((0,o.default)(s)){v(s).forEach((e=>i.push(`${t}.${e}`)))}else i.push(t)})),i}function g(e,t,i=""){const s={};return t.forEach((r=>{const n=r.split("."),a=n[0],l=e[a],d=""===i?a:`${i}.${a}`;if(e.hasOwnProperty(a))if(n.length>1){if(!(0,o.default)(l))return void m.logError(`path ${d} must be an object, but it is a primitive`);{const e=t.filter((e=>e.startsWith(`${a}.`))).map((e=>e.split(".").slice(1).join(".")));s[a]=g(l,e,d)}}else{if((0,o.default)(l))return void m.logError(`path ${d} must be a primitive, but it is an object`);s[a]=l}})),s}function y(e,t){var i;const r=null!==(i=u.watchedTheme.value())&&void 0!==i?i:c.StdTheme.Light,n=(0,h.deepCopy)(e);return(0,s.default)(n,(0,l.ensureDefined)(t.get(r))),n}function S(e,t){const i=(0,r.default)(e,((e,i,s)=>{if(void 0===t[s])return e ;if(!(0,n.default)(i,t[s]))if((0,o.default)(i)&&(0,o.default)(t[s])){const r=S(i,t[s]);void 0!==r&&(e[s]=r)}else e[s]=i;return e}),{});return(0,a.default)(i)?void 0:i}class b extends _.default{constructor({defaultName:e,defaultsSupplier:t,nonThemedDefaultsKeys:i,themedDefaultsKeys:r,allStateKeys:n,state:o}){super(),this._applyingThemeInProcess=!1,this._restoreFactoryDefaultsEvent=new f.Delegate,this._defaultName=e,this._defaultsSupplier=t,this._notThemedDefaultsKeys=i,this._themedDefaultsKeys=r,this._allStateKeys=n,this._allDefaultsKeys=[...i,...r],this.merge((0,s.default)(t(),this._userSettings(),o?g(o,n):void 0))}restoreFactoryDefaults(){const e=this._defaultsSupplier();this.mergeAndFire(e),this.saveDefaults(),this._restoreFactoryDefaultsEvent.fire()}onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}addExclusion(){}removeExclusion(){}state(){return g(super.state(),this._allStateKeys)}mergePreferences(e){this.mergeAndFire(g(e,this._allStateKeys))}childChanged(e,t){super.childChanged(e,t),!this._applyingThemeInProcess&&this._allDefaultsKeys.includes(t)&&this.saveDefaults()}saveDefaults(){const e=this.state(),t=this._defaultsSupplier();let i=S(g(e,this._notThemedDefaultsKeys),g(t,this._notThemedDefaultsKeys));const r=g(t,this._themedDefaultsKeys),n=g(e,this._themedDefaultsKeys),o=S(n,r);(0,a.default)(o)||(i=null!=i?i:{},(0,s.default)(i,n)),(0,p.saveDefaults)(this._defaultName,i)}preferences(){return g(super.state(),this._allDefaultsKeys)}_userSettings(){const e=d.getJSON(this._defaultName,null);if(e)return g((0,h.deepCopy)(e),this._allStateKeys)}}},369689:(e,t,i)=>{"use strict";i.d(t,{combineProperty:()=>r});var s=i(152633);function r(e,...t){const i=()=>e(...t.map((e=>e.value()))),r=(0,s.createPrimitiveProperty)(i()),n=()=>r.setValue(i()),o={};for(const e of t)e.subscribe(o,n);return r.destroy=()=>{t.forEach((e=>e.unsubscribeAll(o))),t.forEach((e=>e.release()))},r}},154718:(e,t,i)=>{"use strict";i(152633)},197050:(e,t,i)=>{"use strict";i.d(t,{combineProperty:()=>o.combineProperty,createWVFromGetterAndSubscription:()=>s.createWVFromGetterAndSubscription,createWVFromGetterAndSubscriptions:()=>r.createWVFromGetterAndSubscriptions,createWVFromProperty:()=>n.createWVFromProperty});var s=i(824837),r=i(784547),n=i(936515),o=(i(154718),i(369689))},784547:(e,t,i)=>{"use strict";i.d(t,{createWVFromGetterAndSubscriptions:()=>r});var s=i(401580);function r(e,t){const i=new s.WatchedValue(e()),r={};t.forEach((t=>t.subscribe(r,(()=>{i.setValue(e())}))));return i.readonly().spawn((()=>t.forEach((e=>e.unsubscribeAll(r)))))}},936515:(e,t,i)=>{"use strict";i.d(t,{createWVFromProperty:()=>r});var s=i(824837);function r(e){return(0,s.createWVFromGetterAndSubscription)((()=>e.value()),e)}},190973:(e,t,i)=>{"use strict";i.d(t,{default:()=>a});var s=i(428123),r=i(389137),n=i(707957);function o(e){return null===e||(!!isNumber(e)||("string"==typeof e||"boolean"==typeof e))}class a extends class{constructor(){this._listeners=new n.Delegate,this._muteChildChanges=!1,this._childs=[],this._dependents=[]}hasChild(e){ return this._childs.includes(e)}addProperty(e,t){const i=new a(t);this[e]=i,this._childs.push(e),i.subscribe(this,((t,i)=>this.childChanged(t,i?`${e}.${i}`:e)))}removeProperty(e){this[e].unsubscribeAll(this),delete this[e],this._childs=this._childs.filter((t=>t!==e))}addChild(e,t){const i=this;i[e]&&i[e].unsubscribeAll(this),i[e]=t,-1===this._childs.indexOf(e)&&this._childs.push(e),t.subscribe(this,((t,i)=>this.childChanged(t,i?`${e}.${i}`:e)))}childChanged(e,t){this._muteChildChanges||this._listeners.fire(this,t)}addDependent(e){this._dependents.push(e)}removeDependent(e){const t=this._dependents.indexOf(e);t>=0&&this._dependents.splice(t,1)}dependents(){return this._dependents}}{constructor(e){if(super(),void 0!==e)if(o(e))this._value=e;else for(var t in e)this.addProperty(t,e[t])}destroy(){this.listeners().destroy()}merge(e,t){var i=null;if(t)var s=(i=[]).length;if(void 0===e)return i;if(o(e))return t&&this._value!==e&&i.push(this),this._value=e,i;if(Array.isArray(e))for(var r=0;rs&&i.push(this),i}mergeAndFire(e){var t=this.merge(e,!0);this._muteChildChanges=!0,t.forEach((function(e){e._muteChildChanges=!0})),t.forEach((function(e){e._muteChildChanges=!1,e.listeners().fire(e)})),this._muteChildChanges=!1,t.length>0&&this.listeners().fire(this)}state(e){var t=(0,r.isFunction)(this.value)?this.value():void 0;void 0===t&&(t={});for(var i=0;i{"use strict";i.r(t),i.d(t,{QuotesProvider:()=>o});var s=i(876332),r=i(707957),n=i(541558);class o{constructor(e="full",t){var i;this._quotes=null,this._quoteSessionSymbol=null,this._quoteSessionClientId="",this._pausedQuoteSessionSymbol=null,this._quotesUpdate=new r.Delegate,this._quoteSymbolChanged=new r.Delegate,this._multiplexerType=e,this._hibernated=t,null===(i=this._hibernated)||void 0===i||i.subscribe((e=>{e?this.pause():this.resume()}))}setQuotesSessionSymbol(e){ this._quoteSessionSymbol!==e&&(this._pausedQuoteSessionSymbol=null,this._quoteSessionClientId||(this._quoteSessionClientId="series-"+(0,n.guid)()),this._unsubscribeQuoteSession(),this._quoteSessionSymbol=e,this._quoteSymbolChanged.fire(),e&&this._subscribeQuoteSession(e))}symbol(){return this._quoteSessionSymbol}quotesUpdate(){return this._quotesUpdate}quoteSymbolChanged(){return this._quoteSymbolChanged}quotes(){return this._quotes}async quotesSnapshot(e){return(0,s.getQuoteSessionInstance)("simple").snapshot(e)}isPaused(){return null!==this._pausedQuoteSessionSymbol}pause(){null===this._pausedQuoteSessionSymbol&&(this._pausedQuoteSessionSymbol=this._quoteSessionSymbol,this._unsubscribeQuoteSession())}resume(){null!==this._pausedQuoteSessionSymbol&&(this._subscribeQuoteSession(this._pausedQuoteSessionSymbol),this._pausedQuoteSessionSymbol=null)}destroy(){var e;this._unsubscribeQuoteSession(),null===(e=this._hibernated)||void 0===e||e.release()}_onUpdate(e,t){this._quotes=e&&e.values||null,t&&t.values&&this._quotesUpdate.fire(e,t)}_subscribeQuoteSession(e){this._quoteSessionSymbol=e,(0,s.getQuoteSessionInstance)(this._multiplexerType).subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,this._onUpdate.bind(this))}_unsubscribeQuoteSession(){this._quoteSessionSymbol&&((0,s.getQuoteSessionInstance)(this._multiplexerType).unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=null,this._quotes=null)}}},662080:(e,t,i)=>{"use strict";i.d(t,{iterateAndPatchObjectsByMap:()=>h,patchPropertiesAsync:()=>d});var s=i(650151),r=i(201089),n=i(345848),o=i(516684),a=i(957879);const l=(0,r.getLogger)("Pine.ScriptLib");function d(e,t,i,s){return l.logNormal("patchPropertiesAsync"),new Promise(((r,l)=>{if(!t.TVScriptMetaInfoExprs)return void r(e);const d=t.TVScriptMetaInfoExprs.tree,u=t.TVScriptMetaInfoExprs.patchMap;(function(e,t){(0,n.trackEvent)("Pine","ScriptLib.evalMetaInfoExprs");const i=a.Deferred(),s={username:window.user&&window.user.username,source:e,inputs:JSON.stringify(t||{})};return(0,o._pineFacadeAjax)("POST","/eval_pine_ex/",s).done(((e,t)=>{e.error?i.reject((0,o._readableError)(e.error,t)):e.success?i.resolve(e.result):i.reject((0,o.safetyGetReason)(e))})).fail((e=>{(0,o._anyRequestAsyncFail)(i,e)})),i.promise()})(d,i).done((i=>{if(!i)return void r(e);const n=i.rootValues;h([e,t.defaults,t],u,((e,t,i)=>{const r=n[i],o=e[0],a=e[1],l=e[2];(void 0===s||void 0!==s[i]&&s[i]!==r)&&(a.hasOwnProperty(t)?o[t].setValue(r):l[t]=r)})),void 0!==s&&Object.keys(n).forEach((e=>{void 0!==s[e]&&(s[e]=n[e])})),r(e)})).fail((e=>{l(e)}))}))}function h(e,t,i){const r=Object.keys(t);for(let n=0;n1,"Unexpectedly short json path");let d=[...e];for(let e=0;ee?e[t]:null))}i(d,l[l.length-1],a)}}},63316:(e,t,i)=>{"use strict";i.d(t,{SelectionIndexes:()=>r});var s=i(650151);class r{constructor(e){this._baseIndex=null,this._offsetInBar=null, this._offsetInTime=null,this._barsBetweenPoints=null,this._timescale=e}indexes(){const e=this._timescale.visibleBarsStrictRange();if(null===e)return[];const t=e.firstBar(),i=e.lastBar();if(null===this._offsetInTime||null===this._barsBetweenPoints){const e=this._timescale.barSpacing();this._barsBetweenPoints=Math.floor(120/e),this._offsetInBar=i%this._barsBetweenPoints,this._offsetInTime=this._timescale.indexToTimePoint(this._offsetInBar),this._baseIndex=this._timescale.baseIndex()}const r=this._timescale.baseIndex();this._baseIndex!==r&&(this._baseIndex=r,this._offsetInBar=(0,s.ensureNotNull)(this._timescale.timePointToIndex(this._offsetInTime)));const n=(0,s.ensureNotNull)(this._offsetInBar),o=[];let a=Math.floor((t-n)/this._barsBetweenPoints);const l=Math.floor((i-n)/this._barsBetweenPoints);for(;a<=l;a++)o.push(n+a*this._barsBetweenPoints);return o}clear(){this._offsetInBar=null,this._offsetInTime=null,this._baseIndex=null,this._barsBetweenPoints=null}}},230058:(e,t,i)=>{"use strict";i.d(t,{SelectionRenderer:()=>d});var s=i(934026),r=i(790188),n=i(315801),o=i(147354),a=i(43192);const l=r.colorsPalette["color-tv-blue-600"];class d extends a.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e||null}setData(e){this._data=e}hitTest(e){if(!this._data||!this._data.visible)return null;for(let t=0;t(0,s.pointInBox)(t,e)))}_drawImpl(e){if(null===this._data||!this._data.visible)return;const{context:t,horizontalPixelRatio:i}=e;t.strokeStyle=void 0!==this._data.color?this._data.color:l,t.lineCap="butt";const s=Math.max(1,Math.floor(i));t.lineWidth=s;const r=this._data.vertOffset||0;for(let i=0;i{"use strict";i.d(t,{SeriesBarColorer:()=>p});var s=i(790188),r=i(650151),n=i(488530),o=i(534741),a=i(938471);const l=(0,s.getHexColorByName)("color-minty-green-500"),d=(0,s.getHexColorByName)("color-ripe-red-500");function h(e){return{barColor:e.upColor.value(),barBorderColor:e.borderUpColor?e.borderUpColor.value():e.borderColor.value()}}function u(e){return{barColor:e.downColor.value(),barBorderColor:e.borderDownColor?e.borderDownColor.value():e.borderColor.value()}} function c(e,t){return e.borderUpColorProjection&&e.borderUpColor?{barColor:t?e.upColorProjection.value():e.upColor.value(),barBorderColor:t?e.borderUpColorProjection.value():e.borderUpColor.value()}:{barColor:t?e.upColorProjection.value():e.upColor.value()}}function _(e,t){return e.borderDownColorProjection&&e.borderDownColor?{barColor:t?e.downColorProjection.value():e.downColor.value(),barBorderColor:t?e.borderDownColorProjection.value():e.borderDownColor.value()}:{barColor:t?e.downColorProjection.value():e.downColor.value()}}class p extends a.AbstractBarColorer{constructor(e){super(),this._series=e}applyBarStyle(e,t,i,s){const r=i;r.barColor=void 0,r.barBorderColor=void 0,r.barWickColor=void 0,r.isBarHollow=void 0,r.isBarUp=void 0,r.upColor=void 0,r.downColor=void 0,r.isTwoColorBar=void 0,r.isMergedBar=void 0;const n=this._series.properties();switch(n.childs().style.value()){case 2:case 18:case 14:case 15:this._applyLineStyle(i,n);break;case 3:this._applyAreaStyle(i,n);break;case 16:this._applyHLCAreaStyle(e,t,i,s,n);break;case 0:this._applyBarStyle(e,i,s,n);break;case 17:case 1:case 19:this._applyCandleStyle(e,i,s,n);break;case 9:this._applyHollowCandleStyle(e,i,s,n);break;case 8:this._applyHAStyle(e,t,i,s,n);break;case 10:this._applyBaseLineStyle(e,t,i,s,n);break;case 12:this._applyHiLoStyle(t,i,n);break;case 13:this._applyColumnStyle(e,i,s,n);break;case 4:this._applyRenkoStyle(e,t,i,s,n);break;case 7:this._applyPBStyle(e,t,i,s,n);break;case 5:this._applyKagiStyle(e,t,i,s,n);break;case 6:this._applyPnfStyle(e,t,i,s,n);break;case 11:this._applyRangeStyle(e,t,i,s,n)}return i}static upColor(e,t){const i=e.childs(),s=i.style.value();switch(s){case 18:return{barColor:i.tpoStyle.childs().color.value()};case 2:return{barColor:i.lineStyle.childs().color.value()};case 14:return{barColor:i.lineWithMarkersStyle.childs().color.value()};case 15:return{barColor:i.steplineStyle.childs().color.value()};case 3:return{barColor:i.areaStyle.childs().linecolor.value()};case 16:return{barColor:i.hlcAreaStyle.childs().closeLineColor.value(),barBorderColor:l};case 0:return{barColor:i.barStyle.childs().upColor.value()};case 17:return h(i.volFootprintStyle.childs());case 19:return h(i.volCandlesStyle.childs());case 1:return h(i.candleStyle.childs());case 9:return h(i.hollowCandleStyle.childs());case 8:return h(i.haStyle.childs());case 10:return{barColor:i.baselineStyle.childs().topLineColor.value()};case 12:return{barColor:i.hiloStyle.childs().color.value(),barBorderColor:e.childs().hiloStyle.childs().borderColor.value()};case 13:return{barColor:i.columnStyle.childs().upColor.value()};case 4:return c(i.renkoStyle.childs(),t);case 7:return c(i.pbStyle.childs(),t);case 5:return c(i.kagiStyle.childs(),t);case 6:return c(i.pnfStyle.childs(),t);case 11:0;const s=i.rangeStyle.childs(),r=s.barStyle.value()===n.RangeBarStyle.Bars;return{barColor:t?s.upColorProjection.value():r?s.upColor.value():s.candlesUpColor.value(),barBorderColor:t?s.upColorProjection.value():r?s.upColor.value():s.candlesBorderUpColor.value()}}(0,r.ensureNever)(s)} static downColor(e,t){const i=e.childs(),s=i.style.value();switch(s){case 2:return{barColor:i.lineStyle.childs().color.value()};case 18:return{barColor:i.tpoStyle.childs().color.value()};case 14:return{barColor:i.lineWithMarkersStyle.childs().color.value()};case 15:return{barColor:i.steplineStyle.childs().color.value()};case 3:return{barColor:i.areaStyle.childs().linecolor.value()};case 16:return{barColor:i.hlcAreaStyle.childs().closeLineColor.value(),barBorderColor:d};case 0:return{barColor:i.barStyle.childs().downColor.value()};case 17:return u(i.volFootprintStyle.childs());case 1:return u(i.candleStyle.childs());case 19:return u(i.volCandlesStyle.childs());case 9:return u(i.hollowCandleStyle.childs());case 8:return u(i.haStyle.childs());case 10:return{barColor:i.baselineStyle.childs().bottomLineColor.value()};case 12:return{barColor:i.hiloStyle.childs().color.value(),barBorderColor:e.childs().hiloStyle.childs().borderColor.value()};case 13:return{barColor:i.columnStyle.childs().downColor.value()};case 4:return _(i.renkoStyle.childs(),t);case 7:return _(i.pbStyle.childs(),t);case 5:return _(i.kagiStyle.childs(),t);case 6:return _(i.pnfStyle.childs(),t);case 11:0;const s=i.rangeStyle.childs(),r=s.barStyle.value()===n.RangeBarStyle.Bars;return{barColor:t?s.downColorProjection.value():r?s.downColor.value():s.candlesDownColor.value(),barBorderColor:t?s.downColorProjection.value():r?s.downColor.value():s.candlesBorderDownColor.value()}}(0,r.ensureNever)(s)}_applyLineStyle(e,t){e.barColor=p.upColor(t).barColor}_applyAreaStyle(e,t){e.barColor=p.upColor(t).barColor}_applyHLCAreaStyle(e,t,i,s,r){var n;const o=this._isUp(e,!1,s,(null===(n=this._series.data().first())||void 0===n?void 0:n.index)!==e)?p.upColor(r,t):p.downColor(r,t);i.barColor=o.barColor,i.barBorderColor=o.barBorderColor}_applyBarStyle(e,t,i,s){const r=this._isUp(e,!1,i,s.childs().barStyle.childs().barColorsOnPrevClose.value())?p.upColor(s):p.downColor(s);t.barColor=r.barColor,t.barBorderColor=r.barBorderColor}_applyCandleStyle(e,t,i,s){var r;const n=s.childs(),o=1===n.style.value()?n.candleStyle.childs():19===n.style.value()?n.volCandlesStyle.childs():n.volFootprintStyle.childs(),a=this._isUp(e,!1,i,o.barColorsOnPrevClose.value()&&(null===(r=this._series.data().first())||void 0===r?void 0:r.index)!==e),l=a?p.upColor(s):p.downColor(s);t.barColor=l.barColor,t.barBorderColor=l.barBorderColor,t.barWickColor=a?o.wickUpColor?o.wickUpColor.value():o.wickColor.value():o.wickDownColor?o.wickDownColor.value():o.wickColor.value()}_applyHollowCandleStyle(e,t,i,s){var r;const n=s.childs().hollowCandleStyle.childs(),o=this._isUp(e,!1,i,(null===(r=this._series.data().first())||void 0===r?void 0:r.index)!==e),a=o?p.upColor(s):p.downColor(s);t.barColor=a.barColor,t.barBorderColor=a.barBorderColor,t.barWickColor=o?n.wickUpColor?n.wickUpColor.value():n.wickColor.value():n.wickDownColor?n.wickDownColor.value():n.wickColor.value();const l=this._findBar(e,!1,i);t.isBarHollow=l[1]<=l[4]}_applyHAStyle(e,t,i,s,r){ const n=r.childs().haStyle.childs(),o=this._isUp(e,t,s,n.barColorsOnPrevClose.value()),a=o?p.upColor(r):p.downColor(r);i.barColor=a.barColor,i.barBorderColor=a.barBorderColor,i.barWickColor=o?n.wickUpColor.value():n.wickDownColor.value()}_applyBaseLineStyle(e,t,i,s,n){const o=this._findBar(e,t,s),a=n.childs().baselineStyle.childs(),l=this._series.priceScale(),d=Math.round(l.height()*(Math.abs(100-a.baseLevelPercentage.value())/100)),h=(0,r.ensureNotNull)(this._series.firstValue()),u=l.coordinateToPrice(d,h);o[4]>u?i.barColor=p.upColor(n,t).barColor:i.barColor=p.downColor(n,t).barColor}_applyHiLoStyle(e,t,i){const s=p.upColor(i,e);t.barColor=s.barColor,t.barBorderColor=s.barBorderColor}_applyColumnStyle(e,t,i,s){const r=s.childs().columnStyle.childs(),n=this._isUp(e,!1,i,r.barColorsOnPrevClose.value())?p.upColor(s):p.downColor(s);t.color=n.barColor,t.barColor=t.color}_applyRenkoStyle(e,t,i,s,r){const n=r.childs().renkoStyle.childs(),o=this._isUp(e,t,s,!1),a=o?p.upColor(r,t):p.downColor(r,t);i.barColor=a.barColor,i.barBorderColor=a.barBorderColor,i.barWickColor=o?n.wickUpColor.value():n.wickDownColor.value(),i.isBarUp=o}_applyPBStyle(e,t,i,s,r){const n=this._isUp(e,t,s,!1),o=n?p.upColor(r,t):p.downColor(r,t);i.barColor=o.barColor,i.barBorderColor=o.barBorderColor,i.isBarUp=n}_applyKagiStyle(e,t,i,s,r){let n;i.upColor=p.upColor(r,t).barColor,i.downColor=p.downColor(r,t).barColor;const o=this._findBar(e,t,s);o[3]0,a=p.upColor(r,t),l=p.downColor(r,t);i.isBarUp=o,i.isMergedBar=2===Math.abs(n),i.upColor=a.barColor,i.downColor=l.barColor,i.barColor=o?a.barColor:l.barColor}_applyRangeStyle(e,t,i,s,r){const o=r.childs().rangeStyle.childs(),a=o.barStyle.value()===n.RangeBarStyle.Bars,l=this._isUp(e,!1,s,!1),d=l?p.upColor(r,t):p.downColor(r,t),h=l?t?o.upColorProjection.value():a?void 0:o.candlesWickUpColor.value():t?o.downColorProjection.value():a?void 0:o.candlesWickDownColor.value();i.barColor=d.barColor,i.barBorderColor=d.barBorderColor,i.wickColor=h,i.barWickColor=h}_findBar(e,t,i){return i?i.value:this._getSeriesBars(t).valueAt(e)||[]}_findPrevBar(e,t,i){if(i&&i.previousValue)return i.previousValue;const s=this._series.bars().search(e-1,o.PlotRowSearchMode.NearestLeft,4);return null!==s?s.value:[]}_getSeriesBars(e){return e?this._series.nsBars():this._series.bars()}_isUp(e,t,i,s){const r=this._findBar(e,t,i);if(s){return this._findPrevBar(e,t,i)[4]<=r[4]}return r[1]<=r[4]}}},3140:(e,t,i)=>{"use strict";i.d(t,{SeriesTimeRangeVolumeCalculator:()=>s});class s{constructor(e){this._value=null,this._series=e,this._series.dataEvents().dataUpdated().subscribe(this,this._onSeriesUpdated)}destroy(){this._series.dataEvents().dataUpdated().unsubscribeAll(this)}volume(e,t){if(null!==this._value&&this._value.from===e&&this._value.to===t)return this._value.value;let i=0 ;const s=this._series.data().bars(),r=s.firstIndex(),n=s.lastIndex();if(null!==r&&en&&t>n)i=NaN;else{const s=this._series.data().bars().rangeIterator(Math.min(e,t),Math.max(e,t));for(const e of s){const t=e.value[5];if(void 0===t){i=NaN;break}i+=t}}return this._value={from:e,to:t,value:i},i}_onSeriesUpdated(e,t){if(null===this._value)return;if(t)return void(this._value=null);const i=this._series.data().bars().lastIndex();(null===i||i<=this._value.to)&&(this._value=null)}}},904891:(e,t,i)=>{"use strict";i.d(t,{SeriesAreaPaneView:()=>l});var s=i(246733),r=i(413225),n=i(142119),o=i(230058),a=i(143389);class l extends a.SeriesSingleLinePaneView{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs().areaStyle.childs(),i=t.transparency.value(),a={simpleMode:!1,barSpacing:this._model.timeScale().barSpacing(),items:this._items,lineColor:t.linecolor.value(),lineStyle:t.linestyle.value(),lineWidth:t.linewidth.value(),isSeries:!0,withMarkers:!1,bottom:e.height(),color1:(0,s.generateColor)(t.color1.value(),i),color2:(0,s.generateColor)(t.color2.value(),i),skipHoles:!0},l=new n.CompositeRenderer;return l.append(new r.PaneRendererArea(a)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&l.append(new o.SelectionRenderer(this._selectionData)),l}}},969419:(e,t,i)=>{"use strict";i.d(t,{PaneRendererBars:()=>n});var s=i(9640),r=i(756930);class n extends r.PaneRendererSeriesBase{constructor(e){super(),this._bars=e.bars,this._dontDrawOpen=e.dontDrawOpen,this._thinBars=e.thinBars}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;t.save();let r=null;for(const e of this._bars){let n=this._calcRealBarWidth(e.right-e.left,i);if(n>=2){Math.max(1,Math.floor(i))%2!=n%2&&n--}const o=this._thinBars?Math.min(n,Math.floor(i)):n,a=o<=n&&e.right-e.left>=Math.floor(1.5*i);r!==e.color&&(t.fillStyle=e.color,r=e.color);const l=Math.floor(.5*o),d=Math.round(e.center*i),h=d-l,u=o,c=h+u-1,_=Math.min(e.high,e.low),p=Math.max(e.high,e.low),f=Math.round(_*s)-l,m=Math.round(p*s)+l,v=Math.max(m-f,o);t.fillRect(h,f,u,v);const g=Math.ceil(1.5*n);if(a){const i=d-g,r=d+g,n=Math.min(h-i,r-c);if(!this._dontDrawOpen){let r=Math.max(f,Math.round(e.open*s)-l),o=r+u-1;o>f+v-1&&(o=f+v-1,r=o-u+1),t.fillRect(i,r,n,o-r+1)}let o=Math.max(f,Math.round(e.close*s)-l),a=o+u-1;a>f+v-1&&(a=f+v-1,o=a-u+1),t.fillRect(c+1,o,n,a-o+1)}}t.restore()}_getTolerance(){return(0,s.interactionTolerance)().series}_calcRealBarWidth(e,t){const i=Math.floor(t);return Math.max(i,Math.floor((0,s.optimalBarWidth)(e,t)))}}},825278:(e,t,i)=>{"use strict";i.d(t,{SeriesBarsPaneView:()=>a});var s=i(142119),r=i(230058),n=i(891512),o=i(969419);class a extends n.SeriesBarCandlesPaneView{renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1);const e=this._source.properties().childs(),t={bars:this._bars,dontDrawOpen:e.barStyle.childs().dontDrawOpen.value(), thinBars:11===e.style.value()?e.rangeStyle.childs().thinBars.value():e.barStyle.childs().thinBars.value()},i=new s.CompositeRenderer;return i.append(new o.PaneRendererBars(t)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&i.append(new r.SelectionRenderer(this._selectionData)),i}_createItem(e,t,i){const s={center:NaN,open:NaN,high:NaN,low:NaN,close:NaN,color:i.barColor,left:NaN,right:NaN,timePointIndex:e};return(0,n.baseBarCandlesUpdater)(t,s)?s:null}}},255799:(e,t,i)=>{"use strict";i.d(t,{SeriesBaselinePaneView:()=>f});var s=i(246733),r=i(142119),n=i(86441),o=i(5531),a=i(204652),l=i(9640),d=i(674981),h=i(710455),u=i(315801);class c extends h.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){if(null===this._data)return null;const{items:t,topLineWidth:i,bottomLineWidth:s}=this._data,r=(0,l.interactionTolerance)().series+(i+s)/4,o=(0,d.lowerbound)(t,e,((e,t)=>e.center<=t.x)),h=Math.max(1,o-1),c=Math.min(t.length-1,o+1);for(let i=h;i<=c;++i){const s=t[i-1],o=t[i],{distance:l}=(0,a.distanceToSegment)((0,n.point)(s.center,s.y),(0,n.point)(o.center,o.y),(0,n.point)(e.x,e.y));if(l<=r)return new u.HitTestResult(u.HitTarget.Regular)}return null}_drawImpl(e){if(null===this._data)return;const{items:t,baseLevelCoordinate:i,bottom:s,bottomFillColor1:r,bottomFillColor2:a,topFillColor1:d,topFillColor2:h,topLineColor:u,bottomLineColor:c,topLineWidth:_,bottomLineWidth:p}=this._data;if(!function(e){if(0===e.length)return!1;const t=e.findIndex((e=>(0,l.coordinateIsValid)(e.y)));if(-1===t)return!1;let i=e.length-1;for(;i>t&&!(0,l.coordinateIsValid)(e[i].y);)i--;return!(t>i)}(t))return;const f=e.context,{topItems:m,bottomItems:v}=function(e,t){const i=[],s=[];let r=null;for(let a=0;a=t&&s.push(d),r=d;else{if(null===r)continue;d=r}if((0,l.coordinateIsValid)(h.y)&&(d.y>t&&h.yt))if(Math.abs(d.center-h.center)<1){const e={center:d.center,y:t};i.push(e),s.push(e)}else{const e=(0,o.intersectLineSegments)((0,n.point)(d.center,d.y),(0,n.point)(h.center,h.y),(0,n.point)(d.center,t),(0,n.point)(h.center,t));if(null!==e){const t={center:d.center+(h.center-d.center)*e,y:d.y+(h.y-d.y)*e};i.push(t),s.push(t)}}}return{topItems:i,bottomItems:s}}(t,i);f.lineCap="round",f.lineJoin="round",0!==m.length&&(f.beginPath(),f.moveTo(m[0].center,i),this._makeLine(f,m,!0,0),f.closePath(),f.fillStyle=this._makeLinearGradient(f,d,h,i-s,i),f.fill(),f.beginPath(),this._makeLine(f,m,!1,0),f.lineWidth=_,f.strokeStyle=u,f.stroke()),0!==v.length&&(f.beginPath(),f.moveTo(v[0].center,i),this._makeLine(f,v,!0,1),f.closePath(),f.fillStyle=this._makeLinearGradient(f,r,a,i,i+s),f.fill(),f.beginPath(),this._makeLine(f,v,!1,1),f.lineWidth=p,f.strokeStyle=c,f.stroke())}_makeLine(e,t,i,s){if(null===this._data)return;const r=t.findIndex((e=>(0,l.coordinateIsValid)(e.y)));if(-1===r)return;const{barSpacing:n,baseLevelCoordinate:o}=this._data,a=.25*n;let d ;const h=t.length;for(let n=r;n=o&&h.y>=o){e.moveTo(h.center,h.y);continue}}else if(d&&d.y<=o&&h.y<=o){e.moveTo(h.center,h.y);continue}if(d&&(0,l.coordinateIsValid)(d.y))e.lineTo(h.center,h.y),i&&!(0,l.coordinateIsValid)(u.y)&&e.lineTo(h.center,o);else if(u&&(0,l.coordinateIsValid)(u.y))i?(n!==r&&e.lineTo(h.center,o),e.lineTo(h.center,h.y)):e.moveTo(h.center,h.y);else if(i){if(0===n)continue;n!==r&&e.lineTo(h.center-a,o),e.lineTo(h.center-a,h.y),e.lineTo(h.center+a,h.y),e.lineTo(h.center+a,o)}else e.moveTo(h.center-a,h.y),e.lineTo(h.center+a,h.y);d=h}}}_makeLinearGradient(e,t,i,s,r){const n=e.createLinearGradient(0,s,0,r);return n.addColorStop(0,t),n.addColorStop(1,i),n}}var _=i(230058),p=i(143389);class f extends p.SeriesSingleLinePaneView{constructor(){super(...arguments),this._renderer=new c,this._topFillColor1="",this._topFillColor2="",this._bottomFillColor1="",this._bottomFillColor2="",this._topLineColor="",this._bottomLineColor="",this._topLineWidth=0,this._bottomLineWidth=0,this._barSpacing=0,this._bottom=0,this._baseLevelCoordinate=0}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer.setData({items:this._items,topFillColor1:this._topFillColor1,topFillColor2:this._topFillColor2,bottomFillColor1:this._bottomFillColor1,bottomFillColor2:this._bottomFillColor2,topLineColor:this._topLineColor,bottomLineColor:this._bottomLineColor,topLineWidth:this._topLineWidth,bottomLineWidth:this._bottomLineWidth,barSpacing:this._barSpacing,baseLevelCoordinate:this._baseLevelCoordinate,bottom:this._bottom});const e=new r.CompositeRenderer;return e.append(this._renderer),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&e.append(new _.SelectionRenderer(this._selectionData)),e}_updateImpl(){super._updateImpl();const e=this._source.priceScale();if(!e)return;const t=this._source.properties().childs().baselineStyle.childs(),i=t.transparency.value();this._topFillColor1=(0,s.generateColor)(t.topFillColor1.value(),i),this._topFillColor2=(0,s.generateColor)(t.topFillColor2.value(),i),this._bottomFillColor1=(0,s.generateColor)(t.bottomFillColor1.value(),i),this._bottomFillColor2=(0,s.generateColor)(t.bottomFillColor2.value(),i),this._topLineColor=t.topLineColor.value(),this._bottomLineColor=t.bottomLineColor.value(),this._topLineWidth=t.topLineWidth.value(),this._bottomLineWidth=t.bottomLineWidth.value(),this._barSpacing=this._model.timeScale().barSpacing(),this._bottom=e.height(),this._baseLevelCoordinate=Math.round(this._bottom*(Math.abs(100-t.baseLevelPercentage.value())/100))}}},147664:(e,t,i)=>{"use strict";i.d(t,{SeriesWaterlinePaneView:()=>a});var s=i(955831),r=i(147354),n=i(315801),o=i(458963);class a extends s.HorizontalLinePaneView{constructor(e){super(),this._getters=e;const t={cursorType:r.PaneCursorType.VerticalResize,activeItem:0,areaName:n.AreaName.SourceItemMove};this._lineRenderer.setHitTest(new n.HitTestResult(n.HitTarget.MovePoint,t)), this._lineRendererData.visible=!0,this._lineRendererData.linestyle=o.LINESTYLE_SPARSE_DOTTED}_updateImpl(){const{baseLevelPercentage:e,paneHeight:t,color:i}=this._getters,s=Math.abs(100-e());this._lineRendererData.y=Math.round(t()*(s/100)),this._lineRendererData.color=i()}}},756930:(e,t,i)=>{"use strict";i.d(t,{PaneRendererSeriesBase:()=>n});var s=i(315801),r=i(43192);class n extends r.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._bars=[]}hitTest(e){const t=this._bars;if(0===t.length)return null;const i=this._getTolerance(),s=t[0],r=t[t.length-1];if(e.xr.right+i)return null;let n=0,o=t.length-1,a=-1;for(;n<=o;){const i=Math.floor((n+o)/2),s=t[i];if(e.x>=s.left&&e.x<=s.right){a=i;break}e.x>s.right?n=i+1:o=i-1}if(-1===a)return null;if(this._isPointAtBar(t[a],e.y,i))return this._getHitTest();let l=a;for(;l>=1&&e.x-t[l-1].right{"use strict";i.d(t,{PaneRendererCandles:()=>d});var s=i(650151),r=i(315801),n=i(787123),o=i(9640),a=i(756930);function l(e,t,i,s){const r=Math.floor(t);return e.map((e=>{let n=(0,o.optimalCandlestickWidth)((e.right-e.left)*s,t);n>=2&&r%2!=n%2&&n--;const a=Math.floor(.5*n),l=function(e,t){let i=Math.floor(1*t);e<=2*i&&(i=Math.floor(.5*(e-1)));const s=Math.max(Math.floor(t),i);if(e<=2*s)return Math.max(Math.floor(t),Math.floor(1*t));return s}(n,t),d=Math.round(e.center*t),h=d-a,u=h+n-1,c=Math.abs(Math.max(e.open,e.close)-Math.min(e.open,e.close))*i,_=Math.round(Math.min(e.open,e.close)*i),p=Math.round(Math.max(e.open,e.close)*i);let f=Math.min(Math.floor(t),Math.floor(n*t));f=Math.max(Math.floor(t),Math.min(f,n));const m=Math.floor(.5*f);return{rawBodyHeight:c,top:_,bottom:p,center:d,left:h,right:u,candleWidth:n,high:Math.round(e.high*i),low:Math.round(e.low*i),wickWidth:f,wickOffset:m,borderWidth:l}}))}class d extends a.PaneRendererSeriesBase{constructor(e){super(),this._scaleCoeff=1,this._borderVisible=!1,this._wickVisible=!1,this._bodyVisible=!0,this._borderColor=void 0,this._wickColor=void 0,this._hittest=void 0,this._isPriceScaleInverted=!1,e&&this.setData(e)}setData(e){var t;this._bars=e.bars,this._scaleCoeff=null!==(t=e.scaleCoeff)&&void 0!==t?t:1,this._borderVisible=e.borderVisible,this._bodyVisible=e.bodyVisible,this._wickVisible=e.wickVisible,this._borderColor=e.borderColor,this._wickColor=e.wickColor,this._hittest=e.hittest,this._isPriceScaleInverted=e.isPriceScaleInverted}hitTest(e){return this._wickVisible||this._borderVisible||this._bodyVisible?super.hitTest(e):null}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;if(0===this._bars.length)return;const r=l(this._bars,i,s,this._scaleCoeff);this._wickVisible&&this._drawWicks(t,r), this._borderVisible&&this._drawBorder(t,r),this._bodyVisible&&this._drawCandles(t,r)}_getTolerance(){return(0,o.interactionTolerance)().series}_getHitTest(){return this._hittest||new r.HitTestResult(r.HitTarget.Regular)}_isPointAtBar(e,t,i){const s=this._bodyVisible||this._borderVisible,r=this._wickVisible;if(!s&&!r)return!1;if(s){const s=r?Math.min(e.high,e.low):Math.min(e.open,e.close),n=r?Math.max(e.high,e.low):Math.max(e.open,e.close);return s-i<=t&&t<=n+i}{const s=Math.min(e.open,e.close),r=Math.max(e.open,e.close);return e.high-i<=t&&t<=s+i||r-i<=t&&t<=e.low+i}}_drawWicks(e,t){let i="",r=null;this._bars.forEach(((n,o)=>{const a=n.wickColor?n.wickColor:(0,s.ensureDefined)(this._wickColor);a!==i&&(e.fillStyle=a,i=a);let{top:l,bottom:d}=t[o];const{rawBodyHeight:h,borderWidth:u,center:c,high:_,low:p,wickWidth:f,wickOffset:m}=t[o];this._isPriceScaleInverted&&([d,l]=[l,d]);let v=c-m;const g=v+f-1;null!==r&&(v=Math.max(r+1,v),v=Math.min(v,g));const y=g-v+1;h<=u&&(l!==_&&(l=Math.round(l-.5*u)),d=d!==p?Math.round(l-.5*u)+u-1:p-1),l!==_&&e.fillRect(v,_,y,l-_),p-d-1&&e.fillRect(v,d+1,y,p-d-1),r=g}))}_drawBorder(e,t){let i="",r=null;this._bars.forEach(((o,a)=>{if(o.borderColor!==i&&(e.fillStyle=o.borderColor?o.borderColor:(0,s.ensureDefined)(this._borderColor),i=o.borderColor),this._bodyVisible&&o.hollow)return;let{left:l}=t[a];const{rawBodyHeight:d,top:h,bottom:u,right:c,borderWidth:_}=t[a];null!==r&&(l=Math.max(r+1,l),l=Math.min(l,c));const p=c-l+1;d<=_?e.fillRect(l,Math.round(h-.5*_),p,_):p>2*_?(0,n.fillRectInnerBorder)(e,l,h,c-l+1,u-h+1,_):e.fillRect(l,h,p,u-h+1),r=c}))}_drawCandles(e,t){let i="";this._bars.forEach(((s,r)=>{let{top:o,bottom:a,left:l,right:d}=t[r];const{rawBodyHeight:h,borderWidth:u,candleWidth:c}=t[r];if(!(this._borderVisible&&c<=2*u)||s.hollow){if(s.color!==i){const t=s.color;e.fillStyle=t,i=t}if(s.hollow)e.fillStyle=s.color,h<=u?e.fillRect(l,Math.round(o-.5*u),c,u):(0,n.fillRectInnerBorder)(e,l,o,d-l+1,a-o+1,u);else{if(!this._borderVisible&&h<=u)return void e.fillRect(l,Math.round(o-.5*u),c,u);if(this._borderVisible&&(l+=u,o+=u,d-=u,a-=u),o>a)return;e.fillRect(l,o,d-l+1,a-o+1)}}}))}}},245242:(e,t,i)=>{"use strict";i.d(t,{SeriesCandlesPaneView:()=>l});var s=i(142119),r=i(9640),n=i(230058),o=i(891512),a=i(956725);class l extends o.SeriesBarCandlesPaneView{constructor(e,t,i=1){super(e,t),this._scaleCoeff=1,this._scaleCoeff=i}renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1);const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs(),i=1===t.style.value()?t.candleStyle.childs():19===t.style.value()?t.volCandlesStyle.childs():t.volFootprintStyle.childs(),o=this._model.timeScale().barSpacing(),l={bars:this._bars,barSpacing:o,bodyVisible:i.drawBody.value(),borderVisible:i.drawBorder.value(),borderColor:i.borderColor.value(),wickColor:i.wickColor.value(),barWidth:(0,r.optimalBarWidth)(o),wickVisible:i.drawWick.value(),isPriceScaleInverted:e.isInverted(),scaleCoeff:this._scaleCoeff},d=new s.CompositeRenderer ;return d.append(new a.PaneRendererCandles(l)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&d.append(new n.SelectionRenderer(this._selectionData)),d}_createItem(e,t,i){const s={center:NaN,open:NaN,high:NaN,low:NaN,close:NaN,left:NaN,right:NaN,timePointIndex:e,color:i.barColor,borderColor:i.barBorderColor,wickColor:i.barWickColor,hollow:i.isBarHollow};return(0,o.baseBarCandlesUpdater)(t,s)?s:null}}},72731:(e,t,i)=>{"use strict";i.d(t,{SeriesColumnsPaneView:()=>_});var s=i(650151),r=i(86441),n=i(244842),o=i(203308),a=i(315801),l=i(142119),d=i(534741),h=i(63316),u=i(230058),c=i(793907);class _{constructor(e,t){this._items=[],this._invalidated=!0,this._isMarkersEnabled=(0,n.enabled)("source_selection_markers"),this._selectionData=null,this._histogramBase=0,this._source=e,this._model=t,this._selectionIndexer=new h.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={barSpacing:this._model.timeScale().barSpacing(),items:this._items,lineColor:"",histogramBase:this._histogramBase},t=new l.CompositeRenderer;return t.append(new c.PaneRendererColumns(e)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&t.append(new u.SelectionRenderer(this._selectionData)),t}_updateImpl(){this._items=[];const e=this._model.timeScale(),t=this._source.priceScale();if(e.isEmpty()||!t||t.isEmpty())return;const i=e.visibleBarsStrictRange();if(null===i)return;if(0===this._source.bars().size())return;const n=this._source.nearestIndex(i.firstBar(),d.PlotRowSearchMode.NearestRight),l=this._source.nearestIndex(i.lastBar(),d.PlotRowSearchMode.NearestLeft);if(void 0===n||void 0===l)return;const h=this._source.bars().range(n,l),u=this._source.barColorer(),c={},_=this._source.barFunction(),p=h.reduce(((e,t,s)=>{const r=_(s);if(!(0,o.default)(r))return e;c.value=s;let n=this._source.precomputedBarStyle(s);return void 0===n&&(n=u.barStyle(t,!1,c),this._source.setPrecomputedBarStyle(s,n)),this._items.push({timePointIndex:t,left:NaN,center:NaN,right:NaN,y:r,style:n}),c.previousValue=s,i.contains(t)&&null!=e?e:r}),null);if(null!==p)if(t.pointsArrayToCoordinates(this._items,p),e.fillBarBorders(this._items),this._histogramBase=t.isInverted()?0:t.height(),this._model.selection().isSelected(this._source)){const i=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,barSpacing:e.barSpacing(),hittestResult:a.HitTarget.Regular};const n=(0,s.ensureNotNull)(this._model.paneForSource(this._source)).height();this._selectionData.hittestResult=a.HitTarget.Regular;for(let s=0;s{"use strict";i.d(t,{SeriesHiLoPaneView:()=>m}) ;var s=i(448874),r=i(511131),n=i(674981),o=i(9640),a=i(315801),l=i(710455);class d extends l.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._barWidth=null}setData(e){this._data=e,this._barWidth=Math.max(1,Math.round((0,o.optimalHiLoWidth)(e.barSpacing)))}hitTest(e){if(null===this._data||null===this._barWidth)return null;const t=this._data.bars,i=.5*this._data.barSpacing;if(0===t.length)return null;if(e.xt[t.length-1].center+i)return null;const s=t[(0,n.lowerbound)(t,e.x-i,((e,t)=>e.centers.center+i)return null;const r=(0,o.interactionTolerance)().series+this._barWidth/2,l=Math.min(s.high,s.low),d=Math.max(s.high,s.low),h=this._data.fontSize;return l-r-h<=e.y&&e.y<=l+r||d-r<=e.y&&e.y<=d+r+h?new a.HitTestResult(a.HitTarget.Regular):null}_drawImpl(e){if(null===this._data||null===this._barWidth)return;const{font:t,fontSize:i,labelColor:s,bars:n,inverted:o,labelsPadding:a}=this._data,l=e.context;l.textAlign="center",l.fillStyle=s,l.font=(0,r.makeFont)(i,t);for(let e=0;eMath.max(1,(0,n.lowerboundExt)((e=>e+1),null,(i=>{const s=(0,r.makeFont)(i,c.CHART_FONT_FAMILY);return(0,_.measureText)(e,s).width<=t}),7,36))),((e,t)=>`${e}/${t}`))}renderer(){const e=this._source.priceScale();if(!e||e.isEmpty())return null;const t=new h.CompositeRenderer,i=this._needLabels(),s=this._source.properties().childs().hiloStyle.childs(),r=this._model.timeScale().barSpacing();if(this._invalidated){const e=this._source.formatter();this._maxLengthLabel="",this._updateImpl({generateLabels:i,formatter:e}),this._invalidated=!1}if(this._candlesRenderer.setData({bars:this._bars,wickVisible:!1,bodyVisible:s.drawBody.value(),barSpacing:r,borderVisible:s.showBorders.value(),barWidth:(0,o.optimalHiLoWidth)(r),isPriceScaleInverted:e.isInverted()}),t.append(this._candlesRenderer),i){const i=this._calculateLabelFontSize();i&&i>=8&&(this._labelsRenderer.setData({bars:this._bars,barSpacing:r,font:c.CHART_FONT_FAMILY,fontSize:i,labelColor:s.labelColor.value(),inverted:e.isInverted(),labelsPadding:.4*i}),t.append(this._labelsRenderer))}return this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&t.append(new u.SelectionRenderer(this._selectionData)),t}topPixelMargin(){return this._margin()}bottomPixelMargin(){return this._margin()}_createItem(e,t,i,s){const r={center:NaN,left:NaN,right:NaN,open:NaN,high:NaN,low:NaN,close:NaN,color:i.barColor,borderColor:i.barBorderColor,hollow:!1, highLabel:"",lowLabel:"",timePointIndex:e};if(!(0,f.baseBarCandlesUpdater)(t,r))return null;if(r.open=r.high,r.close=r.low,s.generateLabels){const e=s.formatter.format(r.high),t=s.formatter.format(r.low);r.highLabel=e,r.lowLabel=t;const i=(e.length>t.length?e:t).replace(/\d/g,"0");i.length>this._maxLengthLabel.length&&(this._maxLengthLabel=i)}return r}_margin(){if(this._needLabels()){const e=this._calculateLabelFontSize();if(e&&e>=8)return 1.4*e}return 0}_calculateLabelFontSize(){return""===this._maxLengthLabel?null:this._calculateFontSize(this._maxLengthLabel,Math.floor(this._model.timeScale().barSpacing())-2)}_needLabels(){const e=this._source.properties().childs().hiloStyle.childs().showLabels.value(),t=this._model.timeScale().barSpacing();return e&&t>5}}},579950:(e,t,i)=>{"use strict";i.d(t,{SeriesHLCAreaPaneView:()=>m});var s=i(86441),r=i(650151),n=i(244842),o=i(57372),a=i(63316),l=i(230058),d=i(534741),h=i(9640),u=i(142119),c=i(315801),_=i(879617),p=i(632739);class f extends p.ObjectValuesCache{_newObject(){return{high:void 0,close:void 0,low:void 0}}_clearObject(e){e.high=void 0,e.close=void 0,e.low=void 0}}class m{constructor(e,t){this._isMarkersEnabled=(0,n.enabled)("source_selection_markers"),this._hlcAreaCache=new f,this._highPoints=new p.CachedContainer,this._closePoints=new p.CachedContainer,this._lowPoints=new p.CachedContainer,this._barsBorders=new p.CachedContainer,this._filledAreas=new o.CachedMap,this._renderer=new u.CompositeRenderer,this._invalidated=!0,this._source=e,this._model=t,this._selectionIndexer=new a.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){var e,t,i,n,a,u,p,f,m;this._renderer.clear();const v=this._model.timeScale(),g=this._source.priceScale();if(v.isEmpty()||!g||g.isEmpty())return;const y=v.visibleBarsStrictRange();if(null===y)return;if(0===this._source.bars().size())return;const S=this._source.firstValue();if(null===S)return;const b=null!==(e=this._source.nearestIndex(y.firstBar()-1,d.PlotRowSearchMode.NearestLeft))&&void 0!==e?e:y.firstBar()-1,w=null!==(t=this._source.nearestIndex(y.lastBar()+1,d.PlotRowSearchMode.NearestRight))&&void 0!==t?t:y.lastBar()+1;this._hlcAreaCache.invalidateCache(),this._hlcAreaCache.setStartIndex(b),this._barsBorders.invalidateCache(),this._highPoints.invalidateCache(),this._lowPoints.invalidateCache(),this._closePoints.invalidateCache(),this._filledAreas.invalidateCache();let C,I,x;this._source.bars().range(b,w).each(((e,t)=>{if(this._hlcAreaCache.isValidIndex(e)){const i=this._hlcAreaCache.at(e);i.close=t[4],i.high=t[2],i.low=t[3]}return!1}));const P=new Map,T=b+this._hlcAreaCache.length();for(let e=b;e{"use strict";i.d(t,{SeriesHollowCandlesPaneView:()=>l});var s=i(142119),r=i(9640),n=i(230058),o=i(956725),a=i(245242);class l extends a.SeriesCandlesPaneView{renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1) ;const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs().hollowCandleStyle.childs(),i=this._model.timeScale().barSpacing(),a={bars:this._bars,barSpacing:i,bodyVisible:t.drawBody.value(),borderVisible:t.drawBorder.value(),borderColor:t.borderColor.value(),wickColor:t.wickColor.value(),barWidth:(0,r.optimalBarWidth)(i),wickVisible:t.drawWick.value(),isPriceScaleInverted:e.isInverted()},l=new s.CompositeRenderer;return l.append(new o.PaneRendererCandles(a)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&l.append(new n.SelectionRenderer(this._selectionData)),l}}},936258:(e,t,i)=>{"use strict";i.d(t,{SeriesLinePaneView:()=>d});var s=i(315801),r=i(142119),n=i(879617),o=i(627172),a=i(230058),l=i(143389);class d extends l.SeriesSingleLinePaneView{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e=this._source.properties().childs(),t=e.style.value();let i,l=!1;2===t?i=e.lineStyle.childs():14===t?(i=e.lineWithMarkersStyle.childs(),l=!0):15===t?i=e.steplineStyle.childs():18===t&&(i=e.tpoStyle.childs());const d={barSpacing:this._model.timeScale().barSpacing(),items:this._items,lineColor:i.color.value(),lineStyle:i.linestyle.value(),withMarkers:l,lineWidth:i.linewidth.value(),simpleMode:!0,hitTestResult:s.HitTarget.Regular,skipHoles:!0};let h,u;if(h=15===t?new o.PaneRendererStepLine(d):new n.PaneRendererLine(d),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData){const e=new r.CompositeRenderer;e.append(h),e.append(new a.SelectionRenderer(this._selectionData)),u=e}else u=h;return u}}},891512:(e,t,i)=>{"use strict";i.d(t,{SeriesBarCandlesPaneView:()=>h,baseBarCandlesUpdater:()=>d});var s=i(86441),r=i(244842),n=i(63316),o=i(534741),a=i(315801);function l(e){return null!=e}function d(e,t){const i=e[1],s=e[2],r=e[3],n=e[4];return!!(l(i)&&l(s)&&l(r)&&l(n))&&(t.open=i,t.high=s,t.low=r,t.close=n,!0)}class h{constructor(e,t){this._bars=[],this._invalidated=!0,this._isMarkersEnabled=(0,r.enabled)("source_selection_markers"),this._selectionData=null,this._source=e,this._model=t,this._selectionIndexer=new n.SelectionIndexes(t.timeScale())}items(){return this._bars}update(){this._invalidated=!0}_updateImpl(e){const t=this._model.timeScale(),i=this._source.priceScale();if(this._bars=[],t.isEmpty()||!i||i.isEmpty())return;const r=t.visibleBarsStrictRange();if(null===r)return;if(0===this._source.bars().size())return;let n=this._source.nearestIndex(r.firstBar(),o.PlotRowSearchMode.NearestRight);const l=this._source.nearestIndex(r.lastBar(),o.PlotRowSearchMode.NearestLeft);if(void 0===n||void 0===l)return;for(;n<=l;n++){if(null!==this._source.bars().valueAt(n))break}if(n>l)return;const d=this._source.bars().range(n,l),h=this._source.barColorer(),u={};if(d.each(((t,i)=>{u.value=i;let s=this._source.precomputedBarStyle(i);void 0===s&&(s=h.barStyle(t,!1,u),this._source.setPrecomputedBarStyle(i,s));const r=this._createItem(t,i,s,e);return!!r&&(u.previousValue=i,this._bars.push(r),!1)})), 0===this._bars.length)return;const c=this._source.firstValue();if(null!==c)if(i.barPricesToCoordinates(this._bars,c),t.fillBarBorders(this._bars),this._model.selection().isSelected(this._source)){const e=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,hittestResult:a.HitTarget.Regular,barSpacing:t.barSpacing()};const r=this._model.paneForSource(this._source);if(!r)return;const n=r.height();for(let r=0;r{"use strict";i.d(t,{SeriesSingleLinePaneView:()=>u});var s=i(203308),r=i(86441),n=i(650151),o=i(244842),a=i(63316),l=i(534741),d=i(315801),h=i(674981);class u{constructor(e,t){this._items=[],this._invalidated=!0,this._isMarkersEnabled=(0,o.enabled)("source_selection_markers"),this._selectionData=null,this._source=e,this._model=t,this._selectionIndexer=new a.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}_updateImpl(){var e,t;this._items=[];const i=this._model.timeScale(),o=this._source.priceScale();if(i.isEmpty()||!o||o.isEmpty())return;const a=i.visibleBarsStrictRange();if(null===a)return;if(0===this._source.bars().size())return;const u=null!==(e=this._source.nearestIndex(a.firstBar()-1,l.PlotRowSearchMode.NearestLeft))&&void 0!==e?e:a.firstBar()-1,c=null!==(t=this._source.nearestIndex(a.lastBar()+1,l.PlotRowSearchMode.NearestRight))&&void 0!==t?t:a.lastBar()+1,_=this._source.barFunction();let p=null;const f=this._model.timeScale().barSpacing();if(f<.1&&this._source.supportsPressedChunks()){p=this._source.firstValue();const e=this._source.pressedChunks(f,(0,n.ensureNotNull)(this._source.priceSource())),t=(0,h.lowerbound)(e,u,((e,t)=>e.startTimee.endTime{this._items.push({timePointIndex:t.startTime,y:e,left:NaN,center:NaN,right:NaN})}))}}else{p=this._source.bars().range(u,c).reduce(((e,t,i)=>{const r=_(i);return(0,s.default)(r)?(this._items.push({timePointIndex:t,y:r,left:NaN,center:NaN,right:NaN}),a.contains(t)?null!=e?e:r:e):e}),null)}if(null!==p)if(o.pointsArrayToCoordinates(this._items,p),i.fillBarBorders(this._items),this._model.selection().isSelected(this._source)){const e=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,barSpacing:i.barSpacing(),hittestResult:d.HitTarget.Regular};const t=(0,n.ensureNotNull)(this._model.paneForSource(this._source)).height();this._selectionData.hittestResult=d.HitTarget.Regular;for(let s=0;s{"use strict";i.d(t,{SeriesValuesProvider:()=>T,calculateColor:()=>x,changesData:()=>P});var s=i(650151),r=i(150335),n=i(724377),o=i(444372),a=i(638456),l=i(246733),d=i(31341),h=i(534741),u=i(885482),c=i(541346),_=i(943994),p=i(711757);function f(e,t){return 100*(t-e)/Math.abs(e||1)}var m=i(570226),v=i(616117),g=i(60897),y=i(334652);const S=y.lastDayChangeAvailable||y.alwaysShowLastPriceAndLastDayChange,b=a.CheckMobile.any(),w=new c.PercentageFormatter,C=new _.VolumeFormatter(2),I=`${g.notAvailable} (${g.notAvailable}%)`;function x(e,t){const i=(0,n.parseRgb)(t),s=(0,n.parseRgb)(e);return(0,n.distanceRgb)(i,s)<70?(0,n.rgbToHexString)((0,n.invertRgb)(i)):t}function P(e,t,i,s,r){var n;let o,a;if(null!==t){const e=r[4],i=t.change||0;a={change:i,currentPrice:e,prevPrice:e-i,percentChange:t.change_percent||0}}const l=i[4],d=e.search(s-1,h.PlotRowSearchMode.NearestLeft,1),u=null!==(n=null==d?void 0:d.value[4])&&void 0!==n?n:null;return null!==u&&null!=l&&(o={change:l-u,currentPrice:l,prevPrice:u,percentChange:f(u,l)}),{barChange:o,lastDayChange:a}}class T{constructor(e,t){this._series=e,this._model=t,this._emptyValues=[{title:o.t(null,void 0,i(539280)),visible:!1,value:"",index:0,id:""},{title:o.t(null,void 0,i(330777)),visible:!1,value:"",index:1,id:""},{title:o.t(null,void 0,i(608136)),visible:!1,value:"",index:2,id:""},{title:o.t(null,void 0,i(931691)),visible:!1,value:"",index:3,id:""},{title:"",visible:!1,value:"",index:4,id:""},{title:"",visible:!1,value:"",index:5,id:""},{title:o.t(null,void 0,i(349329)),visible:!1,value:"",index:6,id:""},{title:o.t(null,{context:"study"},i(32819)),visible:!1,value:"",index:7,id:""},{title:o.t(null,void 0,i(37611)),visible:!1,value:"",index:8,id:""}]}getItems(){return this._emptyValues}getValues(e){var t,i,n,o,a,u;const c=this._showLastPriceAndChangeOnly(),_=this._emptyValues.map(((e,t)=>({...e,value:6===t||8===t?I:g.notAvailable,visible:5!==t&&4!==t&&!c})));if(this._model.timeScale().isEmpty()||0===this._series.bars().size()||this._series.priceScale().isEmpty())return _;const p=(0,s.ensureNotNull)(this._series.data().bars().last());(0,r.isNumber)(e)||(e=p.index);const f=this._series.nearestIndex(e,h.PlotRowSearchMode.NearestLeft);if(void 0===f)return _;const v=this._series.data().valueAt(f),y=this._model.backgroundTopColor().value();if(null===v)return _;const b=v[1],T=v[2],R=v[3],M=v[4],{barChange:D,lastDayChange:A}=P(this._series.data(),this._series.quotes(),v,f,p.value),V=(0,m.getPriceValueFormatterForSource)(this._series);if((0,m.shouldBeFormattedAsPercent)(this._series)||(0,m.shouldBeFormattedAsIndexedTo100)(this._series))_[6].value="",_[8].value="";else{const e=this._series.formatter();if(void 0!==D){const{currentPrice:s,prevPrice:r,change:n,percentChange:o}=D,a=null!==(i=null===(t=e.formatChange)||void 0===t?void 0:t.call(e,s,r,!0))&&void 0!==i?i:e.format(n,!0) ;_[6].value=(0,d.forceLTRStr)(`${a} (${w.format(o,!0)})`)}if(void 0!==A){const{currentPrice:t,prevPrice:i,change:s,percentChange:r}=A,a=null!==(o=null===(n=e.formatChange)||void 0===n?void 0:n.call(e,t,i,!0))&&void 0!==o?o:e.format(s,!0);_[8].value=(0,d.forceLTRStr)(`${a} (${w.format(r,!0)})`)}}let L=null;if(c)_[5].value=null==M?g.notAvailable:V(M),_[5].visible=!0,L=this._getChangeColor(null==A?void 0:A.change),_[6].visible=void 0!==D,_[8].visible=void 0!==A||S;else{_[0].value=null==b?g.notAvailable:V(b),_[1].value=null==T?g.notAvailable:V(T),_[2].value=null==R?g.notAvailable:V(R),_[3].value=null==M?g.notAvailable:V(M),_[4].value=V(this._series.barFunction()(v));const e=v[5];(0,r.isNumber)(e)?_[7].value=C.format(e):_[7].visible=!1,_[8].visible=void 0!==A||S,_[6].visible=void 0!==D;const t=this._series.barColorer().barStyle(f,!1);L=x(y,null!==(a=t.barBorderColor)&&void 0!==a?a:t.barColor)}L=(0,l.resetTransparency)(x(y,L));for(const e of _)e.color||(e.color=L);return _[8].visible&&(_[8].color=(0,l.resetTransparency)(x(y,this._getChangeColor(null===(u=A)||void 0===u?void 0:u.change)))),_}_mobileNonTrackingMode(){return b&&(null===this._model.crossHairSource().pane||(0,v.isLineToolName)(u.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return y.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){var t;const i=void 0===e||e>=0?p.SeriesBarColorer.upColor(this._series.properties()):p.SeriesBarColorer.downColor(this._series.properties());return null!==(t=i.barBorderColor)&&void 0!==t?t:i.barColor}}},985715:(e,t,i)=>{"use strict";i.d(t,{StatusProviderBase:()=>s});class s{constructor(e){this._colorProperty=e}size(){return"13px"}bold(){return!1}color(){return this._colorProperty.value()}}},833642:(e,t,i)=>{"use strict";i.d(t,{StatusView:()=>s});class s{constructor(e){this._text="",this._color="",this._size="13px",this._bold=!1,this._statusProvider=e}text(){return this._text}getSplitTitle(){return[this._text]}color(){return this._statusProvider.color()}bold(){return this._bold}size(){return this._size}}},77338:(e,t,i)=>{"use strict";i.d(t,{getNoDataPosition:()=>u,getSeriesPosition:()=>c,noDataBasePosition:()=>d,positionToCoordinate:()=>l,positionVisualDirection:()=>a,seriesBasePosition:()=>h,seriesPrice:()=>n});var s=i(650151),r=i(534741);function n(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:case 14:case 15:return s(t.value);default:return t.value[-1===i?3:2]}}function o(e){return e>=0?1:-1}function a(e,t){return-1===o(e)!==t?-1:1}function l(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function d(e,t,i){const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i)}}function h(e,t){const i=e.data().bars(),s=i.first(),a=i.last();if(null===s||null===a)return null;let l;const d=t.index();if(null===d){if(void 0===t.time)return null;const e=t.time(),n=s.value[0],o=a.value[0];if(eo)return null;l=i.searchByTime(e,r.PlotRowSearchMode.NearestRight,4) }else l=i.search(d);return null===l?null:{index:l.index,price:n(e,l,o(t.position()))}}function u(e,t,i){const s=d(e,t,i);if(null===s)return null;const r=a(e.position(),t.isInverted());return{index:s.index,price:s.price,poleStartY:t.height(),visualDirection:1,positionPointDirection:r,startsOnSeriesData:!1}}function c(e,t,i=!0){const r=h(e,t),n=e.priceScale(),o=(0,s.ensureNotNull)(e.firstValue());if(null===r)return u(t,n,o);let l=0;const d=e.properties().childs(),c=e.model().timeScale(),_=n.priceToCoordinate(r.price,o),p=a(t.position(),n.isInverted());if(i)switch(e.style()){case 16:l=1===p?d.hlcAreaStyle.childs().highLineWidth.value()/2:d.hlcAreaStyle.childs().lowLineWidth.value()/2;break;case 3:l=d.areaStyle.childs().linewidth.value()/2;break;case 2:l=d.lineStyle.childs().linewidth.value()/2;break;case 14:l=d.lineWithMarkersStyle.childs().linewidth.value()/2;break;case 15:l=d.steplineStyle.childs().linewidth.value()/2;break;case 10:const e=Math.abs(100-d.baselineStyle.childs().baseLevelPercentage.value());l=n.height()*e/100>_?d.baselineStyle.childs().topLineWidth.value()/2:d.baselineStyle.childs().bottomLineWidth.value()/2;break;case 1:case 9:case 8:case 12:case 4:case 7:l=3;break;case 0:l=d.barStyle.childs().thinBars.value()?3:Math.max(3,.25*c.barSpacing());break;case 11:l=d.rangeStyle.childs().thinBars.value()?3:Math.max(3,.25*c.barSpacing());break;case 5:l=Math.max(4,.25*c.barSpacing());break;case 6:l=Math.max(5,.25*c.barSpacing())}const f=_-p*l;return{index:r.index,price:r.price,poleStartY:f,visualDirection:p,positionPointDirection:p,startsOnSeriesData:!0}}},434294:(e,t,i)=>{"use strict";i.d(t,{AbstractFilledAreaPaneView:()=>p});var s=i(650151),r=(i(86441),i(5531),i(674981)),n=i(448874),o=i(246733),a=i(407478);var l=i(57372),d=i(272933);function h(e,t){return Array.from({length:e},((e,i)=>({timePointIndex:i+t})))}function u(e,t,i){let s,r;const n=e.length;for(let o=t;o>=0&&o`${e}_${t}_${i}`));return n.default.Cache=t,i}(),this._source=e,this._model=t,this._fillGaps=!!(null==i?void 0:i.fillgaps),this._fillToIntersection=!!(null==i?void 0:i.fillToIntersection)}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0) ;if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{e.sourceId===this._source.id()&&(this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData}))}}renderer(){return this._dataInvalidated?this._updateImplFull(this._dataInvalidated)&&(this._dataInvalidated=null,this._viewportInvalidated=!1):this._viewportInvalidated&&(this._updateImplLight(),this._viewportInvalidated=!1),this._areaRenderer}_minFirstBarIndex(){return-1/0}_plotNames(){return this._source.metaInfo().plots.map((e=>e.id))}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImplFull(e){var t,i,n,o;if(this._areaRenderer.setData(null),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._visible())return!1;if(null===this._source.priceScale())return!1;if(null===this._source.firstValue())return!1;const a=this._source.plots().plottableRange(),l=a.size();if(0===l)return!1;const d=this._source.offset(this._plotAId()),u=this._source.offset(this._plotBId()),c=Math.min(d,u),_=Math.max(d,u);let p=e.firstIndex;const f=l+(_-c)+1,m=this._plotIndex1(),v=this._plotIndex2();f!==this._items.length&&(void 0===p||0===this._items.length||pe.timePointIndex=0&&te.timePointIndex=this._items.length)return;const S=Math.min(this._items.length-1,(0,r.lowerbound)(this._items,p.lastBar(),((e,t)=>e.timePointIndex1&&(x=null),void 0!==d?(r=d.level1,o=d.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:f(t.plot1Value),o=t.plot2Coordinate=void 0===t.plot2Value?void 0:f(t.plot2Value));const a=t.xCoordinate=h.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=f(t.color.value1),t.color.coordinate2=f(t.color.value2)),this._fillGaps?void 0!==r||void 0!==o:void 0!==r&&void 0!==o){const s=null!==this._colorPlotIndex?t.color||_:R;if(A=s,!(null===(D=T)||null===A?D===A:0===D.type&&0===A.type?D.color===A.color:1===D.type&&1===A.type&&D.color1===A.color1&&D.color2===A.color2&&D.coordinate1===A.coordinate1&&D.coordinate2===A.coordinate2)||null===x){if(null!==x&&(void 0!==r&&x.addPoints1Point(a,r),void 0!==o&&x.addPoints2Point(a,o)),e===w)continue;T=s;const t=c(s),d=null!==(i=C.get(t))&&void 0!==i?i:new l.AreaBackgroundItemsGroup(s);P=x,x=null!==(n=d.newItem())&&void 0!==n?n:new l.AreaBackgroundItem,d.push(x),C.set(t,d)}void 0!==r&&x.addPoints1Point(a,r),void 0!==o&&x.addPoints2Point(a,o)}else this._fillGaps||(T=null,x=null,P=null);M=s,I=t}var D,A;C.delete(c(_));const V={barSpacing:this._model.timeScale().barSpacing(),colorAreas:C};this._areaRenderer.setData(V)}}},1584:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundPaneView:()=>n});var s=i(650151),r=i(434294);class n extends r.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency.value()}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},114315:(e,t,i)=>{ "use strict";i.d(t,{ExtendedStudyDataSource:()=>n});var s=i(405721),r=i(807218);class n extends s.StudyDataSource{constructor(e,t,i,s){super(e,t.seriesSource(),i,s),this._series=t}_createStudyError(e){var t;return(0,r.createStudyError)(this._getStudyErrorDescription(e),null===(t=this._series.symbolInfo())||void 0===t?void 0:t.exchange)}}},736543:(e,t,i)=>{"use strict";i.d(t,{financialPeriodToShortString:()=>o,financialPeriodToString:()=>n});var s=i(650151),r=i(444372);function n(e){switch(e){case"FQ":return r.t(null,void 0,i(908831));case"FY":return r.t(null,void 0,i(34314));case"FH":return r.t(null,void 0,i(512421));case"TTM":return r.t(null,void 0,i(794236))}(0,s.ensureNever)(e)}function o(e){switch(e){case"FQ":return r.t(null,void 0,i(99374));case"FY":return r.t(null,void 0,i(776550));case"FH":return r.t(null,void 0,i(924468));case"TTM":return r.t(null,void 0,i(794236))}(0,s.ensureNever)(e)}},709081:(e,t,i)=>{"use strict";i.d(t,{Fundamental:()=>y});var s=i(444372),r=i(807218),n=i(736543),o=i(932167);class a extends o.StudyPriceAxisView{constructor(e,t){super(e,t),this._fundamental=e}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._fundamental.labelTitle(),e.visible=!0)}}var l=i(506387);class d extends l.StudyPriceLineAxisView{constructor(e,t){super(e,t),this._model=e.model()}_isVisible(){return this._model.properties().childs().scalesProperties.childs().showFundamentalLastValue.value()&&this._study.properties().childs().styles.childs()[this._plotname].childs().trackPrice.value()}}var h=i(509550),u=i(7288);const c=s.t(null,void 0,i(490411));class _ extends h.StudyStatusProvider{sourceStatusText(){const e=this._source.status();return e.type===u.StudyStatusType.Error&&(e.errorDescription.error.startsWith("resolve_error ")||e.errorDescription.error.startsWith("Symbol resolve error:"))?c:super.sourceStatusText()}}var p=i(368135),f=i(195447),m=i(534741),v=i(291784),g=i(982217);class y extends r.Study{constructor(e,t,i,s){super(e,t,i,s),this._linePlot=null;const r=s.plots.findIndex((e=>"line"===e.type));if(-1!==r){const e=s.plots[r],i=t.childs().styles.childs()[e.id];i.hasChild("plottype")&&(this._linePlot={plotIndex:r,plotType:i.childs().plottype})}}labelTitle(){return this.title(g.TitleDisplayTarget.StatusLine,!0)}hasStateForAlert(){return!1}titleInParts(e,t,i,s,r){return[this._title(e,!!t)]}statusProvider(e){return new _(this,this._model.properties().childs().scalesProperties.childs().textColor)}firstValue(){var e;const t=super.firstValue();if(null!==t||null===this._linePlot||this._linePlot.plotType.value()!==p.LineStudyPlotStyle.StepLine&&this._linePlot.plotType.value()!==p.LineStudyPlotStyle.StepLineWithDiamonds)return t;const i=this._model.timeScale().visibleBarsStrictRange();if(null===i)return null;if(!this.properties().childs().visible.value()||!this.isActualInterval())return this._ownFirstValue;const s=this.data().search(i.firstBar()-1,m.PlotRowSearchMode.NearestLeft,this._linePlot.plotIndex+1);return null===s?null:null!==(e=s.value[this._linePlot.plotIndex+1])&&void 0!==e?e:null} priceRange(e,t){let i=super.priceRange(e,t);if(null===i){const e=this.firstValue();null!==e&&(i=this._postProcessPriceRange(new v.PriceRange(e,e)))}return i}_createPriceAxisView(e){return new a(this,{plotIndex:e})}_createPriceLineAxisView(e){return new d(this,e)}_title(e,t){const r=this.metaInfo();let o;if(o=t?r.shortDescription:r.description,void 0!==r.financialPeriod){const e=t?(0,n.financialPeriodToShortString)(r.financialPeriod):(0,n.financialPeriodToString)(r.financialPeriod);o=`${s.t(o,{context:"study"},i(168716))} · ${e}`}const a=this._titleInputs(e,!0),l=Object.keys(a);return l.length>0&&(o=`${s.t(a[l[0]],{context:"study"},i(168716))} · ${o}`),o}_titleInputsOptions(e,t,i){return{...super._titleInputsOptions(e,t,i),skipOptionalEmptySymbolInputs:!0,allowedInputTypes:["symbol"]}}_fillPrecalculatedAutoscaleInfo(e,t){const i=super._fillPrecalculatedAutoscaleInfo(e,t);if(null!==this._linePlot&&(this._linePlot.plotType.value()===p.LineStudyPlotStyle.StepLine||this._linePlot.plotType.value()===p.LineStudyPlotStyle.StepLineWithDiamonds)){const t=this.data().search(e,m.PlotRowSearchMode.NearestLeft);if(null!==t){const e=t.value[this._linePlot.plotIndex+1];i.baseValueMinMax=(0,f.mergeMinMax)(i.baseValueMinMax,{min:e,max:e})}}return i}}},580683:(e,t,i)=>{"use strict";function s(e,t,i){let s=e[`${t}#${i}`]||null;return null===s&&(s=e[t]||null),null===s&&Object.keys(e).forEach((i=>{null===s&&i.startsWith(`${t}#`)&&(s=e[i]||null)})),s}i.d(t,{getObsoleteIdeaSymbolInfo:()=>s})},92245:(e,t,i)=>{"use strict";i.d(t,{DwgExtend:()=>s,convertPointsToScreenDimension:()=>a,doesItemAffectVisibleRange:()=>l,isExtendInSameDirection:()=>o});var s,r=i(650151);function n(e,t){return e===s.None?t:t===s.None?e:e===s.Both||t===s.Both?s.Both:e===t?t:s.Both}function o(e,t){return e===s.Both||e===t}function a(e,t,i,o,a,l,d,h,u,c){let _,p;if(null===e&&null===i){if(a!==s.Right&&a!==s.Both)return null;a=s.Both,_=0,p=h}else null===e?(_=d.indexToCoordinate((0,r.ensureNotNull)(i)-1),a=n(a,s.Left)):_=d.indexToCoordinate(e),null===i?(p=d.indexToCoordinate((0,r.ensureNotNull)(e)-1),a=n(a,s.Right)):p=d.indexToCoordinate(i);const f=_,m=l.priceToCoordinate(t,u),v=p,g=l.priceToCoordinate(o,u);return void 0!==c?(c.x1=f,c.y1=m,c.x2=v,c.y2=g,c.extend=a,c):{x1:f,y1:m,x2:v,y2:g,extend:a}}function l(e,t,i,r,n){let o=!1;switch(i){case s.Both:o=!0;break;case s.Right:o=null===t||null===e||e<=n;break;case s.Left:o=null===t||t>=r;break;default:null!==e&&null!==t?o=(e>=r||t>=r)&&(e<=n||t<=n):null!==e&&null===t?o=e<=n:null===e&&null!==t&&(o=t>=r)}return o}!function(e){e.None="n",e.Left="l",e.Right="r",e.Both="b"}(s||(s={}))},539163:(e,t,i)=>{"use strict";i.d(t,{DwgLabelPaneViewConstants:()=>s,calculateDwgLabelsMargins:()=>a,calculateLabelHeight:()=>o});var s,r=i(368135),n=i(294024);function o(e,t,i){let s=i;switch(t){case r.PlotSymbolSize.Tiny:s=.6*e;break;case r.PlotSymbolSize.Small:s=.8*e;break;case r.PlotSymbolSize.Normal:s=e;break;case r.PlotSymbolSize.Large:s=1.5*e;break;case r.PlotSymbolSize.Huge:s=2*e}return s}function a(e,t,i){ const r=e.model().timeScale().barSpacing(),a=Math.round(r*s.AUTO_SIZE_MULT),l=o(s.NORMAL_SIZE,t.size,a)*s.SHAPE_HEIGHT_MULT,d=Math.round(l/2);switch(t.style){case n.DwgLabelStyle.LabelUp:case n.DwgLabelStyle.LabelLeftUp:case n.DwgLabelStyle.LabelRightUp:return{bottomPixelMargin:d,topPixelMargin:0};case n.DwgLabelStyle.LabelDown:case n.DwgLabelStyle.LabelLeftDown:case n.DwgLabelStyle.LabelRightDown:return{bottomPixelMargin:0,topPixelMargin:d};case n.DwgLabelStyle.LabelLeft:case n.DwgLabelStyle.LabelRight:case n.DwgLabelStyle.LabelCenter:return{bottomPixelMargin:d,topPixelMargin:d}}return{bottomPixelMargin:0,topPixelMargin:0}}!function(e){e.NORMAL_SIZE=50,e.AUTO_SIZE_MULT=1,e.SHAPE_HEIGHT_MULT=.5,e.SHAPE_WIDTH_MULT=.6,e.FONT_SIZE_MULT=.24}(s||(s={}))},484812:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>o.LiveStudyGraphics,createGraphicsPaneViews:()=>_,createGraphicsPriceAxisViews:()=>f,emptyStudyGraphics:()=>n.emptyStudyGraphics,isStudyGraphicsEmpty:()=>r.isStudyGraphicsEmpty,loadStudyGraphics:()=>n.loadStudyGraphics,saveStudyGraphics:()=>n.saveStudyGraphics});var s=i(201089),r=i(590713),n=i(2605),o=i(700534),a=i(229765),l=i(246733);class d extends a.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){var s,r;e.visible=!1;const n=this._source.priceScale(),o=this._source.properties().childs(),a=o.visible.value();if(!n||n.isEmpty()||!a)return;const d=null===(r=null===(s=o.graphics.childs()[this._data.lineType])||void 0===s?void 0:s.childs()[this._data.styleId])||void 0===r?void 0:r.childs();if(!(void 0!==d&&d.visible&&d.visible.value()&&d.showPrice&&d.showPrice.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const h=this._source.firstValue();if(null===h)return;const u=this._data.line.level,c=(0,l.resetTransparency)(d.color.value());i.background=c,i.textColor=this.generateTextColor(c),i.coordinate=n.priceToCoordinate(u,h),e.text=n.formatPrice(u,h,!0),e.visible=!0}_isLabelVisibleAccordinglyToProperties(){const e=this._source.model().properties().childs().scalesProperties.childs();return(e.showStudyLastValue.value()||e.showFundamentalLastValue.value())&&this._source.properties().childs().showLabelsOnPriceScale.value()}}const h=(0,s.getLogger)("Chart.StudyGraphics"),u=new Set(["dwgtablecells","tpoBlockSets","tpoLevels","tpoVolumeRows","logs","performance"]);async function c(e,t,s,r){switch(e){case"hlines":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,454112))).LevelPaneView)(t,s,r);case"lines":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,556613))).LinePaneView)(t,s,r);case"shapemarks":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,709329))).ShapeMarkPaneView)(t,s,r);case"textmarks":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,99490))).TextMarkPaneView)(t,s,r);case"trendchannels":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,149284))).TrendChannelPaneView)(t,s,r);case"dwglabels": return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,531536))).DwgLabelPaneView)(t,s,r);case"dwglines":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,591393))).DwgLinePaneView)(t,s,r);case"dwgpolylines":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,806468))).DwgPolylinePaneView)(t,s,r);case"dwgboxes":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,277150))).DwgBoxPaneView)(t,s,r);case"dwgtables":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,760269))).DwgTablePaneView)(t,s,r);case"dwglinefills":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,262831))).DwgLineFillPaneView)(t,s,r);case"tpos":return new((await i.e(769).then(i.bind(i,166077))).TpoPaneView)(t,s,r);case"footprints":return new((await i.e(9141).then(i.bind(i,556914))).VolumeFootprintPaneView)(t,s)}switch(e){case"hhists":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,670751))).HHistPaneView)(t,s,r);case"horizlines":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,722669))).HorizLinePaneView)(t,s,r);case"vertlines":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,652742))).VertLinePaneView)(t,s,r);case"polygons":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,842474))).PolygonPaneView)(t,s,r);case"backgrounds":return new((await Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,209406))).BackgroundPaneView)(t,s,r)}return null}async function _(e,t,i){const s=[],r=Object.keys(e.graphicsInfo());r.sort(((e,t)=>p(e)-p(t)));for(const n of r){const r=await c(n,e,t,i);null!==r?s.push(r):u.has(n)||h.logWarn(`${n} is not supported by this build of graphics subsystem, skipping`)}return s}function p(e){var t;return null!==(t=r.primitivesZOrders.get(e))&&void 0!==t?t:0}function f(e){const t=Object.keys(e.graphicsInfo()),i=[];for(const s of t)switch(s){case"hlines":e.graphics().hlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new d(e,{line:{level:t.level},styleId:r,lineType:s}))}))}));break;case"horizlines":e.graphics().horizlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new d(e,{line:{level:t.level},styleId:r,lineType:s}))}))}))}return i}},567467:(e,t,i)=>{"use strict";i.d(t,{HHistBasedValuesProvider:()=>p});var s=i(150335),r=i(650151),n=i(638456),o=i(534741),a=i(885482),l=i(943994),d=i(396372),h=i(616117),u=i(60897);function c(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}const _=n.CheckMobile.any();class p{constructor(e,t){this._emptyValues=[],this._study=e,this._model=t,void 0!==this._study.metaInfo().graphics.hhists&&this._emptyValues.push(c(0),c(1),c(2))}getItems(){return this._emptyValues}getValues(e){var t,i;const n=this._emptyValues.map((e=>({...e})));n.forEach((e=>{e.visible=this._study.isVisible(),e.value=u.notAvailable}));const a=this._study.properties().childs().inputs.childs().volume.value();switch(a){case d.HHistVolumeMode.UpDown:n[0].title="Up",n[1].title="Down",n[2].title="Total";break ;case d.HHistVolumeMode.Total:n[0].title="Total",n[1].visible=!1,n[2].visible=!1;break;case d.HHistVolumeMode.Delta:n[0].title="Delta",n[1].title="Max(Up, Down)",n[2].title="Total"}const h=this._study.priceScale(),c=this._model.timeScale();if(null===h||h.isEmpty()||c.isEmpty()||this._hideValues())return n;if(null===e||!isFinite(e)){const t=this._study.data().last();if(null===t)return n;e=t.index}const _=this._model.crossHairSource(),p=_.price;if(!isFinite(_.y)&&(e=function(e,t){var i;const s=null===(i=e.visibleBarsStrictRange())||void 0===i?void 0:i.lastBar();if(!s)return null;const r=t.data().search(s,o.PlotRowSearchMode.NearestLeft);return r?r.index:null}(this._model.timeScale(),this._model.mainSeries()),null===e))return n;const f=function(e,t,i,s){if(0===e.size)return null;if(!i){const e=(0,r.ensureNotNull)(s.data().valueAt(t));i=s.barFunction()(e)}const n=function(e,t){let i=null;return e.forEach(((e,s)=>{s<=t&&(null===i||s>i)&&(i=s)})),i}(e,t);if(null===n)return null;const o=e.get(n);if(!o||0===o.size)return null;return function(e,t){let i=null;return e.forEach((e=>{e.priceLow<=t&&t{e.value="0"})),n;const m=this._study.metaInfo().graphics.hhists;if(void 0===m)return n;if(void 0===m[f.styleId])return n;const v=null===(i=null===(t=this._study.properties().childs().graphics.childs().hhists)||void 0===t?void 0:t.childs()[f.styleId])||void 0===i?void 0:i.childs(),g=new l.VolumeFormatter,y=e=>(0,s.isNumber)(e)?g.format(e):"";if(a!==d.HHistVolumeMode.Delta){if(f.rate.forEach(((e,t)=>{n[t].value=y(e),n[t].color=(0,r.ensureDefined)(v).colors[t].value()})),a===d.HHistVolumeMode.UpDown){const e=f.rate[0]+f.rate[1];n[2].value=y(e),n[2].color=(0,r.ensureDefined)(v).valuesColor.value()}}else{const e=f.rate[0]>f.rate[1]?0:1,t=(0,r.ensureDefined)(v).colors[e].value(),i=f.rate[0]+f.rate[1];[2*f.rate[e]-i,f.rate[e],i].forEach(((e,i)=>{n[i].value=y(e),n[i].color=t}))}return n}_hideValues(){return _&&(null===this._model.crossHairSource().pane||(0,h.isLineToolName)(a.tool.value())||null!==this._model.lineBeingEdited())}}},799567:(e,t,i)=>{"use strict";var s;i.d(t,{StudyStatusType:()=>s}),function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(s||(s={}))},173220:(e,t,i)=>{"use strict";i.d(t,{makeNextStudyId:()=>o,makeNextSymbolId:()=>r});let s=0;function r(){return s++,"ss_"+s}let n=0;function o(){return n++,"st"+n}},272933:(e,t,i)=>{"use strict";function s(e,t){if(null===e)return t;const i=e.firstIndex,s=t.firstIndex,r=e.clearData||t.clearData;return{firstIndex:r||void 0===i||void 0===s?void 0:Math.min(i,s),clearData:r}}i.d(t,{mergeDataInvalidation:()=>s})},772466:(e,t,i)=>{"use strict";i.d(t,{NonSeriesStudy:()=>o,isNonSeriesStudy:()=>n});var s=i(650151),r=i(807218);function n(e){return e instanceof o}class o extends r.Study{clearData(){this._customData=null,this._indexes=null}restoreData(e,t,i){super.restoreData(e), this._customData=t,this._indexes=i}state(e){const t=super.state(e);return e&&(t.nonSeriesData=this._customData,t.indexes=this._indexes),t}customData(){return this._customData}_setPaneViews(e){this._paneViews=e,this.model().lightUpdate()}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace?((0,s.assert)("nochange"!==i),this._indexes=i):(this._customData=t.data,"nochange"!==i&&(this._indexes=i))),super._onDataUpdated(e,t,i)}}},588840:(e,t,i)=>{"use strict";i.d(t,{OverlayLegendValuesProvider:()=>n});var s=i(444331),r=i(675557);class n extends r.OverlayValuesProvider{constructor(e,t){super(e,t);const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._showBarChange=i.showBarChange,this._showLastDayChange=i.showLastDayChange,this._showSeriesOHLC=i.showSeriesOHLC}getValues(e){var t,i,r;const n=super.getValues(e),o=this._study.properties().childs(),a=o.style.value(),l=12!==a,d=this._showSeriesOHLC.value(),h=l&&this._showBarChange.value(),u=l&&this._showLastDayChange.value();if(this._showLastPriceAndChangeOnly())return(t=n[7]).visible&&(t.visible=h),n[6].visible=!1,n;const c=(0,s.isPriceSourceStyle)(a),_=12!==a&&16!==a,p=12!==a,f=d&&!c,m=d&&c;if(n[0].visible=f&&_,n[1].visible=f,n[2].visible=f,n[3].visible=f&&p,(i=n[7]).visible&&(i.visible=u),(r=n[6]).visible&&(r.visible=h),n[4].visible=m,16===a){const e=o.hlcAreaStyle.childs();n[1].color=e.highLineColor.value(),n[2].color=e.lowLineColor.value(),n[3].color=e.closeLineColor.value()}return n}}},768204:(e,t,i)=>{"use strict";i.d(t,{OverlayStatusProvider:()=>n});var s=i(509550),r=i(982217);class n extends s.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(r.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(r.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(r.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(r.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}},675557:(e,t,i)=>{"use strict";i.d(t,{OverlayValuesProvider:()=>w});var s=i(150335),r=i(444372),n=i(638456),o=i(246733),a=i(31341),l=i(541346),d=i(748844),h=i(534741),u=i(334652),c=i(885482),_=i(711757),p=i(570226),f=i(616117),m=i(60897);const v=u.lastDayChangeAvailable||u.alwaysShowLastPriceAndLastDayChange,g=n.CheckMobile.any(),y=new l.PercentageFormatter,S=m.notAvailable,b=`${S} (${S}%)`;class w{constructor(e,t){this._study=e,this._model=t,this._emptyValues=[{title:r.t(null,void 0,i(539280)),visible:!1,value:"",index:0,id:""},{title:r.t(null,void 0,i(330777)),visible:!1,value:"",index:1,id:""},{title:r.t(null,void 0,i(608136)),visible:!1,value:"",index:2,id:""},{title:r.t(null,void 0,i(931691)),visible:!1,value:"",index:3,id:""},{title:"",visible:!1,value:"",index:4,id:""},{title:"",visible:!1,value:"",index:5,id:""},{title:r.t(null,void 0,i(349329)),visible:!1,value:"",index:6,id:""},{title:r.t(null,void 0,i(37611)),visible:!1,value:"",index:7,id:""}]}getItems(){return this._emptyValues} getValues(e){var t,i,r,n,l,u;const c=this._emptyValues.map((e=>({...e})));if(this._model.timeScale().isEmpty())return c;const _=this._study.data(),f=_.lastIndex();if(0===_.size()||null===f)return c;const m=_.search(f,h.PlotRowSearchMode.NearestLeft,1);if(null===m)return c;const g=this._showLastPriceAndChangeOnly();if((0,s.isNumber)(e)||(g?e=f:(e=this._model.crossHairSource().appliedIndex(),(0,s.isNumber)(e)||(e=f))),null===e||!(0,s.isNumber)(e))return c;const w=_.search(e,h.PlotRowSearchMode.NearestLeft,1),C=this._model.backgroundTopColor().value();if(null===w)return c;const I=w.index,x=w.value,P=x[1],T=x[2],R=x[3],M=x[4];c[0].value=S,c[1].value=S,c[2].value=S,c[3].value=S,c[7].value=b,c[6].value=b;for(const e of c)e.visible=!g;const D=c[4];D.visible=!1;const{barChange:A,lastDayChange:V}=(0,d.changesData)(_,this._study.quotes(),w.value,w.index,m.value),L=(0,p.getPriceValueFormatterForSource)(this._study);if((0,p.shouldBeFormattedAsPercent)(this._study)||(0,p.shouldBeFormattedAsIndexedTo100)(this._study))c[7].value="",c[6].value="";else{const e=this._study.formatter();if(void 0!==A){const{currentPrice:s,prevPrice:r,change:n}=A,o=null!==(i=null===(t=e.formatChange)||void 0===t?void 0:t.call(e,s,r,!0))&&void 0!==i?i:e.format(n,!0);c[6].value=(0,a.forceLTRStr)(`${o} (${y.format(A.percentChange,!0)})`)}if(void 0!==V){const{currentPrice:t,prevPrice:i,change:s,percentChange:o}=V,l=null!==(n=null===(r=e.formatChange)||void 0===r?void 0:r.call(e,t,i,!0))&&void 0!==n?n:e.format(s,!0);c[7].value=(0,a.forceLTRStr)(`${l} (${y.format(o,!0)})`)}}let k=null;if(g)c[5].value=null==M?S:L(M),c[5].visible=!0,k=this._getChangeColor(null==V?void 0:V.change),c[6].visible=void 0!==A,c[7].visible=void 0!==V||v;else{c[0].value=null==P?S:L(P),c[1].value=null==T?S:L(T),c[2].value=null==R?S:L(R),c[3].value=null==M?S:L(M),D.value=L(this._study.barFunction()(x)),c[5].visible=!1,c[7].visible=void 0!==V||v,c[6].visible=void 0!==A;const e=this._study.barColorer().barStyle(I,!1),t=null!==(l=e.barBorderColor)&&void 0!==l?l:e.barColor;k=(0,d.calculateColor)(C,t)}k=(0,o.resetTransparency)((0,d.calculateColor)(C,k));for(const e of c)e.color||(e.color=k);return c[7].visible&&(c[7].color=(0,o.resetTransparency)((0,d.calculateColor)(C,this._getChangeColor(null===(u=V)||void 0===u?void 0:u.change)))),c}_mobileNonTrackingMode(){return g&&(null===this._model.crossHairSource().pane||(0,f.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return u.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){var t;const i=void 0===e||e>=0?_.SeriesBarColorer.upColor(this._study.properties()):_.SeriesBarColorer.downColor(this._study.properties());return null!==(t=i.barBorderColor)&&void 0!==t?t:i.barColor}}},574809:(e,t,i)=>{"use strict";function s(e){e.lineWidth=void 0,e.lineStyle=void 0;for(let t=0;ts, createEmptyStyle:()=>r})},793907:(e,t,i)=>{"use strict";i.d(t,{PaneRendererColumns:()=>n});var s=i(43192),r=i(315801);class n extends s.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._precalculatedCache=[],this.setData(e)}setData(e){this._data=e,this._precalculatedCache=[]}hitTest(e){var t,i,s,n;if(null===this._data)return null;const o=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,a=(null!==(n=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==n?n:this._data.items.length)-1;for(let t=o;t<=a;t++){const i=this._data.items[t];if(e.x>=i.left&&e.x<=i.right){const t=i.y;if(e.y>=Math.min(t,this._data.histogramBase)&&e.y<=Math.max(t,this._data.histogramBase))return new r.HitTestResult(r.HitTarget.Regular)}}return null}_drawImpl(e){var t,i,s,r;if(null===this._data||0===this._data.items.length)return;const{context:n,horizontalPixelRatio:o,verticalPixelRatio:a}=e;this._precalculatedCache.length||this._fillPrecalculatedCache(o);const l=Math.max(1,Math.floor(o)),d=Math.max(1,Math.floor(a)),h=Math.round(this._data.histogramBase*a)-Math.floor(l/2),u=h+l,c=this._data.lineColor,_=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,p=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=_;e<=p;e++){const t=this._data.items[e],i=this._precalculatedCache[e-_],s=Math.round(t.y*a);let r,o;n.fillStyle=t.style?t.style.color:c,s<=h?(r=s,o=u):(r=h,o=s-Math.floor(d/2)+d),n.fillRect(i.left,r,i.right-i.left+1,o-r)}}_fillPrecalculatedCache(e){var t,i;if(null===this._data||0===this._data.items.length)return void(this._precalculatedCache=[]);const{barSpacing:s,visibleItemsRange:r,items:n}=this._data,o=Math.ceil(s*e)<=1?0:Math.max(1,Math.floor(e)),a=null!==(t=null==r?void 0:r.startItemIndex)&&void 0!==t?t:0,l=(null!==(i=null==r?void 0:r.endItemIndex)&&void 0!==i?i:n.length)-1,d=l-a+1;if(d<=0)return void(this._precalculatedCache=[]);this._precalculatedCache=new Array(d);for(let t=a;t<=l;t++){const i=n[t],s=Math.round(i.center*e);let r,l;const d=Math.round((i.right-i.left)*e)-o;if(d%2){const e=(d-1)/2;r=s-e,l=s+e}else{const e=d/2;r=s-e,l=s+e-1}this._precalculatedCache[t-a]={left:r,right:l,roundedCenter:s,center:i.center*e,time:i.timePointIndex}}for(let e=a+1;e<=l;e++){const t=this._precalculatedCache[e-a],i=this._precalculatedCache[e-a-1];t.time===i.time+1&&(t.left-i.right!==o+1&&(i.roundedCenter>i.center?i.right=t.left-o-1:t.left=i.right+o+1))}let h=Math.ceil(s*e);for(let e=a+1;e<=l;e++){const t=this._precalculatedCache[e-a];t.right0&&h<4)for(let e=a+1;e<=l;e++){const t=this._precalculatedCache[e-a];t.right-t.left+1>h&&(t.roundedCenter>t.center?t.right-=1:t.left+=1)}}}},268008:(e,t,i)=>{"use strict";i.d(t,{StudyPlotPaneView:()=>B}) ;var s=i(650151),r=i(724377),n=i(244842),o=i(678515),a=i(389137),l=i(246733),d=i(103221),h=i(755785),u=i(413225),c=i(142119),_=i(879617),p=i(627172),f=i(230058),m=i(574809),v=i(470130),g=i(86441),y=i(9640),S=i(315801),b=i(43192),w=i(638456);class C extends b.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=n.lineWidth,a=n.vertOffset||0,l=(0,y.interactionTolerance)().series+o,d=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,h=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(let t=d;t{const t=(0,r.rgbToHsl)((0,r.parseRgb)(e)),i=t[0]+.05;return t[0]=i-Math.floor(i),(0,r.rgbToHexString)((0,r.hslToRgb)(t))},L=(0,h.memoize)(V),k=new Set([R.LineStudyPlotStyle.Line,R.LineStudyPlotStyle.Area,R.LineStudyPlotStyle.Circles,R.LineStudyPlotStyle.Cross,R.LineStudyPlotStyle.StepLine,R.LineStudyPlotStyle.StepLineWithDiamonds]);class B extends A.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s,r=!1){super(i),this._histogramBase=null,this._lineColor="",this._lineWidth=1,this._color1="",this._color2="",this._renderer=new c.CompositeRenderer,this._isMarkersEnabled=n.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s,this._plotIndex=e.metaInfo().plots.findIndex((e=>e.id===s)),this._colorProvider=(0,M.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._extendStepLineToBarsEndings=r,this._isFundamental=(0,v.isFundamentalStudyMetaInfo)(e.metaInfo());const o=this._study.properties().styles[this._plotName].plottype.value();this._isStepLinePlot=o===R.LineStudyPlotStyle.StepLine||o===R.LineStudyPlotStyle.StepLineWithBreaks||o===R.LineStudyPlotStyle.StepLineWithDiamonds}items(){return this._items}renderer(){return this._makeSureRendererIsValid(),this._renderer}_getTranspValue(){const e=this._study.properties(),t=e.styles[this._plotName];let i=0;const s=this._study.metaInfo();return"Volume@tv-basicstudies"===s.id&&s.version<=46&&"transparency"in e?(i=e.transparency.value(),i=(0,a.isNumber)(i)?i:0,i):(t.transparency&&(i=t.transparency.value(),i=(0,a.isNumber)(i)?i:0),i)}_updateImplFull(e){var t,i,r;if(this._renderer.clear(), (null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._study.isPlotVisibleAt(this._plotName,1))return!1;if(!this._study.priceScale())return!1;if(null===this._study.firstValue())return!1;if(null===this._study.priceScale())return!1;this._histogramBase=null;const n=this._study.properties().styles[this._plotName],a=n.plottype.value(),h=this._isFundamental&&this._isStepLinePlot,u=this._study.plots().plottableRange(h);if(0===u.size())return!1;const c=this._study.offset(this._plotName),_=k.has(a),p=this._preallocateItems(u,((e,t)=>({y:NaN,left:NaN,center:NaN,right:NaN,origPrices:{price:null!=t?t:NaN,timePointIndex:e+c},timePointIndex:e+c})));let f=NaN,v=NaN;const g=new Map,y=(e,t)=>{let i=g.get(e);void 0===i&&(i=new Map,g.set(e,i));let s=i.get(t);if(void 0===s){const r=!this._plotName||"vol"!==this._plotName;s=(0,l.generateColor)(e,t,r),i.set(t,s)}return s},S=(0,m.createEmptyStyle)(),b=(0,o.clamp)(this._getTranspValue(),0,100),w=this._model.timeScale().visibleBarsStrictRange();if(null===w)return!1;const{startBar:C,endBar:I}=this._calculateStartEnd(w);if(null===C||null===I||0===this._items.length)return!1;const x=null!=p?p:(0,s.ensureNotNull)(u.firstIndex()),P=(0,s.ensureNotNull)(u.lastIndex())+1,T=u.rangeIterator(x,P);let R,M=(0,D.lowerbound)(this._items,x+c,((e,t)=>e.timePointIndex0&&(this._items[M].breakBefore=!0),v=o,f=t,M++,R=d}if(R&&this._isFundamental&&this._isStepLinePlot){const e=this._model.mainSeries().data().bars().lastIndex(),t=R;if(null!==e&&e>t.timePointIndex){const i=(0,d.deepCopy)(t);i.timePointIndex=e,i.valIsNotSameAsPrev=!1,this._items.length>M?this._items[M]=i:this._items.push(i)}}return this._updateImplLight(),!0}_correctVisibleItemIndexes(e,t){const i=super._correctVisibleItemIndexes(e,t);return this._isFundamental&&this._isStepLinePlot&&i.endItemIndex===this._items.length-1&&(i.endItemIndex+=1),i}_updateRenderer(e,t){var i,r;this._renderer.clear();const n=this._study.properties().styles.childs()[this._plotName].childs(),h=null===(i=this._study.metaInfo().styles)||void 0===i?void 0:i[this._plotName],c=(0,o.clamp)(this._getTranspValue(),0,100);this._lineColor=(0,l.generateColor)(n.color.value(),c),this._lineWidth=n.linewidth.value();let m=n.color.value();const v=this._colorProvider.getDefaultPlotPointStyle();v&&(m=v.colors[0]||m,this._lineWidth=null!==(r=v.lineWidth)&&void 0!==r?r:this._lineWidth,this._lineColor=m?(0, l.generateColor)(m,c):this._lineColor),this._color2=(0,l.generateColor)(m,c);const g=this._study.metaInfo().isRGB?V(m):L(m);this._color1=(0,l.generateColor)(g,c);const y=this._histogramBase?this._histogramBase:(0,s.ensureNotNull)(this._study.priceScale()).height(),S=n.plottype.value(),b={barSpacing:this._model.timeScale().barSpacing(),items:this._items,histogramBase:y,lineIndex:0,lineStyle:n.linestyle.value(),lineColor:this._lineColor,lineWidth:(0,a.isNumber)(this._lineWidth)?this._lineWidth:1,color1:this._color1,color2:this._color2,bottom:y,visibleItemsRange:{startItemIndex:e,endItemIndex:t},simpleMode:this._colorProvider.singleColor(),skipHoles:[R.LineStudyPlotStyle.Line,R.LineStudyPlotStyle.Area,R.LineStudyPlotStyle.Cross,R.LineStudyPlotStyle.Circles,R.LineStudyPlotStyle.StepLine,R.LineStudyPlotStyle.StepLineWithDiamonds].includes(S)},w=this._renderer,x=Boolean(null==h?void 0:h.joinPoints);switch(S){case R.LineStudyPlotStyle.Line:case R.LineStudyPlotStyle.LineWithBreaks:w.append(new _.PaneRendererLine(b));break;case R.LineStudyPlotStyle.Area:case R.LineStudyPlotStyle.AreaWithBreaks:w.append(new u.PaneRendererArea(b));break;case R.LineStudyPlotStyle.Histogram:w.append(new T(b));break;case R.LineStudyPlotStyle.Columns:w.append(new I.PaneRendererColumns(b));break;case R.LineStudyPlotStyle.Cross:w.append(new P(b)),x&&w.append(new _.PaneRendererLine({...(0,d.deepCopy)(b),lineWidth:1,forceLineWidth:!0}));break;case R.LineStudyPlotStyle.Circles:w.append(new C(b)),x&&w.append(new _.PaneRendererLine({...(0,d.deepCopy)(b),lineWidth:1,ignorePaletteLineWidth:!0}));break;case R.LineStudyPlotStyle.StepLine:case R.LineStudyPlotStyle.StepLineWithBreaks:case R.LineStudyPlotStyle.StepLineWithDiamonds:{const e=new p.PaneRendererStepLine;e.setData({...b,decoration:n.plottype.value()===R.LineStudyPlotStyle.StepLineWithDiamonds?p.StepLineDecoration.Diamonds:p.StepLineDecoration.None,extendToBarsEndings:this._extendStepLineToBarsEndings}),w.append(e);break}default:w.append(new _.PaneRendererLine(b))}this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&w.append(new f.SelectionRenderer(this._selectionData))}_updateAdditionalPrices(e,t){var i;const s=null===(i=this._study.metaInfo().styles)||void 0===i?void 0:i[this._plotName];void 0!==(null==s?void 0:s.histogramBase)&&(this._histogramBase=e.priceToCoordinate(s.histogramBase,t))}}},821885:(e,t,i)=>{"use strict";i.d(t,{PaneRendererAbstractFillStrokeShape:()=>m,PaneRendererAbstractShape:()=>p,PaneRendererAbstractStrokeShape:()=>f});var s=i(650151),r=i(86441),n=i(934026),o=i(150335),a=i(315801),l=i(318041),d=i(600642),h=i(422333),u=i(43192),c=i(199471),_=i(638456);class p extends u.BitmapCoordinatesPaneRenderer{constructor(e,t={skipRenderingOptimizations:!1}){super(),this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new l.TextImageCachesContainer(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}hitTest(e){ const t=a.HitTarget.Regular;let i=null;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,n.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new a.HitTestResult(t,e)}}return i}setData(e){var t,i,s,r;if(this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"),void 0!==e.items&&void 0!==e.barSpacing){const n=null!==(i=null===(t=e.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,o=null!==(r=null===(s=e.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:e.items.length;this.setItems(o>n?e.items.slice(n,o):[],e.barSpacing)}}setItems(e,t){this._setBaseData(e,t)}_drawImpl(e){this._preDrawInit(),this._drawOperation(e)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,n=i.textImageHeight,o=s/2,a=e.y+t+e.textVertOffset,l=t>0?0:-n,d=t>0?n:0,h=new r.Point(e.center-o,a+l),u=new r.Point(e.center+o,a+d);return(0,r.box)(h,u)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),n=Math.min(e.min.y,t.min.y),o=Math.max(e.max.y,t.max.y),a=new r.Point(i,n),l=new r.Point(s,o);return(0,r.box)(a,l)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){if((0,o.isNaN)(t.y))continue;const e=void 0===t.width?(0,s.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,s.ensureDefined)(this._height):t.height,r=void 0===t.vertOffset?this._vertOffset:t.vertOffset,n=r>0?i:-i;this._items.push({width:e,height:i,vertOffset:r,textVertOffset:n,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t){const i=this._getTextCache(t);if(null===i)return;const s=t.center,r=t.vertOffset,n=t.y+r+t.textVertOffset;let o;o=t.style&&void 0!==t.style.textColor?t.style.textColor:this._textColor;const a={style:{fillStyle:o},location:{x:s,y:n,horzAlign:d.HorizontalAlign.Center,vertAlign:r>0?d.VerticalAlign.Top:d.VerticalAlign.Bottom}};i.paintTo(e,a)}_drawWithOptimizations(e){let t,i,s=null,r=!1;for(const n of this._items)(0,o.isNaN)(n.y)||(n.style&&void 0!==n.style.color?(t=n.style.color||"rgba(0, 0, 0, 0)",i=n.style.borderColor||"rgba(0, 0, 0, 0)"):(t=this._color,i=this._borderColor),(s!==t||_.isSafari)&&(s=t,r&&this._endPath(e),this._startPath(e,t,i)),this._drawItemShape(e,n),r=!0);r&&this._endPath(e);for(const t of this._items)(0,o.isNaN)(t.y)||this._drawItemText(e,t)}_drawWithoutOptimizations(e){let t,i;for(const r of this._items){if((0,o.isNaN)(r.y))continue;const n=(0,s.ensureDefined)(r.style);t=n.color||"rgba(0, 0, 0, 0)",i=n.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i),this._drawItemShape(e,r), this._endPath(e),this._drawItemText(e,r)}}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e;(0,c.drawScaled)(i,s,r,(()=>this._drawItemShapeUsingCSSPixels(i,t)))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i){}_endPath(e){}_getTextCache(e){var t,i;const s=e.text||this._text,r=e.fontSize||this._fontSize,n=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,o=e.textAlign||this._textAlign,a=null!==(i=e.font)&&void 0!==i?i:h.CHART_FONT_FAMILY;return this._textCache.get({text:s,bold:!1,italic:!1,font:a,fontSize:r,lineSpacing:n,align:o})}}class f extends p{_startPath(e,t,i){const s=e.context;s.beginPath(),s.lineWidth=this._lineWidth(e),s.lineCap="butt",s.strokeStyle=t}_endPath(e){e.context.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.horizontalPixelRatio))}}class m extends p{_startPath(e,t,i){const s=e.context;s.beginPath(),s.lineWidth=this._lineWidth(e),s.lineCap="butt",s.fillStyle=t,s.strokeStyle=i}_endPath(e){const t=e.context;t.fill(),t.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.horizontalPixelRatio))}}},111595:(e,t,i)=>{"use strict";i.d(t,{PaneRendererArrowDown:()=>l,PaneRendererArrowUp:()=>a});var s=i(86441),r=i(821885),n=i(678515);class o extends r.PaneRendererAbstractFillStrokeShape{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,o=this._lineWidth(e)%2?.5:0,a=this._sign,l=this._arrowWidth,d=this._headHeight,h=Math.abs(t.height),u=Math.round(t.center*s)+o,c=t.vertOffset,_=Math.round((t.y+c+a*h/2)*r)+o,p=(0,n.ceiledEven)(l*s),f=p/2,m=Math.round(h*r),v=Math.round(d*r);i.translate(u,_),this._thinArrow?(i.moveTo(0,0),i.lineTo(-f,-f*a),i.moveTo(0,0),i.lineTo(f,-f*a),i.moveTo(0,0),i.lineTo(0,-m*a),i.moveTo(-f,-m*a),i.lineTo(f,-m*a)):(i.moveTo(0,0),m{"use strict";i.d(t,{PaneRendererCircleShape:()=>o});var s=i(86441),r=i(821885);const n=2*Math.PI ;class o extends r.PaneRendererAbstractFillStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=Math.max(t.width,t.height)/2,s=t.center,r=t.vertOffset,o=t.y+r;e.moveTo(s+i,o),e.arc(s,o,i,0,n,!1)}_calcBoundingBox(e){const t=Math.max(e.width,e.height)/2,i=e.center,r=e.vertOffset,n=e.y+r,o=i-t,a=i+t,l=n-t,d=n+t,h=new s.Point(o,l),u=new s.Point(a,d);let c=(0,s.box)(h,u);const _=super._calcBoundingBox(e);return _&&(c=this._unionBox(c,_)),c}}},506366:(e,t,i)=>{"use strict";i.d(t,{PaneRendererCrossShape:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractStrokeShape{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,a=t.center-n/2,l=t.vertOffset,d=t.y-o/2+l,h=this._lineWidth(e),u=h%2?.5:0,c=Math.round(a*s);let _=Math.round((a+n)*s);(_-c)%2!=h%2&&(_+=1);const p=Math.floor((c+_)/2)+u,f=Math.round(d*r);let m=Math.round((d+o)*r);(m-f)%2!=h%2&&(m+=1);const v=Math.floor((f+m)/2)+u;i.moveTo(p,f),i.lineTo(p,m),i.moveTo(c,v),i.lineTo(_,v)}_calcBoundingBox(e){const t=e.width,i=e.height,r=e.center-t/2,n=e.vertOffset,o=e.y-i/2+n,a=r,l=r+t,d=o,h=o+i,u=new s.Point(a,d),c=new s.Point(l,h);let _=(0,s.box)(u,c);const p=super._calcBoundingBox(e);return p&&(_=this._unionBox(_,p)),_}}},992885:(e,t,i)=>{"use strict";i.d(t,{PaneRendererDiamond:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=Math.round(t.height/2),s=t.center,r=t.vertOffset,n=t.y+r;e.moveTo(s,n-i),e.lineTo(s+i,n),e.lineTo(s,n+i),e.lineTo(s-i,n),e.lineTo(s,n-i)}_calcBoundingBox(e){const t=Math.round(e.height/2),i=e.center,r=e.vertOffset,n=e.y+r,o=i-t,a=i+t,l=n-t,d=n+t,h=new s.Point(o,l),u=new s.Point(a,d);let c=(0,s.box)(h,u);const _=super._calcBoundingBox(e);return _&&(c=this._unionBox(c,_)),c}}},618241:(e,t,i)=>{"use strict";i.d(t,{PaneRendererFlagShape:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=s/2,n=(i-3)/3,o=t.center-i/2,a=t.vertOffset,l=t.y-r+a;e.moveTo(o,l),e.lineTo(o+3,l),e.bezierCurveTo(o+n,l-n,o+2*n,l+n,o+i,l),e.lineTo(o+i,l+r),e.bezierCurveTo(o+i-n,l+r+n,o+i-2*n,l+r-n,o+3,l+r),e.lineTo(o+3,l+s),e.lineTo(o,l+s),e.lineTo(o,l)}_calcBoundingBox(e){const t=e.width,i=e.height,r=i/2,n=e.center-t/2,o=e.vertOffset,a=e.y-r+o,l=n,d=n+t,h=a,u=a+i,c=new s.Point(l,h),_=new s.Point(d,u);let p=(0,s.box)(c,_);const f=super._calcBoundingBox(e);return f&&(p=this._unionBox(p,f)),p}}},379730:(e,t,i)=>{"use strict";i.d(t,{CornerVectorsClockwise:()=>s,PaneRendererLabelBase:()=>a});var s,r=i(650151),n=i(821885),o=i(600642);class a extends n.PaneRendererAbstractFillStrokeShape{setItems(e,t){this._setBaseData(e,t);for(const e of this._items){if(e.fontSize){const t=e.fontSize;e.stepX=Math.round(t/1.5),e.stepY=Math.round(t/2)-1}else{const t=e.height;e.stepX=Math.round(t/2*.65)+.5,e.stepY=e.stepX}e.vertOffset=this._calcVertOffset(e);const t=this._getTextCache(e);if(null===t){e.shapeWidth=2*e.stepX,e.shapeHeight=2.5*e.stepY;continue} const i=t.textImageWidth,s=t.textImageHeight;e.shapeWidth=i+2*e.stepX,e.shapeHeight=s+2*e.stepY,e.vertOffset=this._calcVertOffset(e),e.textHorizOffset=this._getHorizontalTextOffset(e),e.textVertOffset=this._getVerticalTextOffset(e)}}_calcVertOffset(e){return e.vertOffset}_drawCorner(e,t,i,s){const{context:r,horizontalPixelRatio:n}=e,o=Math.max(1,Math.floor(2*n));r.lineTo(t-o*s.prevPointSignX,i-o*s.prevPointSignY),r.arcTo(t,i,t+o*s.nextPointSignX,i+o*s.nextPointSignY,o)}_getArrowSize(e){return e.stepX}_getHorizontalTextOffset(e){return 0}_getVerticalTextOffset(e){return 0}_hasText(e){return Boolean(e.text)||Boolean(this._text)}_drawItemText(e,t){var i;const s=this._getTextCache(t);if(null===s)return;const n=t.textHorizOffset||0,a=t.center+n,l=t.vertOffset,d=t.y+l+t.textVertOffset,h=(null===(i=t.style)||void 0===i?void 0:i.textColor)||this._textColor,u={style:{fillStyle:(0,r.ensureDefined)(h)},location:{x:a,y:Math.floor(d),horzAlign:o.HorizontalAlign.Center,vertAlign:o.VerticalAlign.Middle}};s.paintTo(e,u)}}class l{constructor(e,t,i,s){this.prevPointSignX=e,this.prevPointSignY=t,this.nextPointSignX=i,this.nextPointSignY=s}}!function(e){e.rightUp=new l(1,0,0,1),e.rightDown=new l(0,1,-1,0),e.leftDown=new l(-1,0,0,-1),e.leftUp=new l(0,-1,1,0)}(s||(s={}))},778190:(e,t,i)=>{"use strict";i.d(t,{PaneRendererLabelCenter:()=>d,PaneRendererLabelDown:()=>o,PaneRendererLabelLeft:()=>a,PaneRendererLabelRight:()=>l,PaneRendererLabelUp:()=>n});var s=i(86441),r=i(379730);class n extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,r=e.y+e.vertOffset,n=e.y+e.shapeHeight+e.vertOffset,o=new s.Point(t,r),a=new s.Point(i,n);return(0,s.box)(o,a)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,a=Math.max(1,Math.floor(s))%2?.5:0,l=this._getArrowSize(t);let d=Math.round(l*s);(a+d)%1!=o%1&&(d+=.5);let h=Math.round(t.shapeWidth/2*s);(a+h)%1!=o%1&&(h+=.5);const u=Math.round(t.center*s)+a,c=Math.round((t.y+t.vertOffset)*n)+o,_=u-d,p=Math.round((t.y+t.vertOffset+l)*n)+o,f=u+d,m=u+h,v=Math.round((t.y+t.vertOffset+l+t.shapeHeight)*n)+o,g=u-h;i.moveTo(_,p),i.lineTo(u,c),i.lineTo(f,p),t.shapeWidth<=2*l?(i.lineTo(m,p),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightDown),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftDown),i.lineTo(g,p)):(this._drawCorner(e,m,p,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightDown),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,g,p,r.CornerVectorsClockwise.leftUp)),i.lineTo(_,p)}_getVerticalTextOffset(e){return e.shapeHeight/2+this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)>=0?e.vertOffset:e.vertOffset-e.shapeHeight}}class o extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,r=e.y-e.shapeHeight+e.vertOffset,n=e.y+e.vertOffset,o=new s.Point(t,r),a=new s.Point(i,n);return(0,s.box)(o,a)}_drawItemShape(e,t){ const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,a=Math.max(1,Math.floor(s))%2?.5:0,l=this._getArrowSize(t);let d=Math.round(l*s);(a+d)%1!=o%1&&(d+=.5);let h=Math.round(t.shapeWidth/2*s);(a+h)%1!=o%1&&(h+=.5);const u=Math.round(t.center*s)+a,c=Math.round((t.y+t.vertOffset)*n)+o,_=u+d,p=Math.round((t.y+t.vertOffset-l)*n)+o,f=u-d,m=u+h,v=Math.round((t.y+t.vertOffset-t.shapeHeight-l)*n)+o,g=u-h;i.moveTo(_,p),i.lineTo(u,c),i.lineTo(f,p),t.shapeWidth<=2*l?(i.lineTo(g,p),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightUp),i.lineTo(m,p)):(this._drawCorner(e,g,p,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,m,p,r.CornerVectorsClockwise.rightDown)),i.lineTo(_,p)}_getVerticalTextOffset(e){return-e.shapeHeight/2-this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)<=0?e.vertOffset:e.vertOffset+e.shapeHeight}}class a extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center,i=e.center+e.shapeWidth,r=e.y-e.shapeHeight/2+e.vertOffset,n=e.y+e.shapeHeight/2+e.vertOffset,o=new s.Point(t,r),a=new s.Point(i,n);return(0,s.box)(o,a)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,a=this._getArrowSize(t),l=this._hasText(t),d=l?t.shapeHeight/2:a,h=Math.round(t.center*s)+o,u=Math.round((t.y+t.vertOffset)*n)+o,c=Math.round((t.center+a)*s)+o,_=Math.round((t.y+t.vertOffset+a)*n)+o,p=Math.round((t.y+t.vertOffset-a)*n)+o,f=Math.round((t.y+t.vertOffset-d)*n)+o,m=Math.round((t.center+t.shapeWidth+a)*s)+o,v=Math.round((t.y+t.vertOffset+d)*n)+o;i.moveTo(c,_),i.lineTo(h,u),i.lineTo(c,p),l?this._drawCorner(e,c,f,r.CornerVectorsClockwise.leftUp):i.lineTo(c,f),this._drawCorner(e,m,f,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightDown),l?this._drawCorner(e,c,v,r.CornerVectorsClockwise.leftDown):i.lineTo(c,v),i.lineTo(c,_)}_getHorizontalTextOffset(e){return e.shapeWidth/2+this._getArrowSize(e)}}class l extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth,i=e.center,r=e.y-e.shapeHeight/2+e.vertOffset,n=e.y+e.shapeHeight/2+e.vertOffset,o=new s.Point(t,r),a=new s.Point(i,n);return(0,s.box)(o,a)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,a=this._getArrowSize(t),l=this._hasText(t),d=l?t.shapeHeight/2:a,h=Math.round(t.center*s)+o,u=Math.round((t.y+t.vertOffset)*n)+o,c=Math.round((t.center-a)*s)+o,_=Math.round((t.y+t.vertOffset-a)*n)+o,p=Math.round((t.y+t.vertOffset+a)*n)+o,f=Math.round((t.y+t.vertOffset-d)*n)+o,m=Math.round((t.center-t.shapeWidth-a)*s)+o,v=Math.round((t.y+t.vertOffset+d)*n)+o;i.moveTo(c,_),i.lineTo(h,u),i.lineTo(c,p),l?this._drawCorner(e,c,v,r.CornerVectorsClockwise.rightDown):i.lineTo(c,v),this._drawCorner(e,m,v,r.CornerVectorsClockwise.leftDown), this._drawCorner(e,m,f,r.CornerVectorsClockwise.leftUp),l?this._drawCorner(e,c,f,r.CornerVectorsClockwise.rightUp):i.lineTo(c,f),i.lineTo(c,_)}_getHorizontalTextOffset(e){return-e.shapeWidth/2-this._getArrowSize(e)}}class d extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,r=e.y-e.shapeHeight/2+e.vertOffset,n=e.y+e.shapeHeight/2+e.vertOffset,o=new s.Point(t,r),a=new s.Point(i,n);return(0,s.box)(o,a)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,a=t.shapeHeight/2,l=t.shapeWidth/2,d=Math.round(t.center*s)+o,h=Math.round((t.center-l)*s)+o,u=Math.round((t.center+l)*s)+o,c=Math.round((t.y+t.vertOffset-a)*n)+o,_=Math.round((t.y+t.vertOffset+a)*n)+o;i.moveTo(d,c),this._drawCorner(e,u,c,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,u,_,r.CornerVectorsClockwise.rightDown),this._drawCorner(e,h,_,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,h,c,r.CornerVectorsClockwise.leftUp),i.lineTo(d,c)}}},29164:(e,t,i)=>{"use strict";i.d(t,{PaneRendererSquare:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=Math.max(1,Math.floor(s))%2?.5:0,o=this._lineWidth(e)%2?.5:0;let a=Math.round(t.height/2*r);(n+a)%1!=o%1&&(a+=.5);const l=Math.round(t.center*s)+n,d=Math.round((t.y+t.vertOffset)*r)+n,h=l-a,u=d-a,c=l+a,_=d+a;i.rect(h,u,c-h,_-u)}_calcBoundingBox(e){const t=e.height,i=Math.round(t/2),r=e.center-i,n=e.vertOffset,o=e.y+n-i,a=r,l=r+t,d=o,h=o+t,u=new s.Point(a,d),c=new s.Point(l,h);let _=(0,s.box)(u,c);const p=super._calcBoundingBox(e);return p&&(_=this._unionBox(_,p)),_}}},119914:(e,t,i)=>{"use strict";i.d(t,{PaneRendererTriangleApexDown:()=>a,PaneRendererTriangleApexUp:()=>o});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_calcBoundingBox(e){const t=e.width,i=e.height,r=t/2,n=Math.round(i/3),o=e.center,a=e.vertOffset-2*n,l=e.y+a,d=o-r,h=o+r,u=l,c=l+i,_=new s.Point(d,u),p=new s.Point(h,c);let f=(0,s.box)(_,p);const m=super._calcBoundingBox(e);return m&&(f=this._unionBox(f,m)),f}}class o extends n{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,a=Math.round(o/3),l=t.vertOffset-2*a,d=this._lineWidth(e)%2?.5:0,h=Math.max(1,Math.floor(s)),u=h%2?.5:0;let c=Math.round(n*s);c%2!=h%2&&(c+=1);const _=Math.round(t.center*s)+u,p=Math.round((t.y+l)*r),f=_+c/2,m=Math.round((t.y+l+o)*r)+d,v=_-c/2;i.moveTo(_,p),i.lineTo(f,m),i.lineTo(v,m),i.lineTo(_,p)}}class a extends n{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,a=Math.round(o/3),l=t.vertOffset-a,d=this._lineWidth(e)%2?.5:0,h=Math.max(1,Math.floor(s)),u=h%2?.5:0;let c=Math.round(n*s);c%2!=h%2&&(c+=1);const _=Math.round(t.center*s)+u,p=Math.round((t.y+l)*r)+d,f=_+c/2,m=Math.round((t.y+l+o)*r),v=_-c/2;i.moveTo(v,p),i.lineTo(f,p),i.lineTo(_,m),i.lineTo(v,p)}}},815555:(e,t,i)=>{"use strict";i.d(t,{ PaneRendererXCross:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=t.center-i/2,n=t.vertOffset,o=t.y-s/2+n;e.moveTo(r,o),e.lineTo(r+i,o+s),e.moveTo(r,o+s),e.lineTo(r+i,o)}_calcBoundingBox(e){const t=e.width,i=e.height,r=e.center-t/2,n=e.vertOffset,o=e.y-i/2+n,a=r,l=r+t,d=o,h=o+i,u=new s.Point(a,d),c=new s.Point(l,h);let _=(0,s.box)(u,c);const p=super._calcBoundingBox(e);return p&&(_=this._unionBox(_,p)),_}}},928483:(e,t,i)=>{"use strict";i.d(t,{StudyPaneViewInplaceUpdatable:()=>h});var s=i(650151),r=i(86441),n=i(272933),o=i(534741),a=i(674981),l=i(63316),d=i(315801);class h{constructor(e){this._selectionData=null,this._dataInvalidated=null,this._viewportInvalidated=!1,this._items=[],this._selectionIndexer=new l.SelectionIndexes(e.timeScale())}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,n.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{if((e.sourceId===this._study.id()||this._dependsOnSeriesData()&&e.sourceId===this._model.mainSeries().id())&&!e.nonSeriesOnly){const t=(0,n.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData});this._dataInvalidated=t}}}_dependsOnSeriesData(){return!1}_makeSureRendererIsValid(){this._dataInvalidated?this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null):this._viewportInvalidated&&this._updateImplLight(),this._viewportInvalidated=!1}_preallocateItems(e,t){var i,r;const n=e.size(),o=null===(i=this._dataInvalidated)||void 0===i?void 0:i.firstIndex;if(0===n)return o;const l=this._study.offset(this._plotName);if(n!==this._items.length){const i=void 0!==o?o+l:void 0;if(void 0===i||0===this._items.length||i<(0,s.ensureDefined)(this._items[0].timePointIndex))return this._items=[],e.each(((e,i)=>{const s=i[this._plotIndex+1];return this._items.push(t(e,s)),!1})),this._items.length?(0,s.ensureDefined)(this._items[0].timePointIndex)-l:void 0;{const i=(0,s.ensureDefined)(o),n=l>=0?0:l,d=l>=0?l:0;let h=(0,a.lowerbound)(this._items,i+n,((e,t)=>e.timePointIndex=0?0:l,i=l>=0?l:0;let r=(0,a.lowerbound)(this._items,o+t,((e,t)=>e.timePointIndexr+1)return{startBar:null,endBar:null};let a=this._study.plots();a=a.range(n,(0,s.ensureNotNull)(a.lastIndex())),i=Math.max(i,n),r=Math.max(r,n);const l=a.search(i,o.PlotRowSearchMode.NearestLeft,this._plotIndex+1),d=a.search(r,o.PlotRowSearchMode.NearestRight,this._plotIndex+1);return null!==l&&(i=l.index),null!==d&&(r=d.index),i=Math.max(n,i),{startBar:i,endBar:r}}_updateImplLight(){const e=this._study.firstValue();if(null===e)return this._selectionData=null,void this._updateRenderer(0,-1);const t=this._study.priceScale();if(null===t)return this._selectionData=null,void this._updateRenderer(0,-1);const i=this._model.timeScale().visibleBarsStrictRange();if(null===i)return this._selectionData=null,void this._updateRenderer(0,-1);const{startBar:s,endBar:r}=this._calculateStartEnd(i);if(null===s||null===r||0===this._items.length)return this._selectionData=null,void this._updateRenderer(0,-1);const{startItemIndex:n,endItemIndex:o}=this._correctVisibleItemIndexes(Math.max(0,(0,a.lowerbound)(this._items,s,((e,t)=>e.timePointIndexe=o)return this._selectionData=null,void this._updateRenderer(0,-1);this._convertItemsToCoordinates(t,e,n,o),this._createSelection(e),this._updateRenderer(n,o)}_correctVisibleItemIndexes(e,t){return{startItemIndex:e,endItemIndex:t}}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_convertItemsToCoordinatesImpl(e,t,i,s){for(let e=i;e{"use strict";i.d(t,{createStudyPlotColorProvider:()=>_});var s=i(368135),r=i(650151),n=i(574809);const o=new Map([[0,"color"],[2,"textColor"],[3,"borderColor"],[4,"wickColor"],[5,"colorup"],[6,"colordown"]]);class a{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return o.forEach(((e,t)=>{ this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())})),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}const l=[0,1,2,3,4,5,6];class d{constructor(e,t,i,s){this._palettesColors=new Map,this._defaultPlotColors=new Map,this._indexes=s;const n=t.styles[i];if(n)for(const[e,t]of o)this._defaultPlotColors.set(e,n[t]);const a=(0,r.ensureDefined)(e.palettes),l=e.plots;s.forEach(((e,i)=>{const s=l[e];if(s&&"palette"in s){const e=a[s.palette],r=t.palettes[s.palette];if(e&&r){const{valToIndex:t}=e,{colors:s}=r,n={...s};t&&Object.keys(t).forEach((e=>{const i=t[e];void 0!==i&&(n[e]=s[i])})),this._palettesColors.set(i,n)}}}))}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return l.forEach((t=>{var s,n;if(this._palettesColors.has(t)){const n=e[(0,r.ensureDefined)(this._indexes.get(t))+1];if("number"==typeof n){const e=null===(s=this._palettesColors.get(t))||void 0===s?void 0:s[n];0===t&&e&&(i.lineWidth=e.width.value(),i.lineStyle=e.style.value()),i.colors[t]=null==e?void 0:e.color.value()}else i.colors[t]="transparent"}else i.colors[t]=null===(n=this._defaultPlotColors.get(t))||void 0===n?void 0:n.value()})),i}getDefaultPlotPointStyle(){var e;const t=null===(e=this._palettesColors.get(0))||void 0===e?void 0:e[0];if(void 0!==t){return{colors:[t.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineStyle:void 0,lineWidth:t.width.value()}}return null}isColorDefined(){return!!this._palettesColors.size}singleColor(){return!1}}var h=i(151149);class u{constructor(e){this._rgbaFromInteger=(0,h.rgbaFromIntegerCached)(),this._indexes=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return this._indexes.forEach(((t,s)=>{const r=e[t+1];if(null!=r){const e=this._rgbaFromInteger(r);i.colors[s]=e}else i.colors[s]="transparent"})),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}}const c=new Map([[0,function(e,t){const i=(0,s.isColorerPlot)(t)||(0,s.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[2,function(e,t){const i=(0,s.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[1,function(e,t){return(0,s.isBgColorerPlot)(t)&&t.id===e}],[3,function(e,t){const i=(0,s.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[4,function(e,t){const i=(0,s.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[5,function(e,t){const i=(0,s.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[6,function(e,t){const i=(0,s.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function _(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex((e=>e.id===t)),r=new Map;return i.forEach(((e,i)=>{c.forEach(((s,n)=>{s(t,e)&&r.set(n,i)}))})),{plotIndex:-1===s?null:s,colorers:r}}(e,i);if(s.size)return e.isRGB?new u(s):new d(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new a(e[i]) ;const s=t.styles[i];return new a(s)}}},427937:(e,t,i)=>{"use strict";i.r(t),i.d(t,{createStudy:()=>Pi,isESDStudy:()=>Ii,isFundamentalStudy:()=>Ci,isRollDatesStudy:()=>xi,isStudy:()=>Si,isStudyStrategy:()=>bi,isStudyStub:()=>wi,studyColorRotationMode:()=>Ti,useSameColorRotationComparator:()=>Mi});var s=i(244842),r=i(526075),n=i(807218),o=i(980004),a=i(960769),l=i.n(a),d=i(650151),h=i(790188),u=i(444372),c=i(226663),_=i(31341),p=i(103221),f=i(389137),m=i(246733),v=i(511131),g=i(541346),y=i(943994),S=i(422333),b=i(315801),w=i(458963),C=i(382778),I=i(787123);const x={fillPath:new Path2D("M8.961.92a3 3 0 0 1 3.078 0l7.5 4.48A3 3 0 0 1 21 7.975V20a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V7.975A3 3 0 0 1 1.461 5.4l7.5-4.48z"),strokePath:new Path2D("M9.867 2.742c.39-.23.875-.23 1.266 0l7.5 4.406c.382.225.617.635.617 1.078V20c0 .69-.56 1.25-1.25 1.25H3c-.69 0-1.25-.56-1.25-1.25V8.226c0-.443.235-.853.617-1.078l7.5-4.406z")},P={fillPath:new Path2D("M8.961 22.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 15.025V3a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 17.6l7.5 4.48z"),strokePath:new Path2D("M9.866 20.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V3c0-.69-.56-1.25-1.25-1.25H3c-.69 0-1.25.56-1.25 1.25v11.765c0 .443.234.853.616 1.078l7.5 4.414z")},T={fillPath:new Path2D("M3 0h15c1.662 0 3 1.338 3 3v15c0 1.662-1.338 3-3 3H3c-1.662 0-3-1.338-3-3V3c0-1.662 1.338-3 3-3z"),strokePath:new Path2D("M3 1.75h15c.693 0 1.25.557 1.25 1.25v15c0 .693-.557 1.25-1.25 1.25H3c-.692 0-1.25-.558-1.25-1.25V3c0-.692.558-1.25 1.25-1.25z")};function R(e,t,i,s,r){const n=i.pixelRatio;e.save(),e.translate(t.x-s.lollipop.width*n/2,t.y-s.lollipop.height*n/2),e.scale(n,n),s.lollipop.fillCircle&&s.lollipop.backgroundColor&&(e.fillStyle=s.lollipop.backgroundColor,e.fill(r.fillPath)),e.strokeStyle=s.lollipop.strokeStyle,e.lineWidth=Math.round(s.lollipop.lineWidth*n)/n,(0,I.setLineStyle)(e,w.LINESTYLE_SOLID),s.lollipop.fillCircle&&s.lollipop.fillStyle&&(e.fillStyle=s.lollipop.fillStyle,e.fill(r.strokePath)),e.stroke(r.strokePath),e.restore()}class M extends C.LollipopRenderer{_drawLollipop(e,t,i){const s=this._data.style;switch(s.type){case"Positive":!function(e,t,i,s){R(e,t,i,s,x)}(e,t,i,s);break;case"Negative":!function(e,t,i,s){R(e,t,i,s,P)}(e,t,i,s);break;default:!function(e,t,i,s){R(e,t,i,s,T)}(e,t,i,s)}}}var D=i(995874),A=i(86441),V=i(224743),L=i(988124),k=i(854798),B=i(700134),N=i(232650),E=i(199687),O=i(986837);class F extends O.LollipopPaneView{constructor(){super(...arguments),this._getMoreFinancialsLinkInitialTabId=E.PageId.Overview,this._symbolName=null}addLollipop(e,t,i,s,r,n,o){var a,l;if(null===this._symbolName&&(this._symbolName=null!==(l=null===(a=this._model.mainSeries().symbolInfo())||void 0===a?void 0:a.name)&&void 0!==l?l:null,null===this._symbolName))return ;const d=`${this._source.metaInfo().id}_${this._lollipopId(n)}_${this._symbolName}`,h=this._lollipops[d],u=void 0!==h?h.itemIndex:this._lollipopsCounter++,c=this._model.lastHittestData(),_=d===this.getLastClickedLollipopId(),p=this._model.hoveredSource()===this._source&&null!==c&&c.activeItem===u;this._lollipops[d]={id:d,itemIndex:u,visible:!0,basePoint:new A.Point(i.indexToCoordinate(r),e),hovered:p,active:_,stack:o,...this.extraData(n)}}renderer(e){return this._invalidated&&(this._updateImpl(e),this._invalidated=!1),this._source.hideLollipops()?null:this._renderer}_lollipopId(e){return e[0].toString()}_updateImpl(e){const t=this._source.data(),i=this._model.timeScale(),s=i.visibleBarsStrictRange(),r=this._model.mainSeries().bars(),n=this._model.mainSeries(),o=n.priceScale(),a=n.firstBar();if(o.isEmpty()||i.isEmpty()||!a||!t||null===s)return;if(this._source.hideLollipops())return void this.clearLastClicked();for(const e in this._lollipops)this._lollipops.hasOwnProperty(e)&&((0,d.ensureDefined)(this._lollipops[e]).visible=!1);const l=this._getY(),h=s.firstBar(),u=s.lastBar(),c=this._source.zorder(),_=this._model.mainPane().lollipopDataSources().filter((e=>e!==this._source&&e.zorder()>c&&e.isVisible()));t.range(h,u).each(((e,t)=>{let s=0;for(const t of _)s+=t.lollipopsAtIndex(e);return this.addLollipop(l,r,i,o,e,t,s),!1})),this.afterUpdate(l,r,i,o),this._createRenderers(e)}_formatDate(e,t){let i,s=!0;if(s=k.Version.parse(this._source.metaInfo().version).isLessOrEqual(new k.Version(137,0)),s){let t="Etc/UTC";const s=this._model.mainSeries();if(!s.isDWM()&&(t=this._model.properties().childs().timezone.value(),"exchange"===t)){const e=s.symbolInfo();t=e&&e.timezone||""}const r=(0,L.get_timezone)(t);i=(0,L.utc_to_cal)(r,e)}else i=new Date(e);return(t?"≈ ":"")+this._model.dateFormatter().format(i)}_getMoreFinancialsLink(){var e;if(!/\betf\b/i.test((null===(e=this._model.mainSeries().symbolInfo())||void 0===e?void 0:e.description)||""))return{text:this._getMoreFinancialsLinkText(),onClick:()=>{V.globalCloseDelegate.fire(),s.enabled("mobile_app_action_open_financials_webview")?(0,N.openFinancialsWebview)(new URLSearchParams):(0,B.showFinancialsDialog)({initialTabId:this._getMoreFinancialsLinkInitialTabId})}}}_getMoreFinancialsLinkText(){var e,t;return u.t(null,{replace:{symbol:null!==(t=null===(e=this._model.mainSeries().symbolInfo())||void 0===e?void 0:e.name)&&void 0!==t?t:""}},i(633282))}_onSymbolOrIntervalChanged(){super._onSymbolOrIntervalChanged(),this._symbolName=null}}var H=i(385442),W=i(777566),z=i(261820),U=i(274469),G=i(788600),q=i(85290),$=i(315507) ;const j=u.t(null,void 0,i(376434)),Y=u.t(null,void 0,i(783851)),K=u.t(null,void 0,i(802985)),Q=u.t(null,void 0,i(396269)),X=u.t(null,void 0,i(180160)),Z=u.t(null,void 0,i(68625)),J=u.t(null,void 0,i(94647)),ee=u.t(null,void 0,i(634135)),te=u.t(null,void 0,i(400241)),ie=u.t(null,void 0,i(233481)),se=u.t(null,void 0,i(676912)),re=u.t(null,void 0,i(651924)),ne=u.t(null,void 0,i(744441)),oe=u.t(null,void 0,i(993225)),ae=u.t(null,void 0,i(259285)),le=u.t(null,void 0,i(945855)),de=u.t(null,void 0,i(354079)),he={dark:(0,h.getHexColorByName)("color-cold-gray-900"),light:(0,h.getHexColorByName)("color-white")},ue={positive:(0,h.getHexColorByName)("color-minty-green-600"),negative:(0,h.getHexColorByName)("color-ripe-red-600"),future:(0,h.getHexColorByName)("color-grapes-purple-a400"),unknown:(0,h.getHexColorByName)("color-cold-gray-350")},ce={positive:(0,h.getHexColorByName)("color-minty-green-500"),negative:(0,h.getHexColorByName)("color-ripe-red-500"),future:(0,h.getHexColorByName)("color-grapes-purple-a200"),unknown:(0,h.getHexColorByName)("color-cold-gray-700")};function _e(e){return e?ue:ce}const pe=new g.PercentageFormatter,fe=new y.VolumeFormatter;class me extends F{}class ve extends me{constructor(e,t,i){super(e,t,i)}styles(e){return e?{positive:(0,h.getHexColorByName)("color-minty-green-600"),negative:(0,h.getHexColorByName)("color-ripe-red-600"),future:(0,h.getHexColorByName)("color-grapes-purple-a400"),unknown:(0,h.getHexColorByName)("color-cold-gray-350")}:{positive:(0,h.getHexColorByName)("color-minty-green-500"),negative:(0,h.getHexColorByName)("color-ripe-red-500"),future:(0,h.getHexColorByName)("color-grapes-purple-a200"),unknown:(0,h.getHexColorByName)("color-cold-gray-700")}}extraData(e){const t=e[8],i=14===t,s=e[1],r=e[2],n=e[3],o=e[4],a=i?null:e[5],l=null!=a&&null!=r?a-r:null,d=e[6],h=i?null:e[7];let u;return null!=t?t<20?u="Future":null!==l&&(u=l<0?"Negative":"Positive"):null!==l?u=l<0?"Negative":"Positive":o>Date.now()&&(u="Future"),{standardized:s,reported:a,estimate:r,revenueValue:h,revenueEstimate:d,period:n,date:o,type:u,timeType:null!=t?t:void 0}}afterUpdate(e,t,i,s){const r=this._source.getEstimate();if(r){const n=r.value.slice();n[4]*=1e3,this.addLollipop(e,t,i,s,r.index,n)}}getStyle(e){const t=this._getLollipopStatus(e);if(void 0===e.type)return super.getStyle(e,t);const i=t;let s=i;e.stack&&(s+="_stack:"+e.stack);let r=this._getStyleObject(e.type,s);if(null!==r)return r;if(this._stylesCache||(this._stylesCache={}),!this._stylesCache[s]){r=this._getStyleObject(e.type,i);const t=(0,f.clone)(r);t&&(e.stack&&(t.lollipop.incHeight=25*e.stack),this._stylesCache[s]=t)}return this._stylesCache[s]}_createTooltipContent(e){const t=e.standardized,i=null!=t,s=e.reported,r=null!=s,n=e.estimate,o=null!=n,l=r&&o?s-n:null;let h=e.revenueEstimate,u=!1;null!=h&&(u=!0,h*=1e6);let p=e.revenueValue,f=!1;null!=p&&(f=!0,p*=1e6);const m=f&&u?p-h:null,v=_e(this._model.dark().value());let g,y,S,b,w;switch(e.type){case"Future":y=v.future,g=z;break;case"Negative":y=v.negative,g=W;break;case"Positive":y=v.positive,g=H;break ;default:y=v.unknown,g=z}switch(e.timeType){case 12:case 22:S=$,b=c.LollipopGroupIcons.AfterMarketClose,w=de;break;case 11:case 21:S=q,b=c.LollipopGroupIcons.BeforeMarketOpen,w=le}const C=10===e.timeType||14===e.timeType,I={name:se,value:this._formatDate(e.date,C)};S&&(I.valueRightIcon={iconContent:S,iconClass:b,tooltipText:w});const x=[I];e.period&&x.push({name:ne,value:a.unix(e.period).format("MMM 'YY")});const P={type:"common",title:f||u?j:Y,subTitle:x,tooltipIcon:g,style:{color:y},content:[],anchor:this._getMoreFinancialsLink()},T={title:Y,content:[]};if(i&&T.content.push({name:K,value:(0,D.roundToThirdDigit)(t)}),r&&T.content.push({name:Q,value:(0,D.roundToThirdDigit)(s)}),o&&T.content.push({name:X,value:(0,D.roundToThirdDigit)(n)}),null!==l){const e=100*Math.abs(l/n);let t=(0,D.roundToThirdDigit)(l);isFinite(e)&&(t+=" ("+pe.format(e)+")"),T.content.push({name:Z,value:(0,_.forceLTRStr)(t),style:{fontWeight:"bold",color:y}})}if((0,d.ensureDefined)(P.content).push(T),f||u){const e={title:ae,content:[]};if(f&&e.content.push({name:Q,value:fe.format(p)}),u&&e.content.push({name:X,value:fe.format(h)}),null!==m){const t=100*Math.abs(m/h);let i=fe.format(m);isFinite(t)&&(i+=" ("+pe.format(t)+")"),e.content.push({name:Z,value:(0,_.forceLTRStr)(i),style:{fontWeight:"bold",color:m>=0?v.positive:v.negative}})}(0,d.ensureDefined)(P.content).push(e)}return[P]}_showBarLine(e){return super._showBarLine(e)||this._model.mainSeries().properties().childs().esdShowBreaks.value()}_createRendererForLollipop(e,t){return new M(e,new b.HitTestResult(b.HitTarget.Custom,t),this._textWidthCache)}_recreateStyles(e){const t=e.dark().value(),i=_e(t),s=i.unknown,r={barLine:{lineStyle:w.LINESTYLE_DASHED,lineWidth:1,strokeStyle:s},lollipop:{width:21,height:21,bottom:2,lineWidth:1.5,importance:"earnings",strokeStyle:s,backgroundColor:t?he.dark:he.light,fillCircle:!0,text:{label:"E",strokeStyle:s,font:(0,v.makeFont)(12,S.CHART_FONT_FAMILY,"bold")}}},n={lollipop:{fillStyle:(0,m.generateColor)(s,85)}},o={lollipop:{fillStyle:s,text:{strokeStyle:(0,h.getHexColorByName)("color-cold-gray-50")}}};this._defaultStyle=(0,p.deepCopy)(r),this._hoveredStyle=(0,f.merge)((0,p.deepCopy)(r),n),this._activeStyle=(0,f.merge)((0,p.deepCopy)(r),o);const a=(e,t)=>{const i=(0,p.deepCopy)(r);return i.barLine.strokeStyle=e,i.lollipop.strokeStyle=e,i.lollipop.text.strokeStyle=e,i.type=t,n.lollipop.fillStyle=(0,m.generateColor)(e,85),o.lollipop.fillStyle=e,{default:i,hovered:(0,f.merge)((0,p.deepCopy)(i),n),active:(0,f.merge)((0,p.deepCopy)(i),o)}};o.lollipop.text.strokeStyle=(0,h.getHexColorByName)("color-grapes-purple-50");const l=a(i.future,"Future");r.lollipop.height=23,r.lollipop.text.deltaY=1,o.lollipop.text.strokeStyle=(0,h.getHexColorByName)("color-minty-green-50");const d=a(i.positive,"Positive");r.lollipop.bottom=.5,r.lollipop.text.deltaY=-.5,o.lollipop.text.strokeStyle=(0,h.getHexColorByName)("color-ripe-red-50");const u=a(i.negative,"Negative");this._earningTypeStyles={Future:l,Positive:d,Negative:u},this._stylesCache=null}_getStyleObject(e,t){ const i=this._earningTypeStyles[e];switch(t){case"default":return i.default;case"hovered":return i.hovered;case"active":return i.active}return null}}const ge=(0,h.getHexColorByName)("color-tan-orange-600"),ye=(0,h.getHexColorByName)("color-tan-orange-500");function Se(e){return e?ge:ye}class be extends me{extraData(e){const t=e[1];return{numerator:e[2],denominator:t,date:e[3]}}_createTooltipContent(e){let t=J;return(0,f.isNumber)(e.numerator)&&(0,f.isNumber)(e.denominator)&&(t+=": "+e.numerator+"/"+e.denominator),[{type:"common",title:t,subTitle:this._formatDate(e.date),tooltipIcon:U,style:{color:Se(this._model.dark().value())},anchor:this._getMoreFinancialsLink()}]}_recreateStyles(e){const t=e.dark().value(),i=Se(t),s={barLine:{lineStyle:w.LINESTYLE_DASHED,lineWidth:1,strokeStyle:i},lollipop:{width:23,height:23,bottom:1,lineWidth:1.5,importance:"splits",strokeStyle:i,backgroundColor:t?he.dark:he.light,fillCircle:!0,text:{label:"S",strokeStyle:i,font:(0,v.makeFont)(12,S.CHART_FONT_FAMILY,"bold")}}},r={lollipop:{fillStyle:(0,m.generateColor)(i,85)}},n={lollipop:{fillStyle:i,text:{strokeStyle:(0,h.getHexColorByName)("color-tan-orange-50")}}};this._defaultStyle=s,this._hoveredStyle=(0,f.merge)((0,p.deepCopy)(s),r),this._activeStyle=(0,f.merge)((0,p.deepCopy)(s),n),this._stylesCache=null}}const we=(0,h.getHexColorByName)("color-tv-blue-600"),Ce=(0,h.getHexColorByName)("color-tv-blue-500");function Ie(e){return e?we:Ce}class xe extends me{constructor(){super(...arguments),this._getMoreFinancialsLinkInitialTabId=E.PageId.Dividends}extraData(e){return{amountDividends:e[1],date:e[2],adjustedAmountDividends:e[3],paymentDate:e[4]}}_createTooltipContent(e){const{date:t,amountDividends:i,paymentDate:s,adjustedAmountDividends:r}=e,n=[{name:re,value:this._formatDate(t)}];return(0,f.isNumber)(i)&&n.push({name:te,value:(0,D.roundToThirdDigit)(i)}),(0,f.isNumber)(r)&&n.push({name:ie,value:(0,D.roundToThirdDigit)(r)}),(0,f.isNumber)(s)&&n.push({name:oe,value:this._formatDate(s)}),[{type:"common",title:ee,subTitle:n,tooltipIcon:G,style:{color:Ie(this._model.dark().value())},anchor:this._getMoreFinancialsLink()}]}_recreateStyles(e){const t=e.dark().value(),i=Ie(t),s={barLine:{lineStyle:w.LINESTYLE_DASHED,lineWidth:1,strokeStyle:i},lollipop:{width:23,height:23,bottom:1,lineWidth:1.5,importance:"dividends",strokeStyle:i,backgroundColor:t?he.dark:he.light,fillCircle:!0,text:{label:"D",strokeStyle:i,font:(0,v.makeFont)(12,S.CHART_FONT_FAMILY,"bold")}}},r={lollipop:{fillStyle:(0,m.generateColor)(i,85)}},n={lollipop:{fillStyle:i,text:{strokeStyle:(0,h.getHexColorByName)("color-tv-blue-50")}}};this._defaultStyle=s,this._hoveredStyle=(0,f.merge)((0,p.deepCopy)(s),r),this._activeStyle=(0,f.merge)((0,p.deepCopy)(s),n),this._stylesCache=null}_getMoreFinancialsLinkText(){var e,t;return u.t(null,{replace:{symbol:null!==(t=null===(e=this._model.mainSeries().symbolInfo())||void 0===e?void 0:e.name)&&void 0!==t?t:""}},i(177743))}}var Pe=i(888929),Te=i(732149),Re=i(782086),Me=i(555502),De=i(65455);class Ae extends n.Study{constructor(e,t,i,s){ super(e,t,i,s),this._restartRequired=!1,this.setOwnerSource(e.mainSeries());const r=this._externalVisibilityProperty();null!==r&&(this._destroyPropertyBinder=(0,De.bindProperties)(r,this._properties.childs().visible))}destroy(){var e;this._paneView.destroy(),null===(e=this._destroyPropertyBinder)||void 0===e||e.call(this),super.destroy()}lollipopsAtIndex(e){return!this.hideLollipops()&&this.data().contains(e)?1:0}hideLollipops(){return this._model.timeScale().barSpacing()/23<2/3&&this._model.mainSeries().intervalObj().inMilliseconds()>=432e6}async start(){const e=super.start();return this._model.mainSeries().dataEvents().symbolResolved().subscribe(this,this._initPlotStash),this._initPlotStash(),e}stop(){super.stop(),this._model.mainSeries().dataEvents().symbolResolved().unsubscribe(this,this._initPlotStash)}restoreData(e){e.data=e.data.filter((e=>e.index!==Te.INVALID_TIME_POINT_INDEX&&this.isValid(e.value))),this._transformData(e.data),e.end=e.data.length,super.restoreData(e)}onClickOutside(){this._paneView.processClickOutside()}preferNoScale(){return!0}showInObjectTree(){return!1}isSavedInStudyTemplates(){return!1}isRemovedByStudyTemplates(){return!1}removeByRemoveAllStudies(){return!1}isDraggable(){return!1}copiable(){return!1}statusView(){return null}hasStateForAlert(){return!1}isSavedInChart(e){return Boolean(e)}isSpeciallyZOrderedSource(){return!0}isUserDeletable(){return!1}canHaveChildren(){return!1}isIncludedInAutoScale(){return!1}isCurrencySource(){return!1}isUnitSource(){return!1}_externalVisibilityProperty(){return null}_transformData(e){for(let t=e.length-1;t>=0;--t){const i=e[t],s=i.index!==Te.INVALID_TIME_POINT_INDEX&&this.isValid(i.value);this._updatePlotStash(i,s)}}_createViews(){this._paneViews=[this._paneView],this._priceAxisViews=[],this._dataWindowView||(this._dataWindowView=new Re.DataWindowView),this._legendView=null,this._statusView||(this._statusView=new Me.StudyStatusView(this))}_seriesDataRangeToSave(e){return this._model.timeScale().visibleBarsStrictRange()}async _showTooltip(e,t){const s=this._model,r=this._model.timeScale(),n=[r.onScroll(),r.barSpacingChanged(),s.mainSeries().onSymbolIntervalChanged(),(0,d.ensureNotNull)(s.paneForSource(this)).onSizeChanged()],o=this._paneView.processClickOutside.bind(this._paneView),a=this._paneView.clearLastClicked.bind(this._paneView),l=t();if(null===l)return;const{showLollipopTooltip:h}=await Promise.all([i.e(22666),i.e(5993),i.e(92191),i.e(4015),i.e(53842),i.e(35649),i.e(72639),i.e(89842),i.e(88548),i.e(48986),i.e(36747),i.e(13821),i.e(6744),i.e(27620),i.e(42244),i.e(57215),i.e(94345),i.e(58666),i.e(54234),i.e(84372),i.e(91895),i.e(56943),i.e(2807),i.e(63823),i.e(50690),i.e(59255),i.e(45366),i.e(25827),i.e(18657),i.e(69226),i.e(49039)]).then(i.bind(i,722832));h({items:l,position:e,customCloseSubscriptions:n,onClickOutside:o,onCustomClose:a,showScrollFades:!0})}_initPlotStash(){this._plotStash={}}_updatePlotStash(e,t){if(this._restartRequired||!this._plotStash)return;const i=e.value.slice(),s=i.shift(),r=String(s) ;t?this._plotStash[r]?String(this._plotStash[r])!==String(i)&&(this._restartRequired=!0):this._plotStash[r]=i:this._plotStash[r]&&(this._restartRequired=!0)}}const Ve=Pe.sortSourcesPreOrdered.Dividends,Le=Pe.sortSourcesPreOrdered.Splits,ke=Pe.sortSourcesPreOrdered.Earnings;class Be extends Ae{zorder(){return Ve}isValid(e){const t=e[2];return(0,f.isNumber)(t)}state(e,t){const i=super.state(e,t);return i.data.version=2,i}restoreData(e){var t;(null!==(t=e.version)&&void 0!==t?t:1)<2&&e.data.forEach((e=>{e.value[3]=null})),super.restoreData(e)}_createViews(){this._paneView=new xe(this._model,this,this._showTooltip.bind(this)),super._createViews()}_externalVisibilityProperty(){return this._model.mainSeries().properties().childs().esdShowDividends}}class Ne extends Ae{zorder(){return Le}isValid(e){const t=e[3];return(0,f.isNumber)(t)}_createViews(){this._paneView=new be(this._model,this,this._showTooltip.bind(this)),super._createViews()}_externalVisibilityProperty(){return this._model.mainSeries().properties().childs().esdShowSplits}}class Ee extends Ae{constructor(){super(...arguments),this._estimatePlotRow=null}zorder(){return ke}isValid(e){const t=e[3],i=e[4];return(0,f.isNumber)(t)&&(0,f.isNumber)(i)}restoreData(e){super.restoreData(e);let t=null;if(e.estimate)t=this._restorePointset(e.estimate);else if(e.pointSets&&null==e.pointSetsVersion){const i=this._getSymbol();if(null!==i){const s=i.split(":")[1].toUpperCase();e.pointSets[i]?t=this._restorePointset(e.pointSets[i]):e.pointSets[s]&&(t=this._restorePointset(e.pointSets[s]))}}else if(e.pointSets&&"1"===e.pointSetsVersion){const i=this._getSymbol();if(null!==i){const s=i.split(":")[1].toUpperCase();e.pointSets[i]?t=e.pointSets[i].estimate:e.pointSets[s]&&(t=e.pointSets[s].estimate)}}else null!=e.estimatePlotRow&&"2"===e.pointSetsVersion&&(t=e.estimatePlotRow);this._estimatePlotRow=t}getEstimate(){return this._estimatePlotRow}_createViews(){this._paneView=new ve(this._model,this,this._showTooltip.bind(this)),super._createViews()}_externalVisibilityProperty(){return this._model.mainSeries().properties().childs().esdShowEarnings}_getSymbol(){var e,t;return null!==(t=null===(e=this._series.symbolInfo())||void 0===e?void 0:e.base_name[0].toLowerCase())&&void 0!==t?t:null}_restorePointset(e){return{index:e.index,value:[e.tickmark,void 0,e.estimate,(0,f.isNumber)(e.period)?e.period:l()(e.period).unix(),(0,f.isNumber)(e.date)?e.date:l()(e.date).unix()]}}}var Oe=i(822914),Fe=i(682103),He=i(528474);const We=[u.t(null,void 0,i(926910)),u.t(null,void 0,i(316467)),u.t(null,void 0,i(322852)),u.t(null,void 0,i(997637)),u.t(null,void 0,i(668327)),u.t(null,void 0,i(49385)),u.t(null,void 0,i(323230)),u.t(null,void 0,i(486797)),u.t(null,void 0,i(661132)),u.t(null,void 0,i(290784)),u.t(null,void 0,i(171194)),u.t(null,void 0,i(55669))],ze=new Path2D("m13 6.02.5-.52-.5-.52-3.33-3.5-1.09 1.04 2.13 2.23H6.23L2.13.95l-1.01 1.1 4.3 4 .22.2H10.71L8.58 8.48l1.09 1.04 3.34-3.5Zm-9.4.45-3 3 1.06 1.06 3-3L3.6 6.47Z");class Ue extends C.LollipopRenderer{_drawLollipop(e,t,i){ const s=i.pixelRatio,r=this._data.style;e.save(),e.translate(t.x,t.y),e.scale(s,s),e.beginPath(),e.strokeStyle=r.outerBorderColor,e.lineWidth=1,e.arc(0,0,11,0,2*Math.PI),e.stroke(),e.fillStyle=r.backgroundColor,e.beginPath(),e.arc(0,0,10.5,0,2*Math.PI),e.fill(),e.translate(-6.5,-5.5),e.fillStyle=r.iconColor,e.fill(ze),e.translate(6.5,5.5),r.borderColor&&(e.strokeStyle=r.borderColor,e.lineWidth=1.5,(0,I.setLineStyle)(e,w.LINESTYLE_SOLID),e.beginPath(),e.arc(0,0,9.75,0,2*Math.PI),e.stroke()),e.restore()}}var Ge=i(717090);const qe=u.t(null,void 0,i(520516)),$e=u.t(null,void 0,i(570323)),je=u.t(null,void 0,i(881240)),Ye=u.t(null,void 0,i(676912)),Ke={dark:{background:(0,h.getHexColorByName)("color-cold-gray-900"),foreground:(0,h.getHexColorByName)("color-deep-blue-a200"),linkColor:(0,h.getHexColorByName)("color-tv-blue-500")},light:{background:(0,h.getHexColorByName)("color-white"),foreground:(0,h.getHexColorByName)("color-deep-blue-a400"),linkColor:(0,h.getHexColorByName)("color-tv-blue-500")}},Qe={barLine:{lineStyle:w.LINESTYLE_DASHED,lineWidth:1,strokeStyle:""},lollipop:{width:21,height:21,bottom:2,lineWidth:1.5,strokeStyle:"",backgroundColor:"",fillCircle:!0,fillStyle:"",text:{label:"",strokeStyle:"",font:(0,v.makeFont)(12,S.CHART_FONT_FAMILY,"bold")}},iconColor:"",backgroundColor:"",outerBorderColor:""},Xe=["F","G","H","J","K","M","N","Q","U","V","X","Z"];function Ze(e,t){const i=Math.floor(t/100),s=t-100*i-1;return{name:`${e}${Xe[s]}${i}`,expirationDate:`${We[s]} ${i}`}}class Je extends F{extraData(e){const t=[];for(let i=0;i<4;++i){const s=3*i+1;if(!Boolean(e[s]))break;t.push({currentContractCode:e[s],nextContractCode:e[s+1],switchDate:e[s+2]})}return{items:t}}_createRendererForLollipop(e,t){return new Ue(e,new b.HitTestResult(b.HitTarget.Custom,t),this._textWidthCache)}_createTooltipContent(e){return e.items.map((e=>{const t=[{name:Ye,value:(0,Fe.formatYYYYMMDD)(this._model.dateFormatter(),e.switchDate)}],i=this._model.dark().value()?Ke.dark:Ke.light,s=this._model.mainSeries(),r=this._model.mainSeries().symbolInfo();if(null!==r&&void 0!==r.root){const n=r.listed_exchange,o={color:i.linkColor,cursor:"pointer"},a=Ze(r.root,e.currentContractCode);t.push({name:$e,value:a.name,valueStyle:o,onValueClick:()=>this._model.undoModel().setSymbol(s,`${n}:${a.name}`)}),t.push({name:" ",value:a.expirationDate});const l=Ze(r.root,e.nextContractCode);t.push({name:je,value:l.name,valueStyle:o,onValueClick:()=>this._model.undoModel().setSymbol(s,`${n}:${l.name}`)}),t.push({name:" ",value:l.expirationDate})}return{type:"common",title:qe,subTitle:t,tooltipIcon:Ge,style:{color:i.foreground}}}))}_lollipopId(e){return e[3].toString()}_showBarLine(e){return super._showBarLine(e)||this._model.mainSeries().properties().childs().showContinuousContractSwitchesBreaks.value()}_recreateStyles(e){const t=this._model.dark().value()?Ke.dark:Ke.light,i=t.foreground,s=t.background,r=(0,Oe.default)(Qe);r.iconColor=i,r.borderColor=i,r.backgroundColor=s,r.outerBorderColor=s,r.barLine.strokeStyle=i,this._defaultStyle=r;const n=(0,Oe.default)(r) ;n.backgroundColor=(0,He.blendColors)(s,(0,m.applyAlpha)(i,.15)),this._hoveredStyle=n;const o=(0,Oe.default)(r);o.backgroundColor=i,o.iconColor=s,o.borderColor=void 0,this._activeStyle=o,this._stylesCache=null}}class et extends Ae{zorder(){return Pe.sortSourcesPreOrdered.RollDates}isValid(e){const t=e[4];return(0,f.isNumber)(t)}_createViews(){this._paneView=new Je(this._model,this,this._showTooltip.bind(this)),super._createViews()}_externalVisibilityProperty(){return this._model.mainSeries().properties().childs().showContinuousContractSwitches}}var tt=i(709081),it=i(682541),st=i(772466);class rt extends st.NonSeriesStudy{startIndex(){const e=this.customData();if(null==e||null==this._indexes)return null;const t=this._indexes[e.startIndex];return t!==Te.INVALID_TIME_POINT_INDEX?t:null}endIndex(){const e=this.customData();if(null==e||null==this._indexes)return null;const t=this._indexes[e.endIndex];return t!==Te.INVALID_TIME_POINT_INDEX?t:null}baseLine(){const e=this.customData();return null!=e?e.baseLine:null}downLine(){const e=this.customData();return null!=e?e.downLine:null}upLine(){const e=this.customData();return null!=e?e.upLine:null}pearsons(){const e=this.customData();return null!=e&&void 0!==e.pearsons?e.pearsons:null}isVisible(){if(!this.properties().childs().visible.value()||!this.isActualInterval())return!1;const e=(0,d.ensureDefined)(this.properties().childs().styles.childs());return 0!==e.upLine.childs().display.value()||0!==e.downLine.childs().display.value()||0!==e.baseLine.childs().display.value()}_createViews(){super._createViews(),Promise.all([i.e(77028),i.e(20507)]).then(i.bind(i,554855)).then((({LinearRegressionPaneView:e})=>{this._setPaneViews([new e(this.model(),this)])}))}}var nt=i(894718),ot=i(401580),at=i(291784);var lt=i(229765);class dt extends lt.PriceAxisView{constructor(e,t){super(),this._source=e,this._styleId=t}_updateRendererData(e,t,i){var s;e.visible=!1;const r=this._source.priceScale(),n=this._source.properties().childs();if(!r||r.isEmpty()||!n.visible.value())return;const o=null===(s=this._source.properties().childs().graphics.childs().horizlines)||void 0===s?void 0:s.childs()[this._styleId].childs();if(!(o&&o.visible&&o.visible.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const a=this._source.model().timeScale().logicalRange(),l=this._source.firstValue();if(null===l||null===a)return;const d={price:NaN,time:-1/0},h=this._source.graphics().horizlines().get(this._styleId);if(void 0===h)return;for(const e of h){if(void 0===e.level)continue;const t=a.contains(e.startIndex,!0);t===a.contains(e.endIndex,!0)&&0!==t||d.timenew dt(this,e)))}_createStudyPlotPaneView(e){return new ht.StudyPlotPaneView(this,this._series,this._model,e,this._needExtendToBarsEnding())}_apiInputs(){return{...super._apiInputs(),mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}class ct extends ut{priceRange(e,t){let i=!1;this.graphics().hhists().forEach(((e,t)=>{var s;i=i||(0,d.ensureDefined)(null===(s=this.properties().childs().graphics.childs().hhists)||void 0===s?void 0:s.childs()[t]).value()}));const s=function(e,t,i,s){let r=null;return e.forEach(((e,s)=>{e.forEach((e=>{e.firstBarTime<=i&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow{e.call(t,i,i,this)}))}has(e){let t=!1;return this._mostDetailedHorizLines().forEach((i=>{t=t||i===e})),t}get size(){return this._rough.size}[Symbol.iterator](){const e=this._mostDetailedHorizLines().entries();return{[Symbol.iterator](){return this},next(){const t=e.next();return!0===t.done?t:{value:t.value[1]}}}}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){throw new Error("Not implemented")}_mostDetailedHorizLines(){const e=new Map;this._rough.forEach((t=>e.set(t.startIndex,t)));for(let t=this._detailed.length-1;t>=0;t--){this._detailed[t].forEach((t=>{e.has(t.startIndex)&&e.set(t.startIndex,t)}))}return e}}class wt{constructor(e,t){this._mergedHorizLinesSet=e,this._roughIterator=t} [Symbol.iterator](){return this}next(){const e=this._roughIterator.next();if(!0===e.done)return e;const t=e.value[0];return{value:[t,(0,d.ensureDefined)(this._mergedHorizLinesSet.get(t))]}}}class Ct{constructor(e,t){this._roughHorizLineSets=e,this._detailedHorizLineSets=t}forEach(e,t){this._roughHorizLineSets.forEach(((i,s)=>{e.call(t,(0,d.ensureDefined)(this.get(s)),s,this)}))}get(e){const t=this._roughHorizLineSets.get(e);if(void 0!==t)return new bt(t,this._detailedHorizLineSets.map((t=>t.get(e))).filter((e=>void 0!==e)))}has(e){return this._roughHorizLineSets.has(e)}get size(){return this._roughHorizLineSets.size}[Symbol.iterator](){return new wt(this,this._roughHorizLineSets.entries())}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){throw new Error("Not implemented")}}class It{constructor(e,t){this._rough=e,this._detailed=t}forEach(e,t){this._rough.forEach(((i,s)=>{for(const i of this._detailed){const r=i.get(s);if(void 0!==r)return void e.call(t,r,s,this)}e.call(t,i,s,this)}))}get(e){for(const t of this._detailed){const i=t.get(e);if(void 0!==i)return i}return this._rough.get(e)}has(e){for(const t of this._detailed){if(t.has(e))return!0}return this._rough.has(e)}get size(){return this._rough.size}[Symbol.iterator](){throw new Error("Not implemented")}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){throw new Error("Not implemented")}}class xt{constructor(e,t){this._graphics=e,this._styleId=t}forEach(e,t){this._graphics.hhistsByTimePointIndex().forEach((i=>{i.forEach((i=>{if(i.styleId===this._styleId){const s={firstBarTime:i.firstBarTime,lastBarTime:i.lastBarTime,rate:i.rate,priceHigh:i.priceHigh,priceLow:i.priceLow};e.call(t,s,s,this)}}))}))}has(e){let t=!1;return this._graphics.hhistsByTimePointIndex().forEach((i=>{i.forEach((i=>{i.styleId===this._styleId&&i===e&&(t=!0)}))})),t}get size(){let e=0;return this._graphics.hhistsByTimePointIndex().forEach((t=>{t.forEach((t=>{t.styleId===this._styleId&&e++}))})),e}[Symbol.iterator](){const e=this._graphics.hhistsByTimePointIndex()[Symbol.iterator]();let t,i;return{[Symbol.iterator](){return this},next(){for(;;){if(void 0===t&&(i=void 0,t=e.next(),!t.done&&!t.value))return{done:!0,value:void 0};const s=t.value;i||(i=s[Symbol.iterator]());const r=i.next();if(!r.done)return{value:r.value};{const e=t;if(t=void 0,r.value)return{value:r.value,done:e.done}}}}}}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){throw new Error("Not implemented")}}class Pt{constructor(e,t){this._graphicsInfo=e,this._graphics=t}forEach(e,t){if(void 0===this._graphicsInfo.hhists)return;const i=Object.keys(this._graphicsInfo.hhists);for(const s of i)e.call(t,(0,d.ensureDefined)(this.get(s)),s,this)}get(e){if(void 0!==this._graphicsInfo.hhists)return new xt(this._graphics,e)}has(e){return void 0!==this._graphicsInfo.hhists&&e in this._graphicsInfo.hhists}get size(){return void 0===this._graphicsInfo.hhists?0:Object.keys(this._graphicsInfo.hhists).length} [Symbol.iterator](){var e,t;const i=Object.keys(null!==(t=null===(e=this._graphicsInfo)||void 0===e?void 0:e.hhists)&&void 0!==t?t:{})[Symbol.iterator]();return{[Symbol.iterator](){return this},next:()=>{const e=i.next();return e.done?{done:!0,value:e.value?[e.value,(0,d.ensureDefined)(this.get(e.value))]:void 0}:{value:[e.value,(0,d.ensureDefined)(this.get(e.value))],done:e.done}}}}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){throw new Error("Not implemented")}}class Tt{constructor(e,t,i){this._graphicsInfo=e,this._roughStudyGraphics=t,this._detailedStudyGraphics=i}horizlines(){return new Ct(this._roughStudyGraphics.horizlines(),this._detailedStudyGraphics.map((e=>e.horizlines())))}vertlines(){return this._roughStudyGraphics.vertlines()}lines(){return this._roughStudyGraphics.lines()}hlines(){return this._roughStudyGraphics.hlines()}textmarks(){return this._roughStudyGraphics.textmarks()}shapemarks(){return this._roughStudyGraphics.shapemarks()}backgrounds(){return this._roughStudyGraphics.backgrounds()}polygons(){return this._roughStudyGraphics.polygons()}trendchannels(){return this._roughStudyGraphics.trendchannels()}hhists(){return new Pt(this._graphicsInfo,this)}hhistsByTimePointIndex(){return new It(this._roughStudyGraphics.hhistsByTimePointIndex(),this._detailedStudyGraphics.map((e=>e.hhistsByTimePointIndex())))}dwglabels(){return this._roughStudyGraphics.dwglabels()}dwglines(){return this._roughStudyGraphics.dwglines()}dwgpolylines(){return this._roughStudyGraphics.dwgpolylines()}dwgboxes(){return this._roughStudyGraphics.dwgboxes()}dwgtables(){return this._roughStudyGraphics.dwgtables()}dwgtablecells(){return this._roughStudyGraphics.dwgtablecells()}dwglinefills(){return this._roughStudyGraphics.dwglinefills()}tpos(){return this._roughStudyGraphics.tpos()}tpoBlockSets(){return this._roughStudyGraphics.tpoBlockSets()}tpoBlockSetsByStyleAndTpoId(e,t){return this._roughStudyGraphics.tpoBlockSetsByStyleAndTpoId(e,t)}tpoLevels(){return this._roughStudyGraphics.tpoLevels()}tpoVolumeRows(){return this._roughStudyGraphics.tpoVolumeRows()}tpoVolumeRowByStyleAndTpoId(e,t){return this._roughStudyGraphics.tpoVolumeRowByStyleAndTpoId(e,t)}logs(){return this._roughStudyGraphics.logs()}performance(){return this._roughStudyGraphics.performance()}footprints(){return this._roughStudyGraphics.footprints()}footprintLevels(){return this._roughStudyGraphics.footprintLevels()}}var Rt=i(964824),Mt=i(347710);const Dt="tv-volumebyprice",At=(0,ft.studyIdString)("VbPSessionsRough",Dt),Vt=(0,ft.studyIdString)("VbPSessionsDetailed",Dt),Lt=(0,ft.studyIdString)("VbPSessionsDetailedAlerts",Dt),kt=Number.MAX_SAFE_INTEGER,Bt=u.t(null,void 0,i(421934));class Nt extends ct{constructor(e,t,i,s){super(e,t,i,s),this._isPackageAvailable=Et(),this._alertsStudyMetaInfo=null,this._roughDataSource=null,this._detailedDataSource=null,this._detailedDataBuffer=new _t.CircularBuffer(7),this._loadedGraphics=null,this._loadedPlots=null,this._mergedGraphics=(0,St.emptyStudyGraphics)(), this._mergedPlots=this._emptyPlotList(),this._isPackageAvailable||this._setStatus({type:vt.StudyStatusType.Error,errorDescription:{error:Bt}})}destroy(){null!==this._detailedDataSource&&(this._detailedDataSource.dataUpdated().unsubscribe(this,this._onRoughOrDetailedDataUpdated),this._detailedDataSource.dataCleared().unsubscribe(this,this._onRoughOrDetailedDataCleared),this._detailedDataSource.studyStatusChanged().unsubscribe(this,this._onStudyStatusChanged),this._detailedDataSource.destroy(),this._detailedDataSource=null),null!==this._roughDataSource&&(this._roughDataSource.dataUpdated().unsubscribe(this,this._onRoughOrDetailedDataUpdated),this._roughDataSource.dataCleared().unsubscribe(this,this._onRoughOrDetailedDataCleared),this._roughDataSource.studyStatusChanged().unsubscribe(this,this._onStudyStatusChanged),this._roughDataSource.destroy(),this._roughDataSource=null),super.destroy()}data(){return this._loadedPlots||this._mergedPlots}graphics(){return this._loadedGraphics||this._mergedGraphics}clearData(){null!==this._roughDataSource&&this._roughDataSource.clearData(),null!==this._detailedDataSource&&this._detailedDataSource.clearData()}restoreData(e){this._invalidateLastNonEmptyPlotRowCache(),this._loadedPlots=this._emptyPlotList(),this._loadedPlots.restoreState(e),void 0!==e.graphics&&(this._loadedGraphics=(0,St.loadStudyGraphics)(e.graphics)),this._postProcessGraphics()}isFailed(){return!this._isPackageAvailable||null!==this._roughDataSource&&this._roughDataSource.studyStatus().type===vt.StudyStatusType.Error||null!==this._detailedDataSource&&this._detailedDataSource.studyStatus().type===vt.StudyStatusType.Error}isLoading(){return null!==this._roughDataSource&&this._roughDataSource.studyStatus().type===vt.StudyStatusType.Loading||null!==this._detailedDataSource&&this._detailedDataSource.studyStatus().type===vt.StudyStatusType.Loading}isStarted(){return null!==this._roughDataSource&&this._roughDataSource.isStarted()||null!==this._detailedDataSource&&this._detailedDataSource.isStarted()}sourceId(){throw new Error("Invalid operation")}idForAlert(){return super._collectDepsForAlert().idForAlert}canHaveChildren(){return!1}isChildStudy(){return!1}hasChildren(){return!1}getAllChildren(){return[]}isHibernated(){return!(this.isVisible()||null!==this._roughDataSource&&this._roughDataSource.isStarted()||null!==this._detailedDataSource&&this._detailedDataSource.isStarted())}_alertMetaInfo(){return this._alertsStudyMetaInfo}_stopStudyOnServer(){var e,t;this._chartApi&&this._chartApi.isConnected().value()&&((null===(e=this._roughDataSource)||void 0===e?void 0:e.isStarted())&&this._roughDataSource.stop(),(null===(t=this._detailedDataSource)||void 0===t?void 0:t.isStarted())&&this._detailedDataSource.stop())}async _startAfterSymbolsResolved(e,t){if(!this.isStarted()||this.isRestarting())if(this._restarting=!1,this._isPackageAvailable=Et(),this._isPackageAvailable){if(this._allInputsAreValid()){if(this._inputs=this._apiInputs(),null===this._roughDataSource){const e=await(0,Mt.studyMetaInfoRepository)().findById({type:"java", studyId:At});this._roughDataSource=new gt.ExtendedStudyDataSource(this.model().chartApi(),this.model().mainSeries(),"vbpsessionsrough_",e),this._roughDataSource.studyStatusChanged().subscribe(this,this._onStudyStatusChanged),this._roughDataSource.dataCleared().subscribe(this,this._onRoughOrDetailedDataCleared),this._roughDataSource.dataUpdated().subscribe(this,this._onRoughOrDetailedDataUpdated)}else this._roughDataSource.stop();if(this._roughDataSource.setInputs(Ot(this._roughDataSource.metaInfo().inputs,this._inputs)),null===this._detailedDataSource){const e=await(0,Mt.studyMetaInfoRepository)().findById({type:"java",studyId:Vt});this._detailedDataSource=new gt.ExtendedStudyDataSource(this.model().chartApi(),this.model().mainSeries(),"vbpsessionsdetailed_",e),this._detailedDataSource.studyStatusChanged().subscribe(this,this._onStudyStatusChanged),this._detailedDataSource.dataCleared().subscribe(this,this._onRoughOrDetailedDataCleared),this._detailedDataSource.dataUpdated().subscribe(this,this._onRoughOrDetailedDataUpdated)}else this._detailedDataSource.stop();this._detailedDataSource.setInputs(Ft(this._inputs)),this._roughDataSource.start(),this._detailedDataSource.start(),this._createStudyGraphics(),this._subscribeToSessionId(),this._setStatus(this._statusValueFromDataSources()),this._onStart.fire(),null===this._alertsStudyMetaInfo&&(this._alertsStudyMetaInfo=await(0,Mt.studyMetaInfoRepository)().findById({type:"java",studyId:Lt}),this._updateAlertCreationAvailable())}}else this._setStatus({type:vt.StudyStatusType.Error,errorDescription:{error:Bt}})}async _changeInputsImpl(e,t){if(null!==this._roughDataSource){if((0,mt.areStudyInputsEqual)(this._roughDataSource.metaInfo().inputs,t,e)){if(null!==this._detailedDataSource){const t=Ft(e),i=(0,mt.rangeDependentStudyInputsToTimeRange)(t);if(this._moreDetailedDataRequiredForTimeRange(i)){if(this._detailedDataSource.isActive()){const e=this._detailedDataSource.stopAndStealData();if(e.plots.size()>0||!(0,St.isStudyGraphicsEmpty)(e.graphics)){const t=(0,d.ensureNotNull)(this._detailedDataSource.inputs());e.plots=this._extractEffectiveDetailedPlotValues(e.plots,t),this._detailedDataBuffer.enqueue({lod:Ht(t),value:e})}}this._detailedDataSource.setInputs(t),this._detailedDataSource.start()}}}else this._inputs=e,this._roughDataSource.setInputs(Ot(this._roughDataSource.metaInfo().inputs,e)),this._detailedDataBuffer.clear(),null!==this._detailedDataSource&&this._detailedDataSource.setInputs(Ft(e));null!==this._detailedDataSource&&this._createStudyGraphics()}}_collectDepsForAlert(){const e=super._collectDepsForAlert();if(null===this._alertsStudyMetaInfo)throw new Error("Alerts study metainfo is not ready yet. Have you checked the alert availability using hasStateForAlert()?");return{...e,studyDependencies:e.studyDependencies.map((e=>{const t=e.study===Wt(this.metaInfo());return{id:e.id,inputs:t?(i=e.inputs,{...i,subscribeRealtime:!0}):e.inputs,study:t&&null!==this._alertsStudyMetaInfo?Wt(this._alertsStudyMetaInfo):e.study};var i}))}}_statusValueFromDataSources(){const e={ type:vt.StudyStatusType.Undefined};if(null===this._roughDataSource||null===this._detailedDataSource)return e;const t=this._roughDataSource.studyStatus(),i=this._detailedDataSource.studyStatus();if(t.type===vt.StudyStatusType.Error)return t;if(i.type===vt.StudyStatusType.Error)return i;if(t.type===vt.StudyStatusType.Loading||i.type===vt.StudyStatusType.Loading){const e=t.type===vt.StudyStatusType.Loading?t.startTime:1/0,s=i.type===vt.StudyStatusType.Loading?i.startTime:1/0;return{type:vt.StudyStatusType.Loading,startTime:Math.min(e,s)}}return t.type===vt.StudyStatusType.Completed?{type:vt.StudyStatusType.Completed}:e}_emptyPlotList(){return new pt.PlotList((0,yt.studyPlotFunctionMap)(this.metaInfo()),yt.studyEmptyPlotValuePredicate)}_createStudyPlots(){const e=(0,d.ensureNotNull)(this._roughDataSource),t=(0,d.ensureNotNull)(this._detailedDataSource);this._mergedPlots.clear();const i=[];i.push({lod:kt,value:e.plots()}),this._detailedDataBuffer.forEach((e=>{i.push({lod:e.lod,value:e.value.plots})}));const s=(0,d.ensureNotNull)(t.inputs());i.push({lod:Ht(s),value:this._extractEffectiveDetailedPlotValues(t.plots(),s)}),i.sort(((e,t)=>t.lod-e.lod));for(const e of i)e.value.each(((e,t)=>{for(const e of t)if(void 0===e)return!1;return this._mergedPlots.add(e,t),!1}));this._invalidateLastNonEmptyPlotRowCache()}_createStudyGraphics(){const e=(0,d.ensureNotNull)(this._roughDataSource),t=(0,d.ensureNotNull)(this._detailedDataSource),i=[];this._detailedDataBuffer.forEach((e=>{i.push({lod:e.lod,value:e.value.graphics})})),void 0!==this._inputs&&i.push({lod:Ht(this._inputs),value:t.graphics()}),i.sort(((e,t)=>e.lod-t.lod));const s=i.map((e=>e.value));this._mergedGraphics=new Tt(this.metaInfo().graphics,e.graphics(),s),this._postProcessGraphics()}_extractEffectiveDetailedPlotValues(e,t){const i=(0,mt.rangeDependentStudyInputsToTimeRange)(t),s=this.model().timeScale().timePointToIndex(i.from),r=this.model().timeScale().timePointToIndex(i.to);return e.size()>0?e.range(s||(0,d.ensureNotNull)(e.firstIndex()),r||(0,d.ensureNotNull)(e.lastIndex())):this._emptyPlotList()}_moreDetailedDataRequiredForTimeRange(e){const{from:t,to:i}=e;let s=!1;return(0,d.ensureNotNull)(this._roughDataSource).graphics().hhistsByTimePointIndex().forEach(((e,r)=>{if(s)return;const n=this.model().timeScale().indexToTimePoint(r);if(null===n||n{if(e.lod<=o){e.value.graphics.hhistsByTimePointIndex().has(r)&&(a=!0)}})),a||(s=!0)})),s}_onStudyStatusChanged(){const e=this.status();this._setStatus(this._statusValueFromDataSources()),e.type!==this.status().type&&this._updateAlertCreationAvailable(),(0,d.ensureDefined)(this._statusView).update()}_onRoughOrDetailedDataCleared(){null!==this._roughDataSource&&null!==this._detailedDataSource&&(this._invalidateLastNonEmptyPlotRowCache(),this._detailedDataBuffer.clear(),this._createStudyPlots(),this._createStudyGraphics(),this.updateAllViews((0,Rt.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this.model().updateSource(this))} _onRoughOrDetailedDataUpdated(e){null!==this._roughDataSource&&null!==this._detailedDataSource&&(e.length>0&&this._createStudyPlots(),this.updateAllViews((0,Rt.sourceChangeEvent)(this.id())),this.model().updateSource(this))}}function Et(){return void 0!==window.pro&&window.pro.hasPackage(Dt)}function Ot(e,t){const i={};for(const s of e)i[s.id]=t[s.id];return i}function Ft(e){const t=e.last_visible_bar_time-e.first_visible_bar_time;return{...e,first_visible_bar_time:e.first_visible_bar_time-t,last_visible_bar_time:e.last_visible_bar_time+t}}function Ht(e){const{from:t,to:i}=(0,mt.rangeDependentStudyInputsToTimeRange)(e);return i-t}function Wt(e){return`${e.id}-${e.version}`}var zt=i(576678),Ut=i(556983),Gt=i(856676);class qt extends Gt.TpoStudyBase{splitMergeSupported(){return!1}}var $t=i(327714),jt=i(199471);class Yt{constructor(e,t,i,s){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._pixelRatioParams=e,this._recreateCanvasAndContext((0,$t.size)({width:0,height:0})),this.reset({font:t,fontSize:i,backColors:s})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(((e,t)=>{const i=this._cache.measureText(t).width;return Math.max(i,e)}),0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)),width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const i=(e,t)=>{const i=void 0===e,s=void 0===t;return(!i&&!s||i===s)&&(0,d.ensureDefined)(e).formatted===(0,d.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let s=0;s{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,this._cache.textBaseline="middle";for(let e=0;e=n||d)){this._visiblePivots.add(o[e]),this._prices=[];for(let i=0;i=t.left&&e.x<=t.left+t.width&&e.y>=t.top&&e.y<=t.top+t.height)return new b.HitTestResult(b.HitTarget.Regular);return null}_drawImpl(e){ const t=this._cacheProvider(e),{horizontalPixelRatio:i,verticalPixelRatio:s,context:r}=e;this._drawRects=[];const n=e=>{const n=t.labelRectByIndex(e),o={left:Math.round(this._point.x-n.width+a),top:Math.round(this._point.y-n.height/2),width:n.width,height:n.height};return r.drawImage(t.canvas(),Math.round(n.left*i),Math.round(n.top*s),n.width*i,n.height*s,Math.round(o.left*i),Math.round(o.top*s),o.width*i,o.height*s),this._drawRects.push(o),n.width},o=this._label.split("/");let a=0;for(let e=0;e0&&(a+=n(t+11)/2),a+=n(t)/2}}}function ai(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]}function li(e,t,i){const s=t;void 0===e[s]?e[s]={text:i,ids:[ai(i)]}:(e[s].text+="/"+i,e[s].ids.push(ai(i)))}class di{constructor(e,t){this._pivots=[],this._invalidated=!0,this._renderer=new si.CompositeRenderer,this._model=e,this._source=t,this._cacheProvider=this._source.getCache.bind(this._source)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){this._renderer.clear();const e=this._source.ownerSource();if(null===e)return;this._source.pricesView().prices(),this._pivots=[];const t=this._source.customData();if(!t||!t.pivots)return;const i=this._source.properties().childs();if(!i.visible.value())return;const s=t.pivots,r=this._source.indexes(),n=this._model.timeScale(),o=this._source.priceScale(),a=e.firstValue();if(!o||o.isEmpty()||n.isEmpty()||!s||!r||null===a)return;const l=(0,d.ensureNotNull)(n.visibleBarsStrictRange()),h=l.firstBar(),u=l.lastBar();for(let e=0;eu)continue;const d={},c=i.levelsStyle.childs().visibility.childs();c.P.value()&&li(d,s[e].p,"P"),c["S1/R1"].value()&&(li(d,s[e].s1,"S1"),li(d,s[e].r1,"R1")),c["S2/R2"].value()&&(li(d,s[e].s2,"S2"),li(d,s[e].r2,"R2")),c["S3/R3"].value()&&(li(d,s[e].s3,"S3"),li(d,s[e].r3,"R3")),c["S4/R4"].value()&&(li(d,s[e].s4,"S4"),li(d,s[e].r4,"R4")),c["S5/R5"].value()&&(li(d,s[e].s5,"S5"),li(d,s[e].r5,"R5"));const _=n.indexToCoordinate(t),p=n.indexToCoordinate(l);for(const t of Object.keys(d)){const i=parseFloat(t),r=o.priceToCoordinate(i,a);this._pivots.push({x1:_,x2:p,y:r,label:d[t].text,labelIds:d[t].ids,src:s[e]})}}const c=i.levelsStyle.childs().colors,_=i.levelsStyle.childs().widths,p=this._source.visiblePivots();for(let e=0;ethis.processHibernate()))}pricesView(){return this._pricesView}indexes(){return this._indexes}properties(){return this._properties}getCache(e){if(null===this._cache||null==this._cachedPixelRatioParams||(t=e,i=this._cachedPixelRatioParams,t.horizontalPixelRatio!==i.horizontalPixelRatio||t.verticalPixelRatio!==i.verticalPixelRatio)){this._cache&&this._cache.destroy();const t=this._getActualCacheParams(),i={horizontalPixelRatio:e.horizontalPixelRatio,verticalPixelRatio:e.verticalPixelRatio};this._cache=new Yt(i,t.font,t.fontSize,t.backColors),this._cache.setPrices((0,d.ensureNotNull)(this._pricesView).prices()),this._cachedPixelRatioParams=i,this._cache.reset(t)}var t,i;return this._cache}priceLabelText(e){return this._metaInfo.shortDescription+":"+e.toUpperCase()}updateAllViews(e){super.updateAllViews(e),this._pricesView.update()}visiblePivots(){return this._pricesView.visiblePivots()}isVisible(){if(!this.properties().childs().visible.value()||!this.isActualInterval())return!1;const e=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],t=this.properties().childs().levelsStyle.childs().visibility;for(let i=0;it)continue;const a=[],l=this.properties().childs().levelsStyle.childs().visibility.childs();l.P.value()&&a.push(r[i].p),l["S1/R1"].value()&&a.push(r[i].s1,r[i].r1),l["S2/R2"].value()&&a.push(r[i].s2,r[i].r2),l["S3/R3"].value()&&a.push(r[i].s3,r[i].r3),l["S4/R4"].value()&&a.push(r[i].s4,r[i].r4),l["S5/R5"].value()&&a.push(r[i].s5,r[i].r5);for(let e=0;e(0,vi.isFundamentalStudyMetaInfo)(t);yi[vi.fundamentalsPrefix]=gi(tt.Fundamental,"loop",e),yi.study_ElliottWave=gi(it.study_ElliottWave),yi.study_LinearRegression=gi(rt),yi.study_PivotPointsHighLow=gi(nt.study_PivotPointsHighLow),yi.study_VbPSessions=gi(ct),yi.study_VbPPeriodic=gi(ut),yi.study_VbPSessionsRoughDetailed=gi(Nt),yi.study_ZigZag=gi(zt.study_ZigZag),yi.study_VbPAutoAnchored=gi(ut),yi.study_TPOPeriodic=gi(Ut.TpoPeriodicStudy),yi.study_TPOSessions=gi(qt),TradingView.StudyStrategy=gi(o.StudyStrategy).studyConstructor}for(const e in yi)yi.hasOwnProperty(e)&&(TradingView[e]=yi[e].studyConstructor);function Si(e){return e instanceof n.Study}function bi(e){return e instanceof o.StudyStrategy}function wi(e){return e instanceof pi.StudyStub}function Ci(e){return e instanceof tt.Fundamental}function Ii(e){return e instanceof Ee||e instanceof Ne||e instanceof Be}function xi(e){return e instanceof et}function Pi(e,t,i,s,a,l){if(r.StudyMetaInfo.isScriptStrategy(s)){const r=2===l;return new o.StudyStrategy(e,t,i,s,r)}const d=(0,vi.studyNameByMetaInfo)(s),h=new(d in yi?yi[d].studyConstructor:n.Study)(e,t,i,s);return void 0!==a&&h.setId(a),h}function Ti(e){const t=(0,vi.studyNameByMetaInfo)(e);return t in yi?yi[t].colorRotationMode:void 0===e.pine||r.StudyMetaInfo.isStandardPine(e.id)?1!==e.plots.length?"shift":"loop":null}function Ri(e,t){return e.id===t.id&&(s=t,((i=e).pine?i.pine.version:void 0)===(s.pine?s.pine.version:void 0));var i,s}function Mi(e){const t=(0,vi.studyNameByMetaInfo)(e);if(t in yi){const e=yi[t].colorRotationComparator ;if(void 0!==e)return e}return Ri}},260414:(e,t,i)=>{"use strict";i.d(t,{StudyBaseWindowView:()=>n});var s=i(782086),r=i(982217);class n extends s.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new s.DataWindowItem(e.id,e.title,""))),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}study(){return this._study}_updateImpl(){this._header=this._study.title(r.TitleDisplayTarget.DataWindow,!0),this._title=this._study.title(r.TitleDisplayTarget.DataWindow);const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t{"use strict";i.d(t,{StudyDataWindowView:()=>a});var s=i(260414),r=i(103055),n=i(567467);class o{constructor(e,t){this._study=e,this._model=t,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,2);for(const e of t)e.visible=e.visible&&i(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new n.HHistBasedValuesProvider(e,t):new r.StudyValuesProvider(e,t)}}class a extends s.StudyBaseWindowView{_createValuesProvider(e,t){return new o(e,t)}}},347710:(e,t,i)=>{"use strict";i.d(t,{studyMetaInfoRepository:()=>v});var s=i(895171),r=i(444372),n=i(650151),o=i(526075),a=i(819021),l=i(854798),d=i(520533),h=i(388545),u=i(201089),c=i(268222);const _=(0,u.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});class p{constructor(e){this._isReady=!1,this._rawStudiesMetaInfo=[],this._rawStudiesMetaInfoDeferredPromise=null,this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._chartApi=e}async requestMetaInfo(){if(null===this._rawStudiesMetaInfoDeferredPromise){this._rawStudiesMetaInfoDeferredPromise=(0,c.createDeferredPromise)(),this._rawStudiesMetaInfoDeferredPromise.promise.finally((()=>{this._rawStudiesMetaInfoDeferredPromise=null})),this._requestStarted();const e=await this._chartApi.requestMetadata(),t=e.params[1].metainfo.slice();{const i=e.params[1].migrations.slice();this._processSiteMetaInfo(t,i)}this._requestFinished(),this._rawStudiesMetaInfoDeferredPromise.resolve(this._rawStudiesMetaInfo)}return this._rawStudiesMetaInfoDeferredPromise.promise}async findById(e){this._isReady||await this.requestMetaInfo();const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady} async findAllJavaStudies(){return this._isReady||await this.requestMetaInfo(),this._javaStudiesMetaInfo}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}getMigrations(){return this._studiesMigrations}addPineMetaInfo(e){return m(this._pineMetaInfoCache,e)}async getLatestMetaInfoForPineStudy(e,t){const i=await(0,d.requestUserScripts)();let s;if(i){const r=i.find((t=>t.scriptIdPart===e));if(r){const e=l.Version.parse(t),i=l.Version.parse(r.version);e.isLess(i)&&(s=r.version)}}if(void 0!==s){const t={type:"pine",pineId:e,pineVersion:s};return this.findById(t)}return null}_processMigrations(e){this._studiesMigrations=[];for(let t=0;e&&tt.id===e.studyId))||null:this._pineMetaInfoCache.find((t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0,n.ensureDefined)(t.pine).version===e.pineVersion)))||null}_compilePine(e){_.logNormal(`Compiling ${e.pineId} script`);const t=(0,d.translateScriptAsync2)(e.pineId,e.pineVersion||"last").then((({metaInfo:t})=>(_.logNormal(`Compiling ${e.pineId} is successful`),this.addPineMetaInfo((0,n.ensureDefined)(t)))));return t.catch((()=>{_.logNormal(`Compiling ${e.pineId} is failed`)})),t}}function f(e){e.description_localized=r.t(e.description,{context:"study"},i(168716))}function m(e,t){const i=new o.StudyMetaInfo(t);(0,a.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex((e=>e.id===i.id));if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?l.Version.parse(t.pine.version):null,o=void 0!==i.pine?l.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}const v=(0,s.default)((()=>new p(window.ChartApiInstance)))},470130:(e,t,i)=>{"use strict";i.d(t,{fundamentalsPrefix:()=>s,isFundamentalStudyMetaInfo:()=>r,studyNameByMetaInfo:()=>n});const s="study_Internal$STD;Fund_";function r(e){return n(e)===s}function n(e){const t="study_"+(e.classId||e.shortId);return t.startsWith(s)?s:t}},414585:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProviderBase:()=>l});var s=i(985715),r=i(7288),n=i(982217);const o={NONE:"Default"},a=!0;class l extends s.StatusProviderBase{constructor(e,t){super(t),this._source=e}getSplitTitle(){return this._source.titleInParts(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}text(){ return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}: ${this.sourceStatusText()}`:`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)} ${this.sourceStatusText()}`:this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;const e=this._source.status();return e.type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,r.studyStatusSolutionId)(e),title:(0,r.studyStatusTitle)(e),studyFeature:(0,r.studyStatusFeature)(e),stackTrace:(0,r.studyErrorStatusStackTrace)(e.errorDescription.stack_trace)}:null}}},509550:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProvider:()=>l});var s=i(444372),r=i(7288),n=i(971417),o=i(414585);const a=s.t(null,void 0,i(947542));class l extends o.StudyStatusProviderBase{constructor(e,t){super(e,t),this._study=e}color(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":super.color()}sourceStatusText(){if(this._study.status().type===r.StudyStatusType.Error){const e=this._study.metaInfo(),t=(0,n.extractPineId)(e.fullId);if(e.scriptIdPart&&(0,n.isEdgrPineId)(e.scriptIdPart)||t&&(0,n.isEdgrPineId)(t))return a}return super.sourceStatusText()}}},555502:(e,t,i)=>{"use strict";i.d(t,{StudyStatusView:()=>r});var s=i(833642);class r extends s.StatusView{constructor(e){super(e.statusProvider())}color(){return this._statusProvider.color()}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},7288:(e,t,i)=>{"use strict";i.d(t,{StudyStatusType:()=>u,convertStudyStatusToString:()=>c,isVolumeDataError:()=>a,noVolumeErrorTooltip:()=>o,studyErrorStatusStackTrace:()=>m,studyStatusFeature:()=>f,studyStatusSolutionId:()=>_,studyStatusTitle:()=>p});var s=i(444372),r=i(963456),n=i(1500);const o=s.t(null,void 0,i(916971));function a(e){const t=e.toLowerCase();return t.includes("the data vendor doesn't provide volume data for this symbol.")||t.includes("no volume is provided by the data vendor")}const l=new Map([["Pine cannot determine the referencing length of a series. Try using max_bars_back",n.solutionIds.PINE_CANNOT_DETERMINE],["Memory limits exceeded",n.solutionIds.MEMORY_LIMITS_EXCEEDED],["This script is invite-only",n.solutionIds.PUBLIC_INVITE_ONLY_SCRIPTS]]),d=new Map([["Volume Profile indicator available only on our upgraded plans","volumeProfile"]]),h=s.t(null,void 0,i(930295));var u;function c(e,t){if(e.type===u.Loading)return t?h:"loading...";if(e.type===u.Error){const i=e.errorDescription,s=t?(0,r.triesTranslateError)(i.error):i.error;if(i.ctx){const e={};return Object.entries(i.ctx).forEach((([t,i])=>{e[t]=i.toString()})),s.format(e)}return s}return""}function _(e){if(e.type===u.Error)return e.errorDescription.solution_id?e.errorDescription.solution_id:function(e){ for(const t of Array.from(l.keys()))if(e.includes(t))return l.get(t)}(e.errorDescription.error)}function p(e){if(e.type===u.Error)return a(e.errorDescription.error)?o:e.errorDescription.title}function f(e){const{errorDescription:{error:t}}=e;for(const[e,i]of d)if(t.startsWith(e))return i}function m(e){if(void 0===e)return;const t=[];for(const i of e){const e={functionOrScopeName:i.n,lineNumber:i.p};"id"in i&&(e.id=i.id),"v"in i&&(e.versionScript=i.v),t.push(e)}return t}!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(u||(u={}))},306682:(e,t,i)=>{"use strict";i.d(t,{StudyStub:()=>m});var s=i(572230),r=i(555502),n=i(974655),o=i(624444),a=i(707957),l=i(190973),d=i(414585),h=i(982217);class u extends d.StudyStatusProviderBase{text(){return this._source.isActualInterval()?`${this._source.title(h.TitleDisplayTarget.StatusLine)} ${this.sourceStatusText()}`:this._source.title(h.TitleDisplayTarget.StatusLine)}}var c=i(7288),_=i(790524);class p{getItems(){return[]}getValues(e){return[]}}const f=new a.Delegate;class m extends n.PriceDataSource{constructor(e,t,i,s){super(e),this._priceStep=.01,this._status={type:c.StudyStatusType.Undefined},this._statusChanged=new a.Delegate,this._formatter=new o.PriceFormatter(100),this._origState=t,this._title=i,this._alwaysShowInLegend=s;this._properties=new l.default({visible:!0}),this._statusView=new r.StudyStatusView(this)}barColorer(){return null}properties(){return this._properties}statusView(){return this._statusView}legendView(){return null}state(e){return this._origState}setStatus(e){const t=this.isDisplayedInLegend();if(this._status=e,this._statusChanged.fire(),this.isDisplayedInLegend()!==t){const e=this._model.paneForSource(this);if(e){const t=this._model.panes().indexOf(e),i=s.InvalidationMask.invalidateLegendWidgetLayout(t);this.model().invalidate(i)}}}formatter(){return this._formatter}name(){return this._title}title(){return this._title}titleInParts(){return[this._title]}isFailed(){return this._status.type===c.StudyStatusType.Error}isLoading(){return this._status.type===c.StudyStatusType.Loading}isDisplayedInLegend(){return this._alwaysShowInLegend||this.isFailed()}setFailed(e){this.setStatus({type:c.StudyStatusType.Error,errorDescription:{error:e}}),this._model.updateSource(this)}isSymbolInvalid(){return!1}isActualInterval(){return!0}onIsActualIntervalChange(){return f}start(){}status(){return this._status}onStatusChanged(){return this._statusChanged}firstValue(){return null}currency(){return null}sessionId(){return this._model.mainSeries().sessionId()}sessionIdChanged(){return this._model.mainSeries().sessionIdChanged()}unit(){return null}symbolSource(){return this._model.mainSeries()}barsProvider(){return this._model.mainSeries()}valuesProvider(){return new p}statusProvider(e){return new u(this,this._model.properties().childs().scalesProperties.childs().textColor)}isRemovedByStudyTemplates(){return null!==this._origState&&(0,_.isStudyState)(this._origState)}}},103055:(e,t,i)=>{"use strict";i.d(t,{ StudyValuesProvider:()=>S});var s=i(150335),r=i(638456),n=i(246733),o=i(244842),a=i(534741),l=i(616117),d=i(885482),h=i(368135),u=i(441212),c=i(470130),_=i(570226),p=i(650151),f=i(60897),m=i(982217);const v=r.CheckMobile.any(),g=o.enabled("hide_last_na_study_output"),y=o.enabled("always_show_legend_values_on_mobile");class S{constructor(e,t){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t,this._studyMetaInfo=this._study.metaInfo(),this._studyProperties=this._study.properties().childs(),this._isFundamental=(0,c.isFundamentalStudyMetaInfo)(this._studyMetaInfo);const i=this._studyMetaInfo.plots;i&&i.forEach(((e,t)=>{if((0,h.isPlotWithTechnicalValues)(e))return;const i=e.id;this._emptyValues.push(function(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}(t,i,this._study.guiPlotName(m.TitleDisplayTarget.StatusLine,i)));const s=(0,h.isOhlcPlot)(e)?e.target:i;this._colorProviders.set(s,(0,u.createStudyPlotColorProvider)(this._studyMetaInfo,this._study.properties(),s))}))}getItems(){return this._emptyValues}getPlotColor(e,t){var i;const r=t[e+1];if(!(0,s.isNumber)(r))return"";const n=r>0;let o;const a=this._studyMetaInfo.plots[e];let l=a.id;const d=this._studyProperties;if((0,h.isOhlcPlot)(a))l=a.target||l,o=(0,p.ensureDefined)(d.ohlcPlots.childs()[l].childs().color).value();else if((0,h.isArrowsPlot)(a)){const e=(0,p.ensureDefined)(d.styles.childs()[l]);o=n?e.childs().colorup.value():e.childs().colordown.value()}else o=(0,p.ensureDefined)(null===(i=d.styles.childs()[l])||void 0===i?void 0:i.child("color")).value();let u=o;const c=this._colorProviders.get(l),_=c&&c.getPlotPointStyle(t);return _&&((0,h.isArrowsPlot)(a)?(n&&void 0!==_.colors[5]&&(u=_.colors[5]),n||void 0===_.colors[6]||(u=_.colors[6])):void 0!==_.colors[0]&&(u=_.colors[0])),"transparent"===u&&(u=o),u}getValues(e){var t,i;const r=this._emptyValues.map((e=>({...e})));let o=null;const l=this._study.data().lastIndex(),d=this._studyProperties;if(null!==l)for(const e of r){if(0===(null===(t=d.styles.childs()[e.id])||void 0===t?void 0:t.childs().display.value()))continue;const i=this._study.nearestIndex(l,a.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===i)continue;const s=i+this._study.offset(e.id);o=null!==o?Math.max(s,o):s}(null===e||null!==o&&e>o)&&(e=o);const u=this._hideValues(),c=this._study.isVisible()&&!u?f.notAvailable:"";for(const e of r)e.value=c;if(u)return r;g&&r.length&&(r[r.length-1].value="");const m=this._study.priceScale();if(!this._study.isVisible()||null===e||null===m||m.isEmpty()||this._model.timeScale().isEmpty())return r;const v={};for(const t of r){const r=t.id,o=(0,_.getPriceValueFormatterForStudy)(this._study,r),u=(0,p.ensureDefined)(d.styles.childs()[r]),c=u.childs().display.value();if(t.visible=0!==c,!t.visible)continue ;const f=u.hasChild("plottype")?null===(i=u.child("plottype"))||void 0===i?void 0:i.value():null,m=this._isFundamental&&(f===h.LineStudyPlotStyle.StepLine||f===h.LineStudyPlotStyle.StepLineWithDiamonds),g=t.index,y=e-this._study.offset(r),S=m||null!==l&&y>l?a.PlotRowSearchMode.NearestLeft:a.PlotRowSearchMode.Exact,b=this._study.nearestIndex(y,S);if(void 0===b)continue;let w=v[r];if(void 0===w&&(w=this._study.getMinFirstBarIndexForPlot(r),Number.isFinite(w)&&(v[r]=w)),w>b)continue;const C=this._study.data().last(),I=this._study.data().valueAt(b)||(null!==C?C.value:null);if(null===I)continue;const x=I[g+1];(0,s.isNumber)(x)&&(t.value=o(x),t.color=(0,n.resetTransparency)(this.getPlotColor(g,I)))}return r}_hideValues(){return y?(0,l.isLineToolName)(d.tool.value())||null!==this._model.lineBeingEdited():v&&(null===this._model.crossHairSource().pane||(0,l.isLineToolName)(d.tool.value())||null!==this._model.lineBeingEdited())}}},556983:(e,t,i)=>{"use strict";i.r(t),i.d(t,{TpoPeriodicStudy:()=>l,createTpoPeriodicStudy:()=>d});var s=i(650151),r=i(339315),n=i(856676),o=i(347710),a=i(807218);class l extends n.TpoStudyBase{splitMergeSupported(){return!0}}async function d(e){const t=(0,s.ensureDefined)(r.SYMBOL_STRING_DATA[18]),i=await(0,o.studyMetaInfoRepository)().findById({type:"java",studyId:t.type}),n=(0,a.prepareStudyProperties)(i,{},null,e.studyVersioning(),[]);return new l(e,n,[],i,!0)}},856676:(e,t,i)=>{"use strict";i.d(t,{TpoStudyBase:()=>u,extendingInputIds:()=>h});var s=i(444372),r=i(809796),n=i(807218),o=i(190973),a=i(444331),l=i(339315),d=i(66732);const h=["extendPoorLow","extendPoorHigh","extendPOC","extendSingleprints"];class u extends n.Study{constructor(e,t,i,s,r){h.forEach((e=>t.removeExclusion(`inputs.${e}`))),super(e,t,i,s),this._autoTickPerRowData=null,this._onSeriesCompletedChanged=e=>{e&&(this._seriesCompleted.unsubscribe(this._onSeriesCompletedChanged),this._tryCalculateTickPerRow())},this._seriesCompleted=(0,d.combine)((e=>l.seriesReadyStatuses.has(e)),e.mainSeries().statusVW().weakReference()),this._chartStyleMode=!!r,t.childs().styles.hasChild("splitByBlocks")||t.childs().styles.addChild("splitByBlocks",new o.default(!1));const n=e.mainSeries(),u=()=>{this._autoTickPerRowData=null,this._tryCalculateTickPerRow()};this.properties().childs().inputs.childs().rowSize.subscribe(this,u),this.properties().onRestoreFactoryDefaults().subscribe(this,u),n.symbolResolved().subscribe(this,u),n.onIntervalChanged().subscribe(this,u),n.onSymbolIntervalChanged().subscribe(this,this.resetAllSplitsAndMerges),n.onStyleChanged().subscribe(this,(e=>{(0,a.isTimeBasedStyle)(e)||this.resetAllSplitsAndMerges()})),this._tryCalculateTickPerRow();const c=this._properties.childs().inputs.childs();if(this._properties.addExclusion("inputs.mergePoints"),"mergePoints"in c){const e=c.mergePoints;n.properties().childs().style.addDependent(c.mergePoints),["period","blockSize","periodsNum","rowSize","ticksPerRow"].forEach((t=>{c[t].subscribe(null,this.resetAllSplitsAndMerges.bind(this)),c[t].addDependent(e)}))}}destroy(){ const e=this._model.mainSeries();this._seriesCompleted.unsubscribe(this._onSeriesCompletedChanged),this._seriesCompleted.destroy(),e.symbolResolved().unsubscribeAll(this),e.onIntervalChanged().unsubscribeAll(this),e.onSymbolIntervalChanged().unsubscribeAll(this),e.onStyleChanged().unsubscribeAll(this);const t=this._properties.childs().inputs.childs();e.properties().childs().style.removeDependent(t.mergePoints),super.destroy()}preferredZOrder(){return 0}stateCustomFields(){var e;return{autoTickPerRowData:null!==(e=this._autoTickPerRowData)&&void 0!==e?e:void 0}}restoreStateCustomFields(e){var t;this._autoTickPerRowData=null!==(t=e.autoTickPerRowData)&&void 0!==t?t:null}resetAllSplitsAndMerges(){const e=this._model.undoModel();e.beginUndoMacro(new r.TranslatedString("TPO Reset all splits and merges",s.t(null,void 0,i(543775)))),e.setProperty(this._properties.childs().inputs.childs().mergePoints,"[]",null),e.endUndoMacro()}splitBlock(e){this._appendMergeSplitAction(e,"split",new r.TranslatedString("TPO split block",s.t(null,void 0,i(134234))))}mergeProfile(e){this._appendMergeSplitAction(e,"merge",new r.TranslatedString("TPO merge block",s.t(null,void 0,i(205340))))}paneViews(e){return this._chartStyleMode?this._paneViews:super.paneViews(e)}priceScale(){return this._chartStyleMode?this._model.mainSeries().priceScale():super.priceScale()}_apiInputs(){const{rowSize:e,...t}=super._apiInputs();return t}_autoRowSizeModeEnabled(){return"Auto"===this.properties().childs().inputs.childs().rowSize.value()}_tryCalculateTickPerRow(){if(this._autoRowSizeModeEnabled()&&(e=this._autoTickPerRowData,t=this._currentAutoTickPerRowData(),null===e||e.symbol!==t.symbol||e.interval!==t.interval)){this._calculateTickPerRow()?this._autoTickPerRowData=this._currentAutoTickPerRowData():(this._seriesCompleted.unsubscribe(this._onSeriesCompletedChanged),this._seriesCompleted.subscribe(this._onSeriesCompletedChanged,{once:!0}))}var e,t}_calculateTickPerRow(){const e=this._model.mainSeries(),t=e.symbolInfo(),i=this._model.timeScale().visibleBarsStrictRange();if(null===i||null===t||e.isLoading())return!1;const s=e.data().bars().minMaxOnRangeCached(i.firstBar(),i.lastBar(),[{name:"low",offset:0},{name:"high",offset:0}]);if(null===s)return!1;const r=t.minmov/t.pricescale,n=(s.max-s.min)/r,o=Math.round(n/80),a=Math.floor(Math.log10(o)),l=5*Math.max(1,Math.pow(10,a-1)),d=Math.round(o/l)*l,h=Math.min(1e6,Math.max(1,d));return this.properties().childs().inputs.childs().ticksPerRow.setValue(h),!0}_currentAutoTickPerRowData(){const e=this._model.mainSeries();return{symbol:e.getSymbolString(),interval:e.interval()}}_appendMergeSplitAction(e,t,i){const s=this._properties.childs().inputs.childs().mergePoints.value(),r=""===s?[]:JSON.parse(s);r.push({action:t,time:e}),this._model.undoModel().setProperty(this._properties.childs().inputs.childs().mergePoints,JSON.stringify(r),i)}}},223284:(e,t,i)=>{"use strict";i.d(t,{EXCLUDED_FOR_ALERT_ID_INPUTS:()=>p,collectDepsForAlert:()=>v,dependenciesForAlerts:()=>g,plotsForAlert:()=>m}) ;var s=i(484156),r=i(650151),n=i(62745),o=i(201089),a=i(827523),l=i(526075),d=i(95452),h=i(368135);const u=(0,o.getLogger)("Chart.Study");function c(e,t,i){void 0!==i&&i.forEach((i=>{const s=e[i];"string"==typeof s?e[i]=_(s,t):(0,n.isExtendedInput)(s)&&(0,n.isExtendedInputSource)(s)?s.v=_((0,n.getInputValue)(s),t):u.logError(`Cannot patch source input, its type is not source: ${JSON.stringify(s)}`)}))}function _(e,t){const[i,s]=e.split("$"),r=t.get(i);return r?r+(void 0===s?"":"$"+s):e}const p=["text","pineFeatures"];function f(e){return(0,s.default)(e,p)}function m(e,t,i){const s=[h.isLinePlot,h.isShapesPlot,h.isCharsPlot,h.isArrowsPlot,h.isOhlcPlot,h.isAlertConditionPlot];return e.plots.map(((e,t)=>({...e,pinePlotIndex:t}))).filter((e=>!(void 0!==i&&!i.includes(e.id))&&s.some((t=>t(e))))).map((i=>{const s={id:i.id,type:i.type,pinePlotIndex:i.pinePlotIndex,offset:t(i.id)};if(e.styles&&void 0!==e.styles[i.id]){const t=(0,r.ensureDefined)((0,r.ensureDefined)(e.styles)[i.id]);s.title=t.title||"",s.text=t.text||""}return(0,h.isOhlcPlot)(i)&&i.target&&e.ohlcPlots&&e.ohlcPlots[i.target]&&(s.ohlcTitle=(0,r.ensureDefined)((0,r.ensureDefined)(e.ohlcPlots)[i.target]).title),s}))}function v(e,t){const i=[],s=new Map;let n;for(let r=e.length-1;r>=0;r--){const o=e[r],h=(0,a.extractStudyId)(o.metaInfo().id),u=l.StudyMetaInfo.getStudyIdWithLatestVersion(o.metaInfo());n=o.inputsForAlertState();c(n,s,o.metaInfo().inputs.filter((e=>"source"===e.type)).map((e=>e.id)));const _=o.metaInfo().isTVScript?f(n):n,p=(0,d.getStudyIdForAlert)(h,_,t);i.push({id:p,study:u,inputs:n}),s.set(o.id(),p)}const o=i.reverse();return{idForAlert:(0,r.ensureDefined)(o[0].id),inputsForAlert:(0,r.ensureDefined)(n),studyDependencies:o}}function g(e,t){return e.map((e=>{const i=e.inputs(),s=e.metaInfo();let r=l.StudyMetaInfo.cutDollarHash(s.fullId);if("tv-scripting"===s.productId){const e=t.findByIdSync({type:"java",studyId:"Script@tv-scripting"});null!==e&&(r=e.fullId)}const n={id:e.sourceId(),study:r,inputs:i,scriptIdPart:void 0,scriptVersion:void 0};return s.pine?{...n,scriptIdPart:s.scriptIdPart,scriptVersion:s.pine.version}:n}))}},943855:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>W});var s=i(650151),r=i(580683),n=i(261066),o=i(807218),a=i(444331),l=i(190973),d=i(919892),h=i(244842),u=i(909598),c=i(229765),_=i(740086),p=i(246733);const f=h.enabled("force_exchange_as_title");class m extends c.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._studyCompare.priceScale(),n=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(n.noData||null===r||r.isEmpty())return;const o=this._studyCompare.model(),a=o.timeScale().visibleBarsStrictRange(),l=o.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,p.resetTransparency)(n.color),i.textColor=this.generateTextColor(i.background),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1;else{const r=o.backgroundColorAtYPercentFromTop(n.coordinate/(0, s.ensureNotNull)(o.paneForSource(this._studyCompare)).height());i.background=r,i.textColor=(0,p.resetTransparency)(n.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate;const d=o.properties().childs().scalesProperties.childs();d.showSeriesLastValue.value()&&(e.text=(0,_.getCurrentModePriceText)(r,n),d.seriesLastValueMode.value()!==u.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,_.getOppositeModePriceText)(r,n),e.visible=!0),t.text="",d.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return f?e=(0,a.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,a.displayedSymbolName)(t)),e}}var v=i(444372),g=i(544820),y=i(103055),S=i(885482),b=i(638456),w=i(616117),C=i(389137),I=i(982217);const x=b.CheckMobile.any();class P extends y.StudyValuesProvider{constructor(e,t){super(e,t),this._emptyValues[0].title=e.guiPlotName(I.TitleDisplayTarget.StatusLine,"")}getValues(e){return(0,C.isNumber)(e)||(this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,C.isNumber)(e)||(e=this._study.data().lastIndex()))),super.getValues(e)}_hideValues(){return!1}_showLastPriceAndChangeOnly(){return x&&(null===this._model.crossHairSource().pane||(0,w.isLineToolName)(S.tool.value())||null!==this._model.lineBeingEdited())}}class T extends g.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new P(e,t)}}var R=i(177126);class M extends T{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC,this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._additional}_updateImpl(){{const e=(0,R.getDataVendorString)(this._studyCompare.symbolInfo());this._additional=e?v.t(null,void 0,i(493345))+" "+e:null}super._updateImpl()}}var D=i(555502),A=i(551775),V=i(509550);class L extends V.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(I.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(I.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(I.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(I.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}var k=i(502141),B=i(25e4),N=i(401580);const E=h.enabled("study_overlay_compare_legend_option"),O=h.enabled("force_exchange_as_title"),F=!h.enabled("hide_study_compare_legend_item"),H=h.enabled("hide_unresolved_symbols_in_legend") ;class W extends o.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new l.default(null)),e.hasChild("unitId")||e.addChild("unitId",new l.default(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new N.WatchedValue(!0),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this.properties().childs().minTick.subscribe(null,(()=>this._recreatePriceFormattingDependencies())),this.properties().childs().minTick.subscribe(null,(()=>this._model.fullUpdate())),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this._symbolResolvingActive=new N.WatchedValue(!1),this._symbolHibernated=new N.WatchedValue(!1),e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}properties(){return this._properties}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}symbolParams(){return(0,k.symbolParams)(this)}compareSymbolParams(e){return(0,k.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this.symbol();if(!e)return null;let t;return t=this._model.isSnapshot()?this._resolvedSymbols.___snapshot||null:this._resolvedSymbols[this._getSymbolForResolve(e)]||null,this._model.isSnapshot()&&null===t&&(t=(0,r.getObsoleteIdeaSymbolInfo)(this._resolvedSymbols,e,this.currency()),null!==t&&(this._resolvedSymbols.___snapshot=t)),t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,k.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,B.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,a.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,a.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[1])&&void 0!==s?s:null}state(e,t){var i;const r=super.state(e,t) ;this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,a.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}titleInParts(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(", ")]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return F?super.statusView():null}guiPlotName(e,t){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}valuesProvider(){return new P(this,this.model())}statusProvider(e){return new L(this,this._model.properties().childs().scalesProperties.childs().textColor)}measureUnitId(){return(0,a.measureUnitId)(this.symbolInfo())}getSymbolString(e){return void 0===e&&(e=this._getSymbolForApi(this.symbol())),(0,d.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}_createPriceAxisView(e){return new m(this,{plotIndex:"compare"})}_createViews(){this._legendView||(this._legendView=new M(this,this._model)),this._dataWindowView||(this._dataWindowView=new T(this,this._model)),this._statusView||(this._statusView=new D.StudyStatusView(this)),super._createViews()}_onUnitChanged(){"alwaysOff"!==(0,n.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,a.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,a.symbolCurrency)(i),n=(0,a.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}async _changeInputsImpl(e,t){await super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_createStudyOnServer(){const e=super._createStudyOnServer();return this._realignLineToolsIfParamsChanged(),e}_tryCreateFormatter(){var e,t;t=null===(e=null===A.customFormatters||void 0===A.customFormatters?void 0:A.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(A.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value());return(0,a.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value())}_titleInParts(e,t,i,s,r){const n=this.symbolInfo() ;return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_skipHistogramBaseOnAutoScale(){return!0}_getSymbolTitlePart(e){var t;if(null===e)return H?"":this.properties().childs().inputs.childs().symbol.value();const i=(0,a.getSymbolExchange)(e);if(O&&void 0!==i)return i;if(E)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,a.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){return null}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),o=n.inputs.childs().symbol.value(),l=n.currencyId.value(),d=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,a.symbolCurrency)(e)),n.unitId.setValueSilently((0,a.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==o&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==l&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==d&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},981098:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>pe});var s=i(650151),r=i(580683),n=i(638456),o=i(201089),a=i(807218),l=i(548587),d=i(261066),h=i(544421),u=i(444331),c=i(190973),_=i(919892),p=i(244842),f=i(356747),m=i(502141),v=i(25e4),g=i(731042),y=i(195447),S=i(534741),b=i(389137),w=i(291784),C=i(401580),I=i(551775),x=i(555502),P=i(147664),T=i(229765),R=i(909598),M=i(740086),D=i(246733);const A=p.enabled("force_exchange_as_title");class V extends T.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.lastValueData("close",!1);if(r.noData)return;const n=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!n.isPriceScaleVisible(o))return;const a=n.timeScale().visibleBarsStrictRange(),l=n.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,D.resetTransparency)(r.color),i.textColor=this.generateTextColor(r.color),e.borderVisible=!1,t.borderVisible=!1;else{ const o=n.backgroundColorAtYPercentFromTop(r.coordinate/(0,s.ensureNotNull)(n.paneForSource(this._source)).height());i.background=o,i.textColor=(0,D.resetTransparency)(r.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const d=this._source.model().properties().childs().scalesProperties.childs();d.showSeriesLastValue.value()&&(e.text=(0,M.getCurrentModePriceText)(o,r),d.seriesLastValueMode.value()!==R.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,M.getOppositeModePriceText)(o,r),e.visible=!0),t.text="",d.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return A?e=(0,u.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,u.displayedSymbolName)(t)),e}}var L=i(506387);class k extends L.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var B=i(458963),N=i(9524);class E{constructor(e){this._lineRenderer=new N.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:B.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var O=i(782086),F=i(616117),H=i(885482),W=i(982217),z=i(675557);const U=n.CheckMobile.any();class G extends O.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new O.DataWindowItem(e.id,e.title,""))),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){var e,t;this._header=this._study.title(W.TitleDisplayTarget.DataWindow);let i;this._showLastPriceAndChangeOnly()?i=this._study.data().lastIndex():(i=this._model.crossHairSource().appliedIndex(),isNaN(i)&&(i=this._study.data().lastIndex(),p.enabled("use_last_visible_bar_value_in_legend")&&(i=null!==(t=null===(e=this._model.timeScale().visibleBarsStrictRange())||void 0===e?void 0:e.lastBar())&&void 0!==t?t:NaN)));const s=this._valueProvider.getValues(i);for(let e=0;ee||t),i.showBarChange.weakReference(),i.showSeriesOHLC.weakReference()),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl();{const e=(0,Y.getDataVendorString)(this._studyOverlay.symbolInfo());this._additional=e?q.t(null,void 0,i(493345))+" "+e:null}}_createValuesProvider(e,t){return new $.OverlayLegendValuesProvider(e,t)}}var Q=i(742391),X=i(825278),Z=i(245242),J=i(936258),ee=i(904891),te=i(579950),ie=i(255799),se=i(41117),re=i(72731),ne=i(262550),oe=i(711757),ae=i(707621);const le=(n.CheckMobile.any(),!0),de=p.enabled("study_overlay_compare_legend_option"),he=(p.enabled("secondary_series_extend_time_scale"),p.enabled("hide_unresolved_symbols_in_legend")),ue=!p.enabled("hide_study_overlay_legend_item"),ce=(0,o.getLogger)("Chart.StudyOverlay");function _e(e,t){return null==e[t]}class pe extends a.Study{constructor(e,t,i,s){super(e,function(e){e.hasChild("currencyId")||e.addChild("currencyId",new c.default(null)),e.hasChild("unitId")||e.addChild("unitId",new c.default(null)),(0,ae.allChartStyles)().includes(e.childs().style.value())||e.childs().style.setValueSilently(2);const t=e.childs();if(t.lineStyle.hasChild("styleType")){const e=t.lineStyle.childs(),i=e.styleType.value();let s,r;0===i&&(r=14,s=t.lineWithMarkersStyle.childs()),1===i&&(r=15,s=t.steplineStyle.childs()),s&&(s.color.setValueSilently(e.color.value()),s.linestyle.setValueSilently(e.linestyle.value()),s.linewidth.setValueSilently(e.linewidth.value()),s.priceSource.setValueSilently(e.priceSource.value())),void 0!==r&&2===t.style.value()&&t.style.setValueSilently(r),t.lineStyle.removeProperty("styleType")}return e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._seriesSource=null,this._symbolResolvingActive=new C.WatchedValue(!1),this._symbolHibernated=new C.WatchedValue(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new C.WatchedValue(!0),this._realignToolsLastParams=null,this._precomputedBarStyles=new WeakMap,this._lastResolvedSymbolSource="",this._data=new y.PlotList((0,h.seriesPlotFunctionMap)(),_e),this._quotesProvider=new f.QuotesProvider(void 0,e.collapsed().spawnOwnership()),le&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged), r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),this._model.mainSeries().properties().childs().dividendsAdjustment.subscribe(this,(()=>{this._tryChangeInputs()})),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),this._formatter=null,e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){var e;this._model.mainSeries().properties().childs().dividendsAdjustment.unsubscribeAll(this),this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),null===(e=this._quotesProvider)||void 0===e||e.destroy(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}properties(){return this._properties}barColorer(){return new oe.SeriesBarColorer({data:()=>this.data(),bars:()=>this.data(),nsBars:()=>new y.PlotList,priceScale:()=>(0,s.ensureNotNull)(this.priceScale()),properties:()=>this.properties(),firstValue:()=>this.firstValue()})}symbolParams(){return(0,m.symbolParams)(this)}compareSymbolParams(e){return(0,m.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.childs().inputs.childs().symbol.value();if(!e)return null;let t;return t=this._model.isSnapshot()?this._resolvedSymbols.___snapshot||null:this._resolvedSymbols[this._getSymbolForResolve(e)]||null,this._model.isSnapshot()&&null===t&&(t=(0,r.getObsoleteIdeaSymbolInfo)(this._resolvedSymbols,e,this.currency()),null!==t&&(this._resolvedSymbols.___snapshot=t)),t}supportsPressedChunks(){return!1}pressedChunks(e,t){throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,m.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,v.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}priceSource(){ const e=this.properties().childs();switch(e.style.value()){case 2:return e.lineStyle.childs().priceSource.value();case 14:return e.lineWithMarkersStyle.childs().priceSource.value();case 15:return e.steplineStyle.childs().priceSource.value();case 3:return e.areaStyle.childs().priceSource.value();case 10:return e.baselineStyle.childs().priceSource.value();case 13:return e.columnStyle.childs().priceSource.value()}return null}barFunction(){return this._barFunction}quotesProvider(){return this._quotesProvider}quotes(){return this._quotesProvider.quotes()}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,u.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,u.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[t])&&void 0!==s?s:null}symbolSource(){return this}barsProvider(){return this}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,u.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}title(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(` ${u.symbolTitleSeparator} `)}titleInParts(e,t,i,s,r){return[this.title(e,t,i,s,r)]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,S.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==i?this._barFunction(i.value,0):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),S.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s ;const d=this._lastNonEmptyPlotRow(4),h=null!==d&&n.contains(d.index),u=null!==d?d.value:null,c=t||h?u:this.data().valueAt(a);if(null===c)return s;const _=this._barFunction(c,2);if(!(0,b.isNumber)(_))return s;const p=r.priceToCoordinate(_,l);let f;switch(o.style.value()){case 0:f=c[1]<=c[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:f=c[1]<=c[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 9:f=c[1]<=c[4]?o.hollowCandleStyle.childs().upColor.value():o.hollowCandleStyle.childs().downColor.value();break;case 13:f=c[1]<=c[4]?o.columnStyle.childs().upColor.value():o.columnStyle.childs().downColor.value();break;case 2:f=o.lineStyle.childs().color.value();break;case 14:f=o.lineWithMarkersStyle.childs().color.value();break;case 15:f=o.steplineStyle.childs().color.value();break;case 3:f=o.areaStyle.childs().linecolor.value();break;case 16:f=o.hlcAreaStyle.childs().closeLineColor.value();break;case 10:{const e=o.baselineStyle.childs();f=p(0,s.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:r=new ne.SeriesHiLoPaneView(this,this._model)}r&&this._paneViews.push(r),null!==i&&this._paneViews.push(i),this._paneViews.push(new E(this)),this._dataWindowView||(this._dataWindowView=new G(this,this._model)),this._legendView||(this._legendView=new K(this,this._model)),this._statusView||(this._statusView=new x.StudyStatusView(this)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new Q.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){let e;return null===this._seriesSource?e=super._createStudyOnServer():(this._modifyStudyOnServer((0,s.ensureDefined)(this._inputs)),e=!0),this._realignLineToolsIfParamsChanged(),e}_modifyStudyOnServer(e){null===this._seriesSource?super._modifyStudyOnServer(e,0):(this._seriesSource.modifySeries((0,_.decodeExtendedSymbol)(e.symbol),(0,g.getServerInterval)(this._series.properties().childs().interval.value())),this._seriesSource.isStarted()||this._seriesSource.start())}_stopStudyOnServer(){null===this._seriesSource?super._stopStudyOnServer():this._seriesSource.stop()}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_getSymbolTitlePart(e){var t;if(null===e)return he?"":this.properties().childs().inputs.childs().symbol.value();if(de)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,u.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){return null}_onAllowExtendTimeScaleChanged(){}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),d=o.unitId.value(),h=o.style.value();if(void 0!==i&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&o.currencyId.setValueSilently(s),void 0!==r&&o.unitId.setValueSilently(r),void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,u.symbolCurrency)(e)),o.unitId.setValueSilently((0,u.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol,""), o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId,""),o.unitId.value()!==d&&o.unitId.listeners().fire(o.unitId,""),o.style.value()!==h&&o.style.listeners().fire(o.style,""),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){this._barFunction=(0,l.barFunctionByStyle)(this.style(),this.priceSource())}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,u.isCloseBasedSymbol)(this.symbolInfo())?(0,u.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},932167:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>o});var s=i(650151),r=i(229765),n=i(246733);class o extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!r.isPriceScaleVisible(o))return;const a=this._source.lastValueData(this._data.plotIndex,!1);if(a.noData)return;const l=r.timeScale().visibleBarsStrictRange(),d=r.mainSeries().bars().lastIndex();if(null!==l&&null!==d){if(d<=l.lastBar()){i.background=(0,n.resetTransparency)(a.color);let s=a.color;"transparent"===s&&(s=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(s),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const o=r.backgroundColorAtYPercentFromTop(a.coordinate/(0,s.ensureNotNull)(r.paneForSource(this._source)).height());i.background=o,i.textColor=(0,n.resetTransparency)(a.color),i.borderColor=(0,n.resetTransparency)(i.textColor),e.borderVisible=!0,t.borderVisible=!0}i.coordinate=a.coordinate,i.floatCoordinate=a.floatCoordinate,this._showAxisLabel()&&(e.text=a.text,e.visible=!0),this._updatePaneRendererData(t)}}_showPaneLabel(){const e=this._model.properties().childs().scalesProperties.childs();return(e.showStudyPlotLabels.value()||e.showFundamentalNameLabel.value())&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_showAxisLabel(){const e=this._model.properties().childs().scalesProperties.childs();return(e.showStudyLastValue.value()||e.showFundamentalLastValue.value())&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="", this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},980004:(e,t,i)=>{"use strict";i.d(t,{StudyStrategy:()=>V});var s=i(650151),r=i(401580),n=i(807218),o=i(790188),a=i(86441),l=i(724377),d=i(315801),h=i(20422),u=i(199471),c=i(678515);function _(e,t,i){return i?Math.sign(e)*(Math.round(Math.abs(e))+t):Math.round(e)+t}class p{constructor(e,t){this._data=e,this._textWidths=t}draw(e,t){const i=t.pixelRatio;void 0!==this._textWidths.rendererParams&&(0,h.areEqualPaneRenderParams)(this._textWidths.rendererParams,t)||(this._textWidths.rendererParams=t,this._textWidths.width.clear());const s=this._data;e.lineJoin="miter",e.miterLimit=Math.round(2*i),e.strokeStyle=s.bgColor,e.lineWidth=Math.max(2,(0,c.ceiledEven)(2*i));for(const t of s.items){e.beginPath();const r="lower"===t.pos;e.save();const n=Math.round(s.orderArrow.vMargin*i);e.translate(0,r?n:-n),this._drawOrderArrow(e,t.orderPoint,s.orderArrow,s.exitLineWidth,r,i),e.restore(),e.save(),this._drawPriceArrow(e,t.pricePoint,s.priceArrow,!r,i),e.restore(),e.closePath(),e.stroke(),e.fillStyle=s.exitLineWidth?s.exitColor:"buy"===t.type?s.buyColor:s.sellColor,e.fill()}const r=s.text;r.visible&&(0,u.drawScaled)(e,i,i,(()=>{e.font=r.fontSize+"px "+r.font,e.textAlign="center",e.textBaseline="top",e.fillStyle=s.labelColor,e.strokeStyle=s.bgColor,e.lineWidth=Math.min(2,Math.floor(2*i));for(const t of s.items){const i="lower"===t.pos;e.save();const n=i?1:-1,o=s.orderArrow;e.translate(0,(o.height+o.vMargin+s.exitLineWidth)*n);const a=i?r.vMargin:-r.fontSize-r.vMargin,l=n*(r.fontSize+r.lineSpacing);if(t.label&&(e.translate(0,a),e.strokeText(t.label,Math.ceil(t.orderPoint.x),t.orderPoint.y),e.fillText(t.label,Math.ceil(t.orderPoint.x),t.orderPoint.y),this._textWidths.width.has(t.label)||this._textWidths.width.set(t.label,e.measureText(t.label).width)),t.qty){const i=Boolean(t.label)?l:a;e.translate(0,i),e.strokeText(t.qty,Math.ceil(t.orderPoint.x),t.orderPoint.y),e.fillText(t.qty,Math.ceil(t.orderPoint.x),t.orderPoint.y),this._textWidths.width.has(t.qty)||this._textWidths.width.set(t.qty,e.measureText(t.qty).width)}e.restore()}}))}hitTest(e){const t=this._testOrderArrows(e),i=!t&&this._data.text&&this._testText(e);return t||i?new d.HitTestResult(d.HitTarget.Regular):null}_drawOrderArrow(e,t,i,s,r,n){let o,a;r?(e.rotate(Math.PI),o=-t.x,a=-t.y):(o=t.x,a=t.y),a-=i.height+s;const l=Math.max(1,Math.floor(n)),d=l%2?.5:0,h=r?"floor":"ceil";o=_(o*n,d,r),a=Math.round((Math[h](a)+.5)*n),e.translate(o,a);const u=(0,c.ceiledEven)(i.width*n)/2+d,p=(0,c.ceiledEven)(i.tailWidth*n)/2+d,f=Math.round(i.tailHeight*n);if(e.moveTo(-p,0),e.lineTo(p,0),e.lineTo(p,f),e.lineTo(u,f),e.lineTo(0,Math.round(i.height*n)),s){const t=Math.floor(l/2);e.lineTo(u+t,Math.round(i.height*n)),e.lineTo(u+t,Math.round((i.height+s)*n)),e.lineTo(-u-t,Math.round((i.height+s)*n)),e.lineTo(-u-t,Math.round(i.height*n)),e.lineTo(0,Math.round(i.height*n))}e.lineTo(-u,f),e.lineTo(-p,f),e.lineTo(-p,0),e.lineTo(p,0)}_drawPriceArrow(e,t,i,s,r){let n,o;s?(e.rotate(Math.PI),n=-t.x,o=-t.y):(n=t.x, o=t.y);const a=Math.max(1,Math.floor(r)),l=a%2?.5:0;n=_(n*r,l,s)-a,o=_(o*r,l,s);const d=(0,c.ceiledEven)(2*i.width*r)/2,h=-(Math.round(i.width*r)+l);e.translate(n,o),e.moveTo(0,0),e.lineTo(h,-d),e.lineTo(h,d),e.lineTo(0,0),e.lineTo(h,-d)}_testOrderArrows(e){const t=this._data,i=t.orderArrow.width/2;for(const s of t.items){const r=s.orderPoint;if(e.xr.x+i)continue;const n="lower"===s.pos;let o=t.orderArrow.height+t.exitLineWidth;n||(o=-o);const a=r.y+(n?t.orderArrow.vMargin:-t.orderArrow.vMargin),l=Math.min(a,a+o),d=Math.max(a,a+o);if(!(e.yd))return!0}return!1}_testText(e){const t=this._data,i=t.text;if(!i.visible)return!1;for(const s of t.items){const r=s.orderPoint,n="lower"===s.pos;let o=t.orderArrow.vMargin+t.orderArrow.height+t.exitLineWidth;n||(o=-o);const a=r.y+o,l=(s.label?1:0)+(s.qty?1:0);let d=i.vMargin+i.fontSize*l+i.lineSpacing*Math.max(0,l-1);n||(d=-d);const h=Math.min(a,a+d),u=Math.max(a,a+d);if(e.yu)continue;const c=s.label&&s.qty?n&&e.ya-i.fontSize?s.label:s.qty:s.label||s.qty,_=this._textWidths.width.get(c);if(!(void 0===_||e.xr.x+_/2))return!0}return!1}}var f=i(422333),m=i(534741),v=i(142119);const g={BuyColor:(0,o.getHexColorByName)("color-tv-blue-500"),SellColor:"#FF1744",ExitColor:"#D500F9",LabelDarkColor:"#B2B5BE",LabelLightColor:(0,o.getHexColorByName)("color-cold-gray-900")};function y(e){return!1===e.e?"exit":e.b?"entryBuy":"entrySell"}function S(e){return e.b?"buy":"sell"}function b(e,t){return t?!e.b:e.b}function w(e,t){return b(e,t)?"lower":"upper"}function C(e,t,i){let s=e[t].get(i);return void 0===s&&(s=0,e[t].set(i,s)),s}function I(e,t,i,r){const n=(0,s.ensureDefined)(e[t].get(i));e[t].set(i,n+r)}function x(e,t){return t&&(e.c||e.id||"Untitled")||""}function P(e,t){return t&&(e.b?"+":"-")+e.q||""}function T(e,t,i){return(0,s.ensureNotNull)(e.b?i.valueAt(t,3):i.valueAt(t,2))}function R(e,t){return("exit"===y(e)?2:0)+t.vMargin+t.height}class M{constructor(e,t,i){this._invalidated=!0,this._textWidths={width:new Map},this._study=e,this._series=t,this._model=i,this._orderArrow={vMargin:11,width:10,height:15,tailWidth:2,tailHeight:10},this._priceArrow={width:5},this._text={vMargin:7,font:f.CHART_FONT_FAMILY,fontSize:12,lineSpacing:2,visible:!0},this._items={entryBuy:[],entrySell:[],exit:[]},this._study.properties().childs().strategy.childs().orders.subscribe(this,this.update)}update(){this._invalidated=!0}clearItems(){this._items.entryBuy=[],this._items.entrySell=[],this._items.exit=[]}renderer(){const e=this._study.properties().childs();if(!e.visible.value()||!e.strategy.childs().orders.childs().visible.value())return null;if(this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items.entryBuy.length||this._items.entrySell.length||this._items.exit.length){const e=new v.CompositeRenderer;return this._items.entryBuy.length&&e.append(this._strategyOrdersRenderer(this._items.entryBuy,!1)),this._items.entrySell.length&&e.append(this._strategyOrdersRenderer(this._items.entrySell,!1)), this._items.exit.length&&e.append(this._strategyOrdersRenderer(this._items.exit,!0)),e}return null}_strategyOrdersRenderer(e,t){const i=this._model.backgroundColor().value(),s="black"===(0,l.rgbToBlackWhiteString)((0,l.parseRgb)(i),150);return new p({items:e,buyColor:g.BuyColor,sellColor:g.SellColor,exitColor:g.ExitColor,labelColor:s?g.LabelDarkColor:g.LabelLightColor,bgColor:i,orderArrow:this._orderArrow,exitLineWidth:t?2:0,priceArrow:this._priceArrow,text:this._text},this._textWidths)}_updateImpl(){this.clearItems();const e=this._study.ordersData();if(!e||!e.length)return;const t=this._model.timeScale(),i=this._series.priceScale(),r=t.visibleBarsStrictRange();if(t.isEmpty()||i.isEmpty()||null===r)return;const n=this._study.barsIndexes(),o=this._series.nearestIndex(r.firstBar(),m.PlotRowSearchMode.NearestRight),l=this._series.nearestIndex(r.lastBar(),m.PlotRowSearchMode.NearestLeft);if(void 0===o||void 0===l)return;const[d,h]=function(e,t,i,s){const r=[],n=[];for(let o=0;oi||(r.push(e[o]),n.push(a))}return[r,n]}(e,o,l,n),[u,c]=this._labelAndQtyVisibility(d.length),_=u||c,p=this._textHeight(u,c),f=(0,s.ensureNotNull)(this._series.firstValue()),v=i.isInverted(),g={upper:new Map,lower:new Map};for(let e=0;et.width())return[!1,!1];const i=this._study.properties().childs().strategy.childs().orders.childs();return[i.showLabels.value(),i.showQty.value()]}_textHeight(e,t){return e||t?e&&t?2*this._text.fontSize+this._text.vMargin+this._text.lineSpacing:this._text.fontSize+this._text.vMargin:0}}var D=i(811630);const A=["strategy_props"];class V extends n.Study{constructor(e,t,i,s,n){super(e,t,i,s),this.watchedData=new r.WatchedValue,this._barsIndexes=[],this._srcBarsIndexes=[],this._reportDataBuffer=null,this._reportData=null,this._activeState=!1,t.childs().visible.subscribe(this,(()=>{this._processChangeVisibility()})),this._processChangeVisibility(n)}destroy(){this._properties.childs().visible.unsubscribeAll(this),this.model().removeStrategySource(this,0),super.destroy()}properties(){return this._properties}hasStateForAlert(){return D.alertsAvailable}inputsForAlertState(){const e=this.inputs();return(0,s.ensureNotNull)(this._metaInfo).inputs.forEach((t=>{const i=e[t.id];i&&t.internalID&&(i.internalID=t.internalID)})),e}reportData(){return this._reportData}ordersData(){var e,t;return null!==(t=null===(e=this._reportData)||void 0===e?void 0:e.filledOrders)&&void 0!==t?t:null}barsIndexes(){return this._barsIndexes}clearData(){super.clearData(),this._reportDataBuffer=null,this._reportData=null, this._strategyOrdersPaneView&&this._strategyOrdersPaneView.clearItems()}strategyOrdersPaneView(){return this.isSourceHidden()?null:this._strategyOrdersPaneView}restoreData(e){super.restoreData(e);const t=e;this.model().addStrategySource(this,0),t.reportData&&t.barsIndexes&&(this._reportData=t.reportData,this._barsIndexes=t.barsIndexes,this.watchedData.setValue({method:"data_update",nonSeriesData:{indexes_replace:!1,data:{report:this._reportData}}})),t.activeState&&(this._activeState=!0)}activeState(){return this._activeState}updateAllViews(e){super.updateAllViews(e),this._strategyOrdersPaneView&&this._strategyOrdersPaneView.update()}state(e,t){const i=super.state(e,t);return e&&this._reportData&&this._barsIndexes&&(i.data||(i.data={}),i.data.reportData=this._reportData,i.data.barsIndexes=this._barsIndexes,i.data.activeState=this.model().activeStrategySource().value()===this),i}isHibernationAllowed(){return!1}_onData(e){e.method&&"data_update"!==e.method&&this.watchedData.setValue({method:e.method}),super._onData(e)}_onDataUpdated(e,t,i){var r,n,o;let a=t&&!t.indexes_replace&&t.data&&t.data.report;a?(t&&!t.indexes_replace&&t.isUpdate&&this._reportDataBuffer&&(a={...this._reportDataBuffer,...a}),this._reportData={...this._reportDataBuffer,...a},this._reportDataBuffer=this._reportData,this.watchedData.setValue({method:"data_update",nonSeriesData:(0,s.ensureNotNull)(t)})):this.watchedData.setValue({method:"data_update",nonSeriesData:{indexes_replace:!1,data:{report:this._reportDataBuffer}}});const l=!(!t||!t.indexes_replace);("nochange"!==i&&i.length>0||(null!==(o=null===(n=null===(r=this._reportData)||void 0===r?void 0:r.filledOrders)||void 0===n?void 0:n.length)&&void 0!==o?o:0)!==this._barsIndexes.length)&&(a||l)&&this._collateBarsIndexes(Array.isArray(i)?i:this._srcBarsIndexes),super._onDataUpdated(e,t,i)}_createViews(){super._createViews(),this._strategyOrdersPaneView=new M(this,this._series,this._model)}_titleInputs(e,t,i){return this.inputs({symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:A,noExchanges:t,displayMask:e})}_getTelemetryObjectName(){return"strategy"}_collateBarsIndexes(e){var t;this._srcBarsIndexes=e;const i=null===(t=this._reportData)||void 0===t?void 0:t.filledOrders;if(i&&i.length){this._barsIndexes.length=0;for(let t=0;t{"use strict";i.d(t,{Study:()=>Pi,createStudyError:()=>wi,prepareStudyProperties:()=>fi,prepareStudyPropertiesForLoadChart:()=>yi});var s=i(316230),r=i(822914),n=i(852290),o=i(650151),a=i(130551),l=i(444372),d=i(201089),h=i(638456),u=i(461794),c=i(173948),_=i(168682),p=i(855611),f=i(782856),m=i(62745),v=i(298113);function g(e){const t=new Set ;("historyCalculationMayChange"in e?e.historyCalculationMayChange():e.metaInfo().historyCalculationMayChange)&&t.add(f.DataSourceDangerReason.PineRepainting);for(const i of Object.values(e.inputs()))if((0,m.isExtendedInput)(i)&&"symbol"===i.t){const s=e.resolvedSymbolInfoBySymbol(i.v);"spread"===(null==s?void 0:s.type)&&t.add(f.DataSourceDangerReason.Spread),"CRYPTOCAP"===(null==s?void 0:s.exchange)&&t.add(f.DataSourceDangerReason.CryptoCap)}for(const i of e.parentSources())(0,v.addToSet)(t,g(i));const i=e.ownerSource();return e.isChildStudy()&&i&&(0,v.addToSet)(t,g(i)),t}function y(e){const[t]=g(e);return null!=t?t:null}var S=i(223284),b=i(662080),w=i(960337),C=i(371927),I=i(822122),x=i(397150),P=i(707957),T=i(246733),R=i(459685),M=i(974655),D=i(291784),A=i(195447),V=i(526075),L=i(484812),k=i(534741),B=i(379048),N=i(260414),E=i(103055),O=i(567467);class F{constructor(e,t){this._study=e,this._model=t,this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=this._study.properties(),s=this._showStudyValues.value()&&i.childs().showLegendValues.value(),r=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,8);for(const e of t)e.visible=e.visible&&s&&r(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new O.HHistBasedValuesProvider(e,t):new E.StudyValuesProvider(e,t)}}var H=i(368135);class W extends N.StudyBaseWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update);const i=this._study.properties();i.childs().showLegendValues.subscribe(this,this.update);const s=this._study.metaInfo().plots,r=new Set;s.forEach((e=>{var t;if((0,H.isOhlcPlot)(e)){const t=e.target;if(r.has(t))return;r.add(t),i.childs().ohlcPlots.childs()[t].childs().display.subscribe(this,this.update)}else(0,H.isPlotSupportDisplay)(e)&&(null===(t=i.childs().styles.childs()[e.id])||void 0===t||t.childs().display.subscribe(this,this.update))}))}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this);const e=this._study.properties();e.childs().showLegendValues.unsubscribeAll(this);const t=this._study.metaInfo().plots,i=new Set;t.forEach((t=>{var s;if((0,H.isOhlcPlot)(t)){const s=t.target;if(i.has(s))return;i.add(s),e.childs().ohlcPlots.childs()[s].childs().display.unsubscribe(this,this.update)}else(0,H.isPlotSupportDisplay)(t)&&(null===(s=e.childs().styles.childs()[t.id])||void 0===s||s.childs().display.unsubscribe(this,this.update))}))}_createValuesProvider(e,t){return new F(e,t)}}var z=i(885482),U=i(555502),G=i(919892),q=i(173220),$=i(826989),j=i(509550),Y=i(389137),K=i(182436),Q=i(982217),X=i(539163);class Z{constructor(e,t,i=!1){this.price=t, this.index=e,this.useMainSeriesForPriceRange=i}}var J=i(92245);function ee(e,t,i,s){if(e.y1===e.y2)return function(e,t,i){return(0,o.assert)(e.y1===e.y2),(0,J.doesItemAffectVisibleRange)(e.x1,e.x2,e.extend,t,i)?[new Z(t,e.y1,!1),new Z(i,e.y2,!1)]:[]}(e,i,s);const r=[];return null!==e.x1&&r.push(new Z(e.x1,e.y1,!1)),null!==e.x2&&r.push(new Z(e.x2,e.y2,!1)),r}function te(e,t,i,s){return e.points.filter((e=>e.x>=i&&e.x<=s)).map((e=>new Z(e.x,e.y,!1)))}function ie(e,t,i,s){return(0,J.doesItemAffectVisibleRange)(e.left,e.right,e.extend,i,s)?[new Z(i,e.top,!1),new Z(s,e.bottom,!1)]:[]}var se=i(294024);function re(e,t,i,s){let r;const n=e.yloc!==se.DwgLabelYloc.Price&&e.yloc!==se.DwgLabelYloc.Auto;if(n){const i=e.yloc===se.DwgLabelYloc.AboveBar?2:3,s=t.valueAt(e.x);null!==s&&(r=s[i])}else r=e.y;return null==r?null:[new Z(e.x,r,n)]}function ne(e,t,i,s,r,n){if(!(0,J.doesItemAffectVisibleRange)(e.firstBarTime,e.lastBarTime,J.DwgExtend.None,i,s))return[];let o=1/0,a=-1/0;for(const[t,i]of r.tpoBlockSets())if(n===t)for(const t of i)t.tpoId===e.id&&(o=Math.min(o,t.rowIndex*e.priceRange),a=Math.max(a,(t.rowIndex+1)*e.priceRange));return Number.isFinite(o)?[new Z(i,a,!1),new Z(s,o,!1)]:[]}class oe{constructor(e,t,i,s,r){this._mapGetter=e,this._study=t,this._bars=t.series().bars(),this._visibilityGetter=i,this._getPoints=s,this._getMargins=r}groupPriceRange(e,t){let i=null;const s=this._study.graphics();for(const[r,n]of this._mapGetter())if(this._visibilityGetter(r))for(const o of n){const n=this._getPoints(o,this._bars,e,t,s,r);if(null===n)continue;let a=1/0,l=-1/0,d=!1,h=!1,u=!1;for(const i of n){const s=i.index<=t,r=i.index>=e;d=d||s,h=h||r,u=u||s&&r;let n=i.price,o=i.price;if(i.useMainSeriesForPriceRange){const e=this._bars.valueAt(i.index);if(null===e)continue;const t=e[2];if(null==t)continue;const s=e[3];if(null==s)continue;n=s,o=t}nl&&(l=o)}if(!(u||d&&h))continue;const c=new D.PriceRange(a,l);i=null===i?c:i.merge(c)}return i}firstValue(e,t){let i=1/0,s=1/0,r=-1/0,n=1/0,o=1/0,a=1/0;const l=this._study.graphics();for(const[d,h]of this._mapGetter())if(this._visibilityGetter(d))for(const u of h){const h=this._getPoints(u,this._bars,e,t,l,d);if(null!==h)for(const l of h){const d=l.index;d>=e&&d<=t&&dr?(r=d,n=l.price):d>t&&d{const s=i.index;return s>=e&&s<=t})).length)continue;const a=this._getMargins(o,this._bars);i.bottomPixelMargin=Math.max(i.bottomPixelMargin,a.bottomPixelMargin),i.topPixelMargin=Math.max(i.topPixelMargin,a.topPixelMargin)}return i}}const ae=()=>({bottomPixelMargin:0,topPixelMargin:0}) ;function le(e){const t=(0,o.ensureDefined)(e.properties().childs().graphics).childs();return[new oe((()=>e.graphics().tpos()),e,(e=>{const i=(0,o.ensureDefined)(t.tpoBlockSets).childs()[e].childs();return i.showLetters.value()||i.showBlocks.value()||(0,o.ensureDefined)(t.tpoVolumeRows).childs()[e].childs().visible.value()}),ne,ae),new oe((()=>e.graphics().dwglabels()),e,(e=>(0,o.ensureDefined)(t.dwglabels).childs()[e].childs().visible.value()),re,X.calculateDwgLabelsMargins.bind(null,e)),new oe((()=>e.graphics().dwglines()),e,(e=>(0,o.ensureDefined)(t.dwglines).childs()[e].childs().visible.value()),ee,ae),new oe((()=>e.graphics().dwgpolylines()),e,(e=>(0,o.ensureDefined)(t.dwgpolylines).childs()[e].childs().visible.value()),te,ae),new oe((()=>e.graphics().dwgboxes()),e,(e=>(0,o.ensureDefined)(t.dwgboxes).childs()[e].childs().visible.value()),ie,ae),new oe((()=>e.graphics().dwglinefills()),e,(e=>(0,o.ensureDefined)(t.dwglinefills).childs()[e].childs().visible.value()),((t,i,s,r)=>{const n=new Map;for(const[,t]of e.graphics().dwglines())for(const e of t)n.set(e.id,e);return function(e,t,i,s,r){const n=e.get(t.line1),o=e.get(t.line2);return void 0!==n&&void 0!==o&&((0,J.doesItemAffectVisibleRange)(n.x1,n.x2,n.extend,s,r)||(0,J.doesItemAffectVisibleRange)(o.x1,o.x2,o.extend,s,r))?[new Z(s,n.y1,!1),new Z(r,n.y2,!1),new Z(s,o.y1,!1),new Z(r,o.y2,!1)]:[]}(n,t,0,s,r)}),ae)]}function de(e,t,i){return null===t?e:null===e?t:e.index{t.has(e.studyId)||(t.add(e.studyId),i.push(e))})),i}function ge(e){const t=e.model().mainSeries();return{studyId:(0,o.ensureNotNull)(e.sourceId()),turnaround:e.turnaround(),sourceStudies:e.parentSources().filter((e=>e!==t)).map((e=>ge(e)))}}var ye=i(244842),Se=i(142119),be=i(43192);class we extends be.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){}_drawBackgroundImpl(e){const{context:t,horizontalPixelRatio:i,bitmapSize:s}=e,r=this._data;for(let e=0;e0?(i-=r,s+=r):(i+=r,s-=r);const n=this._study.getMinFirstBarIndexForPlot(this._plotName);if(n>s)return;i=Math.max(n,i);const a=this._study.data();for(const e of a.rangeIterator(i,s)){let i=e.index;const s=e.value;i+=r;const n={timePointIndex:Math.floor(i),left:NaN,center:NaN,right:NaN};let a=(0,Y.isNumber)(t)?t:50;a=Math.min(a,100),a=Math.max(a,0);const l=this._colorProvider.getPlotPointStyle(s);void 0!==l.colors[1]&&(n.color=(0,T.generateColor)((0,o.ensureDefined)(l.colors[1]),a)),this._items.push(n)}this._model.timeScale().fillBarBorders(this._items)}}var xe=i(230058),Pe=i(466144),Te=i(678515),Re=i(63316),Me=i(544421),De=i(574809),Ae=i(111595),Ve=i(594931),Le=i(506366),ke=i(992885),Be=i(618241),Ne=i(778190),Ee=i(29164),Oe=i(119914),Fe=i(815555),He=i(674981),We=i(928483);const ze=new Map;ze.set("PaneRendererArrowUp",Ae.PaneRendererArrowUp),ze.set("PaneRendererArrowDown",Ae.PaneRendererArrowDown),ze.set("PaneRendererCircleShape",Ve.PaneRendererCircleShape),ze.set("PaneRendererCrossShape",Le.PaneRendererCrossShape),ze.set("PaneRendererDiamond",ke.PaneRendererDiamond),ze.set("PaneRendererFlagShape",Be.PaneRendererFlagShape),ze.set("PaneRendererLabelUp",Ne.PaneRendererLabelUp),ze.set("PaneRendererLabelDown",Ne.PaneRendererLabelDown),ze.set("PaneRendererSquare",Ee.PaneRendererSquare),ze.set("PaneRendererTriangleApexUp",Oe.PaneRendererTriangleApexUp),ze.set("PaneRendererTriangleApexDown",Oe.PaneRendererTriangleApexDown),ze.set("PaneRendererXCross",Fe.PaneRendererXCross);class Ue extends We.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s){var r;super(i),this._renderer=null,this._shapesRenderer=null,this._selectionRenderer=null, this._isMarkersEnabled=ye.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s;const n=e.metaInfo().plots;for(let e=0;ethis._createItem(e,null!=t?t:null,d,h,a)));let c=this._series.nearestIndex(r.firstBar(),k.PlotRowSearchMode.NearestRight),_=this._series.nearestIndex(r.lastBar(),k.PlotRowSearchMode.NearestLeft);if(void 0===c||void 0===_)return!1;a>0?(c-=a,_+=a):(c+=a,_-=a);const p=this._study.getMinFirstBarIndexForPlot(this._plotName);if(p>_)return!0;c=Math.max(p,c);const f=this._getTranspValue(),m=this._study.properties().childs().styles.childs()[this._plotName].childs(),v=m.color.value(),g=m.textColor?m.textColor.value():void 0,y=v,S=v,b=void 0===g?void 0:g,w=(0,o.ensureNotNull)(this._plotIndex),C=(0,De.createEmptyStyle)(),I=null!=u?u:(0,o.ensureNotNull)(n.firstIndex()),x=n.rangeIterator(I,(0,o.ensureNotNull)(n.lastIndex())+1);let P=(0,He.lowerbound)(this._items,I+a,((e,t)=>e.timePointIndex9?i-10:0;s.borderColor=(0,T.generateColor)(s.color,e)}void 0!==t.colors[2]&&(s.textColor=(0,T.generateColor)((0,o.ensureDefined)(t.colors[2]),i))}_updateRenderer(e,t){this._makeSureRendererIsValid() ;const i=this._model.timeScale(),s={},r=this._getTranspValue(),n=i.barSpacing(),o=this._calculateShapeHeight(n),a=this._study.properties().childs().styles.childs()[this._plotName].childs(),l=a.location.value(),d=this._calculateVerticalOffset(l,o+o/2);s.barSpacing=n,s.items=this._items,s.color=(0,T.generateColor)(a.color.value(),r),s.height=o,s.vertOffset=d,s.visibleItemsRange={startItemIndex:e,endItemIndex:t};const h=a.plottype.value(),u=Pe.plotShapesData[h],c=new Se.CompositeRenderer;u&&(this._shapesRenderer?this._shapesRenderer.setData(s):(this._shapesRenderer=this._createRenderer(u.paneRendererClass,s),c.append(this._shapesRenderer))),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=d,c.append(new xe.SelectionRenderer(this._selectionData))),this._renderer=c}_createRenderer(e,t){const i=ze.get(e);return new((0,o.ensureDefined)(i))(t)}_getSeriesVal(e,t){const i=(0,Me.barFunction)(e),s=this._series.data().valueAt(t);return null===s?null:i(s)}_getTranspValue(){let e=0;const t=this._study.properties().childs();t.transparency&&(e=t.transparency.value(),e=(0,Y.isNumber)(e)?e:50);const i=t.styles.childs()[this._plotName].childs();return i.transparency&&(e=i.transparency.value(),e=(0,Y.isNumber)(e)?e:50),(0,Te.clamp)(e,0,100)}_createItem(e,t,i,s,r){const n=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),a={origPrices:{price:NaN},timePointIndex:e+r};if((null===t||0===t)&&n!==B.MarkLocation.Absolute)return a;if(null==t)return a;let l=NaN;switch(n){case B.MarkLocation.AboveBar:{const t=this._getLocationPrice(e,i,r);if(null===t)return a;l=t;break}case B.MarkLocation.BelowBar:{const t=this._getLocationPrice(e,s,r);if(null===t)return a;l=t;break}case B.MarkLocation.Absolute:l=(0,o.ensureNotNull)(t);break;case B.MarkLocation.Top:case B.MarkLocation.Bottom:l=0;break;default:throw new Error("Bad value: "+n)}return{y:NaN,origPrices:{price:l},timePointIndex:e+r}}_dependsOnSeriesData(){const e=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();return e===B.MarkLocation.AboveBar||e===B.MarkLocation.BelowBar}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(null==t)return null;const i=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();if(0===t&&i!==B.MarkLocation.Absolute)return null;const s=this._study.offset(this._plotName),{hiPlot:r,loPlot:n}=this._hiLoPlots();switch(i){case B.MarkLocation.AboveBar:return this._getLocationPrice(e.index,r,s);case B.MarkLocation.BelowBar:return this._getLocationPrice(e.index,n,s)}return super._getValueForUpdating(e)}_convertItemsToCoordinates(e,t,i,s){for(let e=i;e{ for(let t=i;t19?o-10:0,_=this._calculateVerticalOffset(d,Math.round(1.5*l));n.barSpacing=a,n.items=this.items(),n.color=h,n.borderColor=(0,T.generateColor)(s.color.value(),c),n.height=l,n.vertOffset=_,n.visibleItemsRange={startItemIndex:e,endItemIndex:t};const p=s.plottype.value(),f=Pe.plotShapesData[p],m=this._plotStyleInfo.text;if(void 0!==m&&""!==m.trim()){let e=m.trim().replace(/\\n/gm,"\n");e=(0,u.cleanButAmpersand)(e,!0),n.text=e,n.fontSize=12;const t=s.textColor?s.textColor.value():void 0;n.textColor=t?(0,T.generateColor)(t,o):h}if(this._renderer&&this._shapesRenderer&&this._selectionRenderer)this._shapesRenderer.setData(n),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?(this._selectionData.vertOffset=_,this._selectionRenderer.setData(this._selectionData)):this._selectionRenderer.setData(null);else{const e=new Se.CompositeRenderer;this._shapesRenderer=super._createRenderer(f.paneRendererClass,n),e.append(this._shapesRenderer),this._selectionRenderer=new xe.SelectionRenderer(null!==(i=this._selectionData)&&void 0!==i?i:void 0),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?this._selectionData.vertOffset=_:this._selectionRenderer.setData(null),e.append(this._selectionRenderer),this._renderer=e}}}var qe=i(687795),$e=i.n(qe),je=i(86441),Ye=i(821885),Ke=i(315801),Qe=i(9640),Xe=i(422333),Ze=i(600642);class Je extends Ye.PaneRendererAbstractShape{constructor(e,t){ super(null,t),this._fontSizeEnsured=0,this._ch="",this._fontFamily=Xe.CHART_FONT_FAMILY,this._charCache=null,null!==e&&this.setData(e)}setData(e){super.setData(e),this._fontSizeEnsured=(0,o.ensureDefined)(this._height);const t=e.char.slice(0,40);this._ch=$e()(t)[0]||" ",this._fontFamily=e.fontFamily||Xe.CHART_FONT_FAMILY}hitTest(e){const t=(0,Qe.interactionTolerance)().series+this._fontSizeEnsured/2;for(const i of this._items){if(new je.Point(i.center,i.y+i.vertOffset).subtract(e).length()<=t)return new Ke.HitTestResult(Ke.HitTarget.Regular)}return null}_drawItemShape(e,t){const i=t.center,s=t.vertOffset>0?1:-1,r=t.y+t.vertOffset-s*Math.round(this._fontSizeEnsured/2);let n;n=t.style&&void 0!==t.style.color?t.style.color:this._color;const o=this._textImageCache(),{context:a,horizontalPixelRatio:l,verticalPixelRatio:d}=e;if(this._fontSizeEnsured<=4/l){a.save();const e=Math.max(1,Math.floor(l));let s=Math.max(1,Math.floor(o.textImageWidth*l));s%2!=e%2&&(s+=s>1?-1:1);const h=Math.round(r*d)+(t.vertOffset>=0?0:-s);return a.fillStyle=n,a.fillRect(Math.round(i*l)+(l%2?.5:0)-s/2,h,s,s),void a.restore()}const h={style:{fillStyle:n},location:{x:i,y:r,horzAlign:Ze.HorizontalAlign.Center,vertAlign:t.vertOffset>0?Ze.VerticalAlign.Top:Ze.VerticalAlign.Bottom}};o.paintTo(e,h)}_startPath(e,t,i){}_endPath(e){}_textImageCache(){return null!==this._charCache&&this._charCache.fontFamily===this._fontFamily&&this._charCache.fontSize===this._fontSizeEnsured||(this._charCache={fontSize:this._fontSizeEnsured,fontFamily:this._fontFamily,cache:new Ze.TextImageCache(this._ch,!1,!1,this._fontFamily,this._fontSizeEnsured,"center",0)}),this._charCache.cache}}class et extends Ue{constructor(){super(...arguments),this._charRenderer=new Je(null)}_updateRenderer(e,t){var i,s;const r=this._getTranspValue(),n=this._model.timeScale().barSpacing();let a;const l=this._study.properties().childs().styles.childs()[this._plotName].childs();a=this._plotStyleInfo.size?this._calculateShapeHeight(50,this._plotStyleInfo.size):Math.round(n);const d=l.location.value(),h=(0,T.generateColor)(l.color.value(),r),c=this._calculateVerticalOffset(d,a),_={items:this.items(),barSpacing:n,char:(0,o.ensureDefined)(null!==(s=null===(i=l.char)||void 0===i?void 0:i.value())&&void 0!==s?s:this._plotStyleInfo.char),height:a,vertOffset:c,color:h,visibleItemsRange:{startItemIndex:e,endItemIndex:t}},p=this._plotStyleInfo.text;if(void 0!==p&&""!==p.trim()){let e=p.trim().replace(/\\n/gm,"\n");e=(0,u.cleanButAmpersand)(e,!0),_.text=e,_.fontSize=12;const t=l.textColor?l.textColor.value():void 0;_.textColor=t?(0,T.generateColor)(t,r):h}this._charRenderer.setData(_);const f=new Se.CompositeRenderer;f.append(this._charRenderer),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=c,f.append(new xe.SelectionRenderer(this._selectionData))),this._renderer=f}}var tt=i(724377);class it{constructor(e,t,i,s,r){this.left=NaN,this.right=NaN,this.height=NaN,this.center=e,this.y=t,this.origHeight=i,this.isUp=s, this.origPrices=r,this.timePointIndex=e,this.style={}}}function st(e){return Math.round(e/4)}function rt(e){return Math.round(e/2)}class nt extends be.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=rt(n.barSpacing),a=Math.round(o/2),l=Math.round(o),d=st(n.barSpacing),h=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,u=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;if(h>=u)return null;for(const t of n.items.slice(h,u)){if(!t)continue;if(!Number.isFinite(t.center)||!Number.isFinite(t.y))continue;const i=Math.abs(t.height),s=t.isUp?-1:1,r=i+l,n=t.y-s*d,o=n-s*r,h=t.center-a,u=t.center+a;if(h=y))for(const e of d.items.slice(g,y)){if(!Number.isFinite(e.center)||!Number.isFinite(e.y))continue;const t=e.isUp?-1:1,i=Math.round(Math.abs(e.height)*a),s=Math.round(e.center*o)+v,r=Math.round((e.y-t*u)*a)+v;l.beginPath(),l.translate(s,r);const h=null!==(n=e.style&&e.style.color)&&void 0!==n?n:e.isUp?d.colorup:d.colordown;c?(l.moveTo(0,0),l.lineTo(-f,-f*t),l.moveTo(0,0),l.lineTo(f,-f*t),l.moveTo(0,0),l.lineTo(0,-i*t),l.moveTo(-f,-i*t),l.lineTo(f,-i*t),l.lineWidth=_,l.strokeStyle=h,l.stroke()):(l.moveTo(0,0),i0,{hiPlot:r,loPlot:n}=this._hiLoPlots(),a=this._study.offset(this._plotName),l=Math.min(i+a,(0,o.ensureNotNull)(this._series.data().last()).index);if(s){const e=this._getSeriesVal(n,l);if(null!==e)return e}else{const e=this._getSeriesVal(r,l);if(null!==e)return e}return null}_updateItem(e,t){const i=this._getValueForUpdating(e),s=e.value[this._plotIndex+1]>0;return this._items[t].origPrices.price=null!=i?i:NaN,this._items[t].isUp=s,t+1}_createItem(e,t,i,s,r){const n={center:NaN,y:NaN,origPrices:{price:NaN,timePointIndex:NaN},origHeight:NaN};if(n.timePointIndex=e+r,!t)return n;const a=Math.min(e+r,(0,o.ensureNotNull)(this._series.data().last()).index),l=t>0;let d;if(l){const e=this._getSeriesVal(s,a);if(null===e)return n;d=e}else{const e=this._getSeriesVal(i,a);if(null===e)return n;d=e}return new it(e+r,d,t,l,{price:d,timePointIndex:e+r})}_dependsOnSeriesData(){return!0}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_updateItemsHeights(e){var t,i,s,r,n,a,l,d;const h=this._study.properties().childs().styles.childs();let u=Math.abs((0,o.ensureDefined)(null!==(i=null===(t=h[this._plotName].childs().minHeight)||void 0===t?void 0:t.value())&&void 0!==i?i:this._plotStyleInfo.minHeight)),c=Math.abs((0,o.ensureDefined)(null!==(r=null===(s=h[this._plotName].childs().maxHeight)||void 0===s?void 0:s.value())&&void 0!==r?r:this._plotStyleInfo.maxHeight));if(u>c){const e=u;u=c,c=e}const _=this._items,p=null!==(a=null===(n=e.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==a?a:0,f=(null!==(d=null===(l=e.visibleItemsRange)||void 0===l?void 0:l.endItemIndex)&&void 0!==d?d:_.length)-1;let m=0;for(let e=p;e<=f;e++){const t=_[e],i=Math.abs(t.origHeight);i>m&&(m=i)}const v=(c-u)/m;for(let e=p;e<=f;e++){const t=_[e],i=Math.abs(t.origHeight);t.height=i*v+u}}}var lt=i(969419);class dt{constructor(e,t,i,s){this._bars=[],this._invalidated=!1,this._isMarkersEnabled=ye.enabled("source_selection_markers"),this._selectionData=null,this._ohlcPlotIndexes=new Map,this._study=e,this._series=t,this._model=i,this._plotName=s, this._isMarkersEnabled=ye.enabled("source_selection_markers"),this._colorProvider=(0,Ce.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new Re.SelectionIndexes(i.timeScale());const r=this._study.metaInfo().plots;for(let e=0;es)return;i=Math.max(r,i);const n=this._study.data(),a=this._study.firstValue();if(null===a)return;const l=n.rangeIterator(i,s),d=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),h=new Map,u=(e,t)=>{const i=e+"@"+t;if(!h.has(i)){const s=(0,T.generateColor)(e,t);return h.set(i,s),s}return h.get(i)},c=(0,De.createEmptyStyle)();for(const e of l){let t=e.index;const i=e.value;t=Math.floor(t);let s=!0;const r=new Map;for(let e=1;e<=4;++e){const t=this._ohlcPlotIndexes.get(e);if(void 0===t){s=!1;break}const n=i[t+1];if(null==n){s=!1;break}r.set(e,n)}if(!s)continue;const n=(0,o.ensureDefined)(r.get(1)),a=(0,o.ensureDefined)(r.get(4)),l=(0,o.ensureDefined)(r.get(2)),h=(0,o.ensureDefined)(r.get(3)),_=Math.max(n,l,h,a),p=Math.min(n,l,h,a);let f=(0,o.ensureDefined)(u(d.color.value(),0));const m=this._colorProvider.getPlotPointStyle(i,c);void 0!==m.colors[0]&&(f=(0,o.ensureDefined)(m.colors[0]));const v={open:n,high:_,low:p,close:a,color:f,wickColor:m.colors[4],borderColor:m.colors[3],hollow:null,center:NaN,left:NaN,right:NaN,timePointIndex:Math.round(t)};this._bars.push(v)}if(e.barPricesToCoordinates(this._bars,a),this._model.timeScale().fillBarBorders(this._bars),this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:Ke.HitTarget.Regular,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=(0,o.ensureNotNull)(this._model.paneForSource(this._study)).height(),s=(0,o.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let r=0;r{var e;return this._colorPlotIndex=null!==(e=this._colorPlotIndex)&&void 0!==e?e:{type:1}};for(let t=0;t{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)}))}}var Dt=i(7288),At=i(395098),Vt=i(572230),Lt=i(964824),kt=i(401580),Bt=i(444331),Nt=i(261066),Et=i(932167),Ot=i(506387),Ft=i(938471);class Ht extends Ft.AbstractBarColorer{constructor(e,t){super(),this._rgbaFromInteger=(0,yt.rgbaFromIntegerCached)(),this._study=e,this._plotIndex=t}applyBarStyle(e,t,i,s){var r;if(t)return i;const n=this._study.properties().childs();if(!n.visible.value())return i;const a=this._study.metaInfo(),l=this._study.data();if(!l||0===l.size())return i;const d=a.plots[this._plotIndex],h=this._getOffset() ;if(this._study.getMinFirstBarIndexForPlot(d.id)>e+h)return i;if(0===n.styles.childs()[d.id].childs().display.value())return i;const u=l.valueAt(e-h);if(null===u)return i;let c=u[this._plotIndex+1];if(null==c)return i;if(c=Math.round(c),a.isRGB)i.barColor=this._rgbaFromInteger(c),i.upColor=i.barColor,i.downColor=i.barColor;else{const e=a.plots[this._plotIndex];if("palette"in e){const t=e.palette,s=n.palettes.childs()[t],l=(0,o.ensureDefined)(null===(r=a.palettes)||void 0===r?void 0:r[t]),d=l.valToIndex?(0,o.ensureDefined)(l.valToIndex[c]):c,h=s.childs().colors.childs()[d].childs().color.value();i.barColor=h,i.upColor=h,i.downColor=h}}return i}firstColoredBar(e){var t;let i=e;for(const s of this._backColorers)i=Math.min(i,null!==(t=s.firstColoredBar(e))&&void 0!==t?t:1/0);const s=this._getOffset();i=Math.min(i,e+s);const r=this._getBars().firstIndex();return Math.max(i,null!=r?r:-1/0)}_getBars(){return this._study.series().bars()}_getOffset(){const e=this._study.metaInfo().plots[this._plotIndex];return this._study.offset(e.id)}}var Wt=i(251954),zt=i(42292),Ut=i(808068),Gt=i(853965),qt=i(312449),$t=i(388545),jt=i(624444),Yt=i(943994),Kt=i(541346),Qt=i(347710),Xt=i(989709);const Zt=(0,d.getLogger)("Chart.Study"),Jt=l.t(null,void 0,i(814177));const ei={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:!1,asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1},ti={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!0,skipFakeInputs:!1,skipBooleanInputs:!1,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1,fakeInputsForDisplay:!1,doNotSkipHiddenWithMigrate:!1,onlyAtomValues:!0,patchSosInputs:!1},ii=ye.enabled("study_symbol_ticker_description"),si=ye.enabled("hide_main_series_symbol_from_indicator_legend"),ri=ye.enabled("datasource_copypaste"),ni=ye.enabled("hide_unresolved_symbols_in_legend");function oi(e,t){const i=e.plots[t];if(!i||!(0,H.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,H.isOhlcPlotStyleBars)(r)||n&&(0,H.isOhlcPlotStyleBars)(n)||!!o&&(0,H.isOhlcPlotStyleBars)(o)}function ai(e,t){const i=e.plots[t];if(!i||!(0,H.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,H.isOhlcPlotStyleCandles)(r)||n&&(0,H.isOhlcPlotStyleCandles)(n)||!!o&&(0,H.isOhlcPlotStyleCandles)(o)}function li(e,t){(0,o.assert)(void 0!==e,"zOrder must be defined"),(0,o.assert)(!t.has(e),"zOrder must be unique")}function di(e,t){return e.plots.some((e=>((0,H.isColorerPlot)(e)||(0,H.isDataPlot)(e))&&e.target===t))} function hi(e){const t={};if(e.plots)for(let i=0;i= 1");const o=V.StudyMetaInfo.getStudyPropertyRootName(e),l=(0,Y.clone)(e.defaults),d=ui();if((0,n.default)(d,hi(e)),(0,n.default)(d,l),(0,n.default)(d,(0,zt.factoryDefaults)(o)),(0,n.default)(d,ci(e,s,o)),(0,n.default)(d,t),(0,n.default)(d,_i(l,d)),null!==i){const t=i.model().studiesColorRotatorFactory().getColorRotator(e);null!==t&&("Overlay@tv-basicstudies"===e.id?d.lineStyle.color=t.getColor(d.lineStyle.color):(0,n.default)(d,function(e,t){for(const i of Object.keys(e.styles)){const s=e.styles[i];if((0,a.isObject)(s)&&"color"in s){const e=s.color;s.color=t.getColor(e)}}return e}(d,t)))}return s.updateStudyInputsIfNeeded(d,null!==(r=d.version)&&void 0!==r?r:e.version,e),d}function fi(e,t,i,s,r){return function(e,t,i,s,r,n){const o=pi(e,t,i,s);return V.StudyMetaInfo.getSourceInputIds(e).forEach(((e,t)=>{const i=o.inputs[e];t=1&&(0,n.default)(u,_i(l,u)),u}(e,t,i,s,o);return vi(t||e,r,a)}function yi(e,t,i,s,r){return gi(e,t,i,s,V.StudyMetaInfo.getStudyPropertyRootName(e),r)}function Si(e,t,i){let s=0,r=0;return e.inputs.filter((e=>"source"===e.type)).forEach((e=>{(0,m.getInputValue)(i[e.id]).includes("$")&&s++,(0,m.getInputValue)(t[e.id]).includes("$")&&r++})),Math.sign(r)-Math.sign(s)}function bi(e){const t=new Set;for(const i of e.parentSources())for(const e of bi(i))t.add(e);return t.add(e),Array.from(t)}function wi(e,t){return"BISTMIXED"===t&&(0,Dt.isVolumeDataError)(e.error)&&(e.error="VOLUME_BIST_MIXED",e.solution_id=ue.solutionIds.BIST_MIXED_SUBSCRIPTION,e.title=Dt.noVolumeErrorTooltip),{type:Dt.StudyStatusType.Error,errorDescription:e}}function Ci(e){return"inherit"===e.type&&(e.type="price"),e}function Ii(e,t,i,s){if(null!==t)switch(e.type){case"inherit":case"price":return new jt.PriceFormatter(t);case"volume":return new Yt.VolumeFormatter(Math.log10(t));case"percent":return new Kt.PercentageFormatter(t)}if("inherit"===e.type)return null;const r=(0,Y.isNumber)(e.precision)?Math.pow(10,e.precision):void 0;switch(e.type){case"price":return new jt.PriceFormatter(r);case"volume":{let t=e.precision;return void 0===t&&(t=i&&(0,Y.isNumber)(i.volume_precision)?i.volume_precision:0),new Yt.VolumeFormatter(t)}case"percent":return new Kt.PercentageFormatter(r);default:return Zt.logWarn(`Unsupported format type: ${e.type}`),null}}const xi=new Set(["first_visible_bar_time","last_visible_bar_time","subscribeRealtime"]);class Pi extends M.PriceDataSource{constructor(e,t,i,s){var r,n,a;super(e),this._onStart=new P.Delegate,this._restarting=!1,this._paneViews=[],this._legendView=null,this._priceAxisViews=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._labelPaneViews=[], this._ownFirstValue=null,this._formatter=null,this._dataUpdated=new P.Delegate,this._currencySourceSymbolInputProperty=null,this._onHibernationStateChange=new P.Delegate,this._symbolsResolved=new P.Delegate,this._statusChanged=new P.Delegate,this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._sources=[],this._status={type:Dt.StudyStatusType.Undefined},this._recompilationStatus=null,this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new K.NumericFormatter,this._graphicsPriceAxisViews=[],this._plotOffsets={},this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._tagsChanged=new P.Delegate,this._studyName="",this._turnaround="st0",this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new P.Delegate,this._childStudyByRebind=new P.Delegate,this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new kt.WatchedValue(0),this._currencySourceSymbolInfo=null,this._graphicsPriceRangeGroups=null,this._graphicsViewsReady=!1,this._visibleTimeRangeInputs=null,this._turnaroundCounter=0,this._deferredPinePatchProps=!1,this._propertiesPatched=Promise.resolve(),this._aboutToBeDestroyed=new P.Delegate,this._definitionsViewModel=null,this._plotFormatters=new Map,this._onParentSourcesChanges=new P.Delegate,this._statusChangesSubscriber={},this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._hideMatches=s.inputs.filter((e=>e.hideWhenPlotsHidden)).map((e=>({id:e.id,plotIds:e.hideWhenPlotsHidden||[]}))),this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),this._sources=i,V.StudyMetaInfo.setChildStudyMetaInfoPropertiesSourceId(s,null===(r=this._sources[0])||void 0===r?void 0:r.id(),t),i.forEach((e=>{e.setChild(this)})),[this._series,...i].forEach((e=>{e.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),e.unitChanged().subscribe(this,this._onSourceUnitChanged),e.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),e.formatterChanged().subscribe(this,this._onSourceFormatterChanged),e.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged)})),ii&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,(()=>{this.invalidateTitleCache(!0)}));const l=this._properties.childs();for(const e of V.StudyMetaInfo.getSourceInputIds(s))null===(n=l.inputs.childs()[e])||void 0===n||n.subscribe(this,this._onSourceInputChanged);this._properties.subscribe(this,this._onPropertiesChanged),l.visible.subscribe(this,this._visibleChanged),l.visible.subscribe(this,(()=>this.processHibernate())), l.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),l.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offsets&&l.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offset&&l.offset.listeners().subscribe(this,this._updateMaxOffsetValue),z.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e{this.processHibernate(),this.invalidateTitleCache()}))}for(const e of Object.keys(this._metaInfo.graphics))for(const t of Object.keys(this._metaInfo.graphics[e])){const i=null===(a=l.graphics.childs()[e])||void 0===a?void 0:a.childs()[t];i&&i.childs().visible&&(0,o.ensureDefined)(i.childs().visible).subscribe(this,(()=>this.processHibernate()))}this._isActualInterval=(0,At.isActualInterval)(this._series.intervalObj(),l.intervalsVisibilities),this._initializeStudyInputsPaneViews(),this._handler=e=>this._onData(e),this._handler.isTVScriptStrategy=this._metaInfo.isTVScriptStrategy,this._valuesProvider=new E.StudyValuesProvider(this,e),this._graphicsPriceRangeGroups=le(this),this._graphics=new L.LiveStudyGraphics(s.graphics),this._signlePerformanceValue=(0,fe.createWVFromGetterAndSubscriptions)((()=>{var e;return null!==(e=Array.from((0,o.ensureDefined)(this._graphics.performance().get("performance")))[0])&&void 0!==e?e:null}),[(0,o.ensureDefined)(this._graphics.observablePerformance().get("performance")).changed(),(0,o.ensureDefined)(this._graphics.observablePerformance().get("performance")).cleared()]),this._chartApi=e.chartApi(),this._invalidateLastNonEmptyPlotRowCache(),this._data=new A.PlotList((0,Xt.studyPlotFunctionMap)(this._metaInfo),Xt.studyEmptyPlotValuePredicate),this._createViews(),this._recreatePriceFormattingDependencies(this._series.symbolInfo()),l.precision.subscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.subscribe(this,(()=>this.invalidateTitleCache(!0))),l.inputs.listeners().subscribe(this,(()=>this.invalidateTitleCache(!0))),ye.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().dataEvents().symbolResolved().subscribe(this,this._recreatePriceFormattingDependencies),e.mainSeries().dataEvents().symbolResolved().subscribe(this,(()=>this.invalidateTitleCache(!0)));const d=new Set;if(this._simplePlotsCount=s.plots.filter(((e,t)=>{if((0,H.isLinePlot)(e))return!0;if((0,H.isOhlcPlot)(e)){const t=e.target;return!d.has(t)&&(d.add(t),!0)}return!1})).length,this.hasBarColorer()&&l.visible.listeners().subscribe(this,(()=>e.mainSeries().invalidateBarStylesCache)),this._definitionsViewModel=null,this._updateMaxOffsetValue(),s.inputs.some((e=>xi.has(e.id)))){this._visibleTimeRangeInputs=e.visibleRangeStudiesInputs().spawn();const t=this._visibleTimeRangeInputs.value();let i=null!==t;this._visibleTimeRangeInputs.subscribe((e=>{const t=()=>{this._onVisibleTimeRangeInputsChanged(e),i!==(null!==e)&&(i=null!==e,!i||this._restarting||this.isStarted()||this.start(!0))} ;this._statusChanged.unsubscribeAll(this._statusChangesSubscriber),this._status.type===Dt.StudyStatusType.Loading?this._statusChanged.subscribe(this._statusChangesSubscriber,t,!0):t()})),t&&this._updateVisibleTimeRangeInputs(t,!1)}}destroy(){var e,t,i;null===(e=this._signlePerformanceValue)||void 0===e||e.destroy(),this._aboutToBeDestroyed.fire(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._showStudyArgumentsProperty.unsubscribeAll(this),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this);this.parentSources().forEach((e=>{e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this),e.priceRangeReadyChanged().unsubscribeAll(this),e.formatterChanged().unsubscribeAll(this),e.priceStepChanged().unsubscribeAll(this)})),this._series.properties().childs().statusViewStyle.childs().symbolTextSource.unsubscribeAll(this),this._series.onIntervalChanged().unsubscribeAll(this),this.formatterChanged().unsubscribe(this,this.invalidateTitleCache),z.hideAllIndicators().unsubscribe(this,this._visibleChanged),this._model.collapsed().unsubscribe(this._processHibernateBound),null!==this._currencySourceSymbolInputProperty&&this._currencySourceSymbolInputProperty.unsubscribeAll(this),null===(t=this._legendView)||void 0===t||t.destroy(),null===(i=this._visibleTimeRangeInputs)||void 0===i||i.destroy(),super.destroy()}properties(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.linkedToSeries}logs(){return this._metaInfo.graphics.logs&&this._graphics instanceof L.LiveStudyGraphics?(0,o.ensureDefined)(this._graphics.observableLogs().get("logs")):null}logLevelMask(){const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,Y.isNumber)(e)||e<0||e>7)throw new Error(`Value of log level is unexpected, current value is ${e}, but expected values from 0 to 7`);return{error:Boolean(1&e),warning:Boolean(2&e),info:Boolean(4&e)}}setLogLevelMask(e){const t=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4);this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){return this._graphics instanceof L.LiveStudyGraphics?this._signlePerformanceValue:new kt.WatchedValue(null)}profilingEnabled(){var e;return!!(null===(e=this._properties.childs().inputs.childs().__profile)||void 0===e?void 0:e.value())}enableProfiling(e){var t;null===(t=this._properties.childs().inputs.childs().__profile)||void 0===t||t.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange(),o=this.firstValue(!0);if(null===n||null===o)return s;if(!this._properties.childs().visible.value())return s;const a=this._properties.childs().styles,l=this._properties.childs().ohlcPlots;let d,h;if(a&&a.childs()[e]&&(d=a.childs()[e]),l&&l.childs()[e]&&(d=l.childs()[e]), !d||0===d.childs().display.value())return s;const u=this.metaInfo().plots;for(h=0;he.id()));if(d.length&&(l.parentSources=d),e){let e=this.data();const t=this._model.timeScale(),i=this._seriesDataRangeToSave(e);null!==i&&(e=e.range(i.firstBar(),i.lastBar())),l.data=e.state(),l.data.symbols=this._resolvedSymbols,l.data.graphics=(0,L.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),l.data.plotOffsets=this._plotOffsets}this.ownerSource()&&(l.ownerSource=null===(i=this.ownerSource())||void 0===i?void 0:i.id());for(let e=0;e=0?e:0}}if(null===(s=l.state)||void 0===s?void 0:s.inputs){const e=l.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete l.state.inputs[e.id],delete l.state.inputs.__log_level,delete l.state.inputs.__profile}const u=this.stateCustomFields();var c;return u&&(l.customFields=u),t&&(c=l).metaInfo&&c.metaInfo.scriptIdPart&&c.metaInfo.scriptIdPart.startsWith("USER;")&&(function(e){if(!e.metaInfo)return;const t=e.metaInfo.scriptIdPart;if(!t)return;const i=t.split(";")[0],s=e.metaInfo;s.id=(s.id||"").replace(t,i),s.fullId=(s.fullId||"").replace(t,i),s.name=(s.name||"").replace(t,i),s.shortId=(s.shortId||"").replace(t,i),s.scriptIdPart=(s.scriptIdPart||"").replace(t,i),e.state&&(e.state.id=(e.state.id||"").replace(t,i),e.state.name=(e.state.name||"").replace(t,i),e.state.scriptIdPart=(e.state.scriptIdPart||"").replace(t,i))}(c),function(e){const t=(e.metaInfo&&e.metaInfo.inputs||[]).find((e=>"ILScript"===e.name));t&&(t.defval="",e.state&&e.state.inputs&&(e.state.inputs[t.id]=""), e.metaInfo.defaults.inputs&&(e.metaInfo.defaults.inputs[t.id]=""))}(c)),l}stateCustomFields(){}restoreStateCustomFields(e){}restoreData(e){var t,i;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,L.loadStudyGraphics)(e.graphics):(0,L.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({type:Dt.StudyStatusType.Completed},!0)}hasStateForAlert(){return pe.alertsAvailable&&!this.isFailed()&&!this._metaInfo.isTVLibrary&&(this._hasAlertConditions()||this._hasAvailableAlertPlots()||this._hasAlertFunction())}stateForAlert(){const e=(0,o.ensureNotNull)(this._alertMetaInfo()),t=this._plotsForAlert(),i=this._collectDepsForAlert(),s=i.idForAlert,r=i.studyDependencies,n=i.inputsForAlert,a=(this.priceScale()||this.model().mainSeries().priceScale()).formatter(),l=a?p.FormattersSerializer.serialize(a):null,d={id:s,uniqueId:s,type:(0,o.ensureNotNull)(window.TradingView.className(this.constructor)),title:(0,u.clean)(this._title(Q.TitleDisplayTarget.StatusLine,!1,{},!1),!0),shortTitle:(0,u.clean)(this._title(Q.TitleDisplayTarget.StatusLine,!0,{},!1),!0),shortDescription:(0,u.clean)(e.shortDescription||"Study",!0),fullId:e.fullId,isTVScript:Boolean(e.isTVScript),isTVScriptStrategy:Boolean(e.isTVScriptStrategy),isTVLibrary:Boolean(e.isTVLibrary),hasAlertFunction:Boolean(e.hasAlertFunction),plots:t,inputs:n,alerts:e.alerts,scriptIdPart:e.scriptIdPart,scriptVersion:e.pine?e.pine.version:"-1",callStudyDependencies:(0,c.formatCallstudyArg)(this._dependenciesForAlerts()),studyDependencies:r,formatter:l},h=y(this);h&&(d.dangerReason=h);const _=e.defaultStrategyAlertMessage;return _&&(d.defaultStrategyAlertMessage=(0,u.clean)(_,!0)),d}idForAlert(){return this._collectDepsForAlert().idForAlert}hasBarColorer(){return(0,o.ensureNotNull)(this._metaInfo).plots.some(H.isBarColorerPlot)}barColorer(){const e=this._metaInfo.plots;let t=null;for(let i=0;i"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||ye.enabled("stop_study_on_restart"))&&this.stop(),setTimeout(this.start.bind(this),0)}stop(e,t){if(!0===e&&this._children)for(const e of this._children)e.stop(!0);this._stopStudyOnServer(),this.clearData(),this._unsubscribeToSessionId(),this.recalculate()}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._studyId}parentSources(){return this._sources}symbolSource(){return this._firstSourceOrSeries().symbolSource()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources[0]:super.ownerSource()}isChildStudy(){return this._sources.length>0}hasChildren(){ return this._children.length>0}isStarted(){return Boolean(this._studyId)}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){var e,t,i;const s=this._properties.childs();if(this._model.collapsed().value()||!s.visible.value()||!this.isActualInterval())return!1;const r=this.metaInfo();if(r.plots.length>0)for(let e=0;ee.isHibernated())).map((e=>e.start())));const r=!(this.isHibernationAllowed()&&!this.isVisible())||!0===t;if(this._chartApi&&this._chartApi.isConnected().value()&&r)try{await this._allSymbolsAreResolved(),await this._startAfterSymbolsResolved(e,t)}catch(e){const t=`ERROR: ${this._debugId()} start failed, ${e}`;Zt.logError(t),this._restarting=!1,"TooManyStudies"===(null==e?void 0:e.cause)&&(0,x.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}}replaceData(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(i,t)}inputs(e){const t=(0,n.default)((0,Y.clone)(ei),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);const i=(0,r.default)(this._buildInputs(t));return t.patchSosInputs&&V.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i}data(){return this._data}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this.data().move(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo}status(){var e;return null!==(e=this._recompilationStatus)&&void 0!==e?e:this._status}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleStrCache[n])return this._titleStrCache[n];if(this._titleInPartsCache[n])return this._joinTitlesParts(this._titleInPartsCache[n]);const o=this._title(e,t,i,s,r);return this._titleStrCache[n]=o,o}titleInParts(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n] ;const o=this._titleInParts(e,t,i,s,r);return this._titleInPartsCache[n]=o,o}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e))),"data-source-change"===e.type&&e.sourceId===this.id()&&e.clearData&&this._children.forEach((e=>e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0})))}removeByRemoveAllStudies(){return!0}getStudyName(){return this._studyName}nearestIndex(e,t,i){var s;return null===(s=this.data().search(e,t,i))||void 0===s?void 0:s.index}getMinFirstBarIndexForPlot(e){var t,i,s,r,n,o,a,l,d,h,u,c,_,p,f ;const m=this._properties.childs(),v=this._metaInfo,g=null!==(f=null!==(c=null!==(d=null!==(o=null!==(s=null===(i=null===(t=m.styles.childs()[e])||void 0===t?void 0:t.child("showLast"))||void 0===i?void 0:i.value())&&void 0!==s?s:null===(n=null===(r=m.filledAreasStyle.childs()[e])||void 0===r?void 0:r.child("showLast"))||void 0===n?void 0:n.value())&&void 0!==o?o:null===(l=null===(a=v.styles)||void 0===a?void 0:a[e])||void 0===l?void 0:l.showLast)&&void 0!==d?d:null===(u=null===(h=m.ohlcPlots.childs()[e])||void 0===h?void 0:h.child("showLast"))||void 0===u?void 0:u.value())&&void 0!==c?c:null===(p=null===(_=v.ohlcPlots)||void 0===_?void 0:_[e])||void 0===p?void 0:p.showLast)&&void 0!==f?f:null;if(null===g)return-1/0;const y=this.data().lastIndex();return null===y?-1/0:y-g+1}guiPlotName(e,t){var i,s,r;return null!==(r=null===(s=null===(i=this._metaInfo.styles)||void 0===i?void 0:i[t])||void 0===s?void 0:s.title)&&void 0!==r?r:this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&V.StudyMetaInfo.isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}hasPendingUnresolvedSymbols(){return this._pendingResolveSymbols.size>0}hasSymbolInputs(){return this._metaInfo.inputs.some((e=>"symbol"===e.type))}currency(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().unit():null}canOverrideMinTick(){return!1}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,G.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new F(this,this.model())}statusProvider(e){return new j.StudyStatusProvider(this,this._model.properties().childs().scalesProperties.childs().textColor)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){ return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&z.hideAllIndicators().value()}paneViews(e){if(this.isSourceHidden()||!e.hasPriceDataSource(this))return null;const t=[];return!this._startMovingPoint&&this._wasCompletedBefore&&t.push(...this._paneViews),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&t.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&t.push(this._inputsAnchorsPaneView),t}labelPaneViews(){return this.isSourceHidden()?null:this._labelPaneViews}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){const i=this._properties.childs().oldShowLastValue;if(i&&!i.value())return null;let s=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(s=s.concat(this._inputsPriceAxisPaneViews)),e.findTargetPriceAxisViews(this,t,s,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,Lt.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof L.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,Lt.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.forEach((e=>{e.processHibernate()})),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every((e=>e.isHibernationAllowed())))}isPlotVisibleAt(e,t){let i;const s=this.metaInfo().plots.find((t=>t.id===e));if(i=void 0!==s?(0,H.isOhlcPlot)(s)?this._properties.childs().ohlcPlots.childs()[s.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===i)throw new Error(`Study does not contain ${e} plot`);const r=i.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,Lt.sourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){return this._maxOffset}onStart(){return this._onStart} onParentSourcesChanges(){return this._onParentSourcesChanges}isHibernated(){return!this.isVisible()&&!this.isStarted()}graphicsViewsReady(){return this._graphicsViewsReady}setRecompilationActive(e){var t;e!==Boolean(this._recompilationStatus)&&(this._recompilationStatus=e?{type:Dt.StudyStatusType.Loading,startTime:Date.now()}:null,null===(t=this._statusView)||void 0===t||t.update(),this._model.updateSource(this),this._statusChanged.fire(this.status()))}turnaround(e){if(!e)return this._turnaround;return function(e,t){let i=t.turnaround,s=[t];for(;s.length>0;){let e=[];const t=[];s.forEach((i=>{const s=ve(i.sourceStudies).sort(me);if(s.length>0){e=e.concat(s);const i=s.map((e=>e.turnaround)).join("_");t.push(i)}})),t.length&&(i=t.join("_")+"_"+i),s=e}return e+"_"+i}(this._series.seriesSource().turnaround(),ge(this))}canHaveChildren(){var e;return this._canHaveChildren=null!==(e=this._canHaveChildren)&&void 0!==e?e:V.StudyMetaInfo.canHaveChildren(this._metaInfo),this._canHaveChildren}setChild(e){-1===this._children.indexOf(e)&&this._children.push(e)}unsetChild(e){const t=this._children.indexOf(e);~t&&this._children.splice(t,1)}getAllChildren(){const e=this._children.slice();for(let t=0;te.id()===i)))&&void 0!==t?t:null}return this._series}priceStep(){return this._priceStep||this._firstSourceOrSeries().priceStep(!1)}recreatePriceFormatter(){this._recreatePriceFormattingDependencies()}setOwnerSource(e){super.setOwnerSource(e),this._recreatePriceFormattingDependencies()}onTagsChanged(){return this._tagsChanged}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return!1;const e=this._getStudyIdWithLatestVersion();this._studyId=(0,q.makeNextStudyId)(),this._incrementTurnaround(),this._studyName=e;const t=(0,Y.clone)((0,o.ensureDefined)(this._inputs));let i;if(V.StudyMetaInfo.patchSoSInputs(t,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i=this._chartApi.createStudy(this._studyId,this._turnaround,(0,o.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName,t,this._handler,this._studySpec()),!i)return this._studyId=null,i;if(void 0===this._oldStudyInputs){if(this._metaInfo.TVScriptMetaInfoExprs){this._previousPatchMap={};const e=this._metaInfo.TVScriptMetaInfoExprs.patchMap;(0, b.iterateAndPatchObjectsByMap)([this._properties,this._metaInfo.defaults,this._metaInfo],e,((e,t,i)=>{const s=e[0],r=e[1],n=e[2];r.hasOwnProperty(t)?(0,o.ensureDefined)(this._previousPatchMap)[i]=s[t].value():(0,o.ensureDefined)(this._previousPatchMap)[i]=n[t]}))}const e=this._prepareInputs(ti);Object.keys(e).some((e=>(0,m.isStudyInputDependsOnChart)({id:e})))||(this._oldStudyInputs=e)}return this._deferredPinePatchProps&&!this._restarting&&this._pinePatchProps(),!0}_stopStudyOnServer(){this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy((0,o.ensureNotNull)(this._studyId)),this._setStatus({type:Dt.StudyStatusType.Undefined})),this._studyId=null}_modifyStudyOnServer(e,t){const i=(0,Y.clone)((0,o.ensureDefined)(e));V.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),this._chartApi.modifyStudy((0,o.ensureNotNull)(this._studyId),this._turnaround,i,this._handler,t)}_transformData(e){}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){const e=[this,...this._getAllOwnerSources().filter((e=>e instanceof Pi))];return(0,S.collectDepsForAlert)(e)}_allInputsAreValid(){var e;if(null===(null===(e=this._visibleTimeRangeInputs)||void 0===e?void 0:e.value()))return!1;for(const e of this._metaInfo.inputs)if("bar_time"===e.type){const t=e.id;if(null==this._properties.childs().inputs.childs()[t].value())return!1}return!0}async _startAfterSymbolsResolved(e,t){await Promise.all(this._sources.map((e=>!e.isStarted()||e.isRestarting()?new Promise((t=>{e.onStart().subscribe(this,t,!0)})):Promise.resolve()))),this.isStarted()&&!this._restarting||(this._restarting=!1,this._allInputsAreValid()&&!this.metaInfo().isTVScriptStub&&(this._inputs=this._apiInputs(),this._createStudyOnServer()&&(this._subscribeToSessionId(),this._onStart.fire(),!0===e&&this._children&&await this._children.map((e=>e.start(!0,t))))))}async _changeInputsImpl(e,t){const s=this._calcSources(),r=Si(this._metaInfo,e,t),n=()=>{for(const i of this._metaInfo.inputs){if("source"!==i.type)continue;const s=e[i.id].v,r=t[i.id].v;if(s!==r){(0,o.ensureDefined)(this._properties.childs().inputs.child(i.id)).setValue(r)}}};if(this.isStarted()&&this._chartApi.isConnected().value()&&r>0&&!this._chartApi.canCreateStudy(this._studySpec(!0),!0).success){const e=window.user.pro_plan;return(0,w.createGoProDialog)({feature:"studyOnStudy",actions:e&&e===I.ExpertPlans.PremiumExpert?[{text:l.t(null,void 0,i(875139)),action:C.PredefinedAction.Close}]:void 0}),void n()}this._inputs=e;let a=!1;const d=Object.values(m.RangeDependentStudyInputNames);for(const i of Object.keys(e))if(JSON.stringify(e[i])!==JSON.stringify(t[i])&&!d.includes(i)){a=!0;break}this._incrementTurnaround(),a&&this.disablePriceRangeReady();try{await this._updateParentSources(s,r,!0),this._modifyStudyOnServer(e,r),this._studyModified=!0}catch(e){Zt.logError(`Error applying parent sources: ${e}`),n()}this.invalidateTitleCache()} _createPriceAxisView(e){return new Et.StudyPriceAxisView(this,{plotIndex:e})}_createPriceLineAxisView(e){return new Ot.StudyPriceLineAxisView(this,e)}_createStudyPlotPaneView(e){return new pt.StudyPlotPaneView(this,this._series,this._model,e)}_createViews(){var e,t,i,s;this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._paneViews=[],this._labelPaneViews=[];const r=new Set,n=this.metaInfo(),a=Boolean(n.usePlotsZOrder),l=new Map,d=this._properties.childs();if(d.filledAreasStyle&&n.filledAreas)for(let e=0;e{const i=d.bands.childs()[t];if(i&&i.childs().visible.value()){const t=new xt(i,this),s=a?(0,o.ensureDefined)(e.zorder):l.size;li(s,l),l.set(s,{paneViews:[t]})}})),d.bandsBackground&&((0,o.assert)(!a,"'usePlotsZOrder' flag does not supported"),l.set(l.size,{paneViews:[new Rt(this)]}));const h=this._paneViews;this._createGraphicsPaneViews().then((e=>{for(let t=0;te-t));for(let e=0;e0){const t=(0,o.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,Lt.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null!=s?s:void 0,nonSeriesOnly:0===e.length})),this._updateSources()}_titleInputs(e,t,i){return this.inputs(this._titleInputsOptions(e,t,i))}_titleInputsOptions(e,t,i){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],skippedInputs:this._skippedTitleInputs(),noExchanges:t,noResolution:i,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:si,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,L.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,L.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){this._recreatePlotsFormatters(e),this._formatter=this._tryCreateFormatter(e),this._formatterChanged.fire();const t=this.priceScale();null!==t&&t.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,i,s,r){const n=this._titleInParts(e,t,i,s,r);return this._joinTitlesParts(n)}_postProcessPriceRange(e){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new D.PriceRange(e.minValue()-t,e.maxValue()+t)}const t=this.priceScale() ;return t&&t.isLog()&&e?new D.PriceRange(t.priceToLogical(e.minValue()),t.priceToLogical(e.maxValue())):e}_titleInParts(e,t,s,r,n){var a;const d=this.name(t);s=s||{};const h=[l.t(d,{context:"study"},i(168716))];let u=[];if(!r){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&h.push(i);const r=this.metaInfo(),l=this._titleInputs(e,n,!0),d=r.inputs.filter((e=>l.hasOwnProperty(e.id))).map((e=>({meta:e,value:l[e.id]})));if(d.length>0){const i={};if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(h);if(s instanceof Pi){const r=s.metaInfo(),o=s.title(e,t,{},!0,n);if(1===r.plots.length)i[h]=o;else{const e=h.split("$")[1],t=null===(a=r.plots[parseInt(e)])||void 0===a?void 0:a.id,s=r.styles&&r.styles[t],n=s&&s.title||t;i[h]=o+": "+n}}}}u=d.map((({meta:e,value:t})=>{if("time"===e.type)return new Date(t).toISOString();let r=(0,Y.isNumber)(t)?this._numericFormatter.format(t):i&&i[t.toString()]||t.toString();return s&&s[r.toString()]&&(r=s[r.toString()]),r}))}}return[h.join(" · "),u]}_seriesDataRangeToSave(e){return this._model.timeScale().visibleExtendedDataRange(e,0)}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_getSymbolForApi(e){return e}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){{const e=(0,o.ensureNotNull)(this._model.alertsWatcher());e.syncSourceAlertLabels(this);const t=this.getAllChildren();for(const i of t)e.syncSourceAlertLabels(i)}this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){var i;const s=this.isFailed();this._status=e,e.type===Dt.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==Dt.StudyStatusType.Error&&e.type!==Dt.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(this.status())),s!==this.isFailed()&&this._updateAlertCreationAvailable()}_onPropertiesChanged(){this._restarting||(this._inputs?this._tryChangeInputs():this._chartApi&&this._chartApi.isConnected().value()&&this.restart()),this._metaInfo.isTVScript&&this._metaInfo.TVScriptMetaInfoExprs&&(this._restarting?this._deferredPinePatchProps=!0:this._pinePatchProps()),this._recreatePaneViews(),(0,Wt.emit)("study_properties_changed",this._id)}_lastNonEmptyPlotRow(e){var t;if(!(0,Y.isInteger)(e))return Zt.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let i=null!==(t=this._lastNonEmptyPlotRowCache[e])&&void 0!==t?t:null;if(null!==i)return i;return i=this.data().findLast(((t,i)=>void 0!==i[e]),1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)} _onCurrencyChanged(){"alwaysOff"!==(0,Nt.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_apiInputs(){return this.inputs({keepOptionalSymbolsEmpty:!0})}async _tryChangeInputs(){const e=this.isStarted()&&this._chartApi.isConnected().value(),t=this._allInputsAreValid(),i=(0,o.ensureDefined)((0,Y.clone)(this._inputs)),s=this._apiInputs(),r=JSON.stringify(s),n=r!==JSON.stringify(this._inputs);if(e&&t)try{if(await this._allSymbolsAreResolved(),r!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(n&&this.disablePriceRangeReady());n&&(await this._changeInputsImpl(s,(0,o.ensureDefined)((0,Y.clone)(this._inputs))),(0,o.ensureNotNull)(this.model().alertsWatcher()).syncSourceAlertLabels(this))}catch(e){Zt.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(e&&!t&&this.stop(!0),!e&&t&&this.start(!0),n){const e=this._calcSources(),t=Si(this._metaInfo,s,i);this._updateParentSources(e,t,!0),this._inputs=s}this._tagsChanged.fire()}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_fillPrecalculatedAutoscaleInfo(e,t){const i=this._metaInfo,s=this.properties().childs(),r=new Set,n=this._metaInfo.filledAreas||[];for(let e=0;e!(0,H.isPlotWithTechnicalValues)(e))).filter((e=>r.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){var e;return null!==(e=this._sources[0])&&void 0!==e?e:this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return Ii(this._metaInfo.format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this.data().merge(e)}_skippedTitleInputs(){return this._hideMatches.filter((e=>e.plotIds.every((e=>0===this._getPlotDisplayValue(e))))).map((e=>e.id))}_getPlotDisplayValue(e){var t,i,s,r,n,o,a;return null===(a=null===(o=null===(n=null===(r=null===(s=null===(i=null===(t=this.properties())||void 0===t?void 0:t.childs())||void 0===i?void 0:i.styles)||void 0===s?void 0:s.childs())||void 0===r?void 0:r[e])||void 0===n?void 0:n.childs())||void 0===o?void 0:o.display)||void 0===a?void 0:a.value()}_incrementTurnaround(){this._turnaround="st"+ ++this._turnaroundCounter}_checkTurnaround(e){return e===this._turnaround||e===this._model.mainSeries().seriesSource().turnaround()||e===this.turnaround(!0)}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){ if(this._series.bars().size()>=e){const t=(0,o.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,o.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(){var e;this._setStatus({type:Dt.StudyStatusType.Loading,startTime:Date.now()}),null===(e=this._statusView)||void 0===e||e.update(),this._model.updateSource(this)}_handleStudyError(e){var t,i,s;this.clearData(),this._setStatus(e);{const s=(0,Dt.convertStudyStatusToString)(e),r=this._getTelemetryAdditionalData(),n=s.indexOf("Command info");r.reason=n>=0?s.slice(0,n).trim():s;if(!/study in error state|the data vendor doesn\'t provide volume data for this symbol.|error in series|unsupported resolution/gi.test(null!==(i=null===(t=r.reason)||void 0===t?void 0:t.toLowerCase())&&void 0!==i?i:"")){const e=this._getTelemetryObjectName();this._sendTelemetryCounter(e+"_error",r)}}null===(s=this._statusView)||void 0===s||s.update(),this._model.updateSource(this)}_onStudyError(e){this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_createStudyError(e){var t;return wi("string"==typeof e?{error:this._getStudyErrorText(e)}:e,null===(t=this.symbolSource().symbolInfo())||void 0===t?void 0:t.exchange)}_onStudyCompleted(e){var t;this._studyModified&&(this.clearData(),this._studyModified=!1),this._sendTelemetryCounter(this._getTelemetryObjectName()+"_loaded"),this._setStatus({type:Dt.StudyStatusType.Completed}),null===(t=this._statusView)||void 0===t||t.update();const i=this._model.paneForSource(this);this._model.recalculatePane(i,(0,Lt.sourceChangeEvent)(this.id())),this._updateSources();const s=Vt.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_updateSources(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_recreatePriceStep(){var e;let t=null;const i=null!==(e=this._priceScaleByProperties())&&void 0!==e?e:this._priceScaleByMetaInfo();null!==i&&(t=1/i),this._priceStep!==t&&(this._priceStep=t,this._priceStepChanged.fire())}_recreatePlotsFormatters(e){var t,i;this._plotFormatters.clear();const s=this._metaInfo.format,r=this._priceScaleByProperties(),n=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,i]of Object.entries(null!==(t=this._metaInfo.ohlcPlots)&&void 0!==t?t:{}))if(null==i?void 0:i.format){const t=Ii(Ci({...s,...null==i?void 0:i.format}),r,n,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const[e,t]of Object.entries(null!==(i=this._metaInfo.styles)&&void 0!==i?i:{}))if(null==t?void 0:t.format){const i=Ii(Ci({...s,...null==t?void 0:t.format}),r,n,this.properties().childs().precision.value());i&&this._plotFormatters.set(e,i)} for(const e of this._metaInfo.plots)if((0,H.isOhlcPlot)(e)){const t=this._plotFormatters.get(e.target);t&&this._plotFormatters.set(e.id,t)}}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;ts),(()=>s)).then(this._onDataUnpacked.bind(this,e,t.indexes,i)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let i=!1;for(const s of e){const e=this._getSymbolForResolve(s);if(""!==e)if(this._resolvedSymbols[e])i=!0;else{const i=this._resolveSymbol(e,s);t.push(i)}}if(0===t.length){const e=Promise.resolve();return i?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:Dt.StudyStatusType.Error,errorDescription:{error:Jt}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise(((i,s)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,q.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:Dt.StudyStatusType.Undefined});const s=r.params[1];this._resolvedSymbols[e]=s,this._resolvedSymbolsByInput[t]=s,this._onSymbolResolved(e,t,s),this.invalidateTitleCache(!0),i();break}case"symbol_error":if(this._setStatus({type:Dt.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===$.permissionDenied&&r.params[2]){if(r.params[2]!==$.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(i);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i)}this._sendTelemetryCounter("symbol_error",Object.assign(this._getTelemetryAdditionalData(),{symbol:e,reason:r.params[1]})),s(t)}}))})),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach((e=>{e.ownerSource()===this&&e.calcIsActualSymbol()}))}_sendTelemetryCounter(e,t){void 0===t&&(t=this._getTelemetryAdditionalData());const i={count:1,additional:t};ce.telemetry.sendChartReport(e,i)}_getTelemetryAdditionalData(){let e="";return this._metaInfo.pine&&this._metaInfo.pine.version&&this._metaInfo.shortId.indexOf("USER")>=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_onSourceFormatterChanged(){ null===this._formatter&&(null!==this._priceScale&&this._priceScale.updateFormatter(),this._formatterChanged.fire())}_onSourcePriceStepChanged(){null===this._priceStep&&this._priceStepChanged.fire()}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;i=0?t:e}return e}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===o)return null!==(n=null===(r=this._metaInfo.defaults.inputs)||void 0===r?void 0:r.text)&&void 0!==n?n:"";if("pineId"===o)return this._metaInfo.scriptIdPart;if("pineVersion"===o)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){const e=a.inputs.childs()[o].value();return(0,T.colorToInteger)(e)}if("price"===e.type){const e=a.inputs.childs()[o].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return a.inputs.childs()[o].value()}_getAllOwnerSources(){ return bi(this).reverse().slice(1)}_getStudyIdWithLatestVersion(){return V.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){if(null===this._alertMetaInfo())return!1;const e=this.stateForAlert(),t=_.alertBandFactory.create(e).getPlots();return null!=t&&t.length>0}_hasAlertConditions(){const e=this._alertMetaInfo();if(null===e)return!1;if(e.plots.some(H.isAlertConditionPlot))return!0;const t=this.stateForAlert();return Boolean(t.alerts&&t.alerts.conditions)}_hasAlertFunction(){const e=this._alertMetaInfo();return Boolean(null!==e&&e.hasAlertFunction)}async _updateParentSources(e,t,i){if(this._sources.forEach((e=>e.unsetChild(this))),i&&await Promise.all(e.map((e=>e.isStarted()?Promise.resolve():e.start(!1,!0)))),e.forEach((e=>e.setChild(this))),this._setSources(e),this._recreatePriceFormattingDependencies(),0!==t&&this._sources.length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,i=(0,o.ensureNotNull)(e.priceScale());if(t!==i){const t=this._model.paneForSource(this),s=(0,o.ensureNotNull)(this._model.paneForSource(e));t===s&&s.move(this,i,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return V.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e).map((e=>{if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;{const t=this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e));return null!=t?t:null}})).filter(Y.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i,s){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(s),this._transformData(e);const r=this._mergeData(e);null!==s&&(s.indexes_replace?((0,o.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==s.graphicsCmds&&this._graphics.processCommands(s.graphicsCmds))),this._onDataUpdated(e,s,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady(),this._dataUpdated.fire(i,!1,r)}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets;this._plotOffsets=e&&e.offsets||{},(0,s.default)(t,this._plotOffsets)||this.updateAllViews((0,Lt.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){var r,n,a;const l=s.id,d=this._properties.childs().styles.childs()[l],h=(0,H.isShapesPlot)(s)||(0,H.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,H.isArrowsPlot)(s);let u=(0,H.isLinePlot)(s)||(0,H.isOhlcPlot)(s);if(h){const e=(0,o.ensureDefined)(d).childs().location.value(),t=[B.MarkLocation.Absolute,B.MarkLocation.Top,B.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||h&&t,u=u||e===B.MarkLocation.Absolute}if(!u)return i;const c={name:l,offset:this.offset(l)},_=d.childs().plottype.value() ;if(!this._skipHistogramBaseOnAutoScale()&&[H.LineStudyPlotStyle.Histogram,H.LineStudyPlotStyle.Columns,H.LineStudyPlotStyle.Area].indexOf(_)>=0){const s=null===(a=null===(n=null!==(r=this._metaInfo.styles)&&void 0!==r?r:{})||void 0===n?void 0:n[l])||void 0===a?void 0:a.histogramBase;if(void 0===s)return i;const o=this.data().minMaxOnRangeCached(e,t,[c]);return(0,Y.isNumber)(s)&&null!==o&&(i.baseValueMinMax=(0,A.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,A.mergeMinMax)(i.baseValueMinMax,o)),i}return i.fields.push(c),i}async _onSourceInputChanged(){if(!this.isStarted()){const e=this._calcSources();{const t=1===e.length&&e[0]!==this._sources[0]?1:0;this._updateParentSources(e,t,!1)}}}_buildInputs(e){(0,o.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){Zt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((i=>{null!=t[i]&&(e[i]=t[i])})),e}{const e=[];return Object.keys(t).forEach((i=>{null!=t[i]&&e.push(t[i])})),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return(0,S.plotsForAlert)(this.metaInfo(),this.offset.bind(this))}_dependenciesForAlerts(){const e=this._getAllOwnerSources().filter((e=>e instanceof Pi));return(0,S.dependenciesForAlerts)(e,(0,Qt.studyMetaInfoRepository)())}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,At.isActualInterval)(this._series.intervalObj(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this._sources;for(const t of e)if(t instanceof Pi){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const i=this._properties.childs().inputs.childs();if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){const e=(0,m.editableStudyInputs)(this._metaInfo.inputs);if(0===e.length)return;const t={convertPriceToCoordinate:e=>{const t=this.priceScale();if(null!==t&&!t.isEmpty()){const i=this.firstValue();if(null!==i)return t.priceToCoordinate(e,i)}return null},formatPrice:e=>{const t=this.priceScale();if(null!==t&&!t.isEmpty()){const i=this.firstValue();if(null!==i)return t.formatPrice(e,i)}return""},getInputValue:e=>{var t,i;return null!==(i=null===(t=this._properties.childs().inputs.child(e))||void 0===t?void 0:t.value())&&void 0!==i?i:null},isSelected:()=>this._model.selection().isSelected(this),isHovered:()=>this===this._model.hoveredSource()};Promise.all([i.e(62183).then(i.bind(i,781929)),i.e(62183).then(i.bind(i,141361)),i.e(62183).then(i.bind(i,286125)),i.e(62183).then(i.bind(i,180861))]).then((i=>{const[s,r,n,o]=i ;this._inputsAnchorsPaneView=new s.StudyInputsAnchorsPaneView(e,this._model,t);const a=e.filter((e=>!Array.isArray(e)));this._inputsLinesPaneView=new r.StudyInputsLinesPaneView(a,this._model,t);let l=!1;e.forEach((e=>{if(Array.isArray(e)){const i="time"===e[0].type?e[0]:e[1],s="price"===e[0].type?e[0]:e[1];this._inputsTimeAxisPaneViews.push(new n.StudyInputTimeAxisPaneView(i,this._model,t.getInputValue)),this._inputsPriceAxisPaneViews.push(new o.StudyInputPriceAxisPaneView(s,t)),l=!0}else"time"===e.type?this._inputsTimeAxisPaneViews.push(new n.StudyInputTimeAxisPaneView(e,this._model,t.getInputValue)):(this._inputsPriceAxisPaneViews.push(new o.StudyInputPriceAxisPaneView(e,t)),l=!0)})),l&&this.formatterChanged().subscribe(this,this.invalidateTitleCache)}))}_updateCurrencySourceSymbolInfo(){}_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find((e=>e.id===s)),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.childs().inputs.childs()[s];void 0!==e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}_recreatePaneViews(){this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this._createViews(),this.recalculate(),this.updateAllViews((0,Lt.sourceChangeEvent)(this.id()))}_pinePatchProps(){this._deferredPinePatchProps=!1;const e=this._prepareInputs(ti);if(!this._areStudyInputsModified(e))return;this._oldStudyInputs=e;const t=(0,b.patchPropertiesAsync)(this._properties,this._metaInfo,e,this._previousPatchMap),i=this._allSymbolsAreResolved(),s=this._propertiesPatched=new Promise((e=>{const r=()=>{s===this._propertiesPatched?e():this._propertiesPatched.then(e)};Promise.all([t,i]).then((()=>{r(),this._isDestroyed||(this._createViews(),this.recalculate(),this.updateAllViews((0,Lt.sourceChangeEvent)(this.id())),this.invalidateTitleCache())})).catch((e=>{r(),Zt.logError(`ERROR: ${this._debugId()} pine inputs patching failed, reason: ${e}`)}))}))}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,o.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const i of t)if((0,o.assert)(e.hasOwnProperty(i),`key '${i}' should exist in study inputs`),(0,o.ensureDefined)(this._oldStudyInputs)[i]!==e[i])return!0;return!1}_onVisibleTimeRangeInputsChanged(e){null!==e?this._updateVisibleTimeRangeInputs(e):this.isStarted()&&this._chartApi.isConnected().value()&&this.stop(!0)}_updateVisibleTimeRangeInputs(e,t=!0){const i={first_visible_bar_time:e.firstVisibleBarTime,last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},s=this.metaInfo().inputs,r=[];for(const e of s)i.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(i[e]) ;t&&r.length>0&&n.listeners().fire(n,"")}_getStudyErrorText(e){var t;switch(null===(t=e.match(/^study_not_auth:(.*)?@.*/))||void 0===t?void 0:t[1]){case"Script":case"StrategyScript":return"This script is invite-only. To request access, please contact its author.";case"VbPSessions":case"VbPPeriodic":case"VbPVisible":return"Volume Profile indicator available only on our upgraded plans."}return e.split(":",2)[0]}_priceScaleByProperties(){if("default"===this.properties().childs().precision.value())return null;const e=parseInt(this.properties().childs().precision.value());return isFinite(e)?Math.pow(10,e):null}_priceScaleByMetaInfo(){const e=this.metaInfo().format,t="inherit"!==e.type?e.precision:void 0,i=(0,Y.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return i||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,Y.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||Zt.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,o.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_studySpec(e){return{id:this._metaInfo.id,child:null!=e?e:this.isChildStudy(),fundamental:(0,_e.isFundamentalStudyMetaInfo)(this._metaInfo)}}_precisionChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources=e,this._onParentSourcesChanges.fire()}}window.TradingView.Study=Pi},466144:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(444372);const r={shape_arrow_down:{guiName:s.t(null,void 0,i(348732)),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:s.t(null,void 0,i(610650)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:s.t(null,void 0,i(490068)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:s.t(null,void 0,i(429908)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:s.t(null,void 0,i(773720)),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:s.t(null,void 0,i(121524)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:s.t(null,void 0,i(318528)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:s.t(null,void 0,i(513046)),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:s.t(null,void 0,i(944904)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:s.t(null,void 0,i(483356)), id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:s.t(null,void 0,i(928340)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:s.t(null,void 0,i(707050)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},682541:(e,t,i)=>{"use strict";var s=i(650151).ensureNotNull,r=i(86441).Point,n=i(535698).TextRenderer,o=i(772466).NonSeriesStudy,a=i(541801).TrendLineRenderer,l=i(315801).HitTestResult,d=i(315801).HitTarget,h=i(142119).CompositeRenderer,u=i(246733),c=i(855152).LineEnd,_=i(422333).CHART_FONT_FAMILY;const{LINESTYLE_SOLID:p,LINESTYLE_DASHED:f}=i(458963);class m{constructor(e,t){this._model=e,this._source=t,this._waves=[],this._highlights=[],this._retracements=[],this._invalidated=!0}update(){this._invalidated=!0}updateImpl(){if(this._waves=[],this._highlights=[],this._retracements=[],this._source.customData()&&this._source.properties().visible.value()){var e=this._source.customData().waves,t=this._source._indexes,i=this._model.timeScale(),n=this._source.priceScale(),o=this._model.mainSeries(),a=o.firstBar();if(n&&!n.isEmpty()&&!i.isEmpty()&&a&&e){for(var l=i.visibleBarsStrictRange(),d=l.lastBar(),h=l.firstBar(),u=["m0StartIndex","startIndex","endIndex","m2EndIndex","m3EndIndex"],c=o.firstValue(),_=0;_d||v[v.length-1]{"use strict";var s=i(588840).OverlayLegendValuesProvider,r=i(768204).OverlayStatusProvider,n=i(981098).StudyOverlayBase;t.study_Overlay=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._paneView=null;var r=this;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()}))}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}tags(){var e=[],t=this.symbolInfo();return t?e.push(t.name):this._properties.inputs.symbol.value()&&e.push(this._properties.inputs.symbol.value()),e}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(88601),i.e(96461),i.e(76169),i.e(97732),i.e(30154),i.e(82375),i.e(47924),i.e(60607)]).then(i.bind(i,811173))).StudyOverlayDefinitionsViewModel}defaultPlotIdForAlert(){return""}valuesProvider(){return new s(this,this.model())}statusProvider(e){return new r(this,this.model())}}},894718:(e,t,i)=>{"use strict";var s=i(772466).NonSeriesStudy,r=i(315801).HitTestResult,n=i(315801).HitTarget,o=i(142119).CompositeRenderer,a=i(710455).MediaCoordinatesPaneRenderer,l=i(422333);class d extends a{constructor(e,t){super(),this._data=e,this._textCache=t}_drawImpl(e){var t=e.context;t.textBaseline="bottom",t.font=(this._data.bold?"bold ":"normal ")+this._data.fontsize+"px "+this._data.font;var i=Math.round(t.measureText(this._data.text).width+4);this._textCache.width=i,t.translate(this._data.x+.5,this._data.y),t.strokeStyle=this._data.borderColor,t.fillStyle=this._data.backColor,t.beginPath(),t.moveTo(0,0),1===this._data.type?(t.lineTo(5,-5),t.lineTo(i/2,-5),t.lineTo(i/2,-5-this._data.fontsize),t.lineTo(-i/2,-5-this._data.fontsize),t.lineTo(-i/2,-5),t.lineTo(-5,-5),t.lineTo(0,0)):(t.lineTo(5,5),t.lineTo(i/2,5),t.lineTo(i/2,5+this._data.fontsize),t.lineTo(-i/2,5+this._data.fontsize),t.lineTo(-i/2,5),t.lineTo(-5,5),t.lineTo(0,0)),t.fill(),t.stroke(),t.fillStyle=this._data.textColor,t.textAlign="center",t.textBaseline="middle",1===this._data.type?t.fillText(this._data.text,0,-5-this._data.fontsize/2):t.fillText(this._data.text,0,5+this._data.fontsize/2)}hitTest(e){var t=this._textCache.width,i=this._data.fontsize+15,s=this._data.x-t/2,o=this._data.y;return 1===this._data.type&&(o-=i),e.x>=s&&e.x<=s+t&&e.y>=o&&e.y<=o+i?new r(n.Regular):null}}class h{constructor(e,t){this._model=e,this._source=t,this._pivots=[],this._textCache={},this._invalidated=!0}update(){this._invalidated=!0}updateImpl(){if(this._pivots=[],this._source.customData()&&this._source.customData().pivots&&this._source.properties().visible.value()){var e=this._source.customData().pivots,t=this._source._indexes,i=this._model.timeScale(),s=this._source.priceScale(),r=this._model.mainSeries(),n=r.firstValue() ;if(s&&!s.isEmpty()&&!i.isEmpty()&&n)for(var o=i.visibleBarsStrictRange(),a=o.firstBar(),l=o.lastBar(),d=0;dl)){var u=e[d].type,c=r.bars().valueAt(h);if(null!==c){var _=1===u?c[TradingView.HIGH_PLOT]:c[TradingView.LOW_PLOT],p=Math.round(i.indexToCoordinate(h)),f=s.priceToCoordinate(_,n);1===u?f-=i.barSpacing()/6:f+=i.barSpacing()/6+1,f=Math.round(f),this._pivots.push({x:p,y:f,price:s.formatPrice(_,n),type:u})}}}}}_pixelMargins(){return this._source.properties().fontsize.value()+15}topPixelMargin(){return this._pixelMargins()}bottomPixelMargin(){return this._pixelMargins()}renderer(){if(this._invalidated&&(this.updateImpl(),this._invalidated=!1),0!==this._pivots.length){for(var e=l.CHART_FONT_FAMILY,t=this._source.properties().fontsize.value(),i=this._source.properties().borderColor.value(),s=this._source.properties().backColor.value(),r=this._source.properties().textColor.value(),n=new o,a=0;a0?this._paneViews[0].topPixelMargin():0,bottomPixelMargin:this._paneViews.length>0?this._paneViews[0].bottomPixelMargin():0}}}},738949:(e,t,i)=>{"use strict";var s=i(650151).assert,r=i(389137).clone,n=i(807218).Study,o=i(195447).PlotList,a=i(989709).studyPlotFunctionMap,l=i(989709).studyEmptyPlotValuePredicate;class d{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var d=n+l,h={pointIndex:d,value:a};if(r){if(r.pointIndex!==h.pointIndex){d>=0&&(e.valueAt(d)[t]=a);var u=!1;s&&(u=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),u?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this._data=new o(a(this._metaInfo),l));var i=this._data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this._data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new d(e.strategyIndex,e.targetIndex,i).rebuildData(this._data) }),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},576678:(e,t,i)=>{"use strict";var s=i(86441).Point,r=i(772466).NonSeriesStudy,n=i(541801).TrendLineRenderer,o=i(315801).HitTestResult,a=i(315801).HitTarget,l=i(142119).CompositeRenderer,d=i(855152).LineEnd;const{LINESTYLE_SOLID:h}=i(458963);class u{constructor(e,t){this._model=e,this._source=t,this._pivots=[],this._textCache={},this._invalidated=!0}update(){this._invalidated=!0}updateImpl(){if(this._pivots=[],this._source.customData()&&this._source.customData().zigzag&&this._source.properties().visible.value()){var e=this._source.customData().zigzag,t=this._source._indexes,i=this._model.timeScale(),s=this._source.priceScale(),r=this._model.mainSeries(),n=r.firstValue();if(s&&!s.isEmpty()&&!i.isEmpty()&&n)for(var o=0;o{"use strict";i.d(t,{areEqualSymbols:()=>n,compareSymbolParams:()=>d,symbolParams:()=>l,symbolSameAsCurrent:()=>a});i(244842);var s=i(444331),r=i(223699);function n(e,t){return void 0===e?void 0===t:void 0!==t&&e.toUpperCase()===t.toUpperCase()}function o(e,t){return e.some((e=>n(t,e)))}function a(e,t){if(null===t)return!1;if(t){if(n(t.full_name,e)||n(t.pro_name,e))return!0;if(n(t.ticker,e))return!0;if(t.aliases&&o(t.aliases,e))return!0;if(t.alternatives&&o(t.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&n(t.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}function l(e){return{symbol:e.symbol(),currency:e.currency(),unit:e.unit(),interval:e.interval(),style:e.style()}}function d(e,t,i,n){const{symbol:o,currency:a,unit:l,style:d}=t;let h=t.interval;const u=e.symbolInfo(),c=void 0!==o&&!e.symbolSameAsResolved(o);let _,p,f;if(null!==u?(_=void 0!==a&&!function(e,t){return null===e&&!(0,s.isConvertedToOtherCurrency)(t)||e===(0,s.symbolCurrency)(t)}(a,u),p=void 0!==l&&!function(e,t,i){return null===e&&!(0, s.isConvertedToOtherUnit)(t,i)||e===(0,s.symbolUnit)(t,i)}(l,u,i)):(_=void 0!==a&&a!==e.currency(),p=void 0!==l&&l!==e.unit()),void 0!==h&&!c&&n){const e=n(h);r.Interval.isEqual(e,h)||(h=e,f=h)}return{symbolChanged:c,intervalChanged:void 0!==h&&!r.Interval.isEqual(e.interval(),h),currencyChanged:_,unitChanged:p,styleChanged:void 0!==d&&d!==e.style(),correctedInterval:f,styleChangeRequiresRestart:void 0!==d&&(0,s.styleChangeRequiresRestart)(d,e.style())}}},294162:(e,t,i)=>{"use strict";i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return"actualBoundingBoxAscent"in i&&"actualBoundingBoxDescent"in i?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t);return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},161164:(e,t,i)=>{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(246733),r=i(199471);class n{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=t.font;const n=Math.round(t.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=t.paddingHorizontal,a=n+2*o,l=a/2;let d=s.coordinate,h=Math.floor(d-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(d+=Math.abs(0-h),h=Math.floor(d-l)+.5):h+a>e&&(d-=Math.abs(e-(h+a)),h=Math.floor(d-l)+.5)}const u=h+a,c=Math.ceil(0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const _=Math.round(h*i),p=Math.round(0*i),f=Math.round(u*i),m=Math.round(c*i),v=Math.round(2*i);e.beginPath(),e.moveTo(_,p),e.lineTo(_,m-v),e.arcTo(_,m,_+v,m,v),e.lineTo(f-v,m),e.arcTo(f,m,f,m-v,v),e.lineTo(f,p),e.fill();const g=0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const y=t.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*i,(g+y)*i),(0,r.drawScaled)(e,i,i,(()=>e.fillText(s.text,0,0))),e.restore()}}class o{constructor(e){this._renderer=new n,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate} _getAlwaysInViewPort(){return!0}_getText(e){const t=this._model.timeScale().indexToUserTime(e);return null!==t?this._model.dateTimeFormatter().format(t):""}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty()||!this._isVisible())return;const t=this._getIndex();null!==t&&Number.isFinite(t)&&(e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort(),e.text=this._getText(t),this._invalidated=!1)}}},87053:(e,t,i)=>{"use strict";i.d(t,{createVisibilityController:()=>d});var s=i(444372),r=i(778785),n=i(152633),o=i(62802);const a="visibleOnMouseOver";function l(e){return"alwaysOn"===e||"alwaysOff"===e?e:a}function d(e,t){let d,h;function u(){if(!d){d=(0,n.createPrimitiveProperty)();let i=o.getValue(e);void 0===i&&void 0!==t&&(i=o.getValue(t)),d.setValue(l(i)),d.subscribe(d,(t=>{o.setValue(e,l(t.value()))}))}return d}return{property:u,availableValues:function(){return[{id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:s.t(null,void 0,i(689960))},{id:"alwaysOn",value:"alwaysOn",title:s.t(null,void 0,i(471997))},{id:"alwaysOff",value:"alwaysOff",title:s.t(null,void 0,i(109408))}]},actualBehavior:function(){if(!h){h=(0,n.createPrimitiveProperty)();const e=u(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),h&&h.setValue(t)};e.subscribe(h,t),t()}return h},restoreDefaultValue:function(){u().setValue(a),o.remove(e)}}}},558793:(e,t,i)=>{"use strict";i.d(t,{getChartAlertsFacade:()=>a,getChartAlertsFacadeIfCreatedBefore:()=>l});var s=i(125226),r=i(949307),n=i(922100);let o;async function a(){return void 0===o&&(o=await async function(){if((0,s.isFeatureEnabled)("alerts-editor-use-facade")&&(0,s.isFeatureEnabled)("alerts-chart-use-facade")){const[e,{getAlertsCollection:t},s]=await Promise.all([Promise.all([i.e(32327),i.e(94949),i.e(41723),i.e(29525),i.e(54253),i.e(36679)]).then(i.bind(i,788589)),Promise.all([i.e(11843),i.e(94949),i.e(41723),i.e(14141)]).then(i.bind(i,41723)),(0,r.getPriceAlertsDispatcher)()]);return new e.ChartAlertsFacade(t(),s)}const[e,t,o]=await Promise.all([Promise.all([i.e(32327),i.e(36876),i.e(69030),i.e(25977),i.e(24951),i.e(68647),i.e(42292),i.e(94949),i.e(42700),i.e(81274),i.e(54253),i.e(61865),i.e(86922),i.e(48158)]).then(i.bind(i,408114)),(0,r.getPriceAlertsDispatcher)(),(0,n.getAlertsFiresFocusHandler)()]);return new e.ChartAlertsFacadeOld(t,o)}()),o}function l(){return null!=o?o:null}},922100:(e,t,i)=>{"use strict";i.d(t,{getAlertsFiresFocusHandler:()=>s});const s=(0,i(895171).default)((async()=>{const{AlertsFiresFocusHandler:e}=await i.e(69581).then(i.bind(i,393334));return new e}))},511131:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{ family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},151149:(e,t,i)=>{"use strict";i.d(t,{rgbaFromIntegerCached:()=>o});var s=i(448874),r=i(246733),n=i(407478);function o(e=1e3){const t=s.default.Cache;s.default.Cache=n.CircularCacheBuffer.bind(n.CircularCacheBuffer,e);const i=(0,s.default)(r.rgbaFromInteger);return s.default.Cache=t,i}},298113:(e,t,i)=>{"use strict";function s(e,t){for(const i of t.keys())e.add(i)}i.d(t,{addToSet:()=>s})},847754:(e,t,i)=>{"use strict";async function s(e){(await Promise.all([i.e(95549),i.e(74756),i.e(94773),i.e(62253),i.e(92191),i.e(32109),i.e(68992),i.e(81643),i.e(33199),i.e(6209),i.e(61298),i.e(55242),i.e(967),i.e(36953),i.e(27781),i.e(73151),i.e(61633),i.e(8954),i.e(50690),i.e(53490),i.e(32605),i.e(8658),i.e(39946),i.e(8304),i.e(94913)]).then(i.bind(i,577594))).renderRunOrSigninWithFeatureDialog(e)}i.d(t,{createRunOrSigniWithFeatureDialog:()=>s})},904310:(e,t,i)=>{"use strict";function s(e){return e.charAt(0).toUpperCase()+e.substring(1)}i.d(t,{capitalizeFirstLetter:()=>s})},315507:e=>{e.exports=''},85290:e=>{e.exports=''},788600:e=>{e.exports=''},261820:e=>{e.exports=''},777566:e=>{e.exports=''},385442:e=>{ e.exports=''},717090:e=>{e.exports=''},274469:e=>{e.exports=''}}]);