diff --git a/changelog.md b/changelog.md
index 4f1e5e3c..bfba61a2 100644
--- a/changelog.md
+++ b/changelog.md
@@ -4,9 +4,44 @@
+
+## Version 30.1.0
+
+*Date: Mon Nov 10 2025*
+
+**New Features**
+
+- **Added the `always_show_study_symbol_input_values_in_legend` featureset.** When enabled, this featureset keeps symbol-type [indicator inputs](https:/www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo/Custom-Studies-Inputs) (`StudySymbolInputInfo`) visible in the legend, even when other indicator inputs are hidden. This allows users to visually distinguish multiple instances of the same indicator on the chart by their source symbol.
+
+**Improvements**
+
+- **Improved drag-to-export feature.** When the [`chart_drag_export`](https:/www.tradingview.com/charting-library-docs/latest/customization/Featuresets#chart_drag_export) featureset is enabled and [`setDragExportEnabled(true)`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#setdragexportenabled) is called, the chart remains responsive to mouse interactions instead of blocking them. The library now emits [`dragstart`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.SubscribeEventsMap#dragstart) for all drags. To treat a drag as a drag-drop export, set payload via the parameters of the [`setData`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.DragStartParams#setdata) method. The [event parameters](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.DragStartParams) also include current modifier keys (ctrl/meta/alt/shift), enabling patterns like Cmd+Drag without relying on global key listeners.
+- **Added the `getVisibleBarsRange` method.** [`getVisibleBarsRange`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#getvisiblebarsrange) returns the range of bar times currently shown on the chart. The method includes existing bars and visible incomplete bars produced by non-time-based chart styles (for example, Renko). Unlike [`getVisibleRange`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#getvisiblerange), `getVisibleBarsRange` doesn't include future bar times beyond the last visible bar.
+- **Added a dropdown to change the type of Moving Average used for calculating Bollinger Bands.**
+
+- **Support setting `noData` with non-empty bars response.** It is now possible to signal that there is no more data available, while at the same time returning bars via the [`getBars`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IDatafeedChartApi#getbars) callback. Previously, this would cause a `"noData should be set when there is no data in the requested period and earlier only"` warning to be logged to the console, and a second call would be made to [`getBars`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IDatafeedChartApi#getbars).
+
+**Bug Fixes**
+
+- **Fixed an issue where the widget bar would disappear when resizing.** When transitioning to higher dimensions, the widget bar would not necessarily be properly displayed.
+- **Fixed VWAP issue.** The VWAP indicator used to break the chart when applied to a Japanese style chart.
+- **Fixed an issue where the main series wouldn’t load more data if an indicator error appeared.**
+
+- **Fixed an issue where the Moving Average Double indicator ignored the `Method` input.**
+
+- **Fixed an issue where an error could be thrown after a pane is removed.**
+
+- **Fixed an issue where creating an anchored shape would fail if placed before the first available bar.**
+
+- **Fixed an issue where the Bollinger Bands indicator could be loaded inconsistently.** The result differed depending on whether it was added from the header dropdown or via the `createStudy` method.
+- **Fixed an issue where `showOrderDialog` would use the default implementation instead of the one from `customUI`.** (Trading Platform only)
+- **Fixed an issue where interacting with the DOM could cause errors in the console.** (Trading Platform only)
+
+---
+
## Version 30.0.0
-*Date: Thu Sep 18 2025*
+*Date: Mon Sep 18 2025*
**Breaking Changes**
@@ -15,8 +50,9 @@
For this reason, the `showLabel` override property has no effect for the line tools such as Trend Line.
- **Update UDF properties.** Both `exchange-listed` and `exchange-traded` have been marked deprecated in favour of a single `exchange_listed_name` property.
From version 31 they will be removed.
-- **Extend featureset to display inactivity gaps on DWM charts.** The new [`inactivity_gaps`](https:/www.tradingview.com/charting-library-docs/latest/customization/Featuresets#inactivity_gaps) featureset replaces the existing `intraday_inactivity_gaps` and enables the display of inactivity gaps both on intraday and DWM (daily, weekly, monthly) charts. For more information, refer to the [Show/hide gaps on the chart](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#showhide-gaps-on-the-chart) section.
+- **Extend featureset to display inactivity gaps on DWM charts.** The new [`inactivity_gaps`](https://www.tradingview.com/charting-library-docs/latest/customization/Featuresets#inactivity_gaps) featureset replaces the existing `intraday_inactivity_gaps` and enables the display of inactivity gaps both on intraday and DWM (daily, weekly, monthly) charts. For more information, refer to the [Show/hide gaps on the chart](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#showhide-gaps-on-the-chart) section.
- **Removed support for iOS version below 15.** Only iOS versions including and above 16 are now compatible with the library.
+- **Default value of `supportOrdersHistory` changed to `true`.** This means the *History* page in the [Account Manager](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/account-manager/) is enabled by default and requires the [`ordersHistory`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IBrokerTerminal#ordershistory) method to be implemented. If you don't plan to support order history, set [`supportOrdersHistory`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.BrokerConfigFlags#supportordershistory) to `false` in your broker configuration. This hides the *History* page and prevents related errors. (Trading Platform only)
**New Features**
@@ -30,24 +66,24 @@ To disable this feature, use the `long_press_floating_tooltip` featureset.
- **Added option to remove locked drawings.** A new toggle *Always remove locked drawings* is now available in the left toolbar’s delete menu.
When enabled, this option forces the deletion of locked drawings along with other items.
-- **Added subscription for *Zoom out* tool.** [`IChartWidgetApi`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi) has a new property `canZoomOutWV`. It returns whether the chart can be zoomed out using [`zoomOut`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#zoomout).
-- **The `onSymbolChanged` method returns the right type.** [`onSymbolChanged`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#onsymbolchanged) now returns the expected type.
-- **Deprecated support for letters in shortcuts.** The support for letters in [shortcuts](https:/www.tradingview.com/charting-library-docs/latest/getting_started/Shortcuts) has been deprecated. Starting from version 31, string key names are no longer supported.
-Old styles like `'ctrl+shift+/'` or `['ctrl', 'shift', '/']` are deprecated. Use the supportable style like `['ctrl', 'shift', 191]` instead. For more information, refer to the [Manage shortcuts](https:/www.tradingview.com/charting-library-docs/latest/getting_started/Shortcuts#manage-shortcuts) section.
-- **Added a `label` property to StudyOrDrawingAddedToChartEventParams.** The [`label`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.StudyOrDrawingAddedToChartEventParams#label) property contains the indicator's name as defined in the [`description`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.RawStudyMetaInfo#description) field of its [metainfo](https:/www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo).
-- **New featuresets for legend in-place edit.** The `disable_legend_inplace_resolution_change` and `disable_legend_inplace_symbol_change` featuresets control whether users can change the resolution or symbol directly from the [legend](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Legend).
-- **Show symbol name in the _Сompare_ dialog.** When the [`use_symbol_name_for_header_toolbar`](https:/www.tradingview.com/charting-library-docs/latest/customization/Featuresets#use_symbol_name_for_header_toolbar) featureset is enabled, the symbol [`name`](https:/www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology/#name) is displayed in the _Compare_ search dialog instead of [`ticker`](https:/www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology/#ticker).
+- **Added subscription for *Zoom out* tool.** [`IChartWidgetApi`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi) has a new property `canZoomOutWV`. It returns whether the chart can be zoomed out using [`zoomOut`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#zoomout).
+- **The `onSymbolChanged` method returns the right type.** [`onSymbolChanged`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#onsymbolchanged) now returns the expected type.
+- **Deprecated support for letters in shortcuts.** The support for letters in [shortcuts](https://www.tradingview.com/charting-library-docs/latest/getting_started/Shortcuts) has been deprecated. Starting from version 31, string key names are no longer supported.
+Old styles like `'ctrl+shift+/'` or `['ctrl', 'shift', '/']` are deprecated. Use the supportable style like `['ctrl', 'shift', 191]` instead. For more information, refer to the [Manage shortcuts](https://www.tradingview.com/charting-library-docs/latest/getting_started/Shortcuts#manage-shortcuts) section.
+- **Added a `label` property to StudyOrDrawingAddedToChartEventParams.** The [`label`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.StudyOrDrawingAddedToChartEventParams#label) property contains the indicator's name as defined in the [`description`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.RawStudyMetaInfo#description) field of its [metainfo](https://www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo).
+- **New featuresets for legend in-place edit.** The `disable_legend_inplace_resolution_change` and `disable_legend_inplace_symbol_change` featuresets control whether users can change the resolution or symbol directly from the [legend](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Legend).
+- **Show symbol name in the _Сompare_ dialog.** When the [`use_symbol_name_for_header_toolbar`](https://www.tradingview.com/charting-library-docs/latest/customization/Featuresets#use_symbol_name_for_header_toolbar) featureset is enabled, the symbol [`name`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology/#name) is displayed in the _Compare_ search dialog instead of [`ticker`](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology/#ticker).
- **Added new time zone for Kabul.**
-- **Added new APIs to control the watermark settings.** The [Watermark API](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/watermarks#watermark-api-recommended) now has three different properties that can be set independently:
- - [`tickerVisibility`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IWatermarkApi/#tickervisibility) to toggle the display of the ticker (e.g. AAPL)
- - [`intervalVisibility`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IWatermarkApi/#intervalvisibility) to toggle the display of the interval (e.g. 1h)
- - [`descriptionVisibility`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IWatermarkApi/#descriptionvisibility) to toggle the display of the description (e.g. Apple Inc.)
-- **The `setVisibleRange` method can be rejected.** [`setVisibleRange`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#setvisiblerange) now returns a `Promise` that can be rejected.
-- **Added `chart_theme_changed` event to `SubscribeEventsMap`.** The [`chart_theme_changed`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.SubscribeEventsMap#chart_theme_changed) event is fired when a user applies a saved [chart template](https:/www.tradingview.com/charting-library-docs/latest/saving_loading#chart-templates), resets the theme to the default built-in settings, or when the [`changeTheme`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#changetheme) or [`loadChartTemplate`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#loadcharttemplate) methods are called.
-- **New `applyTradingCustomization` method.** This method allows you to override the style of order and position lines created with the [Broker API](https:/www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts#broker-api) after the widget has been created. (Trading Platform only)
-- **Added a date property to `PositionBase`.** [`PositionBase`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.PositionBase) now has an optional `updateTime` property. (Trading Platform only)
-- **Added a `canBeClosed` property to different Position APIs.** Both [`IndividualPositionBase`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IndividualPositionBase) and [`IndividualPosition`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IndividualPosition) now have an optional `canBeClosed` property to determine if a position can be closed. (Trading Platform only)
+- **Added new APIs to control the watermark settings.** The [Watermark API](https://www.tradingview.com/charting-library-docs/latest/ui_elements/watermarks#watermark-api-recommended) now has three different properties that can be set independently:
+ - [`tickerVisibility`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IWatermarkApi/#tickervisibility) to toggle the display of the ticker (e.g. AAPL)
+ - [`intervalVisibility`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IWatermarkApi/#intervalvisibility) to toggle the display of the interval (e.g. 1h)
+ - [`descriptionVisibility`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IWatermarkApi/#descriptionvisibility) to toggle the display of the description (e.g. Apple Inc.)
+- **The `setVisibleRange` method can be rejected.** [`setVisibleRange`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#setvisiblerange) now returns a `Promise` that can be rejected.
+- **Added `chart_theme_changed` event to `SubscribeEventsMap`.** The [`chart_theme_changed`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.SubscribeEventsMap#chart_theme_changed) event is fired when a user applies a saved [chart template](https://www.tradingview.com/charting-library-docs/latest/saving_loading#chart-templates), resets the theme to the default built-in settings, or when the [`changeTheme`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#changetheme) or [`loadChartTemplate`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#loadcharttemplate) methods are called.
+- **New `applyTradingCustomization` method.** This method allows you to override the style of order and position lines created with the [Broker API](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts#broker-api) after the widget has been created. (Trading Platform only)
+- **Added a date property to `PositionBase`.** [`PositionBase`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.PositionBase) now has an optional `updateTime` property. (Trading Platform only)
+- **Added a `canBeClosed` property to different Position APIs.** Both [`IndividualPositionBase`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IndividualPositionBase) and [`IndividualPosition`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IndividualPosition) now have an optional `canBeClosed` property to determine if a position can be closed. (Trading Platform only)
- **Added price information (price and profit/loss details) to the tooltip for positions, orders, and brackets.** (Trading Platform only)
- **Redesigned *Trading settings* panel.** The *Trading settings* panel has been reworked to be more intuitive and provide users with clearer options for customizing their trading view. (Trading Platform only)
@@ -57,21 +93,21 @@ Old styles like `'ctrl+shift+/'` or `['ctrl', 'shift', '/']` are deprecated. Use
- **Fixed an issue where the _Long Position_ and _Short Position_ drawings were not reversed correctly.**
- **Fixed a bug that allowed orders to be placed without a price.** (Trading Platform only)
-- **Fixed *Reverse* button color overrides.** Previously, setting override properties for the *Reverse* button within the [`trading_customization`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.TradingTerminalWidgetOptions#trading_customization) object would result in the button rendering as black. (Trading Platform only)
+- **Fixed *Reverse* button color overrides.** Previously, setting override properties for the *Reverse* button within the [`trading_customization`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.TradingTerminalWidgetOptions#trading_customization) object would result in the button rendering as black. (Trading Platform only)
**Documentation**
-- **AI docs assistant.** You can now download a comprehensive knowledge file containing our complete, up-to-date documentation and full TypeScript definitions. Feed this file to your favorite LLM to create a dedicated expert assistant for our library, ensuring you get accurate, context-aware answers and code examples. [Learn how to set it up](https:/www.tradingview.com/charting-library-docs/latest/getting_started/llm-context).
-- **New watermarks guide.** The [Watermarks](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/watermarks) article explains how to programmatically control the watermark's visibility, color, and content using the Watermark API.
-- **New profit and loss article.** The [Profit and loss](https:/www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/profit-and-loss) article explains how to provide P&L values from your backend. It details the different methods for updating the data and clarifies how the library uses this data for the *Money*, *Ticks*, and *Percentage* display modes.
+- **AI docs assistant.** You can now download a comprehensive knowledge file containing our complete, up-to-date documentation and full TypeScript definitions. Feed this file to your favorite LLM to create a dedicated expert assistant for our library, ensuring you get accurate, context-aware answers and code examples. [Learn how to set it up](https://www.tradingview.com/charting-library-docs/latest/getting_started/llm-context).
+- **New watermarks guide.** The [Watermarks](https://www.tradingview.com/charting-library-docs/latest/ui_elements/watermarks) article explains how to programmatically control the watermark's visibility, color, and content using the Watermark API.
+- **New profit and loss article.** The [Profit and loss](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/profit-and-loss) article explains how to provide P&L values from your backend. It details the different methods for updating the data and clarifies how the library uses this data for the *Money*, *Ticks*, and *Percentage* display modes.
- **Other updates.** The following enhancements were made:
- - Added a new section that describes [time ranges](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Time-Scale#time-range) and how to use `setVisibleRange`.
- - Added a new section that describes [how to show/hide gaps on the chart](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#showhide-gaps-on-the-chart) using the `intraday_inactivity_gaps` featureset.
- - Updated information on [mobile app development](https:/www.tradingview.com/charting-library-docs/latest/mobile_specifics#mobile-applications).
- - Updated [`setMinimumAdditionalDepth`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IContext#setminimumadditionaldepth) description, mentioning when to use the method.
- - Updated the [Trading primitives](https:/www.tradingview.com/charting-library-docs/latest/trading_terminal/Trading-Primitives) article, providing clear explanations and examples on the primitive methods.
- - Updated the [Online playgrounds](https:/www.tradingview.com/charting-library-docs/latest/getting_started/Online-Editors) article, providing templates for [CodePen](https://codepen.io/tradingview).
-- **Update the Datafeed API tutorial.** We updated both the code example and documentation for the [How to connect data via datafeed API](https:/www.tradingview.com/charting-library-docs/latest/tutorials/implement_datafeed_tutorial) tutorial. The latest version introduces several key improvements:
+ - Added a new section that describes [time ranges](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Time-Scale#time-range) and how to use `setVisibleRange`.
+ - Added a new section that describes [how to show/hide gaps on the chart](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Chart#showhide-gaps-on-the-chart) using the `intraday_inactivity_gaps` featureset.
+ - Updated information on [mobile app development](https://www.tradingview.com/charting-library-docs/latest/mobile_specifics#mobile-applications).
+ - Updated [`setMinimumAdditionalDepth`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IContext#setminimumadditionaldepth) description, mentioning when to use the method.
+ - Updated the [Trading primitives](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/Trading-Primitives) article, providing clear explanations and examples on the primitive methods.
+ - Updated the [Online playgrounds](https://www.tradingview.com/charting-library-docs/latest/getting_started/Online-Editors) article, providing templates for [CodePen](https://codepen.io/tradingview).
+- **Update the Datafeed API tutorial.** We updated both the code example and documentation for the [How to connect data via datafeed API](https://www.tradingview.com/charting-library-docs/latest/tutorials/implement_datafeed_tutorial) tutorial. The latest version introduces several key improvements:
- Added support for minute and hour resolutions.
- Removed `full_name` from the `SymbolInfo` object. Now, `ticker` is used instead.
@@ -88,11 +124,11 @@ Old styles like `'ctrl+shift+/'` or `['ctrl', 'shift', '/']` are deprecated. Use
**Improvements**
- **Improved crosshair movement in tracking mode on mobile.** Previously, the crosshair moved incorrectly in tracking mode when `vert_touch_drag_scroll` was disabled. Now, page scrolling is disabled in tracking mode, allowing the crosshair to move on touch.
-- **Added `setLayoutSizes` method to `IChartingLibraryWidget`.** The [`setLayoutSizes`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#setlayoutsizes) method can be used to resize the charts in [multiple-chart layouts](https:/www.tradingview.com/charting-library-docs/latest/trading_terminal#multiple-chart-layout). (Trading Platform only)
+- **Added `setLayoutSizes` method to `IChartingLibraryWidget`.** The [`setLayoutSizes`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#setlayoutsizes) method can be used to resize the charts in [multiple-chart layouts](https://www.tradingview.com/charting-library-docs/latest/trading_terminal#multiple-chart-layout). (Trading Platform only)
**Bug Fixes**
-- **Fixed an issue where setMinimumAdditionalDepth would be ignored.** Fixed an issue where custom studies would sometimes not request enough historic bars after calling [`setMinimumAdditionalDepth`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IContext/#setminimumadditionaldepth).
+- **Fixed an issue where setMinimumAdditionalDepth would be ignored.** Fixed an issue where custom studies would sometimes not request enough historic bars after calling [`setMinimumAdditionalDepth`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IContext/#setminimumadditionaldepth).
- **Fixed an issue where pivot points could be drawn on the wrong bar for overnight sessions.** Fixed an issue where pivot points could be drawn on the wrong bars for symbols with overnight sessions when calculating with a daily timeframe.
---
@@ -104,21 +140,21 @@ Old styles like `'ctrl+shift+/'` or `['ctrl', 'shift', '/']` are deprecated. Use
**New Features**
- **Added new legend property.** A new overrides property `paneProperties.legendProperties.showSeriesLegendCloseOnMobile` was added to hide/show the close value in the legend when on mobile. The default value is `true`.
-- **Support multiple tick resolution.** The library now supports multiple [tick resolutions](https:/www.tradingview.com/charting-library-docs/latest/core_concepts/Resolution#resolution-in-ticks). Previously, it was possible to set only `1T` resolution.
+- **Support multiple tick resolution.** The library now supports multiple [tick resolutions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/configure-datafeed-resolutions#resolution-in-ticks). Previously, it was possible to set only `1T` resolution.
Note that the library does not support tick multipliers. This means it is not possible to build a higher resolution (e.g., `10T`) from a lower one (e.g., `1T`). Therefore, your datafeed must explicitly provide each required resolution. (Trading Platform only)
-- **Enabled custom price formatting for Watchlist values.** `priceFormatterFactory` from [`custom_formatters`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#custom_formatters) can now be used to format values displayed in the Watchlist columns titled _Last_ and _Chg_. (Trading Platform only)
+- **Enabled custom price formatting for Watchlist values.** `priceFormatterFactory` from [`custom_formatters`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#custom_formatters) can now be used to format values displayed in the Watchlist columns titled _Last_ and _Chg_. (Trading Platform only)
**Improvements**
-- **Updated snapshots functionality in the top toolbar.** Now, handling and storing [snapshots](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Snapshots) rely solely on the [`snapshot_url`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#snapshot_url) property.
+- **Updated snapshots functionality in the top toolbar.** Now, handling and storing [snapshots](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Snapshots) rely solely on the [`snapshot_url`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#snapshot_url) property.
This means all server-side snapshot actions (*Copy link*, *Open in new tab*, *Tweet image*) must be implemented using your own server.
-For details on how to set up your own server, see our guide to [implementing a snapshot server](https:/www.tradingview.com/charting-library-docs/latest/tutorials/implement-snapshots-server).
+For details on how to set up your own server, see our guide to [implementing a snapshot server](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/implement-snapshots-server).
- **Added the `use_symbol_name_for_header_toolbar` featureset.** This featureset allows you to show the symbol name over the ticker in the _Symbol Search_ dialog.
-- **Added `searchSource` parameter to `searchSymbols`.** [`searchSymbols`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IDatafeedChartApi#searchsymbols) now receives a new parameter `searchSource` to indicate where the search was triggered from.
-- **Added a new property to the `BrokerCustomUI` interface.** [`showReversePositionDialog`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.BrokerCustomUI#showreversepositiondialog) allows overriding the default *Reverse position* dialog with a custom implementation.
+- **Added `searchSource` parameter to `searchSymbols`.** [`searchSymbols`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IDatafeedChartApi#searchsymbols) now receives a new parameter `searchSource` to indicate where the search was triggered from.
+- **Added a new property to the `BrokerCustomUI` interface.** [`showReversePositionDialog`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.BrokerCustomUI#showreversepositiondialog) allows overriding the default *Reverse position* dialog with a custom implementation.
- **Added VWAP insufficient data warning.** Users will now see a warning icon and message in the legend if there isn't enough data loaded to calculate VWAP.
- **Add featureset to display inactivity gaps on intraday charts.** The new `intraday_inactivity_gaps` featureset enables the display of inactivity gaps on intraday charts. These gaps represent periods within the trading session when there has been no trading activity, resulting in missing bars on the chart.
-When `intraday_inactivity_gaps` is enabled, a checkbox appears in the chart settings dialog, allowing users to toggle inactivity gaps on or off. The featureset also exposes the [`intradayInactivityGaps`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#intradayinactivitygaps) watched value on the Widget API for programmatic control.
+When `intraday_inactivity_gaps` is enabled, a checkbox appears in the chart settings dialog, allowing users to toggle inactivity gaps on or off. The featureset also exposes the [`intradayInactivityGaps`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#intradayinactivitygaps) watched value on the Widget API for programmatic control.
- **Improved data loading efficiency by throttling data requests during user scrolling.** This significantly reduces the frequency of small, incremental requests to the Datafeed API.
- **Order & Position lines display the same information on desktop and mobile.** Users can now benefit from the same design on both desktop and mobile when an order/position is displayed on the chart. (Trading Platform only)
@@ -133,14 +169,14 @@ When `intraday_inactivity_gaps` is enabled, a checkbox appears in the chart sett
- **Fixed the spread operator issue in the Compare symbol dialog.** Spread operators now function correctly in the _Compare symbol_ dialog, ensuring consistency with the _Symbol Search_ dialog.
- **Fix for sameorigin.html loading from relative path.** This fix ensures proper loading of the `sameorigin.html` file when using the `iframe_loading_same_origin` featureset and the current page is not the root page.
- **The `_getStyleOverrides` error message.** Fixed a bug where the `_getStyleOverrides` error message could be seen in the console when instantiating the chart with pre-existing orders or positions. (Trading Platform only)
-- **Fix rendering of multiple execution shapes on a single bar.** Fixed an issue where adding multiple [execution shapes](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/drawings/drawings-api#createexecutionshape) to a single bar would only render the first shape. (Trading Platform only)
+- **Fix rendering of multiple execution shapes on a single bar.** Fixed an issue where adding multiple [execution shapes](https://www.tradingview.com/charting-library-docs/latest/ui_elements/drawings/drawings-api#createexecutionshape) to a single bar would only render the first shape. (Trading Platform only)
**Documentation**
-- **New tutorial.** Check out our [new tutorial](https:/www.tradingview.com/charting-library-docs/latest/tutorials/implement-broker-api) on how to implement the required methods to enable basic trading functionality using the Broker API.
+- **New tutorial.** Check out our [new tutorial](https://www.tradingview.com/charting-library-docs/latest/tutorials/implement-broker-api) on how to implement the required methods to enable basic trading functionality using the Broker API.
By the end of this tutorial, you will learn how to enable trading UI and how to store, return, and update orders to make the trading flow functional.
-- **New troubleshooting article.** Explore a new article on common [customization issues](https:/www.tradingview.com/charting-library-docs/latest/customization/customization-issues) and potential solutions.
-- **Other enhancements.** Updated the [Custom themes API](https:/www.tradingview.com/charting-library-docs/latest/customization/styles/custom-themes) article and added a new [example](https://codepen.io/tradingview/pen/xbGRaKd) to demonstrate how chart colors can be adjusted using this API.
+- **New troubleshooting article.** Explore a new article on common [customization issues](https://www.tradingview.com/charting-library-docs/latest/customization/customization-issues) and potential solutions.
+- **Other enhancements.** Updated the [Custom themes API](https://www.tradingview.com/charting-library-docs/latest/customization/styles/custom-themes) article and added a new [example](https://codepen.io/tradingview/pen/xbGRaKd) to demonstrate how chart colors can be adjusted using this API.
---
@@ -150,28 +186,28 @@ By the end of this tutorial, you will learn how to enable trading UI and how to
**New Features**
-- **Added HLC bars chart style.** The HLC bars chart style is the same as regular bars but doesn't display the open price. When exporting a series or [overlay](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/indicators#add-and-compare-new-series) indicator that uses the HLC bars chart style, open values are not included. Open values also do not appear in the data window or [legend](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Legend) for series or overlay indicators using this style.
+- **Added HLC bars chart style.** The HLC bars chart style is the same as regular bars but doesn't display the open price. When exporting a series or [overlay](https://www.tradingview.com/charting-library-docs/latest/ui_elements/indicators#add-and-compare-new-series) indicator that uses the HLC bars chart style, open values are not included. Open values also do not appear in the data window or [legend](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Legend) for series or overlay indicators using this style.
**Improvements**
-- **Added price scale details to context menu event.** When invoking the [context menu](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/context-menu) on the price scale, it now returns the following details:
+- **Added price scale details to context menu event.** When invoking the [context menu](https://www.tradingview.com/charting-library-docs/latest/ui_elements/context-menu) on the price scale, it now returns the following details:
- `id` of the price scale
- `paneIndex` which is the index of the pane the price scale is linked to
- `chartIndex` which is the index of the chart the price scale is linked to
-- **Added icon to dropdown items.** A new property `icon` was added to the [`DropdownItem`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.DropdownItem) interface.
+- **Added icon to dropdown items.** A new property `icon` was added to the [`DropdownItem`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.DropdownItem) interface.
**Bug Fixes**
-- **Empty context menu.** Fixed an issue where the [context menu](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/context-menu) would be partially empty on mobile
-- **onContextMenu callback received incorrect arguments.** Fixed a bug where the [`onContextMenu`](https:/www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#oncontextmenu) callback received an object instead of the expected arguments.
+- **Empty context menu.** Fixed an issue where the [context menu](https://www.tradingview.com/charting-library-docs/latest/ui_elements/context-menu) would be partially empty on mobile
+- **onContextMenu callback received incorrect arguments.** Fixed a bug where the [`onContextMenu`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#oncontextmenu) callback received an object instead of the expected arguments.
- **Autosave won't trigger with empty text box created during autosave delay.**
- **Fixed an error where vertical lines would revert to their previous position when moved beyond latest bar.** Fixes [#8894](https://github.com/tradingview/charting_library/issues/8894)
**Documentation**
- **The following enhancements were made.**
- - Added a new section explaining how to [programmatically open and close Symbol Search](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/Symbol-Search#openclose-symbol-search).
- - Updated the [Customization overview](https:/www.tradingview.com/charting-library-docs/latest/customization) and [Time zones](https:/www.tradingview.com/charting-library-docs/latest/ui_elements/timezones) articles.
+ - Added a new section explaining how to [programmatically open and close Symbol Search](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Symbol-Search#openclose-symbol-search).
+ - Updated the [Customization overview](https://www.tradingview.com/charting-library-docs/latest/customization) and [Time zones](https://www.tradingview.com/charting-library-docs/latest/ui_elements/timezones) articles.
---
@@ -212,9 +248,9 @@ To disable the cross-tab synchronization, use the `watchlist_cross_tab_sync` fea
**Documentation**
- **The following enhancements were made.**
- - Added a new section explaining how to [display pre- and post-market price lines](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Extended-Sessions#enable-the-price-line).
+ - Added a new section explaining how to [display pre- and post-market price lines](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/Extended-Sessions#enable-the-price-line).
- Added a new section explaining how to [provide profit and loss values](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/profit-and-loss) in Trading Platform.
- - Updated the [Trading Session](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Trading-Sessions) article with information on how to specify [session history](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Trading-Sessions#session-history)
+ - Updated the [Trading Session](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/Trading-Sessions) article with information on how to specify [session history](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/Trading-Sessions#session-history)
---
@@ -242,7 +278,7 @@ To disable the cross-tab synchronization, use the `watchlist_cross_tab_sync` fea
- [Quotes](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/quotes) — an article explaining the importance of quotes in Trading Platform.
- **Other updates.** The following enhancements were made:
- - Updated the guide on [how to add a custom page to the Account Manager](https://www.tradingview.com/charting-library-docs/latest/tutorials/create-custom-page-in-account-manager). It now describes how to make the symbol name clickable on the custom page.
+ - Updated the guide on [how to add a custom page to the Account Manager](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/create-custom-page-in-account-manager). It now describes how to make the symbol name clickable on the custom page.
- Added a guide on how to troubleshoot when [quotes are not displayed or refreshed](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Datafeed-Issues#quotes-are-not-displayed-or-refreshed).
- Added a guide on how to troubleshoot [delays in Trading Platform UI elements](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Datafeed-Issues#delays-in-trading-platform-ui-elements).
- Added a new FAQ — [Does the library set cookies](https://www.tradingview.com/charting-library-docs/latest/getting_started/Frequently-Asked-Questions#other-questions).
@@ -301,7 +337,7 @@ For more details, see the [Trading Overrides](https://www.tradingview.com/charti
**Documentation**
-- **New how-to guide.** Check out a new [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/add-custom-button-to-top-toolbar) on how to add a custom button to the top toolbar.
+- **New how-to guide.** Check out a new [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/add-custom-button-to-top-toolbar) on how to add a custom button to the top toolbar.
- **Other updates.** The following enhancements were made:
- Added a new section that explains [multiple symbol resolving](https://www.tradingview.com/charting-library-docs/latest/connecting_data/datafeed-api/required-methods#multiple-symbol-resolving).
- Updated information on how to [change colors of the *Buy/Sell* buttons](https://www.tradingview.com/charting-library-docs/latest/customization/styles/CSS-Color-Themes#buysell-buttons-properties).
@@ -324,10 +360,10 @@ For more details, see the [Trading Overrides](https://www.tradingview.com/charti
**Documentation**
-- **New how-to guide.** Check out a new [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/create-custom-page-in-account-manager) that explains how to create a custom page in the Account Manager.
+- **New how-to guide.** Check out a new [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/create-custom-page-in-account-manager) that explains how to create a custom page in the Account Manager.
- **Other updates.** The following enhancements were made:
- Added a new section that explains how to enable and specify [last day change values](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Legend#last-day-change-values).
- - Updated information on [overnight sessions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Trading-Sessions#overnight-sessions).
+ - Updated information on [overnight sessions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/Trading-Sessions#overnight-sessions).
- Updated information on how to [close](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/positions#close-positions) and [reverse](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/positions#reverse-positions) positions.
- Updated API overview page.
@@ -532,7 +568,7 @@ have been added or updated:
- Updated the types for `paneProperties.*`.
- Added overrides that affect Trading Platform features (`tradingProperties.*`).
- **New articles.** Explore our latest articles:
- - [How to create a custom indicator](https://www.tradingview.com/charting-library-docs/latest/tutorials/create-custom-indicator) — a step-by-step tutorial that demonstrates the Moving Average implementation.
+ - [How to create a custom indicator](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/create-custom-indicator) — a step-by-step tutorial that demonstrates the Moving Average implementation.
- [Custom indicators. Inputs](https://www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo/Custom-Studies-Inputs) — an overview of how to specify and manage input parameters for a custom indicator.
- [Authentication](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/authentication) — an article that outlines possible authentication approaches. `Trading Platform Only`
@@ -555,7 +591,7 @@ have been added or updated:
**Bug Fixes**
-- **Fixed a bug in the Market Status pop-up.** [Corrections](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Extended-Sessions#corrections-for-extended-sessions) specified for the extended session in the [`session-correction`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySubsessionInfo#session-correction) properties were not displayed in the _Market Status_ pop-up window.
+- **Fixed a bug in the Market Status pop-up.** [Corrections](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/Extended-Sessions#corrections-for-extended-sessions) specified for the extended session in the [`session-correction`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySubsessionInfo#session-correction) properties were not displayed in the _Market Status_ pop-up window.
## Version 27.004
@@ -584,7 +620,7 @@ Fixes [#8413](https://github.com/tradingview/charting_library/issues/8413) [#832
**Documentation**
- **New User accounts article.** Refer to [User accounts](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/account-manager/user-accounts) for information on how to manage user accounts in the [Account Manager](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/account-manager).
-- **Session documentation updates.** The [Symbology](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology#session) and [Extended sessions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Extended-Sessions) articles now include more information on how to specify sessions and corrections for them.
+- **Session documentation updates.** The [Symbology](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology#session) and [Extended sessions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/time-and-sessions/Extended-Sessions) articles now include more information on how to specify sessions and corrections for them.
- **New Save user settings article.** Refer to the [Save user settings](https://www.tradingview.com/charting-library-docs/latest/saving_loading/user-settings) article for information on how to store user settings.
- **Updated Watchlist article.** Explore our latest [Watchlist](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/Watch-List) article that describes how to customize and handle the watchlist's data.
@@ -714,12 +750,12 @@ To make this option available in the _Chart Settings_ dialog, use the [`legend_l
Explore our latest article on [customization precedence](https://www.tradingview.com/charting-library-docs/latest/customization/customization-precedence)
for a comprehensive understanding of customization methods/properties and the sequence in which they are applied.
- **Order Ticket dialog article added.** Refer to [Order Ticket](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/order-ticket) to learn how to provide custom fields, enable an order preview, implement your custom Order Ticket, and more.
-- **New how-to guide on metainfo.** Explore our latest [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/create-custom-indicator/metainfo-implementation) on how to implement the `metainfo` field when you create a custom indicator. For more information about custom indicators and `metainfo`, refer to the updated [Custom indicators](https://www.tradingview.com/charting-library-docs/latest/custom_studies) and [Metainfo](https://www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo) articles.
+- **New how-to guide on metainfo.** Explore our latest [guide](https://www.tradingview.com/charting-library-docs/latest/tutorials/how-to-guides/create-custom-indicator/metainfo-implementation) on how to implement the `metainfo` field when you create a custom indicator. For more information about custom indicators and `metainfo`, refer to the updated [Custom indicators](https://www.tradingview.com/charting-library-docs/latest/custom_studies) and [Metainfo](https://www.tradingview.com/charting-library-docs/latest/custom_studies/metainfo) articles.
- **Bracket orders article added.** Explore our latest article on [bracket orders](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/brackets) in Trading Platform.
- **Account Manager article added.** Refer to [Account Manager](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/account-manager) for more information on creating pages, customizing columns, and configuring the Account Manager behavior.
- **Accessibility article added.** Refer to the new [Accessibility](https://www.tradingview.com/charting-library-docs/latest/getting_started/accessibility) article for information about accessibility features that the library includes.
- **Other documentation updates.** The new documentation version includes:
- - Updated [Resolution](https://www.tradingview.com/charting-library-docs/latest/core_concepts/Resolution) and [Price Scale](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Price-Scale) articles.
+ - Updated [Resolution](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Resolution) and [Price Scale](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Price-Scale) articles.
- A full list of overrides for built-in indicators. Refer to the [Indicator Overrides](https://www.tradingview.com/charting-library-docs/latest/customization/overrides/indicator-overrides#list-of-overrides) article for information.
**Other**
diff --git a/charting_library/bundles/1485.b8e04ff5bf844d3451c6.js b/charting_library/bundles/1485.d2c9ddbfe2c9c5be9408.js
similarity index 65%
rename from charting_library/bundles/1485.b8e04ff5bf844d3451c6.js
rename to charting_library/bundles/1485.d2c9ddbfe2c9c5be9408.js
index 299b3297..027b6a7c 100644
--- a/charting_library/bundles/1485.b8e04ff5bf844d3451c6.js
+++ b/charting_library/bundles/1485.d2c9ddbfe2c9c5be9408.js
@@ -28,20 +28,20 @@ this._metaInfo.subscribe((()=>this._onFormatterPropsChanged())),this._showStudyA
this._legendView?.destroy(),this._floatingTooltipView?.destroy(),this._pineSourceCodeModel?.get()?.destroy(),this._visibleTimeRangeInputs?.destroy(),this._showPineVersionInStatusLine.destroy(),this._alertStateVersion?.destroy(),this._metaInfo.destroy(),this._studyName.destroy(),this._allOwnerSources.destroy(),this._sources.destroy(),this._symbolSource.destroy(),this._status.destroy(),this._compileActiveStatus.destroy(),this._compileErrorStatus.destroy(),this._plotOffsets.destroy(),this._serverPlotOffsets.destroy(),this._properties.destroy(),super.destroy()}setId(e){super.setId(e),this._properties.setNameInOwner((0,Wt.propertyPathForSource)(this))}properties(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.value().linkedToSeries}logs(){return null}logLevelMask(){const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,_.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 new b.WatchedValue(null)}profilingEnabled(){return!!this._properties.childs().inputs.childs().__profile?.value()}enableProfiling(e){this._properties.childs().inputs.childs().__profile?.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}priceScale(e){return e?this._model.mainSeries().priceScale():super.priceScale()}lastValueData(e,t,s){const i={noData:!0},r=this.metaInfo().isPlotForceOverlay(e),n=r?this._model.mainSeries().priceScale():this.priceScale();if(this._model.timeScale().isEmpty()||null===n||n.isEmpty()||this.data().isEmpty())return i;const o=this._model.timeScale().visibleBarsStrictRange(),a=this.firstValue(!0,r);if(null===o||null===a)return i;if(!this._properties.childs().visible.value())return i;const l=this._properties.childs().styles,h=this._properties.childs().ohlcPlots;let c,u;if(l&&l.childs()[e]&&(c=l.childs()[e]),h&&h.childs()[e]&&(c=h.childs()[e]),!c||0===c.childs().display.value())return i;const d=this.metaInfo().plots;for(u=0;ue.id()));if(a.length&&(r.parentSources=a),e){let e=this.data();const t=this._model.timeScale(),s=this._seriesDataRangeToSave(e);null!==s&&(e=e.range(s.firstBar(),s.lastBar())),r.data=e.state(),r.data.symbols=this._resolvedSymbols,r.data.graphics=(0,R.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),r.data.plotOffsets=this._serverPlotOffsets.value()}this.ownerSource()&&(r.ownerSource=this.ownerSource()?.id());for(let e=0;e=0?e:0}}if(r.state?.inputs){const e=r.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete r.state.inputs[e.id],delete r.state.inputs.__log_level,delete r.state.inputs.__profile}const l=this.stateCustomFields();return l&&(r.customFields=l),r}stateCustomFields(){const e=this._compileErrorStatus.value();if(e)return{compileErrorDescription:e.errorDescription}}restoreStateCustomFields(e){const t=e.compileErrorDescription;t&&this.setErrorCompilation([(0,p.ensureDefined)(t.editorError)])}restoreData(e){this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=e.symbols??{},this._graphics=e.graphics?(0,R.loadStudyGraphics)(e.graphics):(0,R.emptyStudyGraphics)(),this._postProcessGraphics(),this._serverPlotOffsets.setValue(e.plotOffsets??{}),this._setStatus({type:xt.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}async stateForAlertAsync(){throw new Error("Not implemented")}idForAlert(){return super.idForAlert()}hasBarColorer(){return this._metaInfo.value().plots.some(L.isBarColorerPlot)}barColorer(){const e=this._metaInfo.value().plots;let t=null;for(let s=e.length-1;s>=0;s--)if((0,L.isBarColorerPlot)(e[s])){const e=new Bt(this,s);null===t?t=e:t.pushBackBarColorer(e)}return t}isSavedInStudyTemplates(){return this._metaInfo.value().inputs.every((e=>"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||ee.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._isStarted=!1,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._id.value()}parentSources(){return this._sources.value()}
parentSourcesVW(){return this._sources}symbolSource(){return this._symbolSource.value()}symbolSourceWV(){return this._symbolSource.readonly()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources.value()[0]:super.ownerSource()}isChildStudy(){return this._sources.value().length>0}hasChildren(){return this._children.length>0}isStarted(){return this._isStarted}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){const e=this._properties.childs();if(this._model.collapsed().value()||!e.visible.value()||!this.isActualInterval())return!1;const t=this.metaInfo();if(t.plots.length>0)for(let s=0;se.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}`;Gt.logError(t),this._restarting=!1,"TooManyStudies"===e?.cause&&(0,S.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}r||void 0!==this._inputs||(this._inputs=this._apiInputs())}replaceData(e,t,s){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(s,t)}inputs(e){const t=(0,n.default)((0,_.clone)(Jt),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);return this._buildInputs(t)}data(){return this._data}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this._moveData(e),this.data().isEmpty()||this._onIndexDiffsApplied(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo.value()}status(){return this._compileActiveStatus.value()??this._compileErrorStatus.value()??this._status.value()}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,s,i,r,n){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const o=JSON.stringify([e,t,s,i,r,n]);if(this._titleStrCache[o])return this._titleStrCache[o];if(this._titleInPartsCache[o])return this._joinTitlesParts(this._titleInPartsCache[o]);const a=this._title(e,t,s,i,r,n)
-;return this._titleStrCache[o]=a,a}titleInParts(e,t,s,i,r){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const n=JSON.stringify([e,t,s,i,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,s,i,r);return this._titleInPartsCache[n]=o,o}inputsInParts(e,t=!0,s,i,r){if(!this._showStudyArgumentsProperty.value()&&e===Y.TitleDisplayTarget.StatusLine)return null;const n=JSON.stringify([e,t,s,i,r]);if(this._inputsInPartsCache[n])return this._inputsInPartsCache[n];const o=[],a=this.metaInfo(),l=this._titleInputs((0,zt.toInputDisplayFlags)(e),i,!0),h=a.inputs.filter((e=>l.hasOwnProperty(e.id))).map((e=>{let t=l[e.id];if("symbol"===e.type){const s=this._properties.childs().inputs.child(e.id)?.value();if(s){const e=this._resolvedSymbolsByInput[s];e&&(t=this._model.symbolAliasService()?.getAliasByProName(e.pro_name)?.aliasName??t)}}return{meta:e,value:t}})),c={};if(h.length>0){if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(l);if(s instanceof us){const n=s.metaInfo(),o=s.title(e,t,{},!0,i,r);if(1===n.plots.length)c[l]=o;else{const e=l.split("$")[1],t=n.plots[parseInt(e)]?.id,s=n.styles&&n.styles[t],i=s&&s.title||t;c[l]=o+": "+i}}}}h.forEach((({meta:e,value:t})=>{let i;i="time"===e.type?new Date(t).toISOString():(0,_.isNumber)(t)?(0,Lt.getNumericFormatter)().format(t):c&&c[t.toString()]||t.toString(),s&&s[i.toString()]&&(i=s[i.toString()]),o.push({title:(0,Ut.getTranslatedInputTitle)(e.name),value:i})}))}return this._inputsInPartsCache[n]=o,o}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},this._inputsInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),this._dataWindowView?.update(e),this._legendView?.update(e),this._statusView?.update(e),
-this._floatingTooltipView?.update(e),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),this._inputsLinesPaneView?.update(e),this._inputsAnchorsPaneView?.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e)))),i||(this._forceOverlaysPaneViews.forEach((t=>t.update(e))),this._forceOverlayLabelPaneViews.forEach((t=>t.update(e))),this._forceOverlayPriceAxisViews.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}studyName(){return this._studyName}nearestIndex(e,t,s){return this.data().search(e,t,s)?.index}getMinFirstBarIndexForPlot(e){const t=this._properties.childs(),s=this._metaInfo,i=t.styles.childs()[e]?.child("showLast")?.value()??t.filledAreasStyle.childs()[e]?.child("showLast")?.value()??s.value().styles?.[e]?.showLast??t.ohlcPlots.childs()[e]?.child("showLast")?.value()??s.value().ohlcPlots?.[e]?.showLast??null;if(null===i)return-1/0;const r=this.data().lastIndex();return null===r?-1/0:r-i+1}guiPlotName(e,t){const s=this._metaInfo.value(),i=s.plots.find((e=>e.id===t));if(void 0!==i){return((0,L.isOhlcPlot)(i)?s.ohlcPlots?.[i.target]?.title:s.styles?.[t]?.title)??this.title(e)}return this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.value().pine}isStandardPine(){return this.isPine()&&A.StudyMetaInfo.isStandardPine(this._metaInfo.value().id)}isLinkedToSeries(){return!0===this._metaInfo.value().linkedToSeries}preferredZOrder(){return!1===this._metaInfo.value().behind_chart?0:null}defaultPlotIdForAlert(){return this._metaInfo.value().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.value().inputs.some((e=>"symbol"===e.type))}currency(){if(null!==this._currencySourceSymbolInfo)return(0,Tt.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){return this._currencySourceSymbolInfo??this.symbolSource()?.symbolInfo()??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}chartFloatingTooltipView(){return this._floatingTooltipView}pineSourceCodeModel(){return Promise.resolve(null)}alertSourceModel(){return this._alertSourceModel}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,
-U.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}onDataUpdated(){return this._dataUpdated}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return this._valuesProvider}legendValuesProvider(){return new E(this,this.model())}tableViewValuesProvider(){return this._tableViewValuesProvider}statusProvider(e){return new $.StudyStatusProvider(this)}chartFloatingTooltipValuesProvider(){return new K(this,this.model())}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()&&W.hideAllIndicators().value()}wasCompletedBefore(){return this._wasCompletedBefore}paneViews(e){const t=this._model.mainPane();if(this.isSourceHidden())return null;if(!e.hasPriceDataSource(this))return e!==t?null:this._forceOverlaysPaneViews;const s=[];return!this._startMovingPoint&&this._wasCompletedBefore&&s.push(...this._paneViews.filter((e=>!e.isForceOverlay?.()))),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&s.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&s.push(this._inputsAnchorsPaneView),e===t&&s.push(...this._forceOverlaysPaneViews),s}labelPaneViews(e){const t=this._model.mainPane();if(this.isSourceHidden()||!e.hasPriceDataSource(this))return this._metaInfo.value().hasForceOverlayPlots()?e!==t?null:this._forceOverlayLabelPaneViews:null;const s=[...this._labelPaneViews];return e===t&&s.push(...this._forceOverlayLabelPaneViews),s}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){if(t!==this.priceScale()&&t===this._model.mainSeries().priceScale()&&!e.hasDataSource(this))return this._forceOverlayPriceAxisViews;const s=this._properties.childs().oldShowLastValue;if(s&&!s.value())return null;let i=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(i=i.concat(this._inputsPriceAxisPaneViews)),t===this._model.mainSeries().priceScale()&&(i=i.concat(this._forceOverlayPriceAxisViews)),e.findTargetPriceAxisViews(this,t,i,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,s,i){this._startMovingPoint=e}move(e,t,s,i){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const s=t;this._updateInputValue(e.logical,s[0]),this._updateInputValue(e.logical,s[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,N.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,{indexesChanged:!1,pricesChanged:!1}}clearData(){this._invalidateLastNonEmptyPlotRowCache(),this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._clearData(),this._graphics instanceof R.LiveStudyGraphics&&this._graphics?.clear(),
-this._serverPlotOffsets.setValue({})})),this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,N.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const s=this.priceScale();if(!t||!s||s.isEmpty())return null;const i=t.firstValue();return null===i?null:s.coordinateToPrice(e,i)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.value().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 s;const i=this.metaInfo().plots.find((t=>t.id===e));if(s=void 0!==i?(0,L.isOhlcPlot)(i)?this._properties.childs().ohlcPlots.childs()[i.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===s)throw new Error(`Study does not contain ${e} plot`);const r=s.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,N.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}setLoadingCompilationActive(e){0}setErrorCompilation(e){0}hasCompileError(){return null!==this._compileErrorStatus.value()}turnaround(e){if(!e)return this._turnaround;return function(e,t){let s=t.turnaround,i=[t];for(;i.length>0;){let e=[];const t=[];i.forEach((s=>{const i=J(s.sourceStudies).sort(q);if(i.length>0){e=e.concat(i);const s=i.map((e=>e.turnaround)).join("_");t.push(s)}})),t.length&&(s=t.join("_")+"_"+s),i=e}return e+"_"+s}(this._series.seriesSource().turnaround(),Z(this))}canHaveChildren(){return this._canHaveChildren=this._canHaveChildren??A.StudyMetaInfo.canHaveChildren(this._metaInfo.value()),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()===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)}calculationTime(){return this._calculationTime.readonly()}contextMenuStatName(){return"IndicatorContextMenu"}metaInfoWV(){return this._metaInfo.readonly()}async patchPropertiesAfterResetDefaults(){throw new Error("Not implemented")}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return!1;this._isStarted=!0,this._incrementTurnaround();const e=(0,p.ensureDefined)(this._inputs);let t;return t=this._chartApi.createStudy(this.sourceId(),this._turnaround,this.isChildStudy()?(0,p.ensureNotNull)(this._sources.value()[0].sourceId()):(0,p.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName.value(),e,this._handler,this._studySpec()),t?(performance.mark(`calculate_study_${this._id.value()}`),!0):(this._isStarted=!1,t)}_stopStudyOnServer(){this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy(this.sourceId()),this._setStatus({type:xt.StudyStatusType.Undefined})),performance.clearMarks(`calculate_study_${this.sourceId()}`),this._isStarted=!1}_modifyStudyOnServer(e,t){this._chartApi.modifyStudy(this.sourceId(),this._turnaround,e,this._handler,t),performance.mark(`calculate_study_${this.sourceId()}`)}_sendNotifyCommand(e,t){this._chartApi.notifyStudy(this.sourceId(),e,t)}_transformData(e){}_plotsDataRange(){const e=this.plots().firstIndex(),t=this.plots().lastIndex();return null!==e&&null!==t?[e,t]:null}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}_allInputsAreValid(){if(null===this._visibleTimeRangeInputs?.value())return!1;for(const e of this._metaInfo.value().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.value().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 i=this._calcSources(),r=this._metaInfo.value(),n=os(),o=()=>{for(const s of r.inputs){if("source"!==s.type)continue;const i=e[s.id].v,r=t[s.id].v;if(i!==r){(0,p.ensureDefined)(this._properties.childs().inputs.child(s.id)).setValue(r)}}}
-;if(this.isStarted()&&this._chartApi.isConnected().value()&&n>0&&!this._chartApi.canCreateStudy(this._studySpec(!0),!0).success){const e=window.user.pro_plan,t="pro_premium_expert"===e||"pro_premium_expert_trial"===e;return createGoProDialog({feature:"studyOnStudy",hideLimitTable:t,actions:e&&t?[{text:m.t(null,void 0,s(15462)),action:PredefinedAction.Close}]:void 0}),void o()}this._inputs=e;let a=!1;const l=Object.values(Q.RangeDependentStudyInputNames);for(const s of Object.keys(e))if(JSON.stringify(e[s])!==JSON.stringify(t[s])&&!l.includes(s)){a=!0;break}this._incrementTurnaround(),a&&this.disablePriceRangeReady();try{await this._updateParentSources(i,n,!0),this._modifyStudyOnServer(e,n),this._studyModified=!0}catch(e){Gt.logError(`Error applying parent sources: ${e}`),o()}this.invalidateTitleCache()}_createPriceAxisView(e){return new Rt.StudyPriceAxisView(this,{plotIndex:e})}_createPriceLineAxisView(e){return new Ot.StudyPriceLineAxisView(this,e)}_createStudyPlotPaneView(e){return new lt.StudyPlotPaneView(this,this._series,this._model,e)}_createViews(){this._priceAxisViewsBase=[],this._forceOverlayPriceAxisViews=[],this._priceLinesAxisViews=[],this._paneViews=[],this._forceOverlaysPaneViews=[],this._labelPaneViews=[],this._forceOverlayLabelPaneViews=[];const e=new Set,t=this.metaInfo(),s=Boolean(t.usePlotsZOrder),i=new Map,r=this._properties.childs();if(r.filledAreasStyle&&t.filledAreas)for(let e=0;e{const n=r.bands.childs()[t];if(n&&n.childs().visible.value()){const t=new St(n,this),r=s?(0,p.ensureDefined)(e.zorder):i.size;rs(r,i),i.set(r,{paneViews:[t]})}})),r.bandsBackground&&((0,p.assert)(!s,"'usePlotsZOrder' flag does not supported"),i.set(i.size,{paneViews:[new wt(this)]}));const n=this._paneViews,o=this._forceOverlaysPaneViews;this._createGraphicsPaneViews().then((e=>{for(let t=0;te-t));for(let e=0;e0){const t=(0,p.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);if(this._model.recalculatePane(r,(0,N.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:i??void 0,nonSeriesOnly:0===e.length})),this._updateSources(),e.length){const t=e[e.length-1].index,s=e[0].index;this._dataRangeUpdated.fire({type:"partial",startIndex:s,endIndex:t})}else this.data().isEmpty()&&this._dataRangeUpdated.fire({type:"full"})}_titleInputs(e,t,s){
-return this.inputs(this._titleInputsOptions(e,t,s))}_titleInputsOptions(e,t,s){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],skippedInputs:this._skippedTitleInputs(),noExchanges:t,noResolution:s,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:Qt,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,R.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,R.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){let t=e;if(t){const e=this._model.symbolAliasService()?.getAliasByProName(t.pro_name);e&&(t=(0,r.default)(t),(0,n.default)(t,e.formattingOptions??{}))}this._recreatePlotsFormatters(t),this._formatter=this._tryCreateFormatter(t),this._defaultFormatter=this._tryCreateDefaultFormatter(t),this._formatterChanged.fire();const s=this.priceScale();null!==s&&s.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,s,i,r,n){const o=this._titleInParts(e,t,s,i,r,n);return this._joinTitlesParts(o)}_postProcessPriceRange(e,t){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new M.PriceRange(e.minValue()-t,e.maxValue()+t)}const s=t.targetPriceScale;return s&&s.isLog()&&e?new M.PriceRange(s.priceToLogical(e.minValue()),s.priceToLogical(e.maxValue())):e}_titleInParts(e,t=!0,i,r,n,o){const a=[m.t(this.name(t),{context:"study"},s(83477))];let l=[];if(!r){const s=this._getMTFResolutionInputTitle();null!==s&&s.length>0&&a.push(s);l=(this.inputsInParts(e,t,i,n,o)??[]).map((e=>e.value))}return[a.join(" · "),l]}_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},s=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=s),t.session=this.sessionId(),t}_onSymbolResolved(e,t,s){this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){const s=this.isFailed();this._status.setValue(e),e.type===xt.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==xt.StudyStatusType.Error&&e.type!==xt.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(this._statusView?.update((0,N.sourceChangeEvent)(this.id())),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.value();this._recreatePaneViews(),(0,Nt.emit)("study_properties_changed",this._id.value())}_lastNonEmptyPlotRow(e){if(!(0,_.isInteger)(e))return Gt.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let t=this._lastNonEmptyPlotRowCache[e]??null;if(null!==t)return t;return t=this.data().findLast(((t,s)=>void 0!==s[e]),1e3),null===t?null:(this._lastNonEmptyPlotRowCache[e]=t,t)}_onCurrencyChanged(){"alwaysOff"!==(0,At.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(),s=((0,p.ensureDefined)((0,_.clone)(this._inputs)),this._apiInputs()),i=JSON.stringify(s),r=i!==JSON.stringify(this._inputs);if(e&&t)try{if(await this._allSymbolsAreResolved(),i!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(r&&this.disablePriceRangeReady());r&&await this._changeInputsImpl(s,(0,p.ensureDefined)((0,_.clone)(this._inputs)))}catch(e){Gt.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(e&&!t&&this.stop(!0),!e&&t&&this.start(!0),r){const e=this._calcSources(),t=os(this._metaInfo.value());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,s){const i=this._metaInfo.value(),r=this.properties().childs(),n=new Set,o=i.filledAreas||[];for(let e=0;e!(0,L.isPlotWithTechnicalValues)(e))).filter((e=>i.isPlotForceOverlay(e.id)?s.targetPriceScale===this._model.mainSeries().priceScale():s.targetPriceScale===this.priceScale()&&!s.forceOverlayOnly)).filter((e=>n.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((s,i)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,s,i)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){return this._sources.value()[0]??this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return hs(this._metaInfo.value().format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_tryCreateDefaultFormatter(e){return this._tryCreateFormatter(e)}_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){
-return this.properties()?.childs()?.styles?.childs()?.[e]?.childs()?.display?.value()}_onStudyError(e){performance.clearMarks(`calculate_study_${this.sourceId()}`),this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_onStudyCompleted(e){if(performance.getEntriesByName(`calculate_study_${this.sourceId()}`).length){try{const e=performance.measure(`measure_study_${this.sourceId()}`,`calculate_study_${this.sourceId()}`);this._calculationTime.setValue(e.duration)}catch(e){Gt.logError("Error during measuring study calculation time")}performance.clearMarks(`calculate_study_${this.sourceId()}`),performance.clearMeasures(`measure_study_${this.sourceId()}`)}this._studyModified&&(this.clearData(),this._studyModified=!1),this._setStatus({type:xt.StudyStatusType.Completed}),this._statusView?.update((0,N.sourceChangeEvent)(this.id()));const t=this._model.paneForSource(this);this._model.recalculatePane(t,(0,N.sourceChangeEvent)(this.id())),this._updateSources();const s=Vt.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_clearData(){this._data.clear(),this._dataRangeUpdated.fire({type:"full"})}_moveData(e){this.data().move(e)}_defaultErrorTitle(){return"Runtime error"}_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.value().plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,p.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,p.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(e){this._setStatus({type:xt.StudyStatusType.Loading,startTime:Date.now()}),this._statusView?.update((0,N.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_handleStudyError(e){this.clearData(),this._setStatus(e),this._statusView?.update((0,N.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_createStudyError(e){let t;return t=(0,_.isString)(e)?{error:this._getStudyErrorText(e),title:e.includes("study_not_auth")?"Access error":this._defaultErrorTitle()}:{...e,title:e.title??this._defaultErrorTitle()},(0,xt.createStudyError)(t,this.symbolSource().symbolInfo()?.exchange)}_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(){let e=null;const t=this._priceScaleByProperties()??this._priceScaleByMetaInfo();null!==t&&(e=1/t),this._priceStep!==e&&(this._priceStep=e,this._priceStepChanged.fire())}
-_recreatePlotsFormatters(e){this._plotFormatters.clear();const t=this._metaInfo.value(),s=t.format,i=this._priceScaleByProperties(),r=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,n]of Object.entries(t.ohlcPlots??{}))if(n?.format){const t=hs(ls({...s,...n?.format}),i,r,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const[e,n]of Object.entries(t.styles??{}))if(n?.format){const t=hs(ls({...s,...n?.format}),i,r,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const e of t.plots)if((0,L.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;ti),(()=>i)).then(this._onDataUnpacked.bind(this,e,t.indexes,s)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let s=!1;for(const i of e){const e=this._getSymbolForResolve(i);if(""!==e)if(this._resolvedSymbols[e])s=!0;else{const s=this._resolveSymbol(e,i);t.push(s)}}if(0===t.length){const e=Promise.resolve();return s?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:xt.StudyStatusType.Error,errorDescription:{error:$t}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let s=this._pendingResolveSymbols.get(e);return void 0!==s||(s=new Promise(((s,i)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,j.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:xt.StudyStatusType.Undefined});const i=r.params[1];this._resolvedSymbols[e]=i,this._resolvedSymbolsByInput[t]=i,this.invalidateTitleCache(!0),this._onSymbolResolved(e,t,i),s();break}case"symbol_error":if(this._setStatus({type:xt.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===G.permissionDenied&&r.params[2]){if(r.params[2]!==G.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(s);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(s)}0,i(t)}}))})),this._pendingResolveSymbols.set(e,s)),s}_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 s={count:1,additional:t};telemetry.sendChartReport(e,s)}_getTelemetryAdditionalData(){let e="";const t=this._metaInfo.value();return t.pine&&t.pine.version&&t.shortId.indexOf("USER")>=0&&(e="_v"+t.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:t.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.value();if(!t.bands)return null;for(let s=0;s=0?t:e}return e}if(r.isTVScript||r.pine){if("text"===s)return r.defaults.inputs?.text??"";if("pineId"===s)return r.scriptIdPart
-;if("pineVersion"===s)return r.pine?r.pine.version:"-1";if("color"===e.type&&r.isRGB){const e=i.inputs.childs()[s].value();return(0,I.colorToInteger)(e)}if("price"===e.type){const e=i.inputs.childs()[s].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return i.inputs.childs()[s].value()}_getStudyIdWithLatestVersion(){return A.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];e.push(this._id.value());const t=this._metaInfo.value();return e.push(t.fullId),e.push(t.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){return!1}_hasAlertConditions(){return!1}_hasAlertFunction(){return!1}async _updateParentSources(e,t,s){if(this._sources.value().forEach((e=>e.unsetChild(this))),s&&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.value().length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,s=(0,p.ensureNotNull)(e.priceScale());if(t!==s){const t=this._model.paneForSource(this),i=(0,p.ensureNotNull)(this._model.paneForSource(e));t===i&&i.move(this,s,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return A.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.value().inputs,e).map((e=>{if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;return this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e))??null})).filter(_.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,s,i){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(i),this._transformData(e);const r=this._mergeData(e);null!==i&&(i.indexes_replace?((0,p.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds))),this._onDataUpdated(e,i,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady()}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._serverPlotOffsets.value();this._serverPlotOffsets.setValue(e&&e.offsets||{}),(0,i.default)(t,this._serverPlotOffsets.value())||this.updateAllViews((0,N.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,s,i){const r=i.id,n=this._properties.childs().styles.childs()[r],o=(0,L.isShapesPlot)(i)||(0,L.isCharsPlot)(i);s.useMainSeriesRange=s.useMainSeriesRange||(0,L.isArrowsPlot)(i);let a=(0,L.isLinePlot)(i)||(0,L.isOhlcPlot)(i);if(o){const e=(0,p.ensureDefined)(n).childs().location.value(),t=[D.MarkLocation.Absolute,D.MarkLocation.Top,D.MarkLocation.Bottom].indexOf(e)<0;s.useMainSeriesRange=s.useMainSeriesRange||o&&t,a=a||e===D.MarkLocation.Absolute}if(!a)return s;const l={name:r,offset:this.offset(r)},h=n.childs().plottype.value();if(!this._skipHistogramBaseOnAutoScale()&&[L.LineStudyPlotStyle.Histogram,L.LineStudyPlotStyle.Columns,L.LineStudyPlotStyle.Area].indexOf(h)>=0){
-const i=(this._metaInfo.value().styles??{})?.[r]?.histogramBase;if(void 0===i)return s;const n=this.data().minMaxOnRangeCached(e,t,[l]);return(0,_.isNumber)(i)&&null!==n&&(s.baseValueMinMax=(0,T.mergeMinMax)(s.baseValueMinMax,{min:i,max:i}),s.baseValueMinMax=(0,T.mergeMinMax)(s.baseValueMinMax,n)),s}return s.fields.push(l),s}async _onSourceInputChanged(){if(!this.isStarted()){this._calcSources();Kt}}_buildInputs(e){(0,p.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){Gt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((s=>{null!=t[s]&&(e[s]=t[s])})),e}{const e=[];return Object.keys(t).forEach((s=>{null!=t[s]&&e.push(t[s])})),e}}_prepareInput(e,t){const s=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?s:{v:s,f:!0,t:e.type}}_plotsForAlert(){return[]}_formatterStateForAlert(){try{const e=this.formatter();return FormattersSerializer.isSerializable(e)?FormattersSerializer.serialize(e):null}catch{return null}}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,Ct.isActualInterval)(this._series.intervalObj().value(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this._sources.value();for(const t of e)if(t instanceof us){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const s=this._properties.childs().inputs.childs();if(s[t.id])if("price"===t.type)s[t.id].setValue(e.price);else if("time"===t.type){const i=this._model.timeScale().indexToTimePoint(e.index);null!==i&&s[t.id].setValue(1e3*i)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()]??null)}_initializeCurrencySource(){const e=this.metaInfo(),t="symbolInputSymbolSource"===e.symbolSource?.type&&e.symbolSource?.inputId,s=e.inputs.find((e=>e.id===t));if("string"==typeof t&&"symbol"===s?.type&&e.is_price_study){const e=this._properties.childs().inputs.childs()[t];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,N.sourceChangeEvent)(this.id()))}async _pinePatchProps(){throw new Error("Not implemented")}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,p.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const s of t)if((0,p.assert)(e.hasOwnProperty(s),`key '${s}' should exist in study inputs`),(0,
-p.ensureDefined)(this._oldStudyInputs)[s]!==e[s])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 s={first_visible_bar_time:e.firstVisibleBarTime,last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},i=this.metaInfo().inputs,r=[];for(const e of i)s.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(s[e]);t&&r.length>0&&n.fireChanged()}_getStudyErrorText(e){const t=e.split(":",2)[0];return decodeURIComponent(t)}_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,s=(0,_.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return s||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,_.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||Gt.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,p.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_studySpec(e){return{id:this._metaInfo.value().id,child:e??this.isChildStudy(),fundamental:!1}}_onFormatterPropsChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources.setValue(e),this._onParentSourcesChanges.fire()}async _awaitForMetaInfo(){const e={resolver:()=>{}},t=()=>e.resolver();try{await Promise.race([new Promise(((e,t)=>{setTimeout((()=>t(new Error("Timeout"))),3e3)})),await new Promise((s=>{e.resolver=s,this.metaInfoWV().subscribe(t)}))])}catch(e){throw e}finally{this.metaInfoWV().unsubscribe(t)}}}},51752:(e,t,s)=>{s.d(t,{plotShapesData:()=>r});var i=s(11542);const r={shape_arrow_down:{guiName:i.t(null,void 0,s(34247)),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:i.t(null,void 0,s(45523)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:i.t(null,void 0,s(91944)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:i.t(null,void 0,s(6969)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:i.t(null,void 0,s(15179)),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:i.t(null,void 0,s(33885)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{
-guiName:i.t(null,void 0,s(85924)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:i.t(null,void 0,s(49857)),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:i.t(null,void 0,s(66205)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:i.t(null,void 0,s(76152)),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:i.t(null,void 0,s(21236)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:i.t(null,void 0,s(11316)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}}}]);
\ No newline at end of file
+;return this._titleStrCache[o]=a,a}titleInParts(e,t,s,i,r){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const n=JSON.stringify([e,t,s,i,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,s,i,r);return this._titleInPartsCache[n]=o,o}inputsInParts(e,t=!0,s,i,r){const n=!this._showStudyArgumentsProperty.value(),o=ee.enabled("always_show_study_symbol_input_values_in_legend"),a=n&&o;if(n&&!o&&e===Y.TitleDisplayTarget.StatusLine)return null;const l=JSON.stringify([e,t,s,i,r]);if(this._inputsInPartsCache[l])return this._inputsInPartsCache[l];const h=[],c=this.metaInfo(),u=this._titleInputs((0,zt.toInputDisplayFlags)(e),i,!0),d=c.inputs.filter((e=>u.hasOwnProperty(e.id)&&(!a||"symbol"===e.type))).map((e=>{let t=u[e.id];if("symbol"===e.type){const s=this._properties.childs().inputs.child(e.id)?.value();if(s){const e=this._resolvedSymbolsByInput[s];e&&(t=this._model.symbolAliasService()?.getAliasByProName(e.pro_name)?.aliasName??t)}}return{meta:e,value:t}})),f={};if(d.length>0){if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(a);if(s instanceof us){const n=s.metaInfo(),o=s.title(e,t,{},!0,i,r);if(1===n.plots.length)f[a]=o;else{const e=a.split("$")[1],t=n.plots[parseInt(e)]?.id,s=n.styles&&n.styles[t],i=s&&s.title||t;f[a]=o+": "+i}}}}d.forEach((({meta:e,value:t})=>{let i;i="time"===e.type?new Date(t).toISOString():(0,_.isNumber)(t)?(0,Lt.getNumericFormatter)().format(t):f&&f[t.toString()]||t.toString(),s&&s[i.toString()]&&(i=s[i.toString()]),h.push({title:(0,Ut.getTranslatedInputTitle)(e.name),value:i})}))}return this._inputsInPartsCache[l]=h,h}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},this._inputsInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),
+this._dataWindowView?.update(e),this._legendView?.update(e),this._statusView?.update(e),this._floatingTooltipView?.update(e),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),this._inputsLinesPaneView?.update(e),this._inputsAnchorsPaneView?.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e)))),i||(this._forceOverlaysPaneViews.forEach((t=>t.update(e))),this._forceOverlayLabelPaneViews.forEach((t=>t.update(e))),this._forceOverlayPriceAxisViews.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}studyName(){return this._studyName}nearestIndex(e,t,s){return this.data().search(e,t,s)?.index}getMinFirstBarIndexForPlot(e){const t=this._properties.childs(),s=this._metaInfo,i=t.styles.childs()[e]?.child("showLast")?.value()??t.filledAreasStyle.childs()[e]?.child("showLast")?.value()??s.value().styles?.[e]?.showLast??t.ohlcPlots.childs()[e]?.child("showLast")?.value()??s.value().ohlcPlots?.[e]?.showLast??null;if(null===i)return-1/0;const r=this.data().lastIndex();return null===r?-1/0:r-i+1}guiPlotName(e,t){const s=this._metaInfo.value(),i=s.plots.find((e=>e.id===t));if(void 0!==i){return((0,L.isOhlcPlot)(i)?s.ohlcPlots?.[i.target]?.title:s.styles?.[t]?.title)??this.title(e)}return this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.value().pine}isStandardPine(){return this.isPine()&&A.StudyMetaInfo.isStandardPine(this._metaInfo.value().id)}isLinkedToSeries(){return!0===this._metaInfo.value().linkedToSeries}preferredZOrder(){return!1===this._metaInfo.value().behind_chart?0:null}defaultPlotIdForAlert(){return this._metaInfo.value().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.value().inputs.some((e=>"symbol"===e.type))}currency(){if(null!==this._currencySourceSymbolInfo)return(0,Tt.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){return this._currencySourceSymbolInfo??this.symbolSource()?.symbolInfo()??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}chartFloatingTooltipView(){return this._floatingTooltipView}pineSourceCodeModel(){return Promise.resolve(null)}alertSourceModel(){return this._alertSourceModel}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){
+return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,U.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}onDataUpdated(){return this._dataUpdated}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return this._valuesProvider}legendValuesProvider(){return new E(this,this.model())}tableViewValuesProvider(){return this._tableViewValuesProvider}statusProvider(e){return new $.StudyStatusProvider(this)}chartFloatingTooltipValuesProvider(){return new K(this,this.model())}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()&&W.hideAllIndicators().value()}wasCompletedBefore(){return this._wasCompletedBefore}paneViews(e){const t=this._model.mainPane();if(this.isSourceHidden())return null;if(!e.hasPriceDataSource(this))return e!==t?null:this._forceOverlaysPaneViews;const s=[];return!this._startMovingPoint&&this._wasCompletedBefore&&s.push(...this._paneViews.filter((e=>!e.isForceOverlay?.()))),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&s.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&s.push(this._inputsAnchorsPaneView),e===t&&s.push(...this._forceOverlaysPaneViews),s}labelPaneViews(e){const t=this._model.mainPane();if(this.isSourceHidden()||!e.hasPriceDataSource(this))return this._metaInfo.value().hasForceOverlayPlots()?e!==t?null:this._forceOverlayLabelPaneViews:null;const s=[...this._labelPaneViews];return e===t&&s.push(...this._forceOverlayLabelPaneViews),s}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){if(t!==this.priceScale()&&t===this._model.mainSeries().priceScale()&&!e.hasDataSource(this))return this._forceOverlayPriceAxisViews;const s=this._properties.childs().oldShowLastValue;if(s&&!s.value())return null;let i=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(i=i.concat(this._inputsPriceAxisPaneViews)),t===this._model.mainSeries().priceScale()&&(i=i.concat(this._forceOverlayPriceAxisViews)),e.findTargetPriceAxisViews(this,t,i,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,s,i){this._startMovingPoint=e}move(e,t,s,i){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const s=t;this._updateInputValue(e.logical,s[0]),this._updateInputValue(e.logical,s[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,N.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,{indexesChanged:!1,pricesChanged:!1}}clearData(){this._invalidateLastNonEmptyPlotRowCache(),
+this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._clearData(),this._graphics instanceof R.LiveStudyGraphics&&this._graphics?.clear(),this._serverPlotOffsets.setValue({})})),this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,N.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const s=this.priceScale();if(!t||!s||s.isEmpty())return null;const i=t.firstValue();return null===i?null:s.coordinateToPrice(e,i)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.value().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 s;const i=this.metaInfo().plots.find((t=>t.id===e));if(s=void 0!==i?(0,L.isOhlcPlot)(i)?this._properties.childs().ohlcPlots.childs()[i.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===s)throw new Error(`Study does not contain ${e} plot`);const r=s.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,N.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}setLoadingCompilationActive(e){0}setErrorCompilation(e){0}hasCompileError(){return null!==this._compileErrorStatus.value()}turnaround(e){if(!e)return this._turnaround;return function(e,t){let s=t.turnaround,i=[t];for(;i.length>0;){let e=[];const t=[];i.forEach((s=>{const i=J(s.sourceStudies).sort(q);if(i.length>0){e=e.concat(i);const s=i.map((e=>e.turnaround)).join("_");t.push(s)}})),t.length&&(s=t.join("_")+"_"+s),i=e}return e+"_"+s}(this._series.seriesSource().turnaround(),Z(this))}canHaveChildren(){return this._canHaveChildren=this._canHaveChildren??A.StudyMetaInfo.canHaveChildren(this._metaInfo.value()),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()===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)}calculationTime(){return this._calculationTime.readonly()}contextMenuStatName(){return"IndicatorContextMenu"}metaInfoWV(){return this._metaInfo.readonly()}async patchPropertiesAfterResetDefaults(){throw new Error("Not implemented")}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return!1;this._isStarted=!0,this._incrementTurnaround();const e=(0,p.ensureDefined)(this._inputs);let t;return t=this._chartApi.createStudy(this.sourceId(),this._turnaround,this.isChildStudy()?(0,p.ensureNotNull)(this._sources.value()[0].sourceId()):(0,p.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName.value(),e,this._handler,this._studySpec()),t?(performance.mark(`calculate_study_${this._id.value()}`),!0):(this._isStarted=!1,t)}_stopStudyOnServer(){this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy(this.sourceId()),this._setStatus({type:xt.StudyStatusType.Undefined})),performance.clearMarks(`calculate_study_${this.sourceId()}`),this._isStarted=!1}_modifyStudyOnServer(e,t){this._chartApi.modifyStudy(this.sourceId(),this._turnaround,e,this._handler,t),performance.mark(`calculate_study_${this.sourceId()}`)}_sendNotifyCommand(e,t){this._chartApi.notifyStudy(this.sourceId(),e,t)}_transformData(e){}_plotsDataRange(){const e=this.plots().firstIndex(),t=this.plots().lastIndex();return null!==e&&null!==t?[e,t]:null}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}_allInputsAreValid(){if(null===this._visibleTimeRangeInputs?.value())return!1;for(const e of this._metaInfo.value().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.value().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 i=this._calcSources(),r=this._metaInfo.value(),n=os(),o=()=>{for(const s of r.inputs){if("source"!==s.type)continue;const i=e[s.id].v,r=t[s.id].v;if(i!==r){(0,
+p.ensureDefined)(this._properties.childs().inputs.child(s.id)).setValue(r)}}};if(this.isStarted()&&this._chartApi.isConnected().value()&&n>0&&!this._chartApi.canCreateStudy(this._studySpec(!0),!0).success){const e=window.user.pro_plan,t="pro_premium_expert"===e||"pro_premium_expert_trial"===e;return createGoProDialog({feature:"studyOnStudy",hideLimitTable:t,actions:e&&t?[{text:m.t(null,void 0,s(15462)),action:PredefinedAction.Close}]:void 0}),void o()}this._inputs=e;let a=!1;const l=Object.values(Q.RangeDependentStudyInputNames);for(const s of Object.keys(e))if(JSON.stringify(e[s])!==JSON.stringify(t[s])&&!l.includes(s)){a=!0;break}this._incrementTurnaround(),a&&this.disablePriceRangeReady();try{await this._updateParentSources(i,n,!0),this._modifyStudyOnServer(e,n),this._studyModified=!0}catch(e){Gt.logError(`Error applying parent sources: ${e}`),o()}this.invalidateTitleCache()}_createPriceAxisView(e){return new Rt.StudyPriceAxisView(this,{plotIndex:e})}_createPriceLineAxisView(e){return new Ot.StudyPriceLineAxisView(this,e)}_createStudyPlotPaneView(e){return new lt.StudyPlotPaneView(this,this._series,this._model,e)}_createViews(){this._priceAxisViewsBase=[],this._forceOverlayPriceAxisViews=[],this._priceLinesAxisViews=[],this._paneViews=[],this._forceOverlaysPaneViews=[],this._labelPaneViews=[],this._forceOverlayLabelPaneViews=[];const e=new Set,t=this.metaInfo(),s=Boolean(t.usePlotsZOrder),i=new Map,r=this._properties.childs();if(r.filledAreasStyle&&t.filledAreas)for(let e=0;e{const n=r.bands.childs()[t];if(n&&n.childs().visible.value()){const t=new St(n,this),r=s?(0,p.ensureDefined)(e.zorder):i.size;rs(r,i),i.set(r,{paneViews:[t]})}})),r.bandsBackground&&((0,p.assert)(!s,"'usePlotsZOrder' flag does not supported"),i.set(i.size,{paneViews:[new wt(this)]}));const n=this._paneViews,o=this._forceOverlaysPaneViews;this._createGraphicsPaneViews().then((e=>{for(let t=0;te-t));for(let e=0;e0){const t=(0,p.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);if(this._model.recalculatePane(r,(0,N.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:i??void 0,nonSeriesOnly:0===e.length})),this._updateSources(),e.length){const t=e[e.length-1].index,s=e[0].index;this._dataRangeUpdated.fire({type:"partial",startIndex:s,
+endIndex:t})}else this.data().isEmpty()&&this._dataRangeUpdated.fire({type:"full"})}_titleInputs(e,t,s){return this.inputs(this._titleInputsOptions(e,t,s))}_titleInputsOptions(e,t,s){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],skippedInputs:this._skippedTitleInputs(),noExchanges:t,noResolution:s,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:Qt,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,R.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,R.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){let t=e;if(t){const e=this._model.symbolAliasService()?.getAliasByProName(t.pro_name);e&&(t=(0,r.default)(t),(0,n.default)(t,e.formattingOptions??{}))}this._recreatePlotsFormatters(t),this._formatter=this._tryCreateFormatter(t),this._defaultFormatter=this._tryCreateDefaultFormatter(t),this._formatterChanged.fire();const s=this.priceScale();null!==s&&s.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,s,i,r,n){const o=this._titleInParts(e,t,s,i,r,n);return this._joinTitlesParts(o)}_postProcessPriceRange(e,t){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new M.PriceRange(e.minValue()-t,e.maxValue()+t)}const s=t.targetPriceScale;return s&&s.isLog()&&e?new M.PriceRange(s.priceToLogical(e.minValue()),s.priceToLogical(e.maxValue())):e}_titleInParts(e,t=!0,i,r,n,o){const a=[m.t(this.name(t),{context:"study"},s(83477))];let l=[];if(!r||ee.enabled("always_show_study_symbol_input_values_in_legend")){const s=this._getMTFResolutionInputTitle();null!==s&&s.length>0&&a.push(s);l=(this.inputsInParts(e,t,i,n,o)??[]).map((e=>e.value))}return[a.join(" · "),l]}_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},s=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=s),t.session=this.sessionId(),t}_onSymbolResolved(e,t,s){this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){const s=this.isFailed();this._status.setValue(e),e.type===xt.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==xt.StudyStatusType.Error&&e.type!==xt.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(this._statusView?.update((0,
+N.sourceChangeEvent)(this.id())),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.value();this._recreatePaneViews(),(0,Nt.emit)("study_properties_changed",this._id.value())}_lastNonEmptyPlotRow(e){if(!(0,_.isInteger)(e))return Gt.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let t=this._lastNonEmptyPlotRowCache[e]??null;if(null!==t)return t;return t=this.data().findLast(((t,s)=>void 0!==s[e]),1e3),null===t?null:(this._lastNonEmptyPlotRowCache[e]=t,t)}_onCurrencyChanged(){"alwaysOff"!==(0,At.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(),s=((0,p.ensureDefined)((0,_.clone)(this._inputs)),this._apiInputs()),i=JSON.stringify(s),r=i!==JSON.stringify(this._inputs);if(e&&t)try{if(await this._allSymbolsAreResolved(),i!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(r&&this.disablePriceRangeReady());r&&await this._changeInputsImpl(s,(0,p.ensureDefined)((0,_.clone)(this._inputs)))}catch(e){Gt.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(e&&!t&&this.stop(!0),!e&&t&&this.start(!0),r){const e=this._calcSources(),t=os(this._metaInfo.value());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,s){const i=this._metaInfo.value(),r=this.properties().childs(),n=new Set,o=i.filledAreas||[];for(let e=0;e!(0,L.isPlotWithTechnicalValues)(e))).filter((e=>i.isPlotForceOverlay(e.id)?s.targetPriceScale===this._model.mainSeries().priceScale():s.targetPriceScale===this.priceScale()&&!s.forceOverlayOnly)).filter((e=>n.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((s,i)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,s,i)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){return this._sources.value()[0]??this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return hs(this._metaInfo.value().format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_tryCreateDefaultFormatter(e){return this._tryCreateFormatter(e)}_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){return this.properties()?.childs()?.styles?.childs()?.[e]?.childs()?.display?.value()}_onStudyError(e){performance.clearMarks(`calculate_study_${this.sourceId()}`),this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_onStudyCompleted(e){if(performance.getEntriesByName(`calculate_study_${this.sourceId()}`).length){try{const e=performance.measure(`measure_study_${this.sourceId()}`,`calculate_study_${this.sourceId()}`);this._calculationTime.setValue(e.duration)}catch(e){Gt.logError("Error during measuring study calculation time")}performance.clearMarks(`calculate_study_${this.sourceId()}`),performance.clearMeasures(`measure_study_${this.sourceId()}`)}this._studyModified&&(this.clearData(),this._studyModified=!1),this._setStatus({type:xt.StudyStatusType.Completed}),this._statusView?.update((0,N.sourceChangeEvent)(this.id()));const t=this._model.paneForSource(this);this._model.recalculatePane(t,(0,N.sourceChangeEvent)(this.id())),this._updateSources();const s=Vt.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_clearData(){this._data.clear(),this._dataRangeUpdated.fire({type:"full"})}_moveData(e){this.data().move(e)}_defaultErrorTitle(){return"Runtime error"}_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.value().plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,p.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,p.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(e){this._setStatus({type:xt.StudyStatusType.Loading,startTime:Date.now()}),this._statusView?.update((0,N.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_handleStudyError(e){this.clearData(),this._setStatus(e),this._statusView?.update((0,N.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_createStudyError(e){let t;return t=(0,_.isString)(e)?{error:this._getStudyErrorText(e),title:e.includes("study_not_auth")?"Access error":this._defaultErrorTitle()}:{...e,title:e.title??this._defaultErrorTitle()},(0,xt.createStudyError)(t,this.symbolSource().symbolInfo()?.exchange)}_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(){let e=null
+;const t=this._priceScaleByProperties()??this._priceScaleByMetaInfo();null!==t&&(e=1/t),this._priceStep!==e&&(this._priceStep=e,this._priceStepChanged.fire())}_recreatePlotsFormatters(e){this._plotFormatters.clear();const t=this._metaInfo.value(),s=t.format,i=this._priceScaleByProperties(),r=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,n]of Object.entries(t.ohlcPlots??{}))if(n?.format){const t=hs(ls({...s,...n?.format}),i,r,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const[e,n]of Object.entries(t.styles??{}))if(n?.format){const t=hs(ls({...s,...n?.format}),i,r,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const e of t.plots)if((0,L.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;ti),(()=>i)).then(this._onDataUnpacked.bind(this,e,t.indexes,s)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let s=!1;for(const i of e){const e=this._getSymbolForResolve(i);if(""!==e)if(this._resolvedSymbols[e])s=!0;else{const s=this._resolveSymbol(e,i);t.push(s)}}if(0===t.length){const e=Promise.resolve();return s?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:xt.StudyStatusType.Error,errorDescription:{error:$t}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let s=this._pendingResolveSymbols.get(e);return void 0!==s||(s=new Promise(((s,i)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,j.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:xt.StudyStatusType.Undefined});const i=r.params[1];this._resolvedSymbols[e]=i,this._resolvedSymbolsByInput[t]=i,this.invalidateTitleCache(!0),this._onSymbolResolved(e,t,i),s();break}case"symbol_error":if(this._setStatus({type:xt.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===G.permissionDenied&&r.params[2]){if(r.params[2]!==G.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(s);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(s)}0,i(t)}}))})),this._pendingResolveSymbols.set(e,s)),s}_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 s={count:1,additional:t};telemetry.sendChartReport(e,s)}_getTelemetryAdditionalData(){let e="";const t=this._metaInfo.value();return t.pine&&t.pine.version&&t.shortId.indexOf("USER")>=0&&(e="_v"+t.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:t.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.value();if(!t.bands)return null;for(let s=0;s=0?t:e}
+return e}if(r.isTVScript||r.pine){if("text"===s)return r.defaults.inputs?.text??"";if("pineId"===s)return r.scriptIdPart;if("pineVersion"===s)return r.pine?r.pine.version:"-1";if("color"===e.type&&r.isRGB){const e=i.inputs.childs()[s].value();return(0,I.colorToInteger)(e)}if("price"===e.type){const e=i.inputs.childs()[s].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return i.inputs.childs()[s].value()}_getStudyIdWithLatestVersion(){return A.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];e.push(this._id.value());const t=this._metaInfo.value();return e.push(t.fullId),e.push(t.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){return!1}_hasAlertConditions(){return!1}_hasAlertFunction(){return!1}async _updateParentSources(e,t,s){if(this._sources.value().forEach((e=>e.unsetChild(this))),s&&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.value().length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,s=(0,p.ensureNotNull)(e.priceScale());if(t!==s){const t=this._model.paneForSource(this),i=(0,p.ensureNotNull)(this._model.paneForSource(e));t===i&&i.move(this,s,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return A.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.value().inputs,e).map((e=>{if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;return this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e))??null})).filter(_.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,s,i){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(i),this._transformData(e);const r=this._mergeData(e);null!==i&&(i.indexes_replace?((0,p.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds))),this._onDataUpdated(e,i,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady()}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._serverPlotOffsets.value();this._serverPlotOffsets.setValue(e&&e.offsets||{}),(0,i.default)(t,this._serverPlotOffsets.value())||this.updateAllViews((0,N.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,s,i){const r=i.id,n=this._properties.childs().styles.childs()[r],o=(0,L.isShapesPlot)(i)||(0,L.isCharsPlot)(i);s.useMainSeriesRange=s.useMainSeriesRange||(0,L.isArrowsPlot)(i);let a=(0,L.isLinePlot)(i)||(0,L.isOhlcPlot)(i);if(o){const e=(0,p.ensureDefined)(n).childs().location.value(),t=[D.MarkLocation.Absolute,D.MarkLocation.Top,D.MarkLocation.Bottom].indexOf(e)<0;s.useMainSeriesRange=s.useMainSeriesRange||o&&t,a=a||e===D.MarkLocation.Absolute}if(!a)return s;const l={name:r,offset:this.offset(r)},h=n.childs().plottype.value()
+;if(!this._skipHistogramBaseOnAutoScale()&&[L.LineStudyPlotStyle.Histogram,L.LineStudyPlotStyle.Columns,L.LineStudyPlotStyle.Area].indexOf(h)>=0){const i=(this._metaInfo.value().styles??{})?.[r]?.histogramBase;if(void 0===i)return s;const n=this.data().minMaxOnRangeCached(e,t,[l]);return(0,_.isNumber)(i)&&null!==n&&(s.baseValueMinMax=(0,T.mergeMinMax)(s.baseValueMinMax,{min:i,max:i}),s.baseValueMinMax=(0,T.mergeMinMax)(s.baseValueMinMax,n)),s}return s.fields.push(l),s}async _onSourceInputChanged(){if(!this.isStarted()){this._calcSources();Kt}}_buildInputs(e){(0,p.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){Gt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((s=>{null!=t[s]&&(e[s]=t[s])})),e}{const e=[];return Object.keys(t).forEach((s=>{null!=t[s]&&e.push(t[s])})),e}}_prepareInput(e,t){const s=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?s:{v:s,f:!0,t:e.type}}_plotsForAlert(){return[]}_formatterStateForAlert(){try{const e=this.formatter();return FormattersSerializer.isSerializable(e)?FormattersSerializer.serialize(e):null}catch{return null}}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,Ct.isActualInterval)(this._series.intervalObj().value(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this._sources.value();for(const t of e)if(t instanceof us){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const s=this._properties.childs().inputs.childs();if(s[t.id])if("price"===t.type)s[t.id].setValue(e.price);else if("time"===t.type){const i=this._model.timeScale().indexToTimePoint(e.index);null!==i&&s[t.id].setValue(1e3*i)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()]??null)}_initializeCurrencySource(){const e=this.metaInfo(),t="symbolInputSymbolSource"===e.symbolSource?.type&&e.symbolSource?.inputId,s=e.inputs.find((e=>e.id===t));if("string"==typeof t&&"symbol"===s?.type&&e.is_price_study){const e=this._properties.childs().inputs.childs()[t];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,N.sourceChangeEvent)(this.id()))}async _pinePatchProps(){throw new Error("Not implemented")}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,
+p.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const s of t)if((0,p.assert)(e.hasOwnProperty(s),`key '${s}' should exist in study inputs`),(0,p.ensureDefined)(this._oldStudyInputs)[s]!==e[s])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 s={first_visible_bar_time:e.firstVisibleBarTime,last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},i=this.metaInfo().inputs,r=[];for(const e of i)s.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(s[e]);t&&r.length>0&&n.fireChanged()}_getStudyErrorText(e){const t=e.split(":",2)[0];return decodeURIComponent(t)}_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,s=(0,_.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return s||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,_.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||Gt.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,p.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_studySpec(e){return{id:this._metaInfo.value().id,child:e??this.isChildStudy(),fundamental:!1}}_onFormatterPropsChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources.setValue(e),this._onParentSourcesChanges.fire()}async _awaitForMetaInfo(){const e={resolver:()=>{}},t=()=>e.resolver();try{await Promise.race([new Promise(((e,t)=>{setTimeout((()=>t(new Error("Timeout"))),3e3)})),await new Promise((s=>{e.resolver=s,this.metaInfoWV().subscribe(t)}))])}catch(e){throw e}finally{this.metaInfoWV().unsubscribe(t)}}}},51752:(e,t,s)=>{s.d(t,{plotShapesData:()=>r});var i=s(11542);const r={shape_arrow_down:{guiName:i.t(null,void 0,s(34247)),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:i.t(null,void 0,s(45523)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:i.t(null,void 0,s(91944)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:i.t(null,void 0,s(6969)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:i.t(null,void 0,s(15179)),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{
+guiName:i.t(null,void 0,s(33885)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:i.t(null,void 0,s(85924)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:i.t(null,void 0,s(49857)),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:i.t(null,void 0,s(66205)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:i.t(null,void 0,s(76152)),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:i.t(null,void 0,s(21236)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:i.t(null,void 0,s(11316)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}}}]);
\ No newline at end of file
diff --git a/charting_library/bundles/1727.7ff9031cf392f780ce22.js b/charting_library/bundles/1727.98e9d718a90f5c1c2f73.js
similarity index 62%
rename from charting_library/bundles/1727.7ff9031cf392f780ce22.js
rename to charting_library/bundles/1727.98e9d718a90f5c1c2f73.js
index 14141aa6..54992765 100644
--- a/charting_library/bundles/1727.7ff9031cf392f780ce22.js
+++ b/charting_library/bundles/1727.98e9d718a90f5c1c2f73.js
@@ -1,9 +1,9 @@
(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1727],{16499:e=>{e.exports={favorite:"favorite-_FRQhM5Y",hovered:"hovered-_FRQhM5Y",disabled:"disabled-_FRQhM5Y",focused:"focused-_FRQhM5Y",active:"active-_FRQhM5Y",checked:"checked-_FRQhM5Y"}},74670:(e,o,l)=>{"use strict";l.d(o,{useActiveDescendant:()=>n});var t=l(50959),i=l(39416);function n(e,o=[]){const[l,n]=(0,t.useState)(!1),a=(0,i.useFunctionalRefObject)(e);return(0,t.useLayoutEffect)((()=>{const e=a.current;if(null===e)return;const o=e=>{switch(e.type){case"active-descendant-focus":n(!0);break;case"active-descendant-blur":n(!1)}};return e.addEventListener("active-descendant-focus",o),e.addEventListener("active-descendant-blur",o),()=>{e.removeEventListener("active-descendant-focus",o),e.removeEventListener("active-descendant-blur",o)}}),o),[a,l]}},71402:(e,o,l)=>{"use strict";l.d(o,{RemoveTitleType:()=>t,removeTitlesMap:()=>n});var t,i=l(11542);!function(e){e.Add="add",e.Remove="remove"}(t||(t={}));const n={[t.Add]:i.t(null,void 0,l(69207)),[t.Remove]:i.t(null,void 0,l(85106))}},36189:(e,o,l)=>{"use strict";l.d(o,{FavoriteButton:()=>d});var t=l(50959),i=l(97754),n=l.n(i),a=l(9745),r=l(71402),s=l(74670),c=l(39146),v=l(48010),h=l(16499);function d(e){const{className:o,isFilled:l,isActive:i,onClick:d,title:m,...u}=e,[g,L]=(0,s.useActiveDescendant)(null),T=m??(l?r.removeTitlesMap[r.RemoveTitleType.Remove]:r.removeTitlesMap[r.RemoveTitleType.Add]);return(0,t.useLayoutEffect)((()=>{const e=g.current;e instanceof HTMLElement&&T&&e.dispatchEvent(new CustomEvent("common-tooltip-update"))}),[T,g]),t.createElement(a.Icon,{...u,className:n()(h.favorite,"apply-common-tooltip",l&&h.checked,i&&h.active,L&&h.focused,o),onClick:d,icon:l?c:v,title:T,ariaLabel:T,ref:g})}},73607:(e,o,l)=>{"use strict";l.d(o,{focusFirstMenuItem:()=>v,handleAccessibleMenuFocus:()=>s,handleAccessibleMenuKeyDown:()=>c,queryMenuElements:()=>m});var t=l(22692),i=l(33647),n=l(68335),a=l(15754);const r=[37,39,38,40];function s(e,o){if(!e.target)return;const l=e.relatedTarget?.getAttribute("aria-activedescendant");if(e.relatedTarget!==o.current){const e=l&&document.getElementById(l);if(!e||e!==o.current)return}v(e.target)}function c(e){if(e.defaultPrevented)return;const o=(0,n.hashFromEvent)(e);if(!r.includes(o))return;const l=document.activeElement;if(!(document.activeElement instanceof HTMLElement))return;const a=m(e.currentTarget).sort(t.navigationOrderComparator);if(0===a.length)return;const s=document.activeElement.closest('[data-role="menuitem"]')||document.activeElement.parentElement?.querySelector('[data-role="menuitem"]');if(!(s instanceof HTMLElement))return;const c=a.indexOf(s);if(-1===c)return;const v=u(s),g=v.indexOf(document.activeElement),L=-1!==g,T=e=>{l&&(0,i.becomeSecondaryElement)(l),(0,i.becomeMainElement)(e),e.focus()};switch((0,t.mapKeyCodeToDirection)(o)){case"inlinePrev":if(!v.length)return;e.preventDefault(),T(0===g?a[c]:L?h(v,g,-1):v[v.length-1]);break;case"inlineNext":if(!v.length)return;e.preventDefault(),g===v.length-1?T(a[c]):T(L?h(v,g,1):v[0]);break
-;case"blockPrev":{e.preventDefault();const o=h(a,c,-1);if(L){const e=d(o,g);T(e||o);break}T(o);break}case"blockNext":{e.preventDefault();const o=h(a,c,1);if(L){const e=d(o,g);T(e||o);break}T(o)}}}function v(e){const[o]=m(e);o&&((0,i.becomeMainElement)(o),o.focus())}function h(e,o,l){return e[(o+e.length+l)%e.length]}function d(e,o){const l=u(e);return l.length?l[(o+l.length)%l.length]:null}function m(e){return Array.from(e.querySelectorAll('[data-role="menuitem"]:not([disabled]):not([aria-disabled])')).filter((0,a.createScopedVisibleElementFilter)(e))}function u(e){return Array.from(e.querySelectorAll("[tabindex]:not([disabled]):not([aria-disabled])")).filter((0,a.createScopedVisibleElementFilter)(e))}},70173:(e,o,l)=>{"use strict";l.d(o,{drawingToolsIcons:()=>t});const t={SyncDrawing:l(99088),arrow:l(63743),cursor:l(18953),dot:l(72196),demonstration:l(54780),performance:"",drawginmode:l(52459),drawginmodeActive:l(63975),eraser:l(27999),group:l(34059),hideAllDrawings:l(45820),hideAllDrawingsActive:l(84959),hideAllIndicators:l(42321),hideAllIndicatorsActive:l(75895),hideAllDrawingTools:l(93756),hideAllDrawingToolsActive:l(42650),hideAllPositionsTools:l(57313),hideAllPositionsToolsActive:l(65162),lockAllDrawings:l(91244),lockAllDrawingsActive:l(65186),magnet:l(68385),heart:l(10862),smile:l(7636),sticker:l(62567),strongMagnet:l(46049),measure:l(88518),removeAllDrawingTools:l(93544),showObjectsTree:l(36515),zoom:l(6894),"zoom-out":l(45360)}},84902:(e,o,l)=>{"use strict";l.d(o,{isLineTool:()=>h,isLineToolOption:()=>d,isLineToolSwitcherOption:()=>m,isLineToolsGroupWithSections:()=>v,lineTools:()=>c,lineToolsFlat:()=>u});var t=l(11542),i=l(49483),n=l(37103),a=l(57340),r=l(87465);const s=n.enabled("image_drawingtool"),c=[{id:"linetool-group-cursors",title:t.t(null,void 0,l(81578)),sections:[{items:[{name:"cursor"},{name:"dot"},{name:"arrow"},{name:"demonstration"},null].filter(r.isExistent)},{items:[{name:"eraser"},i.CheckMobile.any()?null:{type:"switcher",reactKey:"values-tooltip-on-long-press",label:t.t(null,void 0,l(84145)),value:"valuesTooltipOnLongPress",watchedValue:a.chartFloatingTooltipEnabledWV}].filter(r.isExistent)}],trackLabel:null},{id:"linetool-group-trend-line",title:t.t(null,void 0,l(48773)),sections:[{title:t.t(null,void 0,l(56982)),items:[{name:"LineToolTrendLine"},{name:"LineToolRay"},{name:"LineToolInfoLine"},{name:"LineToolExtended"},{name:"LineToolTrendAngle"},{name:"LineToolHorzLine"},{name:"LineToolHorzRay"},{name:"LineToolVertLine"},{name:"LineToolCrossLine"}]},{title:t.t(null,void 0,l(59934)),items:[{name:"LineToolParallelChannel"},{name:"LineToolRegressionTrend"},{name:"LineToolFlatBottom"},{name:"LineToolDisjointAngle"}]},{title:t.t(null,void 0,l(36167)),items:[{name:"LineToolPitchfork"},{name:"LineToolSchiffPitchfork2"},{name:"LineToolSchiffPitchfork"},{name:"LineToolInsidePitchfork"}]}],trackLabel:null},{id:"linetool-group-gann-and-fibonacci",title:t.t(null,void 0,l(2654)),sections:[{title:t.t(null,void 0,l(26578)),items:[{name:"LineToolFibRetracement"},{name:"LineToolTrendBasedFibExtension"},{
-name:"LineToolFibChannel"},{name:"LineToolFibTimeZone"},{name:"LineToolFibSpeedResistanceFan"},{name:"LineToolTrendBasedFibTime"},{name:"LineToolFibCircles"},{name:"LineToolFibSpiral"},{name:"LineToolFibSpeedResistanceArcs"},{name:"LineToolFibWedge"},{name:"LineToolPitchfan"}]},{title:t.t(null,void 0,l(51494)),items:[{name:"LineToolGannSquare"},{name:"LineToolGannFixed"},{name:"LineToolGannComplex"},{name:"LineToolGannFan"}]}],trackLabel:null},{id:"linetool-group-patterns",title:t.t(null,void 0,l(46417)),sections:[{title:t.t(null,void 0,l(46417)),items:[{name:"LineTool5PointsPattern"},{name:"LineToolCypherPattern"},{name:"LineToolHeadAndShoulders"},{name:"LineToolABCD"},{name:"LineToolTrianglePattern"},{name:"LineToolThreeDrivers"}]},{title:t.t(null,void 0,l(44255)),items:[{name:"LineToolElliottImpulse"},{name:"LineToolElliottCorrection"},{name:"LineToolElliottTriangle"},{name:"LineToolElliottDoubleCombo"},{name:"LineToolElliottTripleCombo"}]},{title:t.t(null,void 0,l(77915)),items:[{name:"LineToolCircleLines"},{name:"LineToolTimeCycles"},{name:"LineToolSineLine"}]}],trackLabel:null},{id:"linetool-group-prediction-and-measurement",title:t.t(null,void 0,l(1410)),sections:[{title:t.t(null,void 0,l(75747)),items:[{name:"LineToolRiskRewardLong"},{name:"LineToolRiskRewardShort"},{name:"LineToolPrediction"},{name:"LineToolBarsPattern"},{name:"LineToolGhostFeed"},{name:"LineToolProjection"}].filter(r.isExistent)},{title:t.t(null,void 0,l(69260)),items:[{name:"LineToolAnchoredVWAP"},{name:"LineToolFixedRangeVolumeProfile"},null].filter(r.isExistent)},{title:t.t(null,void 0,l(97050)),items:[{name:"LineToolPriceRange"},{name:"LineToolDateRange"},{name:"LineToolDateAndPriceRange"}]}],trackLabel:null},{id:"linetool-group-geometric-shapes",title:t.t(null,void 0,l(22145)),sections:[{title:t.t(null,void 0,l(65695)),items:[{name:"LineToolBrush"},{name:"LineToolHighlighter"}]},{title:t.t(null,void 0,l(19147)),items:[{name:"LineToolArrowMarker"},{name:"LineToolArrow"},{name:"LineToolArrowMarkUp"},{name:"LineToolArrowMarkDown"},{name:"LineToolArrowMarkLeft"},{name:"LineToolArrowMarkRight"}].filter(r.isExistent)},{title:t.t(null,void 0,l(65781)),items:[{name:"LineToolRectangle"},{name:"LineToolRotatedRectangle"},{name:"LineToolPath"},{name:"LineToolCircle"},{name:"LineToolEllipse"},{name:"LineToolPolyline"},{name:"LineToolTriangle"},{name:"LineToolArc"},{name:"LineToolBezierQuadro"},{name:"LineToolBezierCubic"}]}],trackLabel:null},{id:"linetool-group-annotation",title:t.t(null,void 0,l(32064)),sections:[{title:t.t(null,void 0,l(65831)),items:[{name:"LineToolText"},{name:"LineToolTextAbsolute"},{name:"LineToolTextNote"},{name:"LineToolPriceNote"},{name:"LineToolNote"},{name:"LineToolTable"},{name:"LineToolCallout"},{name:"LineToolComment"},{name:"LineToolPriceLabel"},{name:"LineToolSignpost"},{name:"LineToolFlagMark"}].filter(r.isExistent)},{title:t.t(null,void 0,l(93111)),items:[s?{name:"LineToolImage"}:null,null,null].filter(r.isExistent)}],trackLabel:null}];function v(e){return"sections"in e}function h(e){return"name"in e}
-function d(e){return"type"in e}function m(e){return d(e)&&"switcher"===e.type}const u=c.map((function(e){return v(e)?e.sections.map((e=>e.items.filter(h))).flat():e.items.filter(h)})).flat()},18117:(e,o,l)=>{"use strict";l.d(o,{lineToolsInfo:()=>f});var t=l(50151),i=l(11542),n=l(61814),a=(l(40167),l(44341)),r=l(70173);const s={SyncDrawing:i.t(null,void 0,l(59377)),arrow:i.t(null,void 0,l(11858)),cursor:i.t(null,void 0,l(6969)),demonstration:i.t(null,void 0,l(14939)),dot:i.t(null,void 0,l(57157)),performance:i.t(null,void 0,l(35553)),drawginmode:i.t(null,void 0,l(99901)),eraser:i.t(null,void 0,l(8727)),group:i.t(null,void 0,l(3154)),hideAllDrawings:i.t(null,void 0,l(52563)),lockAllDrawings:i.t(null,void 0,l(79451)),magnet:i.t(null,void 0,l(81396)),measure:i.t(null,void 0,l(91563)),removeAllDrawingTools:i.t(null,void 0,l(57118)),showObjectsTree:i.t(null,void 0,l(85786)),zoom:i.t(null,void 0,l(55774)),"zoom-out":i.t(null,void 0,l(37310))};var c=l(56876),v=l(68335),h=l(81360);const d=(0,v.humanReadableModifiers)(v.Modifiers.Shift,!1).trim(),m=(0,v.humanReadableModifiers)(v.Modifiers.Alt,!1).trim(),u=(0,v.humanReadableModifiers)(v.Modifiers.Mod,!1).trim(),g={keys:[d],text:i.t(null,void 0,l(23369))},L={keys:[d],text:i.t(null,void 0,l(13798))},T={keys:[d],text:i.t(null,void 0,l(10539))},w={LineTool5PointsPattern:{},LineToolABCD:{},LineToolArc:{},LineToolArrow:{},LineToolArrowMarkDown:{},LineToolArrowMarkLeft:{},LineToolArrowMarkRight:{},LineToolArrowMarkUp:{},LineToolComment:{},LineToolBarsPattern:{},LineToolBezierCubic:{},LineToolBezierQuadro:{},LineToolBrush:{},LineToolCallout:{},LineToolCircleLines:{},LineToolCypherPattern:{},LineToolDateAndPriceRange:{},LineToolDateRange:{},LineToolDisjointAngle:{hotKey:(0,n.hotKeySerialize)(g)},LineToolElliottCorrection:{},LineToolElliottDoubleCombo:{},LineToolElliottImpulse:{},LineToolElliottTriangle:{},LineToolElliottTripleCombo:{},LineToolEllipse:{hotKey:(0,n.hotKeySerialize)(L)},LineToolExtended:{},LineToolFibChannel:{},LineToolFibCircles:{hotKey:(0,n.hotKeySerialize)(L)},LineToolFibRetracement:{},LineToolFibSpeedResistanceArcs:{},LineToolFibSpeedResistanceFan:{hotKey:(0,n.hotKeySerialize)(T)},LineToolFibSpiral:{},LineToolFibTimeZone:{},LineToolFibWedge:{},LineToolFlagMark:{},LineToolFlatBottom:{hotKey:(0,n.hotKeySerialize)(g)},LineToolAnchoredVWAP:{},LineToolGannComplex:{},LineToolGannFixed:{},LineToolGannFan:{},LineToolGannSquare:{hotKey:(0,n.hotKeySerialize)({keys:[d],text:i.t(null,void 0,l(83042))})},LineToolHeadAndShoulders:{},LineToolHorzLine:{hotKey:(0,n.hotKeySerialize)({keys:[m,"H"],text:"{0} + {1}"})},LineToolHorzRay:{},LineToolIcon:{},LineToolImage:{},LineToolEmoji:{},LineToolSticker:{},LineToolInsidePitchfork:{},LineToolNote:{},LineToolSignpost:{},LineToolParallelChannel:{hotKey:(0,n.hotKeySerialize)(g)},LineToolPitchfan:{},LineToolPitchfork:{},LineToolPolyline:{},LineToolPath:{},LineToolPrediction:{},LineToolPriceLabel:{},LineToolPriceNote:{hotKey:(0,n.hotKeySerialize)(g)},LineToolTextNote:{},LineToolArrowMarker:{},LineToolPriceRange:{},LineToolProjection:{},
-LineToolRay:{},LineToolRectangle:{hotKey:(0,n.hotKeySerialize)({keys:[d],text:i.t(null,void 0,l(10539))})},LineToolCircle:{},LineToolRegressionTrend:{},LineToolRiskRewardLong:{},LineToolRiskRewardShort:{},LineToolFixedRangeVolumeProfile:{},LineToolRotatedRectangle:{hotKey:(0,n.hotKeySerialize)(g)},LineToolSchiffPitchfork:{},LineToolSchiffPitchfork2:{},LineToolSineLine:{},LineToolText:{},LineToolTextAbsolute:{},LineToolThreeDrivers:{},LineToolTimeCycles:{},LineToolTrendAngle:{hotKey:(0,n.hotKeySerialize)(g)},LineToolTrendBasedFibExtension:{},LineToolTrendBasedFibTime:{},LineToolTrendLine:{hotKey:(0,n.hotKeySerialize)(g)},LineToolInfoLine:{},LineToolTriangle:{},LineToolTrianglePattern:{},LineToolVertLine:{hotKey:(0,n.hotKeySerialize)({keys:[m,"V"],text:"{0} + {1}"})},LineToolCrossLine:{},LineToolHighlighter:{},LineToolGhostFeed:{},LineToolTable:{},SyncDrawing:{iconActive:r.drawingToolsIcons.SyncDrawingActive},arrow:{},cursor:{},dot:{},demonstration:{hotKey:(0,n.hotKeySerialize)({keys:[m],text:i.t(null,void 0,l(42633))})},drawginmode:{iconActive:r.drawingToolsIcons.drawginmodeActive},eraser:{},group:{},hideAllDrawings:{iconActive:r.drawingToolsIcons.hideAllDrawingsActive,hotKey:(0,n.hotKeySerialize)({keys:[u,m,"H"],text:"{0} + {1} + {2}"})},lockAllDrawings:{iconActive:r.drawingToolsIcons.lockAllDrawingsActive},magnet:{hotKey:(0,n.hotKeySerialize)({keys:[u],text:"{0}"})},measure:{hotKey:(0,n.hotKeySerialize)({keys:[d],text:i.t(null,void 0,l(92949))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};const f={};Object.entries(w).map((([e,o])=>{const l=a.lineToolsIcons[e]??r.drawingToolsIcons[e];(0,t.assert)(!!l,`Icon is not defined for drawing "${e}"`);const i=c.lineToolsLocalizedNames[e]??s[e];(0,t.assert)(!!i,`Localized name is not defined for drawing "${e}"`);return{...o,name:e,icon:l,localizedName:i,selectHotkey:h.lineToolsSelectHotkeys[e]}})).forEach((e=>{f[e.name]=e}))},6519:(e,o,l)=>{"use strict";l.d(o,{LinetoolsFavoritesStore:()=>c});var t=l(48096),i=l(87465),n=l(1765);const a=["LineToolBalloon","LineToolNoteAbsolute",null,null].filter(i.isExistent),r=!1;var s,c;!function(e){function o(){e.favorites=[];let o=!1;const t=Boolean(void 0===(0,n.getValue)("chart.favoriteDrawings")),s=(0,n.getJSON)("chart.favoriteDrawings",[]);if(0===s.length&&t&&"undefined"!=typeof window){const e=JSON.parse(window.urlParams?.favorites??"{}").drawingTools;e&&Array.isArray(e)&&s.push(...e)}s.forEach(((t,i)=>{const n=t.tool||t;l(n)?a.includes(n)?o=!0:e.favorites.push(n):r&&r.includes(n)&&e.hiddenToolsPositions.set(n,i)})),o&&i(),e.favoritesSynced.fire()}function l(e){return"string"==typeof e&&""!==e&&!(r&&r.includes(e))}function i(o){const l=e.favorites.slice();e.hiddenToolsPositions.forEach(((e,o)=>{l.splice(e,0,o)})),(0,n.setJSON)("chart.favoriteDrawings",l,o)}e.favorites=[],e.favoritesSynced=new t.Delegate,e.hiddenToolsPositions=new Map,e.favoriteIndex=function(o){return e.favorites.indexOf(o)},e.isValidLineToolName=l,e.saveFavorites=i,o(),n.onSync.subscribe(null,o)}(s||(s={})),function(e){function o(e){
-return s.isValidLineToolName(e)}function l(){return s.favorites.length}function i(e){return-1!==s.favoriteIndex(e)}e.favoriteAdded=new t.Delegate,e.favoriteRemoved=new t.Delegate,e.favoriteMoved=new t.Delegate,e.favoritesSynced=s.favoritesSynced,e.favorites=function(){return s.favorites.slice()},e.isValidLineToolName=o,e.favoritesCount=l,e.favorite=function(e){return e<0||e>=l()?"":s.favorites[e]},e.addFavorite=function(l,t){return!(i(l)||!o(l)||"performance"===l)&&(s.favorites.push(l),s.saveFavorites(t),e.favoriteAdded.fire(l),!0)},e.removeFavorite=function(o,l){const t=s.favoriteIndex(o);if(-1===t)return!1;s.favorites.splice(t,1);const i=s.hiddenToolsPositions;return i.forEach(((e,o)=>{e>t&&i.set(o,e-1)})),s.saveFavorites(l),e.favoriteRemoved.fire(o),!0},e.isFavorite=i,e.moveFavorite=function(t,i,n){if(i<0||i>=l()||!o(t))return!1;const a=s.favoriteIndex(t);if(-1===a||i===a)return!1;const r=s.hiddenToolsPositions;return r.forEach(((e,o)=>{ae?e--:ie&&e++,r.set(o,e)})),s.favorites.splice(a,1),s.favorites.splice(i,0,t),s.saveFavorites(n),e.favoriteMoved.fire(t,a,i),!0}}(c||(c={}))},54780:e=>{e.exports=''},52459:e=>{e.exports=''},63975:e=>{e.exports=''},34059:e=>{
+;case"blockPrev":{e.preventDefault();const o=h(a,c,-1);if(L){const e=d(o,g);T(e||o);break}T(o);break}case"blockNext":{e.preventDefault();const o=h(a,c,1);if(L){const e=d(o,g);T(e||o);break}T(o)}}}function v(e){const[o]=m(e);o&&((0,i.becomeMainElement)(o),o.focus())}function h(e,o,l){return e[(o+e.length+l)%e.length]}function d(e,o){const l=u(e);return l.length?l[(o+l.length)%l.length]:null}function m(e){return Array.from(e.querySelectorAll('[data-role="menuitem"]:not([disabled]):not([aria-disabled])')).filter((0,a.createScopedVisibleElementFilter)(e))}function u(e){return Array.from(e.querySelectorAll("[tabindex]:not([disabled]):not([aria-disabled])")).filter((0,a.createScopedVisibleElementFilter)(e))}},70173:(e,o,l)=>{"use strict";l.d(o,{drawingToolsIcons:()=>t});const t={SyncDrawing:l(99088),arrow:l(63743),cursor:l(18953),dot:l(72196),demonstration:l(54780),performance:"",drawginmode:l(52459),drawginmodeActive:l(63975),eraser:l(27999),group:l(34059),hideAllDrawings:l(45820),hideAllDrawingsActive:l(84959),hideAllIndicators:l(42321),hideAllIndicatorsActive:l(75895),hideAllDrawingTools:l(93756),hideAllDrawingToolsActive:l(42650),hideAllPositionsTools:l(57313),hideAllPositionsToolsActive:l(65162),lockAllDrawings:l(91244),lockAllDrawingsActive:l(65186),magnet:l(68385),heart:l(10862),smile:l(7636),sticker:l(62567),strongMagnet:l(46049),measure:l(88518),removeAllDrawingTools:l(93544),showObjectsTree:l(36515),zoom:l(6894),"zoom-out":l(45360)}},84902:(e,o,l)=>{"use strict";l.d(o,{isLineTool:()=>d,isLineToolOption:()=>m,isLineToolSwitcherOption:()=>u,isLineToolsGroupWithSections:()=>h,lineTools:()=>v,lineToolsFlat:()=>g});var t=l(11542),i=l(49483),n=l(37103),a=l(57340),r=l(87465);const s=n.enabled("image_drawingtool"),c=!i.CheckMobile.any()&&n.enabled("long_press_floating_tooltip"),v=[{id:"linetool-group-cursors",title:t.t(null,void 0,l(81578)),sections:[{items:[{name:"cursor"},{name:"dot"},{name:"arrow"},{name:"demonstration"},null].filter(r.isExistent)},{items:[{name:"eraser"},c?{type:"switcher",reactKey:"values-tooltip-on-long-press",label:t.t(null,void 0,l(84145)),value:"valuesTooltipOnLongPress",watchedValue:a.chartFloatingTooltipEnabledWV}:null].filter(r.isExistent)}],trackLabel:null},{id:"linetool-group-trend-line",title:t.t(null,void 0,l(48773)),sections:[{title:t.t(null,void 0,l(56982)),items:[{name:"LineToolTrendLine"},{name:"LineToolRay"},{name:"LineToolInfoLine"},{name:"LineToolExtended"},{name:"LineToolTrendAngle"},{name:"LineToolHorzLine"},{name:"LineToolHorzRay"},{name:"LineToolVertLine"},{name:"LineToolCrossLine"}]},{title:t.t(null,void 0,l(59934)),items:[{name:"LineToolParallelChannel"},{name:"LineToolRegressionTrend"},{name:"LineToolFlatBottom"},{name:"LineToolDisjointAngle"}]},{title:t.t(null,void 0,l(36167)),items:[{name:"LineToolPitchfork"},{name:"LineToolSchiffPitchfork2"},{name:"LineToolSchiffPitchfork"},{name:"LineToolInsidePitchfork"}]}],trackLabel:null},{id:"linetool-group-gann-and-fibonacci",title:t.t(null,void 0,l(2654)),sections:[{title:t.t(null,void 0,l(26578)),items:[{
+name:"LineToolFibRetracement"},{name:"LineToolTrendBasedFibExtension"},{name:"LineToolFibChannel"},{name:"LineToolFibTimeZone"},{name:"LineToolFibSpeedResistanceFan"},{name:"LineToolTrendBasedFibTime"},{name:"LineToolFibCircles"},{name:"LineToolFibSpiral"},{name:"LineToolFibSpeedResistanceArcs"},{name:"LineToolFibWedge"},{name:"LineToolPitchfan"}]},{title:t.t(null,void 0,l(51494)),items:[{name:"LineToolGannSquare"},{name:"LineToolGannFixed"},{name:"LineToolGannComplex"},{name:"LineToolGannFan"}]}],trackLabel:null},{id:"linetool-group-patterns",title:t.t(null,void 0,l(46417)),sections:[{title:t.t(null,void 0,l(46417)),items:[{name:"LineTool5PointsPattern"},{name:"LineToolCypherPattern"},{name:"LineToolHeadAndShoulders"},{name:"LineToolABCD"},{name:"LineToolTrianglePattern"},{name:"LineToolThreeDrivers"}]},{title:t.t(null,void 0,l(44255)),items:[{name:"LineToolElliottImpulse"},{name:"LineToolElliottCorrection"},{name:"LineToolElliottTriangle"},{name:"LineToolElliottDoubleCombo"},{name:"LineToolElliottTripleCombo"}]},{title:t.t(null,void 0,l(77915)),items:[{name:"LineToolCircleLines"},{name:"LineToolTimeCycles"},{name:"LineToolSineLine"}]}],trackLabel:null},{id:"linetool-group-prediction-and-measurement",title:t.t(null,void 0,l(1410)),sections:[{title:t.t(null,void 0,l(75747)),items:[{name:"LineToolRiskRewardLong"},{name:"LineToolRiskRewardShort"},{name:"LineToolPrediction"},{name:"LineToolBarsPattern"},{name:"LineToolGhostFeed"},{name:"LineToolProjection"}].filter(r.isExistent)},{title:t.t(null,void 0,l(69260)),items:[{name:"LineToolAnchoredVWAP"},{name:"LineToolFixedRangeVolumeProfile"},null].filter(r.isExistent)},{title:t.t(null,void 0,l(97050)),items:[{name:"LineToolPriceRange"},{name:"LineToolDateRange"},{name:"LineToolDateAndPriceRange"}]}],trackLabel:null},{id:"linetool-group-geometric-shapes",title:t.t(null,void 0,l(22145)),sections:[{title:t.t(null,void 0,l(65695)),items:[{name:"LineToolBrush"},{name:"LineToolHighlighter"}]},{title:t.t(null,void 0,l(19147)),items:[{name:"LineToolArrowMarker"},{name:"LineToolArrow"},{name:"LineToolArrowMarkUp"},{name:"LineToolArrowMarkDown"},{name:"LineToolArrowMarkLeft"},{name:"LineToolArrowMarkRight"}].filter(r.isExistent)},{title:t.t(null,void 0,l(65781)),items:[{name:"LineToolRectangle"},{name:"LineToolRotatedRectangle"},{name:"LineToolPath"},{name:"LineToolCircle"},{name:"LineToolEllipse"},{name:"LineToolPolyline"},{name:"LineToolTriangle"},{name:"LineToolArc"},{name:"LineToolBezierQuadro"},{name:"LineToolBezierCubic"}]}],trackLabel:null},{id:"linetool-group-annotation",title:t.t(null,void 0,l(32064)),sections:[{title:t.t(null,void 0,l(65831)),items:[{name:"LineToolText"},{name:"LineToolTextAbsolute"},{name:"LineToolTextNote"},{name:"LineToolPriceNote"},{name:"LineToolNote"},{name:"LineToolTable"},{name:"LineToolCallout"},{name:"LineToolComment"},{name:"LineToolPriceLabel"},{name:"LineToolSignpost"},{name:"LineToolFlagMark"}].filter(r.isExistent)},{title:t.t(null,void 0,l(93111)),items:[s?{name:"LineToolImage"}:null,null,null].filter(r.isExistent)}],trackLabel:null}]
+;function h(e){return"sections"in e}function d(e){return"name"in e}function m(e){return"type"in e}function u(e){return m(e)&&"switcher"===e.type}const g=v.map((function(e){return h(e)?e.sections.map((e=>e.items.filter(d))).flat():e.items.filter(d)})).flat()},18117:(e,o,l)=>{"use strict";l.d(o,{lineToolsInfo:()=>f});var t=l(50151),i=l(11542),n=l(61814),a=(l(40167),l(44341)),r=l(70173);const s={SyncDrawing:i.t(null,void 0,l(59377)),arrow:i.t(null,void 0,l(11858)),cursor:i.t(null,void 0,l(6969)),demonstration:i.t(null,void 0,l(14939)),dot:i.t(null,void 0,l(57157)),performance:i.t(null,void 0,l(35553)),drawginmode:i.t(null,void 0,l(99901)),eraser:i.t(null,void 0,l(8727)),group:i.t(null,void 0,l(3154)),hideAllDrawings:i.t(null,void 0,l(52563)),lockAllDrawings:i.t(null,void 0,l(79451)),magnet:i.t(null,void 0,l(81396)),measure:i.t(null,void 0,l(91563)),removeAllDrawingTools:i.t(null,void 0,l(57118)),showObjectsTree:i.t(null,void 0,l(85786)),zoom:i.t(null,void 0,l(55774)),"zoom-out":i.t(null,void 0,l(37310))};var c=l(56876),v=l(68335),h=l(81360);const d=(0,v.humanReadableModifiers)(v.Modifiers.Shift,!1).trim(),m=(0,v.humanReadableModifiers)(v.Modifiers.Alt,!1).trim(),u=(0,v.humanReadableModifiers)(v.Modifiers.Mod,!1).trim(),g={keys:[d],text:i.t(null,void 0,l(23369))},L={keys:[d],text:i.t(null,void 0,l(13798))},T={keys:[d],text:i.t(null,void 0,l(10539))},w={LineTool5PointsPattern:{},LineToolABCD:{},LineToolArc:{},LineToolArrow:{},LineToolArrowMarkDown:{},LineToolArrowMarkLeft:{},LineToolArrowMarkRight:{},LineToolArrowMarkUp:{},LineToolComment:{},LineToolBarsPattern:{},LineToolBezierCubic:{},LineToolBezierQuadro:{},LineToolBrush:{},LineToolCallout:{},LineToolCircleLines:{},LineToolCypherPattern:{},LineToolDateAndPriceRange:{},LineToolDateRange:{},LineToolDisjointAngle:{hotKey:(0,n.hotKeySerialize)(g)},LineToolElliottCorrection:{},LineToolElliottDoubleCombo:{},LineToolElliottImpulse:{},LineToolElliottTriangle:{},LineToolElliottTripleCombo:{},LineToolEllipse:{hotKey:(0,n.hotKeySerialize)(L)},LineToolExtended:{},LineToolFibChannel:{},LineToolFibCircles:{hotKey:(0,n.hotKeySerialize)(L)},LineToolFibRetracement:{},LineToolFibSpeedResistanceArcs:{},LineToolFibSpeedResistanceFan:{hotKey:(0,n.hotKeySerialize)(T)},LineToolFibSpiral:{},LineToolFibTimeZone:{},LineToolFibWedge:{},LineToolFlagMark:{},LineToolFlatBottom:{hotKey:(0,n.hotKeySerialize)(g)},LineToolAnchoredVWAP:{},LineToolGannComplex:{},LineToolGannFixed:{},LineToolGannFan:{},LineToolGannSquare:{hotKey:(0,n.hotKeySerialize)({keys:[d],text:i.t(null,void 0,l(83042))})},LineToolHeadAndShoulders:{},LineToolHorzLine:{hotKey:(0,n.hotKeySerialize)({keys:[m,"H"],text:"{0} + {1}"})},LineToolHorzRay:{},LineToolIcon:{},LineToolImage:{},LineToolEmoji:{},LineToolSticker:{},LineToolInsidePitchfork:{},LineToolNote:{},LineToolSignpost:{},LineToolParallelChannel:{hotKey:(0,n.hotKeySerialize)(g)},LineToolPitchfan:{},LineToolPitchfork:{},LineToolPolyline:{},LineToolPath:{},LineToolPrediction:{},LineToolPriceLabel:{},LineToolPriceNote:{hotKey:(0,n.hotKeySerialize)(g)},LineToolTextNote:{},
+LineToolArrowMarker:{},LineToolPriceRange:{},LineToolProjection:{},LineToolRay:{},LineToolRectangle:{hotKey:(0,n.hotKeySerialize)({keys:[d],text:i.t(null,void 0,l(10539))})},LineToolCircle:{},LineToolRegressionTrend:{},LineToolRiskRewardLong:{},LineToolRiskRewardShort:{},LineToolFixedRangeVolumeProfile:{},LineToolRotatedRectangle:{hotKey:(0,n.hotKeySerialize)(g)},LineToolSchiffPitchfork:{},LineToolSchiffPitchfork2:{},LineToolSineLine:{},LineToolText:{},LineToolTextAbsolute:{},LineToolThreeDrivers:{},LineToolTimeCycles:{},LineToolTrendAngle:{hotKey:(0,n.hotKeySerialize)(g)},LineToolTrendBasedFibExtension:{},LineToolTrendBasedFibTime:{},LineToolTrendLine:{hotKey:(0,n.hotKeySerialize)(g)},LineToolInfoLine:{},LineToolTriangle:{},LineToolTrianglePattern:{},LineToolVertLine:{hotKey:(0,n.hotKeySerialize)({keys:[m,"V"],text:"{0} + {1}"})},LineToolCrossLine:{},LineToolHighlighter:{},LineToolGhostFeed:{},LineToolTable:{},SyncDrawing:{iconActive:r.drawingToolsIcons.SyncDrawingActive},arrow:{},cursor:{},dot:{},demonstration:{hotKey:(0,n.hotKeySerialize)({keys:[m],text:i.t(null,void 0,l(42633))})},drawginmode:{iconActive:r.drawingToolsIcons.drawginmodeActive},eraser:{},group:{},hideAllDrawings:{iconActive:r.drawingToolsIcons.hideAllDrawingsActive,hotKey:(0,n.hotKeySerialize)({keys:[u,m,"H"],text:"{0} + {1} + {2}"})},lockAllDrawings:{iconActive:r.drawingToolsIcons.lockAllDrawingsActive},magnet:{hotKey:(0,n.hotKeySerialize)({keys:[u],text:"{0}"})},measure:{hotKey:(0,n.hotKeySerialize)({keys:[d],text:i.t(null,void 0,l(92949))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};const f={};Object.entries(w).map((([e,o])=>{const l=a.lineToolsIcons[e]??r.drawingToolsIcons[e];(0,t.assert)(!!l,`Icon is not defined for drawing "${e}"`);const i=c.lineToolsLocalizedNames[e]??s[e];(0,t.assert)(!!i,`Localized name is not defined for drawing "${e}"`);return{...o,name:e,icon:l,localizedName:i,selectHotkey:h.lineToolsSelectHotkeys[e]}})).forEach((e=>{f[e.name]=e}))},6519:(e,o,l)=>{"use strict";l.d(o,{LinetoolsFavoritesStore:()=>c});var t=l(48096),i=l(87465),n=l(1765);const a=["LineToolBalloon","LineToolNoteAbsolute",null,null].filter(i.isExistent),r=!1;var s,c;!function(e){function o(){e.favorites=[];let o=!1;const t=Boolean(void 0===(0,n.getValue)("chart.favoriteDrawings")),s=(0,n.getJSON)("chart.favoriteDrawings",[]);if(0===s.length&&t&&"undefined"!=typeof window){const e=JSON.parse(window.urlParams?.favorites??"{}").drawingTools;e&&Array.isArray(e)&&s.push(...e)}s.forEach(((t,i)=>{const n=t.tool||t;l(n)?a.includes(n)?o=!0:e.favorites.push(n):r&&r.includes(n)&&e.hiddenToolsPositions.set(n,i)})),o&&i(),e.favoritesSynced.fire()}function l(e){return"string"==typeof e&&""!==e&&!(r&&r.includes(e))}function i(o){const l=e.favorites.slice();e.hiddenToolsPositions.forEach(((e,o)=>{l.splice(e,0,o)})),(0,n.setJSON)("chart.favoriteDrawings",l,o)}e.favorites=[],e.favoritesSynced=new t.Delegate,e.hiddenToolsPositions=new Map,e.favoriteIndex=function(o){return e.favorites.indexOf(o)},e.isValidLineToolName=l,e.saveFavorites=i,o(),
+n.onSync.subscribe(null,o)}(s||(s={})),function(e){function o(e){return s.isValidLineToolName(e)}function l(){return s.favorites.length}function i(e){return-1!==s.favoriteIndex(e)}e.favoriteAdded=new t.Delegate,e.favoriteRemoved=new t.Delegate,e.favoriteMoved=new t.Delegate,e.favoritesSynced=s.favoritesSynced,e.favorites=function(){return s.favorites.slice()},e.isValidLineToolName=o,e.favoritesCount=l,e.favorite=function(e){return e<0||e>=l()?"":s.favorites[e]},e.addFavorite=function(l,t){return!(i(l)||!o(l)||"performance"===l)&&(s.favorites.push(l),s.saveFavorites(t),e.favoriteAdded.fire(l),!0)},e.removeFavorite=function(o,l){const t=s.favoriteIndex(o);if(-1===t)return!1;s.favorites.splice(t,1);const i=s.hiddenToolsPositions;return i.forEach(((e,o)=>{e>t&&i.set(o,e-1)})),s.saveFavorites(l),e.favoriteRemoved.fire(o),!0},e.isFavorite=i,e.moveFavorite=function(t,i,n){if(i<0||i>=l()||!o(t))return!1;const a=s.favoriteIndex(t);if(-1===a||i===a)return!1;const r=s.hiddenToolsPositions;return r.forEach(((e,o)=>{ae?e--:ie&&e++,r.set(o,e)})),s.favorites.splice(a,1),s.favorites.splice(i,0,t),s.saveFavorites(n),e.favoriteMoved.fire(t,a,i),!0}}(c||(c={}))},54780:e=>{e.exports=''},52459:e=>{e.exports=''},63975:e=>{e.exports=''},34059:e=>{
e.exports=''},63743:e=>{e.exports=''},18953:e=>{e.exports=''},72196:e=>{e.exports=''},27999:e=>{e.exports=''},10862:e=>{e.exports=''},68385:e=>{e.exports=''},88518:e=>{e.exports=''},36515:e=>{
e.exports=''},7636:e=>{e.exports=''},62567:e=>{e.exports=''},46049:e=>{e.exports=''},99088:e=>{e.exports=''},42650:e=>{
e.exports=''},75895:e=>{e.exports=''},65162:e=>{
diff --git a/charting_library/bundles/library.15664647653f41254b4d.js b/charting_library/bundles/library.668013b6b41ce2feaa5c.js
similarity index 73%
rename from charting_library/bundles/library.15664647653f41254b4d.js
rename to charting_library/bundles/library.668013b6b41ce2feaa5c.js
index da05d8e4..e30db0ce 100644
--- a/charting_library/bundles/library.15664647653f41254b4d.js
+++ b/charting_library/bundles/library.668013b6b41ce2feaa5c.js
@@ -14,7 +14,7 @@ n.get_day_of_year)(e)+s<=n.LAST_DAY_OF_WEEK+n.FIRST_DAY_OF_WEEK)return this._get
;if(0===t.length)return null;const i=t.slice();return i.sort(l),this._getLeftEntryBorder(e,i[0])}checkSession(){return this._checkEachHistorySession()&&this._checkSpecialEntries()&&this._checkTooManyCorrectionsOnWeek()}inSession(e){e=new Date(1e3*Math.floor(e.getTime()/1e3));const t=this.alignToNearestSessionStart(e,-1),i=this.alignToNearestSessionEnd(t,1);return!(e.getTime()>i.getTime())}hasWeekEnds(){for(const e of this._entries)if(0!==e.getEntries().weekEndsCount())return!0;return!1}getWeekIndicesWithAdditionalWeekBars(e){let t=this._yearToCalculatedAddedWeekIndicesHash.get(e);return void 0===t&&(t=this._calculateAddedIndices(e),this._yearToCalculatedAddedWeekIndicesHash.set(e,t)),t}_prepareSessionsBorderParams(){const e=new Map,t=new Map;let i=null;this._entries.length>1&&(i=Array.from({length:this._entries.length-1},(()=>0)));let s=0;for(let n=0;n=e){if(i=s-1,i=0&&s.compareTo(t)<0&&i.add([s,o]);return i}_prepareBorderWeekHistory(e){const t=this._entries[e-1],i=this._entries[e],s=new Map,r=[],a=(0,n.get_day_of_week)((0,o.ensureNotNull)(i.getStartDay()));for(let e=0;e0&&i>=0||c<0&&i<0)&&(0,n.add_date)(t,7*c),!r.contains(t)){let e=a-o;h&&i<0&&(e=-(7-a+o)),(0,n.add_date)(t,e),o=(0,n.get_day_of_week)(t)}if(r.isOvernight()){const e=r.sessionStartDaysOffset(),i=(o-(r.dayOfWeek()-e)+7)%7;0!==i&&(0,n.add_date)(t,-i)}const d=s(r);return(0,n.set_seconds)(t,d),t}_businessDaysToCalendarDays(e,t,i){let s=0,o=0;for(;o=i)return s;e++,t=n.SUNDAY}return s}_calendarDaysToBusinessDays(e,t,i){let s=0,o=0;for(;s=i)return o;e++,t=n.SUNDAY}return o}_entrySessionStart(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*e.start()))}_entrySessionEnd(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*(e.start()+e.length())-1))}_alignToNearestSessionValue(e,t,i){const s=(0,n.get_day_of_week)(e),o=(0,n.get_minutes_with_hours)(e),r=this.getWeekIndex(e);let a=this.findSession(r,s,o);if(1===t)return i(a,e,t);const l=a.getEntry(),c=l.contains(e),d=r===a.weekIndex,u=l.sessionStartDaysOffset()-l.dayOfWeek()>=0;if(c&&(d||u))return i(a,e,t);let _=a.entryIndex-1;if(_<0){let e=a.weekIndex,t=a.entries;if(0===e)e--,_+=t.length;else for(;_<0;)e--,t=this.getEntriesForWeek(e).list(),_+=t.length;a=new h(e,_,t)}else a=new h(a.weekIndex,_,a.entries);return i(a,e,t)}_getEntriesForDay(e){const t=(0,n.get_day_of_week)(e),i=this.getEntriesForWeek(this.getWeekIndex(e)).entriesByDay().get(t);return void 0!==i?i:[]}_getLeftEntryBorder(e,t){let i=t.startOffset();const s=-Math.trunc((i-1439)/1440);i+=1440*s;const o=(0,n.get_cal)(b,(0,n.get_year)(e),(0,n.get_month)(e),(0,n.get_day_of_month)(e),Math.trunc(i/60),i%60,0);return(0,n.add_date)(o,-s),o}_checkEachHistorySession(){for(const e of this._entries){const t=e.getEntries().list();if(!this._checkEntriesForIntersections(t,t,t))return!1}return!0}_checkEntriesForIntersections(e,t,i){const s=this._buildTestEntries(e,t,i);for(let e=0;e0;){const r=(0,n.clone)((0,o.ensureNotNull)(s.getStartDay()));if((0,n.add_date)(r,-a),!this.isCalWeekEnd(r)){const s={entryIndex:i,weekIndex:e};t.push(s);break}a--}}return t}static _getWeekIndexImpl(e){const t=(0,n.get_cal_utc)((0,n.get_year)(e),(0,n.get_month)(e),1);(0,n.add_date)(t,(0,n.get_day_of_month)(e)-(0,n.get_day_of_week)(e));const i=t.getTime()/1e3;return(0,o.assert)((i+62167219200)%86400==0),Math.trunc((i+62167219200)/86400/7)}}},37236:(e,t,i)=>{"use strict";i.d(t,{DAY_OF_MONTH:()=>P,DAY_OF_WEEK:()=>M,DECEMBER:()=>b,FIRST_DAY_OF_WEEK:()=>_,FRIDAY:()=>d,HOUR_OF_DAY:()=>I,JANUARY:()=>m,JULY:()=>y,LAST_DAY_OF_WEEK:()=>p,MARCH:()=>g,MAY:()=>f,MINUTE:()=>A,MONDAY:()=>a,MONTH:()=>C,NOVEMBER:()=>S,SATURDAY:()=>u,SECOND:()=>L,SEPTEMBER:()=>v,SUNDAY:()=>r,THURSDAY:()=>h,TUESDAY:()=>l,WEDNESDAY:()=>c,WEEK_OF_YEAR:()=>T,YEAR:()=>w,add_date:()=>q,add_days_considering_dst:()=>j,add_minutes:()=>$,add_years_considering_dst:()=>G,cal_to_utc:()=>ae,clone:()=>Y,days_per_year:()=>X,get_cal:()=>oe,get_cal_from_unix_timestamp_ms:()=>ne,get_cal_utc:()=>re,get_day_of_month:()=>O,get_day_of_week:()=>F,get_day_of_year:()=>W,get_hours:()=>R,get_minutes:()=>N,get_minutes_from_midnight:()=>H,get_minutes_with_hours:()=>z,get_month:()=>V,get_part:()=>Q,get_timezone:()=>le,get_year:()=>B,is_leap_year:()=>J,minutesPerDay:()=>k,minutesPerWeek:()=>E,setCustomTimezones:()=>he,set_hms:()=>U,set_seconds:()=>K,time_seconds:()=>ee,time_seconds_diff:()=>te,utc_to_cal:()=>ie,utc_to_cal_ts:()=>se});var s=i(87453);const o={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334};class n{constructor(e){this._invalid=!1,this._name=e;let t=s.tzData[e];!t&&ce&&(t=ce.instance().getTimezoneData(e)),t||(t={time:[],offset:[]},this._invalid=!0),t.time.length!==t.offset.length&&(t={time:[],offset:[]},this._invalid=!0);const i=t;if(!i.time_utc){const e=t.time,s=t.offset,o=e.length,n=new Array(o);for(let t=0;t0){if(e-t[s-1]<=o)return o}return 0}static offset(e,t,i){const s=de(e,i);return-1===s?0:t[s]}}const r=1,a=2,l=3,c=4,h=5,d=6,u=7,_=r,p=u,m=0,g=2,f=4,y=6,v=8,S=10,b=11,w=1,C=2,T=3,P=5,x=6,M=7,I=11,A=12,L=13,k=1440,E=10080,D=864e5;function B(e){return e.getUTCFullYear()}function V(e){return e.getUTCMonth()}function R(e){return e.getUTCHours()}function N(e){
-return e.getUTCMinutes()}function O(e){return e.getUTCDate()}function F(e){return e.getUTCDay()+1}function W(e){const t=e.getUTCMonth();let i=o[t];return t>m+1&&J(e.getUTCFullYear())&&(i+=1),i+e.getUTCDate()}function H(e){return 60*R(e)+N(e)}function z(e){return H(e)}function U(e,t,i,s,o,n){e.setUTCHours(t),e.setUTCMinutes(i),e.setUTCSeconds(s),e.setUTCMilliseconds(o),void 0!==n&&function(e,t){const i=e.getTime(),s=t.correction_loc(i);e.setTime(i+s)}(e,n)}function j(e,t,i){const s=e.offset_utc(t.getTime()),o=Y(t);q(o,i);const n=e.offset_utc(o.getTime());return o.setTime(o.getTime()+s-n),o}function G(e,t,i){let s=t;for(let t=Math.abs(i);t>0;t--)s=j(e,s,Z(s)*Math.sign(i));return s}function q(e,t){e.setTime(e.getTime()+t*D)}function $(e,t){e.setTime(e.getTime()+60*t*1e3)}function K(e,t){const i=86400,s=t%i<0?-1:0,o=Math.trunc(t/i)+s,n=t-o*i,r=Math.trunc(n/3600),a=Math.trunc(n%3600/60);U(e,r,a,n-3600*r-60*a,0),q(e,o)}function Y(e){return new Date(e.getTime())}function Z(e){return X(e.getUTCFullYear())}function X(e){return J(e)?366:365}function J(e){return e%4==0&&(e%100!=0||e%400==0)}function Q(e,t){switch(t){case w:return B(e);case C:return V(e);case P:return O(e);case T:return function(e){const t=new Date(Date.UTC(e.getUTCFullYear(),0,1)).getUTCDay(),i=0===t?1:8-t,s=W(e)-i;return Math.ceil(s/7)+1}(e);case M:return F(e);case I:return R(e);case A:return N(e);case x:return W(e);case L:return function(e){return e.getUTCSeconds()}(e);default:return e.getTime()}}function ee(e){return 1e3*e}function te(e,t){return _e(e)-_e(t)}function ie(e,t){return new Date(se(e,t))}function se(e,t){return t+e.offset_utc(t)}function oe(e,t,i,s,o,n,r){const a=new Date(Date.UTC(t,i,s,o||0,n||0,r||0)),l=e.offset_utc(+a);return new Date(a.valueOf()-l)}function ne(e,t){return new Date(t+e.offset_utc(t))}function re(e,t,i,s=0,o=0,n=0){return new Date(Date.UTC(e,t,i,s,o,n))}function ae(e,t,i){let s=t.getTime();i&&(s+=e.correction_loc(s));return s-e.offset_loc(s)}function le(e){return new n(e)}let ce;function he(e){ce=e}function de(e,t){const i=e.length;if(0===i)return-1;if(isNaN(t))throw Error("Key is NaN");let s=0,o=i-1,n=ue((s+o)/2);for(;;){if(e[n]>t){if(o=n-1,o{e.exports.tzData={"America/New_York":{
+return e.getUTCMinutes()}function O(e){return e.getUTCDate()}function F(e){return e.getUTCDay()+1}function W(e){const t=e.getUTCMonth();let i=o[t];return t>m+1&&J(e.getUTCFullYear())&&(i+=1),i+e.getUTCDate()}function H(e){return 60*R(e)+N(e)}function z(e){return H(e)}function U(e,t,i,s,o,n){e.setUTCHours(t),e.setUTCMinutes(i),e.setUTCSeconds(s),e.setUTCMilliseconds(o),void 0!==n&&function(e,t){const i=e.getTime(),s=t.correction_loc(i);e.setTime(i+s)}(e,n)}function j(e,t,i){const s=e.offset_utc(t.getTime()),o=Y(t);q(o,i);const n=e.offset_utc(o.getTime());return o.setTime(o.getTime()+s-n),o}function G(e,t,i){let s=t;for(let t=Math.abs(i);t>0;t--)s=j(e,s,Z(s)*Math.sign(i));return s}function q(e,t){e.setTime(e.getTime()+t*D)}function $(e,t){e.setTime(e.getTime()+60*t*1e3)}function K(e,t){const i=86400,s=t%i<0?-1:0,o=Math.trunc(t/i)+s,n=t-o*i,r=Math.trunc(n/3600),a=Math.trunc(n%3600/60);U(e,r,a,n-3600*r-60*a,0),q(e,o)}function Y(e){return new Date(e.getTime())}function Z(e){return X(e.getUTCFullYear())}function X(e){return J(e)?366:365}function J(e){return e%4==0&&(e%100!=0||e%400==0)}function Q(e,t){switch(t){case w:return B(e);case C:return V(e);case P:return O(e);case T:return function(e){const t=new Date(Date.UTC(e.getUTCFullYear(),0,1)).getUTCDay(),i=0===t?1:8-t,s=W(e)-i;return Math.ceil(s/7)+1}(e);case M:return F(e);case I:return R(e);case A:return N(e);case x:return W(e);case L:return function(e){return e.getUTCSeconds()}(e);default:return e.getTime()}}function ee(e){return 1e3*e}function te(e,t){return _e(e)-_e(t)}function ie(e,t){return new Date(se(e,t))}function se(e,t){return t+e.offset_utc(t)}function oe(e,t,i,s,o,n,r){const a=new Date(Date.UTC(t,i,s,o||0,n||0,r||0)),l=e.offset_utc(+a);return new Date(a.valueOf()-l)}function ne(e,t){return new Date(t+e.offset_utc(t))}function re(e,t,i,s=0,o=0,n=0){return new Date(Date.UTC(e,t,i,s,o,n))}function ae(e,t,i){let s=t.getTime();i&&(s+=e.correction_loc(s));return s-e.offset_loc(s)}function le(e){return new n(e)}let ce;function he(e){ce=e}function de(e,t){const i=e.length;if(0===i)return-1;if(isNaN(t))throw Error("Key is NaN");let s=0,o=i-1,n=ue((s+o)/2);for(;;){if(e[n]>t){if(o=n-1,o{e.exports.tzData={"America/New_York":{
time:[-2717668562,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1536530400,-1523224800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-76941e4,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-17762,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Los_Angeles":{
time:[-2717668378,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-769420800,-765410400,-687995940,-662680800,-620866800,-608162400,-589417200,-576108e3,-557967600,-544658400,-526518e3,-513208800,-495068400,-481759200,-463618800,-450309600,-431564400,-418255200,-400114800,-386805600,-368665200,-355356e3,-337215600,-323906400,-305766e3,-292456800,-273711600,-261007200,-242262e3,-226533600,-210812400,-195084e3,-179362800,-163634400,-147913200,-13158e4,-116463600,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-28378,-28800,-25200,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Chicago":{
@@ -139,125 +139,124 @@ this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines)
var i=t.new_var(o.open(t)),s=t.new_var(o.high(t)),n=t.new_var(o.low(t)),r=t.new_var(o.close(t)),a=o.abs(s-r.get(1)),l=o.abs(n-r.get(1)),c=o.abs(s-n),h=o.abs(r.get(1)-i.get(1)),d=o.max(a,l),u=o.iff(a>=o.max(l,c),a-.5*l+.25*h,o.iff(l>=o.max(a,c),l-.5*a+.25*h,c+.25*h));return o.iff(0===u,0,(r-r.get(1)+.5*(r-i)+.25*(r.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return o.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return o.gt(e,t)},this.f_1=function(e,t){return o.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(o.close(this._context),o.open(this._context)),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=this.f_1(o.close(this._context),o.open(this._context)),l=this._context.new_var(a),c=o.sum(l,i,this._context);return[this.f_2(r,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._input(2),a=this._context.new_var(i);return[o.alma(a,s,n,r)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",
histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=i+1,r=this._context.new_var(s),a=o.highestbars(r,n,this._context),l=this.f_0(a,i),c=o.low(this._context),h=this._context.new_var(c),d=o.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{symbol:""}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){if(this._context=e,this._input=t,""===this._input(0))return[o.ohlc4(this._context)];this._context.select_sym(0);const i=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);const s=this._context.new_var(o.ohlc4(this._context)).adopt(this._context.new_var(this._context.symbol.time),i,1);return this._context.select_sym(0),[s]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(o.high(this._context)),i=o.change(t),s=this._context.new_var(o.low(this._context)),n=-o.change(s),r=this._context.new_var(o.tr(void 0,this._context)),a=o.rma(r,e,this._context),l=this._context.new_var(o.and(o.gt(i,n),o.gt(i,0))?i:0),c=o.fixnan(100*o.rma(l,e,this._context)/a,this._context),h=this._context.new_var(o.and(o.gt(n,i),o.gt(n,0))?n:0);return[c,o.fixnan(100*o.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],r=s+n,a=this._context.new_var(o.abs(s-n)/(o.eq(r,0)?1:r));return[100*o.rma(a,t,this._context)]},
this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[o.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return o.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=o.hl2(this._context),s=this._context.new_var(i),n=o.sma(s,5,this._context),r=this._context.new_var(i),a=o.sma(r,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=o.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return o.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t
-;var i=o.hl2(this._context),s=this._context.new_var(i),n=o.sma(s,5,this._context),r=this._context.new_var(i),a=o.sma(r,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=o.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),_=o.change(u);return[d,this.f_1(_)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(o.close(this._context),o.open(this._context),o.high(this._context),o.low(this._context))]}}},{name:"BB",metainfo:{_metainfoVersion:23,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#FF0000"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#0000FF"}},precision:4,filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e12},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"BB@tv-basicstudies-1"},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c);return[a,this.f_1(a,h),this.f_2(a,h)]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:53,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0
-}},inputs:{in_0:20,in_1:2,symbol:"",offset:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.time(this._context)),s=o.close(this._context),n=this._input(0),r=this._input(1),a=this._input(2),l=this._input(3);if(""!==n){this._context.select_sym(1);var c=this._context.new_var(o.time(this._context));s=this._context.new_var(o.close(this._context)).adopt(c,i,1),this._context.select_sym(0)}var h=this._context.new_var(s),d=o.sma(h,r,this._context),u=this._context.new_var(s),_=o.stdev(u,r,this._context),p=this.f_0(a,_);return[{value:d,offset:l},{value:this.f_1(d,p),offset:l},{value:this.f_2(d,p),offset:l}]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:53,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t
-;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return o.or(o.and(o.eq(e,t),o.eq(e,i)),o.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(o.close(this._context),o.high(this._context),o.low(this._context),o.volume(this._context)),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=o.volume(this._context),l=this._context.new_var(a),c=o.sum(l,i,this._context);return[this.f_1(r,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},
-description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.accdist(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot",zorder:1}},bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(o.high(this._context)-o.low(this._context)),s=this._context.new_var(o.ema(i,this.period,this._context));return[o.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t
-;var i=this._input(0),s=this._input(1),n=this._input(2),r=o.high(this._context),a=this._context.new_var(r),l=o.highest(a,i,this._context),c=o.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(r),u=o.lowest(d,i,this._context),_=this.f_1(u,s,c),p=this._context.new_var(h),m=o.highest(p,n,this._context),g=this._context.new_var(_);return[o.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return o.ge(e,0)?e:0},this.f_1=function(e){return o.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.close(this._context),n=this._context.new_var(s),r=o.change(n),a=this.f_0(r),l=this.f_1(r),c=this._context.new_var(a),h=o.sum(c,i,this._context),d=this._context.new_var(l),u=o.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){
-var e=o.close(this._context),t=o.hlc3(this._context),i=this._context.new_var(o.high(this._context)),s=o.highest(i,30,this._context),n=o.lowest(i,30,this._context),r=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(o.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*r,h=o.sqrt(1+c*c),d=o.round(180*o.acos(1/h)/3.141592653589793),u=o.iff(o.gt(c,0),-d,d),_=o.and(o.gt(u,-2.14),o.le(u,-.71))?7:8,p=o.and(o.gt(u,-3.57),o.le(u,-2.14))?6:_,m=o.and(o.gt(u,-5),o.le(u,-3.57))?5:p,g=o.le(u,-5)?4:m,f=o.and(o.lt(u,2.14),o.ge(u,.71))?3:g,y=o.and(o.lt(u,3.57),o.ge(u,2.14))?2:f,v=o.and(o.lt(u,5),o.ge(u,3.57))?1:y;return[1,o.ge(u,5)?0:v]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return 100*o.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.atr(1,this._context),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=o.high(this._context),l=this._context.new_var(a),c=o.highest(l,i,this._context),h=o.low(this._context),d=this._context.new_var(h),u=o.lowest(d,i,this._context),_=o.log10(i);return[this.f_0(r,c,u,_)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:2},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,
-bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=o.hlc3(this._context),s=this._input(0),n=this._input(1),r=this._input(2);this._context.setMinimumAdditionalDepth(s+r);var a,l=this._context.new_var(i),c=o.sma(l,s,this._context),h=this._context.new_var(i),d=o.dev(h,s,this._context),u=this.f_0(i,c,d),_=this._context.new_var(u);return"EMA"===n?a=o.ema(_,r,this._context):"WMA"===n?a=o.wma(_,r,this._context):"SMA"===n&&(a=o.sma(_,r,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1,zorder:1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(o.max(o.change(e),0));return o.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-o.min(o.change(e),0));return o.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?o.nz(e)<=0?1:o.nz(e)+1:o.nz(e)>=0?-1:o.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._context.new_var(i),n=this._input(0),r=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a)
-;var l=o.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=o.rsi(this.f_1(c,r,this._context),this.f_2(c,r,this._context)),d=this._context.new_var(o.roc(s,1)),u=o.percentrank(d,a);return[o.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var r=o.close(this._context),a=this._context.new_var(r),l=o.roc(a,s),c=this._context.new_var(r),h=o.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[o.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"symbol",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"",name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),o.period(this._context),o.close(this._context)),n=this._input(1);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),a=o.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(r,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[o.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,
-visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),o.period(this._context)),this._context.new_sym(this._input(1),o.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=o.sma(e,i,s),r=o.sma(t,i,s),a=s.new_var(e.get()*t.get());return(o.sma(a,i,s)-n*r)/Math.sqrt(o.variance2(e,n,i)*o.variance2(t,r,i))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(o.close(this._context)),n=this._context.new_var(o.log(s.get()/s.get(1))),r=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(this._context.symbol.time),l=this._context.new_var(o.close(this._context)),c=this._context.new_var(o.log(l.get()/l.get(1))),h=this._context.new_var(n.adopt(r,a,0)),d=this._context.new_var(this.correlationLog(c,h,this.period,this._context)),u=this._context.new_var(d.adopt(a,i,0)).get(),_=o.round(1e3*u)/1e3;return this._context.select_sym(0),[_]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(o.close(this._context)),n=this._context.new_var(o.sma(s,e,this._context)),r=this._context.new_var(o.close(this._context)).get(i)-n,a=o.close(this._context)-n.get(i);return[t?r:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"
-},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),o.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,offset:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e3,max:1e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.low(this._context),r=this._context.new_var(n);this._context.setMinimumAdditionalDepth(i+Math.max(s,0));var a=o.lowest(r,i,this._context),l=o.high(this._context),c=this._context.new_var(l),h=o.highest(c,i,this._context);return[{value:a,offset:s},{value:h,offset:s},{value:o.avg(h,a),offset:s}]}}},{name:"Double Exponential Moving Average",metainfo:{
-_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i);var s=o.close(this._context),n=this._context.new_var(s),r=o.ema(n,i,this._context),a=this._context.new_var(r),l=o.ema(a,i,this._context);return[this.f_0(r,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,o){return e*t*(i-s)/o},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.hl2(this._context),r=this._context.new_var(n),a=o.change(r),l=this.f_0(i,a,o.high(this._context),o.low(this._context),o.volume(this._context)),c=this._context.new_var(l);return[o.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.close(this._context),n=this._context.new_var(s),r=o.change(n),a=this.f_0(r,o.volume(this._context)),l=this._context.new_var(a);return[o.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,
-is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:o.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.close(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context),h=a,d=c,u=o.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t
-;var i=this._context.new_var(o[this._input(4)](this._context)),s=o.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=o.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=o.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(o.close(this._context)),r=0,a=0,l=0;l0?1:3,i=o.change(this._context.new_var(e));return t-(o.le(i,0)?0:1)},this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t
-;var i=this._context.new_var(this._context.symbol.time),s=o[this._input(3)](this._context),n=this._input(1),r=this._input(2),a=this._input(4),l=this._input(5),c=this._input(6);if(this._context.setMinimumAdditionalDepth(Math.max(n,r)+a),""!==this._input(0)){this._context.select_sym(1);var h=this._context.new_var(this._context.symbol.time),d=o[this._input(3)](this._context);s=this._context.new_var(d).adopt(h,i,0),this._context.select_sym(0)}var u,_,p=this._context.new_var(s);"EMA"===l?u=o.ema(p,n,this._context):"WMA"===l?u=o.wma(p,n,this._context):"SMA"===l&&(u=o.sma(p,n,this._context)),"EMA"===l?_=o.ema(p,r,this._context):"WMA"===l?_=o.wma(p,r,this._context):"SMA"===l&&(_=o.sma(p,r,this._context));var m,g=this.f_0(u,_),f=this._context.new_var(g);"EMA"===c?m=o.ema(f,a,this._context):"WMA"===c?m=o.wma(f,a,this._context):"SMA"===c&&(m=o.sma(f,a,this._context));var y=this.f_0(g,m);return[y,g,m,this.f_1(y)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o[this._input(1)](this._context),s=this._input(0),n=this._input(2),r=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=o.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===r?l=o.ema(d,a,this._context):"WMA"===r?l=o.wma(d,a,this._context):"SMA"===r&&(l=o.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},
-description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o[this._input(1)](this._context),s=this._input(0),n=this._input(2),r=this._context.new_var(i);return[{value:o.wma(r,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{symbol:"",firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"symbol",name:"Another symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.time(this._context)),s=o.close(this._context);if(""!==this._input(0)){this._context.select_sym(1);var n=this._context.new_var(o.time(this._context)),r=o.close(this._context);s=this._context.new_var(r).adopt(n,i,1),this._context.select_sym(0)}var a,l,c=this._context.new_var(s);return"Exponential"===this._input(2)?(a=o.ema(c,this._input(1),this._context),l=o.ema(c,this._input(2),this._context)):"Weighted"===this._input(2)?(a=o.wma(c,this._input(1),this._context),l=o.wma(c,this._input(2),this._context)):(a=o.sma(c,this._input(1),this._context),l=o.sma(c,this._input(2),this._context)),[a,l]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{
-linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{symbol:"",firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time),s=o.close(this._context);if(""!==this._input(0)){this._context.select_sym(1);var n=this._context.new_var(this._context.symbol.time),r=o.close(this._context);s=this._context.new_var(r).adopt(n,i,1),this._context.select_sym(0)}var a,l,c,h=this._context.new_var(s);return"Exponential"===this._input(4)?(a=o.ema(h,this._input(1),this._context),l=o.ema(h,this._input(2),this._context),c=o.ema(h,this._input(3),this._context)):"Weighted"===this._input(4)?(a=o.wma(h,this._input(1),this._context),l=o.wma(h,this._input(2),this._context),c=o.wma(h,this._input(3),this._context)):(a=o.sma(h,this._input(1),this._context),l=o.sma(h,this._input(2),this._context),c=o.sma(h,this._input(3),this._context)),[a,l,c]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),r=o.stdev(t,i,this._context),a=o.log(n/e.get(i))/(r*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.close(this._context)),s=this._context.new_var(o.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,
-is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,o=1;o<=this.periods;++o){var n=Math.sin((1+o)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*o.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return o.gt(e,0)?t:o.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t
-;var i=o.close(this._context),s=this._context.new_var(i),n=o.change(s);return[this.f_0(n,o.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return o.gt(e,0)?t:o.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.close(this._context),r=this._context.new_var(n),a=o.change(r),l=this.f_0(a,o.volume(this._context),a),c=o.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=o.ema(d,s,this._context):"WMA"===i?h=o.wma(d,s,this._context):"SMA"===i&&(h=o.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2,symbol:""}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;const i=()=>o.sar(this._input(1),this._input(2),this._input(3),this._context);if(""===this._input(0))return[i()];this._context.select_sym(0);const s=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);const n=this._context.new_var(i()).adopt(this._context.new_var(this._context.symbol.time),s,1);return this._context.select_sym(0),[n]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,
-isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.high(this._context),s=this._context.new_var(i),n=o.low(this._context),r=this._context.new_var(n),a=this._input(0),l=this._input(1),c=o.highest(s,a,this._context),h=o.lowest(r,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:o.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(o.close(this._context));return[o.cum(o.change(e)/e.get(1)*o.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,
-this._input=t,[this.f_0()[0]]}}},{name:"Rank Correlation Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:12}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"RCI",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Rank Correlation Index",shortDescription:"RCI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"length",defval:12,type:"integer",min:1,max:1e12}],id:"rank_correlation_index@tv-basicstudies-1",scriptIdPart:"",name:"Rank Correlation Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.orderRank=function(e,t,i){let s=e.get(t),n=1,r=0;for(let t=0;t0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){return this._context=e,this._input=t,[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[o.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",
-name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[o.sum(s,i,this._context)/o.sum(n,i,this._context)]},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(o.close(this._context)),n=o.max(o.high(this._context),s.get(1)),r=this._context.new_var(o.close(this._context)),a=o.min(o.low(this._context),r.get(1)),l=o.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return o.sqrt(s)},this.variance=function(e,t,i){var s=o.sma(e,t,i);return this.variance2(e,s,t)},this.variance2=function(e,t,i){var s,o,n=0;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(o.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,
-this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=o.high(this._context)-o.low(this._context),t=o.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-o.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=o.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(o.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(o.close(this._context)),1===this.count)this.atr=o.high(this._context)-o.low(this._context),this.sic=o.close(this._context);else if(this.countthis.sic&&(this.sic=o.close(this._context))}else if(this.count===this.period){e=o.high(this._context)-o.low(this._context),t=o.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-o.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,o.close(this._context)>this.sic&&(this.sic=o.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?o.close(this._context)s?(this.position="LONG",this.sic=o.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(o.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){
-this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return o.weekofyear(e,t)!==o.weekofyear(e,i)||o.year(e,t)!==o.year(e,i)};case"Month":return function(t,i){return o.month(e,t)!==o.month(e,i)||o.year(e,t)!==o.year(e,i)};case"Quarter":return function(t,i){return Math.floor(o.month(e,t)/3)!==Math.floor(o.month(e,i)/3)||o.year(e,t)!==o.year(e,i)};case"Year":return function(t,i){return o.year(e,t)!==o.year(e,i)};case"Decade":return function(t,i){return Math.floor(o.year(e,t)/10)!==Math.floor(o.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(o.year(e,t)/100)!==Math.floor(o.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var(),r=e.new_var();const a=o.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=o.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),r.set(a))}return s.set(o.nz(s.get(1))+o[i](this._context)*o.volume(this._context)),n.set(o.nz(n.get(1))+o.volume(this._context)),o.na(r.get(0))?(e.symbol.isLastBar&&o.error("To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.","VWAP is waiting for more data"),[NaN]):[s.get(0)/n.get(0)]}}},{name:"VWMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._context.new_var(i);return[o.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",
-name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.volume(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._context.new_var(o.low(this._context)),i=this._context.new_var(o.abs(o.high(this._context)-t.get(1))),s=o.sum(i,e,this._context),n=this._context.new_var(o.high(this._context)),r=this._context.new_var(o.abs(o.low(this._context)-n.get(1))),a=o.sum(r,e,this._context),l=this._context.new_var(o.atr(1,this._context)),c=o.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=this._context.new_var(s),r=o.highest(n,i,this._context),a=o.low(this._context),l=this._context.new_var(a),c=o.lowest(l,i,this._context)
-;return[this.f_0(o.close(this._context),r,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),r=this._input(3),a=this._input(4),l=this._input(5),c=o.hl2(this._context);return[{value:o.smma(c,i,this._context),offset:r},{value:o.smma(c,s,this._context),offset:a},{value:o.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(o.high(this._context)),i=!0,s=!0,n=!0,r=!0,a=!0,l=!0,c=1;c<=e;c++)i=o.and(i,o.lt(t.get(e-c),t.get(e))),s=o.and(s,o.lt(t.get(e+c),t.get(e))),n=o.and(n,o.and(o.le(t.get(e+1),t.get(e)),o.lt(t.get(e+c+1),t.get(e)))),
-r=o.and(r,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.lt(t.get(e+c+2),t.get(e))))),a=o.and(a,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.lt(t.get(e+c+3),t.get(e)))))),l=o.and(l,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.and(o.le(t.get(e+4),t.get(e)),o.lt(t.get(e+c+4),t.get(e)))))));var h=o.or(s,o.or(n,o.or(r,o.or(a,l)))),d=o.and(i,h),u=this._context.new_var(o.low(this._context)),_=1,p=1,m=1,g=1,f=1,y=1;for(c=1;c<=e;c++)_=o.and(_,o.gt(u.get(e-c),u.get(e))),p=o.and(p,o.gt(u.get(e+c),u.get(e))),m=o.and(m,o.and(o.ge(u.get(e+1),u.get(e)),o.gt(u.get(e+c+1),u.get(e)))),g=o.and(g,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.gt(u.get(e+c+2),u.get(e))))),f=o.and(f,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.gt(u.get(e+c+3),u.get(e)))))),y=o.and(y,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.and(o.ge(u.get(e+4),u.get(e)),o.gt(u.get(e+c+4),u.get(e)))))));var v=o.or(p,o.or(m,o.or(g,o.or(f,y))));return[o.and(_,v),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{
-color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t
-;var i=this._context.new_var(o.close(this._context)),s=this._input(0),n=this._input(1),r=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=o.ema(i,s,this._context),d=o.ema(i,n,this._context),u=o.ema(i,r,this._context),_=o.ema(i,a,this._context),p=o.ema(i,l,this._context),m=o.ema(i,c,this._context),g=this._input(6),f=this._input(7),y=this._input(8),v=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,_,p,m,o.ema(i,g,this._context),o.ema(i,f,this._context),o.ema(i,y,this._context),o.ema(i,v,this._context),o.ema(i,S,this._context),o.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==o.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||o.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==o.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=o.time(this._context),r=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(o[i](this._context)),l=this._context.new_unlimited_var(o[s](this._context));if(r.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=o.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=r.indexOf(c.getTime()),d=-1===h?NaN:o.highest(a,h,this._context),u=-1===h?NaN:o.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},30342:(e,t,i)=>{"use strict";var s;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},81593:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(34840)},48480:()=>{"use strict"
-;TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},32544:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>r,getQuoteSessionInstance:()=>n});var s=i(13607);const o={};function n(e="full"){return o[e]||function(e="full",t){o[e]=t}(e,new s(e)),o[e]}function r(){for(const e in o)if(o.hasOwnProperty(e)){const t=o[e];void 0!==t&&t.destroy(),delete o[e]}}},13607:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(20057).default,o=i(90484).default,n=i(67563).PriceFormatter;const{uniq:r}=i(53470);var a=i(4168);const{normalizeUpdateMode:l}=i(52706);var c=i(39527).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(30947);var u=i(48096).Delegate;const{getNewPeveCloseMode:_}=i(98422),{QuoteSession:p}=i(76220);function m(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new u,this.onDisconnect=new u,this._quoteApi=new p(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=o(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}m.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},m.prototype.typeFields={},m.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id","unit_id","measure"],m.prototype.typeFields.simpleDetailed=[].concat(m.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),m.prototype.typeFields.full=[],m.prototype.typeFields.watchlist=[].concat(m.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id","dividends_availability","financials_availability","earnings_availability"]),
-m.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","local_description","language","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_calc","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id","unit_id","measure"],m.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],m.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],m.prototype.typeFields.economic=["reference-last-period","lp","currency_code","value_unit_id","unit_id","measure"],m.prototype.typeFields.options=["ask","bid","lp","volume"],m.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},m.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},m.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},m.prototype.setFields=function(){var e=m.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},m.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];_()&&(delete e.values.prev_close_price,void 0!==e.values.regular_close&&(e.values.prev_close_price=e.values.regular_close)),i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},m.prototype._parseUpdateMode=function(e){l(e)},m.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var o=this._subscriptions[s];o.has(e)&&[...o.get(e)].forEach((function(e){e(t,i)}))}},m.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e]
-;t=[].concat(t);var o=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},o.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),o.length&&this._connected&&(this._quoteApi.quoteAddSymbols(o),this._delayUpdateFastSymbols())},m.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],o=[],n=0;n{"use strict";i.d(t,{getServerInterval:()=>o})
-;var s=i(46082);function o(e){return s.Interval.isRange(e)?"1":e}},45720:(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 o(e,t,i){const s=e.get(t);if(void 0!==s)return s;const o=i();return e.set(t,o),o}function n(e,t,i,n){return o(s(e,t,new Map),i,n)}function r(e,t,i,o,n){const r=s(e,t,new Map),a=s(r,i,new Map);return s(a,o,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>r});class a{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}},12217:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>s.compareTwoCollectionsByIds,indexOf:()=>s.indexOf,intersect:()=>s.intersect,join:()=>s.join,lowerbound:()=>s.lowerbound,lowerboundExt:()=>s.lowerboundExt,lowerbound_int:()=>s.lowerbound_int,mapEntriesGenerator:()=>s.mapEntriesGenerator,moveAfter:()=>s.moveAfter,moveBefore:()=>s.moveBefore,moveToHead:()=>s.moveToHead,nestedMapGenerator:()=>s.nestedMapGenerator,removeItemFromArray:()=>s.removeItemFromArray,subtract:()=>s.subtract,sum:()=>s.sum,upperbound:()=>s.upperbound,upperbound_int:()=>s.upperbound_int});var s=i(16879)},69558:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_DASHED:()=>n,LINESTYLE_DOTTED:()=>o,LINESTYLE_LARGE_DASHED:()=>r,LINESTYLE_SMALL_DASHED:()=>l,LINESTYLE_SOLID:()=>s,LINESTYLE_SPARSE_DOTTED:()=>a});const s=0,o=1,n=2,r=3,a=4,l=5},16659:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>r});var s,o=i(50151);function n(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}!function(e){e[e.CapacityFactor=1.3]="CapacityFactor"}(s||(s={}));class r{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&&(n(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){const t=this._cache.get(e);if(void 0===t)return t;if(t===this._firstItem&&(this._firstItem=t.nextItem??t),t!==this._lastItem){n(t);const e=(0,o.ensureNotNull)(this._lastItem);e.nextItem=t,t.prevItem=e,t.nextItem=null,this._lastItem=t}return t.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(n(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}*entries(){if(null!==this._firstItem)for(let e=this._firstItem;null!==e;e=e.nextItem)yield[e.key,e.value]}state(){const e=[];for(const[t,i]of this.entries())e.push([t,i]);return e}restoreState(e){for(const t of e)this.set(t[0],t[1])}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,
-o.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{accumulate:()=>a,combine:()=>r,combineWithFilteredUpdate:()=>n});var s=i(22613);function o(e,t,...i){let o=null;const n=(...t)=>e(...t.map((e=>e.value())),o?.value()),r=o=new s.WatchedValue(n(...i)),a=()=>{const e=i.map(((e,t)=>e.value()));t(...e)&&r.setValue(n(...i))},l=i.map((e=>e.spawn()));for(const e of l)e.subscribe(a);return r.readonly().spawn((()=>{l.forEach((e=>e.destroy())),i.forEach((e=>e.release()))}))}function n(e,t,...i){return o(e,t,...i)}function r(e,...t){return o(e,(()=>!0),...t)}function a(e,t,...i){let o=null;const n=r(((...e)=>(e.splice(-1),e)),...i),a=t.spawn(),l=(t,...i)=>{const s=t.map((e=>e.value()));return e(s,...i,o?.value())},c=o=new s.WatchedValue(l(a.value(),...n.value()));let h=[];const d=()=>{c.setValue(l(h,...n.value()))},u=e=>{h.forEach((e=>e.destroy())),h=e.map((e=>e.spawn())),h.forEach((e=>e.subscribe(d))),d()};u(a.value()),a.subscribe(u),n.subscribe(d);return c.readonly().spawn((()=>{h.forEach((e=>e.destroy())),a.destroy(),n.destroy(),t.release()}))}},10845:(e,t,i)=>{"use strict";i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,timezoneIsSupported:()=>_,timezoneTitle:()=>p,updateAvailableTimezones:()=>d});var s=i(95523),o=i(11542);const n=[{id:"Etc/UTC",get title(){return o.t(null,void 0,i(1833))}},{id:"exchange",get title(){return o.t(null,void 0,i(86905))}}],r=[{id:"Africa/Cairo",get title(){return o.t(null,void 0,i(65736))},offset:0},{id:"Africa/Casablanca",get title(){return o.t(null,void 0,i(70409))},offset:0},{id:"Africa/Johannesburg",get title(){return o.t(null,void 0,i(39585))},offset:0},{id:"Africa/Lagos",get title(){return o.t(null,void 0,i(19931))},offset:0},{id:"Africa/Nairobi",get title(){return o.t(null,void 0,i(40977))},offset:0},{id:"Africa/Tunis",get title(){return o.t(null,void 0,i(21007))},offset:0},{id:"America/Anchorage",get title(){return o.t(null,void 0,i(42630))},offset:0},{id:"America/Argentina/Buenos_Aires",get title(){return o.t(null,void 0,i(25282))},offset:0},{id:"America/Bogota",get title(){return o.t(null,void 0,i(73905))},offset:0},{id:"America/Caracas",get title(){return o.t(null,void 0,i(30948))},offset:0},{id:"America/Chicago",get title(){return o.t(null,void 0,i(72452))},offset:0},{id:"America/El_Salvador",get title(){return o.t(null,void 0,i(55502))},offset:0},{id:"America/Juneau",get title(){return o.t(null,void 0,i(67560))},offset:0},{id:"America/Lima",get title(){return o.t(null,void 0,i(59444))},offset:0},{id:"America/Los_Angeles",get title(){return o.t(null,void 0,i(28733))},offset:0},{id:"America/Mexico_City",get title(){return o.t(null,void 0,i(73332))},offset:0},{id:"America/New_York",get title(){return o.t(null,void 0,i(40544))},offset:0},{id:"America/Phoenix",get title(){return o.t(null,void 0,i(14055))},offset:0},{id:"America/Santiago",get title(){return o.t(null,void 0,i(30231))},offset:0},{id:"America/Sao_Paulo",get title(){
-return o.t(null,void 0,i(91912))},offset:0},{id:"America/Toronto",get title(){return o.t(null,void 0,i(10095))},offset:0},{id:"America/Vancouver",get title(){return o.t(null,void 0,i(32838))},offset:0},{id:"US/Mountain",get title(){return o.t(null,void 0,i(27358))},offset:0},{id:"Asia/Almaty",get title(){return o.t(null,void 0,i(98128))},offset:0},{id:"Asia/Ashkhabad",get title(){return o.t(null,void 0,i(63627))},offset:0},{id:"Asia/Bahrain",get title(){return o.t(null,void 0,i(90594))},offset:0},{id:"Asia/Bangkok",get title(){return o.t(null,void 0,i(47045))},offset:0},{id:"Asia/Chongqing",get title(){return o.t(null,void 0,i(50349))},offset:0},{id:"Asia/Colombo",get title(){return o.t(null,void 0,i(10871))},offset:0},{id:"Asia/Dhaka",get title(){return o.t(null,void 0,i(24959))},offset:0},{id:"Asia/Dubai",get title(){return o.t(null,void 0,i(23650))},offset:0},{id:"Asia/Ho_Chi_Minh",get title(){return o.t(null,void 0,i(34491))},offset:0},{id:"Asia/Hong_Kong",get title(){return o.t(null,void 0,i(48861))},offset:0},{id:"Asia/Jakarta",get title(){return o.t(null,void 0,i(14995))},offset:0},{id:"Asia/Jerusalem",get title(){return o.t(null,void 0,i(36057))},offset:0},{id:"Asia/Karachi",get title(){return o.t(null,void 0,i(70913))},offset:0},{id:"Asia/Kabul",get title(){return o.t(null,void 0,i(99563))},offset:0},{id:"Asia/Kathmandu",get title(){return o.t(null,void 0,i(54533))},offset:0},{id:"Asia/Kolkata",get title(){return o.t(null,void 0,i(31561))},offset:0},{id:"Asia/Kuala_Lumpur",get title(){return o.t(null,void 0,i(38561))},offset:0},{id:"Asia/Kuwait",get title(){return o.t(null,void 0,i(76614))},offset:0},{id:"Asia/Manila",get title(){return o.t(null,void 0,i(48991))},offset:0},{id:"Asia/Muscat",get title(){return o.t(null,void 0,i(9865))},offset:0},{id:"Asia/Nicosia",get title(){return o.t(null,void 0,i(94600))},offset:0},{id:"Asia/Qatar",get title(){return o.t(null,void 0,i(28756))},offset:0},{id:"Asia/Riyadh",get title(){return o.t(null,void 0,i(37974))},offset:0},{id:"Asia/Seoul",get title(){return o.t(null,void 0,i(26820))},offset:0},{id:"Asia/Shanghai",get title(){return o.t(null,void 0,i(1852))},offset:0},{id:"Asia/Singapore",get title(){return o.t(null,void 0,i(77377))},offset:0},{id:"Asia/Taipei",get title(){return o.t(null,void 0,i(11034))},offset:0},{id:"Asia/Tehran",get title(){return o.t(null,void 0,i(6686))},offset:0},{id:"Asia/Tokyo",get title(){return o.t(null,void 0,i(69122))},offset:0},{id:"Asia/Yangon",get title(){return o.t(null,void 0,i(53168))},offset:0},{id:"Atlantic/Azores",get title(){return o.t(null,void 0,i(87580))},offset:0},{id:"Atlantic/Reykjavik",get title(){return o.t(null,void 0,i(13386))},offset:0},{id:"Australia/Adelaide",get title(){return o.t(null,void 0,i(37265))},offset:0},{id:"Australia/Brisbane",get title(){return o.t(null,void 0,i(79336))},offset:0},{id:"Australia/Perth",get title(){return o.t(null,void 0,i(24436))},offset:0},{id:"Australia/Sydney",get title(){return o.t(null,void 0,i(31622))},offset:0},{id:"Europe/Amsterdam",get title(){return o.t(null,void 0,i(36485))},
-offset:0},{id:"Europe/Athens",get title(){return o.t(null,void 0,i(73702))},offset:0},{id:"Europe/Belgrade",get title(){return o.t(null,void 0,i(71797))},offset:0},{id:"Europe/Berlin",get title(){return o.t(null,void 0,i(64313))},offset:0},{id:"Europe/Bratislava",get title(){return o.t(null,void 0,i(70876))},offset:0},{id:"Europe/Brussels",get title(){return o.t(null,void 0,i(91499))},offset:0},{id:"Europe/Bucharest",get title(){return o.t(null,void 0,i(33672))},offset:0},{id:"Europe/Budapest",get title(){return o.t(null,void 0,i(20313))},offset:0},{id:"Europe/Copenhagen",get title(){return o.t(null,void 0,i(38917))},offset:0},{id:"Europe/Dublin",get title(){return o.t(null,void 0,i(79716))},offset:0},{id:"Europe/Helsinki",get title(){return o.t(null,void 0,i(48203))},offset:0},{id:"Europe/Istanbul",get title(){return o.t(null,void 0,i(78326))},offset:0},{id:"Europe/Lisbon",get title(){return o.t(null,void 0,i(53375))},offset:0},{id:"Europe/London",get title(){return o.t(null,void 0,i(19439))},offset:0},{id:"Europe/Luxembourg",get title(){return o.t(null,void 0,i(81038))},offset:0},{id:"Europe/Madrid",get title(){return o.t(null,void 0,i(52066))},offset:0},{id:"Europe/Malta",get title(){return o.t(null,void 0,i(38365))},offset:0},{id:"Europe/Moscow",get title(){return o.t(null,void 0,i(64039))},offset:0},{id:"Europe/Oslo",get title(){return o.t(null,void 0,i(75722))},offset:0},{id:"Europe/Paris",get title(){return o.t(null,void 0,i(61879))},offset:0},{id:"Europe/Prague",get title(){return o.t(null,void 0,i(81248))},offset:0},{id:"Europe/Riga",get title(){return o.t(null,void 0,i(94022))},offset:0},{id:"Europe/Rome",get title(){return o.t(null,void 0,i(52961))},offset:0},{id:"Europe/Stockholm",get title(){return o.t(null,void 0,i(86716))},offset:0},{id:"Europe/Tallinn",get title(){return o.t(null,void 0,i(79995))},offset:0},{id:"Europe/Vienna",get title(){return o.t(null,void 0,i(23160))},offset:0},{id:"Europe/Vilnius",get title(){return o.t(null,void 0,i(60534))},offset:0},{id:"Europe/Warsaw",get title(){return o.t(null,void 0,i(5959))},offset:0},{id:"Europe/Zurich",get title(){return o.t(null,void 0,i(62859))},offset:0},{id:"Pacific/Auckland",get title(){return o.t(null,void 0,i(66103))},offset:0},{id:"Pacific/Chatham",get title(){return o.t(null,void 0,i(36549))},offset:0},{id:"Pacific/Fakaofo",get title(){return o.t(null,void 0,i(98549))},offset:0},{id:"Pacific/Honolulu",get title(){return o.t(null,void 0,i(79668))},offset:0},{id:"Pacific/Norfolk",get title(){return o.t(null,void 0,i(67891))},offset:0}];function a(e,t,i){const o=function(e){return e.map((e=>{const{id:t}=e,{string:i,offset:o}=(0,s.parseTzOffset)(t);return{id:t,offset:o,get title(){return`(${i}) ${e.title}`}}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((e=>{const{alias:t,id:i}=e,{string:o,offset:n}=(0,s.parseTzOffset)(t);return{id:i,offset:n,get title(){return`(${o}) ${e.title}`},alias:t}})),r=function(e){return e.sort(((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}))}(o.concat(n));return t.concat(r)}
-const l=a(r,n,[]),c=new Map;l.forEach((e=>{c.set(e.id,!0)}));const h=new Map;n.concat(r).forEach((e=>{h.set(e.id,!0)}));const d=e=>{l.splice(0,l.length,...a(r,n,e)),l.forEach((e=>{c.set(e.id,!0)}))};function u(e){return c.has(e)}function _(e){return h.get(e)||!1}function p(e){for(const{id:t,title:i}of r)if(t===e){return`${i} (${(0,s.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},48096:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(9343).getLogger)("Common.Delegate");function o(e){return!e.singleShot}class n{constructor(){this.fire=this._fireImpl.bind(this),this._listeners=[]}subscribe(e,t,i){this._listeners.push({object:e,member:t,singleShot:!!i,skip:!1})}unsubscribe(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}}destroy(){this._listeners=[]}_fireImpl(...e){const t=this._listeners;this._listeners=this._listeners.filter(o);const i=t.length;for(let o=0;o{"use strict";var s,o;i.d(t,{HorizontalAlign:()=>s,VerticalAlign:()=>o}),function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(o||(o={}))},55014:(e,t,i)=>{"use strict";i.d(t,{formatStudyError:()=>n,triesTranslateError:()=>o});var s=i(11542);function o(e){return r.get(e)||e}function n(e){return e.format({boldHighlightStart:"",boldHighlightEnd:""})}
-const r=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void 0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(69156))],["Runtime error",s.t(null,void 0,i(60630))],["Access error",s.t(null,void 0,i(77401))],["User-defined error",s.t(null,void 0,i(8580))],["Compilation error",s.t(null,void 0,i(12086))],["Metric error",s.t(null,void 0,i(83111))],["There's no data for your selected period and chart timeframe.",s.t(null,void 0,i(43716))],["The request took too long to process. Ensure you have a stable internet connection. If the issue persists, try decreasing the length of the requested time interval.",s.t(null,void 0,i(99274))],["Unexpected error in Deep Backtesting mode. Contact support for more information.",s.t(null,void 0,i(56815))],["check study unexpected error",s.t(null,void 0,i(83524))],["To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.",s.t(null,void 0,i(41446))],["VWAP is waiting for more data",s.t(null,void 0,i(81030))],["The Bar Magnifier feature is only available to Premium users",s.t(null,void 0,i(45328))],["The bar magnifier is only available to the Premium plan or higher.",s.t(null,void 0,i(35601))]])},64971:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});const s=new Map;function o(e){e.crossOrigin="anonymous"}function n(e,t,i=o){let n=s.get(e);return void 0===n&&(n=new Promise(((e,s)=>{const o=new Image;o.onload=()=>{e(o),o.onload=null,o.onerror=null},o.onerror=()=>{s(),o.onload=null,o.onerror=null},i(o),o.src=t})),s.set(e,n)),n}},38486:(e,t,i)=>{"use strict";function s(e){const t=Object.create(e);return t.release=()=>{},t.ownership=()=>t,t}function o(e){const t=e;return t.release=()=>t.destroy(),t.ownership=()=>t,t}i.d(t,{ownership:()=>o,weakReference:()=>s})},95523:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>o});var s=i(37236);function o(e,t=Date.now()){const i=(0,s.get_timezone)(e).offset_utc(t);let o="";const n=i/1e3/60/60;n%1&&(o=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));let r="";return r=n>0?"+"+(n-n%1)+o:0===n?"":String(n-n%1+o),{offset:i,string:"UTC"+r}}},4148:(e,t,i)=>{"use strict";i.d(t,{clone:()=>s.clone,isNumber:()=>s.isNumber,isObject:()=>s.isObject});var s=i(87465)},59149:e=>{"use strict";var t=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{
-d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],i=function(){var e=[{pattern:"(",ctor:n},{pattern:")",ctor:r},{pattern:"+",ctor:l},{pattern:"-",ctor:c},{pattern:"*",ctor:h},{pattern:"/",ctor:d},{pattern:"^",ctor:u},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:g},{pattern:/\./,ctor:v},{pattern:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/,ctor:m},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:o}];function i(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function s(){}function o(e){this.value=e}function n(){}function r(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}s.prototype.toString=function(){return this.value},i(o,s),i(n,s),n.prototype.value="(",i(r,s),r.prototype.value=")",i(a,s),i(l,a),l.prototype.value="+",l.prototype.precedence=0,l.prototype.commutative=!0,i(c,a),c.prototype.value="-",c.prototype.precedence=0,c.prototype.commutative=!1,i(h,a),h.prototype.value="*",h.prototype.precedence=1,h.prototype.commutative=!0,i(d,a),d.prototype.value="/",d.prototype.precedence=1,d.prototype.commutative=!1,i(u,a),u.prototype.value="^",u.prototype.precedence=2,u.prototype.commutative=!1;var _=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,p=/[+\-/*]/;function m(e){this.value=e}function g(e){this.value=e}function f(e){this.value=e}function y(){m.apply(this,arguments)}function v(){g.apply(this,arguments)}i(m,s),m.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=p.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},m.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},m.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return t.some((function(t){return t.t===e}))},i=2;i>=1;--i){var s=this._ticker.slice(0,i);if(e(s)){this._root=s,this._contract=this._ticker.slice(i);break}}},m.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null==e?delete this._exchange:this._exchange=e+""},m.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},m.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},m.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},i(g,s),g.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},
-g.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},f.prototype.toString=function(){return this.value},i(y,m),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},i(v,g),v.prototype.isIncomplete=!0;var S=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function b(t,i){var s,n=[];e:for(;s=S.exec(t);){for(var r=e.length;r--;)if(s[r+1]){if(e[r].ctor){var a=new e[r].ctor(s[r+1]);a._offset=s.index,n.push(a)}continue e}var l=new f(s[0]);l._offset=s.index,n.push(l)}if(i&&i.recover){var c;for(r=n.length;r--;){var h=n[r];if(h instanceof g||h instanceof m){if(void 0!==c){var d=new m(""),u=n.splice(r,c-r+1,d);d.value=u.map((function(e){return e.value})).join("")}c=r}else h instanceof o||(c=void 0)}}return n}function w(e){for(var t=[],i=0;il.precedence&&(s[s.length-1].minPrecedence=l.precedence);else if(l instanceof n)s.push(t={minPrecedence:1/0,openBraceIndex:o});else if(l instanceof r){var c=e[(t=s.pop()).openBraceIndex-1],h=e[o+1];h instanceof a&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof a)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(o=i.length;o--;)e.splice(i[o],1);return e}function T(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=b(e)).filter((function(e){return e instanceof m})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function P(e){return 1!==(e=T(e)).length?null:e[0]}function x(e,t){return(e=T(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:b,validate:function(e){return{currentState:"var"}},factorOutBraces:C,normalizeTokens:function(e){for(var t=0;t{"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 o of Object.keys(e)){const n=e[o];n instanceof s?(t[o]=n.originalText(),i[o]=n.translatedText()):(t[o]=n.toString(),i[o]=n.toString())}const o=this._originalText.format(t),n=this._translatedText.format(i);return new s(o,n)}}},9787:(e,t,i)=>{"use strict";i.d(t,{Version:()=>o});var s=i(50151);class o{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof o)return new o(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new o(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new o(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0,s.assert)(!isNaN(n),"Bad version string: "+e),new o(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}o.ZERO=new o(0,0)},22613:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>s.WatchedValue});var s=i(52499)},62773:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>s.WatchedObject});var s=i(52499)},99247:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>r,initMouseClickAutoBlurHandler:()=>a});var s=i(81251),o=i(76460);const n="data-mouse-click-auto-blur";class r{constructor(){this._handler=e=>{document.activeElement instanceof HTMLElement&&((0,o.isKeyboardClick)(e)||e.target instanceof Element&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}static attributes(e=!0){return e?{[n]:!0}:{}}}const a=(0,s.default)((()=>new r))},
-22692:(e,t,i)=>{"use strict";i.d(t,{mapKeyCodeToDirection:()=>h,navigationOrderComparator:()=>r,queryFocusableElements:()=>l,queryTabbableElements:()=>a,updateTabIndexes:()=>c});var s,o=i(24640),n=i(15754);function r(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function a(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,n.createScopedVisibleElementFilter)(e))}function l(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""]), [tabindex]:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""])')).filter((0,n.createScopedVisibleElementFilter)(e))}function c(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function h(e){const t=(0,o.isRtl)();switch(e){case 38:return"blockPrev";case 40:return"blockNext";case 37:return t?"inlineNext":"inlinePrev";case 39:return t?"inlinePrev":"inlineNext";default:return null}}!function(e){e.BlockPrev="blockPrev",e.BlockNext="blockNext",e.InlinePrev="inlinePrev",e.InlineNext="inlineNext"}(s||(s={}))},66593:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>o,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,o=5},55308:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(1765),o=i(37103),n=i(22613);const r=!o.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",r),l=new n.WatchedValue(a)},9753:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>o});var s=i(41183);const o=parseInt(s["css-value-header-toolbar-height"]),n=3},23745:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>r});var s=i(49483),o=i(84015),n=i(37103);function r(){return!s.CheckMobile.any()&&!(0,o.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},14429:(e,t,i)=>{"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(41706),o=i(84696);class n extends s.Action{constructor(e){const{options:t,customActionOptions:i}=e;t.iconId&&(t.icon=t.icon??o.icons.get(t.iconId)),i&&i.iconId&&(i.icon=i.icon??o.icons.get(i.iconId)),super(e)}}},41706:(e,t,i)=>{"use strict";i.d(t,{Action:()=>c,Separator:()=>h});var s,o=i(50151),n=i(68335),r=i(4226),a=i(48096);class l extends a.Delegate{constructor(e){super(),this._onStartListening=null,this._onStopListening=null,this._onStartListening=e||null}subscribe(e,t,i){const s=0===this._listeners.length;super.subscribe(e,t,i),s&&this._listeners.length>0&&this._onStartListening&&(this._onStopListening=this._onStartListening())}unsubscribe(e,t){const i=0===this._listeners.length;super.unsubscribe(e,t),!i&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),this._onStopListening=null)}unsubscribeAll(e){const t=0===this._listeners.length;super.unsubscribeAll(e),!t&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),
-this._onStopListening=null)}destroy(){this._onStopListening&&(this._onStopListening(),this._onStopListening=null),super.destroy()}}!function(e){e.Normal="normal",e.Big="big"}(s||(s={}));class c{constructor(e){this.type="action",this._destroyed=!1,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:s,customActionOptions:n,customActionOptionsLoader:a,id:h=r.guid(),onStartListening:d}=e;(0,o.assert)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new l(d),this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=s??null,this._loadOptionsGetter&&(this._options.loading=!0),n&&(this._customAction=new c({actionId:t,options:n,optionsLoader:a,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(){return this._options.size??"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}}destroy(){this._destroyed=!0,this._onUpdate.destroy(),this._unbindShortcut(),this._options.onDestroy?.(),this._customAction?.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 h{constructor(e){this.type="separator",this.id=r.guid(),this._hint=e}getHint(){return this._hint}}},84696:(e,t,i)=>{"use strict";i.d(t,{icons:()=>w});var s,o=i(53573),n=i(34369),r=i(39267),a=i(93544),l=i(84959),c=i(34487),h=i(11890),d=i(16911),u=i(25191),_=i(54190),p=i(6862),m=i(97874),g=i(2872),f=i(29453),y=i(94839),v=i(5845),S=i(1457),b=i(93379);!function(e){e.ChartShowDataWindow="Chart.ShowDataWindow",e.ChartReset="Chart.Reset",e.ChartRemoveSelectedObject="Chart.RemoveSelectedObject",e.Settings="Settings",e.ChartHide="Chart.Hide",e.ChartSymbolInfo="Chart.SymbolInfo",e.ChartFinancials="Chart.Financials",e.ChartTechnicals="Chart.Technicals",e.ChartDetailsMetrics="Chart.DetailsMetrics",e.ChartSeasonals="Chart.Seasonals",e.ChartAnalysis="Chart.Analysis",e.ChartStockBonds="Chart.StockBonds",e.ChartForecast="Chart.Forecast",e.ChartOptions="Chart.Options",e.ChartEconomyIdicators="Chart.EconomyIndicators",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertRestart="Alert.Restart",e.AlertStop="Alert.Stop",e.AlertFiresDownload="Alert.FiresDownload",e.ClearAll="Alert.Clear",e.ChartVisualOrder="Chart.VisualOrder",e.ChartShowObject="Chart.ShowObject",e.ChartPriceScale="Chart.PriceScale",e.ChartMove="Chart.Move",e.ChartApplyIndicator="Chart.ApplyIndicator",e.ChartUnlockObject="Chart.UnlockObject",e.ChartLockObject="Chart.LockObject",e.ChartAnchorLineTool="Chart.AnchorLineTool",e.ChartInsertRowTable="Chart.InsertRowTable",e.ChartInsertColumnTable="Chart.InsertColumnTable",e.ChartRemoveRowTable="Chart.RemoveRowTable",e.ChartRemoveColumnTable="Chart.RemoveColumnTable",e.ChartClone="Chart.Clone",e.ChartAddHorzLine="Chart.AddHorzLine",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreateNew="Watchlist.CreateNew",e.TextNoteAdd="TextNote.Add",e.TradingSell="Trading.Sell",e.TradingBuy="Trading.Buy",e.TradingAddOrder="Trading.AddOrder",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem",e.IndicatorAddToFavorites="Indicator.AddToFavorites"}(s||(s={}));const w=new Map([["Chart.Reset",r],["Chart.RemoveSelectedObject",a],["Settings",n],["Chart.Hide",l],["Chart.SymbolInfo",c],["Chart.VisualOrder",h],["Chart.ShowObject",d],["Chart.PriceScale",u],["Chart.Move",_],["Chart.ApplyIndicator",p],["Chart.UnlockObject",m],["Chart.LockObject",g],["Chart.AnchorLineTool",f],["Chart.InsertRowTable",y],["Chart.InsertColumnTable",v],["Chart.RemoveRowTable",a],["Chart.RemoveColumnTable",a],["Chart.Clone",S],["Chart.AddHorzLine",b],["Indicator.AddToFavorites",o]])},31932:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(3462),i.e(6025),i.e(9378),i.e(1485),i.e(5456),i.e(6602)]).then(i.bind(i,95616))}i.d(t,{actionsProviderModule:()=>s})},72104:(e,t,i)=>{"use strict";i.d(t,{defaultChartWidgetActionsOptions:()=>s});const s={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,
-studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};var o;!function(e){e.Copy="Copy"}(o||(o={}))},92848:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),o=i(36313),n=i(2088),r=i(26610);function a(e){return"drawing"===e.type}function l(e,t){if(1===t.length&&(0,n.isStudy)(t[0])){const e=t[0];return{title:e.title(o.TitleDisplayTarget.StatusLine),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter((e=>e.copiable()&&(0,r.isLineTool)(e))).map((t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i})),i.sources.length>0?(1===i.sources.length?i.title=t[0].title(o.TitleDisplayTarget.StatusLine):i.title="Drawings",i):null}},33350:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>T,addExclusionAreaByScope:()=>C,calcTextHorizontalShift:()=>b,clearRect:()=>p,createBoundCanvas:()=>v,createDisconnectedCanvas:()=>g,createDisconnectedCanvasByRenderingInfo:()=>f,disableSelection:()=>w,drawScaled:()=>m,drawWithExclusionAreaByScope:()=>P,fillRect:()=>_,getBindingRenderingInfo:()=>h,getContext2D:()=>d,getPrescaledContext2D:()=>u,measureText:()=>M,tryApplySuggestedCanvasBitmapSize:()=>S});var s=i(27714),o=i(50151),n=i(59239),r=i(57658),a=i(24640),l=i(49483);function c(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function h(e){return{...c(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function d(e){const t=(0,o.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function u(e){const t=(0,o.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function _(e,t,i,s,o,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function p(e,t,i,s,o,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function m(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function g(e,t,i){const s=y(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function f(e,t){const{bitmapSize:i,mediaSize:s}=t,o=y(e);return o.style.width=`${s.width}px`,o.style.height=`${s.height}px`,o.width=i.width,o.height=i.height,o}function y(e){const t=e.createElement("canvas");return w(t),t}function v(e,t){const i=y((0,o.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 S(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function b(e,t){return"center"===e.textAlign?0:(0,
-a.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function w(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function C(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:o,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e{"use strict";i.d(t,{ChartChangesWatcher:()=>a,changedAll:()=>r});var s,o=i(67455),n=i(48096);!function(e){e[e.NothingChanged=0]="NothingChanged",e[e.ContentChanged=1]="ContentChanged",e[e.LineToolsChanged=2]="LineToolsChanged"}(s||(s={}));const r=3;class a{constructor(e,t,i){this._undoHistoryHasChanges=!1,this._changesMask=0,this._handleLayoutNameChanged=()=>{this._changesMask=1|this._changesMask},this._recalculateHaveChanges=()=>{const e=this._changesMask,t=this._undoHistoryHasChanges?1:0,i=this._lineToolsHaveChanges.value()?2:0;this._changesMask=t|i,e!==this._changesMask&&this._onValueChanged.fire(0!==this._changesMask)},this._chartWidgetCollection=e,this._undoHistory=e.undoHistory,this._lineToolsHaveChanges=e.lineToolsSynchronizerHasChanges,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new n.Delegate,this._hasChangesWV=(0,o.createWVFromGetterAndSubscription)((()=>this.hasChanges()),this.getOnChange()),this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy(),this._hasChangesWV.destroy()}changes(){return this._changesMask}hasChanges(){return this._changesMask>0}hasChangesWV(){return this._hasChangesWV}getOnChange(){return this._onValueChanged}_subscribe(){this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.subscribe("layout_loaded",this._handleLayoutLoaded,this),this._globalEvents.subscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.subscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().subscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.subscribe(this._handleLayoutNameChanged)}_unsubscribe(){this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.unsubscribe("layout_loaded",this._handleLayoutLoaded,this),
-this._globalEvents.unsubscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.unsubscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.unsubscribe(this._handleLayoutNameChanged)}_setUndoHistoryHasChanges(e){this._undoHistoryHasChanges=e,this._recalculateHaveChanges()}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleLayoutLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){e?.affectsState()&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1)}}},57340:(e,t,i)=>{"use strict";i.d(t,{chartFloatingTooltipEnabledWV:()=>a});var s=i(1765),o=i(22613);const n="chart_floating_tooltip_enabled";function r(){return s.getJSON(n,true)}const a=new o.WatchedValue(r());a.subscribe((()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},75579:(e,t,i)=>{"use strict";i.d(t,{ChartHotkeysListener:()=>g,globalEnvironmentState:()=>m,modifierPressed:()=>p,shiftPressed:()=>_});var s=i(26709),o=i(68335),n=i(35749),r=i(26610);var a=i(22613),l=i(93946);const c=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Shift)),h=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Mod)),d=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Alt)),u=[o.Modifiers.None,o.Modifiers.Alt,o.Modifiers.Mod,o.Modifiers.Alt+o.Modifiers.Shift];function _(){return c}function p(){return h}function m(){return new l.EnvironmentState({altKey:d.value(),ctrlKey:p().value(),metaKey:p().value(),shiftKey:_().value()})}s.pressedKeys.subscribe(((e=0)=>{c.setValue(Boolean(e&o.Modifiers.Shift)),h.setValue(Boolean(e&o.Modifiers.Mod)),d.setValue(Boolean(e&o.Modifiers.Alt))}));class g{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){
-this._chartWidget.hasModel()&&this._chartWidget.isActive().value()&&(e.defaultPrevented||("text-editor"===window.document.activeElement?.getAttribute("data-name")&&this._handleTabKeyDown(e)||window.document.activeElement===window.document.body&&(this._handleMoveDrawingsKeyDown(e)||this._handleScrollKeyDown(e)||this._handleZoomKeyDown(e)))&&e.preventDefault())}_keyupHandler(e){this._chartWidget.hasModel()&&this._handleScrollKeyUp(e)}_handleTabKeyDown(e){const t=255&(0,o.hashFromEvent)(e),i=this._chartWidget.model();if(9===t){const t=i.selection().dataSources()[0];if(void 0!==t&&(s=t,(0,r.isLineTool)(s)&&"LineToolTable"===s.state().type)){const i=(0,o.modifiersFromEvent)(e);return t.switchActiveCell(i===o.Modifiers.Shift)}return!1}var s;return!1}_handleMoveDrawingsKeyDown(e){const t=255&(0,o.hashFromEvent)(e),i=this._chartWidget.model();switch(t){case 37:return i.moveSelectedToolsLeft();case 39:return i.moveSelectedToolsRight();case 38:return i.moveSelectedToolsUp();case 40:return i.moveSelectedToolsDown()}return!1}_handleScrollKeyDown(e){if(null!==this._pressedKeyCode)return!1;const t=(0,o.hashFromEvent)(e),i=255&t,s=(0,o.modifiersFromEvent)(e);let r;if(37===i)r=1;else{if(39!==i)return!1;r=-1}if(o.isMacKeyboard&&s===o.Modifiers.Mod||!u.includes(s))return!1;if((0,n.isNativeUIInteraction)(t,e.target))return!1;this._pressedKeyCode=i;const a=this._chartWidget.scrollHelper();return s===o.Modifiers.None?a.moveByBar(r):s===o.Modifiers.Alt||s===o.Modifiers.Mod?a.move(r):-1===r?a.scrollToRealtime(!0):a.scrollToFirstBar(),!0}_handleScrollKeyUp(e){if(null===this._pressedKeyCode)return!1;const t=(0,o.hashFromEvent)(e);if((0,n.isNativeUIInteraction)(t,e.target))return!1;return(255&t)===this._pressedKeyCode&&(this._pressedKeyCode=null,this._chartWidget.scrollHelper().stopMove(),!0)}_handleZoomKeyDown(e){const t=(0,o.hashFromEvent)(e),i=255&t;if((0,o.modifiersFromEvent)(e)!==o.Modifiers.Mod||(0,n.isNativeUIInteraction)(t,e.target))return!1;const s=this._chartWidget.model();if(38===i)s.zoomIn();else{if(40!==i)return!1;s.zoomOut()}return!0}}},64236:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>l});var s=i(50151),o=i(32955),n=i(37103);const r=n.enabled("end_of_period_timescale_marks"),a=n.enabled("align_dwm_bars_to_main_series")&&n.enabled("secondary_series_extend_time_scale");function l(e,t,i){return new h(function(e,t){const i={...t};a&&(i.session_holidays="");const s=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,i);let n=c.get(s);void 0===n&&(n=(0,o.createDwmAligner)(e,i),c.set(s,n));return n}(e,t),i)}const c=new Map;class h{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;let i=r?function(e,t){const i=e.indexToUserTime(t)
-;if(null===i)return null;return i.getTime()/1e3}(t,e):this.convertTimePointIndexToInternalTime(e);return null!==i&&(i=this.convertInternalTimeToPublicTime(i)),i}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;const i=t.points(),{firstIndex:o,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let r=null;if(o<=e&&e<=n)r=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const o=(0,s.ensureNotNull)(t.indexToTimePoint(n));r=i.projectTime(o,e-n)}}return r}}},84617:(e,t,i)=>{"use strict";i.d(t,{CHART_FONT_FAMILY:()=>n,setChartFontFamily:()=>o});const s="'Trebuchet MS', Roboto, Ubuntu, sans-serif";function o(e){n=e}let n=`-apple-system, BlinkMacSystemFont, ${s}`},31269:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,o=i(12217),n=i(41706),r=i(87713);!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},r={menuName:""},c){null!==t&&(e=await t(e,l,r));let d=null;const u=()=>{const e=(0,o.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let _=!1;if(null!==s&&(d=await s(e,r,u)),d)_=!0,h();else{const t=await Promise.all([i.e(4109),i.e(1681),i.e(6032),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(1667),i.e(3290),i.e(2227),i.e(3179),i.e(6376),i.e(1584)]).then(i.bind(i,14474));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:_}),d}function h(){(0,r.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,o){return c(e,i,s,o).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{deleteLockedLineToolsProperty:()=>c});var s=i(1765),o=i(41072),n=i(5734);const r="delete_locked_linetools",a="toggle_delete_locked_linetools";function l(){const e=s.getBool(r,!0)&&s.getBool(n.doNotShowDeleteLockedLineKey,!1),t=s.getBool(a,e);return s.remove(r),s.setValue(a,t),t}const c=(0,o.createPrimitiveProperty)(l());c.subscribe(null,(()=>s.setValue(a,c.value()))),s.onSync.subscribe(null,(()=>c.setValue(l())))},5734:(e,t,i)=>{"use strict";i.d(t,{doNotShowDeleteLockedLineConfirmProperty:()=>a,doNotShowDeleteLockedLineKey:()=>n});var s=i(1765),o=i(41072);const n="do_not_show_delete_locked_line_confirm";function r(){return s.getBool(n,!1)}const a=(0,o.createPrimitiveProperty)(r());a.subscribe(null,(()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},38414:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>o});var s=i(22613);class o{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1),this._rootInstance=null}visible(){
-return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},70002:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.alerts="Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},69455:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>r});var s=i(9753);let o=null,n=null;function r(){return n}function a(){null===n&&(n=Promise.all([i.e(7617),i.e(8185),i.e(1681),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(7827),i.e(8220),i.e(9590),i.e(1667),i.e(9836),i.e(3290),i.e(6178),i.e(7777),i.e(2227),i.e(3179),i.e(1890),i.e(6193),i.e(6376),i.e(2306)]).then(i.bind(i,63027)).then((({FavoriteDrawingToolbar:e})=>(o=null!==o?o:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),o))))}},59239:(e,t,i)=>{"use strict";function s(e){return Math.max(1,e.ownerDocument?.defaultView?.devicePixelRatio||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},96708:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>r});const s=["Z","Y","X","W","V","U","T","S"],o=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function r(e,t){const i="left"===e?s:o,r=t{"use strict";i.d(t,{getTranslatedInputTitle:()=>n});var s=i(11542);const o={PercentageLTP:"Percentage LTP",Labels:"Pane labels",LineFills:"Line fills"};function n(e){return s.t(o[e]??e,{context:"input"},i(32856))}},60709:(e,t,i)=>{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>n,chartWidgetCollectionService:()=>r});var s,o=i(16216);!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(s||(s={}));const n={id:"ChartWidgetCollectionService"};function r(){return(0,o.hasService)(n)?(0,o.service)(n):null}},51304:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>l,defaultInvalidationLevel:()=>r});var s,o=i(50151);class n{constructor(e=r){this._paneInvalidationLevel=r,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,o=s.get(t)||r;s.set(t,Math.max(o,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)||r,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)||r;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||r;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 r=s.None;var a;!function(e){e[e.ScrollAnimation=0]="ScrollAnimation",e[e.StopAnimation=1]="StopAnimation"}(a||(a={}));class l{constructor(e=r){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeScaleInvalidation={level:r,animations:[],invalidateStubs:!1},this._invalidatedPanes=new Map,this._additionalActions=[],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,o.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,o.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e,t=!1){this._timeScaleInvalidation.level=Math.max(this._timeScaleInvalidation.level,e),this._timeScaleInvalidation.invalidateStubs=this._timeScaleInvalidation.invalidateStubs||t}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)}invalidationForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidationForTimeScale(){return{...this._timeScaleInvalidation,level:Math.max(this._timeScaleInvalidation.level,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,o.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeScaleInvalidation.level=Math.max(this._timeScaleInvalidation.level,e._timeScaleInvalidation.level),this._timeScaleInvalidation.invalidateStubs=this._timeScaleInvalidation.invalidateStubs||e._timeScaleInvalidation.invalidateStubs;for(let t=0;t0===e.type));if(-1!==e){const[t]=this._timeScaleInvalidation.animations.splice(e,1);t.value.onFinish?.(!1)}}}},39612:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>o,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(49483).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function o(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},62548:(e,t,i)=>{"use strict";i.d(t,{layoutInitialSizingState:()=>o});var s=i(69708);i(50151);function o(e){const[,...t]=e;return function(e){const t=1/e.length;return e.map((e=>({percent:t,substate:(0,s.default)(e)?void 0:o(e)})))}(t)}},3354:(e,t,i)=>{"use strict";i.d(t,{isMultipleLayout:()=>r,isSupportedLayout:()=>a,layouts:()=>o,tryGuessingTheMostSuitableLayout:()=>l});i(26743),i(62548);let s;s={};const o={...{s:{title:"1 chart",count:1,layoutType:"s",sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e},splitters:()=>[],
-resizeApplier:(e,t,i,s,o)=>o,syncSublayoutsBySplitter:(e,t)=>t,expression:["h",0]}},...s};function n(e){return"s"===e}function r(e){return!n(e)}function a(e){return n(e)||s.hasOwnProperty(e)}function l(e){return"s"}},81360:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>o});i(40167);var s=i(68335);const o={LineToolFibRetracement:{hash:s.Modifiers.Alt+70,action:"setTool",description:"Draw Fib Retracement"},LineToolHorzLine:{hash:s.Modifiers.Alt+72,action:"drawRightThere",description:"Draw Horizontal Line here"},LineToolHorzRay:{hash:s.Modifiers.Alt+74,action:"drawRightThere",description:"Draw Horizontal Ray here"},LineToolRectangle:{hash:s.Modifiers.Alt+s.Modifiers.Shift+82,action:"setTool",description:"Draw Rectangle"},LineToolTrendLine:{hash:s.Modifiers.Alt+84,action:"setTool",description:"Draw Trend Line"},LineToolVertLine:{hash:s.Modifiers.Alt+86,action:"drawRightThere",description:"Draw Vertical Line here"},LineToolCrossLine:{hash:s.Modifiers.Alt+67,action:"drawRightThere",description:"Draw Cross Line here"}}},62153:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>f,defaultPreventedHandler:()=>m,getClickPosition:()=>_,isTouchMouseEvent:()=>p});var s=i(81251),o=i(50151),n=i(87465),r=i(49483),a=i(80007),l=i(39612);const c=r.isSafari?"click":"auxclick";var h,d;!function(e){e[e.ResetClick=500]="ResetClick",e[e.LongTap=333]="LongTap",e[e.PreventFiresTouchEvents=500]="PreventFiresTouchEvents"}(h||(h={})),function(e){e[e.CancelClickManhattanDistance=5]="CancelClickManhattanDistance",e[e.CancelTapManhattanDistance=5]="CancelTapManhattanDistance",e[e.DoubleClickManhattanDistance=5]="DoubleClickManhattanDistance",e[e.DoubleTapManhattanDistance=30]="DoubleTapManhattanDistance"}(d||(d={}));const u={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function _(e){if(p(e))return{x:e.clientX,y:e.clientY};if("touches"in(t=e)&&void 0!==t.touches){if(1===e.touches.length){const t=(0,o.ensureNotNull)(e.target).getBoundingClientRect(),i=e.touches[0];return{x:i.clientX-t.left,y:i.clientY-t.top}}return null}var t;return{x:e.offsetX,y:e.offsetY}}function p(e){return"isTouch"in e&&"stylus"in e}function m(e){return t=>{t.preventDefault(),e(t)}}function g(e,t){let i=!1;return{clickOrTap:(...s)=>{t?.()?e.clickOrTap(...s):(i=!1,setTimeout((()=>!i&&e.clickOrTap(...s)),501))},doubleClickOrDoubleTap:(...t)=>{i=!0,e.doubleClickOrDoubleTap?.(...t)}}}class f{constructor(e,t,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,
-this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._unsubscribePinchEvents=null,this._unsubscribeTargetElementEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!r.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,n.merge)((0,n.clone)(u),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){if(t.mouseClickEvent&&t.mouseDoubleClickEvent){const e=g({clickOrTap:t.mouseClickEvent.bind(t),doubleClickOrDoubleTap:t.mouseDoubleClickEvent.bind(t)});t.mouseClickEvent=e.clickOrTap,t.mouseDoubleClickEvent=e.doubleClickOrDoubleTap}if(t.tapEvent&&t.doubleTapEvent){const e=g({clickOrTap:t.tapEvent.bind(t),doubleClickOrDoubleTap:t.doubleTapEvent.bind(t)});t.tapEvent=e.clickOrTap,t.doubleTapEvent=e.doubleClickOrDoubleTap}}this._handlers=t,this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),null!==this._unsubscribePinchEvents&&(this._unsubscribePinchEvents(),this._unsubscribePinchEvents=null),null!==this._unsubscribeTargetElementEvents&&(this._unsubscribeTargetElementEvents(),this._unsubscribeTargetElementEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){
-null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=w(e.changedTouches,(0,o.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=b(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(v(t),(0,o.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:r}=i;if(this._touchMoveExceededManhattanDistance||!(r<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=this._options.shouldAllowTouchDrag?.()??!1,i=n>=e&&(!this._options.treatVertTouchDragAsPageScroll||t),o=e>n&&(!this._options.treatHorzTouchDragAsPageScroll||t);i||o||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,a.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;if(this._options.isMouseMoveHandlingEnabled&&!this._options.isMouseMoveHandlingEnabled?.())return;const t=this._touchMouseMoveWithDownInfo(v(e),(0,o.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=w(e.changedTouches,(0,o.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=b(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(v(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,a.preventDefault)(e));0===this._tapCount&&(0,a.preventDefault)(e),
-0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,a.preventDefault)(e))}_touchCancelHandler(e){this._touchEndHandler(e)}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),r.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=b(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=v(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),333)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handlers.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=v(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;if(this._options.isMouseMoveHandlingEnabled&&!this._options.isMouseMoveHandlingEnabled?.())return;const t=this._target.ownerDocument.documentElement;r.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=v(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,
-this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=v(e))}_init(){const e=this._mouseEnterHandler.bind(this);this._target.addEventListener("mouseenter",e);const t=this._touchCancelHandler.bind(this);this._target.addEventListener("touchcancel",t);{const e=this._target.ownerDocument,t=e=>!e.target||!this._target.contains(e.target),i=e=>{if(!t(e))return;const i=e.changedTouches[0];this._lastTouchEventTimeStamp=b(e),this._processTouchEvent(this._makeCompatEvent(e,i),this._handlers.touchStartOutsideEvent)},s=e=>{t(e)&&!this._firesTouchEvents(e)&&this._processMouseEvent(this._makeCompatEvent(e),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",s)},e.addEventListener("mousedown",s),e.addEventListener("touchstart",i,{passive:!0})}r.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick));const i=this._mouseLeaveHandler.bind(this);this._target.addEventListener("mouseleave",i);const s=this._contextMenuHandler.bind(this);this._target.addEventListener("contextmenu",s);const o=this._touchStartHandler.bind(this);let n;this._target.addEventListener("touchstart",o,{passive:!0}),r.isChrome&&(n=e=>{if(1===e.button)return e.preventDefault(),!1},this._target.addEventListener("mousedown",n));const a=this._mouseDownHandler.bind(this);this._target.addEventListener("mousedown",a);const l=this._wheelClickHandler.bind(this);this._target.addEventListener(c,l);const h=()=>{};this._target.addEventListener("touchmove",h,{passive:!1}),this._unsubscribeTargetElementEvents=()=>{this._target.removeEventListener("mouseleave",i),this._target.removeEventListener("contextmenu",s),this._target.removeEventListener("touchstart",o),n&&this._target.removeEventListener("mousedown",n),this._target.removeEventListener("mousedown",a),this._target.removeEventListener(c,l),this._target.removeEventListener("touchmove",h)},this._initPinch()}_initPinch(){if(void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent)return;const e=e=>this._checkPinchState(e.touches);this._target.addEventListener("touchstart",e,{passive:!0});const t=e=>{if(null===this._pinchInfo)return;const t=w(e.touches,(0,o.ensureNotNull)(this._activeTouchId)),i=w(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:o}=this._pinchInfo,n=S(t,i)/s,r=y(this._target);this._handlers.pinchEvent(o,{x:t.clientX-r.left,y:t.clientY-r.top},{x:i.clientX-r.left,y:i.clientY-r.top},n),(0,a.preventDefault)(e)}};this._target.addEventListener("touchmove",t,{passive:!1})
-;const i=e=>this._checkPinchState(e.touches);this._target.addEventListener("touchend",i),this._unsubscribePinchEvents=()=>{this._target.removeEventListener("touchstart",e),this._target.removeEventListener("touchmove",t),this._target.addEventListener("touchend",i)}}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const t=y(this._target);let i,s;e[0].identifier===this._activeTouchId?(i=e[0],s=e[1]):(i=e[1],s=e[0]);const o={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top},r={x:(o.x+n.x)/2,y:(o.y+n.y)/2};this._handlers.pinchStartEvent(r,o,n,{bothPointsOnTargetElement:this._target.contains(s.target)})&&(this._pinchInfo={startPinchDistance:S(i,s),startPinchMiddlePoint:r,secondTouchId:s.identifier})}this._clearLongTapTimeout()}_stopPinch(){null!==this._pinchInfo&&(this._pinchInfo=null,this._handlers.pinchEndEvent?.())}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!r.CheckMobile.iOS()}_longTapHandler(e){const t=w(e.touches,(0,o.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,a.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:b(e)this._target.getBoundingClientRect()||{left:0,top:0}));return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,get localX(){return i.clientX-o().left},get localY(){return i.clientY-o().top},ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,isTouch:!e.type.startsWith("mouse")&&"contextmenu"!==e.type&&"click"!==e.type,stylus:"stylus"===t?.touchType,srcType:e.type,target:i.target,view:e.view,preventDefault:()=>{"touchstart"!==e.type&&(0,a.preventDefault)(e)}}}}function y(e){return e.getBoundingClientRect()||{left:0,top:0}}function v(e){return{x:e.pageX,y:e.pageY}}function S(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function b(e){
-return e.timeStamp||performance.now()}function w(e,t){for(let i=0;i{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>r,navigationButtonsVisibilityKey:()=>o,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(64876);const o="NavigationButtons.visibility",{property:n,availableValues:r,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(o)},61786:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>r,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(64876),o=i(23714);const{property:n,availableValues:r,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",o.navigationButtonsVisibilityKey)},67763:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>o,CommonJsonStoreService:()=>n});var s=i(48096);class o{constructor(e,t,i,o,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=o,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends o{_serialize(e){return e}_deserialize(e){return e}}},68028:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(22613);const o="#9598a1",n=!1,r=null,a='';class l{constructor(e){this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(r),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(o),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},87911:(e,t,i)=>{"use strict";i.d(t,{
-restoreShowMarketOpenStatusProperty:()=>c,showMarketOpenStatusProperty:()=>l});var s=i(41072),o=i(1765);const n="Chart.ShowMarketOpenStatus",r=!0;function a(){return o.getBool(n,r)}const l=(0,s.createPrimitiveProperty)(a());function c(){l.setValue(r),o.remove(n)}o.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>o.setValue(n,l.value())))},53107:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>u});var s,o=i(50151),n=i(37236),r=i(22613),a=i(48943),l=i(16329),c=i(95059);function h(e){return window.ChartApiInstance.serverTime()/1e3-e}function d(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}!function(e){e.Open="market",e.Pre="pre_market",e.Post="post_market",e.Close="out_of_session",e.Holiday="holiday",e.Delisted="delisted",e.Expired="expired"}(s||(s={}));class u{constructor(e){this._currentSession=new r.WatchedValue(null),this._delistedByTypespecs=new r.WatchedValue(!1),this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new r.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._delay=0,this._futuresContractExpirationTime=null,this._quotesProvider=e;const{current_session:t}=e.quotes()??{};t&&this._currentSession.setValue(t),this._marketStatus=(0,a.combine)(((e,t,i)=>null===e?e:t?"delisted":i?"expired":function(e){switch(e){case"market":return"market";case"pre_market":return"pre_market";case"post_market":return"post_market";case"out_of_session":return"out_of_session";case"holiday":return"holiday"}(0,o.ensureNever)(e)}(e)),this._currentSession.weakReference(),this._delistedByTypespecs.weakReference(),(this._futuresContractExpirationTime?.expired()??new r.WatchedValue(!1)).weakReference()),e.quotesUpdate().subscribe(this,(e=>{this._currentSession.setValue(e?.values.current_session??null)})),e.quoteSymbolChanged().subscribe(this,(()=>{this._currentSession.setValue(null)}))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId),this._marketStatus.destroy()}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);this._delay=(0,c.getSymbolDelaySeconds)(e);const t=new l.SessionsSpec(e.timezone,e.session_display??e.session,e.session_holidays,e.corrections);let i,s;const o=e.subsessions?.find((e=>"premarket"===e.id)),n=e.subsessions?.find((e=>"postmarket"===e.id));void 0!==o&&(i=new l.SessionsSpec(e.timezone,o["session-display"]??o.session,e.session_holidays,o["session-correction"])),void 0!==n&&(s=new l.SessionsSpec(e.timezone,n["session-display"]??n.session,e.session_holidays,n["session-correction"])),this._sessionsSpec={general:t,preMarket:i,postMarket:s},this._recalculateNextSessionEdge()}status(){return this._marketStatus}currentSession(){return this._currentSession}nextSessionEdge(){return this._nextSessionEdge}_getNextSessionEdgeInternal(){
-if(null===this._sessionsSpec)return null;const e=1e3*h(this._delay);if(null===this._nextSessionEdgeInternal||(this._nextSessionEdgeInternal.timestamp??1/0)<=e/1e3){const{general:t,preMarket:i,postMarket:s}=this._sessionsSpec,o=(0,n.get_timezone)(t.timezone()),r=(0,n.utc_to_cal)(o,e),a=d((0,n.cal_to_utc)(o,t.alignToNearestSessionStart(r,1)),(0,n.cal_to_utc)(o,t.alignToNearestSessionEnd(r,1)),e),l=d(void 0!==i?(0,n.cal_to_utc)(o,i.alignToNearestSessionStart(r,1)):1/0,void 0!==i?(0,n.cal_to_utc)(o,i.alignToNearestSessionEnd(r,1)):1/0,e),c=d(void 0!==s?(0,n.cal_to_utc)(o,s.alignToNearestSessionStart(r,1)):1/0,void 0!==s?(0,n.cal_to_utc)(o,s.alignToNearestSessionEnd(r,1)):1/0,e);let u=Math.min(a,l,c);if(u===1/0){const e=h(this._delay),i=6e4,s=new Date(Math.round(new Date(1e3*e).getTime()/i)*i).getTime()+i,r=(0,n.utc_to_cal)(o,s),a=d((0,n.cal_to_utc)(o,t.alignToNearestSessionStart(r,1)),(0,n.cal_to_utc)(o,t.alignToNearestSessionEnd(r,1)),s),_=Math.min(a,l,c);_!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=_):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===c?{timestamp:u,status:"post_market"}:u===l?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-h(this._delay))};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},50888:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>l,firstReplacedByBatsExchange:()=>c,isAmexToCboeMigratedSymbol:()=>_,isDelay:()=>d,isEod:()=>h,witoutRealtime:()=>u});i(50151);var s=i(59149),o=i.n(s);const n=["DJ","JSE","BELEX"],r=["NZX"],a=["BIVA"],l=["AMEX","NASDAQ","NYSE"];function c(e){return null}function h(e,t){return o().hasEodSymbols(e.full_name)||6===t}function d(e){return void 0!==e&&e>0}function u(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&r.includes(e.listed_exchange)||a.includes(e.listed_exchange)}function _(e,t){return"amex"===t&&"CBOE"===e}},18041:(e,t,i)=>{"use strict";i.d(t,{getStudyTemplateDescString:()=>r,getStudyTemplateMetaInfo:()=>o,getStudyTemplateSaveData:()=>n});var s=i(36313);function o(e,t){return{indicators:e.allStudies(!0).map((e=>({id:e.metaInfo().id,description:e.title(s.TitleDisplayTarget.StatusLine,!0,void 0,!0)}))),interval:t}}function n(e,t,i,s){const n=t.studyTemplate(i,s);return{name:e,content:JSON.stringify(n),meta_info:o(t,n.interval)}}function r(e){const t=new Map;return e.forEach((e=>{const[i,s]=t.get(e.id)||[e.description,0];t.set(e.id,[i,s+1])})),
-Array.from(t.values()).map((([e,t])=>`${e}${t>1?` x ${t}`:""}`)).join(", ")}},4745:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>o,globalKeypressMatches:()=>n});var s=i(37103);function o(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},8686:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(8836),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(3672),i.e(3359),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(445),i.e(846),i.e(2227),i.e(4931),i.e(9418),i.e(3179),i.e(4426),i.e(2475),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},49470:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const o={id:"TradingService"};function n(){return(0,s.hasService)(o)?(0,s.service)(o):null}},28477:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const o of this._backColorers)o.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},33718:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>p,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(26709),o=i(37103),n=i(1765),r=i(41072),a=i(22613);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return o.enabled("chart_crosshair_menu")}function _(){return n.getBool(l,u())}const p=(0,r.createPrimitiveProperty)(_());function m(){p.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>p.setValue(_()))),p.subscribe(null,(()=>{n.setValue(l,p.value()),o.setEnabled("chart_crosshair_menu",!o.enabled("chart_crosshair_menu"))}))},62301:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),o=i.n(s);function n(e,t){return o()(e).div(t).round(0,o().roundHalfUp).mul(t).toNumber()}},25246:(e,t,i)=>{"use strict";i.d(t,{actualAutoLogButtonsVisibility:()=>l,autoLogButtonsVisibilityOptions:()=>r,autoLogButtonsVisibilityProperty:()=>n,restoreAutoLogButtonsVisibilitySettingsValue:()=>a});var s,o=i(64876);!function(e){e.SettingsKey="PriceAxisAutoLogButtons.visibility"}(s||(s={}));const{property:n,availableValues:r,restoreDefaultValue:a,actualBehavior:l}=(0,o.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},72755:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>o});var s=i(58978);const o={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]};var n;!function(e){e.BorderColor="#2E84A6"}(n||(n={}))},
-32955:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>h,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>c});var s=i(37236),o=i(10892),n=i(47312),r=i(51101);const a=new n.SessionInfo("Etc/UTC","0000-0000:1234567");var l=i(37103);function c(){return!l.enabled("disable_resolution_rebuild")}const h=function(e,t,i){if(!e||!o.Interval.isDWM(t))return null;const l=new n.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),c=(0,r.newBarBuilder)(t,l,a);return{timeToSessionStart:e=>c.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=(0,s.utc_to_cal)(l.timezone,e),i=l.spec.correctTradingDay(t);return(0,s.set_hms)(i,0,0,0,0,(0,s.get_timezone)("Etc/UTC")),i.getTime()}}}.bind(null,c()),d=function(e,t,i){if(!e)return e=>e;const s=new n.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),o=(0,r.newBarBuilder)(t,s,s,!1);return e=>o.alignTimeIfPossible(e)}.bind(null,c())},17776:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>o});var s=i(52746);function o(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 18:case 20:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(t??"close");default:return(0,s.barFunction)("close","open")}}},28001:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>o});var s=i(50151);class o{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}unite(e){return null===e?this:new o(Math.min(this._firstBar,e.firstBar()),Math.max(this._lastBar,e.lastBar()))}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},54370:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>o});var s=i(37103);function o(){return function(){const e=[0,1,9,13,2,14,15,3,16,10];return s.enabled("chart_style_hilo")&&e.push(12),e.push(21),e}().concat((s.enabled("japanese_chart_styles"),[8]))}},32853:(e,t,i)=>{"use strict";var s=i(49251).makeFont,o=i(49251).parseFont,n=i(9343).getLogger;const{drawPoly:r}=i(58221);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 o=100*(1-s.a);i.setValue(Math.max(0,Math.min(o,100)))},getFontFromProperties:function(e,t,i,o){
-return s(t.value(),e.value(),o.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){var r=o(e);null!==r?(r.family.length>0&&t.setValue(r.family),i.setValue(r.size),s.setValue(r.bold),n.setValue(r.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)",r(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",r(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},93201:(e,t,i)=>{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},55803:(e,t,i)=>{"use strict";i.d(t,{ConflatedChunksBuilder:()=>r});var s=i(50151),o=i(12217);const n=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,forBarspacingLargerThen:0}];class r{constructor(e,t){this._plots=e,this._conflatedChunks={chunks:new Map,priceSource:null,priceSourcesProvider:t},this._clearConflatedChunks()}conflatedChunks(e,t){if(t!==this._conflatedChunks.priceSource){this._conflatedChunks.priceSource=t;const e=this._plots.first();e&&(this._clearConflatedChunks(),this._rebuildConflatedChunks(e))}const i=(0,s.ensureDefined)(n.find((t=>t.forBarspacingLargerThen<=e)));return(0,s.ensureDefined)(this._conflatedChunks.chunks.get(i.barsToMerge))}mergeData(e){const t=this._plots.size(),i=this._plots.merge(e);return i&&null!==this._conflatedChunks.priceSource&&(t!==this._plots.size()||i.index!==this._plots.lastIndex()||function(e){let t=!0;return e.chunks.forEach((e=>{t=t&&0===e.length})),t}(this._conflatedChunks)?this._rebuildConflatedChunks(i):this._updateLatestChunks()),i}moveData(e){this._plots.move(e),this._plots.size()>0&&this._clearConflatedChunks()}clearData(){this._plots.clear(),this._clearConflatedChunks()}_rebuildConflatedChunks(e){const t=this._conflatedChunks.priceSource;if(null===t)return;const i=e.index,r=this._conflatedChunks.priceSourcesProvider(t),a=(e,t,i)=>{let s=null;for(const o of e){const e=r(o.value);s&&o.index-s.startTime>=i.barsToMerge&&(t.push(s),s=null),s?(s.endTime=o.index,s.high=Math.max(s.high,e),s.low=Math.min(s.low,e),s.close=e):s={startTime:o.index,endTime:o.index,open:e,high:e,low:e,close:e}}s&&t.push(s)};n.forEach((e=>{const t=(0,s.ensureDefined)(this._conflatedChunks.chunks.get(e.barsToMerge)),n=(0,o.lowerbound)(t,i,((e,t)=>e.endTime0){const i=t[0].startTime-1,o=(0,s.ensureNotNull)(this._plots.firstIndex()),n=this._plots.rangeIterator(o,i),r=[];a(n,r,e);const l=r.concat(t)
-;this._conflatedChunks.chunks.set(e.barsToMerge,l)}else{const i=(0,s.ensureNotNull)(this._plots.lastIndex());t.splice(n);let o=(0,s.ensureNotNull)(this._plots.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const r=this._plots.rangeIterator(o,i);a(r,t,e)}}))}_updateLatestChunks(){const e=(0,s.ensureNotNull)(this._plots.last()),t=this._conflatedChunks.priceSourcesProvider("close");n.forEach((i=>{const o=(0,s.ensureDefined)(this._conflatedChunks.chunks.get(i.barsToMerge)),n=t(e.value),r=o[o.length-1];r.high=Math.max(r.high,n),r.low=Math.min(r.low,n),r.close=n,r.endTime=e.index}))}_clearConflatedChunks(){n.forEach((e=>this._conflatedChunks.chunks.set(e.barsToMerge,[])))}}},91106:(e,t,i)=>{"use strict";i.d(t,{actualCurrencyUnitVisibility:()=>c,currencyUnitVisibilityOptions:()=>a,currencyUnitVisibilityProperty:()=>r,migrateShowCurrencyAndShowUnitProperties:()=>d,restoreCurrencyUnitVisibilitySettingsValue:()=>l});var s,o=i(64876),n=i(1765);!function(e){e.SettingsKey="PriceAxisCurrencyAndUnit.visibility"}(s||(s={}));const{property:r,availableValues:a,restoreDefaultValue:l,actualBehavior:c}=(0,o.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let h=!1;function d(e,t){h||(h=!0,void 0===n.default.getValue("PriceAxisCurrencyAndUnit.visibility")&&r().setValue(e||t?"alwaysOn":"alwaysOff"))}},66786:(e,t,i)=>{"use strict";i.d(t,{CustomSourceBase:()=>s});class s{constructor(e,t){this._id=e,this._model=t}id(){return this._id}isHoveredEnabled(){return!0}isSelectionEnabled(){return!1}priceScale(){return null}paneViews(e){return[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateViewsForPane(e,t){e.containsMainSeries()&&this.updateAllViews(t)}}},29447:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>r,isMainSeriesState:()=>o,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(11946);function o(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function r(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return Boolean(e.type)&&(0,s.isStudyLineToolName)(e.type)}},72207:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>d,getTranslatedStringForSource:()=>c,toInputDisplayFlags:()=>h});var s=i(95804),o=i(36313),n=i(4226),r=i(48096),a=i(22613),l=i(69422);function c(e,t){return new s.TranslatedString(t.name(),t.title(e))}function h(e){switch(e){case o.TitleDisplayTarget.DataWindow:return l.InputDisplayFlags.DataWindow;case o.TitleDisplayTarget.StatusLine:case o.TitleDisplayTarget.Alerts:return l.InputDisplayFlags.StatusLine}}class d{constructor(e){this.isSeries=!1,this._isDestroyed=!1,this._hasAlert=new a.WatchedValue(!1),this._alertStatus=new a.WatchedValue(0),this._alertCreationAvailable=new a.WatchedValue(!1),this._zorder=0,this._priceScale=null,this._ownerSource=null,this._userEditEnabled=!0,this._priceScaleChanged=new r.Delegate,this._isSelectionEnabled=!0,this._instanceId=(0,n.randomHashN)(6),this._ownerSourceChanged=new r.Delegate,this._zOrderChanged=new r.Delegate,this._id=new a.WatchedValue(e??(0,n.randomHashN)(6))}
-destroy(){this._isDestroyed=!0}id(){return this._id.value()}idWV(){return this._id.readonly()}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id.setValue(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}hasPriceScale(){return null!==this._priceScale}setPriceScale(e){this._priceScale!==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}propertyByPath(e){const t=e.split(".");if(t.length<1)throw new Error("Invalid path");const i=t[0];if("properties"===i){const e=this.properties();return 1===t.length?e:e.childByPath(t.slice(1).join("."))}throw new Error(`Unknown property root: ${i}`)}isVisible(){return this.properties().visible.value()}dataWindowView(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(e){}paneViews(e){return null}labelPaneViews(e){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(e,t){}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}allowsMovingBetweenPanes(){return!0}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,i){return null}autoScaleInfo(e,t,i){return{range:this.priceRange(e,t,i)}}stateForAlert(){return null}async stateForAlertAsync(){return this.stateForAlert()}canHasAlert(){return!1}canHasAlertOnLineTools(){return!1}hasAlert(){return this._hasAlert.readonly()}alertCreationAvailable(){return this._alertCreationAvailable.readonly()}hasStateForAlert(){return!1}idForAlert(){return this._id.value()}alertStatus(){return this._alertStatus.readonly()}_getAlertCreationAvailable(){return!1}_updateAlertCreationAvailable(){0}}},40137:(e,t,i)=>{"use strict";i.d(t,{DataWindowItem:()=>s,DataWindowView:()=>o});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 o{constructor(){this._items=[],this._header="",this._title=""}header(){return this._header}title(){return this._title}items(){return this._items}canShowItems(){return!0}update(e){}}},97363:(e,t,i)=>{"use strict";i.d(t,{dateFormatProperty:()=>l,restoreDateFormatSettingsValue:()=>c});var s=i(1765),o=i(41072),n=i(10718);const r="date_format";function a(){return s.getValue(r,(0,n.defaultDateFormat)())}const l=(0,o.createPrimitiveProperty)(a());function c(){l.setValue((0,n.defaultDateFormat)()),s.remove(r)}s.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>s.setValue(r,l.value())))},78176:(e,t,i)=>{"use strict";i.d(t,{DefaultProperty:()=>F,allowSavingDefaults:()=>A,cleanUpStateKeys:()=>x,createDefaultsState:()=>M,extractAllPropertiesKeys:()=>L,extractState:()=>E,extractThemedColors:()=>D});var s=i(90054),o=i(16738),n=i(81960),r=i(54029),a=i(47339),l=i(28569),c=i(50279),h=i(15943),d=i(82433),u=i(83873),_=i(50151),p=i(24377),m=i(9343),g=i(29970),f=i(24633),y=i(45345),v=i(22489),S=i(48096),b=i(55114),w=i(60973),C=i(43337);const T=(0,m.getLogger)("ThemedDefaults");function P(e){return e.value()===f.StdTheme.Dark?f.StdTheme.Dark:f.StdTheme.Light}function x(e,t,i){for(const s of t)if((0,n.default)(e,s),i){const t=s.split(".");for(t.pop();t.length;){const i=(0,r.default)(e,t);if(!(0,d.default)(i)||0!==Object.keys(i).length)break;(0,n.default)(e,t),t.pop()}}}function M(e,t,i,n){const r=e?w.defaults:w.factoryDefaults,a=t.startsWith("study_")?(0,s.default)(r("study")):{};let l=(0,s.default)(r(t,n));return t.startsWith("study_")&&l.inputs&&delete l.inputs.symbol,"linetoolicon"===t&&e&&(l.icon=(0,w.defaults)(t).icon),"linetooemoji"===t&&e&&(l.emoji=(0,w.defaults)(t).emoji),"linetoolsticker"===t&&e&&(l.sticker=(0,w.defaults)(t).sticker),l=(0,s.default)(l),x(l,i),(0,o.default)(a,l),a}let I=!1;function A(e){I=e}function L(e){const t=Object.keys(e),i=[];return t.forEach((t=>{const s=e[t];if((0,d.default)(s)){L(s).forEach((e=>i.push(`${t}.${e}`)))}else i.push(t)})),i}function k(e,t,i=""){if(1===t.length&&"*"===t[0])return e;const s={};for(const o of t){const n=o.split("."),r=n[0],a=e[r],l=""===i?r:`${i}.${r}`;if(e.hasOwnProperty(r))if(n.length>1){if(!(0,d.default)(a)){T.logError(`path ${l} must be an object, but it is a primitive`);continue}{const e=t.filter((e=>e.startsWith(`${r}.`))).map((e=>e.split(".").slice(1).join(".")));s[r]=k(a,e,l)}}else{if((0,d.default)(a)){T.logError(`path ${l} must be a primitive, but it is an object`);continue}s[r]=a}}return s}function E(e,t,i){if(!e)return{};let s=e;return t&&(s=k(e,t)),i&&x(s,i,!0),s}function D(e,t){const i=L(e),s=[];for(const o of i){const i=(0,r.default)(e,o),n=(0,r.default)(t,o);(0,_.assert)(void 0!==i,`Light theme value for ${o} is undefined`),(0,
-_.assert)(void 0!==n,`Dark theme value for ${o} is undefined`),s.push({path:o,colors:[i,n]})}return s}function B(e,t){e.includes(t)||e.push(t)}function V(e,t){const i=e.indexOf(t);-1!==i&&e.splice(i,1)}function R(e,t){const i=(0,l.default)(e,((e,i,s)=>{if(void 0===t[s])return e;if(!(0,c.default)(i,t[s]))if((0,d.default)(i)&&(0,d.default)(t[s])){const o=R(i,t[s]);void 0!==o&&(e[s]=o)}else e[s]=i;return e}),{});return(0,h.default)(i)?void 0:i}function N(e){return e===f.StdTheme.Dark?1:0}function O(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(!(0,u.default)(e)||!(0,u.default)(t))return!1;const i=(0,p.tryParseRgba)(e),s=(0,p.tryParseRgba)(t);return!(!i||!s)&&!!(0,g.colorsAreCloseEnough)(e,t)}class F extends C.Property{constructor(e){const{defaultName:t,nonThemedDefaultsKeys:i,themedDefaultsKeys:s,excludedDefaultsKeys:n=[],themedColors:r,replaceThemedColorsOnThemeChange:a=!1,allStateKeys:l,excludedStateKeys:c=[],excludedTemplateKeys:h=[],state:d,useUserPreferences:u=!0,saveNonDefaultUserPreferencesOnly:p=!1,ignoreAllowSavingDefaults:m=!1,alwaysSaveDefaultKeys:g=["version"],saveDefaultsConsumer:C=w.saveDefaults,factoryDefaultsSupplier:T=()=>M(!1,t,[],null),schema:x=(0,b.createPropertySchema)(T()),theme:I=y.watchedTheme.spawnOwnership()}=e;super(void 0,x),this._themedColors=[],this._restoreFactoryDefaultsEvent=new S.Delegate,this._replaceThemedColorsOnThemeChange=!1,this._forbidSavingDefaults=!1,this._defaultName=t,this._useUserPreferences=u,this._saveNonDefaultUserPreferencesOnly=p,this._ignoreAllowSavingDefaults=m,this._saveDefaultsConsumer=C,this._factoryDefaultsSupplier=T,this._allStateKeys=l,this._excludedStateKeys=c,this._nonThemedDefaultsKeys=i,this._themedDefaultsKeys=s,this._allDefaultsKeys=i||s?[...i??[],...s??[]]:void 0,this._excludedDefaultsKeys=n,this._excludedTemplateKeys=h,this._themedColors=r,this._alwaysSaveDefaultKeys=g,(0,_.assert)(void 0===this._allDefaultsKeys||0===this._excludedDefaultsKeys.length,"Defaults keys and excluded defaults keys cannot be used at the same time"),(0,_.assert)(void 0===this._allStateKeys||0===this._excludedStateKeys.length,"State keys and excluded state keys cannot be used at the same time"),this._theme=I;const A=P(this._theme);this.merge((0,o.default)(this._factoryDefaultsForTheme((0,v.isStdThemeName)(A)?A:f.StdTheme.Light),this._userSettings(),E(d,l,c))),r&&a&&this.setThemedColors(r),this._restoreFactoryDefaultsEvent=new S.Delegate}destroy(){this._theme?.release(),this._unsubscribeWatchedTheme?.(),super.destroy()}applyTemplate(e,t){this.mergeAndFire(E((0,o.default)((0,s.default)(t),e),this._allStateKeys,this._excludedTemplateKeys))}preferences(){return E(this.state(this._excludedDefaultsKeys),this._allDefaultsKeys)}template(){return E(this.state(void 0,4),void 0,this._excludedTemplateKeys)}mergePreferences(e){this.mergeAndFire(E(e,this._allDefaultsKeys,this._excludedDefaultsKeys))}addExcludedKey(e,t){1&t&&B(this._excludedDefaultsKeys,e),2&t&&B(this._excludedStateKeys,e),4&t&&B(this._excludedTemplateKeys,e)}removeExcludedKey(e,t){
-1&t&&V(this._excludedDefaultsKeys,e),2&t&&V(this._excludedStateKeys,e)}restoreFactoryDefaults(){const e=this.factoryDefaults();x(e,this._excludedDefaultsKeys),this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this._saveDefaultsConsumer(this._defaultName),this._restoreFactoryDefaultsEvent.fire()}onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}saveDefaults(){if(!this._useUserPreferences||this._forbidSavingDefaults)return;let e;if(this._saveNonDefaultUserPreferencesOnly){const t=this.state(this._excludedDefaultsKeys),i=this.factoryDefaults();if(e=R(E(t,this._nonThemedDefaultsKeys),E(i,this._nonThemedDefaultsKeys,this._excludedDefaultsKeys)),this._alwaysSaveDefaultKeys.length){const i=E(t,this._alwaysSaveDefaultKeys);e=e??{},(0,o.default)(e,i)}const s=this.themeDefaults(P(this._theme)),n=this.themeState(),r=R(n,s);(0,h.default)(r)||(e=e??{},(0,o.default)(e,n))}else e=this.preferences();this._saveDefaultsConsumer(this._defaultName,e)}themeDefaults(e){if(this._themedColors)return function(e,t){const i={};for(const{path:s,colors:o}of e)(0,a.default)(i,s,o[N(t)]);return i}(this._themedColors,e===f.StdTheme.Dark?f.StdTheme.Dark:f.StdTheme.Light);return E(this._factoryDefaultsSupplier(),this._themedDefaultsKeys,this._excludedDefaultsKeys)}factoryDefaults(){return this._factoryDefaultsForTheme(P(this._theme))}themeState(){const e=super.state(this._excludedDefaultsKeys),t=this._themedColors;return E(e,t?t.map((e=>e.path)):this._themedDefaultsKeys)}allThemePropertiesAreDefault(e){(0,_.assert)(!!this._themedColors,"This method should not be called if themed colors are not set");return function(e,t,i=[]){for(const s of i){const i=s.path;if(!O((0,r.default)(e,i),(0,r.default)(t,i)))return!1}return!0}(this.themeState(),this.themeDefaults(e),this._themedColors)}clone(e){return new F(this._options())}setThemedColors(e){if(this._themedColors=e,void 0===this._unsubscribeWatchedTheme){const e=()=>{this._updateThemedColors(!1)};this._theme.subscribe(e),this._unsubscribeWatchedTheme=()=>this._theme.unsubscribe(e)}this._updateThemedColors(!0)}applyDefaultThemedProperties(e){this._themedColors&&this.mergeAndFire(this.themeDefaults(e))}state(e,t){return E(super.state([...this._excludedStateKeys,...e??[]],t),this._allStateKeys)}_updateThemedColors(e){if(!this._themedColors)return;const t=P(this._theme),i=t===f.StdTheme.Light?f.StdTheme.Dark:f.StdTheme.Light;for(const s of this._themedColors){const o=(0,_.ensureDefined)(this.childByPath(s.path)),n=s.colors[N(i)];(""===o.value()||!e&&O(o.value(),n))&&o.setValue(s.colors[N(t)])}}_userSettings(){if(!this._useUserPreferences)return;const e=M(!0,this._defaultName,[],null);if(!e)return;return E((0,b.extractStateWithSchema)(e,this._schema,1),this._allDefaultsKeys,this._excludedDefaultsKeys)}_options(){return{defaultName:this._defaultName,factoryDefaultsSupplier:this._factoryDefaultsSupplier,state:this.state(),nonThemedDefaultsKeys:this._nonThemedDefaultsKeys,themedDefaultsKeys:this._themedDefaultsKeys,
-excludedDefaultsKeys:this._excludedDefaultsKeys,themedColors:this._themedColors,replaceThemedColorsOnThemeChange:this._replaceThemedColorsOnThemeChange,allStateKeys:this._allStateKeys,excludedStateKeys:this._excludedDefaultsKeys,excludedTemplateKeys:this._excludedTemplateKeys,useUserPreferences:this._useUserPreferences,saveNonDefaultUserPreferencesOnly:this._saveNonDefaultUserPreferencesOnly,ignoreAllowSavingDefaults:this._ignoreAllowSavingDefaults,saveDefaultsConsumer:this._saveDefaultsConsumer,alwaysSaveDefaultKeys:this._alwaysSaveDefaultKeys,theme:this._theme.spawnOwnership()}}_childChanged(e,t){super._childChanged(e,t),this._propertyAffectsDefaults(t)&&this.saveDefaults()}_fireMergeAndFireChangedProps(e){this._forbidSavingDefaults=!0,super._fireMergeAndFireChangedProps(e),this._forbidSavingDefaults=!1,e.some((e=>this._propertyAffectsDefaults(e.pathToRootProperty())))&&this.saveDefaults()}_factoryDefaultsForTheme(e){return(0,o.default)(this._factoryDefaultsSupplier(),this.themeDefaults(e))}_propertyAffectsDefaults(e){return(this._ignoreAllowSavingDefaults||I)&&!this._defaultName.startsWith("replayStudyStrategy")&&(!this._defaultName.startsWith("study_")||this._defaultName.startsWith("study_VbPFixed"))&&(this._allDefaultsKeys&&this._allDefaultsKeys.includes(e)||!this._allDefaultsKeys&&!this._excludedDefaultsKeys?.includes(e))&&(0,C.isPrimitiveType)(this.childByPath(e)?.value())}}},60973:(e,t,i)=>{"use strict";var{clone:s,merge:o}=i(87465),n=i(86572).PlDisplay;const{generateColor:r}=i(52859),{getStdChartTheme:a}=i(24317),{DEFAULT_THEME:l}=i(22489),c=i(49156).colors;var h=i(86572).TradedGroupHorizontalAlignment,d=i(82095),u=i(36947).LineToolPitchforkStyle,_=i(45580).LineToolBarsPatternMode,p=i(4359),m=p.LineStudyPlotStyle,g=p.STUDYPLOTDISPLAYTARGET,f=i(19679),y=i(97902).PriceAxisLastValueMode,v=i(7024).MagnetMode,S=i(25672).LineEnd,b=i(93201).ColorType;const w=i(59883).DEFAULT_LINE_TOOL_LINE_WIDTH;var C=i(97760).StatsPosition,T=i(57511).sessionsPreferencesDefault,P=i(72755).axisLabelBackgroundColor,x=i(59064).mainSeriesProperties;const{LINESTYLE_SOLID:M,LINESTYLE_DASHED:I}=i(69558);var A=i(9343).getLogger("Chart.Defaults")
-;const{colorWhite:L,colorWhiteAlpha25:k,colorTvBlue50:E,colorTvBlue500:D,colorTvBlue500Alpha30:B,colorTvBlue500Alpha25:V,colorTvBlue500Alpha20:R,colorTvBlue600:N,colorDeepBlue200:O,colorDeepBlue300:F,colorDeepBlue500:W,colorDeepBlue500Alpha20:H,colorSkyBlue500:z,colorSkyBlue500Alpha20:U,colorSkyBlue500Alpha25:j,colorSkyBlue700:G,colorSkyBlue700Alpha70:q,colorDefaultRed:$,colorRipeRed200:K,colorRipeRed300:Y,colorRipeRed400:Z,colorRipeRed400Alpha5:X,colorRipeRed500:J,colorRipeRed500Alpha30:Q,colorRipeRed500Alpha20:ee,colorRipeRed600:te,colorGrapesPurple500:ie,colorGrapesPurple500Alpha0:se,colorGrapesPurple500Alpha20:oe,colorGrapesPurple500Alpha70:ne,colorBerryPink400:re,colorBerryPink500:ae,colorBerryPink500Alpha20:le,colorBerryPink500Alpha25:ce,colorMintyGreen100:he,colorMintyGreen400:de,colorMintyGreen500:ue,colorMintyGreen500Alpha20:_e,colorIguanaGreen300:pe,colorIguanaGreen500:me,colorIguanaGreen500Alpha20:ge,colorTanOrange300:fe,colorTanOrange500:ye,colorTanOrange500Alpha20:ve,colorTanOrange600:Se,colorTanOrange700:be,colorColdGray150:we,colorColdGray400:Ce,colorColdGray450:Te,colorColdGray500:Pe,colorColdGray550:xe,colorColdGray900:Me,colorColdGray750:Ie,colorForestGreen300:Ae,colorForestGreen300Alpha5:Le}=c;var ke=function(e){var t=function(e,t){return{color:e,visible:t}},i=function(e,t,i,s){const o={coeff:e,color:t,visible:i};return s&&(o.text=""),o},p=function(e,t,i,s,o){return{coeff:e,color:t,visible:i,linestyle:void 0===s?M:s,linewidth:void 0===o?w:o}},A=function(e,t,i){return{color:e,width:void 0===i?w:i,visible:t}},ke=function(e,t,i,s,o){return{color:e,visible:t,width:i,x:s,y:o}},Ee=function(e,t,i,s,o,n){return{coeff1:e,coeff2:t,color:i,visible:s,linestyle:void 0===o?M:o,linewidth:void 0===n?w:n}};if(void 0===TradingView.defaultProperties){var Be;switch(window.locale){case"ar_AE":Be="Asia/Dubai";break;case"au":Be="Australia/Sydney";break;case"br":Be="America/Sao_Paulo";break;case"ca":Be="America/Toronto";break;case"de_DE":case"it":Be="Europe/Berlin";break;case"es":Be="Europe/Madrid";break;case"he_IL":case"tr":Be="Europe/Athens";break;case"hu_HU":case"pl":Be="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":Be="Asia/Bangkok";break;case"in":Be="Asia/Kolkata";break;case"ja":case"kr":Be="Asia/Tokyo";break;case"ms_MY":Be="Asia/Singapore";break;case"ru":Be="Europe/Moscow";break;case"uk":Be="Europe/London";break;case"zh_CN":case"zh_TW":Be="Asia/Shanghai";break;default:Be="Etc/UTC"}const e=a(l);TradingView.defaultProperties={chartproperties:o({timezone:Be,priceScaleSelectionStrategyName:"auto",inactivityGaps:!1,paneProperties:{backgroundType:b.Solid,gridLinesMode:"both",vertGridProperties:{style:M},horzGridProperties:{style:M},crossHairProperties:{style:I,transparency:0,width:1},topMargin:10,bottomMargin:8,axisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,alignLabels:!0,isInverted:!1},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0,
-showLastDayChange:!1,showBarChange:!0,showVolume:!1,showBackground:!0,showPriceSource:!0,backgroundTransparency:50,showLogo:!0,showTradingButtons:!0,showTradingButtonsMobile:!0,showSeriesLegendCloseOnMobile:!0},separatorColor:we},scalesProperties:{fontSize:12,scaleSeriesOnly:!1,showSeriesLastValue:!0,seriesLastValueMode:y.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!0,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalNameLabel:!1,showFundamentalLastValue:!0,barSpacing:f.DEFAULT_BAR_SPACING,axisHighlightColor:V,axisLineToolLabelBackgroundColorCommon:P.common,axisLineToolLabelBackgroundColorActive:P.active,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0,crosshairLabelBgColorLight:Me,crosshairLabelBgColorDark:Ie,saveLeftEdge:!1},mainSeriesProperties:o(x,e.content.mainSourceProperties),chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"#555555",visible:!1,style:I,width:1}},tradingProperties:{showPositions:!0,positionPL:{visibility:!0,display:n.Money},bracketsPL:{visibility:!0,display:n.Money},positionAndBracketsPL:!0,showOrders:!0,showExecutions:!0,showExecutionsLabels:!1,showReverse:!0,horizontalAlignment:h.Right,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:M},volumePaneSize:"large"},e.content.chartProperties),sessions:o(T,e.content.sessions),drawings:{magnet:!1,magnetSnapsToIndicators:!1,magnetMode:v.WeakMagnet,stayInDrawingMode:!1,drawOnAllCharts:!0,drawOnAllChartsMode:1},linetoolorder:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineColor:$,lineActiveBuyColor:"#4094e8",lineInactiveBuyColor:"rgba(64, 148, 232, 0.5)",lineActiveSellColor:"#e75656",lineInactiveSellColor:"rgba(231, 86, 86, 0.5)",lineStyle:"inherit",lineWidth:"inherit",bodyBorderActiveBuyColor:"#4094e8",bodyBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyBorderActiveSellColor:"#e75656",bodyBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyBackgroundColor:k,bodyBackgroundTransparency:25,bodyTextInactiveLimitColor:"rgba(38, 140, 2, 0.5)",bodyTextActiveLimitColor:"#268c02",bodyTextInactiveStopColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveStopColor:"#e75656",bodyTextInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyTextActiveBuyColor:"#4094e8",bodyTextInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveSellColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderActiveBuyColor:"#4094e8",quantityBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBorderActiveSellColor:"#e75656",quantityBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBackgroundActiveBuyColor:"#4094e8",quantityBackgroundInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundActiveSellColor:"#e75656",quantityTextColor:L,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderActiveBuyColor:"#4094e8",
-cancelButtonBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonBorderActiveSellColor:"#e75656",cancelButtonBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",cancelButtonBackgroundColor:k,cancelButtonBackgroundTransparency:25,cancelButtonIconActiveBuyColor:"#4094e8",cancelButtonIconInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonIconActiveSellColor:"#e75656",cancelButtonIconInactiveSellColor:"rgba(231, 86, 86, 0.5)",tooltip:"",modifyTooltip:"",cancelTooltip:""},linetoolposition:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineBuyColor:"#4094e8",lineSellColor:"#e75656",lineStyle:"inherit",lineWidth:"inherit",bodyBorderBuyColor:"#4094e8",bodyBorderSellColor:"#e75656",bodyBackgroundColor:k,bodyBackgroundTransparency:25,bodyTextPositiveColor:"#268c02",bodyTextNeutralColor:"#646464",bodyTextNegativeColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderBuyColor:"#4094e8",quantityBorderSellColor:"#e75656",quantityBackgroundBuyColor:"#4094e8",quantityBackgroundSellColor:"#e75656",quantityTextColor:L,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderBuyColor:"#4094e8",reverseButtonBorderSellColor:"#e75656",reverseButtonBackgroundColor:k,reverseButtonBackgroundTransparency:25,reverseButtonIconBuyColor:"#4094e8",reverseButtonIconSellColor:"#e75656",closeButtonBorderBuyColor:"#4094e8",closeButtonBorderSellColor:"#e75656",closeButtonBackgroundColor:k,closeButtonBackgroundTransparency:25,closeButtonIconBuyColor:"#4094e8",closeButtonIconSellColor:"#e75656",tooltip:"",protectTooltip:"",closeTooltip:"",reverseTooltip:""},linetoolexecution:{direction:"buy",arrowHeight:8,arrowSpacing:1,arrowBuyColor:"#4094e8",arrowSellColor:"#e75656",text:"",textColor:c.colorBlack,textTransparency:0,fontFamily:"Verdana",fontSize:10,fontBold:!1,fontItalic:!1,tooltip:""},linetoolimage:{transparency:0,cssWidth:0,cssHeight:0,angle:0},linetoolbezierquadro:{linecolor:D,linewidth:w,fillBackground:!1,backgroundColor:R,transparency:50,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal},linetoolbeziercubic:{linecolor:W,linewidth:w,fillBackground:!1,backgroundColor:H,transparency:80,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal},linetooltrendline:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolinfoline:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!0,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!0,
-showPercentPriceRange:!0,showPipsPriceRange:!0,showBarsRange:!0,showDateTimeRange:!0,showDistance:!0,showAngle:!0,statsPosition:C.Center},linetooltimecycles:{linecolor:"#159980",linewidth:w,fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:M},linetoolsineline:{linecolor:"#159980",linewidth:w,linestyle:M},linetooltrendangle:{linecolor:D,linewidth:w,linestyle:M,fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1,statsPosition:C.Right},linetooldisjointangle:{linecolor:ue,linewidth:w,linestyle:M,fillBackground:!0,backgroundColor:_e,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,textcolor:ue,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ue,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolflatbottom:{linecolor:ye,linewidth:w,linestyle:M,fillBackground:!0,backgroundColor:ve,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,textcolor:ye,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ye,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolriskrewardshort:{linecolor:Pe,linewidth:1,textcolor:L,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:ee,profitBackground:_e,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0,currency:"NONE"},linetoolriskrewardlong:{linecolor:Pe,linewidth:1,textcolor:L,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:ee,profitBackground:_e,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0,currency:"NONE"},linetoolarrow:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Arrow,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolray:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!0,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,
-showAngle:!1,statsPosition:C.Right},linetoolextended:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!0,extendRight:!0,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolhorzline:{linecolor:D,linewidth:w,linestyle:M,showPrice:!0,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle"},linetoolhorzray:{linecolor:D,linewidth:w,linestyle:M,showPrice:!0,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{linecolor:D,linewidth:w,linestyle:M,extendLine:!0,showTime:!0,horzLabelsAlign:"center",vertLabelsAlign:"middle",textcolor:D,textOrientation:"vertical",fontsize:14,bold:!1,italic:!1},linetoolcrossline:{linecolor:D,linewidth:w,linestyle:M,showPrice:!0,showTime:!0},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",showLabels:!0,fillBackground:!1,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:I},level1:p(0,Pe,!0),level2:p(1,D,!0),level3:p(2,D,!0),level4:p(3,D,!0),level5:p(5,D,!0),level6:p(8,D,!0),level7:p(13,D,!0),level8:p(21,D,!0),level9:p(34,D,!0),level10:p(55,D,!0),level11:p(89,D,!0)},linetooltext:{color:D,fontsize:14,fillBackground:!1,backgroundColor:V,backgroundTransparency:70,drawBorder:!1,borderColor:xe,bold:!1,italic:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:200},linetooltextabsolute:{color:D,fontsize:14,fillBackground:!1,backgroundColor:V,backgroundTransparency:70,drawBorder:!1,borderColor:xe,bold:!1,italic:!1,fixedSize:!1,wordWrap:!1,wordWrapWidth:200},linetoolballoon:{color:L,backgroundColor:ne,borderColor:se,fontsize:14,transparency:30},linetoolcomment:{color:L,backgroundColor:D,borderColor:D,fontsize:16,transparency:0},linetoolbrush:{linecolor:z,linewidth:w,smooth:5,fillBackground:!1,backgroundColor:z,transparency:50,leftEnd:S.Normal,rightEnd:S.Normal},linetoolhighlighter:{linecolor:ee,smooth:5,transparency:80,width:20},linetoolpolyline:{linecolor:z,linewidth:w,linestyle:M,fillBackground:!0,backgroundColor:U,transparency:80,filled:!1},linetoolsignpost:{emoji:"🙂",showImage:!1,plateColor:D,fontSize:12,bold:!1,italic:!1},linetoolpath:{lineColor:D,lineWidth:w,lineStyle:M,leftEnd:S.Normal,rightEnd:S.Arrow},linetoolarrowmarkleft:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkup:{color:ue,arrowColor:ue,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkright:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkdown:{color:te,arrowColor:te,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolflagmark:{flagColor:D},linetoolpricelabel:{color:L,backgroundColor:D,borderColor:D,fontWeight:"bold",fontsize:14,transparency:0},linetoolarrowmarker:{backgroundColor:N,textColor:N,bold:!0,italic:!1,fontsize:16},
-linetoolrotatedrectangle:{color:me,fillBackground:!0,backgroundColor:ge,transparency:50,linewidth:w},linetoolcircle:{color:ye,backgroundColor:ve,fillBackground:!0,linewidth:w,textColor:ye,fontSize:14,bold:!1,italic:!1},linetoolellipse:{color:J,fillBackground:!0,backgroundColor:ee,transparency:50,linewidth:w,textColor:J,fontSize:14,bold:!1,italic:!1},linetoolarc:{color:ae,fillBackground:!0,backgroundColor:le,transparency:80,linewidth:w},linetoolprediction:{linecolor:D,linewidth:w,sourceBackColor:D,sourceTextColor:L,sourceStrokeColor:D,targetStrokeColor:D,targetBackColor:D,targetTextColor:L,successBackground:me,successTextColor:L,failureBackground:J,failureTextColor:L,intermediateBackColor:"#ead289",intermediateTextColor:"#6d4d22",transparency:10,centersColor:"#202020"},linetooltriangle:{color:ue,fillBackground:!0,backgroundColor:_e,transparency:80,linewidth:w},linetoolcallout:{color:L,backgroundColor:q,transparency:50,linewidth:w,fontsize:14,bordercolor:G,bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:200},linetoolparallelchannel:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:R,transparency:20,showMidline:!0,midlinecolor:D,midlinewidth:1,midlinestyle:I,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:D,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolelliottimpulse:{degree:7,showWave:!0,color:"#3d85c6",linewidth:w},linetoolelliotttriangle:{degree:7,showWave:!0,color:ye,linewidth:w},linetoolelliotttriplecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:w},linetoolelliottcorrection:{degree:7,showWave:!0,color:"#3d85c6",linewidth:w},linetoolelliottdoublecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:w},linetoolbarspattern:{color:D,mode:_.Bars,mirrored:!1,flipped:!1},linetoolghostfeed:{averageHL:20,variance:50,candleStyle:{upColor:he,downColor:K,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:ue,borderDownColor:J,wickColor:Pe},transparency:50},study:{inputs:{},styles:{},bands:{},graphics:{},ohlcPlots:{},palettes:{},filledAreasStyle:{},filledAreas:{},visible:!0,showLegendValues:!0,showLegendInputs:!0,showLabelsOnPriceScale:!0,precision:"default"},linetoolpitchfork:{fillBackground:!0,transparency:80,style:u.Original,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolpitchfan:{fillBackground:!0,transparency:80,median:{visible:!0,color:J,linewidth:w,linestyle:M},level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,z,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolgannfan:{linewidth:w,showLabels:!0,fillBackground:!0,transparency:80,level1:Ee(1,8,ye,!0),level2:Ee(1,4,ue,!0),level3:Ee(1,3,me,!0),level4:Ee(1,2,ue,!0),level5:Ee(1,1,z,!0),level6:Ee(2,1,D,!0),level7:Ee(3,1,ie,!0),level8:Ee(4,1,ae,!0),level9:Ee(8,1,J,!0)},linetoolganncomplex:{
-fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,scaleRatio:"",showLabels:!0,labelsStyle:{fontSize:12,bold:!1,italic:!1},levels:[A(Pe,!0),A(ye,!0),A(z,!0),A(me,!0),A(ue,!0),A(Pe,!0)],fanlines:[ke(O,!1,w,8,1),ke(J,!1,w,5,1),ke(Pe,!1,w,4,1),ke(ye,!1,w,3,1),ke(z,!0,w,2,1),ke(me,!0,w,1,1),ke(ue,!0,w,1,2),ke(ue,!1,w,1,3),ke(D,!1,w,1,4),ke(F,!1,w,1,5),ke(O,!1,w,1,8)],arcs:[ke(ye,!0,w,1,0),ke(ye,!0,w,1,1),ke(ye,!0,w,1.5,0),ke(z,!0,w,2,0),ke(z,!0,w,2,1),ke(me,!0,w,3,0),ke(me,!0,w,3,1),ke(ue,!0,w,4,0),ke(ue,!0,w,4,1),ke(D,!0,w,5,0),ke(D,!0,w,5,1)]},linetoolgannfixed:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,levels:[A(Pe,!0),A(ye,!0),A(z,!0),A(me,!0),A(ue,!0),A(Pe,!0)],fanlines:[ke(O,!1,w,8,1),ke(J,!1,w,5,1),ke(Pe,!1,w,4,1),ke(ye,!1,w,3,1),ke(z,!0,w,2,1),ke(me,!0,w,1,1),ke(ue,!0,w,1,2),ke(ue,!1,w,1,3),ke(D,!1,w,1,4),ke(F,!1,w,1,5),ke(O,!1,w,1,8)],arcs:[ke(ye,!0,w,1,0),ke(ye,!0,w,1,1),ke(ye,!0,w,1.5,0),ke(z,!0,w,2,0),ke(z,!0,w,2,1),ke(me,!0,w,3,0),ke(me,!0,w,3,1),ke(ue,!0,w,4,0),ke(ue,!0,w,4,1),ke(D,!0,w,5,0),ke(D,!0,w,5,1)]},linetoolgannsquare:{color:"rgba(21, 56, 153, 0.8)",linewidth:w,linestyle:M,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,reverse:!1,fans:t(Ce,!1),hlevel1:i(0,Pe,!0),hlevel2:i(.25,ye,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,ue,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Pe,!0),vlevel1:i(0,Pe,!0),vlevel2:i(.25,ye,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,ue,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Pe,!0)},linetoolfibspeedresistancefan:{fillBackground:!0,transparency:80,grid:{color:"rgba(21, 56, 153, 0.8)",linewidth:1,linestyle:M,visible:!0},linewidth:w,linestyle:M,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,reverse:!1,hlevel1:i(0,Pe,!0),hlevel2:i(.25,ye,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,ue,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Pe,!0),vlevel1:i(0,Pe,!0),vlevel2:i(.25,ye,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,ue,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Pe,!0)},linetoolfibretracement:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},levelsStyle:{linewidth:w,linestyle:M},level1:i(0,Pe,!0,!0),level2:i(.236,J,!0,!0),level3:i(.382,ye,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,ue,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Pe,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,J,!0,!0),level10:i(3.618,ie,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ye,!1,!0),level13:i(1.414,J,!1,!0),level16:i(2,ue,!1,!0),level14:i(2.272,ye,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Pe,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,J,!1,!0),
-level21:i(4.272,ie,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ye,!1,!0),level24:i(4.764,ue,!1,!0)},linetoolfibchannel:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,labelFontSize:12,levelsStyle:{linewidth:w,linestyle:M},level1:i(0,Pe,!0),level2:i(.236,J,!0),level3:i(.382,ye,!0),level4:i(.5,me,!0),level5:i(.618,ue,!0),level6:i(.786,z,!0),level7:i(1,Pe,!0),level8:i(1.618,D,!0),level9:i(2.618,J,!0),level10:i(3.618,ie,!0),level11:i(4.236,ae,!0),level12:i(1.272,ye,!1),level13:i(1.414,J,!1),level16:i(2,ue,!1),level14:i(2.272,ye,!1),level15:i(2.414,me,!1),level17:i(3,z,!1),level18:i(3.272,Pe,!1),level19:i(3.414,D,!1),level20:i(4,J,!1),level21:i(4.272,ie,!1),level22:i(4.414,ae,!1),level23:i(4.618,ye,!1),level24:i(4.764,ue,!1)},linetoolprojection:{showCoeffs:!0,fillBackground:!0,transparency:80,color1:R,color2:oe,linewidth:w,trendline:{visible:!0,color:Ce,linestyle:M},level1:p(1,"#808080",!0)},linetool5pointspattern:{color:D,textcolor:L,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetoolcypherpattern:{color:D,textcolor:L,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetooltrianglepattern:{color:W,textcolor:L,fillBackground:!0,backgroundColor:W,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetoolabcd:{color:ue,textcolor:L,fontsize:12,bold:!1,italic:!1,linewidth:w},linetoolthreedrivers:{color:W,textcolor:L,fillBackground:!0,backgroundColor:"rgba(149, 40, 204, 0.5)",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:w},linetoolheadandshoulders:{color:ue,textcolor:L,fillBackground:!0,backgroundColor:ue,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetoolfibwedge:{showCoeffs:!0,fillBackground:!0,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:w,linestyle:M},level1:p(.236,J,!0),level2:p(.382,ye,!0),level3:p(.5,me,!0),level4:p(.618,ue,!0),level5:p(.786,z,!0),level6:p(1,Pe,!0),level7:p(1.618,D,!1),level8:p(2.618,J,!1),level9:p(3.618,W,!1),level10:p(4.236,ae,!1),level11:p(4.618,ae,!1)},linetoolfibcircles:{showCoeffs:!0,fillBackground:!0,transparency:80,coeffsAsPercents:!1,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},level1:p(.236,J,!0),level2:p(.382,ye,!0),level3:p(.5,ue,!0),level4:p(.618,me,!0),level5:p(.786,z,!0),level6:p(1,Pe,!0),level7:p(1.618,D,!0),level8:p(2.618,ae,!0),level9:p(3.618,D,!0),level10:p(4.236,ae,!0),level11:p(4.618,J,!0)},linetoolfibspeedresistancearcs:{showCoeffs:!0,fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},level1:p(.236,J,!0),level2:p(.382,ye,!0),level3:p(.5,ue,!0),level4:p(.618,me,!0),level5:p(.786,z,!0),level6:p(1,Pe,!0),level7:p(1.618,D,!0),level8:p(2.618,ae,!0),level9:p(3.618,D,!0),level10:p(4.236,ae,!0),level11:p(4.618,J,!0)},linetooltrendbasedfibextension:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,
-horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},levelsStyle:{linewidth:w,linestyle:M},level1:i(0,Pe,!0,!0),level2:i(.236,J,!0,!0),level3:i(.382,ye,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,ue,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Pe,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,J,!0,!0),level10:i(3.618,ie,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ye,!1,!0),level13:i(1.414,J,!1,!0),level16:i(2,ue,!1,!0),level14:i(2.272,ye,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Pe,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,J,!1,!0),level21:i(4.272,ie,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ye,!1,!0),level24:i(4.764,ue,!1,!0)},linetooltrendbasedfibtime:{showCoeffs:!0,fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},level1:p(0,Pe,!0),level2:p(.382,J,!0),level3:p(.5,pe,!1),level4:p(.618,me,!0),level5:p(1,ue,!0),level6:p(1.382,z,!0),level7:p(1.618,Pe,!0),level8:p(2,D,!0),level9:p(2.382,ae,!0),level10:p(2.618,ie,!0),level11:p(3,W,!0)},linetoolschiffpitchfork:{fillBackground:!0,transparency:80,style:u.Schiff,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolschiffpitchfork2:{fillBackground:!0,transparency:80,style:u.Schiff2,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolinsidepitchfork:{fillBackground:!0,transparency:80,style:u.Inside,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolregressiontrend:{linewidth:1,linestyle:M,styles:{upLine:{display:g.All,color:B,linestyle:M,linewidth:w},downLine:{display:g.All,color:B,linestyle:M,linewidth:w},baseLine:{display:g.All,color:Q,linestyle:I,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},De(TradingView.defaultProperties.chartproperties),Ve()}if(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{display:g.All,color:D,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:D,backColor:E,
-textColor:Me}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){var Re=!0;TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:Re,"S1/R1":Re,"S2/R2":Re,"S3/R3":Re,"S4/R4":Re,"S5/R5":Re},colors:{P:Se,"S1/R1":Se,"S2/R2":Se,"S3/R3":Se,"S4/R4":Se,"S5/R5":Se},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}}}void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:D,linewidth:2});const Ne={styles:{splitByBlocks:!1},graphics:{tpoLevels:{tpo:{tpoPoc:{color:""},tpoPoorHigh:{color:""},tpoPoorLow:{color:""},tpoSingleprints:{color:""},tpoVah:{color:""},tpoVal:{color:""},volumePoc:{color:""},volumeVah:{color:""},volumeVal:{color:""}}},tpoVolumeRows:{tpo:{valuesColor:"",colors:{nonVa:"",va:""}}}}};function Oe(e){const t={styles:{developingPoc:{color:""},developingVAHigh:{color:""},developingVALow:{color:""}},graphics:{horizlines:{pocLines:{color:""},vahLines:{color:""},valLines:{color:""}},hhists:{histBars2:{colors:["",""],valuesColor:""},histBarsVA:{colors:["",""],valuesColor:""}}}};return e&&(t.graphics.polygons={histBoxBg:{color:""}}),t}void 0===TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]=Ne),void 0===TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]=Ne),void 0===TradingView.defaultProperties["study_VbPSessions@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPSessions@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPSessionsRoughDetailed@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPSessionsRoughDetailed@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPPeriodic@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPVisible@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPVisible@tv-volumebyprice"]=Oe(!1));const Fe={styles:{developingPoc:{color:""},developingVAHigh:{color:""},developingVALow:{color:""}},graphics:{hhists:{histBars2:{colors:["",""],valuesColor:""},histBarsVA:{colors:["",""],valuesColor:""}},horizlines:{pocLines:{color:""},vahLines:{color:""},valLines:{color:""}},polygons:{histBoxBg:{color:""}}}};if(void 0===TradingView.defaultProperties["study_VbPFixed@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPFixed@tv-volumebyprice"]=Fe),void 0===TradingView.defaultProperties["study_VbPFixed@tv-basicstudies"]&&(TradingView.defaultProperties["study_VbPFixed@tv-basicstudies"]=Fe),void 0===TradingView.defaultProperties.linetoolanchoredvp&&(TradingView.defaultProperties.linetoolanchoredvp=Oe(!0)),
-void 0===TradingView.defaultProperties["study_VbPAutoAnchored@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPAutoAnchored@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t($,!1),level1:t("#008000",!1),level2:t("#0000ff",!1),level3:t("#ff00ff",!1),level4:t("#0080ff",!0),level5:t($,!0),level6:t("#008000",!0),level7:t("#0000ff",!0),level8:t("#ff00ff",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{display:g.All,color:B,linestyle:M,linewidth:1},downLine:{display:g.All,color:B,linestyle:M,linewidth:1},baseLine:{display:g.All,color:Q,linestyle:M,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba(153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]){TradingView.defaultProperties["study_Overlay@tv-basicstudies"]={style:d.STYLE_LINE,allowExtendTimeScale:!1,showPriceLine:!1,minTick:"default",candleStyle:{upColor:de,downColor:re,drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:de,borderDownColor:re,wickColor:"#737375",wickUpColor:de,wickDownColor:re,barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:de,downColor:re,drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:de,borderDownColor:re,wickColor:"#737375",wickUpColor:de,wickDownColor:re,barColorsOnPrevClose:!1},barStyle:{upColor:de,downColor:re,barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},lineStyle:{color:be,linestyle:M,linewidth:2,priceSource:"close"},lineWithMarkersStyle:{color:be,linestyle:M,linewidth:2,priceSource:"close"},steplineStyle:{color:be,linestyle:M,linewidth:2,priceSource:"close"},areaStyle:{color1:D,color2:D,linecolor:D,linestyle:M,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:Te,topFillColor1:Le,topFillColor2:Le,bottomFillColor1:X,bottomFillColor2:X,topLineColor:Ae,bottomLineColor:Z,topLineWidth:2,bottomLineWidth:2,topLineStyle:0,bottomLineStyle:2,priceSource:"close",transparency:50,baseLevelPercentage:50},hiloStyle:{color:D,showBorders:!0,borderColor:D,showLabels:!0,labelColor:D,drawBody:!0},columnStyle:{upColor:r(ue,50),downColor:r(J,50),barColorsOnPrevClose:!0,priceSource:"close",baselinePosition:"bottom"},hlcAreaStyle:{highLineVisible:!0,highLineColor:z,highLineStyle:M,highLineWidth:2,lowLineVisible:!0,lowLineColor:ae,lowLineStyle:M,lowLineWidth:2,closeLineColor:D,closeLineStyle:M,closeLineWidth:2,highCloseFillColor:j,closeLowFillColor:ce},hlcBarsStyle:{color:D,barColorsOnPrevClose:!1,thinBars:!0},styles:{open:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0},high:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,
-histogramBase:0},low:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0},close:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0}}}}for(var We=e.split("."),He=TradingView.defaultProperties,ze=0;ze1?h(e[o],t.slice(1),i):(e[o]&&e[o].setValue?e[o].setValue(i):e[o]=i,!0))}function d(e){i||A.logWarn("Path `"+e+"` does not exist.")}}function De(e,t,i,s){window.__defaultsOverrides&&Ee(e,t,i,window.__defaultsOverrides,s)}function Be(e,t){window.__settingsOverrides&&Ee(e,null,!1,window.__settingsOverrides,t)}function Ve(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&De(TradingView.defaultProperties[t],null,!1,t)}))}function Re(e,t){return t?function(e,t){var i=ke(e);if(!window._UNIT_TESTS){var n=s(TVSettings.getJSON(e,null));if(function(e){var t=new Set(["linetoolregressiontrend"]);return e.startsWith("study_")||t.has(e)}(e)&&n&&function(e){if(!e)return!1;e=e.toString();var t=new RegExp("\\d+").exec(e),i=null!==t&&t[0]===e;return i}(n.version)){var r=n.inputs,a=t.updateStudyInputs(n.id,n.version,"last",r,null);n.inputs=a,n=t.updateStudyState(n,n)}o(i,n),Be(i,e)}return i}(e,t):function(e){var t=ke(e);if(!window._UNIT_TESTS){var i=s(TVSettings.getJSON(e,null));if(i){o(t,i);const s=e.split(".");Be(t,void 0===s[1]?e:s[1])}}return t}(e)}Re.create=function(e,t){if(t){var i=ke(e);TradingView.defaultProperties[e]=o(t,i)}},Re.remove=function(e){TradingView.defaultProperties[e]=void 0},TradingView.saveDefaults=function(e,t){void 0===t?TVSettings.remove(e):TVSettings.setJSON(e,t)},TradingView.factoryDefaults=ke,window.applyDefaultOverridesToLinetools=Ve,window.applyDefaultsOverrides=De,window.applyPropertiesOverrides=Ee,window.defaults=Re,t.applyDefaultOverridesToLinetools=Ve,t.applyDefaultsOverrides=De,t.applyPropertiesOverrides=Ee,t.defaults=Re,t.factoryDefaults=ke,t.saveDefaults=TradingView.saveDefaults,t.createDefaults=Re.create,t.removeDefaults=Re.remove},78861:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DrawingSyncMode:()=>s,SelectPointMode:()=>o,activePointSelectionMode:()=>J,alignTo45Degrees:()=>Ie,barTimesUnderCursor:()=>ee,beenSetLineToolLastPoint:()=>F,cancelLineTool:()=>ne,cancelledLineTool:()=>O,changeLineStyle:()=>me,changeLineTool:()=>de,changedLineStyle:()=>K,changedLineTool:()=>j,continueLineTool:()=>oe,continuedLineTool:()=>N,copiedLineTool:()=>Y,copyLineTool:()=>ge,createLineTool:()=>se,createdLineTool:()=>R,crosshairLock:()=>x,cursorTool:()=>k,drawOnAllCharts:()=>Ae,drawOnAllChartsMode:()=>Le,emojiTool:()=>A,finishChangingLineTool:()=>ue,finishLineTool:()=>pe,finishMovingLineTool:()=>ce,finishedChangingLineTool:()=>G,finishedLineTool:()=>$,
-finishedMovingLineTool:()=>z,hideAllDrawings:()=>Te,hideAllIndicators:()=>Pe,hideMarksOnBars:()=>Me,iconTool:()=>I,init:()=>be,isDirectionalMovementActive:()=>V,isStudyEditingNow:()=>Q,isToolCreatingNow:()=>E,isToolEditingNow:()=>D,isToolMovingNow:()=>B,lockDrawings:()=>xe,moveLineTool:()=>le,movedLineTool:()=>H,properties:()=>Ce,removeLineTool:()=>_e,removedLineTool:()=>q,resetToCursor:()=>v,restoreLineTool:()=>fe,restoreLineToolState:()=>ye,restoredLineTool:()=>Z,restoredLineToolState:()=>X,runOnDrawingStateReady:()=>we,setLineToolLastPoint:()=>re,startChangingLineTool:()=>he,startMovingLineTool:()=>ae,startedChangingLineTool:()=>U,startedMovingLineTool:()=>W,stickerTool:()=>L,tool:()=>M,toolIsCursor:()=>m,toolIsDemonstration:()=>f,toolIsEraser:()=>g,toolIsMeasure:()=>y});var s,o,n=i(50151),r=i(41072),a=i(78176),l=i(22613),c=i(62773),h=i(48096),d=i(1765),u=i(76422),_=i(51768);!function(e){e[e.Layout=1]="Layout",e[e.Global=2]="Global"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(o||(o={}));const p=new Set(["cursor","arrow","dot","performance","demonstration"]);function m(e){return p.has(e)}function g(e){return"eraser"===e}function f(e){return"demonstration"===e}function y(e){return"measure"===e}function v(e=!1){if(!e&&S){if(S.childs().stayInDrawingMode.value())return}M.setValue(k.value())}let S=null,b=null,w=null,C=null,T=null,P=null;const x=new c.WatchedObject(null),M=new l.WatchedValue,I=new l.WatchedValue,A=new l.WatchedValue,L=new l.WatchedValue,k=new l.WatchedValue,E=new l.WatchedValue(!1),D=new l.WatchedValue(!1),B=new l.WatchedValue(!1),V=new l.WatchedValue(!1),R=new h.Delegate,N=new h.Delegate,O=new h.Delegate,F=new h.Delegate,W=new h.Delegate,H=new h.Delegate,z=new h.Delegate,U=new h.Delegate,j=new h.Delegate,G=new h.Delegate,q=new h.Delegate,$=new h.Delegate,K=new h.Delegate,Y=new h.Delegate,Z=new h.Delegate,X=new h.Delegate,J=new l.WatchedValue(o.None),Q=new l.WatchedValue(!1),ee=new Map;function te(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const ie={value:!1},se=te(R,ie),oe=te(N,ie),ne=te(O,ie),re=te(F,ie),ae=te(W),le=te(H),ce=te(z),he=te(U),de=te(j),ue=te(G),_e=te(q),pe=te($),me=te(K,ie),ge=te(Y,ie),fe=te(Z),ye=te(X);let ve=!1,Se=[];function be(){if(ve)return;const e=d.getValue("chart.cursorPreference","cursor");M.setValue(m(e)?e:"cursor"),M.subscribe((e=>{m(e)?k.setValue(e):g(e)&&(0,_.trackEvent)("Chart cursors",e)}),{callWithLast:!0}),k.subscribe((e=>{(0,_.trackEvent)("Chart cursors",e),e&&"performance"!==e&&!f(e)&&d.setValue("chart.cursorPreference",e)})),S=new a.DefaultProperty({defaultName:"drawings"}),b=(0,r.createPrimitiveProperty)(!1),w=(0,r.createPrimitiveProperty)(!1),C=(0,r.createPrimitiveProperty)(!1),T=(0,r.createPrimitiveProperty)(!d.getBool("BarsMarksContainer.visibile",!0)),P=(0,r.createPrimitiveProperty)(!1),M.subscribe((e=>{(0,u.emit)("onSelectedLineToolChanged")})),ve=!0,Se.forEach((e=>e())),Se=[]}function we(e){ve?e():Se.push(e)}function Ce(){return(0,n.ensureNotNull)(S)}function Te(){return(0,
-n.ensureNotNull)(b)}function Pe(){return(0,n.ensureNotNull)(w)}function xe(){return(0,n.ensureNotNull)(C)}function Me(){return(0,n.ensureNotNull)(T)}function Ie(){return(0,n.ensureNotNull)(P)}function Ae(){return Ce().childs().drawOnAllCharts}function Le(){return Ce().childs().drawOnAllChartsMode}},93946:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>o});var s=i(49483);class o{constructor(e,t=!1){this._shift=!1,this._mod=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._mod=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey)),this._isApiEvent=t}shift(){return this._shift}mod(){return this._mod}alt(){return this._alt}shiftOnly(){return this._shift&&!this._mod&&!this._alt}modOnly(){return this._mod&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._mod}modShift(){return this._shift&&this._mod&&!this._alt}isApiEvent(){return this._isApiEvent}static create(e=!1,t=!1,i=!1){return new o({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},60911:(e,t,i)=>{"use strict";i.d(t,{decodeExtendedSymbol:()=>h,encodeExtendedSymbolOrGetSimpleSymbolString:()=>l,extractExtendedSymbol:()=>d,isEncodedExtendedSymbol:()=>c,isStudySymbol:()=>a,replaceExtendedSymbol:()=>u});var s=i(87465);function o(e){return"="+JSON.stringify(n(e))}function n(e){return Object.keys(e).sort().reduce(((t,i)=>("[object Object]"===Object.prototype.toString.call(e[i])?t[i]=n(e[i]):t[i]=e[i],t)),{})}function r(e){return(0,s.isString)(e)}function a(e){return!r(e)&&"inputs"in e}function l(e){return o(e)}function c(e){return"="===e[0]}function h(e){if(!c(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function d(e){if(r(e))return{symbol:e};let t=e;for(;!r(t.symbol);)t=t.symbol;return t}function u(e,t){let i=e;for(;!r(i.symbol);)i=i.symbol;i.symbol=t}},92211:(e,t,i)=>{"use strict";i.d(t,{extractSymbolNameFromSymbolInfo:()=>l});var s=i(37103);const o=s.enabled("pay_attention_to_ticker_not_symbol"),n=s.enabled("charting_library_single_symbol_request"),r=s.enabled("use_ticker_on_symbol_info_update"),a=s.enabled("uppercase_instrument_names");function l(e,t,i,s){let l=e&&(i&&e.pro_name||e.full_name||e.name);return n&&t?l=t:(r||!s&&o)&&e&&e.ticker&&(l=e.ticker),a&&l&&(l=l.toUpperCase()),l}},35727:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},10718:(e,t,i)=>{"use strict";i.d(t,{availableDateFormats:()=>v,dateFormatFunctions:()=>f,defaultDateFormat:()=>S,getDateFormatWithWeekday:()=>y});var s=i(11542),o=i(28865),n=i(95322);const r={1:()=>s.t(null,void 0,i(62310)),2:()=>s.t(null,void 0,i(2507)),3:()=>s.t(null,void 0,i(92767)),4:()=>s.t(null,void 0,i(27072)),5:()=>s.t(null,{context:"short"},i(13132)),6:()=>s.t(null,void 0,i(429)),7:()=>s.t(null,void 0,i(53786)),8:()=>s.t(null,void 0,i(46450)),9:()=>s.t(null,void 0,i(6816)),10:()=>s.t(null,void 0,i(12179)),11:()=>s.t(null,void 0,i(26899)),12:()=>s.t(null,void 0,i(32084))},a={1:()=>s.t(null,void 0,i(14568)),
-2:()=>s.t(null,void 0,i(13534)),3:()=>s.t(null,void 0,i(14530)),4:()=>s.t(null,void 0,i(3762))},l=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,c=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),h=(e,t)=>e.toLocaleDateString(window.language?(0,o.getIsoLanguageCodeFromLanguage)(window.language):void 0,{weekday:"short",timeZone:"local"===t?void 0:t}),d=(e,t)=>a[((e,t)=>Math.floor((l(e,t)-1)/3)+1)(e,t)](),u=(e,t)=>(0,n.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),_=(e,t)=>r[l(e,t)](),p=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t),2),m=(e,t)=>(0,n.numberToStringWithLeadingZero)(c(e,t)%100,2),g=(e,t)=>(0,n.numberToStringWithLeadingZero)(c(e,t),4),f={"qq 'yy":(e,t)=>`${d(e,t)} '${m(e,t)}`,"qq yyyy":(e,t)=>`${d(e,t)} ${g(e,t)}`,"dd MMM 'yy":(e,t)=>`${u(e,t)} ${_(e,t)} '${m(e,t)}`,"MMM 'yy":(e,t)=>`${_(e,t)} '${m(e,t)}`,"MMM dd, yyyy":(e,t)=>`${_(e,t)} ${u(e,t)}, ${g(e,t)}`,"MMM yyyy":(e,t)=>`${_(e,t)} ${g(e,t)}`,"MMM dd":(e,t)=>`${_(e,t)} ${u(e,t)}`,"dd MMM":(e,t)=>`${u(e,t)} ${_(e,t)}`,"yyyy-MM-dd":(e,t)=>`${g(e,t)}-${p(e,t)}-${u(e,t)}`,"yy-MM-dd":(e,t)=>`${m(e,t)}-${p(e,t)}-${u(e,t)}`,"yy/MM/dd":(e,t)=>`${m(e,t)}/${p(e,t)}/${u(e,t)}`,"yyyy/MM/dd":(e,t)=>`${g(e,t)}/${p(e,t)}/${u(e,t)}`,"dd-MM-yyyy":(e,t)=>`${u(e,t)}-${p(e,t)}-${g(e,t)}`,"dd-MM-yy":(e,t)=>`${u(e,t)}-${p(e,t)}-${m(e,t)}`,"dd/MM/yy":(e,t)=>`${u(e,t)}/${p(e,t)}/${m(e,t)}`,"dd/MM/yyyy":(e,t)=>`${u(e,t)}/${p(e,t)}/${g(e,t)}`,"MM/dd/yy":(e,t)=>`${p(e,t)}/${u(e,t)}/${m(e,t)}`,"MM/dd/yyyy":(e,t)=>`${p(e,t)}/${u(e,t)}/${g(e,t)}`};function y(e,t){return"ja"===window.language?(i,s)=>`${f[e](i,s)} (${h(i,t)})`:(i,s)=>`${h(i,t)} ${f[e](i,s)}`}const v=Object.keys(f),S=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},60336:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(35727),o=i(10718);class n{constructor(e="yyyy-MM-dd",t=!1,i="UTC"){this._dateFormatFunc=t?(0,o.getDateFormatWithWeekday)(e,i):o.dateFormatFunctions[e]}format(e){return s.customFormatters&&s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!1)}formatLocal(e){return s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.formatLocal?s.customFormatters.dateFormatter.formatLocal(e):s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!0)}parse(e){if(""===e)return{res:!1};let t=e;return s.customFormatters&&s.customFormatters.dateFormatter&&!s.customFormatters.dateFormatter.parse&&console.warn("You need to provide a `parse` function as part of `dateFormatter`"),s.customFormatters&&s.customFormatters.dateFormatter&&s.customFormatters.dateFormatter.parse&&(t=String(s.customFormatters.dateFormatter.parse(e))),{res:!0,value:t}}}},86957:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>r});var s=i(82087),o=i(60336);const n={dateFormat:"yyyy-MM-dd",withWeekday:!1,timeFormat:s.hourMinuteSecondFormat,dateTimeSeparator:" "};class r{constructor(e={}){const t=Object.assign({},n,e);this._dateFormatter=new o.DateFormatter(t.dateFormat,t.withWeekday,t.timezone),
-this._timeFormatter=new s.TimeFormatter(t.timeFormat),this._separator=t.dateTimeSeparator}format(e,t){const i=t?.dateTimeSeparator??this._separator;return`${this._dateFormatter.format(e)}${i}${this._timeFormatter.format(e)}`}formatLocal(e,t){const i=t?.dateTimeSeparator??this._separator;return`${this._dateFormatter.formatLocal(e)}${i}${this._timeFormatter.formatLocal(e)}`}}},95322:(e,t,i)=>{"use strict";i.d(t,{numDependencyFormatter:()=>n,numberToStringWithLeadingZero:()=>o});var s=i(87465);function o(e,t){if(!(0,s.isNumber)(e))return"n/a";if(!(0,s.isInteger)(t))throw new TypeError("invalid length");if(t<0||t>24)throw new TypeError("invalid length");if(0===t)return e.toString();return("00000000000000000000"+e.toString()).slice(-t)}function n(e){const t=new Map;return i=>{const s=i??-1;let o=t.get(s);return o||(o=e(i),t.set(s,o)),o}}},9860:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>n});var s,o=i(97906);!function(e){e[e.DefaultPrecision=1]="DefaultPrecision"}(s||(s={}));class n{constructor(e,t){this._precision=e??1,this._numericFormatter=new o.NumericFormatter({precision:this._precision,ignoreLocaleNumberFormat:t})}format(e,t){const i=e.toFixed(this._precision),s=Math.pow(10,-this._precision);return this._numericFormatter.format(Math.max(parseFloat(i),s),t)}parse(e,t){const i=this._numericFormatter.parse(e,t);return i.res?{res:!0,value:i.value,suggest:this.format(i.value)}:i}}},91799:(e,t,i)=>{"use strict";i.d(t,{formatNumber:()=>r,parseNumber:()=>l});var s=i(60521),o=i(59332),n=i(24640);function r(e,t,i,o,n){if(!Number.isFinite(e))return`${e}`;const r=-1===Math.sign(e)?"-":"";e=Math.abs(e);let a=void 0===i?e.toString():e.toFixed(i);if(a.includes("e")){if(!o)return`${r}${a.replace(".",t.decimalSign)}`;{const i=new s.Big(e);if(a=i.lt(1)?i.toFixed():i.toString(),a.includes("e"))return`${r}${a.replace(".",t.decimalSign)}`}}const l=a.split("."),c=l[0];let h=l[1];const d=function(e,t){let i=e.length;const s=[];for(;i>0;)s.unshift(e.slice(Math.max(i-3,0),i)),i-=3;return s.join(t)}(c,t.groupingSeparator);return void 0!==i&&(h=0===i?void 0:e.toFixed(i).slice(-i)),void 0!==n&&void 0!==h&&(h=function(e,t){let i=e.length-1;for(let s=i;s>=t&&"0"===e[s];s-=1)i-=1;return e.slice(0,i+1)}(h,n)),h?`${r}${d}${t.decimalSign}${h}`:`${r}${d}`}const a=(0,o.default)((e=>{const t=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(t,"gm")}));function l(e,t){if(/^(NaN|[+|-]?Infinity)$/.test(e))return parseFloat(e);e=(0,n.stripLTRMarks)(e);const i=a(t.groupingSeparator);return i&&(e=e.replace(i,"")),e=e.replace(t.decimalSign,"."),/^(\+|-)?\d+(\.\d+|\.)?(e(\+|-)?\d+)?$/.test(e)?parseFloat(e):NaN}},26010:(e,t,i)=>{"use strict";let s;i.d(t,{formatterOptions:()=>o,formatterOptionsLibraryOverrides:()=>n,getNumberFormat:()=>d});const o={decimalSign:".",decimalSignFractional:"'"},n={};const r={groupingSeparator:",",decimalSign:"."},a={groupingSeparator:".",decimalSign:","},l={groupingSeparator:" ",decimalSign:","},c={groupingSeparator:"",decimalSign:"."
-},h=new Map([["en",r],["th",r],["ja",r],["ko",r],["zh",r],["zh_TW",r],["ar",r],["he_IL",r],["ms_MY",r],["vi",r],["de",a],["es",a],["it",a],["tr",a],["pt",a],["id_ID",a],["fr",l],["pl",l],["ru",l]]);function d(e){if(e)return{decimalSign:o.decimalSign,groupingSeparator:""};return{...h.get(s||window.language||"")??c,...n}}},97906:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(91799),o=i(26010);class n{constructor(e={}){this._options=e}format(e,t={}){if(!Number.isFinite(e))return String(e);const{ignoreLocaleNumberFormat:i=this._options.ignoreLocaleNumberFormat,noExponentialForm:r=this._options.noExponentialForm}=t,{minPrecision:a,precision:l}=this._options,c=(0,o.getNumberFormat)(i);return void 0===l?n._formatNoEImpl(e,c,l,a):(0,s.formatNumber)(e,c,l,r,a)}parse(e,t){const{ignoreLocaleNumberFormat:i,precision:n}=this._options,r=(0,o.getNumberFormat)(i||t?.ignoreLocaleNumberFormat);let a=(0,s.parseNumber)(e,r);return Number.isFinite(a)?(n&&(a=+a.toFixed(n)),{res:!0,value:a}):{res:!1}}static formatNoE(e,t){return this._formatNoEImpl(e,t)}static _formatNoEImpl(e,t,i,o){return Number.isFinite(e)?(t=t??{groupingSeparator:"",decimalSign:"."},(0,s.formatNumber)(e,t,i,!0,o)):String(e)}}},38888:(e,t,i)=>{"use strict";i.d(t,{PercentageFormatter:()=>n});var s=i(67563),o=i(24640);class n extends s.PriceFormatter{constructor(e={}){void 0!==e.decimalPlaces&&(e.priceScale=Math.pow(10,e.decimalPlaces)),super(e),this.type="percentage"}state(){return{...super.state(),percent:!0}}parse(e,t){return e=e.replace("%",""),super.parse(e,t)}format(e,t={}){const{useRtlFormat:i=!0}=t,s=super.format(e,{...t,useRtlFormat:!1})+"%";return i?(0,o.forceLTRStr)(s):s}static serialize(e){return e.state()}static deserialize(e){return new n(e)}}},67563:(e,t,i)=>{"use strict";i.d(t,{PriceFormatter:()=>M});var s=i(60521),o=i.n(s),n=i(9343),r=i(50151),a=i(11542),l=i(50335);var c=i(77914);function h(e){return e?(0,s.Big)(e.minMove).div(e.priceScale).toNumber():NaN}function d(e){const{minTick:t,price:i,variableMinTickData:s,shouldCheckForEquality:o}=e,n=(0,l.isNumber)(t)?u(t):t;return void 0===s?n:function(e,t,i=!1){for(let s=0;s(0,c.isEven)(t)?function(e){const t=Number(e);if(Number.isFinite(t))return u(t);{const t=e.split("/");if(t.length<2||t.length>3)throw new Error(`Unexpected mintick: ${e}`);const i=Number(t[1]),s=Number(t[0]);if(!Number.isFinite(i)||!Number.isFinite(s))throw new Error(`Unexpected mintick: ${e}`);const o=3===t.length?Number(t[2]):void 0;if(void 0!==o&&!Number.isFinite(o))throw new Error(`Unexpected mintick: ${e}`);const n={priceScale:i,minMove:s};return void 0!==o&&(n.minMove2=o),n}}(e):function(e){
-const t=Number(e);if(Number.isNaN(t))throw new Error(`Unexpected price limit: ${e}`);return t}(e)));if((0,c.isEven)(e.length))throw new Error("Theme must not be event number of elements");const i=[];for(let t=0;t0&&t>0){let t=e;for(i&&s&&(t/=s);t>1;)t/=10,o++}return o}function f(e,t,i){const s=(0,r.ensureNotNull)(d({price:i,minTick:null,variableMinTickData:t,shouldCheckForEquality:!0})),{priceScale:o,minMove:n,minMove2:a}=s;return{priceScale:o,minMove:n,fractionalLength:g(o,n,e,a)}}class y{constructor(e){this._formatterErrors={custom:a.t(null,void 0,i(66123)),fraction:a.t(null,void 0,i(39643)),secondFraction:a.t(null,void 0,i(70784))};const{priceScale:t,minMove:s,minMove2:o,ignoreMinMove:n,variableMinTick:r,fractionalLength:l}=e;this._priceScale=t,this._minMove=s,this._minMove2=o,this._ignoreMinMove=n,this._variableMinTickData=void 0===r?void 0:_({priceScale:t,minMove:s,minMove2:o},r),this._fractionalLength=l}formatImpl(e,t={}){const{signPositive:i,signNegative:s=!0,tailSize:o,cutFractionalByPrecision:n=!1,useRtlFormat:r=!0,variableMinTickDataPrice:a,ignoreLocaleNumberFormat:l,noExponentialForm:c,removeAllEndingZeros:h}=t;let d="";e<0?d=!1===s?"":"−":e&&!0===i&&(d="+");const u=this._formatUnsigned(Math.abs(e),{tailSize:o,cutFractionalByPrecision:n,variableMinTickDataPrice:a,ignoreLocaleNumberFormat:l,noExponentialForm:c,removeAllEndingZeros:h}),_="0"===u?u:d+u;return r?(0,p.forceLTRStr)(_):_}parse(e,t){return"+"===(e=(e=(0,p.stripLTRMarks)(e)).replace("−","-"))[0]&&(e=e.substring(1)),this._parseUnsigned(e,t)}_removeEndingZeros(e,t){for(let i=0;i=1e21&&!c)return t.toString().replace(".",d.decimalSign);const u=Math.pow(10,r)*i/(a?1:o),_=1/u;let p;if(u>1)p=Math.floor(t);else{const e=Math.floor(Math.round(t/_)*_);p=0===Math.round((t-e)/_)?e:e+_}let m="";if(u>1){let e=a?new s.Big(t).mul(u).round(void 0,0).minus(new s.Big(p).mul(u)).toNumber():parseFloat((Math.round(t*u)-p*u).toFixed(n));e>=u&&(e-=u,p+=1),e=a?new s.Big(e).round(n,0).toNumber():parseFloat(e.toFixed(n))*o;const i=(0,S.numberToStringWithLeadingZero)(e,n+r);if(!c&&t<1&&n>=10&&i.startsWith("0000")){let e=4;for(let t=e;t0&&2!==t&&4!==t&&8!==t&&T.logDebug("invalid minmove2")}hasForexAdditionalPrecision(){return!1}_parseUnsigned(e){return this._minMove2?this._parseAsDoubleFractional(e):this._parseAsSingleFractional(e)}_formatUnsigned(e,t){const{tailSize:i,variableMinTickDataPrice:s}=t,o={price:Math.abs(e),priceScale:this._priceScale,minMove:this._minMove,minMove2:this._minMove2,fractionalLength:(0,r.ensureDefined)(this._fractionalLength),tailSize:i};return void 0!==this._variableMinTickData&&Object.assign(o,f(!0,this._variableMinTickData,s??o.price)),this._formatAsFractional(o)}_parseAsSingleFractional(e){let t=m.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+b.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=this._priceScale,o=this._patchFractPart(parseInt(t[3]),1,s);if(o>=s||o<0)return{error:this._formatterErrors.fraction,res:!1};let n=i+o/s;return e&&(n=-n),{value:n,res:!0,suggest:this.formatImpl(n)}}return{error:this._formatterErrors.custom,res:!1}}_parseAsDoubleFractional(e){let t=m.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+b.formatterOptions.decimalSignFractional+"([0-9]+)\\"+b.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2&&null!==this._minMove2?this._minMove2:NaN,o=this._priceScale/s,n=this._minMove2,r=this._patchFractPart(parseInt(t[3]),1,o),a=this._patchFractPart(parseInt(t[4]),2,n);if(r>=o||r<0)return{
-error:this._formatterErrors.fraction,res:!1};if(null!=n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1};let l=null!=n?i+r/o+a/(o*n):NaN;return e&&(l=-l),{value:l,res:!0,suggest:this.formatImpl(l)}}return{error:this._formatterErrors.custom,res:!1}}_patchFractPart(e,t,i){const s={0:0,5:1},o={0:0,2:1,5:2,7:3},n={0:0,1:1,2:2,3:3,5:4,6:5,7:6,8:7};return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===o[e]?-1:o[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}_formatAsFractional(e){const{price:t,tailSize:i,priceScale:s,minMove:o,minMove2:n,fractionalLength:r}=e,a=s/o;let l=Math.floor(t),c=i?Math.floor(t*a)-l*a:Math.round(t*a)-l*a;c===a&&(c=0,l+=1);let h="";if(i){let e=(t-l-c/a)*a;e=Math.round(e*Math.pow(10,i)),h=(0,S.numberToStringWithLeadingZero)(e,i),h=this._removeEndingZeros(h,i)}if(!r)throw new Error("_fractionalLength is not calculated");let d="";if(n){const e=c%n;c=(c-e)/n;const t=(0,S.numberToStringWithLeadingZero)(c,r),i=this._getFractPart(e,2,n);d=t+b.formatterOptions.decimalSignFractional+i}else c=this._getFractPart(c,1,s),d=(0,S.numberToStringWithLeadingZero)(c*o,r);return l.toString()+b.formatterOptions.decimalSignFractional+d+h}_getFractPart(e,t,i){const s=[0,5],o=[0,2,5,7],n=[0,1,2,3,5,6,7,8];return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===o[e]?-1:o[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}}var x=i(87465);class M{constructor(e={}){this.type="price";const{minMove2:t,fractional:i,variableMinTick:s,ignoreMinMove:o,ignoreLocaleNumberFormat:n}=e,r=!e.minMove||o?1:e.minMove,a=(0,x.isNumber)(e.priceScale)&&(0,x.isInteger)(e.priceScale)?e.priceScale:100,l=g(a,r,i,t),c={...e,minMove:r,priceScale:a,fractionalLength:l};if(a<0)throw new TypeError("invalid base");this._priceScale=a,this._minMove=r,this._minMove2=t,this._fractional=i,this._variableMinTick=s,this._ignoreMinMove=o,this._fractionalLength=l,this._ignoreLocaleNumberFormat=n,this._noExponentialForm=e.noExponentialForm,this._implementation=i?new P(c):new C(c)}isFractional(){return!!this._fractional}state(){return{minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale,variableMinTick:this._variableMinTick,ignoreMinMove:this._ignoreMinMove,fractional:this._fractional,noExponentialForm:this._noExponentialForm}}formatChange(e,t,i){return this._implementation.formatImpl(e-t,{...i,variableMinTickDataPrice:Math.min(Math.abs(e),Math.abs(t))})}format(e,t){return this._implementation.formatImpl(e,t)}parse(e,t){return this._implementation.parse(e,t)}hasForexAdditionalPrecision(){return this._implementation.hasForexAdditionalPrecision()}static serialize(e){return e.state()}static deserialize(e){return new M(e)}}},82087:(e,t,i)=>{"use strict";i.d(t,{TimeFormatter:()=>_,hourMinuteFormat:()=>l,hourMinuteNonZeroSecondFormat:()=>r,hourMinuteSecondFormat:()=>n,hourMinuteSecondMillisecFormat:()=>a,twelveHourMinuteFormat:()=>d,twelveHourMinuteNonZeroSecondFormat:()=>h,twelveHourMinuteSecondFormat:()=>c});var s=i(35727),o=i(95322);const n="%h:%m:%s",r="%h:%m:%s+",a="%h:%m:%s.%ss+",l="%h:%m",c="%h:%m:%s %ampm",h="%h:%m:%s+ %ampm",d="%h:%m %ampm";var u
-;!function(e){e.TwentyFourHours="24-hours",e.TwelveHours="12-hours"}(u||(u={}));class _{constructor(e){this._isTwelveHoursFormat=!1,this._valuesAndDelimeters=[];const t=e||n,i=new RegExp("%h|%m|%s\\+|%ss\\+|%ss|%ampm|%s","g");let s=i.exec(t),o=0;for(;null!==s;){const e=s[0];"%ampm"===e&&(this._isTwelveHoursFormat=!0);const n=t.substring(o,s.index);""!==n&&this._valuesAndDelimeters.push(n),this._valuesAndDelimeters.push(e),o=s.index+e.length,s=i.exec(t)}}format(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.format(e):this._formatTime(e,!1)}formatLocal(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.formatLocal?s.customFormatters.timeFormatter.formatLocal(e):s.customFormatters.timeFormatter.format(e):this._formatTime(e,!0)}_formatTime(e,t){let i=t?e.getHours():e.getUTCHours();const s=t?e.getMinutes():e.getUTCMinutes(),n=t?e.getSeconds():e.getUTCSeconds(),r=t?e.getMilliseconds():e.getUTCMilliseconds();let a="";this._isTwelveHoursFormat&&(a=i>=12?"PM":"AM",i%=12,i=i||12);let l="",c=!1;for(let e=this._valuesAndDelimeters.length-1;e>=0;e--){const t=this._valuesAndDelimeters[e];let h;switch(t){case"%h":h=(0,o.numberToStringWithLeadingZero)(i,2);break;case"%m":h=(0,o.numberToStringWithLeadingZero)(s,2);break;case"%s+":0!==n?h=(0,o.numberToStringWithLeadingZero)(n,2):(h="",c=!0);break;case"%s":h=(0,o.numberToStringWithLeadingZero)(n,2);break;case"%ss":h=(0,o.numberToStringWithLeadingZero)(r,3);break;case"%ss+":0!==r?h=(0,o.numberToStringWithLeadingZero)(r,3):(h="",c=!0);break;case"%ampm":h=a;break;default:if(c){c=!1;continue}h=t}l=h+l}return l}}},18185:(e,t,i)=>{"use strict";i.d(t,{TimeSpanFormatter:()=>r});var s=i(11542),o=i(91799),n=i(26010);class r{format(e,t){const r=e<0;e=Math.abs(e);const a=Math.floor(e/86400);e-=86400*a;const l=Math.floor(e/3600);e-=3600*l;const c=Math.floor(e/60);e-=60*c;let h="";if(a){const e=(0,n.getNumberFormat)(t?.ignoreLocaleNumberFormat);h+=(0,o.formatNumber)(a,e)+s.t(null,{context:"dates"},i(85886))+" "}return l&&(h+=l+s.t(null,{context:"dates"},i(44634))+" "),c&&(h+=c+s.t(null,{context:"dates"},i(5977))+" "),e&&(h+=e+s.t(null,{context:"dates"},i(21492))+" "),r&&(h="-"+h),h.trim()}}},91565:(e,t,i)=>{"use strict";i.d(t,{VolumeFormatter:()=>l});var s=i(11542),o=i(97906),n=i(87465);const r=[{value:3,letter:"K"},{value:6,letter:"M"},{value:9,letter:"B"},{value:12,letter:"T"}];function a(e,t){const i=e-t;return r.find((e=>e.value>=i))??r[r.length-1]}class l{constructor(e={}){this.type="volume";const{precision:t=0,minPrecision:i=0,dimensionPrecision:s=2,dimensionMinPrecision:n=0,significantDigits:r=3,ignoreLocaleNumberFormat:a,noExponentialForm:l,removeSpaceBeforeDimension:c}=e;this._precision=t,this._formatter=new o.NumericFormatter({ignoreLocaleNumberFormat:a,precision:this._precision,minPrecision:i,noExponentialForm:l}),this._dimensionPrecision=s,this._dimensionFormatter=new o.NumericFormatter({ignoreLocaleNumberFormat:a,precision:this._dimensionPrecision,minPrecision:n,noExponentialForm:l}),this._significantDigits=r,
-this._fractionalValues=void 0!==t&&t>0,this._spaceBeforeDimension=c?"":" ",this._options=e}state(){const{ignoreLocaleNumberFormat:e,...t}=this._options;return t}format(e,t){if(!(0,n.isNumber)(e))return"---";if(Math.abs(e)>=1e100)return s.t(null,void 0,i(96935));let o="";Math.abs(e)<1&&(e=+e.toFixed(this._precision)),e<0?o="−":e>0&&t?.signPositive&&(o="+"),e=Math.abs(e);const r=!!(t?.ignoreLocaleNumberFormat??this._options.ignoreLocaleNumberFormat);let l,c,h=Math.floor(Math.log10(e))+1;if(h<=this._significantDigits&&(e=+e.toFixed(this._precision),h=Math.floor(Math.log10(e))+1),h<=this._significantDigits)l=this._formatNumber(e,r,this._formatter);else{let t=a(h,this._significantDigits);const i=Math.pow(10,t.value);e=+(e/i).toFixed(this._dimensionPrecision)*i,t=a(Math.floor(Math.log10(e))+1,this._significantDigits),l=this._formatNumber(e/Math.pow(10,t.value),r,this._dimensionFormatter),c=t.letter}return c?`${o}${l}${this._spaceBeforeDimension}${c}`:`${o}${l}`}parse(e,t){if("---"===e)return{error:"not a number",res:!1,value:NaN};const i={K:1e3,M:1e6,B:1e9,T:1e12},s=(e=e.replace("−","-")).slice(-1);if(i.hasOwnProperty(s)){const o=this._formatter.parse(e.slice(0,-1).trim(),t),r=o.res?o.value:NaN;return(0,n.isNumber)(r)?{res:!0,value:r*i[s]}:{error:"not a number",res:!1,value:NaN}}{const i=this._formatter.parse(e.trim(),t);let s=i.res?i.value:NaN;return-0===s&&(s=0),(0,n.isNumber)(s)?{res:!0,value:s}:{error:"not a number",res:!1,value:NaN}}}static serialize(e){return e.state()}static deserialize(e){return new l(e)}_formatNumber(e,t,i){if(this._fractionalValues&&0!==e){const t=14-Math.ceil(Math.log10(e)),i=Math.pow(10,t);e=Math.round(e*i)/i}return i.format(e,{ignoreLocaleNumberFormat:t})}}},63903:(e,t,i)=>{"use strict";i.d(t,{getPriceValueFormatterForSource:()=>l,getPriceValueFormatterForStudy:()=>c,shouldBeFormattedAsIndexedTo100:()=>r,shouldBeFormattedAsPercent:()=>n});var s=i(95059),o=i(22455);function n(e){const t=e.priceScale();return!(null===t||!t.isPercentage())&&(!(0,o.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function r(e){const t=e.priceScale();return!(null===t||!t.isIndexedTo100())&&(!(0,o.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function a(e){const t=e.priceScale();return r(e)&&null!==t?(i,s)=>t.formatPriceIndexedTo100(i,e.firstValue()??100,s):n(e)&&null!==t?(i,s)=>t.formatPricePercentage(i,e.firstValue()??100,s):null}function l(e){const t=a(e);if(t)return t;const i=e.formatter();return i.format.bind(i)}function c(e,t){const i=a(e);if(i)return i;const s=e.plotFormatter(t);return s.format.bind(s)}},2383:(e,t,i)=>{"use strict";i.d(t,{AreaName:()=>s,HitTarget:()=>n,HitTestResult:()=>d,hitTestResultDataAreEqual:()=>h,shouldDefaultActionBeExecuted:()=>c,tryCallHandler:()=>l});var s,o,n,r=i(50279),a=i(50151);function l(e,t,i,s){if(e.isTouch){if(void 0!==s)return s(e,t),!0}else if(void 0!==i)return i(e,t),!0;return!1}function c(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}function h(e,t){
-return e&&t&&e.equals&&t.equals?e.equals(t):(0,r.default)(e,t)}!function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove",e.AnchorPoint="AnchorPoint"}(s||(s={})),function(e){e[e.Both=0]="Both",e[e.Horz=1]="Horz",e[e.Vert=2]="Vert"}(o||(o={})),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"}(n||(n={}));class d{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}mergeData(e){this._data={...(0,a.ensureNotNull)(this._data),...e}}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,t){return null!==this._data&&l(e,t,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e,t){return null!==this._data&&l(e,t,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e,t){return null!==this._data&&l(e,t,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e,t){return null!==this._data&&l(e,t,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},40738:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(94119),o=i(69558);class n{constructor(){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",linewidth:1,linestyle:o.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}}},86572:(e,t,i)=>{"use strict";var s,o,n;i.d(t,{CustomSourceLayer:()=>a,PlDisplay:()=>o,RecalcVisibleRangeStudiesReason:()=>c,TradedGroupHorizontalAlignment:()=>n,tradingPreferencesDefault:()=>r}),function(e){e[e.Initial=2]="Initial",e[e.SeriesZOrderIsAlwaysZero=3]="SeriesZOrderIsAlwaysZero",e[e.Current=3]="Current"}(s||(s={})),function(e){e[e.Money=0]="Money",e[e.Pips=1]="Pips",e[e.Percentage=2]="Percentage"}(o||(o={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(n||(n={}));const r={showPositions:!1,positionAndBracketsPL:!1,positionPL:{visibility:!1,display:o.Money},bracketsPL:{visibility:!1,display:o.Money},showOrders:!1,showExecutions:!1,showExecutionsLabels:!1,showReverse:!1,extendLeft:!1,lineLength:0,
-horizontalAlignment:n.Right,lineWidth:0,lineStyle:0};var a,l,c,h;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(a||(a={})),function(e){e[e.Unavailable=0]="Unavailable",e[e.AvailableReadonlyAlwaysDisabled=1]="AvailableReadonlyAlwaysDisabled",e[e.AvailableReadonlyAlwaysEnabled=2]="AvailableReadonlyAlwaysEnabled",e[e.Available=3]="Available"}(l||(l={})),function(e){e[e.ViewportChangeUserAction=0]="ViewportChangeUserAction",e[e.DataUpdate=1]="DataUpdate",e[e.SeriesRestart=2]="SeriesRestart",e[e.SeriesCompleted=3]="SeriesCompleted",e[e.StudyCreation=4]="StudyCreation"}(c||(c={})),function(e){e[e.Chart=0]="Chart"}(h||(h={}))},1395:(e,t,i)=>{"use strict";var s;i.d(t,{CreateLineToolSyncMode:()=>s}),function(e){e[e.Default=0]="Default",e[e.ForceOn=1]="ForceOn",e[e.ForceOff=2]="ForceOff"}(s||(s={}))},36313:(e,t,i)=>{"use strict";var s,o,n;i.d(t,{TitleDisplayTarget:()=>n}),function(e){e[e.AfterMainSeries=0]="AfterMainSeries"}(s||(s={})),function(e){e[e.Idle=0]="Idle",e[e.Processing=1]="Processing",e[e.Active=2]="Active",e[e.Stopped=3]="Stopped"}(o||(o={})),function(e){e[e.DataWindow=1]="DataWindow",e[e.StatusLine=2]="StatusLine",e[e.Alerts=3]="Alerts"}(n||(n={}))},46082:(e,t,i)=>{"use strict";i.d(t,{Interval:()=>s.Interval,ResolutionKind:()=>s.ResolutionKind,SpecialResolutionKind:()=>s.SpecialResolutionKind,isHour:()=>s.isHour});var s=i(10892)},37293:(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}},97719:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>o});var s=i(43337);i(81922);class o extends s.Property{state(e,t){return super.state(e,t)}storeStateIfUndefined(){return!1}}},81922:(e,t,i)=>{"use strict";i.d(t,{getIntervalsVisibilitiesForMode:()=>_,isActualInterval:()=>d,makeIntervalsVisibilitiesVisibleAtInterval:()=>c,mergeIntervalVisibilitiesDefaults:()=>u});var s,o=i(16738),n=i(90054),r=i(50151),a=i(46082),l=i(37293);function c(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 a.Interval(a.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 h(e,t,i,s){return e&&s>=t&&s<=i}function d(e,t){const i=t.childs();switch(e.kind()){case a.ResolutionKind.Ticks:
-return i.ticks.value();case a.ResolutionKind.Seconds:if(e.multiplier()<60)return h(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case a.ResolutionKind.Minutes:if(e.multiplier()<60)return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)}case a.ResolutionKind.Days:return h(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case a.ResolutionKind.Weeks:return h(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case a.ResolutionKind.Months:return h(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case a.ResolutionKind.Range:return i.ranges.value()}return(0,r.assert)(!1,`Unsupported resolution: ${e.value()}`),!1}function u(e){return(0,o.default)((0,n.default)(l.intervalsVisibilitiesDefaults),e??{})}function _(e,t){if(0===t||e.isTicks()&&3===t||e.isRange()&&2===t)return u();let i=!1;const s={ticks:!1,seconds:!1,minutes:!1,hours:!1,days:!1,weeks:!1,months:!1,ranges:!1},o=e=>e.multiplier();return[{checker:e=>e.isTicks(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.ticks=!0}},{checker:e=>e.isSeconds()&&e.multiplier()<60,getIntervalMultiplier:o,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:o,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:o,markIntervalAsVisible:(e,t)=>{s.days=!0,s.daysFrom=e,s.daysTo=t}},{checker:e=>e.isWeeks(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.weeks=!0,s.weeksFrom=e,s.weeksTo=t}},{checker:e=>e.isMonths(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.months=!0,s.monthsFrom=e,s.monthsTo=t}},{checker:e=>e.isRange(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.ranges=!0}}].forEach((s=>{if(s.checker(e)){i=!0;const o=s.getIntervalMultiplier(e);1===t?s.markIntervalAsVisible(o,o):3===t?s.markIntervalAsVisible(o,void 0):s.markIntervalAsVisible(void 0,o)}else(!i&&2===t||i&&3===t)&&s.markIntervalAsVisible(void 0,void 0)})),u(s)}!function(e){e[e.All=0]="All",e[e.OnlyCurrent=1]="OnlyCurrent",e[e.CurrentAndBelow=2]="CurrentAndBelow",e[e.CurrentAndAbove=3]="CurrentAndAbove"}(s||(s={}))},55396:(e,t,i)=>{"use strict";var s,o,n;i.d(t,{PaneMode:()=>n}),function(e){e.Left="left",e.Right="right"}(s||(s={})),function(e){e.Tiny="tiny",e.Small="small",e.Medium="medium",e.Large="large"}(o||(o={})),function(e){e[e.Regular=0]="Regular",
-e[e.Widget=1]="Widget"}(n||(n={}))},5471:(e,t,i)=>{"use strict";var s;i.d(t,{PlotRowSearchMode:()=>s}),function(e){e[e.NearestLeft=-1]="NearestLeft",e[e.Exact=0]="Exact",e[e.NearestRight=1]="NearestRight"}(s||(s={}))},7543:(e,t,i)=>{"use strict";function s(e){return Boolean(e.showInObjectTree)}i.d(t,{isDataSource:()=>s})},15574:(e,t,i)=>{"use strict";i.d(t,{isTicksEnabled:()=>o});var s=i(37103);function o(){return s.enabled("tick_resolution")}},6652:(e,t,i)=>{"use strict";var s,o,n;function r(e){return e.isSeries}i.d(t,{isSeries:()=>r}),function(e){e[e.Bars=0]="Bars",e[e.Candles=1]="Candles",e[e.Line=2]="Line",e[e.Area=3]="Area",e[e.HeikenAshi=8]="HeikenAshi",e[e.HollowCandles=9]="HollowCandles",e[e.Baseline=10]="Baseline",e[e.HiLo=12]="HiLo",e[e.Column=13]="Column",e[e.LineWithMarkers=14]="LineWithMarkers",e[e.Stepline=15]="Stepline",e[e.HLCArea=16]="HLCArea",e[e.VolCandle=19]="VolCandle",e[e.HLCBars=21]="HLCBars",e[e.Renko=4]="Renko",e[e.Kagi=5]="Kagi",e[e.PointAndFigure=6]="PointAndFigure",e[e.LineBreak=7]="LineBreak"}(s||(s={})),function(e){e.Value="_seriesId"}(o||(o={})),function(e){e[e.InvalidSymbol=0]="InvalidSymbol",e[e.ReplayUnsupported=1]="ReplayUnsupported",e[e.UnsupportedDepth=2]="UnsupportedDepth",e[e.UnsupportedIntradyReplay=3]="UnsupportedIntradyReplay"}(n||(n={}))},98155:(e,t,i)=>{"use strict";var s;i.d(t,{SymbolErrorPermissionDeniedReason:()=>s,invalidSymbol:()=>n,permissionDenied:()=>o}),function(e){e.Symbol="symbol",e.GroupPermission="group"}(s||(s={}));const o="permission denied",n="invalid symbol"},22455:(e,t,i)=>{"use strict";function s(e){return e?.symbolSource&&e.symbolSource()===e||void 0!==e?.isActingAsSymbolSource}function o(e){return s(e)&&"quotesProvider"in e}function n(e){return s(e)&&e.isActingAsSymbolSource().value()}i.d(t,{isActingAsSymbolSource:()=>n,isSymbolSource:()=>s,isSymbolSourceWithQuotesProvider:()=>o})},17161:(e,t,i)=>{"use strict";i.d(t,{alwaysShowLastPriceAndLastDayChange:()=>s,lastDayChangeAvailable:()=>o});i(37103);const s=!1,o=!1},13896:(e,t,i)=>{"use strict";i.d(t,{lineToolsDoNotAffectChartInvalidation:()=>s});const s=!1},45580:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolBarsPatternMode:()=>s}),function(e){e[e.Bars=0]="Bars",e[e.Line=1]="Line",e[e.OpenClose=2]="OpenClose",e[e.LineOpen=3]="LineOpen",e[e.LineHigh=4]="LineHigh",e[e.LineLow=5]="LineLow",e[e.LineHL2=6]="LineHL2"}(s||(s={}))},55393:(e,t,i)=>{"use strict";i.d(t,{LineToolBrushBase:()=>r});var s=i(50151),o=i(41414),n=i(22613);class r extends o.LineDataSource{constructor(){super(...arguments),this._hasEditableCoordinates=new n.WatchedValue(!1),this._finished=!1}pointsCount(){return-1}finished(){return this._finished}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}hasOnlyOnePoint(){return 1===this._points.length}addPoint(e,t,i){if(this._finished)return!0;if(this._lastPoint=null,this._points.length>0){const t=this._points[this._points.length-1],i=(0,s.ensureNotNull)(this.pointToScreenPoint(t));if((0,
-s.ensureNotNull)(this.pointToScreenPoint(e)).subtract(i).length()<2)return this._finished}return super.addPoint(e),this._finished}restorePoints(e,t,i){super.restorePoints(e,t,i),this._finished=!0}}},39697:(e,t,i)=>{"use strict";i.d(t,{CircleRenderer:()=>r});var s=i(6453),o=i(2383),n=i(4539);class r{constructor(e){this._data=e??null}setData(e){this._data=e}draw(e,t){if(null===this._data)return;const{center:i,radius:s,lineWidth:o,color:n,backColor:r}=this._data;e.save();const{horizontalPixelRatio:a,verticalPixelRatio:l}=t,c=Math.max(1,Math.floor(a)),h=c%2/2,d=Math.round(i.x*a)+h,u=Math.round(i.y*l)+h,_=Math.round(d+s*a),p=Math.max(1,Math.floor(o*a)),m=_-d-p;m>0&&(e.fillStyle=r,e.beginPath(),e.moveTo(d+m,u),e.arc(d,u,m,0,2*Math.PI,!1),e.fill());const g=Math.max(c/2,_-d-p/2);e.strokeStyle=n,e.lineWidth=p,e.beginPath(),e.moveTo(d+g,u),e.arc(d,u,g,0,2*Math.PI,!1),e.stroke(),e.restore()}hitTest(e){if(null===this._data||this._data.disableInteractions)return null;const{center:t,radius:i,backgroundHitTarget:r}=this._data,a=(0,n.interactionTolerance)().curve;if(!(0,s.pointInCircle)(e,t,i+a))return null;const l=i>a&&(0,s.pointInCircle)(e,t,i-a)?r??o.HitTarget.MovePointBackground:o.HitTarget.MovePoint;return new o.HitTestResult(l)}}},59883:(e,t,i)=>{"use strict";i.d(t,{DEFAULT_LINE_TOOL_LINE_WIDTH:()=>s});const s=2},10544:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolElliott:()=>m,LineToolElliottCorrection:()=>P,LineToolElliottDegree:()=>s,LineToolElliottDoubleCombo:()=>M,LineToolElliottImpulse:()=>y,LineToolElliottTriangle:()=>S,LineToolElliottTripleCombo:()=>w});var s,o,n=i(11542),r=i(95804),a=i(41414),l=i(41706),c=i(78176),h=i(65045),d=i(13896);!function(e){e[e.Supermillennium=0]="Supermillennium",e[e.Millennium=1]="Millennium",e[e.Submillennium=2]="Submillennium",e[e.GrandSupercycle=3]="GrandSupercycle",e[e.Supercycle=4]="Supercycle",e[e.Cycle=5]="Cycle",e[e.Primary=6]="Primary",e[e.Intermediate=7]="Intermediate",e[e.Minor=8]="Minor",e[e.Minute=9]="Minute",e[e.Minuette=10]="Minuette",e[e.Subminuette=11]="Subminuette",e[e.Micro=12]="Micro",e[e.Submicro=13]="Submicro",e[e.Minuscule=14]="Minuscule"}(s||(s={})),function(e){e[e.Current=4]="Current"}(o||(o={}));const u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],_=new r.TranslatedString("change Elliott degree",n.t(null,void 0,i(47977))),p=[{value:0,title:n.t(null,void 0,i(3348))},{value:1,title:n.t(null,void 0,i(87957))},{value:2,title:n.t(null,void 0,i(63375))},{value:3,title:n.t(null,void 0,i(57726))},{value:4,title:n.t(null,void 0,i(67948))},{value:5,title:n.t(null,void 0,i(87380))},{value:6,title:n.t(null,void 0,i(59189))},{value:7,title:n.t(null,void 0,i(10268))},{value:8,title:n.t(null,{context:"wave"},i(51077))},{value:9,title:n.t(null,{context:"wave"},i(922))},{value:10,title:n.t(null,void 0,i(14724))},{value:11,title:n.t(null,void 0,i(30585))},{value:12,title:n.t(null,void 0,i(24866))},{value:13,title:n.t(null,void 0,i(1145))},{value:14,title:n.t(null,void 0,i(78273))}];class m extends a.LineDataSource{constructor(e,t,s,o){
-super(e,t??m.createProperties(e.backgroundTheme().spawnOwnership()),s,o),this.version=4,Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,60509)).then((e=>{this._setPaneViews([new e.ElliottLabelsPaneView(this,this._model)])}))}migrateVersion(e,t,i){if(i.properties.hasChild("background")&&i.properties.removeProperty("background"),i.properties.hasChild("backgroundColor")&&i.properties.removeProperty("backgroundColor"),i.properties.hasChild("showBackground")&&i.properties.removeProperty("showBackground"),1===e){const e=Object.assign({},this._timePoint[0]);if(this._timePoint.unshift(e),this._points.length>0){const e=Object.assign({},this._points[0]);this._points.unshift(e)}}}applyTemplate(e){const t=e;delete t.background,delete t.backgroundColor,delete t.showBackground,super.applyTemplate(e)}name(){return"Elliott Labels"}async additionalActions(e){return{actions:[new l.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:n.t(null,void 0,i(23403)),subItems:u.map((t=>{const i=p.filter((e=>e.value===t))[0];return new l.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:i.title,checkable:!0,checked:this.properties().childs().degree.value()===t,onExecute:()=>{e.setProperty(this.properties().childs().degree,t,_,d.lineToolsDoNotAffectChartInvalidation)}}})}))}})],placement:"CustomAction"}}label(e){const t=u.length-this.properties().childs().degree.value()-1,i=Math.floor(t/3);return{group:i,bold:!!(i%2),decoration:["","brackets","circle"][t%3],label:this.labelsGroup()[i][e]}}availableDegreesValues(){return p}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliott",state:t,theme:e});return this._configureProperties(i),i}static migrateState(e){const t={0:11,1:10,2:9,3:8,4:7,5:6,6:5,7:4,8:3},i={0:11,1:8};"LineToolElliottSubminuette"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinor"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottCircle"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize]),"LineToolElliottMajorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize])}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,6238))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("linesColors",3)}}class g extends m{pointsCount(){return 6}}const f=[["0","1","2","3","4","5"],["0","i","ii","iii","iv","v"],["0","1","2","3","4","5"],["0","I","II","III","IV","V"],["0","1","2","3","4","5"]];class y extends g{constructor(e,t,i,s){super(e,t??y.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){return f}
-static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliottimpulse",state:t,theme:e});return this._configureProperties(i),i}}const v=[["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"]];class S extends g{constructor(e,t,i,s){super(e,t??S.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return v}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliotttriangle",state:t,theme:e});return this._configureProperties(i),i}}const b=[["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"]];class w extends g{constructor(e,t,i,s){super(e,t??w.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return b}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliotttriplecombo",state:t,theme:e});return this._configureProperties(i),i}}class C extends m{pointsCount(){return 4}}const T=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class P extends C{constructor(e,t,i,s){super(e,t??P.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Correction Wave (ABC)"}labelsGroup(){return T}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliottcorrection",state:t,theme:e});return this._configureProperties(i),i}}const x=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class M extends C{constructor(e,t,i,s){super(e,t??M.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return x}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliottdoublecombo",state:t,theme:e});return this._configureProperties(i),i}}},27593:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ExecutionLineAdapter:()=>_,ExecutionsPositionController:()=>u,LineToolExecution:()=>p});var s=i(50151),o=i(41414),n=i(32853),r=i(78176),a=i(5471),l=i(37103),c=i(67777),h=i(40472);const d=c.sortSourcesPreOrdered.LineToolExecution;class u{constructor(e){this._pane=e}getXYCoordinate(e,t,i){let o=0;const n=e.getDirection(),r="buy"===n,l=this._pane.model().mainSeries();if(l.bars){const e=r?10:-10,t=l.bars().search(i,a.PlotRowSearchMode.NearestLeft);if(null!==t){i=t.index;const n=r?t.value[3]:t.value[2],a=l.priceScale(),c=(0,s.ensureNotNull)(l.firstValue());o=a.priceToCoordinate(n,c)+e}}e.setAlignedTimePointIndex(i);const c=t.visibleBarsStrictRange();if(!isFinite(i)||null===c||i>c.lastBar()||i=0;--s){const a=h[s];if(!(a instanceof p))continue
-;if((a.adapter().alignedTimePointIndex()??t.timePointToIndex(a.adapter().getTime(),1))!==i||a.adapter().getDirection()!==n)continue;if(a===e.line())break;const l=a.adapter().height();o=r?o+l:o-l}return{x:t.indexToCoordinate(i),y:o}}static recreateOrderedByBarsSourcesCache(e){this.clearOrderedByBarsSourcesCache();const t=e.sourcesByGroup().all();for(const e of t){if(!(e instanceof p))continue;const t=e.adapter().alignedTimePointIndex();if(void 0===t)continue;const i=u._cachedByBarIndexOrderedExecutions[t]||[];u._cachedByBarIndexOrderedExecutions[t]=i,i.push(e)}}static clearOrderedByBarsSourcesCache(){u._cachedByBarIndexOrderedExecutions={}}}u._cachedByBarIndexOrderedExecutions={};class _{constructor(e,t){this._unixtime=NaN,this._line=e,this._model=t}alignedTimePointIndex(){return this._alignedTimePointIndex}setAlignedTimePointIndex(e){this._alignedTimePointIndex=e}line(){return this._line}getIndex(){return this._model.timeScale().baseIndex()-this._line.points()[0].index}setIndex(e){const t=this._model.timeScale().baseIndex()-Math.abs(e);this._line.startMoving({logical:this._line.points()[0]});const i={...this._line.points()[0]};return i.index=t,this._line.move({logical:i}),this._line.endMoving(!1),this}getTime(){return this._unixtime}setTime(e){return this._unixtime=e,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line.normalizedPoints().length>0?this._line.normalizedPoints()[0].price:NaN}setPrice(e){return this._line.points().length>0&&(this._line.points()[0].price=e),this._line.normalizedPoints().length>0&&(this._line.normalizedPoints()[0].price=e),this}getText(){return this._line.properties().childs().text.value()}setText(e){return this._line.properties().childs().text.setValue(e||""),this._line.updateAllViewsAndRedraw((0,h.sourceChangeEvent)(this._line.id())),this}getArrowHeight(){return this._line.properties().childs().arrowHeight.value()}setArrowHeight(e){return this._line.properties().childs().arrowHeight.setValue(e||5),this}getArrowSpacing(){return this._line.properties().childs().arrowSpacing.value()}setArrowSpacing(e){return this._line.properties().childs().arrowSpacing.setValue(e||1),this}getDirection(){return this._line.properties().childs().direction.value()}setDirection(e){return this._line.properties().childs().direction.setValue(e||"buy"),this}getArrowColor(){const e=this._line.properties().childs();return"buy"===this.getDirection()?e.arrowBuyColor.value():e.arrowSellColor.value()}setArrowColor(e){return"buy"===this.getDirection()?this.setArrowBuyColor(e):this.setArrowSellColor(e),this}setArrowBuyColor(e){return this._line.properties().childs().arrowBuyColor.setValue(e),this}setArrowSellColor(e){return this._line.properties().childs().arrowSellColor.setValue(e),this}getTextColor(){const e=this._line.properties().childs();return n.getColorFromProperties(e.textColor,e.textTransparency)}setTextColor(e){const t=this._line.properties().childs()
-;return n.setColorToProperties(e,t.textColor,t.textTransparency),this}getFont(){const e=this._line.properties().childs();return n.getFontFromProperties(e.fontFamily,e.fontSize,e.fontBold,e.fontItalic)}setFont(e){const t=this._line.properties().childs();return n.setFontToProperties(e,t.fontFamily,t.fontSize,t.fontBold,t.fontItalic),this}setTooltip(e){return null==e?e="":e+="",this._line.properties().childs().tooltip.setValue(e),this}getTooltip(){return this._line.properties().childs().tooltip.value()}remove(){this._model.removeSource(this._line)}getPoints(){return this._line.points()}height(){const e=this.getArrowHeight(),t=this.getArrowSpacing();let i=0;this.getText()&&(i=n.fontHeight(this.getFont()));return e+t+i+10}}class p extends o.LineDataSource{constructor(e,t,s,o){super(e,t??p.createProperties(e.backgroundTheme().spawnOwnership()),s,o),this._adapter=new _(this,e),this.customization.forcePriceAxisLabel=!1,this.customization.disableErasing=!0,this.setSelectionEnabled(!1),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,52361)).then((e=>{this._setPaneViews([new e.ExecutionPaneView(this,this._model)])}))}adapter(){return this._adapter}zorder(){return d}isSpeciallyZOrderedSource(){return!0}pointsCount(){return 1}name(){return"Execution"}hasContextMenu(){return!1}state(){return{}}updateAllViews(e){if(this._isVisible())return super.updateAllViews(e)}priceAxisViews(e,t){return this._isVisible()?super.priceAxisViews(e,t):null}paneViews(){return window.TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._isVisible()?super.paneViews():null}userEditEnabled(){return!1}showInObjectTree(){return!1}cloneable(){return!1}copiable(){return!1}isSynchronizable(){return!1}static createProperties(e,t){const i=new r.DefaultProperty({defaultName:"linetoolexecution",state:t,useUserPreferences:!1,theme:e});return p._configureProperties(i),i}_isVisible(){return this._model.properties().childs().tradingProperties.childs().showExecutions.value()}}},10980:(e,t,i)=>{"use strict";i.d(t,{checkImageSize:()=>c,generateLink:()=>a,getMaxImageSizeInBytes:()=>d,getMaxImageSizeLabel:()=>u,imageIsOversized:()=>l,setImageStorageAdapter:()=>r,uploadImage:()=>h});var s=i(11542);const o=/data:(.+?);base64,(.+)/;let n=2e6;function r(e){n=e.getMaxImageSizeInBytes()}async function a(e){return new Promise(((t,i)=>{const s=new FileReader;s.addEventListener("load",(()=>t(s.result))),s.addEventListener("error",i),s.addEventListener("abort",i),s.readAsDataURL(e)}))}function l(e){return function(e){const t=e.match(o);if(null===t)return 1/0;const[i,s,n]=t,r=atob(n),a=new Array(r.length);for(let e=0;en}async function c(e){return e.size<=n}async function h(e){if(!await c(e))throw new Error(s.t(null,{replace:{value:u()}},i(93738)));return a(e)}function d(){return n}function u(){const e=Math.floor(Math.log(n)/Math.log(1e3));return`${(n/Math.pow(1e3,e)).toFixed(2)}${["Bytes","KB","MB","GB","TB","PB"][e]}`}},14715:(e,t,i)=>{
-"use strict";i.d(t,{blobImageFilter:()=>o,checkImageSize:()=>a,generateLink:()=>r,getMaxImageSizeInBytes:()=>c,getMaxImageSizeLabel:()=>h,imageIsOversized:()=>n,uploadImage:()=>l});var s=i(10980);function o(e){return"image/png"===e.type||"image/jpeg"===e.type||"image/webp"===e.type}function n(e){return s.imageIsOversized(e)}async function r(e){return{status:"ok",data:{url:await s.generateLink(e),fields:{}},filename:"",filepath:""}}async function a(e){return s.checkImageSize(e)}async function l(e){return s.uploadImage(e)}function c(){return s.getMaxImageSizeInBytes()}function h(){return s.getMaxImageSizeLabel()}},73041:(e,t,i)=>{"use strict";i.d(t,{drawSelection:()=>r,getSymbolCoordinatesInfo:()=>n});var s=i(24640),o=i(33350);function n(e){const{symbolPosition:t,textWidth:i,textByLines:n,lineHeight:r,font:a,textAlign:l,lineSpacing:c=0}=e;let[h,d]=function(e,t){let i=0;switch(e){case"center":i=t/2;break;case"start":i=(0,s.isRtl)()?t:0;break;case"end":i=(0,s.isRtl)()?0:t;break;case"right":i=t}return[i,0]}(l,i);const u=(0,s.isRtl)(),_=r+c;let p=0,m=0,g="";for(let e=0;ey.length){p+=y.length+(r&&!c?0:1),f||(d+=_);continue}f&&(d-=_);const S=r&&!c&&y.length===s&&v&&!v.hidden;if(f&&(g+=" ",s=g.length),"center"===l)if(S)h=i/2;else{const e=(0,o.measureText)(g,a).width,t=(0,o.measureText)(g.slice(0,s),a).width,n=i/2;h=u?n+e/2-t:n-e/2+t}else if("right"===l&&!u||"left"===l&&u||"end"===l)if(S)h=i;else{const e=(0,o.measureText)(g.slice(s),a).width;h=u?e:i-e}else if(S)h=0;else{const e=(0,o.measureText)(g.slice(0,s),a).width;h=u?i-e:e}S?(m=e+1,d+=_):m=e;break}return{x:h,y:d,lineNumber:m}}function r(e,t,i){const{lines:n,selectionStart:r,selectionEnd:l,left:c,right:h,color:d,font:u,lineHeight:_,lineSpacing:p=0}=i;e.save();const m=(c+h)/2,g=_+p,f=(0,s.isRtl)();e.fillStyle=d;const{horizontalPixelRatio:y,verticalPixelRatio:v}=t;if(r.lineNumber===l.lineNumber){const t=Math.round(r.x*y),i=Math.round(r.y*v),s=Math.round(l.x*y);e.fillRect(Math.min(t,s),i,Math.abs(t-s),Math.round(g*v))}else{const t=(0,o.measureText)(" ",u).width;let i=0;for(let s=r.lineNumber;s<=l.lineNumber;s+=1){const o=s===r.lineNumber,d=s===l.lineNumber,_=n[s];if(_.hidden)continue;const p=a(_.text,u);let S,b,w=!1;"center"===e.textAlign?(S=o?r.x:f?m+p/2:m-p/2,b=d?l.x:f?m-p/2:m+p/2):"right"===e.textAlign||f&&"start"===e.textAlign||!f&&"end"===e.textAlign?(S=o?r.x:h-p,b=d?l.x:h,w=!0):(S=o?r.x:c,b=d?l.x:c+p);let C=Math.min(S,b),T=Math.max(S,b);d||_.wrappedLinePart&&!_.wrappedLineEnd||(w?C-=t:T+=t);const P=Math.round(C*y),x=Math.round(T*y),M=Math.round((r.y+i*g)*v),I=Math.round((r.y+(i+1)*g)*v);e.fillRect(P,M,x-P,I-M),i+=1}}e.restore()}function a(e,t){return(0,o.measureText)(e,t).width}},11946:(e,t,i)=>{"use strict";i.d(t,{isLineDrawnWithPressedButton:()=>l,isLineToolDrawWithoutPoints:()=>h,isLineToolFinishRequiredWhenCreatedByApi:()=>c,isLineToolName:()=>a,isMtpPredictorToolName:()=>n,isStudyLineToolName:()=>r,isTextToolName:()=>d})
+;var i=o.hl2(this._context),s=this._context.new_var(i),n=o.sma(s,5,this._context),r=this._context.new_var(i),a=o.sma(r,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=o.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),_=o.change(u);return[d,this.f_1(_)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(o.close(this._context),o.open(this._context),o.high(this._context),o.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:53,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1},inputs:{in_0:20,in_1:2,symbol:"",offset:0,maType:"SMA"}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"maType",name:"MA Type",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["maType"]}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.time(this._context)),s=o.close(this._context),n=this._input(0),r=this._input(1),a=this._input(2),l=this._input(3),c=this._input(4)
+;if(""!==n){this._context.select_sym(1);var h=this._context.new_var(o.time(this._context));s=this._context.new_var(o.close(this._context)).adopt(h,i,1),this._context.select_sym(0)}var d,u=this._context.new_var(s);"EMA"===c?d=o.ema(u,r,this._context):"WMA"===c?d=o.wma(u,r,this._context):"SMA"===c&&(d=o.sma(u,r,this._context));var _=this._context.new_var(s),p=o.stdev(_,r,this._context),m=this.f_0(a,p);return[{value:d,offset:l},{value:this.f_1(d,m),offset:l},{value:this.f_2(d,m),offset:l}]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:53,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t
+;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return o.or(o.and(o.eq(e,t),o.eq(e,i)),o.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(o.close(this._context),o.high(this._context),o.low(this._context),o.volume(this._context)),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=o.volume(this._context),l=this._context.new_var(a),c=o.sum(l,i,this._context);return[this.f_1(r,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.accdist(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86",
+linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot",zorder:1}},bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(o.high(this._context)-o.low(this._context)),s=this._context.new_var(o.ema(i,this.period,this._context));return[o.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),r=o.high(this._context),a=this._context.new_var(r),l=o.highest(a,i,this._context),c=o.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(r),u=o.lowest(d,i,this._context),_=this.f_1(u,s,c),p=this._context.new_var(h),m=o.highest(p,n,this._context),g=this._context.new_var(_);return[o.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return o.ge(e,0)?e:0},this.f_1=function(e){return o.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)},
+this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.close(this._context),n=this._context.new_var(s),r=o.change(n),a=this.f_0(r),l=this.f_1(r),c=this._context.new_var(a),h=o.sum(c,i,this._context),d=this._context.new_var(l),u=o.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){var e=o.close(this._context),t=o.hlc3(this._context),i=this._context.new_var(o.high(this._context)),s=o.highest(i,30,this._context),n=o.lowest(i,30,this._context),r=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(o.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*r,h=o.sqrt(1+c*c),d=o.round(180*o.acos(1/h)/3.141592653589793),u=o.iff(o.gt(c,0),-d,d),_=o.and(o.gt(u,-2.14),o.le(u,-.71))?7:8,p=o.and(o.gt(u,-3.57),o.le(u,-2.14))?6:_,m=o.and(o.gt(u,-5),o.le(u,-3.57))?5:p,g=o.le(u,-5)?4:m,f=o.and(o.lt(u,2.14),o.ge(u,.71))?3:g,y=o.and(o.lt(u,3.57),o.ge(u,2.14))?2:f,v=o.and(o.lt(u,5),o.ge(u,3.57))?1:y;return[1,o.ge(u,5)?0:v]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",
+title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return 100*o.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.atr(1,this._context),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=o.high(this._context),l=this._context.new_var(a),c=o.highest(l,i,this._context),h=o.low(this._context),d=this._context.new_var(h),u=o.lowest(d,i,this._context),_=o.log10(i);return[this.f_0(r,c,u,_)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:2},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=o.hlc3(this._context),s=this._input(0),n=this._input(1),r=this._input(2);this._context.setMinimumAdditionalDepth(s+r);var a,l=this._context.new_var(i),c=o.sma(l,s,this._context),h=this._context.new_var(i),d=o.dev(h,s,this._context),u=this.f_0(i,c,d),_=this._context.new_var(u);return"EMA"===n?a=o.ema(_,r,this._context):"WMA"===n?a=o.wma(_,r,this._context):"SMA"===n&&(a=o.sma(_,r,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{
+color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1,zorder:1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(o.max(o.change(e),0));return o.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-o.min(o.change(e),0));return o.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?o.nz(e)<=0?1:o.nz(e)+1:o.nz(e)>=0?-1:o.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._context.new_var(i),n=this._input(0),r=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a);var l=o.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=o.rsi(this.f_1(c,r,this._context),this.f_2(c,r,this._context)),d=this._context.new_var(o.roc(s,1)),u=o.percentrank(d,a);return[o.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var r=o.close(this._context),a=this._context.new_var(r),l=o.roc(a,s),c=this._context.new_var(r),h=o.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[o.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20
+}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"symbol",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"",name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),o.period(this._context),o.close(this._context)),n=this._input(1);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),a=o.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(r,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[o.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),o.period(this._context)),this._context.new_sym(this._input(1),o.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=o.sma(e,i,s),r=o.sma(t,i,s),a=s.new_var(e.get()*t.get());return(o.sma(a,i,s)-n*r)/Math.sqrt(o.variance2(e,n,i)*o.variance2(t,r,i))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(o.close(this._context)),n=this._context.new_var(o.log(s.get()/s.get(1))),r=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(this._context.symbol.time),l=this._context.new_var(o.close(this._context)),c=this._context.new_var(o.log(l.get()/l.get(1))),h=this._context.new_var(n.adopt(r,a,0)),d=this._context.new_var(this.correlationLog(c,h,this.period,this._context)),u=this._context.new_var(d.adopt(a,i,0)).get(),_=o.round(1e3*u)/1e3;return this._context.select_sym(0),[_]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,
+plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(o.close(this._context)),n=this._context.new_var(o.sma(s,e,this._context)),r=this._context.new_var(o.close(this._context)).get(i)-n,a=o.close(this._context)-n.get(i);return[t?r:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),o.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,
+trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,offset:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e3,max:1e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.low(this._context),r=this._context.new_var(n);this._context.setMinimumAdditionalDepth(i+Math.max(s,0));var a=o.lowest(r,i,this._context),l=o.high(this._context),c=this._context.new_var(l),h=o.highest(c,i,this._context);return[{value:a,offset:s},{value:h,offset:s},{value:o.avg(h,a),offset:s}]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i);var s=o.close(this._context),n=this._context.new_var(s),r=o.ema(n,i,this._context),a=this._context.new_var(r),l=o.ema(a,i,this._context);return[this.f_0(r,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,o){return e*t*(i-s)/o},
+this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.hl2(this._context),r=this._context.new_var(n),a=o.change(r),l=this.f_0(i,a,o.high(this._context),o.low(this._context),o.volume(this._context)),c=this._context.new_var(l);return[o.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.close(this._context),n=this._context.new_var(s),r=o.change(n),a=this.f_0(r,o.volume(this._context)),l=this._context.new_var(a);return[o.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:o.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.close(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context),h=a,d=c,u=o.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,
+color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o[this._input(4)](this._context)),s=o.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=o.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=o.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(o.close(this._context)),r=0,a=0,l=0;l0?1:3,i=o.change(this._context.new_var(e));return t-(o.le(i,0)?0:1)},this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time),s=o[this._input(3)](this._context),n=this._input(1),r=this._input(2),a=this._input(4),l=this._input(5),c=this._input(6);if(this._context.setMinimumAdditionalDepth(Math.max(n,r)+a),""!==this._input(0)){this._context.select_sym(1);var h=this._context.new_var(this._context.symbol.time),d=o[this._input(3)](this._context);s=this._context.new_var(d).adopt(h,i,0),this._context.select_sym(0)}var u,_,p=this._context.new_var(s);"EMA"===l?u=o.ema(p,n,this._context):"WMA"===l?u=o.wma(p,n,this._context):"SMA"===l&&(u=o.sma(p,n,this._context)),"EMA"===l?_=o.ema(p,r,this._context):"WMA"===l?_=o.wma(p,r,this._context):"SMA"===l&&(_=o.sma(p,r,this._context));var m,g=this.f_0(u,_),f=this._context.new_var(g);"EMA"===c?m=o.ema(f,a,this._context):"WMA"===c?m=o.wma(f,a,this._context):"SMA"===c&&(m=o.sma(f,a,this._context));var y=this.f_0(g,m);return[y,g,m,this.f_1(y)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",
+defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o[this._input(1)](this._context),s=this._input(0),n=this._input(2),r=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=o.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===r?l=o.ema(d,a,this._context):"WMA"===r?l=o.wma(d,a,this._context):"SMA"===r&&(l=o.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o[this._input(1)](this._context),s=this._input(0),n=this._input(2),r=this._context.new_var(i);return[{value:o.wma(r,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{symbol:"",firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"symbol",name:"Another symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4
+},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.time(this._context)),s=o.close(this._context);if(""!==this._input(0)){this._context.select_sym(1);var n=this._context.new_var(o.time(this._context)),r=o.close(this._context);s=this._context.new_var(r).adopt(n,i,1),this._context.select_sym(0)}var a,l,c=this._context.new_var(s);return"Exponential"===this._input(3)?(a=o.ema(c,this._input(1),this._context),l=o.ema(c,this._input(2),this._context)):"Weighted"===this._input(3)?(a=o.wma(c,this._input(1),this._context),l=o.wma(c,this._input(2),this._context)):(a=o.sma(c,this._input(1),this._context),l=o.sma(c,this._input(2),this._context)),[a,l]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{symbol:"",firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time),s=o.close(this._context);if(""!==this._input(0)){this._context.select_sym(1);var n=this._context.new_var(this._context.symbol.time),r=o.close(this._context);s=this._context.new_var(r).adopt(n,i,1),this._context.select_sym(0)}var a,l,c,h=this._context.new_var(s);return"Exponential"===this._input(4)?(a=o.ema(h,this._input(1),this._context),l=o.ema(h,this._input(2),this._context),c=o.ema(h,this._input(3),this._context)):"Weighted"===this._input(4)?(a=o.wma(h,this._input(1),this._context),
+l=o.wma(h,this._input(2),this._context),c=o.wma(h,this._input(3),this._context)):(a=o.sma(h,this._input(1),this._context),l=o.sma(h,this._input(2),this._context),c=o.sma(h,this._input(3),this._context)),[a,l,c]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),r=o.stdev(t,i,this._context),a=o.log(n/e.get(i))/(r*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.close(this._context)),s=this._context.new_var(o.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,o=1;o<=this.periods;++o){var n=Math.sin((1+o)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*o.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return o.gt(e,0)?t:o.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._context.new_var(i),n=o.change(s);return[this.f_0(n,o.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return o.gt(e,0)?t:o.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.close(this._context),r=this._context.new_var(n),a=o.change(r),l=this.f_0(a,o.volume(this._context),a),c=o.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=o.ema(d,s,this._context):"WMA"===i?h=o.wma(d,s,this._context):"SMA"===i&&(h=o.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{
+_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2,symbol:""}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),o.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;const i=()=>o.sar(this._input(1),this._input(2),this._input(3),this._context);if(""===this._input(0))return[i()];this._context.select_sym(0);const s=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);const n=this._context.new_var(i()).adopt(this._context.new_var(this._context.symbol.time),s,1);return this._context.select_sym(0),[n]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.high(this._context),s=this._context.new_var(i),n=o.low(this._context),r=this._context.new_var(n),a=this._input(0),l=this._input(1),c=o.highest(s,a,this._context),h=o.lowest(r,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:o.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,
+joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(o.close(this._context));return[o.cum(o.change(e)/e.get(1)*o.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0()[0]]}}},{name:"Rank Correlation Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:12}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"RCI",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Rank Correlation Index",shortDescription:"RCI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"length",defval:12,type:"integer",min:1,max:1e12}],id:"rank_correlation_index@tv-basicstudies-1",scriptIdPart:"",name:"Rank Correlation Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.orderRank=function(e,t,i){let s=e.get(t),n=1,r=0;for(let t=0;t0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){return this._context=e,this._input=t,
+[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[o.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[o.sum(s,i,this._context)/o.sum(n,i,this._context)]},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(o.close(this._context)),n=o.max(o.high(this._context),s.get(1)),r=this._context.new_var(o.close(this._context)),a=o.min(o.low(this._context),r.get(1)),l=o.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return o.sqrt(s)},this.variance=function(e,t,i){var s=o.sma(e,t,i);return this.variance2(e,s,t)},this.variance2=function(e,t,i){var s,o,n=0
+;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(o.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=o.high(this._context)-o.low(this._context),t=o.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-o.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=o.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(o.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(o.close(this._context)),1===this.count)this.atr=o.high(this._context)-o.low(this._context),this.sic=o.close(this._context);else if(this.countthis.sic&&(this.sic=o.close(this._context))}else if(this.count===this.period){e=o.high(this._context)-o.low(this._context),t=o.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-o.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,
+o.close(this._context)>this.sic&&(this.sic=o.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?o.close(this._context)s?(this.position="LONG",this.sic=o.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(o.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return o.weekofyear(e,t)!==o.weekofyear(e,i)||o.year(e,t)!==o.year(e,i)};case"Month":return function(t,i){return o.month(e,t)!==o.month(e,i)||o.year(e,t)!==o.year(e,i)};case"Quarter":return function(t,i){return Math.floor(o.month(e,t)/3)!==Math.floor(o.month(e,i)/3)||o.year(e,t)!==o.year(e,i)};case"Year":return function(t,i){return o.year(e,t)!==o.year(e,i)};case"Decade":return function(t,i){return Math.floor(o.year(e,t)/10)!==Math.floor(o.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(o.year(e,t)/100)!==Math.floor(o.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var(),r=e.new_var();const a=o.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=o.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),r.set(a))}return s.set(o.nz(s.get(1))+o[i](this._context)*o.volume(this._context)),n.set(o.nz(n.get(1))+o.volume(this._context)),
+o.na(r.get(0))?(!e.symbol.isLastBar||e.symbol.isNewBar&&!Number.isNaN(e.symbol.projectionTime)||o.error("To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.","VWAP is waiting for more data"),[NaN]):[s.get(0)/n.get(0)]}}},{name:"VWMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._context.new_var(i);return[o.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.volume(this._context),r=this._context.new_var(n),a=o.ema(r,i,this._context),l=this._context.new_var(n),c=o.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){
+var e=this._input(0),t=this._context.new_var(o.low(this._context)),i=this._context.new_var(o.abs(o.high(this._context)-t.get(1))),s=o.sum(i,e,this._context),n=this._context.new_var(o.high(this._context)),r=this._context.new_var(o.abs(o.low(this._context)-n.get(1))),a=o.sum(r,e,this._context),l=this._context.new_var(o.atr(1,this._context)),c=o.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=this._context.new_var(s),r=o.highest(n,i,this._context),a=o.low(this._context),l=this._context.new_var(a),c=o.lowest(l,i,this._context);return[this.f_0(o.close(this._context),r,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",
+name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),r=this._input(3),a=this._input(4),l=this._input(5),c=o.hl2(this._context);return[{value:o.smma(c,i,this._context),offset:r},{value:o.smma(c,s,this._context),offset:a},{value:o.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(o.high(this._context)),i=!0,s=!0,n=!0,r=!0,a=!0,l=!0,c=1;c<=e;c++)i=o.and(i,o.lt(t.get(e-c),t.get(e))),s=o.and(s,o.lt(t.get(e+c),t.get(e))),n=o.and(n,o.and(o.le(t.get(e+1),t.get(e)),o.lt(t.get(e+c+1),t.get(e)))),r=o.and(r,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.lt(t.get(e+c+2),t.get(e))))),a=o.and(a,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.lt(t.get(e+c+3),t.get(e)))))),l=o.and(l,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.and(o.le(t.get(e+4),t.get(e)),o.lt(t.get(e+c+4),t.get(e)))))));var h=o.or(s,o.or(n,o.or(r,o.or(a,l)))),d=o.and(i,h),u=this._context.new_var(o.low(this._context)),_=1,p=1,m=1,g=1,f=1,y=1;for(c=1;c<=e;c++)_=o.and(_,o.gt(u.get(e-c),u.get(e))),p=o.and(p,o.gt(u.get(e+c),u.get(e))),m=o.and(m,o.and(o.ge(u.get(e+1),u.get(e)),o.gt(u.get(e+c+1),u.get(e)))),g=o.and(g,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.gt(u.get(e+c+2),u.get(e))))),f=o.and(f,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.gt(u.get(e+c+3),u.get(e)))))),y=o.and(y,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.and(o.ge(u.get(e+4),u.get(e)),o.gt(u.get(e+c+4),u.get(e)))))));var v=o.or(p,o.or(m,o.or(g,o.or(f,y))));return[o.and(_,v),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{
+name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",
+hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o.close(this._context)),s=this._input(0),n=this._input(1),r=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=o.ema(i,s,this._context),d=o.ema(i,n,this._context),u=o.ema(i,r,this._context),_=o.ema(i,a,this._context),p=o.ema(i,l,this._context),m=o.ema(i,c,this._context),g=this._input(6),f=this._input(7),y=this._input(8),v=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,_,p,m,o.ema(i,g,this._context),o.ema(i,f,this._context),o.ema(i,y,this._context),o.ema(i,v,this._context),o.ema(i,S,this._context),o.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,
+this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==o.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||o.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==o.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=o.time(this._context),r=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(o[i](this._context)),l=this._context.new_unlimited_var(o[s](this._context));if(r.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=o.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=r.indexOf(c.getTime()),d=-1===h?NaN:o.highest(a,h,this._context),u=-1===h?NaN:o.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},30342:(e,t,i)=>{"use strict";var s;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},81593:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(34840)},48480:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},32544:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>r,getQuoteSessionInstance:()=>n});var s=i(13607);const o={};function n(e="full"){return o[e]||function(e="full",t){o[e]=t}(e,new s(e)),o[e]}function r(){for(const e in o)if(o.hasOwnProperty(e)){const t=o[e];void 0!==t&&t.destroy(),delete o[e]}}},13607:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(20057).default,o=i(90484).default,n=i(67563).PriceFormatter;const{uniq:r}=i(53470);var a=i(4168);const{normalizeUpdateMode:l}=i(52706);var c=i(39527).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(30947);var u=i(48096).Delegate;const{getNewPeveCloseMode:_}=i(98422),{QuoteSession:p}=i(76220);function m(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new u,this.onDisconnect=new u,this._quoteApi=new p(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=o(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},
+this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}m.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},m.prototype.typeFields={},m.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id","unit_id","measure"],m.prototype.typeFields.simpleDetailed=[].concat(m.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),m.prototype.typeFields.full=[],m.prototype.typeFields.watchlist=[].concat(m.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id","dividends_availability","financials_availability","earnings_availability"]),m.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","local_description","language","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_calc","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id","unit_id","measure"],m.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],m.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],m.prototype.typeFields.economic=["reference-last-period","lp","currency_code","value_unit_id","unit_id","measure"],m.prototype.typeFields.options=["ask","bid","lp","volume"],m.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},m.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break
+;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},m.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},m.prototype.setFields=function(){var e=m.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},m.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];_()&&(delete e.values.prev_close_price,void 0!==e.values.regular_close&&(e.values.prev_close_price=e.values.regular_close)),i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},m.prototype._parseUpdateMode=function(e){l(e)},m.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var o=this._subscriptions[s];o.has(e)&&[...o.get(e)].forEach((function(e){e(t,i)}))}},m.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e];t=[].concat(t);var o=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},o.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),o.length&&this._connected&&(this._quoteApi.quoteAddSymbols(o),this._delayUpdateFastSymbols())},m.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],o=[],n=0;n{"use strict";i.d(t,{getServerInterval:()=>o});var s=i(46082);function o(e){return s.Interval.isRange(e)?"1":e}},45720:(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 o(e,t,i){const s=e.get(t);if(void 0!==s)return s;const o=i();return e.set(t,o),o}function n(e,t,i,n){return o(s(e,t,new Map),i,n)}function r(e,t,i,o,n){const r=s(e,t,new Map),a=s(r,i,new Map);return s(a,o,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>r});class a{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}},12217:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>s.compareTwoCollectionsByIds,indexOf:()=>s.indexOf,intersect:()=>s.intersect,join:()=>s.join,lowerbound:()=>s.lowerbound,lowerboundExt:()=>s.lowerboundExt,lowerbound_int:()=>s.lowerbound_int,mapEntriesGenerator:()=>s.mapEntriesGenerator,moveAfter:()=>s.moveAfter,moveBefore:()=>s.moveBefore,moveToHead:()=>s.moveToHead,nestedMapGenerator:()=>s.nestedMapGenerator,removeItemFromArray:()=>s.removeItemFromArray,subtract:()=>s.subtract,sum:()=>s.sum,upperbound:()=>s.upperbound,upperbound_int:()=>s.upperbound_int});var s=i(16879)},69558:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_DASHED:()=>n,LINESTYLE_DOTTED:()=>o,LINESTYLE_LARGE_DASHED:()=>r,LINESTYLE_SMALL_DASHED:()=>l,LINESTYLE_SOLID:()=>s,LINESTYLE_SPARSE_DOTTED:()=>a});const s=0,o=1,n=2,r=3,a=4,l=5},16659:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>r});var s,o=i(50151);function n(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}!function(e){e[e.CapacityFactor=1.3]="CapacityFactor"}(s||(s={}));class r{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&&(n(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){const t=this._cache.get(e);if(void 0===t)return t;if(t===this._firstItem&&(this._firstItem=t.nextItem??t),t!==this._lastItem){n(t);const e=(0,o.ensureNotNull)(this._lastItem);e.nextItem=t,t.prevItem=e,t.nextItem=null,this._lastItem=t}return t.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(n(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}*entries(){if(null!==this._firstItem)for(let e=this._firstItem;null!==e;e=e.nextItem)yield[e.key,e.value]}state(){const e=[];for(const[t,i]of this.entries())e.push([t,i]);return e}restoreState(e){for(const t of e)this.set(t[0],t[1])}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,o.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{accumulate:()=>a,combine:()=>r,combineWithFilteredUpdate:()=>n});var s=i(22613);function o(e,t,...i){let o=null;const n=(...t)=>e(...t.map((e=>e.value())),o?.value()),r=o=new s.WatchedValue(n(...i)),a=()=>{const e=i.map(((e,t)=>e.value()));t(...e)&&r.setValue(n(...i))},l=i.map((e=>e.spawn()));for(const e of l)e.subscribe(a);return r.readonly().spawn((()=>{l.forEach((e=>e.destroy())),i.forEach((e=>e.release()))}))}function n(e,t,...i){return o(e,t,...i)}function r(e,...t){return o(e,(()=>!0),...t)}function a(e,t,...i){let o=null;const n=r(((...e)=>(e.splice(-1),e)),...i),a=t.spawn(),l=(t,...i)=>{const s=t.map((e=>e.value()));return e(s,...i,o?.value())},c=o=new s.WatchedValue(l(a.value(),...n.value()));let h=[];const d=()=>{c.setValue(l(h,...n.value()))},u=e=>{h.forEach((e=>e.destroy())),h=e.map((e=>e.spawn())),h.forEach((e=>e.subscribe(d))),d()};u(a.value()),a.subscribe(u),n.subscribe(d);return c.readonly().spawn((()=>{h.forEach((e=>e.destroy())),a.destroy(),n.destroy(),t.release()}))}},10845:(e,t,i)=>{"use strict";i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,timezoneIsSupported:()=>_,timezoneTitle:()=>p,updateAvailableTimezones:()=>d});var s=i(95523),o=i(11542);const n=[{id:"Etc/UTC",get title(){return o.t(null,void 0,i(1833))}},{id:"exchange",get title(){return o.t(null,void 0,i(86905))}}],r=[{id:"Africa/Cairo",get title(){return o.t(null,void 0,i(65736))},offset:0},{id:"Africa/Casablanca",get title(){return o.t(null,void 0,i(70409))},offset:0},{id:"Africa/Johannesburg",get title(){
+return o.t(null,void 0,i(39585))},offset:0},{id:"Africa/Lagos",get title(){return o.t(null,void 0,i(19931))},offset:0},{id:"Africa/Nairobi",get title(){return o.t(null,void 0,i(40977))},offset:0},{id:"Africa/Tunis",get title(){return o.t(null,void 0,i(21007))},offset:0},{id:"America/Anchorage",get title(){return o.t(null,void 0,i(42630))},offset:0},{id:"America/Argentina/Buenos_Aires",get title(){return o.t(null,void 0,i(25282))},offset:0},{id:"America/Bogota",get title(){return o.t(null,void 0,i(73905))},offset:0},{id:"America/Caracas",get title(){return o.t(null,void 0,i(30948))},offset:0},{id:"America/Chicago",get title(){return o.t(null,void 0,i(72452))},offset:0},{id:"America/El_Salvador",get title(){return o.t(null,void 0,i(55502))},offset:0},{id:"America/Juneau",get title(){return o.t(null,void 0,i(67560))},offset:0},{id:"America/Lima",get title(){return o.t(null,void 0,i(59444))},offset:0},{id:"America/Los_Angeles",get title(){return o.t(null,void 0,i(28733))},offset:0},{id:"America/Mexico_City",get title(){return o.t(null,void 0,i(73332))},offset:0},{id:"America/New_York",get title(){return o.t(null,void 0,i(40544))},offset:0},{id:"America/Phoenix",get title(){return o.t(null,void 0,i(14055))},offset:0},{id:"America/Santiago",get title(){return o.t(null,void 0,i(30231))},offset:0},{id:"America/Sao_Paulo",get title(){return o.t(null,void 0,i(91912))},offset:0},{id:"America/Toronto",get title(){return o.t(null,void 0,i(10095))},offset:0},{id:"America/Vancouver",get title(){return o.t(null,void 0,i(32838))},offset:0},{id:"US/Mountain",get title(){return o.t(null,void 0,i(27358))},offset:0},{id:"Asia/Almaty",get title(){return o.t(null,void 0,i(98128))},offset:0},{id:"Asia/Ashkhabad",get title(){return o.t(null,void 0,i(63627))},offset:0},{id:"Asia/Bahrain",get title(){return o.t(null,void 0,i(90594))},offset:0},{id:"Asia/Bangkok",get title(){return o.t(null,void 0,i(47045))},offset:0},{id:"Asia/Chongqing",get title(){return o.t(null,void 0,i(50349))},offset:0},{id:"Asia/Colombo",get title(){return o.t(null,void 0,i(10871))},offset:0},{id:"Asia/Dhaka",get title(){return o.t(null,void 0,i(24959))},offset:0},{id:"Asia/Dubai",get title(){return o.t(null,void 0,i(23650))},offset:0},{id:"Asia/Ho_Chi_Minh",get title(){return o.t(null,void 0,i(34491))},offset:0},{id:"Asia/Hong_Kong",get title(){return o.t(null,void 0,i(48861))},offset:0},{id:"Asia/Jakarta",get title(){return o.t(null,void 0,i(14995))},offset:0},{id:"Asia/Jerusalem",get title(){return o.t(null,void 0,i(36057))},offset:0},{id:"Asia/Karachi",get title(){return o.t(null,void 0,i(70913))},offset:0},{id:"Asia/Kabul",get title(){return o.t(null,void 0,i(99563))},offset:0},{id:"Asia/Kathmandu",get title(){return o.t(null,void 0,i(54533))},offset:0},{id:"Asia/Kolkata",get title(){return o.t(null,void 0,i(31561))},offset:0},{id:"Asia/Kuala_Lumpur",get title(){return o.t(null,void 0,i(38561))},offset:0},{id:"Asia/Kuwait",get title(){return o.t(null,void 0,i(76614))},offset:0},{id:"Asia/Manila",get title(){return o.t(null,void 0,i(48991))},offset:0},{
+id:"Asia/Muscat",get title(){return o.t(null,void 0,i(9865))},offset:0},{id:"Asia/Nicosia",get title(){return o.t(null,void 0,i(94600))},offset:0},{id:"Asia/Qatar",get title(){return o.t(null,void 0,i(28756))},offset:0},{id:"Asia/Riyadh",get title(){return o.t(null,void 0,i(37974))},offset:0},{id:"Asia/Seoul",get title(){return o.t(null,void 0,i(26820))},offset:0},{id:"Asia/Shanghai",get title(){return o.t(null,void 0,i(1852))},offset:0},{id:"Asia/Singapore",get title(){return o.t(null,void 0,i(77377))},offset:0},{id:"Asia/Taipei",get title(){return o.t(null,void 0,i(11034))},offset:0},{id:"Asia/Tehran",get title(){return o.t(null,void 0,i(6686))},offset:0},{id:"Asia/Tokyo",get title(){return o.t(null,void 0,i(69122))},offset:0},{id:"Asia/Yangon",get title(){return o.t(null,void 0,i(53168))},offset:0},{id:"Atlantic/Azores",get title(){return o.t(null,void 0,i(87580))},offset:0},{id:"Atlantic/Reykjavik",get title(){return o.t(null,void 0,i(13386))},offset:0},{id:"Australia/Adelaide",get title(){return o.t(null,void 0,i(37265))},offset:0},{id:"Australia/Brisbane",get title(){return o.t(null,void 0,i(79336))},offset:0},{id:"Australia/Perth",get title(){return o.t(null,void 0,i(24436))},offset:0},{id:"Australia/Sydney",get title(){return o.t(null,void 0,i(31622))},offset:0},{id:"Europe/Amsterdam",get title(){return o.t(null,void 0,i(36485))},offset:0},{id:"Europe/Athens",get title(){return o.t(null,void 0,i(73702))},offset:0},{id:"Europe/Belgrade",get title(){return o.t(null,void 0,i(71797))},offset:0},{id:"Europe/Berlin",get title(){return o.t(null,void 0,i(64313))},offset:0},{id:"Europe/Bratislava",get title(){return o.t(null,void 0,i(70876))},offset:0},{id:"Europe/Brussels",get title(){return o.t(null,void 0,i(91499))},offset:0},{id:"Europe/Bucharest",get title(){return o.t(null,void 0,i(33672))},offset:0},{id:"Europe/Budapest",get title(){return o.t(null,void 0,i(20313))},offset:0},{id:"Europe/Copenhagen",get title(){return o.t(null,void 0,i(38917))},offset:0},{id:"Europe/Dublin",get title(){return o.t(null,void 0,i(79716))},offset:0},{id:"Europe/Helsinki",get title(){return o.t(null,void 0,i(48203))},offset:0},{id:"Europe/Istanbul",get title(){return o.t(null,void 0,i(78326))},offset:0},{id:"Europe/Lisbon",get title(){return o.t(null,void 0,i(53375))},offset:0},{id:"Europe/London",get title(){return o.t(null,void 0,i(19439))},offset:0},{id:"Europe/Luxembourg",get title(){return o.t(null,void 0,i(81038))},offset:0},{id:"Europe/Madrid",get title(){return o.t(null,void 0,i(52066))},offset:0},{id:"Europe/Malta",get title(){return o.t(null,void 0,i(38365))},offset:0},{id:"Europe/Moscow",get title(){return o.t(null,void 0,i(64039))},offset:0},{id:"Europe/Oslo",get title(){return o.t(null,void 0,i(75722))},offset:0},{id:"Europe/Paris",get title(){return o.t(null,void 0,i(61879))},offset:0},{id:"Europe/Prague",get title(){return o.t(null,void 0,i(81248))},offset:0},{id:"Europe/Riga",get title(){return o.t(null,void 0,i(94022))},offset:0},{id:"Europe/Rome",get title(){return o.t(null,void 0,i(52961))},offset:0},{
+id:"Europe/Stockholm",get title(){return o.t(null,void 0,i(86716))},offset:0},{id:"Europe/Tallinn",get title(){return o.t(null,void 0,i(79995))},offset:0},{id:"Europe/Vienna",get title(){return o.t(null,void 0,i(23160))},offset:0},{id:"Europe/Vilnius",get title(){return o.t(null,void 0,i(60534))},offset:0},{id:"Europe/Warsaw",get title(){return o.t(null,void 0,i(5959))},offset:0},{id:"Europe/Zurich",get title(){return o.t(null,void 0,i(62859))},offset:0},{id:"Pacific/Auckland",get title(){return o.t(null,void 0,i(66103))},offset:0},{id:"Pacific/Chatham",get title(){return o.t(null,void 0,i(36549))},offset:0},{id:"Pacific/Fakaofo",get title(){return o.t(null,void 0,i(98549))},offset:0},{id:"Pacific/Honolulu",get title(){return o.t(null,void 0,i(79668))},offset:0},{id:"Pacific/Norfolk",get title(){return o.t(null,void 0,i(67891))},offset:0}];function a(e,t,i){const o=function(e){return e.map((e=>{const{id:t}=e,{string:i,offset:o}=(0,s.parseTzOffset)(t);return{id:t,offset:o,get title(){return`(${i}) ${e.title}`}}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((e=>{const{alias:t,id:i}=e,{string:o,offset:n}=(0,s.parseTzOffset)(t);return{id:i,offset:n,get title(){return`(${o}) ${e.title}`},alias:t}})),r=function(e){return e.sort(((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}))}(o.concat(n));return t.concat(r)}const l=a(r,n,[]),c=new Map;l.forEach((e=>{c.set(e.id,!0)}));const h=new Map;n.concat(r).forEach((e=>{h.set(e.id,!0)}));const d=e=>{l.splice(0,l.length,...a(r,n,e)),l.forEach((e=>{c.set(e.id,!0)}))};function u(e){return c.has(e)}function _(e){return h.get(e)||!1}function p(e){for(const{id:t,title:i}of r)if(t===e){return`${i} (${(0,s.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},48096:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(9343).getLogger)("Common.Delegate");function o(e){return!e.singleShot}class n{constructor(){this.fire=this._fireImpl.bind(this),this._listeners=[]}subscribe(e,t,i){this._listeners.push({object:e,member:t,singleShot:!!i,skip:!1})}unsubscribe(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}}destroy(){this._listeners=[]}_fireImpl(...e){const t=this._listeners;this._listeners=this._listeners.filter(o);const i=t.length;for(let o=0;o{"use strict";var s,o;i.d(t,{HorizontalAlign:()=>s,VerticalAlign:()=>o}),function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(o||(o={}))},55014:(e,t,i)=>{"use strict";i.d(t,{formatStudyError:()=>n,triesTranslateError:()=>o});var s=i(11542);function o(e){return r.get(e)||e}function n(e){return e.format({
+boldHighlightStart:"",boldHighlightEnd:""})}const r=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void 0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(69156))],["Runtime error",s.t(null,void 0,i(60630))],["Access error",s.t(null,void 0,i(77401))],["User-defined error",s.t(null,void 0,i(8580))],["Compilation error",s.t(null,void 0,i(12086))],["Metric error",s.t(null,void 0,i(83111))],["There's no data for your selected period and chart timeframe.",s.t(null,void 0,i(43716))],["The request took too long to process. Ensure you have a stable internet connection. If the issue persists, try decreasing the length of the requested time interval.",s.t(null,void 0,i(99274))],["Unexpected error in Deep Backtesting mode. Contact support for more information.",s.t(null,void 0,i(56815))],["check study unexpected error",s.t(null,void 0,i(83524))],["To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.",s.t(null,void 0,i(41446))],["VWAP is waiting for more data",s.t(null,void 0,i(81030))],["The Bar Magnifier feature is only available to Premium users",s.t(null,void 0,i(45328))],["The bar magnifier is only available to the Premium plan or higher.",s.t(null,void 0,i(35601))]])},64971:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});const s=new Map;function o(e){e.crossOrigin="anonymous"}function n(e,t,i=o){let n=s.get(e);return void 0===n&&(n=new Promise(((e,s)=>{const o=new Image;o.onload=()=>{e(o),o.onload=null,o.onerror=null},o.onerror=()=>{s(),o.onload=null,o.onerror=null},i(o),o.src=t})),s.set(e,n)),n}},38486:(e,t,i)=>{"use strict";function s(e){const t=Object.create(e);return t.release=()=>{},t.ownership=()=>t,t}function o(e){const t=e;return t.release=()=>t.destroy(),t.ownership=()=>t,t}i.d(t,{ownership:()=>o,weakReference:()=>s})},95523:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>o});var s=i(37236);function o(e,t=Date.now()){const i=(0,s.get_timezone)(e).offset_utc(t);let o="";const n=i/1e3/60/60;n%1&&(o=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));let r="";return r=n>0?"+"+(n-n%1)+o:0===n?"":String(n-n%1+o),{offset:i,string:"UTC"+r}}},4148:(e,t,i)=>{"use strict";i.d(t,{clone:()=>s.clone,isNumber:()=>s.isNumber,isObject:()=>s.isObject});var s=i(87465)},59149:e=>{"use strict";var t=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{
+d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],i=function(){var e=[{pattern:"(",ctor:n},{pattern:")",ctor:r},{pattern:"+",ctor:l},{pattern:"-",ctor:c},{pattern:"*",ctor:h},{pattern:"/",ctor:d},{pattern:"^",ctor:u},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:g},{pattern:/\./,ctor:v},{pattern:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/,ctor:m},{pattern:/'[^']*/,ctor:y},{pattern:/[\0-\x20\s]+/,ctor:o}];function i(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function s(){}function o(e){this.value=e}function n(){}function r(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}s.prototype.toString=function(){return this.value},i(o,s),i(n,s),n.prototype.value="(",i(r,s),r.prototype.value=")",i(a,s),i(l,a),l.prototype.value="+",l.prototype.precedence=0,l.prototype.commutative=!0,i(c,a),c.prototype.value="-",c.prototype.precedence=0,c.prototype.commutative=!1,i(h,a),h.prototype.value="*",h.prototype.precedence=1,h.prototype.commutative=!0,i(d,a),d.prototype.value="/",d.prototype.precedence=1,d.prototype.commutative=!1,i(u,a),u.prototype.value="^",u.prototype.precedence=2,u.prototype.commutative=!1;var _=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,p=/[+\-/*]/;function m(e){this.value=e}function g(e){this.value=e}function f(e){this.value=e}function y(){m.apply(this,arguments)}function v(){g.apply(this,arguments)}i(m,s),m.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=p.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},m.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},m.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return t.some((function(t){return t.t===e}))},i=2;i>=1;--i){var s=this._ticker.slice(0,i);if(e(s)){this._root=s,this._contract=this._ticker.slice(i);break}}},m.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null==e?delete this._exchange:this._exchange=e+""},m.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},m.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},m.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},i(g,s),g.prototype.toString=function(){
+return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},g.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},f.prototype.toString=function(){return this.value},i(y,m),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},i(v,g),v.prototype.isIncomplete=!0;var S=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function b(t,i){var s,n=[];e:for(;s=S.exec(t);){for(var r=e.length;r--;)if(s[r+1]){if(e[r].ctor){var a=new e[r].ctor(s[r+1]);a._offset=s.index,n.push(a)}continue e}var l=new f(s[0]);l._offset=s.index,n.push(l)}if(i&&i.recover){var c;for(r=n.length;r--;){var h=n[r];if(h instanceof g||h instanceof m){if(void 0!==c){var d=new m(""),u=n.splice(r,c-r+1,d);d.value=u.map((function(e){return e.value})).join("")}c=r}else h instanceof o||(c=void 0)}}return n}function w(e){for(var t=[],i=0;il.precedence&&(s[s.length-1].minPrecedence=l.precedence);else if(l instanceof n)s.push(t={minPrecedence:1/0,openBraceIndex:o});else if(l instanceof r){var c=e[(t=s.pop()).openBraceIndex-1],h=e[o+1];h instanceof a&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof a)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(o=i.length;o--;)e.splice(i[o],1);return e}function T(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=b(e)).filter((function(e){return e instanceof m})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function P(e){return 1!==(e=T(e)).length?null:e[0]}function x(e,t){return(e=T(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:b,validate:function(e){return{currentState:"var"}},factorOutBraces:C,normalizeTokens:function(e){for(var t=0;t{"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 o of Object.keys(e)){const n=e[o];n instanceof s?(t[o]=n.originalText(),i[o]=n.translatedText()):(t[o]=n.toString(),i[o]=n.toString())}const o=this._originalText.format(t),n=this._translatedText.format(i);return new s(o,n)}}},9787:(e,t,i)=>{"use strict";i.d(t,{Version:()=>o});var s=i(50151);class o{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof o)return new o(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new o(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new o(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0,s.assert)(!isNaN(n),"Bad version string: "+e),new o(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}o.ZERO=new o(0,0)},22613:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>s.WatchedValue});var s=i(52499)},62773:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>s.WatchedObject});var s=i(52499)},99247:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>r,initMouseClickAutoBlurHandler:()=>a});var s=i(81251),o=i(76460);const n="data-mouse-click-auto-blur";class r{constructor(){this._handler=e=>{document.activeElement instanceof HTMLElement&&((0,o.isKeyboardClick)(e)||e.target instanceof Element&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}
+static attributes(e=!0){return e?{[n]:!0}:{}}}const a=(0,s.default)((()=>new r))},22692:(e,t,i)=>{"use strict";i.d(t,{mapKeyCodeToDirection:()=>h,navigationOrderComparator:()=>r,queryFocusableElements:()=>l,queryTabbableElements:()=>a,updateTabIndexes:()=>c});var s,o=i(24640),n=i(15754);function r(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function a(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,n.createScopedVisibleElementFilter)(e))}function l(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""]), [tabindex]:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""])')).filter((0,n.createScopedVisibleElementFilter)(e))}function c(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function h(e){const t=(0,o.isRtl)();switch(e){case 38:return"blockPrev";case 40:return"blockNext";case 37:return t?"inlineNext":"inlinePrev";case 39:return t?"inlinePrev":"inlineNext";default:return null}}!function(e){e.BlockPrev="blockPrev",e.BlockNext="blockNext",e.InlinePrev="inlinePrev",e.InlineNext="inlineNext"}(s||(s={}))},66593:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>o,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,o=5},55308:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(1765),o=i(37103),n=i(22613);const r=!o.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",r),l=new n.WatchedValue(a)},9753:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>o});var s=i(41183);const o=parseInt(s["css-value-header-toolbar-height"]),n=3},23745:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>r});var s=i(49483),o=i(84015),n=i(37103);function r(){return!s.CheckMobile.any()&&!(0,o.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},14429:(e,t,i)=>{"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(41706),o=i(84696);class n extends s.Action{constructor(e){const{options:t,customActionOptions:i}=e;t.iconId&&(t.icon=t.icon??o.icons.get(t.iconId)),i&&i.iconId&&(i.icon=i.icon??o.icons.get(i.iconId)),super(e)}}},41706:(e,t,i)=>{"use strict";i.d(t,{Action:()=>c,Separator:()=>h});var s,o=i(50151),n=i(68335),r=i(4226),a=i(48096);class l extends a.Delegate{constructor(e){super(),this._onStartListening=null,this._onStopListening=null,this._onStartListening=e||null}subscribe(e,t,i){const s=0===this._listeners.length;super.subscribe(e,t,i),s&&this._listeners.length>0&&this._onStartListening&&(this._onStopListening=this._onStartListening())}unsubscribe(e,t){const i=0===this._listeners.length;super.unsubscribe(e,t),!i&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),this._onStopListening=null)}unsubscribeAll(e){const t=0===this._listeners.length;super.unsubscribeAll(e),
+!t&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),this._onStopListening=null)}destroy(){this._onStopListening&&(this._onStopListening(),this._onStopListening=null),super.destroy()}}!function(e){e.Normal="normal",e.Big="big"}(s||(s={}));class c{constructor(e){this.type="action",this._destroyed=!1,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:s,customActionOptions:n,customActionOptionsLoader:a,id:h=r.guid(),onStartListening:d}=e;(0,o.assert)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new l(d),this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=s??null,this._loadOptionsGetter&&(this._options.loading=!0),n&&(this._customAction=new c({actionId:t,options:n,optionsLoader:a,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(){return this._options.size??"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}}destroy(){this._destroyed=!0,this._onUpdate.destroy(),this._unbindShortcut(),this._options.onDestroy?.(),this._customAction?.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 h{constructor(e){this.type="separator",this.id=r.guid(),this._hint=e}getHint(){return this._hint}}},84696:(e,t,i)=>{"use strict";i.d(t,{icons:()=>w});var s,o=i(53573),n=i(34369),r=i(39267),a=i(93544),l=i(84959),c=i(34487),h=i(11890),d=i(16911),u=i(25191),_=i(54190),p=i(6862),m=i(97874),g=i(2872),f=i(29453),y=i(94839),v=i(5845),S=i(1457),b=i(93379);!function(e){e.ChartShowDataWindow="Chart.ShowDataWindow",e.ChartReset="Chart.Reset",e.ChartRemoveSelectedObject="Chart.RemoveSelectedObject",e.Settings="Settings",e.ChartHide="Chart.Hide",e.ChartSymbolInfo="Chart.SymbolInfo",e.ChartFinancials="Chart.Financials",e.ChartTechnicals="Chart.Technicals",e.ChartDetailsMetrics="Chart.DetailsMetrics",e.ChartSeasonals="Chart.Seasonals",e.ChartAnalysis="Chart.Analysis",e.ChartStockBonds="Chart.StockBonds",e.ChartForecast="Chart.Forecast",e.ChartOptions="Chart.Options",e.ChartEconomyIdicators="Chart.EconomyIndicators",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertRestart="Alert.Restart",e.AlertStop="Alert.Stop",e.AlertFiresDownload="Alert.FiresDownload",e.ClearAll="Alert.Clear",e.ChartVisualOrder="Chart.VisualOrder",e.ChartShowObject="Chart.ShowObject",e.ChartPriceScale="Chart.PriceScale",e.ChartMove="Chart.Move",e.ChartApplyIndicator="Chart.ApplyIndicator",e.ChartUnlockObject="Chart.UnlockObject",e.ChartLockObject="Chart.LockObject",e.ChartAnchorLineTool="Chart.AnchorLineTool",e.ChartInsertRowTable="Chart.InsertRowTable",e.ChartInsertColumnTable="Chart.InsertColumnTable",e.ChartRemoveRowTable="Chart.RemoveRowTable",e.ChartRemoveColumnTable="Chart.RemoveColumnTable",e.ChartClone="Chart.Clone",e.ChartAddHorzLine="Chart.AddHorzLine",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreateNew="Watchlist.CreateNew",e.TextNoteAdd="TextNote.Add",e.TradingSell="Trading.Sell",e.TradingBuy="Trading.Buy",e.TradingAddOrder="Trading.AddOrder",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem",e.IndicatorAddToFavorites="Indicator.AddToFavorites"}(s||(s={}));const w=new Map([["Chart.Reset",r],["Chart.RemoveSelectedObject",a],["Settings",n],["Chart.Hide",l],["Chart.SymbolInfo",c],["Chart.VisualOrder",h],["Chart.ShowObject",d],["Chart.PriceScale",u],["Chart.Move",_],["Chart.ApplyIndicator",p],["Chart.UnlockObject",m],["Chart.LockObject",g],["Chart.AnchorLineTool",f],["Chart.InsertRowTable",y],["Chart.InsertColumnTable",v],["Chart.RemoveRowTable",a],["Chart.RemoveColumnTable",a],["Chart.Clone",S],["Chart.AddHorzLine",b],["Indicator.AddToFavorites",o]])},31932:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(3462),i.e(6025),i.e(9378),i.e(1485),i.e(5456),i.e(6602)]).then(i.bind(i,95616))}i.d(t,{actionsProviderModule:()=>s})},72104:(e,t,i)=>{"use strict";i.d(t,{
+defaultChartWidgetActionsOptions:()=>s});const s={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};var o;!function(e){e.Copy="Copy"}(o||(o={}))},92848:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),o=i(36313),n=i(2088),r=i(26610);function a(e){return"drawing"===e.type}function l(e,t){if(1===t.length&&(0,n.isStudy)(t[0])){const e=t[0];return{title:e.title(o.TitleDisplayTarget.StatusLine),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter((e=>e.copiable()&&(0,r.isLineTool)(e))).map((t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i})),i.sources.length>0?(1===i.sources.length?i.title=t[0].title(o.TitleDisplayTarget.StatusLine):i.title="Drawings",i):null}},33350:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>T,addExclusionAreaByScope:()=>C,calcTextHorizontalShift:()=>b,clearRect:()=>p,createBoundCanvas:()=>v,createDisconnectedCanvas:()=>g,createDisconnectedCanvasByRenderingInfo:()=>f,disableSelection:()=>w,drawScaled:()=>m,drawWithExclusionAreaByScope:()=>P,fillRect:()=>_,getBindingRenderingInfo:()=>h,getContext2D:()=>d,getPrescaledContext2D:()=>u,measureText:()=>M,tryApplySuggestedCanvasBitmapSize:()=>S});var s=i(27714),o=i(50151),n=i(59239),r=i(57658),a=i(24640),l=i(49483);function c(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function h(e){return{...c(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function d(e){const t=(0,o.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function u(e){const t=(0,o.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function _(e,t,i,s,o,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function p(e,t,i,s,o,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function m(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function g(e,t,i){const s=y(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function f(e,t){const{bitmapSize:i,mediaSize:s}=t,o=y(e);return o.style.width=`${s.width}px`,o.style.height=`${s.height}px`,o.width=i.width,o.height=i.height,o}function y(e){const t=e.createElement("canvas");return w(t),t}function v(e,t){const i=y((0,o.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 S(e){const t=e.suggestedBitmapSize
+;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function b(e,t){return"center"===e.textAlign?0:(0,a.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function w(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function C(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:o,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e{"use strict";i.d(t,{ChartChangesWatcher:()=>a,changedAll:()=>r});var s,o=i(67455),n=i(48096);!function(e){e[e.NothingChanged=0]="NothingChanged",e[e.ContentChanged=1]="ContentChanged",e[e.LineToolsChanged=2]="LineToolsChanged"}(s||(s={}));const r=3;class a{constructor(e,t,i){this._undoHistoryHasChanges=!1,this._changesMask=0,this._handleLayoutNameChanged=()=>{this._changesMask=1|this._changesMask},this._recalculateHaveChanges=()=>{const e=this._changesMask,t=this._undoHistoryHasChanges?1:0,i=this._lineToolsHaveChanges.value()?2:0;this._changesMask=t|i,e!==this._changesMask&&this._onValueChanged.fire(0!==this._changesMask)},this._chartWidgetCollection=e,this._undoHistory=e.undoHistory,this._lineToolsHaveChanges=e.lineToolsSynchronizerHasChanges,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new n.Delegate,this._hasChangesWV=(0,o.createWVFromGetterAndSubscription)((()=>this.hasChanges()),this.getOnChange()),this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy(),this._hasChangesWV.destroy()}changes(){return this._changesMask}hasChanges(){return this._changesMask>0}hasChangesWV(){return this._hasChangesWV}getOnChange(){return this._onValueChanged}_subscribe(){this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.subscribe("layout_loaded",this._handleLayoutLoaded,this),this._globalEvents.subscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.subscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().subscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.subscribe(this._handleLayoutNameChanged)}_unsubscribe(){this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),
+this._globalEvents.unsubscribe("layout_loaded",this._handleLayoutLoaded,this),this._globalEvents.unsubscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.unsubscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.unsubscribe(this._handleLayoutNameChanged)}_setUndoHistoryHasChanges(e){this._undoHistoryHasChanges=e,this._recalculateHaveChanges()}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleLayoutLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){e?.affectsState()&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1)}}},57340:(e,t,i)=>{"use strict";i.d(t,{chartFloatingTooltipEnabledWV:()=>a});var s=i(1765),o=i(22613);const n="chart_floating_tooltip_enabled";function r(){return s.getJSON(n,true)}const a=new o.WatchedValue(r());a.subscribe((()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},75579:(e,t,i)=>{"use strict";i.d(t,{ChartHotkeysListener:()=>g,globalEnvironmentState:()=>m,modifierPressed:()=>p,shiftPressed:()=>_});var s=i(26709),o=i(68335),n=i(35749),r=i(26610);var a=i(22613),l=i(93946);const c=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Shift)),h=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Mod)),d=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Alt)),u=[o.Modifiers.None,o.Modifiers.Alt,o.Modifiers.Mod,o.Modifiers.Alt+o.Modifiers.Shift];function _(){return c}function p(){return h}function m(){return new l.EnvironmentState({altKey:d.value(),ctrlKey:p().value(),metaKey:p().value(),shiftKey:_().value()})}s.pressedKeys.subscribe(((e=0)=>{c.setValue(Boolean(e&o.Modifiers.Shift)),h.setValue(Boolean(e&o.Modifiers.Mod)),d.setValue(Boolean(e&o.Modifiers.Alt))}));class g{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){
+this._chartWidget.hasModel()&&this._chartWidget.isActive().value()&&(e.defaultPrevented||("text-editor"===window.document.activeElement?.getAttribute("data-name")&&this._handleTabKeyDown(e)||window.document.activeElement===window.document.body&&(this._handleMoveDrawingsKeyDown(e)||this._handleScrollKeyDown(e)||this._handleZoomKeyDown(e)))&&e.preventDefault())}_keyupHandler(e){this._chartWidget.hasModel()&&this._handleScrollKeyUp(e)}_handleTabKeyDown(e){const t=255&(0,o.hashFromEvent)(e),i=this._chartWidget.model();if(9===t){const t=i.selection().dataSources()[0];if(void 0!==t&&(s=t,(0,r.isLineTool)(s)&&"LineToolTable"===s.state().type)){const i=(0,o.modifiersFromEvent)(e);return t.switchActiveCell(i===o.Modifiers.Shift)}return!1}var s;return!1}_handleMoveDrawingsKeyDown(e){const t=255&(0,o.hashFromEvent)(e),i=this._chartWidget.model();switch(t){case 37:return i.moveSelectedToolsLeft();case 39:return i.moveSelectedToolsRight();case 38:return i.moveSelectedToolsUp();case 40:return i.moveSelectedToolsDown()}return!1}_handleScrollKeyDown(e){if(null!==this._pressedKeyCode)return!1;const t=(0,o.hashFromEvent)(e),i=255&t,s=(0,o.modifiersFromEvent)(e);let r;if(37===i)r=1;else{if(39!==i)return!1;r=-1}if(o.isMacKeyboard&&s===o.Modifiers.Mod||!u.includes(s))return!1;if((0,n.isNativeUIInteraction)(t,e.target))return!1;this._pressedKeyCode=i;const a=this._chartWidget.scrollHelper();return s===o.Modifiers.None?a.moveByBar(r):s===o.Modifiers.Alt||s===o.Modifiers.Mod?a.move(r):-1===r?a.scrollToRealtime(!0):a.scrollToFirstBar(),!0}_handleScrollKeyUp(e){if(null===this._pressedKeyCode)return!1;const t=(0,o.hashFromEvent)(e);if((0,n.isNativeUIInteraction)(t,e.target))return!1;return(255&t)===this._pressedKeyCode&&(this._pressedKeyCode=null,this._chartWidget.scrollHelper().stopMove(),!0)}_handleZoomKeyDown(e){const t=(0,o.hashFromEvent)(e),i=255&t;if((0,o.modifiersFromEvent)(e)!==o.Modifiers.Mod||(0,n.isNativeUIInteraction)(t,e.target))return!1;const s=this._chartWidget.model();if(38===i)s.zoomIn();else{if(40!==i)return!1;s.zoomOut()}return!0}}},64236:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>l});var s=i(50151),o=i(32955),n=i(37103);const r=n.enabled("end_of_period_timescale_marks"),a=n.enabled("secondary_series_extend_time_scale");function l(e,t,i){return new h(function(e,t){const i=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,t);let s=c.get(i);void 0===s&&(s=(0,o.createDwmAligner)(e,t),c.set(i,s));return s}(e,t),i)}const c=new Map;class h{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;let i=r?function(e,t){const i=e.indexToUserTime(t);if(null===i)return null;return i.getTime()/1e3
+}(t,e):this.convertTimePointIndexToInternalTime(e);if(null!==i){const t=this._chartModel.mainSeries().bars(),s=t.contains(e),o=t.firstIndex(),n=t.lastIndex();!s&&(null!==o&&null!==n&&o<=e&&e<=n)&&a||(i=this.convertInternalTimeToPublicTime(i))}return i}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;const i=t.points(),{firstIndex:o,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let r=null;if(o<=e&&e<=n)r=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const o=(0,s.ensureNotNull)(t.indexToTimePoint(n));r=i.projectTime(o,e-n)}}return r}}},84617:(e,t,i)=>{"use strict";i.d(t,{CHART_FONT_FAMILY:()=>n,setChartFontFamily:()=>o});const s="'Trebuchet MS', Roboto, Ubuntu, sans-serif";function o(e){n=e}let n=`-apple-system, BlinkMacSystemFont, ${s}`},31269:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,o=i(12217),n=i(41706),r=i(87713);!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},r={menuName:""},c){null!==t&&(e=await t(e,l,r));let d=null;const u=()=>{const e=(0,o.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let _=!1;if(null!==s&&(d=await s(e,r,u)),d)_=!0,h();else{const t=await Promise.all([i.e(4109),i.e(1681),i.e(6032),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(1667),i.e(3290),i.e(2227),i.e(3179),i.e(6376),i.e(1584)]).then(i.bind(i,14474));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:_}),d}function h(){(0,r.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,o){return c(e,i,s,o).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{deleteLockedLineToolsProperty:()=>c});var s=i(1765),o=i(41072),n=i(5734);const r="delete_locked_linetools",a="toggle_delete_locked_linetools";function l(){const e=s.getBool(r,!0)&&s.getBool(n.doNotShowDeleteLockedLineKey,!1),t=s.getBool(a,e);return s.remove(r),s.setValue(a,t),t}const c=(0,o.createPrimitiveProperty)(l());c.subscribe(null,(()=>s.setValue(a,c.value()))),s.onSync.subscribe(null,(()=>c.setValue(l())))},5734:(e,t,i)=>{"use strict";i.d(t,{doNotShowDeleteLockedLineConfirmProperty:()=>a,doNotShowDeleteLockedLineKey:()=>n});var s=i(1765),o=i(41072);const n="do_not_show_delete_locked_line_confirm";function r(){return s.getBool(n,!1)}const a=(0,o.createPrimitiveProperty)(r());a.subscribe(null,(()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},38414:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>o});var s=i(22613);class o{constructor(){
+this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1),this._rootInstance=null}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},70002:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.alerts="Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},69455:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>r});var s=i(9753);let o=null,n=null;function r(){return n}function a(){null===n&&(n=Promise.all([i.e(7617),i.e(8185),i.e(1681),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(7827),i.e(8220),i.e(9590),i.e(1667),i.e(9836),i.e(3290),i.e(6178),i.e(7777),i.e(2227),i.e(3179),i.e(1890),i.e(6193),i.e(6376),i.e(2306)]).then(i.bind(i,63027)).then((({FavoriteDrawingToolbar:e})=>(o=null!==o?o:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),o))))}},59239:(e,t,i)=>{"use strict";function s(e){return Math.max(1,e.ownerDocument?.defaultView?.devicePixelRatio||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},96708:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>r});const s=["Z","Y","X","W","V","U","T","S"],o=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function r(e,t){const i="left"===e?s:o,r=t{"use strict";i.d(t,{getTranslatedInputTitle:()=>n});var s=i(11542);const o={PercentageLTP:"Percentage LTP",Labels:"Pane labels",LineFills:"Line fills"};function n(e){return s.t(o[e]??e,{context:"input"},i(32856))}},60709:(e,t,i)=>{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>n,chartWidgetCollectionService:()=>r});var s,o=i(16216);!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(s||(s={}));const n={id:"ChartWidgetCollectionService"};function r(){return(0,o.hasService)(n)?(0,o.service)(n):null}},51304:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>l,defaultInvalidationLevel:()=>r});var s,o=i(50151);class n{constructor(e=r){this._paneInvalidationLevel=r,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,o=s.get(t)||r;s.set(t,Math.max(o,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)||r,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)||r;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||r;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 r=s.None;var a;!function(e){e[e.ScrollAnimation=0]="ScrollAnimation",e[e.StopAnimation=1]="StopAnimation"}(a||(a={}));class l{constructor(e=r){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeScaleInvalidation={level:r,animations:[],invalidateStubs:!1},this._invalidatedPanes=new Map,this._additionalActions=[],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,o.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,o.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e,t=!1){this._timeScaleInvalidation.level=Math.max(this._timeScaleInvalidation.level,e),this._timeScaleInvalidation.invalidateStubs=this._timeScaleInvalidation.invalidateStubs||t}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)}invalidationForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidationForTimeScale(){return{...this._timeScaleInvalidation,level:Math.max(this._timeScaleInvalidation.level,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,o.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeScaleInvalidation.level=Math.max(this._timeScaleInvalidation.level,e._timeScaleInvalidation.level),this._timeScaleInvalidation.invalidateStubs=this._timeScaleInvalidation.invalidateStubs||e._timeScaleInvalidation.invalidateStubs;for(let t=0;t0===e.type));if(-1!==e){const[t]=this._timeScaleInvalidation.animations.splice(e,1);t.value.onFinish?.(!1)}}}},39612:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>o,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(49483).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function o(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},62548:(e,t,i)=>{"use strict";i.d(t,{layoutInitialSizingState:()=>o});var s=i(69708);i(50151);function o(e){const[,...t]=e;return function(e){const t=1/e.length;return e.map((e=>({percent:t,substate:(0,s.default)(e)?void 0:o(e)})))}(t)}},3354:(e,t,i)=>{"use strict";i.d(t,{isMultipleLayout:()=>r,isSupportedLayout:()=>a,layouts:()=>o,tryGuessingTheMostSuitableLayout:()=>l});i(26743),i(62548);let s;s={};const o={...{s:{title:"1 chart",
+count:1,layoutType:"s",sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e},splitters:()=>[],resizeApplier:(e,t,i,s,o)=>o,syncSublayoutsBySplitter:(e,t)=>t,expression:["h",0]}},...s};function n(e){return"s"===e}function r(e){return!n(e)}function a(e){return n(e)||s.hasOwnProperty(e)}function l(e){return"s"}},81360:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>o});i(40167);var s=i(68335);const o={LineToolFibRetracement:{hash:s.Modifiers.Alt+70,action:"setTool",description:"Draw Fib Retracement"},LineToolHorzLine:{hash:s.Modifiers.Alt+72,action:"drawRightThere",description:"Draw Horizontal Line here"},LineToolHorzRay:{hash:s.Modifiers.Alt+74,action:"drawRightThere",description:"Draw Horizontal Ray here"},LineToolRectangle:{hash:s.Modifiers.Alt+s.Modifiers.Shift+82,action:"setTool",description:"Draw Rectangle"},LineToolTrendLine:{hash:s.Modifiers.Alt+84,action:"setTool",description:"Draw Trend Line"},LineToolVertLine:{hash:s.Modifiers.Alt+86,action:"drawRightThere",description:"Draw Vertical Line here"},LineToolCrossLine:{hash:s.Modifiers.Alt+67,action:"drawRightThere",description:"Draw Cross Line here"}}},62153:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>f,defaultPreventedHandler:()=>m,getClickPosition:()=>_,isTouchMouseEvent:()=>p});var s=i(81251),o=i(50151),n=i(87465),r=i(49483),a=i(80007),l=i(39612);const c=r.isSafari?"click":"auxclick";var h,d;!function(e){e[e.ResetClick=500]="ResetClick",e[e.LongTap=333]="LongTap",e[e.PreventFiresTouchEvents=500]="PreventFiresTouchEvents"}(h||(h={})),function(e){e[e.CancelClickManhattanDistance=5]="CancelClickManhattanDistance",e[e.CancelTapManhattanDistance=5]="CancelTapManhattanDistance",e[e.DoubleClickManhattanDistance=5]="DoubleClickManhattanDistance",e[e.DoubleTapManhattanDistance=30]="DoubleTapManhattanDistance"}(d||(d={}));const u={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function _(e){if(p(e))return{x:e.clientX,y:e.clientY};if("touches"in(t=e)&&void 0!==t.touches){if(1===e.touches.length){const t=(0,o.ensureNotNull)(e.target).getBoundingClientRect(),i=e.touches[0];return{x:i.clientX-t.left,y:i.clientY-t.top}}return null}var t;return{x:e.offsetX,y:e.offsetY}}function p(e){return"isTouch"in e&&"stylus"in e}function m(e){return t=>{t.preventDefault(),e(t)}}function g(e,t){let i=!1;return{clickOrTap:(...s)=>{t?.()?e.clickOrTap(...s):(i=!1,setTimeout((()=>!i&&e.clickOrTap(...s)),501))},doubleClickOrDoubleTap:(...t)=>{i=!0,e.doubleClickOrDoubleTap?.(...t)}}}class f{constructor(e,t,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,
+this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._unsubscribePinchEvents=null,this._unsubscribeTargetElementEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!r.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,n.merge)((0,n.clone)(u),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){if(t.mouseClickEvent&&t.mouseDoubleClickEvent){const e=g({clickOrTap:t.mouseClickEvent.bind(t),doubleClickOrDoubleTap:t.mouseDoubleClickEvent.bind(t)});t.mouseClickEvent=e.clickOrTap,t.mouseDoubleClickEvent=e.doubleClickOrDoubleTap}if(t.tapEvent&&t.doubleTapEvent){const e=g({clickOrTap:t.tapEvent.bind(t),doubleClickOrDoubleTap:t.doubleTapEvent.bind(t)});t.tapEvent=e.clickOrTap,t.doubleTapEvent=e.doubleClickOrDoubleTap}}this._handlers=t,this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),null!==this._unsubscribePinchEvents&&(this._unsubscribePinchEvents(),this._unsubscribePinchEvents=null),null!==this._unsubscribeTargetElementEvents&&(this._unsubscribeTargetElementEvents(),this._unsubscribeTargetElementEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e)
+;this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=w(e.changedTouches,(0,o.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=b(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(v(t),(0,o.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:r}=i;if(this._touchMoveExceededManhattanDistance||!(r<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=this._options.shouldAllowTouchDrag?.()??!1,i=n>=e&&(!this._options.treatVertTouchDragAsPageScroll||t),o=e>n&&(!this._options.treatHorzTouchDragAsPageScroll||t);i||o||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,a.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(v(e),(0,o.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=w(e.changedTouches,(0,o.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=b(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(v(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,a.preventDefault)(e));0===this._tapCount&&(0,a.preventDefault)(e),
+0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,a.preventDefault)(e))}_touchCancelHandler(e){this._touchEndHandler(e)}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),r.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=b(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=v(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),333)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handlers.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=v(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;r.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=v(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseDownEvent),
+this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=v(e))}_init(){const e=this._mouseEnterHandler.bind(this);this._target.addEventListener("mouseenter",e);const t=this._touchCancelHandler.bind(this);this._target.addEventListener("touchcancel",t);{const e=this._target.ownerDocument,t=e=>!e.target||!this._target.contains(e.target),i=e=>{if(!t(e))return;const i=e.changedTouches[0];this._lastTouchEventTimeStamp=b(e),this._processTouchEvent(this._makeCompatEvent(e,i),this._handlers.touchStartOutsideEvent)},s=e=>{t(e)&&!this._firesTouchEvents(e)&&this._processMouseEvent(this._makeCompatEvent(e),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",s)},e.addEventListener("mousedown",s),e.addEventListener("touchstart",i,{passive:!0})}r.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick));const i=this._mouseLeaveHandler.bind(this);this._target.addEventListener("mouseleave",i);const s=this._contextMenuHandler.bind(this);this._target.addEventListener("contextmenu",s);const o=this._touchStartHandler.bind(this);let n;this._target.addEventListener("touchstart",o,{passive:!0}),r.isChrome&&(n=e=>{if(1===e.button)return e.preventDefault(),!1},this._target.addEventListener("mousedown",n));const a=this._mouseDownHandler.bind(this);this._target.addEventListener("mousedown",a);const l=this._wheelClickHandler.bind(this);this._target.addEventListener(c,l);const h=()=>{};this._target.addEventListener("touchmove",h,{passive:!1}),this._unsubscribeTargetElementEvents=()=>{this._target.removeEventListener("mouseleave",i),this._target.removeEventListener("contextmenu",s),this._target.removeEventListener("touchstart",o),n&&this._target.removeEventListener("mousedown",n),this._target.removeEventListener("mousedown",a),this._target.removeEventListener(c,l),this._target.removeEventListener("touchmove",h)},this._initPinch()}_initPinch(){if(void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent)return;const e=e=>this._checkPinchState(e.touches);this._target.addEventListener("touchstart",e,{passive:!0});const t=e=>{if(null===this._pinchInfo)return;const t=w(e.touches,(0,o.ensureNotNull)(this._activeTouchId)),i=w(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:o}=this._pinchInfo,n=S(t,i)/s,r=y(this._target);this._handlers.pinchEvent(o,{x:t.clientX-r.left,y:t.clientY-r.top},{x:i.clientX-r.left,y:i.clientY-r.top},n),(0,a.preventDefault)(e)}};this._target.addEventListener("touchmove",t,{passive:!1});const i=e=>this._checkPinchState(e.touches);this._target.addEventListener("touchend",i),this._unsubscribePinchEvents=()=>{
+this._target.removeEventListener("touchstart",e),this._target.removeEventListener("touchmove",t),this._target.addEventListener("touchend",i)}}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const t=y(this._target);let i,s;e[0].identifier===this._activeTouchId?(i=e[0],s=e[1]):(i=e[1],s=e[0]);const o={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top},r={x:(o.x+n.x)/2,y:(o.y+n.y)/2};this._handlers.pinchStartEvent(r,o,n,{bothPointsOnTargetElement:this._target.contains(s.target)})&&(this._pinchInfo={startPinchDistance:S(i,s),startPinchMiddlePoint:r,secondTouchId:s.identifier})}this._clearLongTapTimeout()}_stopPinch(){null!==this._pinchInfo&&(this._pinchInfo=null,this._handlers.pinchEndEvent?.())}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!r.CheckMobile.iOS()}_longTapHandler(e){const t=w(e.touches,(0,o.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,a.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:b(e)this._target.getBoundingClientRect()||{left:0,top:0}));return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,get localX(){return i.clientX-n().left},get localY(){return i.clientY-n().top},ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,buttons:o,isTouch:!e.type.startsWith("mouse")&&"contextmenu"!==e.type&&"click"!==e.type,stylus:"stylus"===t?.touchType,srcType:e.type,target:i.target,view:e.view,preventDefault:()=>{"touchstart"!==e.type&&(0,a.preventDefault)(e)}}}}function y(e){return e.getBoundingClientRect()||{left:0,top:0}}function v(e){return{x:e.pageX,y:e.pageY}}function S(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function b(e){return e.timeStamp||performance.now()}function w(e,t){for(let i=0;i{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>r,navigationButtonsVisibilityKey:()=>o,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(64876);const o="NavigationButtons.visibility",{property:n,availableValues:r,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(o)},61786:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>r,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(64876),o=i(23714);const{property:n,availableValues:r,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",o.navigationButtonsVisibilityKey)},67763:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>o,CommonJsonStoreService:()=>n});var s=i(48096);class o{constructor(e,t,i,o,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=o,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends o{_serialize(e){return e}_deserialize(e){return e}}},68028:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(22613);const o="#9598a1",n=!1,r=null,a='';class l{constructor(e){this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(r),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(o),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},87911:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>c,showMarketOpenStatusProperty:()=>l});var s=i(41072),o=i(1765);const n="Chart.ShowMarketOpenStatus",r=!0
+;function a(){return o.getBool(n,r)}const l=(0,s.createPrimitiveProperty)(a());function c(){l.setValue(r),o.remove(n)}o.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>o.setValue(n,l.value())))},53107:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>u});var s,o=i(50151),n=i(37236),r=i(22613),a=i(48943),l=i(16329),c=i(95059);function h(e){return window.ChartApiInstance.serverTime()/1e3-e}function d(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}!function(e){e.Open="market",e.Pre="pre_market",e.Post="post_market",e.Close="out_of_session",e.Holiday="holiday",e.Delisted="delisted",e.Expired="expired"}(s||(s={}));class u{constructor(e){this._currentSession=new r.WatchedValue(null),this._delistedByTypespecs=new r.WatchedValue(!1),this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new r.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._delay=0,this._futuresContractExpirationTime=null,this._quotesProvider=e;const{current_session:t}=e.quotes()??{};t&&this._currentSession.setValue(t),this._marketStatus=(0,a.combine)(((e,t,i)=>null===e?e:t?"delisted":i?"expired":function(e){switch(e){case"market":return"market";case"pre_market":return"pre_market";case"post_market":return"post_market";case"out_of_session":return"out_of_session";case"holiday":return"holiday"}(0,o.ensureNever)(e)}(e)),this._currentSession.weakReference(),this._delistedByTypespecs.weakReference(),(this._futuresContractExpirationTime?.expired()??new r.WatchedValue(!1)).weakReference()),e.quotesUpdate().subscribe(this,(e=>{this._currentSession.setValue(e?.values.current_session??null)})),e.quoteSymbolChanged().subscribe(this,(()=>{this._currentSession.setValue(null)}))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId),this._marketStatus.destroy()}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);this._delay=(0,c.getSymbolDelaySeconds)(e);const t=new l.SessionsSpec(e.timezone,e.session_display??e.session,e.session_holidays,e.corrections);let i,s;const o=e.subsessions?.find((e=>"premarket"===e.id)),n=e.subsessions?.find((e=>"postmarket"===e.id));void 0!==o&&(i=new l.SessionsSpec(e.timezone,o["session-display"]??o.session,e.session_holidays,o["session-correction"])),void 0!==n&&(s=new l.SessionsSpec(e.timezone,n["session-display"]??n.session,e.session_holidays,n["session-correction"])),this._sessionsSpec={general:t,preMarket:i,postMarket:s},this._recalculateNextSessionEdge()}status(){return this._marketStatus}currentSession(){return this._currentSession}nextSessionEdge(){return this._nextSessionEdge}_getNextSessionEdgeInternal(){if(null===this._sessionsSpec)return null;const e=1e3*h(this._delay);if(null===this._nextSessionEdgeInternal||(this._nextSessionEdgeInternal.timestamp??1/0)<=e/1e3){
+const{general:t,preMarket:i,postMarket:s}=this._sessionsSpec,o=(0,n.get_timezone)(t.timezone()),r=(0,n.utc_to_cal)(o,e),a=d((0,n.cal_to_utc)(o,t.alignToNearestSessionStart(r,1)),(0,n.cal_to_utc)(o,t.alignToNearestSessionEnd(r,1)),e),l=d(void 0!==i?(0,n.cal_to_utc)(o,i.alignToNearestSessionStart(r,1)):1/0,void 0!==i?(0,n.cal_to_utc)(o,i.alignToNearestSessionEnd(r,1)):1/0,e),c=d(void 0!==s?(0,n.cal_to_utc)(o,s.alignToNearestSessionStart(r,1)):1/0,void 0!==s?(0,n.cal_to_utc)(o,s.alignToNearestSessionEnd(r,1)):1/0,e);let u=Math.min(a,l,c);if(u===1/0){const e=h(this._delay),i=6e4,s=new Date(Math.round(new Date(1e3*e).getTime()/i)*i).getTime()+i,r=(0,n.utc_to_cal)(o,s),a=d((0,n.cal_to_utc)(o,t.alignToNearestSessionStart(r,1)),(0,n.cal_to_utc)(o,t.alignToNearestSessionEnd(r,1)),s),_=Math.min(a,l,c);_!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=_):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===c?{timestamp:u,status:"post_market"}:u===l?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-h(this._delay))};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},50888:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>l,firstReplacedByBatsExchange:()=>c,isAmexToCboeMigratedSymbol:()=>_,isDelay:()=>d,isEod:()=>h,witoutRealtime:()=>u});i(50151);var s=i(59149),o=i.n(s);const n=["DJ","JSE","BELEX"],r=["NZX"],a=["BIVA"],l=["AMEX","NASDAQ","NYSE"];function c(e){return null}function h(e,t){return o().hasEodSymbols(e.full_name)||6===t}function d(e){return void 0!==e&&e>0}function u(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&r.includes(e.listed_exchange)||a.includes(e.listed_exchange)}function _(e,t){return"amex"===t&&"CBOE"===e}},18041:(e,t,i)=>{"use strict";i.d(t,{getStudyTemplateDescString:()=>r,getStudyTemplateMetaInfo:()=>o,getStudyTemplateSaveData:()=>n});var s=i(36313);function o(e,t){return{indicators:e.allStudies(!0).map((e=>({id:e.metaInfo().id,description:e.title(s.TitleDisplayTarget.StatusLine,!0,void 0,!0)}))),interval:t}}function n(e,t,i,s){const n=t.studyTemplate(i,s);return{name:e,content:JSON.stringify(n),meta_info:o(t,n.interval)}}function r(e){const t=new Map;return e.forEach((e=>{const[i,s]=t.get(e.id)||[e.description,0];t.set(e.id,[i,s+1])})),Array.from(t.values()).map((([e,t])=>`${e}${t>1?` x ${t}`:""}`)).join(", ")}},4745:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>o,globalKeypressMatches:()=>n});var s=i(37103);function o(){let e=!1
+;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},8686:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(8836),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(3672),i.e(3359),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(445),i.e(846),i.e(2227),i.e(4931),i.e(9418),i.e(3179),i.e(4426),i.e(2475),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},49470:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const o={id:"TradingService"};function n(){return(0,s.hasService)(o)?(0,s.service)(o):null}},28477:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const o of this._backColorers)o.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},33718:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>p,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(26709),o=i(37103),n=i(1765),r=i(41072),a=i(22613);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return o.enabled("chart_crosshair_menu")}function _(){return n.getBool(l,u())}const p=(0,r.createPrimitiveProperty)(_());function m(){p.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>p.setValue(_()))),p.subscribe(null,(()=>{n.setValue(l,p.value()),o.setEnabled("chart_crosshair_menu",!o.enabled("chart_crosshair_menu"))}))},62301:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),o=i.n(s);function n(e,t){return o()(e).div(t).round(0,o().roundHalfUp).mul(t).toNumber()}},25246:(e,t,i)=>{"use strict";i.d(t,{actualAutoLogButtonsVisibility:()=>l,autoLogButtonsVisibilityOptions:()=>r,autoLogButtonsVisibilityProperty:()=>n,restoreAutoLogButtonsVisibilitySettingsValue:()=>a});var s,o=i(64876);!function(e){e.SettingsKey="PriceAxisAutoLogButtons.visibility"}(s||(s={}));const{property:n,availableValues:r,restoreDefaultValue:a,actualBehavior:l}=(0,o.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},72755:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>o});var s=i(58978);const o={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]};var n;!function(e){e.BorderColor="#2E84A6"}(n||(n={}))},32955:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>h,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>c});var s=i(37236),o=i(10892),n=i(47312),r=i(51101)
+;const a=new n.SessionInfo("Etc/UTC","0000-0000:1234567");var l=i(37103);function c(){return!l.enabled("disable_resolution_rebuild")}const h=function(e,t,i){if(!e||!o.Interval.isDWM(t))return null;const l=new n.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),c=(0,r.newBarBuilder)(t,l,a);return{timeToSessionStart:e=>c.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=(0,s.utc_to_cal)(l.timezone,e),i=l.spec.correctTradingDay(t);return(0,s.set_hms)(i,0,0,0,0,(0,s.get_timezone)("Etc/UTC")),i.getTime()}}}.bind(null,c()),d=function(e,t,i){if(!e)return e=>e;const s=new n.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),o=(0,r.newBarBuilder)(t,s,s,!1);return e=>o.alignTimeIfPossible(e)}.bind(null,c())},17776:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>o});var s=i(52746);function o(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 18:case 20:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(t??"close");default:return(0,s.barFunction)("close","open")}}},28001:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>o});var s=i(50151);class o{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}unite(e){return null===e?this:new o(Math.min(this._firstBar,e.firstBar()),Math.max(this._lastBar,e.lastBar()))}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},54370:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>o});var s=i(37103);function o(){return function(){const e=[0,1,9,13,2,14,15,3,16,10];return s.enabled("chart_style_hilo")&&e.push(12),e.push(21),e}().concat((s.enabled("japanese_chart_styles"),[8]))}},32853:(e,t,i)=>{"use strict";var s=i(49251).makeFont,o=i(49251).parseFont,n=i(9343).getLogger;const{drawPoly:r}=i(58221);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 o=100*(1-s.a);i.setValue(Math.max(0,Math.min(o,100)))},getFontFromProperties:function(e,t,i,o){return s(t.value(),e.value(),o.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){var r=o(e);null!==r?(r.family.length>0&&t.setValue(r.family),
+i.setValue(r.size),s.setValue(r.bold),n.setValue(r.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)",r(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",r(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},93201:(e,t,i)=>{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},55803:(e,t,i)=>{"use strict";i.d(t,{ConflatedChunksBuilder:()=>r});var s=i(50151),o=i(12217);const n=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,forBarspacingLargerThen:0}];class r{constructor(e,t){this._plots=e,this._state={chunks:new Map,priceSource:null,priceSourcesProvider:t},this._setEmptyConflatedChunks()}conflatedChunks(e,t){if(t!==this._state.priceSource){this._state.priceSource=t;const e=this._plots.first();e&&(this._setEmptyConflatedChunks(),this._rebuildConflatedChunks(e))}const i=(0,s.ensureDefined)(n.find((t=>t.forBarspacingLargerThen<=e)));return(0,s.ensureDefined)(this._state.chunks.get(i.barsToMerge))}mergeData(e){const t=this._plots.size(),i=this._plots.merge(e);return i&&null!==this._state.priceSource&&(t===this._plots.size()&&i.index===this._plots.lastIndex()?this._updateLatestChunks():this._rebuildConflatedChunks(i)),i}moveData(e){this._plots.move(e),this._plots.size()>0&&this._clearState()}clearData(){this._plots.clear(),this._clearState()}_rebuildConflatedChunks(e){const t=this._state.priceSource;if(null===t)return;const i=e.index,r=this._state.priceSourcesProvider(t),a=(e,t,i)=>{let s=null;for(const o of e){const e=r(o.value);s&&o.index-s.startTime>=i.barsToMerge&&(t.push(s),s=null),s?(s.endTime=o.index,s.high=Math.max(s.high,e),s.low=Math.min(s.low,e),s.close=e):s={startTime:o.index,endTime:o.index,open:e,high:e,low:e,close:e}}s&&t.push(s)};n.forEach((e=>{const t=(0,s.ensureDefined)(this._state.chunks.get(e.barsToMerge)),n=(0,o.lowerbound)(t,i,((e,t)=>e.endTime0){const i=t[0].startTime-1,o=(0,s.ensureNotNull)(this._plots.firstIndex()),n=this._plots.rangeIterator(o,i),r=[];a(n,r,e);const l=r.concat(t);this._state.chunks.set(e.barsToMerge,l)}else{const i=(0,s.ensureNotNull)(this._plots.lastIndex());t.splice(n);let o=(0,s.ensureNotNull)(this._plots.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const r=this._plots.rangeIterator(o,i);a(r,t,e)}}))}_updateLatestChunks(){const e=(0,s.ensureNotNull)(this._plots.last()),t=this._state.priceSourcesProvider("close");n.forEach((i=>{const o=(0,
+s.ensureDefined)(this._state.chunks.get(i.barsToMerge)),n=t(e.value),r=o[o.length-1];r.high=Math.max(r.high,n),r.low=Math.min(r.low,n),r.close=n,r.endTime=e.index}))}_setEmptyConflatedChunks(){n.forEach((e=>this._state.chunks.set(e.barsToMerge,[])))}_clearState(){this._state.chunks.clear(),this._state.priceSource=null}}},91106:(e,t,i)=>{"use strict";i.d(t,{actualCurrencyUnitVisibility:()=>c,currencyUnitVisibilityOptions:()=>a,currencyUnitVisibilityProperty:()=>r,migrateShowCurrencyAndShowUnitProperties:()=>d,restoreCurrencyUnitVisibilitySettingsValue:()=>l});var s,o=i(64876),n=i(1765);!function(e){e.SettingsKey="PriceAxisCurrencyAndUnit.visibility"}(s||(s={}));const{property:r,availableValues:a,restoreDefaultValue:l,actualBehavior:c}=(0,o.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let h=!1;function d(e,t){h||(h=!0,void 0===n.default.getValue("PriceAxisCurrencyAndUnit.visibility")&&r().setValue(e||t?"alwaysOn":"alwaysOff"))}},66786:(e,t,i)=>{"use strict";i.d(t,{CustomSourceBase:()=>s});class s{constructor(e,t){this._id=e,this._model=t}id(){return this._id}isHoveredEnabled(){return!0}isSelectionEnabled(){return!1}priceScale(){return null}paneViews(e){return[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateViewsForPane(e,t){e.containsMainSeries()&&this.updateAllViews(t)}}},29447:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>r,isMainSeriesState:()=>o,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(11946);function o(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function r(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return Boolean(e.type)&&(0,s.isStudyLineToolName)(e.type)}},72207:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>d,getTranslatedStringForSource:()=>c,toInputDisplayFlags:()=>h});var s=i(95804),o=i(36313),n=i(4226),r=i(48096),a=i(22613),l=i(69422);function c(e,t){return new s.TranslatedString(t.name(),t.title(e))}function h(e){switch(e){case o.TitleDisplayTarget.DataWindow:return l.InputDisplayFlags.DataWindow;case o.TitleDisplayTarget.StatusLine:case o.TitleDisplayTarget.Alerts:return l.InputDisplayFlags.StatusLine}}class d{constructor(e){this.isSeries=!1,this._isDestroyed=!1,this._hasAlert=new a.WatchedValue(!1),this._alertStatus=new a.WatchedValue(0),this._alertCreationAvailable=new a.WatchedValue(!1),this._zorder=0,this._priceScale=null,this._ownerSource=null,this._userEditEnabled=!0,this._priceScaleChanged=new r.Delegate,this._isSelectionEnabled=!0,this._instanceId=(0,n.randomHashN)(6),this._ownerSourceChanged=new r.Delegate,this._zOrderChanged=new r.Delegate,this._id=new a.WatchedValue(e??(0,n.randomHashN)(6))}destroy(){this._isDestroyed=!0}id(){return this._id.value()}idWV(){return this._id.readonly()}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id.setValue(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}hasPriceScale(){return null!==this._priceScale}setPriceScale(e){this._priceScale!==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}propertyByPath(e){const t=e.split(".");if(t.length<1)throw new Error("Invalid path");const i=t[0];if("properties"===i){const e=this.properties();return 1===t.length?e:e.childByPath(t.slice(1).join("."))}throw new Error(`Unknown property root: ${i}`)}isVisible(){return this.properties().visible.value()}dataWindowView(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(e){}paneViews(e){return null}labelPaneViews(e){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(e,t){}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}allowsMovingBetweenPanes(){return!0}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,i){return null}autoScaleInfo(e,t,i){return{range:this.priceRange(e,t,i)}}stateForAlert(){return null}async stateForAlertAsync(){return this.stateForAlert()}canHasAlert(){return!1}canHasAlertOnLineTools(){return!1}hasAlert(){return this._hasAlert.readonly()}alertCreationAvailable(){return this._alertCreationAvailable.readonly()}hasStateForAlert(){return!1}idForAlert(){return this._id.value()}alertStatus(){return this._alertStatus.readonly()}_getAlertCreationAvailable(){return!1}_updateAlertCreationAvailable(){0}}},40137:(e,t,i)=>{"use strict";i.d(t,{DataWindowItem:()=>s,DataWindowView:()=>o});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 o{constructor(){this._items=[],
+this._header="",this._title=""}header(){return this._header}title(){return this._title}items(){return this._items}canShowItems(){return!0}update(e){}}},97363:(e,t,i)=>{"use strict";i.d(t,{dateFormatProperty:()=>l,restoreDateFormatSettingsValue:()=>c});var s=i(1765),o=i(41072),n=i(10718);const r="date_format";function a(){return s.getValue(r,(0,n.defaultDateFormat)())}const l=(0,o.createPrimitiveProperty)(a());function c(){l.setValue((0,n.defaultDateFormat)()),s.remove(r)}s.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>s.setValue(r,l.value())))},78176:(e,t,i)=>{"use strict";i.d(t,{DefaultProperty:()=>F,allowSavingDefaults:()=>A,cleanUpStateKeys:()=>x,createDefaultsState:()=>M,extractAllPropertiesKeys:()=>L,extractState:()=>E,extractThemedColors:()=>D});var s=i(90054),o=i(16738),n=i(81960),r=i(54029),a=i(47339),l=i(28569),c=i(50279),h=i(15943),d=i(82433),u=i(83873),_=i(50151),p=i(24377),m=i(9343),g=i(29970),f=i(24633),y=i(45345),v=i(22489),S=i(48096),b=i(55114),w=i(60973),C=i(43337);const T=(0,m.getLogger)("ThemedDefaults");function P(e){return e.value()===f.StdTheme.Dark?f.StdTheme.Dark:f.StdTheme.Light}function x(e,t,i){for(const s of t)if((0,n.default)(e,s),i){const t=s.split(".");for(t.pop();t.length;){const i=(0,r.default)(e,t);if(!(0,d.default)(i)||0!==Object.keys(i).length)break;(0,n.default)(e,t),t.pop()}}}function M(e,t,i,n){const r=e?w.defaults:w.factoryDefaults,a=t.startsWith("study_")?(0,s.default)(r("study")):{};let l=(0,s.default)(r(t,n));return t.startsWith("study_")&&l.inputs&&delete l.inputs.symbol,"linetoolicon"===t&&e&&(l.icon=(0,w.defaults)(t).icon),"linetooemoji"===t&&e&&(l.emoji=(0,w.defaults)(t).emoji),"linetoolsticker"===t&&e&&(l.sticker=(0,w.defaults)(t).sticker),l=(0,s.default)(l),x(l,i),(0,o.default)(a,l),a}let I=!1;function A(e){I=e}function L(e){const t=Object.keys(e),i=[];return t.forEach((t=>{const s=e[t];if((0,d.default)(s)){L(s).forEach((e=>i.push(`${t}.${e}`)))}else i.push(t)})),i}function k(e,t,i=""){if(1===t.length&&"*"===t[0])return e;const s={};for(const o of t){const n=o.split("."),r=n[0],a=e[r],l=""===i?r:`${i}.${r}`;if(e.hasOwnProperty(r))if(n.length>1){if(!(0,d.default)(a)){T.logError(`path ${l} must be an object, but it is a primitive`);continue}{const e=t.filter((e=>e.startsWith(`${r}.`))).map((e=>e.split(".").slice(1).join(".")));s[r]=k(a,e,l)}}else{if((0,d.default)(a)){T.logError(`path ${l} must be a primitive, but it is an object`);continue}s[r]=a}}return s}function E(e,t,i){if(!e)return{};let s=e;return t&&(s=k(e,t)),i&&x(s,i,!0),s}function D(e,t){const i=L(e),s=[];for(const o of i){const i=(0,r.default)(e,o),n=(0,r.default)(t,o);(0,_.assert)(void 0!==i,`Light theme value for ${o} is undefined`),(0,_.assert)(void 0!==n,`Dark theme value for ${o} is undefined`),s.push({path:o,colors:[i,n]})}return s}function B(e,t){e.includes(t)||e.push(t)}function V(e,t){const i=e.indexOf(t);-1!==i&&e.splice(i,1)}function R(e,t){const i=(0,l.default)(e,((e,i,s)=>{if(void 0===t[s])return e;if(!(0,c.default)(i,t[s]))if((0,d.default)(i)&&(0,d.default)(t[s])){
+const o=R(i,t[s]);void 0!==o&&(e[s]=o)}else e[s]=i;return e}),{});return(0,h.default)(i)?void 0:i}function N(e){return e===f.StdTheme.Dark?1:0}function O(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(!(0,u.default)(e)||!(0,u.default)(t))return!1;const i=(0,p.tryParseRgba)(e),s=(0,p.tryParseRgba)(t);return!(!i||!s)&&!!(0,g.colorsAreCloseEnough)(e,t)}class F extends C.Property{constructor(e){const{defaultName:t,nonThemedDefaultsKeys:i,themedDefaultsKeys:s,excludedDefaultsKeys:n=[],themedColors:r,replaceThemedColorsOnThemeChange:a=!1,allStateKeys:l,excludedStateKeys:c=[],excludedTemplateKeys:h=[],state:d,useUserPreferences:u=!0,saveNonDefaultUserPreferencesOnly:p=!1,ignoreAllowSavingDefaults:m=!1,alwaysSaveDefaultKeys:g=["version"],saveDefaultsConsumer:C=w.saveDefaults,factoryDefaultsSupplier:T=()=>M(!1,t,[],null),schema:x=(0,b.createPropertySchema)(T()),theme:I=y.watchedTheme.spawnOwnership()}=e;super(void 0,x),this._themedColors=[],this._restoreFactoryDefaultsEvent=new S.Delegate,this._replaceThemedColorsOnThemeChange=!1,this._forbidSavingDefaults=!1,this._defaultName=t,this._useUserPreferences=u,this._saveNonDefaultUserPreferencesOnly=p,this._ignoreAllowSavingDefaults=m,this._saveDefaultsConsumer=C,this._factoryDefaultsSupplier=T,this._allStateKeys=l,this._excludedStateKeys=c,this._nonThemedDefaultsKeys=i,this._themedDefaultsKeys=s,this._allDefaultsKeys=i||s?[...i??[],...s??[]]:void 0,this._excludedDefaultsKeys=n,this._excludedTemplateKeys=h,this._themedColors=r,this._alwaysSaveDefaultKeys=g,(0,_.assert)(void 0===this._allDefaultsKeys||0===this._excludedDefaultsKeys.length,"Defaults keys and excluded defaults keys cannot be used at the same time"),(0,_.assert)(void 0===this._allStateKeys||0===this._excludedStateKeys.length,"State keys and excluded state keys cannot be used at the same time"),this._theme=I;const A=P(this._theme);this.merge((0,o.default)(this._factoryDefaultsForTheme((0,v.isStdThemeName)(A)?A:f.StdTheme.Light),this._userSettings(),E(d,l,c))),r&&a&&this.setThemedColors(r),this._restoreFactoryDefaultsEvent=new S.Delegate}destroy(){this._theme?.release(),this._unsubscribeWatchedTheme?.(),super.destroy()}applyTemplate(e,t){this.mergeAndFire(E((0,o.default)((0,s.default)(t),e),this._allStateKeys,this._excludedTemplateKeys))}preferences(){return E(this.state(this._excludedDefaultsKeys),this._allDefaultsKeys)}template(){return E(this.state(void 0,4),void 0,this._excludedTemplateKeys)}mergePreferences(e){this.mergeAndFire(E(e,this._allDefaultsKeys,this._excludedDefaultsKeys))}addExcludedKey(e,t){1&t&&B(this._excludedDefaultsKeys,e),2&t&&B(this._excludedStateKeys,e),4&t&&B(this._excludedTemplateKeys,e)}removeExcludedKey(e,t){1&t&&V(this._excludedDefaultsKeys,e),2&t&&V(this._excludedStateKeys,e)}restoreFactoryDefaults(){const e=this.factoryDefaults();x(e,this._excludedDefaultsKeys),this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this._saveDefaultsConsumer(this._defaultName),this._restoreFactoryDefaultsEvent.fire()}
+onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}saveDefaults(){if(!this._useUserPreferences||this._forbidSavingDefaults)return;let e;if(this._saveNonDefaultUserPreferencesOnly){const t=this.state(this._excludedDefaultsKeys),i=this.factoryDefaults();if(e=R(E(t,this._nonThemedDefaultsKeys),E(i,this._nonThemedDefaultsKeys,this._excludedDefaultsKeys)),this._alwaysSaveDefaultKeys.length){const i=E(t,this._alwaysSaveDefaultKeys);e=e??{},(0,o.default)(e,i)}const s=this.themeDefaults(P(this._theme)),n=this.themeState(),r=R(n,s);(0,h.default)(r)||(e=e??{},(0,o.default)(e,n))}else e=this.preferences();this._saveDefaultsConsumer(this._defaultName,e)}themeDefaults(e){if(this._themedColors)return function(e,t){const i={};for(const{path:s,colors:o}of e)(0,a.default)(i,s,o[N(t)]);return i}(this._themedColors,e===f.StdTheme.Dark?f.StdTheme.Dark:f.StdTheme.Light);return E(this._factoryDefaultsSupplier(),this._themedDefaultsKeys,this._excludedDefaultsKeys)}factoryDefaults(){return this._factoryDefaultsForTheme(P(this._theme))}themeState(){const e=super.state(this._excludedDefaultsKeys),t=this._themedColors;return E(e,t?t.map((e=>e.path)):this._themedDefaultsKeys)}allThemePropertiesAreDefault(e){(0,_.assert)(!!this._themedColors,"This method should not be called if themed colors are not set");return function(e,t,i=[]){for(const s of i){const i=s.path;if(!O((0,r.default)(e,i),(0,r.default)(t,i)))return!1}return!0}(this.themeState(),this.themeDefaults(e),this._themedColors)}clone(e){return new F(this._options())}setThemedColors(e){if(this._themedColors=e,void 0===this._unsubscribeWatchedTheme){const e=()=>{this._updateThemedColors(!1)};this._theme.subscribe(e),this._unsubscribeWatchedTheme=()=>this._theme.unsubscribe(e)}this._updateThemedColors(!0)}applyDefaultThemedProperties(e){this._themedColors&&this.mergeAndFire(this.themeDefaults(e))}state(e,t){return E(super.state([...this._excludedStateKeys,...e??[]],t),this._allStateKeys)}_updateThemedColors(e){if(!this._themedColors)return;const t=P(this._theme),i=t===f.StdTheme.Light?f.StdTheme.Dark:f.StdTheme.Light;for(const s of this._themedColors){const o=(0,_.ensureDefined)(this.childByPath(s.path)),n=s.colors[N(i)];(""===o.value()||!e&&O(o.value(),n))&&o.setValue(s.colors[N(t)])}}_userSettings(){if(!this._useUserPreferences)return;const e=M(!0,this._defaultName,[],null);if(!e)return;return E((0,b.extractStateWithSchema)(e,this._schema,1),this._allDefaultsKeys,this._excludedDefaultsKeys)}_options(){return{defaultName:this._defaultName,factoryDefaultsSupplier:this._factoryDefaultsSupplier,state:this.state(),nonThemedDefaultsKeys:this._nonThemedDefaultsKeys,themedDefaultsKeys:this._themedDefaultsKeys,excludedDefaultsKeys:this._excludedDefaultsKeys,themedColors:this._themedColors,replaceThemedColorsOnThemeChange:this._replaceThemedColorsOnThemeChange,allStateKeys:this._allStateKeys,excludedStateKeys:this._excludedDefaultsKeys,excludedTemplateKeys:this._excludedTemplateKeys,useUserPreferences:this._useUserPreferences,
+saveNonDefaultUserPreferencesOnly:this._saveNonDefaultUserPreferencesOnly,ignoreAllowSavingDefaults:this._ignoreAllowSavingDefaults,saveDefaultsConsumer:this._saveDefaultsConsumer,alwaysSaveDefaultKeys:this._alwaysSaveDefaultKeys,theme:this._theme.spawnOwnership()}}_childChanged(e,t){super._childChanged(e,t),this._propertyAffectsDefaults(t)&&this.saveDefaults()}_fireMergeAndFireChangedProps(e){this._forbidSavingDefaults=!0,super._fireMergeAndFireChangedProps(e),this._forbidSavingDefaults=!1,e.some((e=>this._propertyAffectsDefaults(e.pathToRootProperty())))&&this.saveDefaults()}_factoryDefaultsForTheme(e){return(0,o.default)(this._factoryDefaultsSupplier(),this.themeDefaults(e))}_propertyAffectsDefaults(e){return(this._ignoreAllowSavingDefaults||I)&&!this._defaultName.startsWith("replayStudyStrategy")&&(!this._defaultName.startsWith("study_")||this._defaultName.startsWith("study_VbPFixed"))&&(this._allDefaultsKeys&&this._allDefaultsKeys.includes(e)||!this._allDefaultsKeys&&!this._excludedDefaultsKeys?.includes(e))&&(0,C.isPrimitiveType)(this.childByPath(e)?.value())}}},60973:(e,t,i)=>{"use strict";var{clone:s,merge:o}=i(87465),n=i(86572).PlDisplay;const{generateColor:r}=i(52859),{getStdChartTheme:a}=i(24317),{DEFAULT_THEME:l}=i(22489),c=i(49156).colors;var h=i(86572).TradedGroupHorizontalAlignment,d=i(82095),u=i(36947).LineToolPitchforkStyle,_=i(45580).LineToolBarsPatternMode,p=i(4359),m=p.LineStudyPlotStyle,g=p.STUDYPLOTDISPLAYTARGET,f=i(19679),y=i(97902).PriceAxisLastValueMode,v=i(7024).MagnetMode,S=i(25672).LineEnd,b=i(93201).ColorType;const w=i(59883).DEFAULT_LINE_TOOL_LINE_WIDTH;var C=i(97760).StatsPosition,T=i(57511).sessionsPreferencesDefault,P=i(72755).axisLabelBackgroundColor,x=i(59064).mainSeriesProperties;const{LINESTYLE_SOLID:M,LINESTYLE_DASHED:I}=i(69558);var A=i(9343).getLogger("Chart.Defaults");const{colorWhite:L,colorWhiteAlpha25:k,colorTvBlue50:E,colorTvBlue500:D,colorTvBlue500Alpha30:B,colorTvBlue500Alpha25:V,colorTvBlue500Alpha20:R,colorTvBlue600:N,colorDeepBlue200:O,colorDeepBlue300:F,colorDeepBlue500:W,colorDeepBlue500Alpha20:H,colorSkyBlue500:z,colorSkyBlue500Alpha20:U,colorSkyBlue500Alpha25:j,colorSkyBlue700:G,colorSkyBlue700Alpha70:q,colorDefaultRed:$,colorRipeRed200:K,colorRipeRed300:Y,colorRipeRed400:Z,colorRipeRed400Alpha5:X,colorRipeRed500:J,colorRipeRed500Alpha30:Q,colorRipeRed500Alpha20:ee,colorRipeRed600:te,colorGrapesPurple500:ie,colorGrapesPurple500Alpha0:se,colorGrapesPurple500Alpha20:oe,colorGrapesPurple500Alpha70:ne,colorBerryPink400:re,colorBerryPink500:ae,colorBerryPink500Alpha20:le,colorBerryPink500Alpha25:ce,colorMintyGreen100:he,colorMintyGreen400:de,colorMintyGreen500:ue,colorMintyGreen500Alpha20:_e,colorIguanaGreen300:pe,colorIguanaGreen500:me,colorIguanaGreen500Alpha20:ge,colorTanOrange300:fe,colorTanOrange500:ye,colorTanOrange500Alpha20:ve,colorTanOrange600:Se,colorTanOrange700:be,colorColdGray150:we,colorColdGray400:Ce,colorColdGray450:Te,colorColdGray500:Pe,colorColdGray550:xe,colorColdGray900:Me,colorColdGray750:Ie,colorForestGreen300:Ae,colorForestGreen300Alpha5:Le}=c
+;var ke=function(e){var t=function(e,t){return{color:e,visible:t}},i=function(e,t,i,s){const o={coeff:e,color:t,visible:i};return s&&(o.text=""),o},p=function(e,t,i,s,o){return{coeff:e,color:t,visible:i,linestyle:void 0===s?M:s,linewidth:void 0===o?w:o}},A=function(e,t,i){return{color:e,width:void 0===i?w:i,visible:t}},ke=function(e,t,i,s,o){return{color:e,visible:t,width:i,x:s,y:o}},Ee=function(e,t,i,s,o,n){return{coeff1:e,coeff2:t,color:i,visible:s,linestyle:void 0===o?M:o,linewidth:void 0===n?w:n}};if(void 0===TradingView.defaultProperties){var Be;switch(window.locale){case"ar_AE":Be="Asia/Dubai";break;case"au":Be="Australia/Sydney";break;case"br":Be="America/Sao_Paulo";break;case"ca":Be="America/Toronto";break;case"de_DE":case"it":Be="Europe/Berlin";break;case"es":Be="Europe/Madrid";break;case"he_IL":case"tr":Be="Europe/Athens";break;case"hu_HU":case"pl":Be="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":Be="Asia/Bangkok";break;case"in":Be="Asia/Kolkata";break;case"ja":case"kr":Be="Asia/Tokyo";break;case"ms_MY":Be="Asia/Singapore";break;case"ru":Be="Europe/Moscow";break;case"uk":Be="Europe/London";break;case"zh_CN":case"zh_TW":Be="Asia/Shanghai";break;default:Be="Etc/UTC"}const e=a(l);TradingView.defaultProperties={chartproperties:o({timezone:Be,priceScaleSelectionStrategyName:"auto",inactivityGaps:!1,paneProperties:{backgroundType:b.Solid,gridLinesMode:"both",vertGridProperties:{style:M},horzGridProperties:{style:M},crossHairProperties:{style:I,transparency:0,width:1},topMargin:10,bottomMargin:8,axisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,alignLabels:!0,isInverted:!1},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showBackground:!0,showPriceSource:!0,backgroundTransparency:50,showLogo:!0,showTradingButtons:!0,showTradingButtonsMobile:!0,showSeriesLegendCloseOnMobile:!0},separatorColor:we},scalesProperties:{fontSize:12,scaleSeriesOnly:!1,showSeriesLastValue:!0,seriesLastValueMode:y.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!0,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalNameLabel:!1,showFundamentalLastValue:!0,barSpacing:f.DEFAULT_BAR_SPACING,axisHighlightColor:V,axisLineToolLabelBackgroundColorCommon:P.common,axisLineToolLabelBackgroundColorActive:P.active,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0,crosshairLabelBgColorLight:Me,crosshairLabelBgColorDark:Ie,saveLeftEdge:!1},mainSeriesProperties:o(x,e.content.mainSourceProperties),chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"#555555",visible:!1,style:I,width:1}},tradingProperties:{showPositions:!0,positionPL:{visibility:!0,display:n.Money},bracketsPL:{visibility:!0,display:n.Money},positionAndBracketsPL:!0,showOrders:!0,showExecutions:!0,showExecutionsLabels:!1,showReverse:!0,
+horizontalAlignment:h.Right,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:M},volumePaneSize:"large"},e.content.chartProperties),sessions:o(T,e.content.sessions),drawings:{magnet:!1,magnetSnapsToIndicators:!1,magnetMode:v.WeakMagnet,stayInDrawingMode:!1,drawOnAllCharts:!0,drawOnAllChartsMode:1},linetoolorder:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineColor:$,lineActiveBuyColor:"#4094e8",lineInactiveBuyColor:"rgba(64, 148, 232, 0.5)",lineActiveSellColor:"#e75656",lineInactiveSellColor:"rgba(231, 86, 86, 0.5)",lineStyle:"inherit",lineWidth:"inherit",bodyBorderActiveBuyColor:"#4094e8",bodyBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyBorderActiveSellColor:"#e75656",bodyBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyBackgroundColor:k,bodyBackgroundTransparency:25,bodyTextInactiveLimitColor:"rgba(38, 140, 2, 0.5)",bodyTextActiveLimitColor:"#268c02",bodyTextInactiveStopColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveStopColor:"#e75656",bodyTextInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyTextActiveBuyColor:"#4094e8",bodyTextInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveSellColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderActiveBuyColor:"#4094e8",quantityBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBorderActiveSellColor:"#e75656",quantityBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBackgroundActiveBuyColor:"#4094e8",quantityBackgroundInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundActiveSellColor:"#e75656",quantityTextColor:L,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderActiveBuyColor:"#4094e8",cancelButtonBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonBorderActiveSellColor:"#e75656",cancelButtonBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",cancelButtonBackgroundColor:k,cancelButtonBackgroundTransparency:25,cancelButtonIconActiveBuyColor:"#4094e8",cancelButtonIconInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonIconActiveSellColor:"#e75656",cancelButtonIconInactiveSellColor:"rgba(231, 86, 86, 0.5)",tooltip:"",modifyTooltip:"",cancelTooltip:""},linetoolposition:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineBuyColor:"#4094e8",lineSellColor:"#e75656",lineStyle:"inherit",lineWidth:"inherit",bodyBorderBuyColor:"#4094e8",bodyBorderSellColor:"#e75656",bodyBackgroundColor:k,bodyBackgroundTransparency:25,bodyTextPositiveColor:"#268c02",bodyTextNeutralColor:"#646464",bodyTextNegativeColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderBuyColor:"#4094e8",quantityBorderSellColor:"#e75656",quantityBackgroundBuyColor:"#4094e8",quantityBackgroundSellColor:"#e75656",quantityTextColor:L,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderBuyColor:"#4094e8",
+reverseButtonBorderSellColor:"#e75656",reverseButtonBackgroundColor:k,reverseButtonBackgroundTransparency:25,reverseButtonIconBuyColor:"#4094e8",reverseButtonIconSellColor:"#e75656",closeButtonBorderBuyColor:"#4094e8",closeButtonBorderSellColor:"#e75656",closeButtonBackgroundColor:k,closeButtonBackgroundTransparency:25,closeButtonIconBuyColor:"#4094e8",closeButtonIconSellColor:"#e75656",tooltip:"",protectTooltip:"",closeTooltip:"",reverseTooltip:""},linetoolexecution:{direction:"buy",arrowHeight:8,arrowSpacing:1,arrowBuyColor:"#4094e8",arrowSellColor:"#e75656",text:"",textColor:c.colorBlack,textTransparency:0,fontFamily:"Verdana",fontSize:10,fontBold:!1,fontItalic:!1,tooltip:""},linetoolimage:{transparency:0,cssWidth:0,cssHeight:0,angle:0},linetoolbezierquadro:{linecolor:D,linewidth:w,fillBackground:!1,backgroundColor:R,transparency:50,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal},linetoolbeziercubic:{linecolor:W,linewidth:w,fillBackground:!1,backgroundColor:H,transparency:80,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal},linetooltrendline:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolinfoline:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!0,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!0,showPercentPriceRange:!0,showPipsPriceRange:!0,showBarsRange:!0,showDateTimeRange:!0,showDistance:!0,showAngle:!0,statsPosition:C.Center},linetooltimecycles:{linecolor:"#159980",linewidth:w,fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:M},linetoolsineline:{linecolor:"#159980",linewidth:w,linestyle:M},linetooltrendangle:{linecolor:D,linewidth:w,linestyle:M,fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1,statsPosition:C.Right},linetooldisjointangle:{linecolor:ue,linewidth:w,linestyle:M,fillBackground:!0,backgroundColor:_e,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,textcolor:ue,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ue,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolflatbottom:{linecolor:ye,linewidth:w,linestyle:M,fillBackground:!0,backgroundColor:ve,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Normal,textcolor:ye,fontsize:12,bold:!1,italic:!1,
+showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ye,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolriskrewardshort:{linecolor:Pe,linewidth:1,textcolor:L,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:ee,profitBackground:_e,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0,currency:"NONE"},linetoolriskrewardlong:{linecolor:Pe,linewidth:1,textcolor:L,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:ee,profitBackground:_e,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0,currency:"NONE"},linetoolarrow:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,leftEnd:S.Normal,rightEnd:S.Arrow,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolray:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!0,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolextended:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!0,extendRight:!0,leftEnd:S.Normal,rightEnd:S.Normal,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:C.Right},linetoolhorzline:{linecolor:D,linewidth:w,linestyle:M,showPrice:!0,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle"},linetoolhorzray:{linecolor:D,linewidth:w,linestyle:M,showPrice:!0,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{linecolor:D,linewidth:w,linestyle:M,extendLine:!0,showTime:!0,horzLabelsAlign:"center",vertLabelsAlign:"middle",textcolor:D,textOrientation:"vertical",fontsize:14,bold:!1,italic:!1},linetoolcrossline:{linecolor:D,linewidth:w,linestyle:M,showPrice:!0,showTime:!0},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",showLabels:!0,fillBackground:!1,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:I},level1:p(0,Pe,!0),
+level2:p(1,D,!0),level3:p(2,D,!0),level4:p(3,D,!0),level5:p(5,D,!0),level6:p(8,D,!0),level7:p(13,D,!0),level8:p(21,D,!0),level9:p(34,D,!0),level10:p(55,D,!0),level11:p(89,D,!0)},linetooltext:{color:D,fontsize:14,fillBackground:!1,backgroundColor:V,backgroundTransparency:70,drawBorder:!1,borderColor:xe,bold:!1,italic:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:200},linetooltextabsolute:{color:D,fontsize:14,fillBackground:!1,backgroundColor:V,backgroundTransparency:70,drawBorder:!1,borderColor:xe,bold:!1,italic:!1,fixedSize:!1,wordWrap:!1,wordWrapWidth:200},linetoolballoon:{color:L,backgroundColor:ne,borderColor:se,fontsize:14,transparency:30},linetoolcomment:{color:L,backgroundColor:D,borderColor:D,fontsize:16,transparency:0},linetoolbrush:{linecolor:z,linewidth:w,smooth:5,fillBackground:!1,backgroundColor:z,transparency:50,leftEnd:S.Normal,rightEnd:S.Normal},linetoolhighlighter:{linecolor:ee,smooth:5,transparency:80,width:20},linetoolpolyline:{linecolor:z,linewidth:w,linestyle:M,fillBackground:!0,backgroundColor:U,transparency:80,filled:!1},linetoolsignpost:{emoji:"🙂",showImage:!1,plateColor:D,fontSize:12,bold:!1,italic:!1},linetoolpath:{lineColor:D,lineWidth:w,lineStyle:M,leftEnd:S.Normal,rightEnd:S.Arrow},linetoolarrowmarkleft:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkup:{color:ue,arrowColor:ue,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkright:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkdown:{color:te,arrowColor:te,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolflagmark:{flagColor:D},linetoolpricelabel:{color:L,backgroundColor:D,borderColor:D,fontWeight:"bold",fontsize:14,transparency:0},linetoolarrowmarker:{backgroundColor:N,textColor:N,bold:!0,italic:!1,fontsize:16},linetoolrotatedrectangle:{color:me,fillBackground:!0,backgroundColor:ge,transparency:50,linewidth:w},linetoolcircle:{color:ye,backgroundColor:ve,fillBackground:!0,linewidth:w,textColor:ye,fontSize:14,bold:!1,italic:!1},linetoolellipse:{color:J,fillBackground:!0,backgroundColor:ee,transparency:50,linewidth:w,textColor:J,fontSize:14,bold:!1,italic:!1},linetoolarc:{color:ae,fillBackground:!0,backgroundColor:le,transparency:80,linewidth:w},linetoolprediction:{linecolor:D,linewidth:w,sourceBackColor:D,sourceTextColor:L,sourceStrokeColor:D,targetStrokeColor:D,targetBackColor:D,targetTextColor:L,successBackground:me,successTextColor:L,failureBackground:J,failureTextColor:L,intermediateBackColor:"#ead289",intermediateTextColor:"#6d4d22",transparency:10,centersColor:"#202020"},linetooltriangle:{color:ue,fillBackground:!0,backgroundColor:_e,transparency:80,linewidth:w},linetoolcallout:{color:L,backgroundColor:q,transparency:50,linewidth:w,fontsize:14,bordercolor:G,bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:200},linetoolparallelchannel:{linecolor:D,linewidth:w,linestyle:M,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:R,transparency:20,showMidline:!0,midlinecolor:D,midlinewidth:1,midlinestyle:I,labelVisible:!1,labelHorzAlign:"left",
+labelVertAlign:"bottom",labelTextColor:D,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolelliottimpulse:{degree:7,showWave:!0,color:"#3d85c6",linewidth:w},linetoolelliotttriangle:{degree:7,showWave:!0,color:ye,linewidth:w},linetoolelliotttriplecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:w},linetoolelliottcorrection:{degree:7,showWave:!0,color:"#3d85c6",linewidth:w},linetoolelliottdoublecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:w},linetoolbarspattern:{color:D,mode:_.Bars,mirrored:!1,flipped:!1},linetoolghostfeed:{averageHL:20,variance:50,candleStyle:{upColor:he,downColor:K,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:ue,borderDownColor:J,wickColor:Pe},transparency:50},study:{inputs:{},styles:{},bands:{},graphics:{},ohlcPlots:{},palettes:{},filledAreasStyle:{},filledAreas:{},visible:!0,showLegendValues:!0,showLegendInputs:!0,showLabelsOnPriceScale:!0,precision:"default"},linetoolpitchfork:{fillBackground:!0,transparency:80,style:u.Original,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolpitchfan:{fillBackground:!0,transparency:80,median:{visible:!0,color:J,linewidth:w,linestyle:M},level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,z,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolgannfan:{linewidth:w,showLabels:!0,fillBackground:!0,transparency:80,level1:Ee(1,8,ye,!0),level2:Ee(1,4,ue,!0),level3:Ee(1,3,me,!0),level4:Ee(1,2,ue,!0),level5:Ee(1,1,z,!0),level6:Ee(2,1,D,!0),level7:Ee(3,1,ie,!0),level8:Ee(4,1,ae,!0),level9:Ee(8,1,J,!0)},linetoolganncomplex:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,scaleRatio:"",showLabels:!0,labelsStyle:{fontSize:12,bold:!1,italic:!1},levels:[A(Pe,!0),A(ye,!0),A(z,!0),A(me,!0),A(ue,!0),A(Pe,!0)],fanlines:[ke(O,!1,w,8,1),ke(J,!1,w,5,1),ke(Pe,!1,w,4,1),ke(ye,!1,w,3,1),ke(z,!0,w,2,1),ke(me,!0,w,1,1),ke(ue,!0,w,1,2),ke(ue,!1,w,1,3),ke(D,!1,w,1,4),ke(F,!1,w,1,5),ke(O,!1,w,1,8)],arcs:[ke(ye,!0,w,1,0),ke(ye,!0,w,1,1),ke(ye,!0,w,1.5,0),ke(z,!0,w,2,0),ke(z,!0,w,2,1),ke(me,!0,w,3,0),ke(me,!0,w,3,1),ke(ue,!0,w,4,0),ke(ue,!0,w,4,1),ke(D,!0,w,5,0),ke(D,!0,w,5,1)]},linetoolgannfixed:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,levels:[A(Pe,!0),A(ye,!0),A(z,!0),A(me,!0),A(ue,!0),A(Pe,!0)],fanlines:[ke(O,!1,w,8,1),ke(J,!1,w,5,1),ke(Pe,!1,w,4,1),ke(ye,!1,w,3,1),ke(z,!0,w,2,1),ke(me,!0,w,1,1),ke(ue,!0,w,1,2),ke(ue,!1,w,1,3),ke(D,!1,w,1,4),ke(F,!1,w,1,5),ke(O,!1,w,1,8)],arcs:[ke(ye,!0,w,1,0),ke(ye,!0,w,1,1),ke(ye,!0,w,1.5,0),ke(z,!0,w,2,0),ke(z,!0,w,2,1),ke(me,!0,w,3,0),ke(me,!0,w,3,1),ke(ue,!0,w,4,0),ke(ue,!0,w,4,1),ke(D,!0,w,5,0),ke(D,!0,w,5,1)]},linetoolgannsquare:{color:"rgba(21, 56, 153, 0.8)",linewidth:w,linestyle:M,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,
+fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,reverse:!1,fans:t(Ce,!1),hlevel1:i(0,Pe,!0),hlevel2:i(.25,ye,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,ue,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Pe,!0),vlevel1:i(0,Pe,!0),vlevel2:i(.25,ye,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,ue,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Pe,!0)},linetoolfibspeedresistancefan:{fillBackground:!0,transparency:80,grid:{color:"rgba(21, 56, 153, 0.8)",linewidth:1,linestyle:M,visible:!0},linewidth:w,linestyle:M,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,reverse:!1,hlevel1:i(0,Pe,!0),hlevel2:i(.25,ye,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,ue,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Pe,!0),vlevel1:i(0,Pe,!0),vlevel2:i(.25,ye,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,ue,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Pe,!0)},linetoolfibretracement:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},levelsStyle:{linewidth:w,linestyle:M},level1:i(0,Pe,!0,!0),level2:i(.236,J,!0,!0),level3:i(.382,ye,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,ue,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Pe,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,J,!0,!0),level10:i(3.618,ie,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ye,!1,!0),level13:i(1.414,J,!1,!0),level16:i(2,ue,!1,!0),level14:i(2.272,ye,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Pe,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,J,!1,!0),level21:i(4.272,ie,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ye,!1,!0),level24:i(4.764,ue,!1,!0)},linetoolfibchannel:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,labelFontSize:12,levelsStyle:{linewidth:w,linestyle:M},level1:i(0,Pe,!0),level2:i(.236,J,!0),level3:i(.382,ye,!0),level4:i(.5,me,!0),level5:i(.618,ue,!0),level6:i(.786,z,!0),level7:i(1,Pe,!0),level8:i(1.618,D,!0),level9:i(2.618,J,!0),level10:i(3.618,ie,!0),level11:i(4.236,ae,!0),level12:i(1.272,ye,!1),level13:i(1.414,J,!1),level16:i(2,ue,!1),level14:i(2.272,ye,!1),level15:i(2.414,me,!1),level17:i(3,z,!1),level18:i(3.272,Pe,!1),level19:i(3.414,D,!1),level20:i(4,J,!1),level21:i(4.272,ie,!1),level22:i(4.414,ae,!1),level23:i(4.618,ye,!1),level24:i(4.764,ue,!1)},linetoolprojection:{showCoeffs:!0,fillBackground:!0,transparency:80,color1:R,color2:oe,linewidth:w,trendline:{visible:!0,color:Ce,linestyle:M},level1:p(1,"#808080",!0)},linetool5pointspattern:{color:D,textcolor:L,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetoolcypherpattern:{color:D,textcolor:L,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,
+transparency:85,linewidth:w},linetooltrianglepattern:{color:W,textcolor:L,fillBackground:!0,backgroundColor:W,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetoolabcd:{color:ue,textcolor:L,fontsize:12,bold:!1,italic:!1,linewidth:w},linetoolthreedrivers:{color:W,textcolor:L,fillBackground:!0,backgroundColor:"rgba(149, 40, 204, 0.5)",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:w},linetoolheadandshoulders:{color:ue,textcolor:L,fillBackground:!0,backgroundColor:ue,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:w},linetoolfibwedge:{showCoeffs:!0,fillBackground:!0,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:w,linestyle:M},level1:p(.236,J,!0),level2:p(.382,ye,!0),level3:p(.5,me,!0),level4:p(.618,ue,!0),level5:p(.786,z,!0),level6:p(1,Pe,!0),level7:p(1.618,D,!1),level8:p(2.618,J,!1),level9:p(3.618,W,!1),level10:p(4.236,ae,!1),level11:p(4.618,ae,!1)},linetoolfibcircles:{showCoeffs:!0,fillBackground:!0,transparency:80,coeffsAsPercents:!1,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},level1:p(.236,J,!0),level2:p(.382,ye,!0),level3:p(.5,ue,!0),level4:p(.618,me,!0),level5:p(.786,z,!0),level6:p(1,Pe,!0),level7:p(1.618,D,!0),level8:p(2.618,ae,!0),level9:p(3.618,D,!0),level10:p(4.236,ae,!0),level11:p(4.618,J,!0)},linetoolfibspeedresistancearcs:{showCoeffs:!0,fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},level1:p(.236,J,!0),level2:p(.382,ye,!0),level3:p(.5,ue,!0),level4:p(.618,me,!0),level5:p(.786,z,!0),level6:p(1,Pe,!0),level7:p(1.618,D,!0),level8:p(2.618,ae,!0),level9:p(3.618,D,!0),level10:p(4.236,ae,!0),level11:p(4.618,J,!0)},linetooltrendbasedfibextension:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},levelsStyle:{linewidth:w,linestyle:M},level1:i(0,Pe,!0,!0),level2:i(.236,J,!0,!0),level3:i(.382,ye,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,ue,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Pe,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,J,!0,!0),level10:i(3.618,ie,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ye,!1,!0),level13:i(1.414,J,!1,!0),level16:i(2,ue,!1,!0),level14:i(2.272,ye,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Pe,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,J,!1,!0),level21:i(4.272,ie,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ye,!1,!0),level24:i(4.764,ue,!1,!0)},linetooltrendbasedfibtime:{showCoeffs:!0,fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:Pe,linewidth:w,linestyle:I},level1:p(0,Pe,!0),level2:p(.382,J,!0),level3:p(.5,pe,!1),level4:p(.618,me,!0),level5:p(1,ue,!0),level6:p(1.382,z,!0),level7:p(1.618,Pe,!0),level8:p(2,D,!0),level9:p(2.382,ae,!0),level10:p(2.618,ie,!0),level11:p(3,W,!0)},linetoolschiffpitchfork:{
+fillBackground:!0,transparency:80,style:u.Schiff,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolschiffpitchfork2:{fillBackground:!0,transparency:80,style:u.Schiff2,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolinsidepitchfork:{fillBackground:!0,transparency:80,style:u.Inside,median:{visible:!0,color:J,linewidth:w,linestyle:M},extendLines:!1,level0:p(.25,fe,!1),level1:p(.382,pe,!1),level2:p(.5,ue,!0),level3:p(.618,ue,!1),level4:p(.75,z,!1),level5:p(1,D,!0),level6:p(1.5,ie,!1),level7:p(1.75,ae,!1),level8:p(2,Y,!1)},linetoolregressiontrend:{linewidth:1,linestyle:M,styles:{upLine:{display:g.All,color:B,linestyle:M,linewidth:w},downLine:{display:g.All,color:B,linestyle:M,linewidth:w},baseLine:{display:g.All,color:Q,linestyle:I,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},De(TradingView.defaultProperties.chartproperties),Ve()}if(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{display:g.All,color:D,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:D,backColor:E,textColor:Me}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){var Re=!0;TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:Re,"S1/R1":Re,"S2/R2":Re,"S3/R3":Re,"S4/R4":Re,"S5/R5":Re},colors:{P:Se,"S1/R1":Se,"S2/R2":Se,"S3/R3":Se,"S4/R4":Se,"S5/R5":Se},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}}}void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:D,linewidth:2});const Ne={styles:{splitByBlocks:!1},graphics:{tpoLevels:{tpo:{tpoPoc:{color:""},tpoPoorHigh:{color:""},tpoPoorLow:{color:""},tpoSingleprints:{color:""},tpoVah:{color:""},tpoVal:{color:""},volumePoc:{color:""},volumeVah:{color:""},volumeVal:{color:""}}},tpoVolumeRows:{tpo:{valuesColor:"",colors:{nonVa:"",va:""}}}}};function Oe(e){const t={styles:{developingPoc:{color:""},developingVAHigh:{color:""},developingVALow:{color:""}},graphics:{horizlines:{pocLines:{color:""},vahLines:{color:""},valLines:{color:""}},hhists:{histBars2:{colors:["",""],valuesColor:""},histBarsVA:{colors:["",""],valuesColor:""}}}};return e&&(t.graphics.polygons={histBoxBg:{color:""}}),t}
+void 0===TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]=Ne),void 0===TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]=Ne),void 0===TradingView.defaultProperties["study_VbPSessions@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPSessions@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPSessionsRoughDetailed@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPSessionsRoughDetailed@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPPeriodic@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPVisible@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPVisible@tv-volumebyprice"]=Oe(!1));const Fe={styles:{developingPoc:{color:""},developingVAHigh:{color:""},developingVALow:{color:""}},graphics:{hhists:{histBars2:{colors:["",""],valuesColor:""},histBarsVA:{colors:["",""],valuesColor:""}},horizlines:{pocLines:{color:""},vahLines:{color:""},valLines:{color:""}},polygons:{histBoxBg:{color:""}}}};if(void 0===TradingView.defaultProperties["study_VbPFixed@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPFixed@tv-volumebyprice"]=Fe),void 0===TradingView.defaultProperties["study_VbPFixed@tv-basicstudies"]&&(TradingView.defaultProperties["study_VbPFixed@tv-basicstudies"]=Fe),void 0===TradingView.defaultProperties.linetoolanchoredvp&&(TradingView.defaultProperties.linetoolanchoredvp=Oe(!0)),void 0===TradingView.defaultProperties["study_VbPAutoAnchored@tv-volumebyprice"]&&(TradingView.defaultProperties["study_VbPAutoAnchored@tv-volumebyprice"]=Oe(!0)),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t($,!1),level1:t("#008000",!1),level2:t("#0000ff",!1),level3:t("#ff00ff",!1),level4:t("#0080ff",!0),level5:t($,!0),level6:t("#008000",!0),level7:t("#0000ff",!0),level8:t("#ff00ff",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{display:g.All,color:B,linestyle:M,linewidth:1},downLine:{display:g.All,color:B,linestyle:M,linewidth:1},baseLine:{display:g.All,color:Q,linestyle:M,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba(153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]){TradingView.defaultProperties["study_Overlay@tv-basicstudies"]={style:d.STYLE_LINE,allowExtendTimeScale:!1,showPriceLine:!1,minTick:"default",candleStyle:{upColor:de,downColor:re,drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",
+borderUpColor:de,borderDownColor:re,wickColor:"#737375",wickUpColor:de,wickDownColor:re,barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:de,downColor:re,drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:de,borderDownColor:re,wickColor:"#737375",wickUpColor:de,wickDownColor:re,barColorsOnPrevClose:!1},barStyle:{upColor:de,downColor:re,barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},lineStyle:{color:be,linestyle:M,linewidth:2,priceSource:"close"},lineWithMarkersStyle:{color:be,linestyle:M,linewidth:2,priceSource:"close"},steplineStyle:{color:be,linestyle:M,linewidth:2,priceSource:"close"},areaStyle:{color1:D,color2:D,linecolor:D,linestyle:M,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:Te,topFillColor1:Le,topFillColor2:Le,bottomFillColor1:X,bottomFillColor2:X,topLineColor:Ae,bottomLineColor:Z,topLineWidth:2,bottomLineWidth:2,topLineStyle:0,bottomLineStyle:2,priceSource:"close",transparency:50,baseLevelPercentage:50},hiloStyle:{color:D,showBorders:!0,borderColor:D,showLabels:!0,labelColor:D,drawBody:!0},columnStyle:{upColor:r(ue,50),downColor:r(J,50),barColorsOnPrevClose:!0,priceSource:"close",baselinePosition:"bottom"},hlcAreaStyle:{highLineVisible:!0,highLineColor:z,highLineStyle:M,highLineWidth:2,lowLineVisible:!0,lowLineColor:ae,lowLineStyle:M,lowLineWidth:2,closeLineColor:D,closeLineStyle:M,closeLineWidth:2,highCloseFillColor:j,closeLowFillColor:ce},hlcBarsStyle:{color:D,barColorsOnPrevClose:!1,thinBars:!0},styles:{open:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0},high:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0},low:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0},close:{display:g.All,color:$,linestyle:M,linewidth:1,plottype:m.Line,histogramBase:0}}}}for(var We=e.split("."),He=TradingView.defaultProperties,ze=0;ze1?h(e[o],t.slice(1),i):(e[o]&&e[o].setValue?e[o].setValue(i):e[o]=i,!0))}function d(e){i||A.logWarn("Path `"+e+"` does not exist.")}}function De(e,t,i,s){window.__defaultsOverrides&&Ee(e,t,i,window.__defaultsOverrides,s)}function Be(e,t){window.__settingsOverrides&&Ee(e,null,!1,window.__settingsOverrides,t)}function Ve(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&De(TradingView.defaultProperties[t],null,!1,t)}))}function Re(e,t){return t?function(e,t){var i=ke(e);if(!window._UNIT_TESTS){var n=s(TVSettings.getJSON(e,null));if(function(e){var t=new Set(["linetoolregressiontrend"]);return e.startsWith("study_")||t.has(e)}(e)&&n&&function(e){if(!e)return!1;e=e.toString();var t=new RegExp("\\d+").exec(e),i=null!==t&&t[0]===e;return i
+}(n.version)){var r=n.inputs,a=t.updateStudyInputs(n.id,n.version,"last",r,null);n.inputs=a,n=t.updateStudyState(n,n)}o(i,n),Be(i,e)}return i}(e,t):function(e){var t=ke(e);if(!window._UNIT_TESTS){var i=s(TVSettings.getJSON(e,null));if(i){o(t,i);const s=e.split(".");Be(t,void 0===s[1]?e:s[1])}}return t}(e)}Re.create=function(e,t){if(t){var i=ke(e);TradingView.defaultProperties[e]=o(t,i)}},Re.remove=function(e){TradingView.defaultProperties[e]=void 0},TradingView.saveDefaults=function(e,t){void 0===t?TVSettings.remove(e):TVSettings.setJSON(e,t)},TradingView.factoryDefaults=ke,window.applyDefaultOverridesToLinetools=Ve,window.applyDefaultsOverrides=De,window.applyPropertiesOverrides=Ee,window.defaults=Re,t.applyDefaultOverridesToLinetools=Ve,t.applyDefaultsOverrides=De,t.applyPropertiesOverrides=Ee,t.defaults=Re,t.factoryDefaults=ke,t.saveDefaults=TradingView.saveDefaults,t.createDefaults=Re.create,t.removeDefaults=Re.remove},78861:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DrawingSyncMode:()=>s,SelectPointMode:()=>o,activePointSelectionMode:()=>J,alignTo45Degrees:()=>Ie,barTimesUnderCursor:()=>ee,beenSetLineToolLastPoint:()=>F,cancelLineTool:()=>ne,cancelledLineTool:()=>O,changeLineStyle:()=>me,changeLineTool:()=>de,changedLineStyle:()=>K,changedLineTool:()=>j,continueLineTool:()=>oe,continuedLineTool:()=>N,copiedLineTool:()=>Y,copyLineTool:()=>ge,createLineTool:()=>se,createdLineTool:()=>R,crosshairLock:()=>x,cursorTool:()=>k,drawOnAllCharts:()=>Ae,drawOnAllChartsMode:()=>Le,emojiTool:()=>A,finishChangingLineTool:()=>ue,finishLineTool:()=>pe,finishMovingLineTool:()=>ce,finishedChangingLineTool:()=>G,finishedLineTool:()=>$,finishedMovingLineTool:()=>z,hideAllDrawings:()=>Te,hideAllIndicators:()=>Pe,hideMarksOnBars:()=>Me,iconTool:()=>I,init:()=>be,isDirectionalMovementActive:()=>V,isStudyEditingNow:()=>Q,isToolCreatingNow:()=>E,isToolEditingNow:()=>D,isToolMovingNow:()=>B,lockDrawings:()=>xe,moveLineTool:()=>le,movedLineTool:()=>H,properties:()=>Ce,removeLineTool:()=>_e,removedLineTool:()=>q,resetToCursor:()=>v,restoreLineTool:()=>fe,restoreLineToolState:()=>ye,restoredLineTool:()=>Z,restoredLineToolState:()=>X,runOnDrawingStateReady:()=>we,setLineToolLastPoint:()=>re,startChangingLineTool:()=>he,startMovingLineTool:()=>ae,startedChangingLineTool:()=>U,startedMovingLineTool:()=>W,stickerTool:()=>L,tool:()=>M,toolIsCursor:()=>m,toolIsDemonstration:()=>f,toolIsEraser:()=>g,toolIsMeasure:()=>y});var s,o,n=i(50151),r=i(41072),a=i(78176),l=i(22613),c=i(62773),h=i(48096),d=i(1765),u=i(76422),_=i(51768);!function(e){e[e.Layout=1]="Layout",e[e.Global=2]="Global"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(o||(o={}));const p=new Set(["cursor","arrow","dot","performance","demonstration"]);function m(e){return p.has(e)}function g(e){return"eraser"===e}function f(e){return"demonstration"===e}function y(e){return"measure"===e}function v(e=!1){if(!e&&S){if(S.childs().stayInDrawingMode.value())return}M.setValue(k.value())}let S=null,b=null,w=null,C=null,T=null,P=null
+;const x=new c.WatchedObject(null),M=new l.WatchedValue,I=new l.WatchedValue,A=new l.WatchedValue,L=new l.WatchedValue,k=new l.WatchedValue,E=new l.WatchedValue(!1),D=new l.WatchedValue(!1),B=new l.WatchedValue(!1),V=new l.WatchedValue(!1),R=new h.Delegate,N=new h.Delegate,O=new h.Delegate,F=new h.Delegate,W=new h.Delegate,H=new h.Delegate,z=new h.Delegate,U=new h.Delegate,j=new h.Delegate,G=new h.Delegate,q=new h.Delegate,$=new h.Delegate,K=new h.Delegate,Y=new h.Delegate,Z=new h.Delegate,X=new h.Delegate,J=new l.WatchedValue(o.None),Q=new l.WatchedValue(!1),ee=new Map;function te(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const ie={value:!1},se=te(R,ie),oe=te(N,ie),ne=te(O,ie),re=te(F,ie),ae=te(W),le=te(H),ce=te(z),he=te(U),de=te(j),ue=te(G),_e=te(q),pe=te($),me=te(K,ie),ge=te(Y,ie),fe=te(Z),ye=te(X);let ve=!1,Se=[];function be(){if(ve)return;const e=d.getValue("chart.cursorPreference","cursor");M.setValue(m(e)?e:"cursor"),M.subscribe((e=>{m(e)?k.setValue(e):g(e)&&(0,_.trackEvent)("Chart cursors",e)}),{callWithLast:!0}),k.subscribe((e=>{(0,_.trackEvent)("Chart cursors",e),e&&"performance"!==e&&!f(e)&&d.setValue("chart.cursorPreference",e)})),S=new a.DefaultProperty({defaultName:"drawings"}),b=(0,r.createPrimitiveProperty)(!1),w=(0,r.createPrimitiveProperty)(!1),C=(0,r.createPrimitiveProperty)(!1),T=(0,r.createPrimitiveProperty)(!d.getBool("BarsMarksContainer.visibile",!0)),P=(0,r.createPrimitiveProperty)(!1),M.subscribe((e=>{(0,u.emit)("onSelectedLineToolChanged")})),ve=!0,Se.forEach((e=>e())),Se=[]}function we(e){ve?e():Se.push(e)}function Ce(){return(0,n.ensureNotNull)(S)}function Te(){return(0,n.ensureNotNull)(b)}function Pe(){return(0,n.ensureNotNull)(w)}function xe(){return(0,n.ensureNotNull)(C)}function Me(){return(0,n.ensureNotNull)(T)}function Ie(){return(0,n.ensureNotNull)(P)}function Ae(){return Ce().childs().drawOnAllCharts}function Le(){return Ce().childs().drawOnAllChartsMode}},93946:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>o});var s=i(49483);class o{constructor(e,t=!1){this._shift=!1,this._mod=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._mod=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey)),this._isApiEvent=t}shift(){return this._shift}mod(){return this._mod}alt(){return this._alt}shiftOnly(){return this._shift&&!this._mod&&!this._alt}modOnly(){return this._mod&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._mod}modShift(){return this._shift&&this._mod&&!this._alt}isApiEvent(){return this._isApiEvent}static create(e=!1,t=!1,i=!1){return new o({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},60911:(e,t,i)=>{"use strict";i.d(t,{decodeExtendedSymbol:()=>h,encodeExtendedSymbolOrGetSimpleSymbolString:()=>l,extractExtendedSymbol:()=>d,isEncodedExtendedSymbol:()=>c,isStudySymbol:()=>a,replaceExtendedSymbol:()=>u});var s=i(87465);function o(e){return"="+JSON.stringify(n(e))}function n(e){
+return Object.keys(e).sort().reduce(((t,i)=>("[object Object]"===Object.prototype.toString.call(e[i])?t[i]=n(e[i]):t[i]=e[i],t)),{})}function r(e){return(0,s.isString)(e)}function a(e){return!r(e)&&"inputs"in e}function l(e){return o(e)}function c(e){return"="===e[0]}function h(e){if(!c(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function d(e){if(r(e))return{symbol:e};let t=e;for(;!r(t.symbol);)t=t.symbol;return t}function u(e,t){let i=e;for(;!r(i.symbol);)i=i.symbol;i.symbol=t}},92211:(e,t,i)=>{"use strict";i.d(t,{extractSymbolNameFromSymbolInfo:()=>l});var s=i(37103);const o=s.enabled("pay_attention_to_ticker_not_symbol"),n=s.enabled("charting_library_single_symbol_request"),r=s.enabled("use_ticker_on_symbol_info_update"),a=s.enabled("uppercase_instrument_names");function l(e,t,i,s){let l=e&&(i&&e.pro_name||e.full_name||e.name);return n&&t?l=t:(r||!s&&o)&&e&&e.ticker&&(l=e.ticker),a&&l&&(l=l.toUpperCase()),l}},35727:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},10718:(e,t,i)=>{"use strict";i.d(t,{availableDateFormats:()=>v,dateFormatFunctions:()=>f,defaultDateFormat:()=>S,getDateFormatWithWeekday:()=>y});var s=i(11542),o=i(28865),n=i(95322);const r={1:()=>s.t(null,void 0,i(62310)),2:()=>s.t(null,void 0,i(2507)),3:()=>s.t(null,void 0,i(92767)),4:()=>s.t(null,void 0,i(27072)),5:()=>s.t(null,{context:"short"},i(13132)),6:()=>s.t(null,void 0,i(429)),7:()=>s.t(null,void 0,i(53786)),8:()=>s.t(null,void 0,i(46450)),9:()=>s.t(null,void 0,i(6816)),10:()=>s.t(null,void 0,i(12179)),11:()=>s.t(null,void 0,i(26899)),12:()=>s.t(null,void 0,i(32084))},a={1:()=>s.t(null,void 0,i(14568)),2:()=>s.t(null,void 0,i(13534)),3:()=>s.t(null,void 0,i(14530)),4:()=>s.t(null,void 0,i(3762))},l=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,c=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),h=(e,t)=>e.toLocaleDateString(window.language?(0,o.getIsoLanguageCodeFromLanguage)(window.language):void 0,{weekday:"short",timeZone:"local"===t?void 0:t}),d=(e,t)=>a[((e,t)=>Math.floor((l(e,t)-1)/3)+1)(e,t)](),u=(e,t)=>(0,n.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),_=(e,t)=>r[l(e,t)](),p=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t),2),m=(e,t)=>(0,n.numberToStringWithLeadingZero)(c(e,t)%100,2),g=(e,t)=>(0,n.numberToStringWithLeadingZero)(c(e,t),4),f={"qq 'yy":(e,t)=>`${d(e,t)} '${m(e,t)}`,"qq yyyy":(e,t)=>`${d(e,t)} ${g(e,t)}`,"dd MMM 'yy":(e,t)=>`${u(e,t)} ${_(e,t)} '${m(e,t)}`,"MMM 'yy":(e,t)=>`${_(e,t)} '${m(e,t)}`,"MMM dd, yyyy":(e,t)=>`${_(e,t)} ${u(e,t)}, ${g(e,t)}`,"MMM yyyy":(e,t)=>`${_(e,t)} ${g(e,t)}`,"MMM dd":(e,t)=>`${_(e,t)} ${u(e,t)}`,"dd MMM":(e,t)=>`${u(e,t)} ${_(e,t)}`,"yyyy-MM-dd":(e,t)=>`${g(e,t)}-${p(e,t)}-${u(e,t)}`,"yy-MM-dd":(e,t)=>`${m(e,t)}-${p(e,t)}-${u(e,t)}`,"yy/MM/dd":(e,t)=>`${m(e,t)}/${p(e,t)}/${u(e,t)}`,"yyyy/MM/dd":(e,t)=>`${g(e,t)}/${p(e,t)}/${u(e,t)}`,"dd-MM-yyyy":(e,t)=>`${u(e,t)}-${p(e,t)}-${g(e,t)}`,
+"dd-MM-yy":(e,t)=>`${u(e,t)}-${p(e,t)}-${m(e,t)}`,"dd/MM/yy":(e,t)=>`${u(e,t)}/${p(e,t)}/${m(e,t)}`,"dd/MM/yyyy":(e,t)=>`${u(e,t)}/${p(e,t)}/${g(e,t)}`,"MM/dd/yy":(e,t)=>`${p(e,t)}/${u(e,t)}/${m(e,t)}`,"MM/dd/yyyy":(e,t)=>`${p(e,t)}/${u(e,t)}/${g(e,t)}`};function y(e,t){return"ja"===window.language?(i,s)=>`${f[e](i,s)} (${h(i,t)})`:(i,s)=>`${h(i,t)} ${f[e](i,s)}`}const v=Object.keys(f),S=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},60336:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(35727),o=i(10718);class n{constructor(e="yyyy-MM-dd",t=!1,i="UTC"){this._dateFormatFunc=t?(0,o.getDateFormatWithWeekday)(e,i):o.dateFormatFunctions[e]}format(e){return s.customFormatters&&s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!1)}formatLocal(e){return s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.formatLocal?s.customFormatters.dateFormatter.formatLocal(e):s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!0)}parse(e){if(""===e)return{res:!1};let t=e;return s.customFormatters&&s.customFormatters.dateFormatter&&!s.customFormatters.dateFormatter.parse&&console.warn("You need to provide a `parse` function as part of `dateFormatter`"),s.customFormatters&&s.customFormatters.dateFormatter&&s.customFormatters.dateFormatter.parse&&(t=String(s.customFormatters.dateFormatter.parse(e))),{res:!0,value:t}}}},86957:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>r});var s=i(82087),o=i(60336);const n={dateFormat:"yyyy-MM-dd",withWeekday:!1,timeFormat:s.hourMinuteSecondFormat,dateTimeSeparator:" "};class r{constructor(e={}){const t=Object.assign({},n,e);this._dateFormatter=new o.DateFormatter(t.dateFormat,t.withWeekday,t.timezone),this._timeFormatter=new s.TimeFormatter(t.timeFormat),this._separator=t.dateTimeSeparator}format(e,t){const i=t?.dateTimeSeparator??this._separator;return`${this._dateFormatter.format(e)}${i}${this._timeFormatter.format(e)}`}formatLocal(e,t){const i=t?.dateTimeSeparator??this._separator;return`${this._dateFormatter.formatLocal(e)}${i}${this._timeFormatter.formatLocal(e)}`}}},95322:(e,t,i)=>{"use strict";i.d(t,{numDependencyFormatter:()=>n,numberToStringWithLeadingZero:()=>o});var s=i(87465);function o(e,t){if(!(0,s.isNumber)(e))return"n/a";if(!(0,s.isInteger)(t))throw new TypeError("invalid length");if(t<0||t>24)throw new TypeError("invalid length");if(0===t)return e.toString();return("00000000000000000000"+e.toString()).slice(-t)}function n(e){const t=new Map;return i=>{const s=i??-1;let o=t.get(s);return o||(o=e(i),t.set(s,o)),o}}},9860:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>n});var s,o=i(97906);!function(e){e[e.DefaultPrecision=1]="DefaultPrecision"}(s||(s={}));class n{constructor(e,t){this._precision=e??1,this._numericFormatter=new o.NumericFormatter({precision:this._precision,ignoreLocaleNumberFormat:t})}format(e,t){const i=e.toFixed(this._precision),s=Math.pow(10,-this._precision)
+;return this._numericFormatter.format(Math.max(parseFloat(i),s),t)}parse(e,t){const i=this._numericFormatter.parse(e,t);return i.res?{res:!0,value:i.value,suggest:this.format(i.value)}:i}}},91799:(e,t,i)=>{"use strict";i.d(t,{formatNumber:()=>r,parseNumber:()=>l});var s=i(60521),o=i(59332),n=i(24640);function r(e,t,i,o,n){if(!Number.isFinite(e))return`${e}`;const r=-1===Math.sign(e)?"-":"";e=Math.abs(e);let a=void 0===i?e.toString():e.toFixed(i);if(a.includes("e")){if(!o)return`${r}${a.replace(".",t.decimalSign)}`;{const i=new s.Big(e);if(a=i.lt(1)?i.toFixed():i.toString(),a.includes("e"))return`${r}${a.replace(".",t.decimalSign)}`}}const l=a.split("."),c=l[0];let h=l[1];const d=function(e,t){let i=e.length;const s=[];for(;i>0;)s.unshift(e.slice(Math.max(i-3,0),i)),i-=3;return s.join(t)}(c,t.groupingSeparator);return void 0!==i&&(h=0===i?void 0:e.toFixed(i).slice(-i)),void 0!==n&&void 0!==h&&(h=function(e,t){let i=e.length-1;for(let s=i;s>=t&&"0"===e[s];s-=1)i-=1;return e.slice(0,i+1)}(h,n)),h?`${r}${d}${t.decimalSign}${h}`:`${r}${d}`}const a=(0,o.default)((e=>{const t=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(t,"gm")}));function l(e,t){if(/^(NaN|[+|-]?Infinity)$/.test(e))return parseFloat(e);e=(0,n.stripLTRMarks)(e);const i=a(t.groupingSeparator);return i&&(e=e.replace(i,"")),e=e.replace(t.decimalSign,"."),/^(\+|-)?\d+(\.\d+|\.)?(e(\+|-)?\d+)?$/.test(e)?parseFloat(e):NaN}},26010:(e,t,i)=>{"use strict";let s;i.d(t,{formatterOptions:()=>o,formatterOptionsLibraryOverrides:()=>n,getNumberFormat:()=>d});const o={decimalSign:".",decimalSignFractional:"'"},n={};const r={groupingSeparator:",",decimalSign:"."},a={groupingSeparator:".",decimalSign:","},l={groupingSeparator:" ",decimalSign:","},c={groupingSeparator:"",decimalSign:"."},h=new Map([["en",r],["th",r],["ja",r],["ko",r],["zh",r],["zh_TW",r],["ar",r],["he_IL",r],["ms_MY",r],["vi",r],["de",a],["es",a],["it",a],["tr",a],["pt",a],["id_ID",a],["fr",l],["pl",l],["ru",l]]);function d(e){if(e)return{decimalSign:o.decimalSign,groupingSeparator:""};return{...h.get(s||window.language||"")??c,...n}}},97906:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(91799),o=i(26010);class n{constructor(e={}){this._options=e}format(e,t={}){if(!Number.isFinite(e))return String(e);const{ignoreLocaleNumberFormat:i=this._options.ignoreLocaleNumberFormat,noExponentialForm:r=this._options.noExponentialForm}=t,{minPrecision:a,precision:l}=this._options,c=(0,o.getNumberFormat)(i);return void 0===l?n._formatNoEImpl(e,c,l,a):(0,s.formatNumber)(e,c,l,r,a)}parse(e,t){const{ignoreLocaleNumberFormat:i,precision:n}=this._options,r=(0,o.getNumberFormat)(i||t?.ignoreLocaleNumberFormat);let a=(0,s.parseNumber)(e,r);return Number.isFinite(a)?(n&&(a=+a.toFixed(n)),{res:!0,value:a}):{res:!1}}static formatNoE(e,t){return this._formatNoEImpl(e,t)}static _formatNoEImpl(e,t,i,o){return Number.isFinite(e)?(t=t??{groupingSeparator:"",decimalSign:"."},(0,s.formatNumber)(e,t,i,!0,o)):String(e)}}},38888:(e,t,i)=>{"use strict";i.d(t,{PercentageFormatter:()=>n})
+;var s=i(67563),o=i(24640);class n extends s.PriceFormatter{constructor(e={}){void 0!==e.decimalPlaces&&(e.priceScale=Math.pow(10,e.decimalPlaces)),super(e),this.type="percentage"}state(){return{...super.state(),percent:!0}}parse(e,t){return e=e.replace("%",""),super.parse(e,t)}format(e,t={}){const{useRtlFormat:i=!0}=t,s=super.format(e,{...t,useRtlFormat:!1})+"%";return i?(0,o.forceLTRStr)(s):s}static serialize(e){return e.state()}static deserialize(e){return new n(e)}}},67563:(e,t,i)=>{"use strict";i.d(t,{PriceFormatter:()=>M});var s=i(60521),o=i.n(s),n=i(9343),r=i(50151),a=i(11542),l=i(50335);var c=i(77914);function h(e){return e?(0,s.Big)(e.minMove).div(e.priceScale).toNumber():NaN}function d(e){const{minTick:t,price:i,variableMinTickData:s,shouldCheckForEquality:o}=e,n=(0,l.isNumber)(t)?u(t):t;return void 0===s?n:function(e,t,i=!1){for(let s=0;s(0,c.isEven)(t)?function(e){const t=Number(e);if(Number.isFinite(t))return u(t);{const t=e.split("/");if(t.length<2||t.length>3)throw new Error(`Unexpected mintick: ${e}`);const i=Number(t[1]),s=Number(t[0]);if(!Number.isFinite(i)||!Number.isFinite(s))throw new Error(`Unexpected mintick: ${e}`);const o=3===t.length?Number(t[2]):void 0;if(void 0!==o&&!Number.isFinite(o))throw new Error(`Unexpected mintick: ${e}`);const n={priceScale:i,minMove:s};return void 0!==o&&(n.minMove2=o),n}}(e):function(e){const t=Number(e);if(Number.isNaN(t))throw new Error(`Unexpected price limit: ${e}`);return t}(e)));if((0,c.isEven)(e.length))throw new Error("Theme must not be event number of elements");const i=[];for(let t=0;t0&&t>0){let t=e;for(i&&s&&(t/=s);t>1;)t/=10,o++}return o}function f(e,t,i){const s=(0,r.ensureNotNull)(d({price:i,minTick:null,variableMinTickData:t,shouldCheckForEquality:!0})),{priceScale:o,minMove:n,minMove2:a}=s;return{priceScale:o,minMove:n,fractionalLength:g(o,n,e,a)}}class y{constructor(e){this._formatterErrors={custom:a.t(null,void 0,i(66123)),fraction:a.t(null,void 0,i(39643)),secondFraction:a.t(null,void 0,i(70784))};const{priceScale:t,minMove:s,minMove2:o,ignoreMinMove:n,variableMinTick:r,fractionalLength:l}=e;this._priceScale=t,this._minMove=s,this._minMove2=o,this._ignoreMinMove=n,this._variableMinTickData=void 0===r?void 0:_({priceScale:t,minMove:s,minMove2:o},r),this._fractionalLength=l}formatImpl(e,t={}){
+const{signPositive:i,signNegative:s=!0,tailSize:o,cutFractionalByPrecision:n=!1,useRtlFormat:r=!0,variableMinTickDataPrice:a,ignoreLocaleNumberFormat:l,noExponentialForm:c,removeAllEndingZeros:h}=t;let d="";e<0?d=!1===s?"":"−":e&&!0===i&&(d="+");const u=this._formatUnsigned(Math.abs(e),{tailSize:o,cutFractionalByPrecision:n,variableMinTickDataPrice:a,ignoreLocaleNumberFormat:l,noExponentialForm:c,removeAllEndingZeros:h}),_="0"===u?u:d+u;return r?(0,p.forceLTRStr)(_):_}parse(e,t){return"+"===(e=(e=(0,p.stripLTRMarks)(e)).replace("−","-"))[0]&&(e=e.substring(1)),this._parseUnsigned(e,t)}_removeEndingZeros(e,t){for(let i=0;i=1e21&&!c)return t.toString().replace(".",d.decimalSign);const u=Math.pow(10,r)*i/(a?1:o),_=1/u;let p;if(u>1)p=Math.floor(t);else{const e=Math.floor(Math.round(t/_)*_);p=0===Math.round((t-e)/_)?e:e+_}let m="";if(u>1){let e=a?new s.Big(t).mul(u).round(void 0,0).minus(new s.Big(p).mul(u)).toNumber():parseFloat((Math.round(t*u)-p*u).toFixed(n));e>=u&&(e-=u,p+=1),e=a?new s.Big(e).round(n,0).toNumber():parseFloat(e.toFixed(n))*o;const i=(0,S.numberToStringWithLeadingZero)(e,n+r);if(!c&&t<1&&n>=10&&i.startsWith("0000")){let e=4;for(let t=e;t0&&2!==t&&4!==t&&8!==t&&T.logDebug("invalid minmove2")}hasForexAdditionalPrecision(){return!1}_parseUnsigned(e){return this._minMove2?this._parseAsDoubleFractional(e):this._parseAsSingleFractional(e)}_formatUnsigned(e,t){const{tailSize:i,variableMinTickDataPrice:s}=t,o={price:Math.abs(e),priceScale:this._priceScale,minMove:this._minMove,minMove2:this._minMove2,fractionalLength:(0,r.ensureDefined)(this._fractionalLength),tailSize:i};return void 0!==this._variableMinTickData&&Object.assign(o,f(!0,this._variableMinTickData,s??o.price)),this._formatAsFractional(o)}_parseAsSingleFractional(e){let t=m.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+b.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=this._priceScale,o=this._patchFractPart(parseInt(t[3]),1,s);if(o>=s||o<0)return{error:this._formatterErrors.fraction,res:!1};let n=i+o/s;return e&&(n=-n),{value:n,res:!0,suggest:this.formatImpl(n)}}return{error:this._formatterErrors.custom,res:!1}}_parseAsDoubleFractional(e){let t=m.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+b.formatterOptions.decimalSignFractional+"([0-9]+)\\"+b.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2&&null!==this._minMove2?this._minMove2:NaN,o=this._priceScale/s,n=this._minMove2,r=this._patchFractPart(parseInt(t[3]),1,o),a=this._patchFractPart(parseInt(t[4]),2,n);if(r>=o||r<0)return{error:this._formatterErrors.fraction,res:!1};if(null!=n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1};let l=null!=n?i+r/o+a/(o*n):NaN;return e&&(l=-l),{value:l,res:!0,suggest:this.formatImpl(l)}}return{error:this._formatterErrors.custom,res:!1}}_patchFractPart(e,t,i){const s={0:0,5:1},o={0:0,2:1,5:2,7:3},n={0:0,1:1,2:2,3:3,5:4,6:5,7:6,8:7};return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===o[e]?-1:o[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}_formatAsFractional(e){const{price:t,tailSize:i,priceScale:s,minMove:o,minMove2:n,fractionalLength:r}=e,a=s/o;let l=Math.floor(t),c=i?Math.floor(t*a)-l*a:Math.round(t*a)-l*a;c===a&&(c=0,l+=1);let h="";if(i){let e=(t-l-c/a)*a;e=Math.round(e*Math.pow(10,i)),h=(0,S.numberToStringWithLeadingZero)(e,i),h=this._removeEndingZeros(h,i)}if(!r)throw new Error("_fractionalLength is not calculated");let d="";if(n){const e=c%n;c=(c-e)/n;const t=(0,S.numberToStringWithLeadingZero)(c,r),i=this._getFractPart(e,2,n);d=t+b.formatterOptions.decimalSignFractional+i}else c=this._getFractPart(c,1,s),d=(0,S.numberToStringWithLeadingZero)(c*o,r);return l.toString()+b.formatterOptions.decimalSignFractional+d+h}_getFractPart(e,t,i){const s=[0,5],o=[0,2,5,7],n=[0,1,2,3,5,6,7,8];return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===o[e]?-1:o[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}}var x=i(87465);class M{
+constructor(e={}){this.type="price";const{minMove2:t,fractional:i,variableMinTick:s,ignoreMinMove:o,ignoreLocaleNumberFormat:n}=e,r=!e.minMove||o?1:e.minMove,a=(0,x.isNumber)(e.priceScale)&&(0,x.isInteger)(e.priceScale)?e.priceScale:100,l=g(a,r,i,t),c={...e,minMove:r,priceScale:a,fractionalLength:l};if(a<0)throw new TypeError("invalid base");this._priceScale=a,this._minMove=r,this._minMove2=t,this._fractional=i,this._variableMinTick=s,this._ignoreMinMove=o,this._fractionalLength=l,this._ignoreLocaleNumberFormat=n,this._noExponentialForm=e.noExponentialForm,this._implementation=i?new P(c):new C(c)}isFractional(){return!!this._fractional}state(){return{minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale,variableMinTick:this._variableMinTick,ignoreMinMove:this._ignoreMinMove,fractional:this._fractional,noExponentialForm:this._noExponentialForm}}formatChange(e,t,i){return this._implementation.formatImpl(e-t,{...i,variableMinTickDataPrice:Math.min(Math.abs(e),Math.abs(t))})}format(e,t){return this._implementation.formatImpl(e,t)}parse(e,t){return this._implementation.parse(e,t)}hasForexAdditionalPrecision(){return this._implementation.hasForexAdditionalPrecision()}static serialize(e){return e.state()}static deserialize(e){return new M(e)}}},82087:(e,t,i)=>{"use strict";i.d(t,{TimeFormatter:()=>_,hourMinuteFormat:()=>l,hourMinuteNonZeroSecondFormat:()=>r,hourMinuteSecondFormat:()=>n,hourMinuteSecondMillisecFormat:()=>a,twelveHourMinuteFormat:()=>d,twelveHourMinuteNonZeroSecondFormat:()=>h,twelveHourMinuteSecondFormat:()=>c});var s=i(35727),o=i(95322);const n="%h:%m:%s",r="%h:%m:%s+",a="%h:%m:%s.%ss+",l="%h:%m",c="%h:%m:%s %ampm",h="%h:%m:%s+ %ampm",d="%h:%m %ampm";var u;!function(e){e.TwentyFourHours="24-hours",e.TwelveHours="12-hours"}(u||(u={}));class _{constructor(e){this._isTwelveHoursFormat=!1,this._valuesAndDelimeters=[];const t=e||n,i=new RegExp("%h|%m|%s\\+|%ss\\+|%ss|%ampm|%s","g");let s=i.exec(t),o=0;for(;null!==s;){const e=s[0];"%ampm"===e&&(this._isTwelveHoursFormat=!0);const n=t.substring(o,s.index);""!==n&&this._valuesAndDelimeters.push(n),this._valuesAndDelimeters.push(e),o=s.index+e.length,s=i.exec(t)}}format(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.format(e):this._formatTime(e,!1)}formatLocal(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.formatLocal?s.customFormatters.timeFormatter.formatLocal(e):s.customFormatters.timeFormatter.format(e):this._formatTime(e,!0)}_formatTime(e,t){let i=t?e.getHours():e.getUTCHours();const s=t?e.getMinutes():e.getUTCMinutes(),n=t?e.getSeconds():e.getUTCSeconds(),r=t?e.getMilliseconds():e.getUTCMilliseconds();let a="";this._isTwelveHoursFormat&&(a=i>=12?"PM":"AM",i%=12,i=i||12);let l="",c=!1;for(let e=this._valuesAndDelimeters.length-1;e>=0;e--){const t=this._valuesAndDelimeters[e];let h;switch(t){case"%h":h=(0,o.numberToStringWithLeadingZero)(i,2);break;case"%m":h=(0,o.numberToStringWithLeadingZero)(s,2);break;case"%s+":0!==n?h=(0,o.numberToStringWithLeadingZero)(n,2):(h="",c=!0);break
+;case"%s":h=(0,o.numberToStringWithLeadingZero)(n,2);break;case"%ss":h=(0,o.numberToStringWithLeadingZero)(r,3);break;case"%ss+":0!==r?h=(0,o.numberToStringWithLeadingZero)(r,3):(h="",c=!0);break;case"%ampm":h=a;break;default:if(c){c=!1;continue}h=t}l=h+l}return l}}},18185:(e,t,i)=>{"use strict";i.d(t,{TimeSpanFormatter:()=>r});var s=i(11542),o=i(91799),n=i(26010);class r{format(e,t){const r=e<0;e=Math.abs(e);const a=Math.floor(e/86400);e-=86400*a;const l=Math.floor(e/3600);e-=3600*l;const c=Math.floor(e/60);e-=60*c;let h="";if(a){const e=(0,n.getNumberFormat)(t?.ignoreLocaleNumberFormat);h+=(0,o.formatNumber)(a,e)+s.t(null,{context:"dates"},i(85886))+" "}return l&&(h+=l+s.t(null,{context:"dates"},i(44634))+" "),c&&(h+=c+s.t(null,{context:"dates"},i(5977))+" "),e&&(h+=e+s.t(null,{context:"dates"},i(21492))+" "),r&&(h="-"+h),h.trim()}}},91565:(e,t,i)=>{"use strict";i.d(t,{VolumeFormatter:()=>l});var s=i(11542),o=i(97906),n=i(87465);const r=[{value:3,letter:"K"},{value:6,letter:"M"},{value:9,letter:"B"},{value:12,letter:"T"}];function a(e,t){const i=e-t;return r.find((e=>e.value>=i))??r[r.length-1]}class l{constructor(e={}){this.type="volume";const{precision:t=0,minPrecision:i=0,dimensionPrecision:s=2,dimensionMinPrecision:n=0,significantDigits:r=3,ignoreLocaleNumberFormat:a,noExponentialForm:l,removeSpaceBeforeDimension:c}=e;this._precision=t,this._formatter=new o.NumericFormatter({ignoreLocaleNumberFormat:a,precision:this._precision,minPrecision:i,noExponentialForm:l}),this._dimensionPrecision=s,this._dimensionFormatter=new o.NumericFormatter({ignoreLocaleNumberFormat:a,precision:this._dimensionPrecision,minPrecision:n,noExponentialForm:l}),this._significantDigits=r,this._fractionalValues=void 0!==t&&t>0,this._spaceBeforeDimension=c?"":" ",this._options=e}state(){const{ignoreLocaleNumberFormat:e,...t}=this._options;return t}format(e,t){if(!(0,n.isNumber)(e))return"---";if(Math.abs(e)>=1e100)return s.t(null,void 0,i(96935));let o="";Math.abs(e)<1&&(e=+e.toFixed(this._precision)),e<0?o="−":e>0&&t?.signPositive&&(o="+"),e=Math.abs(e);const r=!!(t?.ignoreLocaleNumberFormat??this._options.ignoreLocaleNumberFormat);let l,c,h=Math.floor(Math.log10(e))+1;if(h<=this._significantDigits&&(e=+e.toFixed(this._precision),h=Math.floor(Math.log10(e))+1),h<=this._significantDigits)l=this._formatNumber(e,r,this._formatter);else{let t=a(h,this._significantDigits);const i=Math.pow(10,t.value);e=+(e/i).toFixed(this._dimensionPrecision)*i,t=a(Math.floor(Math.log10(e))+1,this._significantDigits),l=this._formatNumber(e/Math.pow(10,t.value),r,this._dimensionFormatter),c=t.letter}return c?`${o}${l}${this._spaceBeforeDimension}${c}`:`${o}${l}`}parse(e,t){if("---"===e)return{error:"not a number",res:!1,value:NaN};const i={K:1e3,M:1e6,B:1e9,T:1e12},s=(e=e.replace("−","-")).slice(-1);if(i.hasOwnProperty(s)){const o=this._formatter.parse(e.slice(0,-1).trim(),t),r=o.res?o.value:NaN;return(0,n.isNumber)(r)?{res:!0,value:r*i[s]}:{error:"not a number",res:!1,value:NaN}}{const i=this._formatter.parse(e.trim(),t);let s=i.res?i.value:NaN
+;return-0===s&&(s=0),(0,n.isNumber)(s)?{res:!0,value:s}:{error:"not a number",res:!1,value:NaN}}}static serialize(e){return e.state()}static deserialize(e){return new l(e)}_formatNumber(e,t,i){if(this._fractionalValues&&0!==e){const t=14-Math.ceil(Math.log10(e)),i=Math.pow(10,t);e=Math.round(e*i)/i}return i.format(e,{ignoreLocaleNumberFormat:t})}}},63903:(e,t,i)=>{"use strict";i.d(t,{getPriceValueFormatterForSource:()=>l,getPriceValueFormatterForStudy:()=>c,shouldBeFormattedAsIndexedTo100:()=>r,shouldBeFormattedAsPercent:()=>n});var s=i(95059),o=i(22455);function n(e){const t=e.priceScale();return!(null===t||!t.isPercentage())&&(!(0,o.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function r(e){const t=e.priceScale();return!(null===t||!t.isIndexedTo100())&&(!(0,o.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function a(e){const t=e.priceScale();return r(e)&&null!==t?(i,s)=>t.formatPriceIndexedTo100(i,e.firstValue()??100,s):n(e)&&null!==t?(i,s)=>t.formatPricePercentage(i,e.firstValue()??100,s):null}function l(e){const t=a(e);if(t)return t;const i=e.formatter();return i.format.bind(i)}function c(e,t){const i=a(e);if(i)return i;const s=e.plotFormatter(t);return s.format.bind(s)}},2383:(e,t,i)=>{"use strict";i.d(t,{AreaName:()=>s,HitTarget:()=>n,HitTestResult:()=>d,hitTestResultDataAreEqual:()=>h,shouldDefaultActionBeExecuted:()=>c,tryCallHandler:()=>l});var s,o,n,r=i(50279),a=i(50151);function l(e,t,i,s){if(e.isTouch){if(void 0!==s)return s(e,t),!0}else if(void 0!==i)return i(e,t),!0;return!1}function c(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}function h(e,t){return e&&t&&e.equals&&t.equals?e.equals(t):(0,r.default)(e,t)}!function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove",e.AnchorPoint="AnchorPoint"}(s||(s={})),function(e){e[e.Both=0]="Both",e[e.Horz=1]="Horz",e[e.Vert=2]="Vert"}(o||(o={})),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"}(n||(n={}));class d{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}mergeData(e){this._data={...(0,a.ensureNotNull)(this._data),...e}}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,t){return null!==this._data&&l(e,t,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseLeaveHandler)}
+tryCallMouseMoveHandler(e,t){return null!==this._data&&l(e,t,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e,t){return null!==this._data&&l(e,t,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e,t){return null!==this._data&&l(e,t,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e,t){return null!==this._data&&l(e,t,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},40738:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(94119),o=i(69558);class n{constructor(){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",linewidth:1,linestyle:o.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}}},86572:(e,t,i)=>{"use strict";var s,o,n;i.d(t,{CustomSourceLayer:()=>a,PlDisplay:()=>o,RecalcVisibleRangeStudiesReason:()=>c,TradedGroupHorizontalAlignment:()=>n,tradingPreferencesDefault:()=>r}),function(e){e[e.Initial=2]="Initial",e[e.SeriesZOrderIsAlwaysZero=3]="SeriesZOrderIsAlwaysZero",e[e.Current=3]="Current"}(s||(s={})),function(e){e[e.Money=0]="Money",e[e.Pips=1]="Pips",e[e.Percentage=2]="Percentage"}(o||(o={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(n||(n={}));const r={showPositions:!1,positionAndBracketsPL:!1,positionPL:{visibility:!1,display:o.Money},bracketsPL:{visibility:!1,display:o.Money},showOrders:!1,showExecutions:!1,showExecutionsLabels:!1,showReverse:!1,extendLeft:!1,lineLength:0,horizontalAlignment:n.Right,lineWidth:0,lineStyle:0};var a,l,c,h;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(a||(a={})),function(e){e[e.Unavailable=0]="Unavailable",e[e.AvailableReadonlyAlwaysDisabled=1]="AvailableReadonlyAlwaysDisabled",e[e.AvailableReadonlyAlwaysEnabled=2]="AvailableReadonlyAlwaysEnabled",e[e.Available=3]="Available"}(l||(l={})),function(e){e[e.ViewportChangeUserAction=0]="ViewportChangeUserAction",e[e.DataUpdate=1]="DataUpdate",e[e.SeriesRestart=2]="SeriesRestart",e[e.SeriesCompleted=3]="SeriesCompleted",e[e.StudyCreation=4]="StudyCreation"}(c||(c={})),function(e){e[e.Chart=0]="Chart"}(h||(h={}))},1395:(e,t,i)=>{"use strict";var s;i.d(t,{CreateLineToolSyncMode:()=>s}),function(e){e[e.Default=0]="Default",e[e.ForceOn=1]="ForceOn",e[e.ForceOff=2]="ForceOff"}(s||(s={}))},36313:(e,t,i)=>{"use strict";var s,o,n;i.d(t,{TitleDisplayTarget:()=>n}),function(e){e[e.AfterMainSeries=0]="AfterMainSeries"}(s||(s={})),function(e){e[e.Idle=0]="Idle",e[e.Processing=1]="Processing",e[e.Active=2]="Active",e[e.Stopped=3]="Stopped"}(o||(o={})),function(e){e[e.DataWindow=1]="DataWindow",e[e.StatusLine=2]="StatusLine",e[e.Alerts=3]="Alerts"}(n||(n={}))},46082:(e,t,i)=>{"use strict";i.d(t,{Interval:()=>s.Interval,ResolutionKind:()=>s.ResolutionKind,
+SpecialResolutionKind:()=>s.SpecialResolutionKind,isHour:()=>s.isHour});var s=i(10892)},37293:(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}},97719:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>o});var s=i(43337);i(81922);class o extends s.Property{state(e,t){return super.state(e,t)}storeStateIfUndefined(){return!1}}},81922:(e,t,i)=>{"use strict";i.d(t,{getIntervalsVisibilitiesForMode:()=>_,isActualInterval:()=>d,makeIntervalsVisibilitiesVisibleAtInterval:()=>c,mergeIntervalVisibilitiesDefaults:()=>u});var s,o=i(16738),n=i(90054),r=i(50151),a=i(46082),l=i(37293);function c(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 a.Interval(a.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 h(e,t,i,s){return e&&s>=t&&s<=i}function d(e,t){const i=t.childs();switch(e.kind()){case a.ResolutionKind.Ticks:return i.ticks.value();case a.ResolutionKind.Seconds:if(e.multiplier()<60)return h(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case a.ResolutionKind.Minutes:if(e.multiplier()<60)return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)}case a.ResolutionKind.Days:return h(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case a.ResolutionKind.Weeks:return h(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case a.ResolutionKind.Months:return h(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case a.ResolutionKind.Range:return i.ranges.value()}return(0,r.assert)(!1,`Unsupported resolution: ${e.value()}`),!1}function u(e){return(0,o.default)((0,n.default)(l.intervalsVisibilitiesDefaults),e??{})}function _(e,t){if(0===t||e.isTicks()&&3===t||e.isRange()&&2===t)return u();let i=!1;const s={ticks:!1,seconds:!1,minutes:!1,hours:!1,days:!1,weeks:!1,months:!1,ranges:!1},o=e=>e.multiplier();return[{checker:e=>e.isTicks(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.ticks=!0}},{
+checker:e=>e.isSeconds()&&e.multiplier()<60,getIntervalMultiplier:o,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:o,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:o,markIntervalAsVisible:(e,t)=>{s.days=!0,s.daysFrom=e,s.daysTo=t}},{checker:e=>e.isWeeks(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.weeks=!0,s.weeksFrom=e,s.weeksTo=t}},{checker:e=>e.isMonths(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.months=!0,s.monthsFrom=e,s.monthsTo=t}},{checker:e=>e.isRange(),getIntervalMultiplier:o,markIntervalAsVisible:(e,t)=>{s.ranges=!0}}].forEach((s=>{if(s.checker(e)){i=!0;const o=s.getIntervalMultiplier(e);1===t?s.markIntervalAsVisible(o,o):3===t?s.markIntervalAsVisible(o,void 0):s.markIntervalAsVisible(void 0,o)}else(!i&&2===t||i&&3===t)&&s.markIntervalAsVisible(void 0,void 0)})),u(s)}!function(e){e[e.All=0]="All",e[e.OnlyCurrent=1]="OnlyCurrent",e[e.CurrentAndBelow=2]="CurrentAndBelow",e[e.CurrentAndAbove=3]="CurrentAndAbove"}(s||(s={}))},55396:(e,t,i)=>{"use strict";var s,o,n;i.d(t,{PaneMode:()=>n}),function(e){e.Left="left",e.Right="right"}(s||(s={})),function(e){e.Tiny="tiny",e.Small="small",e.Medium="medium",e.Large="large"}(o||(o={})),function(e){e[e.Regular=0]="Regular",e[e.Widget=1]="Widget"}(n||(n={}))},5471:(e,t,i)=>{"use strict";var s;i.d(t,{PlotRowSearchMode:()=>s}),function(e){e[e.NearestLeft=-1]="NearestLeft",e[e.Exact=0]="Exact",e[e.NearestRight=1]="NearestRight"}(s||(s={}))},7543:(e,t,i)=>{"use strict";function s(e){return Boolean(e.showInObjectTree)}i.d(t,{isDataSource:()=>s})},15574:(e,t,i)=>{"use strict";i.d(t,{isTicksEnabled:()=>o});var s=i(37103);function o(){return s.enabled("tick_resolution")}},6652:(e,t,i)=>{"use strict";var s,o,n;function r(e){return e.isSeries}i.d(t,{isSeries:()=>r}),function(e){e[e.Bars=0]="Bars",e[e.Candles=1]="Candles",e[e.Line=2]="Line",e[e.Area=3]="Area",e[e.HeikenAshi=8]="HeikenAshi",e[e.HollowCandles=9]="HollowCandles",e[e.Baseline=10]="Baseline",e[e.HiLo=12]="HiLo",e[e.Column=13]="Column",e[e.LineWithMarkers=14]="LineWithMarkers",e[e.Stepline=15]="Stepline",e[e.HLCArea=16]="HLCArea",e[e.VolCandle=19]="VolCandle",e[e.HLCBars=21]="HLCBars",e[e.Renko=4]="Renko",e[e.Kagi=5]="Kagi",e[e.PointAndFigure=6]="PointAndFigure",e[e.LineBreak=7]="LineBreak"}(s||(s={})),function(e){e.Value="_seriesId"}(o||(o={})),function(e){e[e.InvalidSymbol=0]="InvalidSymbol",e[e.ReplayUnsupported=1]="ReplayUnsupported",e[e.UnsupportedDepth=2]="UnsupportedDepth",e[e.UnsupportedIntradyReplay=3]="UnsupportedIntradyReplay"}(n||(n={}))},98155:(e,t,i)=>{"use strict";var s
+;i.d(t,{SymbolErrorPermissionDeniedReason:()=>s,invalidSymbol:()=>n,permissionDenied:()=>o}),function(e){e.Symbol="symbol",e.GroupPermission="group"}(s||(s={}));const o="permission denied",n="invalid symbol"},22455:(e,t,i)=>{"use strict";function s(e){return e?.symbolSource&&e.symbolSource()===e||void 0!==e?.isActingAsSymbolSource}function o(e){return s(e)&&"quotesProvider"in e}function n(e){return s(e)&&e.isActingAsSymbolSource().value()}i.d(t,{isActingAsSymbolSource:()=>n,isSymbolSource:()=>s,isSymbolSourceWithQuotesProvider:()=>o})},17161:(e,t,i)=>{"use strict";i.d(t,{alwaysShowLastPriceAndLastDayChange:()=>s,lastDayChangeAvailable:()=>o});i(37103);const s=!1,o=!1},13896:(e,t,i)=>{"use strict";i.d(t,{lineToolsDoNotAffectChartInvalidation:()=>s});const s=!1},45580:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolBarsPatternMode:()=>s}),function(e){e[e.Bars=0]="Bars",e[e.Line=1]="Line",e[e.OpenClose=2]="OpenClose",e[e.LineOpen=3]="LineOpen",e[e.LineHigh=4]="LineHigh",e[e.LineLow=5]="LineLow",e[e.LineHL2=6]="LineHL2"}(s||(s={}))},55393:(e,t,i)=>{"use strict";i.d(t,{LineToolBrushBase:()=>r});var s=i(50151),o=i(41414),n=i(22613);class r extends o.LineDataSource{constructor(){super(...arguments),this._hasEditableCoordinates=new n.WatchedValue(!1),this._finished=!1}pointsCount(){return-1}finished(){return this._finished}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}hasOnlyOnePoint(){return 1===this._points.length}addPoint(e,t,i){if(this._finished)return!0;if(this._lastPoint=null,this._points.length>0){const t=this._points[this._points.length-1],i=(0,s.ensureNotNull)(this.pointToScreenPoint(t));if((0,s.ensureNotNull)(this.pointToScreenPoint(e)).subtract(i).length()<2)return this._finished}return super.addPoint(e),this._finished}restorePoints(e,t,i){super.restorePoints(e,t,i),this._finished=!0}}},39697:(e,t,i)=>{"use strict";i.d(t,{CircleRenderer:()=>r});var s=i(6453),o=i(2383),n=i(4539);class r{constructor(e){this._data=e??null}setData(e){this._data=e}draw(e,t){if(null===this._data)return;const{center:i,radius:s,lineWidth:o,color:n,backColor:r}=this._data;e.save();const{horizontalPixelRatio:a,verticalPixelRatio:l}=t,c=Math.max(1,Math.floor(a)),h=c%2/2,d=Math.round(i.x*a)+h,u=Math.round(i.y*l)+h,_=Math.round(d+s*a),p=Math.max(1,Math.floor(o*a)),m=_-d-p;m>0&&(e.fillStyle=r,e.beginPath(),e.moveTo(d+m,u),e.arc(d,u,m,0,2*Math.PI,!1),e.fill());const g=Math.max(c/2,_-d-p/2);e.strokeStyle=n,e.lineWidth=p,e.beginPath(),e.moveTo(d+g,u),e.arc(d,u,g,0,2*Math.PI,!1),e.stroke(),e.restore()}hitTest(e){if(null===this._data||this._data.disableInteractions)return null;const{center:t,radius:i,backgroundHitTarget:r}=this._data,a=(0,n.interactionTolerance)().curve;if(!(0,s.pointInCircle)(e,t,i+a))return null;const l=i>a&&(0,s.pointInCircle)(e,t,i-a)?r??o.HitTarget.MovePointBackground:o.HitTarget.MovePoint;return new o.HitTestResult(l)}}},59883:(e,t,i)=>{"use strict";i.d(t,{DEFAULT_LINE_TOOL_LINE_WIDTH:()=>s});const s=2},10544:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolElliott:()=>m,
+LineToolElliottCorrection:()=>P,LineToolElliottDegree:()=>s,LineToolElliottDoubleCombo:()=>M,LineToolElliottImpulse:()=>y,LineToolElliottTriangle:()=>S,LineToolElliottTripleCombo:()=>w});var s,o,n=i(11542),r=i(95804),a=i(41414),l=i(41706),c=i(78176),h=i(65045),d=i(13896);!function(e){e[e.Supermillennium=0]="Supermillennium",e[e.Millennium=1]="Millennium",e[e.Submillennium=2]="Submillennium",e[e.GrandSupercycle=3]="GrandSupercycle",e[e.Supercycle=4]="Supercycle",e[e.Cycle=5]="Cycle",e[e.Primary=6]="Primary",e[e.Intermediate=7]="Intermediate",e[e.Minor=8]="Minor",e[e.Minute=9]="Minute",e[e.Minuette=10]="Minuette",e[e.Subminuette=11]="Subminuette",e[e.Micro=12]="Micro",e[e.Submicro=13]="Submicro",e[e.Minuscule=14]="Minuscule"}(s||(s={})),function(e){e[e.Current=4]="Current"}(o||(o={}));const u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],_=new r.TranslatedString("change Elliott degree",n.t(null,void 0,i(47977))),p=[{value:0,title:n.t(null,void 0,i(3348))},{value:1,title:n.t(null,void 0,i(87957))},{value:2,title:n.t(null,void 0,i(63375))},{value:3,title:n.t(null,void 0,i(57726))},{value:4,title:n.t(null,void 0,i(67948))},{value:5,title:n.t(null,void 0,i(87380))},{value:6,title:n.t(null,void 0,i(59189))},{value:7,title:n.t(null,void 0,i(10268))},{value:8,title:n.t(null,{context:"wave"},i(51077))},{value:9,title:n.t(null,{context:"wave"},i(922))},{value:10,title:n.t(null,void 0,i(14724))},{value:11,title:n.t(null,void 0,i(30585))},{value:12,title:n.t(null,void 0,i(24866))},{value:13,title:n.t(null,void 0,i(1145))},{value:14,title:n.t(null,void 0,i(78273))}];class m extends a.LineDataSource{constructor(e,t,s,o){super(e,t??m.createProperties(e.backgroundTheme().spawnOwnership()),s,o),this.version=4,Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,60509)).then((e=>{this._setPaneViews([new e.ElliottLabelsPaneView(this,this._model)])}))}migrateVersion(e,t,i){if(i.properties.hasChild("background")&&i.properties.removeProperty("background"),i.properties.hasChild("backgroundColor")&&i.properties.removeProperty("backgroundColor"),i.properties.hasChild("showBackground")&&i.properties.removeProperty("showBackground"),1===e){const e=Object.assign({},this._timePoint[0]);if(this._timePoint.unshift(e),this._points.length>0){const e=Object.assign({},this._points[0]);this._points.unshift(e)}}}applyTemplate(e){const t=e;delete t.background,delete t.backgroundColor,delete t.showBackground,super.applyTemplate(e)}name(){return"Elliott Labels"}async additionalActions(e){return{actions:[new l.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:n.t(null,void 0,i(23403)),subItems:u.map((t=>{const i=p.filter((e=>e.value===t))[0];return new l.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:i.title,checkable:!0,checked:this.properties().childs().degree.value()===t,onExecute:()=>{e.setProperty(this.properties().childs().degree,t,_,d.lineToolsDoNotAffectChartInvalidation)}}})}))}})],placement:"CustomAction"}}label(e){
+const t=u.length-this.properties().childs().degree.value()-1,i=Math.floor(t/3);return{group:i,bold:!!(i%2),decoration:["","brackets","circle"][t%3],label:this.labelsGroup()[i][e]}}availableDegreesValues(){return p}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliott",state:t,theme:e});return this._configureProperties(i),i}static migrateState(e){const t={0:11,1:10,2:9,3:8,4:7,5:6,6:5,7:4,8:3},i={0:11,1:8};"LineToolElliottSubminuette"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinor"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottCircle"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize]),"LineToolElliottMajorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize])}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,6238))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("linesColors",3)}}class g extends m{pointsCount(){return 6}}const f=[["0","1","2","3","4","5"],["0","i","ii","iii","iv","v"],["0","1","2","3","4","5"],["0","I","II","III","IV","V"],["0","1","2","3","4","5"]];class y extends g{constructor(e,t,i,s){super(e,t??y.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){return f}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliottimpulse",state:t,theme:e});return this._configureProperties(i),i}}const v=[["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"]];class S extends g{constructor(e,t,i,s){super(e,t??S.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return v}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliotttriangle",state:t,theme:e});return this._configureProperties(i),i}}const b=[["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"]];class w extends g{constructor(e,t,i,s){super(e,t??w.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return b}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliotttriplecombo",state:t,theme:e});return this._configureProperties(i),i}}class C extends m{pointsCount(){return 4}}const T=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class P extends C{constructor(e,t,i,s){super(e,t??P.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){
+return"Elliott Correction Wave (ABC)"}labelsGroup(){return T}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliottcorrection",state:t,theme:e});return this._configureProperties(i),i}}const x=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class M extends C{constructor(e,t,i,s){super(e,t??M.createProperties(e.backgroundTheme().spawnOwnership()),i,s)}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return x}static createProperties(e,t){const i=new c.DefaultProperty({defaultName:"linetoolelliottdoublecombo",state:t,theme:e});return this._configureProperties(i),i}}},27593:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ExecutionLineAdapter:()=>_,ExecutionsPositionController:()=>u,LineToolExecution:()=>p});var s=i(50151),o=i(41414),n=i(32853),r=i(78176),a=i(5471),l=i(37103),c=i(67777),h=i(40472);const d=c.sortSourcesPreOrdered.LineToolExecution;class u{constructor(e){this._pane=e}getXYCoordinate(e,t,i){let o=0;const n=e.getDirection(),r="buy"===n,l=this._pane.model().mainSeries();if(l.bars){const e=r?10:-10,t=l.bars().search(i,a.PlotRowSearchMode.NearestLeft);if(null!==t){i=t.index;const n=r?t.value[3]:t.value[2],a=l.priceScale(),c=(0,s.ensureNotNull)(l.firstValue());o=a.priceToCoordinate(n,c)+e}}e.setAlignedTimePointIndex(i);const c=t.visibleBarsStrictRange();if(!isFinite(i)||null===c||i>c.lastBar()||i=0;--s){const a=h[s];if(!(a instanceof p))continue;if((a.adapter().alignedTimePointIndex()??t.timePointToIndex(a.adapter().getTime(),1))!==i||a.adapter().getDirection()!==n)continue;if(a===e.line())break;const l=a.adapter().height();o=r?o+l:o-l}return{x:t.indexToCoordinate(i),y:o}}static recreateOrderedByBarsSourcesCache(e){this.clearOrderedByBarsSourcesCache();const t=e.sourcesByGroup().all();for(const e of t){if(!(e instanceof p))continue;const t=e.adapter().alignedTimePointIndex();if(void 0===t)continue;const i=u._cachedByBarIndexOrderedExecutions[t]||[];u._cachedByBarIndexOrderedExecutions[t]=i,i.push(e)}}static clearOrderedByBarsSourcesCache(){u._cachedByBarIndexOrderedExecutions={}}}u._cachedByBarIndexOrderedExecutions={};class _{constructor(e,t){this._unixtime=NaN,this._line=e,this._model=t}alignedTimePointIndex(){return this._alignedTimePointIndex}setAlignedTimePointIndex(e){this._alignedTimePointIndex=e}line(){return this._line}getIndex(){return this._model.timeScale().baseIndex()-this._line.points()[0].index}setIndex(e){const t=this._model.timeScale().baseIndex()-Math.abs(e);this._line.startMoving({logical:this._line.points()[0]});const i={...this._line.points()[0]};return i.index=t,this._line.move({logical:i}),this._line.endMoving(!1),this}getTime(){return this._unixtime}setTime(e){return this._unixtime=e,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this}getPrice(){
+return this._line.points().length>0?this._line.points()[0].price:this._line.normalizedPoints().length>0?this._line.normalizedPoints()[0].price:NaN}setPrice(e){return this._line.points().length>0&&(this._line.points()[0].price=e),this._line.normalizedPoints().length>0&&(this._line.normalizedPoints()[0].price=e),this}getText(){return this._line.properties().childs().text.value()}setText(e){return this._line.properties().childs().text.setValue(e||""),this._line.updateAllViewsAndRedraw((0,h.sourceChangeEvent)(this._line.id())),this}getArrowHeight(){return this._line.properties().childs().arrowHeight.value()}setArrowHeight(e){return this._line.properties().childs().arrowHeight.setValue(e||5),this}getArrowSpacing(){return this._line.properties().childs().arrowSpacing.value()}setArrowSpacing(e){return this._line.properties().childs().arrowSpacing.setValue(e||1),this}getDirection(){return this._line.properties().childs().direction.value()}setDirection(e){return this._line.properties().childs().direction.setValue(e||"buy"),this}getArrowColor(){const e=this._line.properties().childs();return"buy"===this.getDirection()?e.arrowBuyColor.value():e.arrowSellColor.value()}setArrowColor(e){return"buy"===this.getDirection()?this.setArrowBuyColor(e):this.setArrowSellColor(e),this}setArrowBuyColor(e){return this._line.properties().childs().arrowBuyColor.setValue(e),this}setArrowSellColor(e){return this._line.properties().childs().arrowSellColor.setValue(e),this}getTextColor(){const e=this._line.properties().childs();return n.getColorFromProperties(e.textColor,e.textTransparency)}setTextColor(e){const t=this._line.properties().childs();return n.setColorToProperties(e,t.textColor,t.textTransparency),this}getFont(){const e=this._line.properties().childs();return n.getFontFromProperties(e.fontFamily,e.fontSize,e.fontBold,e.fontItalic)}setFont(e){const t=this._line.properties().childs();return n.setFontToProperties(e,t.fontFamily,t.fontSize,t.fontBold,t.fontItalic),this}setTooltip(e){return null==e?e="":e+="",this._line.properties().childs().tooltip.setValue(e),this}getTooltip(){return this._line.properties().childs().tooltip.value()}remove(){this._model.removeSource(this._line)}getPoints(){return this._line.points()}height(){const e=this.getArrowHeight(),t=this.getArrowSpacing();let i=0;this.getText()&&(i=n.fontHeight(this.getFont()));return e+t+i+10}}class p extends o.LineDataSource{constructor(e,t,s,o){super(e,t??p.createProperties(e.backgroundTheme().spawnOwnership()),s,o),this._adapter=new _(this,e),this.customization.forcePriceAxisLabel=!1,this.customization.disableErasing=!0,this.setSelectionEnabled(!1),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,52361)).then((e=>{this._setPaneViews([new e.ExecutionPaneView(this,this._model)])}))}adapter(){return this._adapter}zorder(){return d}isSpeciallyZOrderedSource(){return!0}pointsCount(){return 1}name(){return"Execution"}hasContextMenu(){return!1}state(){return{}}updateAllViews(e){if(this._isVisible())return super.updateAllViews(e)}priceAxisViews(e,t){
+return this._isVisible()?super.priceAxisViews(e,t):null}paneViews(){return window.TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._isVisible()?super.paneViews():null}userEditEnabled(){return!1}showInObjectTree(){return!1}cloneable(){return!1}copiable(){return!1}isSynchronizable(){return!1}static createProperties(e,t){const i=new r.DefaultProperty({defaultName:"linetoolexecution",state:t,useUserPreferences:!1,theme:e});return p._configureProperties(i),i}_isVisible(){return this._model.properties().childs().tradingProperties.childs().showExecutions.value()}}},10980:(e,t,i)=>{"use strict";i.d(t,{checkImageSize:()=>c,generateLink:()=>a,getMaxImageSizeInBytes:()=>d,getMaxImageSizeLabel:()=>u,imageIsOversized:()=>l,setImageStorageAdapter:()=>r,uploadImage:()=>h});var s=i(11542);const o=/data:(.+?);base64,(.+)/;let n=2e6;function r(e){n=e.getMaxImageSizeInBytes()}async function a(e){return new Promise(((t,i)=>{const s=new FileReader;s.addEventListener("load",(()=>t(s.result))),s.addEventListener("error",i),s.addEventListener("abort",i),s.readAsDataURL(e)}))}function l(e){return function(e){const t=e.match(o);if(null===t)return 1/0;const[i,s,n]=t,r=atob(n),a=new Array(r.length);for(let e=0;en}async function c(e){return e.size<=n}async function h(e){if(!await c(e))throw new Error(s.t(null,{replace:{value:u()}},i(93738)));return a(e)}function d(){return n}function u(){const e=Math.floor(Math.log(n)/Math.log(1e3));return`${(n/Math.pow(1e3,e)).toFixed(2)}${["Bytes","KB","MB","GB","TB","PB"][e]}`}},14715:(e,t,i)=>{"use strict";i.d(t,{blobImageFilter:()=>o,checkImageSize:()=>a,generateLink:()=>r,getMaxImageSizeInBytes:()=>c,getMaxImageSizeLabel:()=>h,imageIsOversized:()=>n,uploadImage:()=>l});var s=i(10980);function o(e){return"image/png"===e.type||"image/jpeg"===e.type||"image/webp"===e.type}function n(e){return s.imageIsOversized(e)}async function r(e){return{status:"ok",data:{url:await s.generateLink(e),fields:{}},filename:"",filepath:""}}async function a(e){return s.checkImageSize(e)}async function l(e){return s.uploadImage(e)}function c(){return s.getMaxImageSizeInBytes()}function h(){return s.getMaxImageSizeLabel()}},73041:(e,t,i)=>{"use strict";i.d(t,{drawSelection:()=>r,getSymbolCoordinatesInfo:()=>n});var s=i(24640),o=i(33350);function n(e){const{symbolPosition:t,textWidth:i,textByLines:n,lineHeight:r,font:a,textAlign:l,lineSpacing:c=0}=e;let[h,d]=function(e,t){let i=0;switch(e){case"center":i=t/2;break;case"start":i=(0,s.isRtl)()?t:0;break;case"end":i=(0,s.isRtl)()?0:t;break;case"right":i=t}return[i,0]}(l,i);const u=(0,s.isRtl)(),_=r+c;let p=0,m=0,g="";for(let e=0;ey.length){p+=y.length+(r&&!c?0:1),f||(d+=_);continue}f&&(d-=_);const S=r&&!c&&y.length===s&&v&&!v.hidden;if(f&&(g+=" ",s=g.length),"center"===l)if(S)h=i/2;else{const e=(0,o.measureText)(g,a).width,t=(0,
+o.measureText)(g.slice(0,s),a).width,n=i/2;h=u?n+e/2-t:n-e/2+t}else if("right"===l&&!u||"left"===l&&u||"end"===l)if(S)h=i;else{const e=(0,o.measureText)(g.slice(s),a).width;h=u?e:i-e}else if(S)h=0;else{const e=(0,o.measureText)(g.slice(0,s),a).width;h=u?i-e:e}S?(m=e+1,d+=_):m=e;break}return{x:h,y:d,lineNumber:m}}function r(e,t,i){const{lines:n,selectionStart:r,selectionEnd:l,left:c,right:h,color:d,font:u,lineHeight:_,lineSpacing:p=0}=i;e.save();const m=(c+h)/2,g=_+p,f=(0,s.isRtl)();e.fillStyle=d;const{horizontalPixelRatio:y,verticalPixelRatio:v}=t;if(r.lineNumber===l.lineNumber){const t=Math.round(r.x*y),i=Math.round(r.y*v),s=Math.round(l.x*y);e.fillRect(Math.min(t,s),i,Math.abs(t-s),Math.round(g*v))}else{const t=(0,o.measureText)(" ",u).width;let i=0;for(let s=r.lineNumber;s<=l.lineNumber;s+=1){const o=s===r.lineNumber,d=s===l.lineNumber,_=n[s];if(_.hidden)continue;const p=a(_.text,u);let S,b,w=!1;"center"===e.textAlign?(S=o?r.x:f?m+p/2:m-p/2,b=d?l.x:f?m-p/2:m+p/2):"right"===e.textAlign||f&&"start"===e.textAlign||!f&&"end"===e.textAlign?(S=o?r.x:h-p,b=d?l.x:h,w=!0):(S=o?r.x:c,b=d?l.x:c+p);let C=Math.min(S,b),T=Math.max(S,b);d||_.wrappedLinePart&&!_.wrappedLineEnd||(w?C-=t:T+=t);const P=Math.round(C*y),x=Math.round(T*y),M=Math.round((r.y+i*g)*v),I=Math.round((r.y+(i+1)*g)*v);e.fillRect(P,M,x-P,I-M),i+=1}}e.restore()}function a(e,t){return(0,o.measureText)(e,t).width}},11946:(e,t,i)=>{"use strict";i.d(t,{isLineDrawnWithPressedButton:()=>l,isLineToolDrawWithoutPoints:()=>h,isLineToolFinishRequiredWhenCreatedByApi:()=>c,isLineToolName:()=>a,isMtpPredictorToolName:()=>n,isStudyLineToolName:()=>r,isTextToolName:()=>d})
;const s=new Set([]),o=new Set(["LineToolFibRetracement","LineToolFibChannel","LineToolFibSpeedResistanceArcs","LineToolProjection","LineToolTrendBasedFibExtension","LineToolElliott","LineToolFibCircles","LineToolVertLine","LineToolCrossLine","LineToolBarsPattern","LineToolTrendBasedFibTime","LineToolFibTimeZone","LineToolCircleLines","LineToolDateRange","LineToolPriceRange","LineToolDateAndPriceRange","LineToolParallelChannel","LineToolTrendAngle","LineToolTrendLine","LineToolInfoLine","LineToolArrowMark","LineToolPitchfan","LineToolGannSquare","LineToolFibSpeedResistanceFan","LineToolGannComplex","LineToolGannFixed","LineToolGannFan","LineToolFibWedge","LineToolPitchfork","LineToolDisjointAngle","LineToolFlatBottom","LineToolIcon","LineToolEmoji","LineToolSticker","LineToolRotatedRectangle","LineToolFibSpiral","LineToolHeadAndShoulders","LineToolTriangle","LineToolTrianglePattern","LineTool5PointsPattern","LineToolThreeDrivers","LineToolABCD","LineToolPolyline","LineToolPath","LineToolPrediction","LineToolPriceLabel","LineToolPriceNote","LineToolTextNote","LineToolNote","LineToolNoteAbsolute","LineToolArrowMarker","LineToolSignpost","LineToolBrush","LineToolArc","LineToolCallout","LineToolBalloon","LineToolComment","LineToolText","LineToolHorzLine","LineToolHorzRay","LineToolRectangle","LineToolCircle","LineToolEllipse","LineToolTimeCycles","LineToolSineLine","LineToolGhostFeed","LineToolBezierQuadro","LineToolBezierCubic","LineToolArrow","LineToolRay","LineToolExtended","LineToolSchiffPitchfork","LineToolSchiffPitchfork2","LineToolInsidePitchfork","LineToolTextAbsolute","LineToolArrowMarkLeft","LineToolArrowMarkRight","LineToolArrowMarkUp","LineToolArrowMarkDown","LineToolFlagMark","LineToolCypherPattern","LineToolElliottImpulse","LineToolElliottTriangle","LineToolElliottTripleCombo","LineToolElliottCorrection","LineToolElliottDoubleCombo","LineToolRiskRewardLong","LineToolRiskRewardShort","LineToolPosition","LineToolOrder","LineToolHighlighter","LineToolTable","LineToolImage"]);function n(e){return s.has(e)}function r(e){return"LineToolRegressionTrend"===e||"LineToolVbPFixed"===e||"LineToolFixedRangeVolumeProfile"===e||"LineToolAnchoredVolumeProfile"===e||"LineToolAnchoredVWAP"===e}function a(e){return o.has(e)||r(e)}function l(e){return"LineToolBrush"===e||"LineToolHighlighter"===e}function c(e){return l(e)||"LineToolPath"===e||"LineToolPolyline"===e||"LineToolGhostFeed"===e}function h(e){return"LineToolTweet"===e||"LineToolIdea"===e||"LineToolImage"===e}function d(e){switch(e){case"LineToolBalloon":case"LineToolComment":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":case"LineToolSignpost":return!0}return!1}o.add("LineToolExecution")},97217:(e,t,i)=>{"use strict";i.d(t,{isLineTool:()=>o});var s=i(30551);function o(e){return(0,s.isObject)(e)&&"isLineTool"in e&&e.isLineTool}},75550:(e,t,i)=>{"use strict";i.d(t,{LineDataSourcePointIndexProperty:()=>o});var s=i(43337);class o extends s.Property{constructor(e,t){super(),this._waitingPointsetUpdate=!1,
this._lineSource=e,this._pointIndex=t,this._cachedIndex=this.value()}value(){const e=this._lineSource.points();return 0===e.length?this._cachedIndex:e[this._pointIndex].index}setValue(e){this._cachedIndex=e;const t=this._lineSource.points(),i=e=>{const t=this._lineSource.points()[this._pointIndex];if(t.index===e)return;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)};if(0===t.length){const e=()=>{i(this._cachedIndex),this._waitingPointsetUpdate=!1};if(this._waitingPointsetUpdate)return;this._lineSource.pointsetUpdated().subscribe(this,e,!0),this._waitingPointsetUpdate=!0}else i(e)}_setPointImpl(e){this._lineSource.setPoint(this._pointIndex,e)}}},47432:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceAxisView:()=>r});var s=i(50151),o=i(36281),n=i(52859);class r extends o.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t,this._properties=e.model().properties().childs().scalesProperties}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.model();if(!s.timeScale()||s.timeScale().isEmpty())return;const o=this._source.priceScale();if(null===o||o.isEmpty())return;if(!s.selection().isSelected(this._source)&&!this._source.isForcedDrawPriceAxisLabel())return;if(null===s.timeScale().visibleBarsStrictRange())return;const r=this._source.priceAxisPoints(),a=this._data.pointIndex;if(r.length<=a)return;const l=r[a];if(!isFinite(l.price))return;const c=this._source.ownerSource(),h=null!==c?c.firstValue():null;if(null===h)return;let d=this._data.backgroundPropertyGetter?this._data.backgroundPropertyGetter():null;null===d&&(d=this._getBgColor()),i.background=(0,n.resetTransparency)(d),i.borderColor="#2E84A6",i.textColor=this.generateTextColor(i.background),i.coordinate=o.priceToCoordinate(l.price,h),e.text=this._formatPrice(l.price,h),e.visible=!0}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_formatPrice(e,t){return(0,s.ensureNotNull)(this._source.priceScale()).formatPrice(e,t)}}},79740:(e,t,i)=>{"use strict";i.d(t,{LineDataSourceTimeAxisView:()=>o});var s=i(23752);class o extends s.TimeAxisView{constructor(e,t){super(e.model()),this._active=!1,this._source=e,this._pointIndex=t,this._properties=e.model().properties().childs().scalesProperties}setActive(e){this._active=e}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_getIndex(){if(!this._model.selection().isSelected(this._source))return null;const e=this._source.timeAxisPoints();return e.length<=this._pointIndex?null:e[this._pointIndex].index}_isVisible(){return!0}}},41414:(e,t,i)=>{"use strict";i.d(t,{LineDataSource:()=>U,changePointUndoText:()=>z})
;var s=i(89880),o=i(10555),n=i(50151),r=i(87465),a=i(76422),l=i(9343),c=i(37103),h=i(32955),d=i(99955),u=i(48943),_=i(48096),p=i(58043),m=i(22613),g=i(51304),f=i(12178),y=i(81922),v=i(37293),S=i(95059),b=i(36597),w=i(46082),C=i(43337),T=i(78861),P=i(72207),x=i(97719),M=i(40472),I=i(22455),A=i(95804),L=i(75550);class k extends C.Property{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,n.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)}}var E=i(79740),D=i(47432),B=i(65045),V=i(56876),R=i(60973),N=i(76559);const O=(0,l.getLogger)("Chart.LineDataSource"),F=c.enabled("datasource_copypaste");class W{constructor(){this._states=[]}start(e){this._states.push(e)}finish(e){const t=(0,n.ensureDefined)(this._states.pop());return s=t,(i=e).length!==s.length?{indexesChanged:!0,pricesChanged:!0}:i.reduce(((e,t,i)=>{const o=s[i];return e.indexesChanged=e.indexesChanged||t.index!==o.index,e.pricesChanged=e.pricesChanged||t.price!==o.price,e}),{indexesChanged:!1,pricesChanged:!1});var i,s}isEmpty(){return 0===this._states.length}}let H=0;const z=new A.TranslatedString("change point",s.t(null,void 0,i(76660)));class U extends P.DataSource{constructor(e,t,i,s){if(super(s),this.isLineTool=!0,this.version=1,this.toolname="",this.customization={forcePriceAxisLabel:!1,disableErasing:!1,disableSave:!1,showInObjectsTree:!0},this._currentPointsetAndSymbolId=null,this._pointChanged=new _.Delegate,this._pointAdded=new _.Delegate,this._priceAxisViews=[],this._timeAxisViews=[],this._timePoint=[],this._points=[],this._lastPoint=null,this._paneViews=new Map,this._signaturesPaneViews=new Map,this._normalizedPointsChanged=new _.Delegate,this._fixedPointsChanged=new _.Delegate,this._changeStatesStack=new W,this._startMovingPoint=null,this._currentMovingPoint=null,this._isActualSymbol=!1,this._isActualInterval=!1,this._isActualCurrency=!1,this._isActualUnit=!1,this._symbolSource=null,this._symbolSourceSymbolInfo=null,this._sharingMode=new m.WatchedValue(0),this._onTemplateApplying=new _.Delegate,this._onTemplateApplied=new _.Delegate,this._syncStateExclusions=["interval"],this._definitionsViewModel=null,this._hasEditableCoordinates=new m.WatchedValue(!0),this._syncLineStyleMuted=!1,this._onIsActualIntervalChange=new _.Delegate,this._onIsActualSymbolChange=new _.Delegate,this._onPointsetUpdatedDelegate=new _.Delegate,
@@ -477,45 +476,45 @@ e.togglePriceScaleIndexedTo100ScaleMode(this.priceScale()),this._updateScalesAct
;if(t.left+t.right===1)return 0===t.left?e.moveScaleToLeft:e.moveScaleToRight;const i=[];return i.push(e.mergeLeftScalesAction),i.push(e.mergeRightScalesAction),new zo.Action({actionId:"Chart.PriceScale.MergeAllScales",options:{label:Jo,subItems:i}})}_setCursor(e){let t="";"grabbing"!==e&&"ns-resize"!==e||(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}async _createScaleModeButtons(){const{PriceScaleModeButtonsRenderer:e}=await Promise.all([i.e(8975),i.e(2318),i.e(2227),i.e(3555)]).then(i.bind(i,34419)),t=new e({className:"price-axis__modeButtons",setMode:e=>{this._priceScale&&("log"===e?this._chart.model().setPriceScaleMode({log:!this._priceScale.isLog()},this._priceScale,Xo):this._chart.model().setPriceScaleMode({autoScale:!this._priceScale.isAutoScale()},this._priceScale,Zo))},getMode:()=>this._priceScale?.mode()});return t.element().style.background=this.backgroundColor(),this._cell.appendChild(t.element()),this._priceScale?.modeChanged().subscribe(this,this._updateScaleModeButtons),t}_destroyScaleModeButtons(){this._scaleModeButtons&&(this._isHovered.unsubscribe(this._updatePriceScaleModeButtonsVisibility),this._selectedViaTap.unsubscribe(this._updatePriceScaleModeButtonsVisibility),this._pane.visuallyCollapsed().unsubscribe(this._updatePriceScaleModeButtonsVisibility),this._priceScale?.modeChanged().unsubscribe(this,this._updateScaleModeButtons),this._scaleModeButtons.destroy(),this._scaleModeButtons=null)}_highlightColor(){const e=this.backgroundColor(),t=this._backgroundBasedTheme.value();if(null===this._highlightColorCache||this._highlightColorCache.backgroundColor!==e||this._highlightColorCache.theme!==t){const i=(0,Ro.applyTransparency)(L.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight"),50),s=(0,Nt.rgbaToString)((0,Nt.blendRgba)((0,Nt.parseRgba)(this.backgroundColor()),(0,Nt.parseRgba)(i)));this._highlightColorCache={theme:t,backgroundColor:e,resultColor:s}}return this._highlightColorCache.resultColor}_applyLightUpdateIfRequired(){"visibleOnMouseOver"===(0,Be.actualCurrencyUnitVisibility)().value()&&this._undoModel.model().lightUpdate()}}function vn(e,t){return e.position-t.position}function Sn(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}!function(e){e[e.MaxStartDelay=50]="MaxStartDelay",e[e.EpsilonDistance=1]="EpsilonDistance"}(fn||(fn={}));class bn{constructor(e,t,i,s){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._minSpeed=e,this._maxSpeed=t,this._dumpingCoeff=i,this._minMove=s}addPosition(e,t){if(null!==this._position1){if(this._position1.time===t)return void(this._position1.position=e);if(Math.abs(this._position1.position-e)50)return;let i=0;const s=Sn(this._position1,this._position2,this._maxSpeed),o=vn(this._position1,this._position2),n=[s],r=[o];if(i+=o,null!==this._position3){const e=Sn(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=vn(this._position2,this._position3);if(n.push(e),r.push(t),i+=t,null!==this._position4){const e=Sn(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=vn(this._position3,this._position4);n.push(e),r.push(t),i+=t}}}}let a=0;for(let e=0;en&&(e.result={hittest:t,source:i,renderer:s,isCustom:o})}const Qn={contextMenuEnabled:!0,contextMenu:In.defaultChartWidgetActionsOptions,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,controlsEnabled:!0,propertyPagesEnabled:!0,sourceSelectionEnabled:!0,countdownEnabled:!0},er=new Map([[Ut.AreaName.Text,"Text"],[Ut.AreaName.Style,"Style"]]),tr=!l.enabled("display_legend_on_all_charts");var ir;!function(e){e[e.MinScrollSpeed=.2]="MinScrollSpeed",e[e.MaxScrollSpeed=7]="MaxScrollSpeed",e[e.DumpingCoeff=.997]="DumpingCoeff",e[e.ScrollMinMove=15]="ScrollMinMove",e[e.SPenMaxDistance=5]="SPenMaxDistance",e[e.CollapsedHeight=33]="CollapsedHeight"}(ir||(ir={}));let sr=null;function or(e,t){return!(0,Ut.shouldDefaultActionBeExecuted)(e,t,"pressedMouseMoveHandler","touchMoveHandler")}var nr;!function(e){e[e.None=0]="None",e[e.DownWithoutMove=1]="DownWithoutMove",e[e.DownWithMove=2]="DownWithMove"}(nr||(nr={}));class rr{constructor(e,t,i,s){this._legendWidget=null,this._paneControls=null,this._isDestroyed=!1,this._trackCrosshairOnlyAfterLongTap=(0,lo.lastMouseOrTouchEventInfo)().isTouch,this._startTrackPoint=null,this._exitTrackingModeOnNextTry=!1,this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._preventSourceChange=!1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,this._clonningAtMoveLineTools=null,this._startCloningPoint=null,this._size=(0,Ft.size)({width:0,height:0}),this._themedTopColor=null,this._initCrossHairPosition=null,this._firstZoomPoint=null,this._editDialog=null,this._processing=!1,this._pressedMoveStage=0,this._touchMove=!1,this._startTouchPoint=null,this._isSelecting=!1,this._prevHoveredHittest=null,this._contextMenuX=0,this._contextMenuY=0,this._startScrollingPos=null,this._isScrolling=!1,this._scrollPriceScale=null,this._scrollXAnimation=null,this._prevPinchScale=1,this._pinching=!1,this._wasPinched=!1,this._longTap=!1,this._contextMenuOpenedOnLastTap=!1,this._paneControlsResizeObserver=null,this._lastClickedSource=null,this._customLegendWidgetsFactoryMap=new Map,this._prevMoveEventPosition=null,this._onMagnetStateChangedListener=this._onMagnetStateChanged.bind(this),
-this._onShiftKeyStateChangedListener=this._onShiftKeyStateChanged.bind(this),this._currentCursorClassName="",this._lastFinishedToolId=null,this._needResetMeasureLater=!1,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._prevTooltipData=null,this._errorRenderer=null,this._highlightedPriceAxises=new wo.WatchedObject([]),this._visuallyCollapsed=new O.WatchedValue(!1),this._maximized=new O.WatchedValue(!1),this._endOfSeriesDataBanner=null,this._selectionBeforeMouseDown=new WeakSet,this._mouseTouchDownUpInfo=null,this._canvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._updateVisuallyCollapsed=()=>{this._visuallyCollapsed.setValue(!this.state().maximized().value()&&this.state().collapsed().value())},this._updateMaximized=()=>{this._maximized.setValue(this.state().maximized().value())},this._chart=e,this._state=t,this._options=(0,tt.merge)((0,tt.clone)(Qn),i),this._paneWidgetsSharedState=s,this._state&&this._subscribeToState();const o={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(o.contextMenu=this._options.priceScaleContextMenu);const r=(e,t,i,s,n)=>new yn(this._chart,this,this._chartUndoModel(),i,t,e,o,s,n),a=e.properties().childs().scalesProperties,c=this._chartModel().rendererOptionsProvider(),h={backgroundBasedTheme:e.backgroundBasedTheme().spawnOwnership(),stubContextMenuProvider:()=>Promise.resolve([]),titlesProvider:()=>[],rendererOptionsProvider:c,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value(),requestRepaint:()=>this._chartModel().lightUpdate()};this._rowElement=document.createElement("div"),this._rowElement.style.display="flex";const d={showLabels:!1};this._lhsPriceAxisesContainer=t.mode()===zi.PaneMode.Regular?new Vo(a,"left",r,h,d):new PaneWidgetSideArea(c,"left"),this._rhsPriceAxisesContainer=t.mode()===zi.PaneMode.Regular?new Vo(a,"right",r,h,d):new PaneWidgetSideArea(c,"right"),this._paneCell=document.createElement("div"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._div.setAttribute("data-name","pane-widget-chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=(0,Kt.createBoundCanvas)(this._div,(0,Ft.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const u=this._canvasBinding.canvasElement;u.style.position="absolute",u.style.left="0",u.style.top="0",u.dataset.name="pane-canvas",this._topCanvasBinding=(0,Kt.createBoundCanvas)(this._div,(0,Ft.size)({
-width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const _=this._topCanvasBinding.canvasElement;_.style.position="absolute",_.style.left="0",_.style.top="0",_.dataset.name="pane-top-canvas",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),u.setAttribute("aria-hidden","true");const p=this._chartModel().mainSeries();p.dataEvents().symbolResolved().subscribe(this,this._updateAccessibilityAttr),this._mainSeriesInterval=p.intervalObj().spawn(),this._mainSeriesInterval.subscribe(this._updateAccessibilityAttr.bind(this)),this._updateAccessibilityAttr(),this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(this._state),(0,Dn.magnetEnabled)().subscribe(this._onMagnetStateChangedListener),(0,Vs.shiftPressed)().subscribe(this._onShiftKeyStateChangedListener),l.enabled("chart_drag_export")&&(_.draggable=this._chartModel().dragExportEnabled().value(),this._chartModel().dragExportEnabled().subscribe((e=>{_.draggable=e})),_.addEventListener("dragend",(e=>{this._chartModel().dragExportEnabled().value()&&(0,ee.emit)("dragend")})),_.addEventListener("dragstart",(async e=>{if(!this._chartModel().dragExportEnabled().value())return void e.preventDefault();e.stopPropagation();const t=this._chartUndoModel().model().hoveredSource(),i=Nn();(0,ee.emit)("dragstart",{preventDefault:()=>e.preventDefault(),hoveredSourceId:t?.id()??null,exportData:e=>{const t=e=>s().convertPublicTimeToInternalTime(e),s=()=>(0,On.getChartWidgetApiTimeConverter)(p.interval(),(0,n.ensureNotNull)(p.symbolInfo(),"main series symbol info"),this._chartModel());return void 0!==e?.from&&(e.from=t(e.from)),void 0!==e?.to&&(e.to=t(e.to)),i?.exportData(this._chartModel(),e)},setData:(t,i)=>{e.dataTransfer&&e.dataTransfer.setData(t,i)},setDragImage:(t,i,s)=>{e.dataTransfer&&e.dataTransfer.setDragImage(t,i,s)}}),e.dataTransfer?.getData("text/plain")||e.dataTransfer?.getData("text/html")||e.preventDefault()}))),this.setCursorForTool(),this._mouseEventHandler=new Wt.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{isMouseMoveHandlingEnabled:()=>!this._chartModel().dragExportEnabled().value(),treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag,shouldAllowTouchDrag:()=>this.trackingModeEnabled()}),this._paneCellMouseEventHandler=new Wt.MouseEventHandler(this._paneCell,{doubleTapEvent:this._paneDblClickOrTapEvent.bind(this),mouseDoubleClickEvent:this._paneDblClickOrTapEvent.bind(this)},{shouldAllowTouchDrag:()=>this.trackingModeEnabled(),treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,
-treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag}),this._prevHoveredHittest=null,this._highlightedPriceAxises.subscribe((e=>{this._highlightPriceAxisesByLabel(e.map((e=>e.axis)))})),this._prevPinchScale=0,this._isDestroyed=!1;const m=(0,ft.combine)((e=>{const t=this._chart.paneWidgetSeparators(this);return[t.separatorAbove?.selected()?.weakReference()??new O.WatchedValue(!1).ownership(),t.separatorBelow?.selected()?.weakReference()??new O.WatchedValue(!1).ownership()]}),this._chart.paneWidgetsWV().weakReference());this._anySeparatorSelected=(0,ft.accumulate)((e=>e.some(Boolean)),m.ownership())}destroy(){this._chart.onPaneWidgetDestroyed(this);this._chartModel().mainSeries().dataEvents().symbolResolved().unsubscribeAll(this),this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&this._unsubscribeFromState(),(0,Dn.magnetEnabled)().unsubscribe(this._onMagnetStateChangedListener),(0,Vs.shiftPressed)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this),this._errorRenderer&&this._errorRenderer.then((e=>{e.destroy(),this._errorRenderer=null})),this._prevHoveredHittest=null,this._mouseEventHandler.destroy(),this._paneCellMouseEventHandler.destroy(),this._rowElement.parentElement?.removeChild(this._rowElement),this._anySeparatorSelected.destroy(),this._mainSeriesInterval.destroy(),this._isDestroyed=!0}updateOptions(e){if((0,tt.merge)(this._options,e),!1===e.legendWidgetEnabled&&this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),e.legendWidgetEnabled&&!this._legendWidget&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),!this._state)return;const t=this._state.mode(),i=this._chartModel().rendererOptionsProvider();if(t===zi.PaneMode.Regular&&!(this._lhsPriceAxisesContainer instanceof Vo)){this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy();const e={showLabels:!1},t={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks
-},s=(e,i,s,o,n)=>new yn(this._chart,this,this._chartUndoModel(),s,i,e,t,o,n),o=this._chart.properties().childs().scalesProperties,n=()=>this._chartModel().backgroundColor().value(),r=()=>this._chartModel().backgroundTopColor().value(),a={backgroundBasedTheme:this._chart.backgroundBasedTheme().spawnOwnership(),stubContextMenuProvider:()=>Promise.resolve([]),titlesProvider:()=>[],rendererOptionsProvider:i,getBackgroundTopColor:r,getBackgroundBottomColor:n,requestRepaint:()=>this._chartModel().lightUpdate()};this._lhsPriceAxisesContainer=new Vo(o,"left",s,a,e),this._rhsPriceAxisesContainer=new Vo(o,"right",s,a,e),this._rowElement.innerHTML="",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement())}t!==zi.PaneMode.Widget||this._lhsPriceAxisesContainer instanceof PaneWidgetSideArea||(this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this._lhsPriceAxisesContainer=new PaneWidgetSideArea(i,"left"),this._rhsPriceAxisesContainer=new PaneWidgetSideArea(i,"right"),this._rowElement.innerHTML="",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()))}size(){return this._size}setSize(e){(0,Ft.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._paneCell.style.width=e.width+"px",this._paneCell.style.height=e.height+"px",this._div.style.width=e.width+"px",this._div.style.height=e.height+"px",this._rowElement.classList.toggle("js-hidden",0===e.height),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.width))}width(){return this._size.width}height(){return this._size.height}backgroundColor(){return this._chartModel().backgroundColor().value()}highlightedPriceAxises(){return this._highlightedPriceAxises}processDoubleClickOnSource(e,t,i){if((0,zs.isEditableTextLineTool)(e)){const t=e.textEditingActivationTime();null!==t&&performance.now()-t<500&&e.deactivateTextEditing()}(0,Po.isDataSource)(e)&&e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}stretchFactor(){return this._state?this._state.stretchFactor():0}setStretchFactor(e){this.hasState()&&this.state().setStretchFactor(e)}setCursorForTool(e,t,i){if(t&&t.mod()&&e&&e!==this._chartModel().crosshairSource())return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case ei.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ei.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case ei.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ei.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case ei.PaneCursorType.Default:this._setCursorClassName("default");break
-;case ei.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case ei.PaneCursorType.Grabbing:this._setCursorClassName("grabbing");break;case ei.PaneCursorType.Text:this._setCursorClassName("text");break;case ei.PaneCursorType.None:this._setCursorClassName("none")}return}const s=mt.tool.value();if((0,mt.toolIsCursor)(s)){if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}let o="";switch(s){case"eraser":o="eraser";break;case"zoom":o="zoom-in"}if(!o)switch(mt.cursorTool.value()){case"arrow":o="default";break;case"dot":o="dot";break;case"demonstration":o="demonstration";break;case"performance":o="performance"}this._setCursorClassName(o)}showContextMenuForSelection(e,t,i){const s=this._chartUndoModel().selection();if(s.isEmpty())return;const o=s.dataSources().filter((e=>e.hasContextMenu()));this.showContextMenuForSources(o,e,void 0,t,i)}async showContextMenuForSources(e,t,i,s,o){if(!e.length||!this._state)return Promise.resolve(null);const{ActionsProvider:n}=await(0,Go.actionsProviderModule)();if(this._isDestroyed)return null;const r=e[0],a=(0,tt.merge)((0,tt.clone)(this._options.contextMenu),i||{}),l=new n(this._chart,a);if(r===this._chartUndoModel().crosshairSource())return r.handleContextMenuEvent(t),Promise.resolve(null);{const i=await l.contextMenuActionsForSources(e,this._state,t,s?.origin,o?.data()?.customActions);if(0===i.length)return Promise.resolve(null);{let e={menuName:""};return r instanceof Vn.Series?e={menuName:s?.origin??"ObjectTreeContextMenu",detail:{type:"series",id:r.instanceId()}}:(0,zs.isLineTool)(r)?e={menuName:s?.origin??"ObjectTreeContextMenu",detail:{type:"shape",id:r?.id()??null}}:(0,Ws.isStudy)(r)&&(e={menuName:s?.origin??"ObjectTreeContextMenu",detail:{type:"study",id:r?.id()||null}}),Io.ContextMenuManager.createMenu(i,{takeFocus:!0,returnFocus:!0,isKeyboardEvent:a.isKeyboardEvent,statName:r.contextMenuStatName()},e).then((e=>(e.show(t),e)))}}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return(0,n.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&(this._unsubscribeFromState(),this._paneControls?.destroy(),this._paneControls=null),this._state=e,this.hasState()&&(this.updateOptions(this._options),this._subscribeToState(),this._loadAndCreatePaneControlsWidget(this.state()),this.updatePriceAxisWidgetsStates(),this._updateAccessibilityAttr()))}getScreenshotData(e){const t=[],i=[];let s,o=[];const n=this.state(),r=n.mode()===zi.PaneMode.Widget?[]:n.sourcesByGroup().priceSources().slice().reverse(),a=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();for(const c of r){const r=c.statusView()
-;if((0,Ws.isStudy)(c)&&(a.showLegend.value()||e?.showCollapsedStudies)){const s=a.showStudyTitles.value(),o=s;if(c.properties().childs().visible.value()&&this._chartModel().paneForSource(c)===n&&r&&o){t.push(s?c.statusProvider(e?.status).text():"");const o=l.enabled("use_last_visible_bar_value_in_legend")?this._chartModel().timeScale().visibleBarsStrictRange()?.lastBar()??null:null,n=c.legendValuesProvider().getValues(o);i.push(n)}}else if(c===this._chartModel().mainSeries()&&r&&a.showSeriesTitle.value()){const t=c.statusProvider(e?.status||{}).getSplitTitle();s=Object.values(t).filter((e=>""!==e)).join(" · ");const i=l.enabled("use_last_visible_bar_value_in_legend")?this._chartModel().timeScale().visibleBarsStrictRange()?.lastBar()??null:null;o=c.legendValuesProvider().getValues(i)}}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this._size.width,contentHeight:this._size.height,studies:t,studiesValues:i,containsMainSeries:this.containsMainSeries(),mainSeriesText:s,mainSeriesValues:o}}updatePriceAxisWidgetsStates(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(t)if(this._state?.mode()===zi.PaneMode.Regular){const i=e.priceScaleSlotsCount(),s=this.state(),o=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(o,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}else this._state?.mode()===zi.PaneMode.Widget&&(this._lhsPriceAxisesContainer.setPane(this._state),this._rhsPriceAxisesContainer.setPane(this._state))}updatePriceAxisWidgets(){this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update()}update(){this.hasState()&&(this.updatePriceAxisWidgets(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e){this.hasState()&&null!==this._legendWidget&&(e.legendWidgetLayoutInvalidated()?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e){this._themedTopColor=e.topColor,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvasElement}getRenderingInfo(){return(0,Kt.getBindingRenderingInfo)(this._canvasBinding)}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}pinchStartEvent(){return null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),!!this._options.handleScale.pinch&&(this._chartModel().stopTimeScaleAnimation(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this),!0))}pinchEvent(e,t,i,s){
-if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return;const o=10*(s-this._prevPinchScale);this._prevPinchScale=s,this._chartModel().zoomTime(e.x,o,!0),this._prevPinchScale=s}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){this._onMouseEvent(),this.hasState()&&this._mouseDownOrTouchStartEvent(e,this._dataSourceAtPoint(e.localX,e.localY))}touchStartEvent(e){if(this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch())return;const t=!this._trackCrosshairOnlyAfterLongTap&&null!==sr&&sr.stateId===this.state().id()&&Math.abs(sr.x-e.localX)+Math.abs(sr.y-e.localY)<5;this._onTouchEvent(),this._chart.setActivePaneWidget(this);const i=this._dataSourceAtPoint(e.localX,e.localY);if(t){const t=this._chartModel().crosshairSource();null!==i&&i.source===t||t.selectPointMode().value()!==mt.SelectPointMode.None?this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(e.localX,e.localY)):!this._chart.readOnly()&&null!==i&&(0,zs.isLineTool)(i.source)&&i.source.userEditEnabled()&&this._chartUndoModel().selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(i.source,i.hittest.data())}))}this._mouseDownOrTouchStartEvent(e,i),this._mouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._state?.model().chartFloatingTooltipVisible().value()?this._mouseOrTouchMoveEvent(e):this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._updateHoveredSource(null,new To.EnvironmentState(e)),this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){if(this._chart.readOnly())return;const t=this._dataSourceAtPoint(e.localX,e.localY);if(null===t||t.isCustom)return;if((t.hittest.target()||0)<=Ut.HitTarget.MovePointBackground)return;const i=new To.EnvironmentState(e),s=t.hittest.eraseMarker();if(i.mod()&&void 0!==s&&t.source.processErase)return void t.source.processErase(this._chartUndoModel(),s);const o=this._chartUndoModel();o.selection().isSelected(t.source)||o.selectionMacro((e=>{e.clearSelection();const i=(0,n.ensureNotNull)(t.source);e.addSourceToSelection(i,Xn(t,i))})),
-this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){if(null===this._state||this._preventTouchEventsExceptPinch())return;if(this._onTouchEvent(),this._longTap=!0,null!==this._startTrackPoint||!this._trackingModeShouldBeActive())return;const t=this._chartModel().selection();if(!t.isEmpty()){const i=this._dataSourceAtPoint(e.localX,e.localY);if(null!==i&&t.isSelected(i.source))return}this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(e.localX,e.localY),new To.EnvironmentState(e))}mouseEnterEvent(e){if(this._onMouseEvent(),!this.hasState())return;this._chart.setActivePaneWidget(this);const t=this._dataSourceAtPoint(e.localX,e.localY);this._updateHoveredSource(t,new To.EnvironmentState(e)),this.setCursorPosition(e.localX,e.localY,new To.EnvironmentState(e))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(e){this._processOutsideClick(null,e)}touchStartOutsideEvent(e){this._processOutsideClick(null,e)}cancelZoom(){this._chartModel().crosshairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this.state().mode()!==zi.PaneMode.Widget&&(this._startChangeLineToolParams=null,this._startMoveSourceParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._chartUndoModel().selectionMacro((e=>e.clearSelection())),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this.setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crosshairSource().currentPoint())}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e,t){if(!this._chartUndoModel()||!this.hasState()||0===this._size.width||0===this._size.height)return;(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding),this._state&&(e.priceScaleSideMaxLevel("left")>ao.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>ao.InvalidationLevel.Cursor)&&(this._recalculatePriceScales((0,wi.viewportChangeEvent)(this.state())),null!==sr&&sr.stateId===this.state().id()&&this.setCursorPosition(sr.x,sr.y,sr.envState));const i=e.fullInvalidation();if(i>ao.InvalidationLevel.Cursor&&null!==sr&&sr.stateId===this.state().id()){
-const e=this._dataSourceAtPoint(sr.x,sr.y);this._updateHoveredSource(e,(0,Vs.globalEnvironmentState)())}if(this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left"),t),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right"),t),i===ao.InvalidationLevel.None)return;const s=this._state&&(this._state.maximized().value()||!this._state.collapsed().value()||this._state.mode()===zi.PaneMode.Widget);if(i>ao.InvalidationLevel.Cursor){const e=(0,n.ensureNotNull)(this._canvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,Kt.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(t),this._drawBackground(e,t),s&&this._drawSources(e,t)}if(null!==this._state){const e=(0,n.ensureNotNull)(this._topCanvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,Kt.getBindingRenderingInfo)(this._topCanvasBinding);e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height),s&&this._drawTopViews(e,t),this._drawCrossHair(e,t),s&&this._drawActiveLineTools(e,t)}}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0&&!(0,Lt.isLineDrawnWithPressedButton)(t.toolname)){const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(),this._clearCursorPosition(),this.setCursorForTool()}async drawRightThere(e,t){this.hasState()&&(await(0,xo.ensureLineToolLoaded)(e),this._chartUndoModel().drawRightThere(e,this.state(),void 0,t))}cancelMeasuring(){this._chartUndoModel().crosshairSource().clearMeasure(),(0,mt.resetToCursor)(),this.setCursorForTool()}async setErrorMessage(e){e&&!this._errorRenderer&&(this._errorRenderer=this._createErrorBlock()),(await this._errorRenderer)?.update({message:e?.message,icon:this._state?.containsMainSeries()||this._state?.maximized().value()?e?.icon:void 0,backgroundColor:`linear-gradient(${this._chartModel().backgroundTopColor().value()}, ${this._chartModel().backgroundColor().value()})`,textColor:this._chartModel().dark().value()?zn:Hn,solutionId:e?.solutionId,rawHtml:e?.rawHtml,buttons:this.containsMainSeries()?e?.buttons:void 0,maxWidth:e?.maxWidth,maxHeight:e?.maxHeight,zeroHeight:e?.zeroHeight})}collapsedHeight(){return Math.max(Math.ceil(this._paneControls?.bottomWithMargin()??0),33)}visuallyCollapsed(){return this._visuallyCollapsed.readonly()}maximized(){return this._maximized.readonly()}setCursorPosition(e,t,i){this._updateLastCrosshairPosition(e,t,i),this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,o){return!(!(0,mt.toolIsMeasure)(mt.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,i),
-s=this._chartModel().magnet().align(s,o,this.state()),t.startMeasuring({price:s,index:o},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?(0,mt.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const o=this._chart.model().model().zoomEnabled();if("zoom"===mt.tool.value()&&o){const o=this._chartUndoModel(),n=o.timeScale().indexToCoordinate(i)-.5*o.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,s),this._chartModel().crosshairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),s=(0,n.ensureNotNull)(t.mainDataSource()).firstValue(),o=i.coordinateToPrice(e.localY,(0,n.ensureNotNull)(s)),r=this._chartUndoModel(),a=Math.round(r.timeScale().coordinateToIndex(e.localX)),l=(0,n.ensureNotNull)(this._firstZoomPoint);a!==l.index&&r.zoomToViewport(l.index,a,l.price,o,t),this._chartModel().crosshairSource().clearSelection(),this._firstZoomPoint=null,(0,mt.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if((0,mt.toolIsEraser)(mt.tool.value())&&!e.isCustom&&(!(i=e.source)||!i.customization||!i.customization.disableErasing)){const i=this._chartUndoModel();if((0,zs.isLineTool)(e.source)||(0,Ws.isStudy)(e.source)){const s=e.hittest.eraseMarker();return t.mod()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1}_tryStartChangingLineTool(e,t,i,s){if(e.isTouch&&null!==this._startTrackPoint)return!1;const o=t.hittest;if((!e.isTouch||!this._preventSourceChange)&&o&&(0,zs.isLineTool)(t.source)&&o.target()===Ut.HitTarget.ChangePoint){const r=this._chartUndoModel(),a=(0,n.ensure)(this.state().mainDataSource()?.firstValue()),l=o.data()?.ownerSourceId,c=(0,n.ensureNotNull)(l?this._chartModel().dataSourceForId(l):t.source.ownerSource()),h=(0,n.ensureNotNull)(c.priceScale()).coordinateToPrice(e.localY,a);r.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(t.source,o.data())}));let d=h;t.source.priceScale()===r.mainSeries().priceScale()&&(d=r.model().magnet().align(h,s,this.state()));const u=o.data()?.nonDiscreteIndex;u&&(s=r.timeScale().coordinateToFloatIndex(e.localX));const _=o.data()?.pointIndex;return this._startChangeLineToolParams={source:t.source,ownerSource:c,startPoint:{index:s,price:d,nonDiscreteIndex:u},screenPoint:{x:e.localX,y:e.localY},pointIndex:_,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.mod()){const t=this._chartUndoModel().selection().dataSources().filter((e=>e.cloneable()));if(s&&s.cloneable()&&t.push(s),
-t.length>0)return this._clonningAtMoveLineTools=t.map((e=>e.id())),this._startCloningPoint=new Vt.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t,i){const s=this._chartUndoModel(),o=this._chartModel();if(t.mod()&&this._clonningAtMoveLineTools){const r=new Vt.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(this._startCloningPoint).subtract(r).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=o.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const o=this.cloneLineTools(l,!0).map((e=>(0,n.ensureNotNull)(s.model().dataSourceForId(e))));s.selectionMacro((e=>{e.clearSelection();let t=null;o.forEach((s=>{null===t&&(t=Xn(i,s)),e.addSourceToSelection(s,t)}))}));const r=new Vt.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(o[0].priceScale()),c=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:s.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,(0,n.ensureNotNull)(c))};s.startMovingSources(o,{logical:h,screen:r},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){const o=mt.tool.value();if(!this.hasState()||(0,Lt.isLineToolDrawWithoutPoints)(o)||this.state().mode()===zi.PaneMode.Widget)return;const r=this._chartUndoModel();let a=!1,l=null;(0,mt.hideAllDrawings)().value()&&(0,Ss.toggleHideMode)(),(0,mt.lockDrawings)().setValue(!1),e.isTouch&&!e.stylus&&((0,Lt.isLineToolName)(o)&&!(0,Lt.isLineDrawnWithPressedButton)(o)||r.lineBeingCreated())&&this._initToolCreationModeParams(e);const c=r.lineBeingCreated();if(c&&!(0,Lt.isLineDrawnWithPressedButton)(c.toolname)){const o=(0,n.ensure)(c.ownerSource()?.firstValue());if(e.isTouch&&!e.stylus){if(!this._startTouchPoint){this._startTouchPoint=new Vt.Point(e.pageX,e.pageY);const t=c.points(),i=t[t.length-1],s=r.timeScale().indexToCoordinate(i.index),a=(0,n.ensureNotNull)(c.priceScale()).priceToCoordinate(i.price,o);return void(this._initCrossHairPosition=new Vt.Point(s,a))}}else if(!e.isTouch){l=c;const h=r.model().paneBeingCreatedLineOn();if(h!==this._state&&null!==h){const i=this._externalPaneXCoord(h,e.localX),s=this._externalPaneYCoord(h,e.localY);a=r.continueCreatingLine({index:Math.round(r.timeScale().coordinateToIndex(i)),price:(0,n.ensure)(c.priceScale()?.coordinateToPrice(s,o))},t)}else{const e=r.model().magnet().align(s,i,this.state());a=r.continueCreatingLine({index:i,price:e},t)}}}else{const t=(0,Lt.isLineDrawnWithPressedButton)(o);if(!e.isTouch||e.stylus||t){const e=null===c||(0,zs.isBrushBasedLineTool)(c)&&c.hasOnlyOnePoint(),n={index:i,price:t&&!e?s:r.model().magnet().align(s,i,this.state())};l=r.createLineTool({pane:this.state(),point:n,linetool:o,actionSource:"Draw"}),this._mouseTouchDownUpInfo&&(this._mouseTouchDownUpInfo.toolCreation=!0),r.lineBeingCreated()||(a=!0)}}const h=this._dataSourceAtPoint(e.localX,e.localY);l&&r.selectionMacro((e=>{e.addSourceToSelection((0,n.ensureNotNull)(l),h?.hittest.data())})),a&&l&&(this._finishTool(l,h),e.preventDefault())}
-_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let o=null;return(null===t||t.source.isSelectionEnabled())&&s.selectionMacro((s=>{!this._preventSourceChange&&null!==t&&(e.isTouch?t.hittest.target()>=Ut.HitTarget.MovePointBackground:t.hittest.target()>Ut.HitTarget.MovePointBackground)?(i.mod()||s.selection().isSelected(t.source)||s.clearSelection(),i.mod()&&s.selection().isSelected(t.source)?(o=t.source,s.removeSourceFromSelection(t.source)):s.addSourceToSelection(t.source,t.hittest.data()),s.selection().allSources().length>1&&(0,re.trackEvent)("GUI","Multiselect","Click Select")):i.mod()||(s.clearSelection(),this._clonningAtMoveLineTools=null,this._startCloningPoint=null)})),o}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,t)}_updateCommonTooltip(e,t){let i=null;if(null!==e&&null!==e.hittest){const t=e.hittest.data();t&&(i=t.tooltip||null)}if(null===this._prevTooltipData&&null===i)return;if(null===i||""===i.text)return this._prevTooltipData=null,void(0,En.hide)(t);if(this._prevTooltipData&&(0,Ot.default)(i,this._prevTooltipData))return;this._prevTooltipData=i;const s=(0,tt.clone)(i);if(void 0!==s.rect){const e=this._paneCell.getBoundingClientRect();s.rect.x+=e.left,s.rect.y+=e.top}(0,En.show)(s)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e).setCursorPosition(t,i,s)}_updateLastCrosshairPosition(e,t,i){const s=this.state().id();sr={x:e,y:t,envState:i,stateId:s}}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){const t=this._dataSourceAtPoint(e.localX,e.localY);if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseUpOrTouchEndHandler(e,{sourceWasSelected:i})}}_crossHairShouldBeVisible(){const e=this._chartModel().crosshairSource();return(0,Lt.isLineToolName)(mt.tool.value())||(0,mt.toolIsMeasure)(mt.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){sr=null,this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){if(!this.hasState())return null;const i={result:null},s=this._chartUndoModel();if((0,Lt.isLineToolName)(mt.tool.value())||null!==s.lineBeingCreated())return i.result;if(this._currentChangingLineToolHitTest)return this._currentChangingLineToolHitTest;const o=new Set;if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()){if(!this._currentMovingHitTest.cancelledContainer?.cancelled)return this._currentMovingHitTest.sourceAtPoint;o.add(this._currentMovingHitTest.sourceAtPoint.source.id())}
-if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()&&!this._currentMovingHitTest.cancelledContainer?.cancelled)return this._currentMovingHitTest.sourceAtPoint;const n=this.state(),r=(0,Kt.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(r);const a=Jn.bind(null,i),l=new Vt.Point(e,t);if(!n.maximized().value()&&n.collapsed().value()||(0,lo.lastMouseOrTouchEventInfo)().isTouch&&(mt.activePointSelectionMode.value()!==mt.SelectPointMode.None||null!==this._startTrackPoint))return this._hitTestSources(r,[s.crosshairSource()],l,a,!1,o),i.result;const c=n.sourcesByGroup(),h=s.selection(),d=h.dataSources().filter((e=>e.isMultiPaneEnabled()||s.paneForSource(e)===n));this._hitTestSources(r,d,l,a,!1,o),this._hitTestSources(r,h.customSources(),l,a,!0,o),h.allSources().forEach((e=>o.add(e.id()))),this._hitTestSources(r,[s.crosshairSource()],l,a,!1,o),this._hitTestSources(r,n.customSources(Co.CustomSourceLayer.Topmost),l,a,!0,o),this._hitTestSources(r,c.tradingSources(),l,a,!1,o),this._hitTestSources(r,n.customSources(Co.CustomSourceLayer.Foreground),l,a,!0,o);const u=c.hitTestSources();if(this._hitTestSources(r,u,l,a,!1,o),this.containsMainSeries()){const e=s.activeStrategySource().value();if(null!==e&&!o.has(e.id())){const t=e.strategyOrdersPaneView();if(null!==t){const s=t.renderer(r);if(null!==s){const t=s.hitTest(l,r);t&&Jn(i,t,e,s,!1)}}}}return null===i.result&&this._hitTestSources(r,n.customSources(Co.CustomSourceLayer.Background),l,a,!0,o),i.result}_sourceWasSelected(e){return!!e&&this._selectionBeforeMouseDown.has(e.source)}_hitTestSources(e,t,i,s,o,r){const a=(0,n.ensureNotNull)(this._state);for(let n=t.length-1;n>=0;--n){const l=t[n];if(r.has(l.id()))continue;const c=l.paneViews(a);if(null!==c&&0!==c.length)for(let t=c.length-1;t>=0;--t){const n=c[t].renderer(e);if(n&&n.hitTest){const t=n.hitTest(i,e);null!==t&&s(t,l,n,o)}}}}_tryStartMovingLineTool(e,t,i,s){if(null===t.source||!t.source.movable()||null!==this._startTrackPoint)return!1;if(!this._preventSourceChange){const o=this._chartUndoModel(),r=(0,n.ensureNotNull)((0,n.ensureNotNull)(this._state).mainDataSource()).firstValue(),a=(0,n.ensureNotNull)(t.source.priceScale()),l=null===r?NaN:a.coordinateToPrice(e.localY,r);let c=(t.source.isSelectionEnabled()?o.selection().allSources():[t.source]).filter(Bn);const h=c.filter((e=>(0,zs.isLineTool)(e)&&!e.isSourceHidden()));c=h.length>0?h:c.includes(t.source)?[t.source]:[c[0]];const d=new Vt.Point(e.localX,e.localY),u={index:s,price:l},_=t.hittest.data()?.activeItem;return this._startMoveSourceParams={source:c,startPoint:{logical:u,screen:d},activeItem:void 0===_?null:_,envState:i},!0}return this._startMoveSourceParams=null,!1}_chartModel(){return this._chart.model().model()}_chartUndoModel(){return this._chart.model()}_externalPaneXCoord(e,t){t+=this._div.getBoundingClientRect().left+document.body.scrollLeft;const i=(0,n.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().left+document.body.scrollLeft;return i._correctXCoord(t-s)}
-_externalPaneYCoord(e,t){t+=this._div.getBoundingClientRect().top+document.body.scrollTop;const i=(0,n.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().top+document.body.scrollTop;return i._correctYCoord(t-s)}_correctXCoord(e){return Math.max(0,Math.min(e,this._size.width-1))}_correctYCoord(e){return Math.max(0,Math.min(e,this._size.height-1))}_processScroll(e){if(!this._chart.model().model().scrollEnabled())return;const t=performance.now();this._startScrollingPos||this._preventScroll()||(this._startScrollingPos={x:e.clientX,y:e.clientY,timestamp:t,localX:e.localX,localY:e.localY});const i=this._chartUndoModel();let s=this.state().defaultPriceScale();if(this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==e.clientX||this._startScrollingPos.y!==e.clientY))return i.beginUndoMacro(Un),null===this._scrollXAnimation&&this._options.useKineticScroll&&(this._scrollXAnimation=new bn(.2,7,.997,15),this._scrollXAnimation.addPosition(e.clientX,this._startScrollingPos.timestamp)),i.selection().isEmpty()||(s=i.selection().allSources()[0].priceScale()),null===s||s.isEmpty()||(this._scrollPriceScale=s,i.startScrollPrice(this.state(),s,e.localY)),i.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool(),void this._paneWidgetsSharedState.setScrollingPane(this);this._isScrolling&&(null!==this._scrollPriceScale&&i.scrollPriceTo(this.state(),this._scrollPriceScale,e.localY),i.scrollTimeTo(e.localX),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(e.clientX,t))}_finishScroll(){const e=this._chartUndoModel();e.endScrollTime(),null!==this._scrollPriceScale&&e.endScrollPrice(this.state(),this._scrollPriceScale),e.endUndoMacro(),this._isScrolling=!1,this._startScrollingPos=null,this._scrollPriceScale=null,this.setCursorForTool(),this._paneWidgetsSharedState.setScrollingPane(null)}_endScroll(e){if(!this._isScrolling)return!1;this._finishScroll();const t=this._scrollUndoCommandInStack(),i=performance.now();return null!==this._scrollXAnimation&&(this._scrollXAnimation.start(e.clientX,i),this._scrollXAnimation.finished(i)||(this._chartModel().stopTimeScaleAnimation(),this._chartModel().setTimeScaleAnimation(this._scrollXAnimation),this._scrollXAnimation=null)),t}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||(0,Lt.isLineToolName)(mt.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint||this._preventScrollUntilNextMouseDownOrTouchStart}_isSelectPointModeEnabled(){return this._chartUndoModel().crosshairSource().selectPointMode().value()!==mt.SelectPointMode.None}_preventCrossHairMove(){return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e,t=null){const i=this._chartUndoModel(),s=e.toolname;if(s===mt.tool.value()&&(0,mt.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),
-i.selectionMacro((i=>{i.addSourceToSelection(e,Xn(t,e))})),(0,zs.isEditableTextLineTool)(e)&&e.activateEditingOnCreation())e.activateTextEditingOn(this._div,!0);else if((0,Lt.isTextToolName)(s)){const t=i.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,Ns.TabNames.text,void 0,t)}this._lastFinishedToolId=e.id(),(0,ee.emit)("drawing_event",e.id(),"create"),kn()}_alignSourcesThatBeingMoved(e,t,i,s,o){const n=this._chartUndoModel(),r=2===o?NaN:n.timeScale().coordinateToIndex(t);n.model().sourcesBeingMoved().forEach((e=>{let a=r,l=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());if(null===l){if(1!==o)return;l=NaN}if((0,Ws.isStudy)(e)){const e=n.mainSeries(),t=e.bars().firstIndex(),i=e.bars().lastIndex();null!==t&&null!==i&&2!==o&&(a=Math.min(Math.max(r,t),i)),1!==o&&(l=this._chartModel().magnet().align(l,r,this.state()))}null!==this._currentMovingHitTest&&void 0!==this._currentMovingHitTest.sourceAtPoint.hittest.data()?.cursorType||this.setCursorForTool(),n.moveSources({screen:new Vt.Point(t,i),logical:{index:a,price:l}},s)}))}_resetMeasureIfRequired(){this._needResetMeasureLater&&((0,mt.resetToCursor)(),this._needResetMeasureLater=!1)}_makeSureIsUpdated(e){const t=this.state(),i=[...t.dataSources(),...t.customSources()];for(const s of i){const i=s.paneViews(t);if(null!==i)for(const t of i)t.makeSureIsUpdated?.(e)}}_drawBackground(e,t){const i=this._chartModel(),s=i.backgroundTopColor().value(),o=i.backgroundColor().value();if(this._state?.mode()===zi.PaneMode.Widget){const i=this._state?.model().panes().indexOf(this._state)??0,n=this._state?.model().mainPane(),r=i>(n?this._state?.model().panes().indexOf(n)??0:0)?o:s;(0,Kt.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,r)}else s===o?(0,Kt.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,o):(0,$t.clearRectWithGradient)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,s,o)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;if(!this.state().containsMainSeries())return;const s=i.paneViews();for(const i of s){e.save();const s=i.renderer(t);s&&s.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crosshairSource();i.invalidateLockPosition(),i.visible||null===mt.crosshairLock.value()||i.updateAllViews((0,wi.sourceChangeEvent)(i.id())),this._drawSourceImpl(e,t,$n,qn,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved(),i.customSourceBeingMoved()].filter((e=>!!e));for(const o of s){(i.paneForSource(o)===this.state()||(0,Po.isDataSource)(o)&&o.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,$n,qn,o)}}_drawTopViews(e,t){for(const i of this.state().sourcesByGroup().all())i.topPaneViews&&this._drawSourceImpl(e,t,Kn,qn,i)}_drawSources(e,t){
-const i=this.state(),s=i.model(),o=i.sourcesByGroup(),n=o.tradingSources(),r=o.generalSources(),a=o.phantomSources(),l=i.customSources(Co.CustomSourceLayer.Background).slice(),c=i.customSources(Co.CustomSourceLayer.Foreground).slice(),h=i.customSources(Co.CustomSourceLayer.Topmost).slice(),d=s.activeStrategySource().value(),u=s.replayStudyStrategy().value();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,$n,qn,s.gridSource()),this._drawWatermark(e,t);for(const i of l)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of r)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of c)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of a)this._drawSourceImpl(e,t,$n,Gn,i);const _=new Set;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved(),s.customSourceBeingMoved()].filter(tt.notNull).forEach((e=>_.add(e.id())));let p=s.hoveredSource();null!==p&&((0,Po.isDataSource)(p)&&!p.showOnTopOnHovering()||_.has(p.id())||(0,Po.isDataSource)(p)&&!r.includes(p)?p=null:_.add(p.id()));const m=s.selection().allSources().filter((e=>!((0,Po.isDataSource)(e)&&!r.includes(e))&&!_.has(e.id())));m.forEach((e=>_.add(e.id())));for(const i of l)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of r)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of c)this._drawSourceImpl(e,t,$n,qn,i,_);d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Zn,qn,d,_),u&&this._drawSourceImpl(e,t,Zn,qn,u,_);for(const i of n)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of h)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of r)this._drawSourceImpl(e,t,Yn,qn,i,_);for(const i of c)this._drawSourceImpl(e,t,Yn,qn,i,_);for(const i of n)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of h)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of m)this._drawSourceImpl(e,t,$n,qn,i),i===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Zn,qn,d);for(const i of m)this._drawSourceImpl(e,t,Yn,qn,i);p&&(this._drawSourceImpl(e,t,$n,qn,p),p===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Zn,qn,d),this._drawSourceImpl(e,t,Yn,qn,p));for(const i of a)this._drawSourceImpl(e,t,$n,qn,i,_);{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,o,n){if(n&&n.has(o.id()))return;const r=i(o,this.state());if(r)for(const i of r){const o=i.renderer(t);o&&(e.save(),s(o,e,t),e.restore())}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof rt))return!1;if(t.isEmpty())return!1;return t.commands()[0]instanceof xn}_onStateDestroyed(){this.setState(null)}_onDataSourcesCollectionChanged(){this._startMoveSourceParams=null}_processMouseEnterLeaveMoveHandlers(e,t){
+this._onShiftKeyStateChangedListener=this._onShiftKeyStateChanged.bind(this),this._currentCursorClassName="",this._lastFinishedToolId=null,this._needResetMeasureLater=!1,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._prevTooltipData=null,this._errorRenderer=null,this._highlightedPriceAxises=new wo.WatchedObject([]),this._visuallyCollapsed=new O.WatchedValue(!1),this._maximized=new O.WatchedValue(!1),this._endOfSeriesDataBanner=null,this._selectionBeforeMouseDown=new WeakSet,this._mouseTouchDownUpInfo=null,this._ignoringMouseMovement=!1,this._canvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._updateVisuallyCollapsed=()=>{this._visuallyCollapsed.setValue(!this.state().maximized().value()&&this.state().collapsed().value())},this._updateMaximized=()=>{this._maximized.setValue(this.state().maximized().value())},this._chart=e,this._state=t,this._options=(0,tt.merge)((0,tt.clone)(Qn),i),this._paneWidgetsSharedState=s,this._state&&this._subscribeToState();const o={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(o.contextMenu=this._options.priceScaleContextMenu);const r=(e,t,i,s,n)=>new yn(this._chart,this,this._chartUndoModel(),i,t,e,o,s,n),a=e.properties().childs().scalesProperties,c=this._chartModel().rendererOptionsProvider(),h={backgroundBasedTheme:e.backgroundBasedTheme().spawnOwnership(),stubContextMenuProvider:()=>Promise.resolve([]),titlesProvider:()=>[],rendererOptionsProvider:c,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value(),requestRepaint:()=>this._chartModel().lightUpdate()};this._rowElement=document.createElement("div"),this._rowElement.style.display="flex";const d={showLabels:!1};this._lhsPriceAxisesContainer=t.mode()===zi.PaneMode.Regular?new Vo(a,"left",r,h,d):new PaneWidgetSideArea(c,"left"),this._rhsPriceAxisesContainer=t.mode()===zi.PaneMode.Regular?new Vo(a,"right",r,h,d):new PaneWidgetSideArea(c,"right"),this._paneCell=document.createElement("div"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._div.setAttribute("data-name","pane-widget-chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=(0,Kt.createBoundCanvas)(this._div,(0,Ft.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const u=this._canvasBinding.canvasElement;u.style.position="absolute",u.style.left="0",u.style.top="0",u.dataset.name="pane-canvas",this._topCanvasBinding=(0,
+Kt.createBoundCanvas)(this._div,(0,Ft.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const _=this._topCanvasBinding.canvasElement;_.style.position="absolute",_.style.left="0",_.style.top="0",_.dataset.name="pane-top-canvas",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),u.setAttribute("aria-hidden","true");const p=this._chartModel().mainSeries();p.dataEvents().symbolResolved().subscribe(this,this._updateAccessibilityAttr),this._mainSeriesInterval=p.intervalObj().spawn(),this._mainSeriesInterval.subscribe(this._updateAccessibilityAttr.bind(this)),this._updateAccessibilityAttr(),this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(this._state),(0,Dn.magnetEnabled)().subscribe(this._onMagnetStateChangedListener),(0,Vs.shiftPressed)().subscribe(this._onShiftKeyStateChangedListener),l.enabled("chart_drag_export")&&(_.draggable=this._chartModel().dragExportEnabled().value(),this._chartModel().dragExportEnabled().subscribe((e=>{_.draggable=e})),_.addEventListener("dragend",(e=>{this._ignoringMouseMovement=!1,this._chartModel().dragExportEnabled().value()&&(0,ee.emit)("dragend")})),_.addEventListener("dragstart",(async e=>{if(this._ignoringMouseMovement=!1,!this._chartModel().dragExportEnabled().value())return void e.preventDefault();e.stopPropagation();const t=this._chartUndoModel().model().hoveredSource(),i=Nn(),s={enableDragDrop:!1};if((0,ee.emit)("dragstart",{enableDragDrop:e=>s.enableDragDrop=e,preventDefault:()=>e.preventDefault(),keys:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey},hoveredSourceId:t?.id()??null,exportData:e=>{const t=e=>s().convertPublicTimeToInternalTime(e),s=()=>(0,On.getChartWidgetApiTimeConverter)(p.interval(),(0,n.ensureNotNull)(p.symbolInfo(),"main series symbol info"),this._chartModel());return void 0!==e?.from&&(e.from=t(e.from)),void 0!==e?.to&&(e.to=t(e.to)),i?.exportData(this._chartModel(),e)},setData:(t,i)=>{e.dataTransfer&&e.dataTransfer.setData(t,i)},setDragImage:(t,i,s)=>{e.dataTransfer&&e.dataTransfer.setDragImage(t,i,s)}}),!e.dataTransfer?.getData("text/plain")&&!e.dataTransfer?.getData("text/html"))return void e.preventDefault();this._isSelecting=!1;this._chartModel().crosshairSource().clearSelection(),this._paneWidgetsSharedState.clearDraggingSource(),this._ignoringMouseMovement=!0}))),this.setCursorForTool(),this._mouseEventHandler=new Wt.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag,shouldAllowTouchDrag:()=>this.trackingModeEnabled()}),
+this._paneCellMouseEventHandler=new Wt.MouseEventHandler(this._paneCell,{doubleTapEvent:this._paneDblClickOrTapEvent.bind(this),mouseDoubleClickEvent:this._paneDblClickOrTapEvent.bind(this)},{shouldAllowTouchDrag:()=>this.trackingModeEnabled(),treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag}),this._prevHoveredHittest=null,this._highlightedPriceAxises.subscribe((e=>{this._highlightPriceAxisesByLabel(e.map((e=>e.axis)))})),this._prevPinchScale=0,this._isDestroyed=!1;const m=(0,ft.combine)((e=>{const t=this._chart.paneWidgetSeparators(this);return[t.separatorAbove?.selected()?.weakReference()??new O.WatchedValue(!1).ownership(),t.separatorBelow?.selected()?.weakReference()??new O.WatchedValue(!1).ownership()]}),this._chart.paneWidgetsWV().weakReference());this._anySeparatorSelected=(0,ft.accumulate)((e=>e.some(Boolean)),m.ownership())}destroy(){this._chart.onPaneWidgetDestroyed(this);this._chartModel().mainSeries().dataEvents().symbolResolved().unsubscribeAll(this),this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&this._unsubscribeFromState(),(0,Dn.magnetEnabled)().unsubscribe(this._onMagnetStateChangedListener),(0,Vs.shiftPressed)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this),this._errorRenderer&&this._errorRenderer.then((e=>{e.destroy(),this._errorRenderer=null})),this._prevHoveredHittest=null,this._mouseEventHandler.destroy(),this._paneCellMouseEventHandler.destroy(),this._rowElement.parentElement?.removeChild(this._rowElement),this._anySeparatorSelected.destroy(),this._mainSeriesInterval.destroy(),this._isDestroyed=!0}updateOptions(e){if((0,tt.merge)(this._options,e),!1===e.legendWidgetEnabled&&this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),e.legendWidgetEnabled&&!this._legendWidget&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),!this._state)return;const t=this._state.mode(),i=this._chartModel().rendererOptionsProvider();if(t===zi.PaneMode.Regular&&!(this._lhsPriceAxisesContainer instanceof Vo)){this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy();const e={showLabels:!1},t={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,
+mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks},s=(e,i,s,o,n)=>new yn(this._chart,this,this._chartUndoModel(),s,i,e,t,o,n),o=this._chart.properties().childs().scalesProperties,n=()=>this._chartModel().backgroundColor().value(),r=()=>this._chartModel().backgroundTopColor().value(),a={backgroundBasedTheme:this._chart.backgroundBasedTheme().spawnOwnership(),stubContextMenuProvider:()=>Promise.resolve([]),titlesProvider:()=>[],rendererOptionsProvider:i,getBackgroundTopColor:r,getBackgroundBottomColor:n,requestRepaint:()=>this._chartModel().lightUpdate()};this._lhsPriceAxisesContainer=new Vo(o,"left",s,a,e),this._rhsPriceAxisesContainer=new Vo(o,"right",s,a,e),this._rowElement.innerHTML="",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement())}t!==zi.PaneMode.Widget||this._lhsPriceAxisesContainer instanceof PaneWidgetSideArea||(this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this._lhsPriceAxisesContainer=new PaneWidgetSideArea(i,"left"),this._rhsPriceAxisesContainer=new PaneWidgetSideArea(i,"right"),this._rowElement.innerHTML="",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()))}size(){return this._size}setSize(e){(0,Ft.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._paneCell.style.width=e.width+"px",this._paneCell.style.height=e.height+"px",this._div.style.width=e.width+"px",this._div.style.height=e.height+"px",this._rowElement.classList.toggle("js-hidden",0===e.height),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.width))}width(){return this._size.width}height(){return this._size.height}backgroundColor(){return this._chartModel().backgroundColor().value()}highlightedPriceAxises(){return this._highlightedPriceAxises}processDoubleClickOnSource(e,t,i){if((0,zs.isEditableTextLineTool)(e)){const t=e.textEditingActivationTime();null!==t&&performance.now()-t<500&&e.deactivateTextEditing()}(0,Po.isDataSource)(e)&&e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}stretchFactor(){return this._state?this._state.stretchFactor():0}setStretchFactor(e){this.hasState()&&this.state().setStretchFactor(e)}setCursorForTool(e,t,i){if(t&&t.mod()&&e&&e!==this._chartModel().crosshairSource())return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case ei.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ei.PaneCursorType.HorizontalResize:
+this._setCursorClassName("ew-resize");break;case ei.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ei.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case ei.PaneCursorType.Default:this._setCursorClassName("default");break;case ei.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case ei.PaneCursorType.Grabbing:this._setCursorClassName("grabbing");break;case ei.PaneCursorType.Text:this._setCursorClassName("text");break;case ei.PaneCursorType.None:this._setCursorClassName("none")}return}const s=mt.tool.value();if((0,mt.toolIsCursor)(s)){if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}let o="";switch(s){case"eraser":o="eraser";break;case"zoom":o="zoom-in"}if(!o)switch(mt.cursorTool.value()){case"arrow":o="default";break;case"dot":o="dot";break;case"demonstration":o="demonstration";break;case"performance":o="performance"}this._setCursorClassName(o)}showContextMenuForSelection(e,t,i){const s=this._chartUndoModel().selection();if(s.isEmpty())return;const o=s.dataSources().filter((e=>e.hasContextMenu()));this.showContextMenuForSources(o,e,void 0,t,i)}async showContextMenuForSources(e,t,i,s,o){if(!e.length||!this._state)return Promise.resolve(null);const{ActionsProvider:n}=await(0,Go.actionsProviderModule)();if(this._isDestroyed)return null;const r=e[0],a=(0,tt.merge)((0,tt.clone)(this._options.contextMenu),i||{}),l=new n(this._chart,a);if(r===this._chartUndoModel().crosshairSource())return r.handleContextMenuEvent(t),Promise.resolve(null);{const i=await l.contextMenuActionsForSources(e,this._state,t,s?.origin,o?.data()?.customActions);if(0===i.length)return Promise.resolve(null);{let e={menuName:""};return r instanceof Vn.Series?e={menuName:s?.origin??"ObjectTreeContextMenu",detail:{type:"series",id:r.instanceId()}}:(0,zs.isLineTool)(r)?e={menuName:s?.origin??"ObjectTreeContextMenu",detail:{type:"shape",id:r?.id()??null}}:(0,Ws.isStudy)(r)&&(e={menuName:s?.origin??"ObjectTreeContextMenu",detail:{type:"study",id:r?.id()||null}}),Io.ContextMenuManager.createMenu(i,{takeFocus:!0,returnFocus:!0,isKeyboardEvent:a.isKeyboardEvent,statName:r.contextMenuStatName()},e).then((e=>(e.show(t),e)))}}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return(0,n.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&(this._unsubscribeFromState(),this._paneControls?.destroy(),this._paneControls=null),this._state=e,this.hasState()&&(this.updateOptions(this._options),this._subscribeToState(),this._loadAndCreatePaneControlsWidget(this.state()),this.updatePriceAxisWidgetsStates(),
+this._updateAccessibilityAttr()))}getScreenshotData(e){const t=[],i=[];let s,o=[];const n=this.state(),r=n.mode()===zi.PaneMode.Widget?[]:n.sourcesByGroup().priceSources().slice().reverse(),a=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();for(const c of r){const r=c.statusView();if((0,Ws.isStudy)(c)&&(a.showLegend.value()||e?.showCollapsedStudies)){const s=a.showStudyTitles.value(),o=s;if(c.properties().childs().visible.value()&&this._chartModel().paneForSource(c)===n&&r&&o){t.push(s?c.statusProvider(e?.status).text():"");const o=l.enabled("use_last_visible_bar_value_in_legend")?this._chartModel().timeScale().visibleBarsStrictRange()?.lastBar()??null:null,n=c.legendValuesProvider().getValues(o);i.push(n)}}else if(c===this._chartModel().mainSeries()&&r&&a.showSeriesTitle.value()){const t=c.statusProvider(e?.status||{}).getSplitTitle();s=Object.values(t).filter((e=>""!==e)).join(" · ");const i=l.enabled("use_last_visible_bar_value_in_legend")?this._chartModel().timeScale().visibleBarsStrictRange()?.lastBar()??null:null;o=c.legendValuesProvider().getValues(i)}}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this._size.width,contentHeight:this._size.height,studies:t,studiesValues:i,containsMainSeries:this.containsMainSeries(),mainSeriesText:s,mainSeriesValues:o}}updatePriceAxisWidgetsStates(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(t)if(this._state?.mode()===zi.PaneMode.Regular){const i=e.priceScaleSlotsCount(),s=this.state(),o=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(o,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}else this._state?.mode()===zi.PaneMode.Widget&&(this._lhsPriceAxisesContainer.setPane(this._state),this._rhsPriceAxisesContainer.setPane(this._state))}updatePriceAxisWidgets(){this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update()}update(){this.hasState()&&(this.updatePriceAxisWidgets(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e){this.hasState()&&null!==this._legendWidget&&(e.legendWidgetLayoutInvalidated()?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e){this._themedTopColor=e.topColor,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvasElement}getRenderingInfo(){return(0,Kt.getBindingRenderingInfo)(this._canvasBinding)}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}pinchStartEvent(){
+return null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),!!this._options.handleScale.pinch&&(this._chartModel().stopTimeScaleAnimation(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this),!0))}pinchEvent(e,t,i,s){if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return;const o=10*(s-this._prevPinchScale);this._prevPinchScale=s,this._chartModel().zoomTime(e.x,o,!0),this._prevPinchScale=s}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){this._onMouseEvent(),this.hasState()&&this._mouseDownOrTouchStartEvent(e,this._dataSourceAtPoint(e.localX,e.localY))}touchStartEvent(e){if(this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch())return;const t=!this._trackCrosshairOnlyAfterLongTap&&null!==sr&&sr.stateId===this.state().id()&&Math.abs(sr.x-e.localX)+Math.abs(sr.y-e.localY)<5;this._onTouchEvent(),this._chart.setActivePaneWidget(this);const i=this._dataSourceAtPoint(e.localX,e.localY);if(t){const t=this._chartModel().crosshairSource();null!==i&&i.source===t||t.selectPointMode().value()!==mt.SelectPointMode.None?this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(e.localX,e.localY)):!this._chart.readOnly()&&null!==i&&(0,zs.isLineTool)(i.source)&&i.source.userEditEnabled()&&this._chartUndoModel().selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(i.source,i.hittest.data())}))}this._mouseDownOrTouchStartEvent(e,i),this._mouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._state?.model().chartFloatingTooltipVisible().value()?this._mouseOrTouchMoveEvent(e):this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._updateHoveredSource(null,new To.EnvironmentState(e)),this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){if(this._chart.readOnly())return;const t=this._dataSourceAtPoint(e.localX,e.localY);if(null===t||t.isCustom)return;if((t.hittest.target()||0)<=Ut.HitTarget.MovePointBackground)return
+;const i=new To.EnvironmentState(e),s=t.hittest.eraseMarker();if(i.mod()&&void 0!==s&&t.source.processErase)return void t.source.processErase(this._chartUndoModel(),s);const o=this._chartUndoModel();o.selection().isSelected(t.source)||o.selectionMacro((e=>{e.clearSelection();const i=(0,n.ensureNotNull)(t.source);e.addSourceToSelection(i,Xn(t,i))})),this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){if(null===this._state||this._preventTouchEventsExceptPinch())return;if(this._onTouchEvent(),this._longTap=!0,null!==this._startTrackPoint||!this._trackingModeShouldBeActive())return;const t=this._chartModel().selection();if(!t.isEmpty()){const i=this._dataSourceAtPoint(e.localX,e.localY);if(null!==i&&t.isSelected(i.source))return}this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(e.localX,e.localY),new To.EnvironmentState(e))}mouseEnterEvent(e){if(this._onMouseEvent(),!this.hasState())return;this._chart.setActivePaneWidget(this);const t=this._dataSourceAtPoint(e.localX,e.localY);this._updateHoveredSource(t,new To.EnvironmentState(e)),this.setCursorPosition(e.localX,e.localY,new To.EnvironmentState(e))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(e){this._processOutsideClick(null,e)}touchStartOutsideEvent(e){this._processOutsideClick(null,e)}cancelZoom(){this._chartModel().crosshairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this.state().mode()!==zi.PaneMode.Widget&&(this._startChangeLineToolParams=null,this._startMoveSourceParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._chartUndoModel().selectionMacro((e=>e.clearSelection())),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this.setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crosshairSource().currentPoint())}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e,t){if(!this._chartUndoModel()||!this.hasState()||0===this._size.width||0===this._size.height)return;(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding),
+this._state&&(e.priceScaleSideMaxLevel("left")>ao.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>ao.InvalidationLevel.Cursor)&&(this._recalculatePriceScales((0,wi.viewportChangeEvent)(this.state())),null!==sr&&sr.stateId===this.state().id()&&this.setCursorPosition(sr.x,sr.y,sr.envState));const i=e.fullInvalidation();if(i>ao.InvalidationLevel.Cursor&&null!==sr&&sr.stateId===this.state().id()){const e=this._dataSourceAtPoint(sr.x,sr.y);this._updateHoveredSource(e,(0,Vs.globalEnvironmentState)())}if(this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left"),t),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right"),t),i===ao.InvalidationLevel.None)return;const s=this._state&&(this._state.maximized().value()||!this._state.collapsed().value()||this._state.mode()===zi.PaneMode.Widget);if(i>ao.InvalidationLevel.Cursor){const e=(0,n.ensureNotNull)(this._canvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,Kt.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(t),this._drawBackground(e,t),s&&this._drawSources(e,t)}if(null!==this._state){const e=(0,n.ensureNotNull)(this._topCanvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,Kt.getBindingRenderingInfo)(this._topCanvasBinding);e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height),s&&this._drawTopViews(e,t),this._drawCrossHair(e,t),s&&this._drawActiveLineTools(e,t)}}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0&&!(0,Lt.isLineDrawnWithPressedButton)(t.toolname)){const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(),this._clearCursorPosition(),this.setCursorForTool()}async drawRightThere(e,t){this.hasState()&&(await(0,xo.ensureLineToolLoaded)(e),this._chartUndoModel().drawRightThere(e,this.state(),void 0,t))}cancelMeasuring(){this._chartUndoModel().crosshairSource().clearMeasure(),(0,mt.resetToCursor)(),this.setCursorForTool()}async setErrorMessage(e){e&&!this._errorRenderer&&(this._errorRenderer=this._createErrorBlock()),(await this._errorRenderer)?.update({message:e?.message,icon:this._state?.containsMainSeries()||this._state?.maximized().value()?e?.icon:void 0,backgroundColor:`linear-gradient(${this._chartModel().backgroundTopColor().value()}, ${this._chartModel().backgroundColor().value()})`,textColor:this._chartModel().dark().value()?zn:Hn,solutionId:e?.solutionId,rawHtml:e?.rawHtml,buttons:this.containsMainSeries()?e?.buttons:void 0,maxWidth:e?.maxWidth,maxHeight:e?.maxHeight,zeroHeight:e?.zeroHeight})}collapsedHeight(){return Math.max(Math.ceil(this._paneControls?.bottomWithMargin()??0),33)}visuallyCollapsed(){return this._visuallyCollapsed.readonly()}maximized(){return this._maximized.readonly()}setCursorPosition(e,t,i){this._updateLastCrosshairPosition(e,t,i),
+this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,o){return!(!(0,mt.toolIsMeasure)(mt.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,i),s=this._chartModel().magnet().align(s,o,this.state()),t.startMeasuring({price:s,index:o},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?(0,mt.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const o=this._chart.model().model().zoomEnabled();if("zoom"===mt.tool.value()&&o){const o=this._chartUndoModel(),n=o.timeScale().indexToCoordinate(i)-.5*o.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,s),this._chartModel().crosshairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),s=(0,n.ensureNotNull)(t.mainDataSource()).firstValue(),o=i.coordinateToPrice(e.localY,(0,n.ensureNotNull)(s)),r=this._chartUndoModel(),a=Math.round(r.timeScale().coordinateToIndex(e.localX)),l=(0,n.ensureNotNull)(this._firstZoomPoint);a!==l.index&&r.zoomToViewport(l.index,a,l.price,o,t),this._chartModel().crosshairSource().clearSelection(),this._firstZoomPoint=null,(0,mt.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if((0,mt.toolIsEraser)(mt.tool.value())&&!e.isCustom&&(!(i=e.source)||!i.customization||!i.customization.disableErasing)){const i=this._chartUndoModel();if((0,zs.isLineTool)(e.source)||(0,Ws.isStudy)(e.source)){const s=e.hittest.eraseMarker();return t.mod()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1}_tryStartChangingLineTool(e,t,i,s){if(e.isTouch&&null!==this._startTrackPoint)return!1;const o=t.hittest;if((!e.isTouch||!this._preventSourceChange)&&o&&(0,zs.isLineTool)(t.source)&&o.target()===Ut.HitTarget.ChangePoint){const r=this._chartUndoModel(),a=(0,n.ensure)(this.state().mainDataSource()?.firstValue()),l=o.data()?.ownerSourceId,c=(0,n.ensureNotNull)(l?this._chartModel().dataSourceForId(l):t.source.ownerSource()),h=(0,n.ensureNotNull)(c.priceScale()).coordinateToPrice(e.localY,a);r.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(t.source,o.data())}));let d=h;t.source.priceScale()===r.mainSeries().priceScale()&&(d=r.model().magnet().align(h,s,this.state()));const u=o.data()?.nonDiscreteIndex;u&&(s=r.timeScale().coordinateToFloatIndex(e.localX));const _=o.data()?.pointIndex
+;return this._startChangeLineToolParams={source:t.source,ownerSource:c,startPoint:{index:s,price:d,nonDiscreteIndex:u},screenPoint:{x:e.localX,y:e.localY},pointIndex:_,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.mod()){const t=this._chartUndoModel().selection().dataSources().filter((e=>e.cloneable()));if(s&&s.cloneable()&&t.push(s),t.length>0)return this._clonningAtMoveLineTools=t.map((e=>e.id())),this._startCloningPoint=new Vt.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t,i){const s=this._chartUndoModel(),o=this._chartModel();if(t.mod()&&this._clonningAtMoveLineTools){const r=new Vt.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(this._startCloningPoint).subtract(r).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=o.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const o=this.cloneLineTools(l,!0).map((e=>(0,n.ensureNotNull)(s.model().dataSourceForId(e))));s.selectionMacro((e=>{e.clearSelection();let t=null;o.forEach((s=>{null===t&&(t=Xn(i,s)),e.addSourceToSelection(s,t)}))}));const r=new Vt.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(o[0].priceScale()),c=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:s.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,(0,n.ensureNotNull)(c))};s.startMovingSources(o,{logical:h,screen:r},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){const o=mt.tool.value();if(!this.hasState()||(0,Lt.isLineToolDrawWithoutPoints)(o)||this.state().mode()===zi.PaneMode.Widget)return;const r=this._chartUndoModel();let a=!1,l=null;(0,mt.hideAllDrawings)().value()&&(0,Ss.toggleHideMode)(),(0,mt.lockDrawings)().setValue(!1),e.isTouch&&!e.stylus&&((0,Lt.isLineToolName)(o)&&!(0,Lt.isLineDrawnWithPressedButton)(o)||r.lineBeingCreated())&&this._initToolCreationModeParams(e);const c=r.lineBeingCreated();if(c&&!(0,Lt.isLineDrawnWithPressedButton)(c.toolname)){const o=(0,n.ensure)(c.ownerSource()?.firstValue());if(e.isTouch&&!e.stylus){if(!this._startTouchPoint){this._startTouchPoint=new Vt.Point(e.pageX,e.pageY);const t=c.points(),i=t[t.length-1],s=r.timeScale().indexToCoordinate(i.index),a=(0,n.ensureNotNull)(c.priceScale()).priceToCoordinate(i.price,o);return void(this._initCrossHairPosition=new Vt.Point(s,a))}}else if(!e.isTouch){l=c;const h=r.model().paneBeingCreatedLineOn();if(h!==this._state&&null!==h){const i=this._externalPaneXCoord(h,e.localX),s=this._externalPaneYCoord(h,e.localY);a=r.continueCreatingLine({index:Math.round(r.timeScale().coordinateToIndex(i)),price:(0,n.ensure)(c.priceScale()?.coordinateToPrice(s,o))},t)}else{const e=r.model().magnet().align(s,i,this.state());a=r.continueCreatingLine({index:i,price:e},t)}}}else{const t=(0,Lt.isLineDrawnWithPressedButton)(o);if(!e.isTouch||e.stylus||t){const e=null===c||(0,zs.isBrushBasedLineTool)(c)&&c.hasOnlyOnePoint(),n={index:i,price:t&&!e?s:r.model().magnet().align(s,i,this.state())};l=r.createLineTool({
+pane:this.state(),point:n,linetool:o,actionSource:"Draw"}),this._mouseTouchDownUpInfo&&(this._mouseTouchDownUpInfo.toolCreation=!0),r.lineBeingCreated()||(a=!0)}}const h=this._dataSourceAtPoint(e.localX,e.localY);l&&r.selectionMacro((e=>{e.addSourceToSelection((0,n.ensureNotNull)(l),h?.hittest.data())})),a&&l&&(this._finishTool(l,h),e.preventDefault())}_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let o=null;return(null===t||t.source.isSelectionEnabled())&&s.selectionMacro((s=>{!this._preventSourceChange&&null!==t&&(e.isTouch?t.hittest.target()>=Ut.HitTarget.MovePointBackground:t.hittest.target()>Ut.HitTarget.MovePointBackground)?(i.mod()||s.selection().isSelected(t.source)||s.clearSelection(),i.mod()&&s.selection().isSelected(t.source)?(o=t.source,s.removeSourceFromSelection(t.source)):s.addSourceToSelection(t.source,t.hittest.data()),s.selection().allSources().length>1&&(0,re.trackEvent)("GUI","Multiselect","Click Select")):i.mod()||(s.clearSelection(),this._clonningAtMoveLineTools=null,this._startCloningPoint=null)})),o}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,t)}_updateCommonTooltip(e,t){let i=null;if(null!==e&&null!==e.hittest){const t=e.hittest.data();t&&(i=t.tooltip||null)}if(null===this._prevTooltipData&&null===i)return;if(null===i||""===i.text)return this._prevTooltipData=null,void(0,En.hide)(t);if(this._prevTooltipData&&(0,Ot.default)(i,this._prevTooltipData))return;this._prevTooltipData=i;const s=(0,tt.clone)(i);if(void 0!==s.rect){const e=this._paneCell.getBoundingClientRect();s.rect.x+=e.left,s.rect.y+=e.top}(0,En.show)(s)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e).setCursorPosition(t,i,s)}_updateLastCrosshairPosition(e,t,i){const s=this.state().id();sr={x:e,y:t,envState:i,stateId:s}}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){const t=this._dataSourceAtPoint(e.localX,e.localY);if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseUpOrTouchEndHandler(e,{sourceWasSelected:i})}}_crossHairShouldBeVisible(){const e=this._chartModel().crosshairSource();return(0,Lt.isLineToolName)(mt.tool.value())||(0,mt.toolIsMeasure)(mt.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){sr=null,this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){if(!this.hasState())return null;const i={result:null},s=this._chartUndoModel();if((0,Lt.isLineToolName)(mt.tool.value())||null!==s.lineBeingCreated())return i.result;if(this._currentChangingLineToolHitTest)return this._currentChangingLineToolHitTest
+;const o=new Set;if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()){if(!this._currentMovingHitTest.cancelledContainer?.cancelled)return this._currentMovingHitTest.sourceAtPoint;o.add(this._currentMovingHitTest.sourceAtPoint.source.id())}if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()&&!this._currentMovingHitTest.cancelledContainer?.cancelled)return this._currentMovingHitTest.sourceAtPoint;const n=this.state(),r=(0,Kt.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(r);const a=Jn.bind(null,i),l=new Vt.Point(e,t);if(!n.maximized().value()&&n.collapsed().value()||(0,lo.lastMouseOrTouchEventInfo)().isTouch&&(mt.activePointSelectionMode.value()!==mt.SelectPointMode.None||null!==this._startTrackPoint))return this._hitTestSources(r,[s.crosshairSource()],l,a,!1,o),i.result;const c=n.sourcesByGroup(),h=s.selection(),d=h.dataSources().filter((e=>e.isMultiPaneEnabled()||s.paneForSource(e)===n));this._hitTestSources(r,d,l,a,!1,o),this._hitTestSources(r,h.customSources(),l,a,!0,o),h.allSources().forEach((e=>o.add(e.id()))),this._hitTestSources(r,[s.crosshairSource()],l,a,!1,o),this._hitTestSources(r,n.customSources(Co.CustomSourceLayer.Topmost),l,a,!0,o),this._hitTestSources(r,c.tradingSources(),l,a,!1,o),this._hitTestSources(r,n.customSources(Co.CustomSourceLayer.Foreground),l,a,!0,o);const u=c.hitTestSources();if(this._hitTestSources(r,u,l,a,!1,o),this.containsMainSeries()){const e=s.activeStrategySource().value();if(null!==e&&!o.has(e.id())){const t=e.strategyOrdersPaneView();if(null!==t){const s=t.renderer(r);if(null!==s){const t=s.hitTest(l,r);t&&Jn(i,t,e,s,!1)}}}}return null===i.result&&this._hitTestSources(r,n.customSources(Co.CustomSourceLayer.Background),l,a,!0,o),i.result}_sourceWasSelected(e){return!!e&&this._selectionBeforeMouseDown.has(e.source)}_hitTestSources(e,t,i,s,o,r){const a=(0,n.ensureNotNull)(this._state);for(let n=t.length-1;n>=0;--n){const l=t[n];if(r.has(l.id()))continue;const c=l.paneViews(a);if(null!==c&&0!==c.length)for(let t=c.length-1;t>=0;--t){const n=c[t].renderer(e);if(n&&n.hitTest){const t=n.hitTest(i,e);null!==t&&s(t,l,n,o)}}}}_tryStartMovingLineTool(e,t,i,s){if(null===t.source||!t.source.movable()||null!==this._startTrackPoint)return!1;if(!this._preventSourceChange){const o=this._chartUndoModel(),r=(0,n.ensureNotNull)((0,n.ensureNotNull)(this._state).mainDataSource()).firstValue(),a=(0,n.ensureNotNull)(t.source.priceScale()),l=null===r?NaN:a.coordinateToPrice(e.localY,r);let c=(t.source.isSelectionEnabled()?o.selection().allSources():[t.source]).filter(Bn);const h=c.filter((e=>(0,zs.isLineTool)(e)&&!e.isSourceHidden()));c=h.length>0?h:c.includes(t.source)?[t.source]:[c[0]];const d=new Vt.Point(e.localX,e.localY),u={index:s,price:l},_=t.hittest.data()?.activeItem;return this._startMoveSourceParams={source:c,startPoint:{logical:u,screen:d},activeItem:void 0===_?null:_,envState:i},!0}return this._startMoveSourceParams=null,!1}_chartModel(){return this._chart.model().model()}_chartUndoModel(){
+return this._chart.model()}_externalPaneXCoord(e,t){t+=this._div.getBoundingClientRect().left+document.body.scrollLeft;const i=(0,n.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().left+document.body.scrollLeft;return i._correctXCoord(t-s)}_externalPaneYCoord(e,t){t+=this._div.getBoundingClientRect().top+document.body.scrollTop;const i=(0,n.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().top+document.body.scrollTop;return i._correctYCoord(t-s)}_correctXCoord(e){return Math.max(0,Math.min(e,this._size.width-1))}_correctYCoord(e){return Math.max(0,Math.min(e,this._size.height-1))}_processScroll(e){if(!this._chart.model().model().scrollEnabled())return;const t=performance.now();this._startScrollingPos||this._preventScroll()||(this._startScrollingPos={x:e.clientX,y:e.clientY,timestamp:t,localX:e.localX,localY:e.localY});const i=this._chartUndoModel();let s=this.state().defaultPriceScale();if(this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==e.clientX||this._startScrollingPos.y!==e.clientY))return i.beginUndoMacro(Un),null===this._scrollXAnimation&&this._options.useKineticScroll&&(this._scrollXAnimation=new bn(.2,7,.997,15),this._scrollXAnimation.addPosition(e.clientX,this._startScrollingPos.timestamp)),i.selection().isEmpty()||(s=i.selection().allSources()[0].priceScale()),null===s||s.isEmpty()||(this._scrollPriceScale=s,i.startScrollPrice(this.state(),s,e.localY)),i.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool(),void this._paneWidgetsSharedState.setScrollingPane(this);this._isScrolling&&(null!==this._scrollPriceScale&&i.scrollPriceTo(this.state(),this._scrollPriceScale,e.localY),i.scrollTimeTo(e.localX),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(e.clientX,t))}_finishScroll(){const e=this._chartUndoModel();e.endScrollTime(),null!==this._scrollPriceScale&&e.endScrollPrice(this.state(),this._scrollPriceScale),e.endUndoMacro(),this._isScrolling=!1,this._startScrollingPos=null,this._scrollPriceScale=null,this.setCursorForTool(),this._paneWidgetsSharedState.setScrollingPane(null)}_endScroll(e){if(!this._isScrolling)return!1;this._finishScroll();const t=this._scrollUndoCommandInStack(),i=performance.now();return null!==this._scrollXAnimation&&(this._scrollXAnimation.start(e.clientX,i),this._scrollXAnimation.finished(i)||(this._chartModel().stopTimeScaleAnimation(),this._chartModel().setTimeScaleAnimation(this._scrollXAnimation),this._scrollXAnimation=null)),t}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||(0,Lt.isLineToolName)(mt.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint||this._preventScrollUntilNextMouseDownOrTouchStart}_isSelectPointModeEnabled(){return this._chartUndoModel().crosshairSource().selectPointMode().value()!==mt.SelectPointMode.None}_preventCrossHairMove(){
+return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e,t=null){const i=this._chartUndoModel(),s=e.toolname;if(s===mt.tool.value()&&(0,mt.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),i.selectionMacro((i=>{i.addSourceToSelection(e,Xn(t,e))})),(0,zs.isEditableTextLineTool)(e)&&e.activateEditingOnCreation())e.activateTextEditingOn(this._div,!0);else if((0,Lt.isTextToolName)(s)){const t=i.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,Ns.TabNames.text,void 0,t)}this._lastFinishedToolId=e.id(),(0,ee.emit)("drawing_event",e.id(),"create"),kn()}_alignSourcesThatBeingMoved(e,t,i,s,o){const n=this._chartUndoModel(),r=2===o?NaN:n.timeScale().coordinateToIndex(t);n.model().sourcesBeingMoved().forEach((e=>{let a=r,l=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());if(null===l){if(1!==o)return;l=NaN}if((0,Ws.isStudy)(e)){const e=n.mainSeries(),t=e.bars().firstIndex(),i=e.bars().lastIndex();null!==t&&null!==i&&2!==o&&(a=Math.min(Math.max(r,t),i)),1!==o&&(l=this._chartModel().magnet().align(l,r,this.state()))}null!==this._currentMovingHitTest&&void 0!==this._currentMovingHitTest.sourceAtPoint.hittest.data()?.cursorType||this.setCursorForTool(),n.moveSources({screen:new Vt.Point(t,i),logical:{index:a,price:l}},s)}))}_resetMeasureIfRequired(){this._needResetMeasureLater&&((0,mt.resetToCursor)(),this._needResetMeasureLater=!1)}_makeSureIsUpdated(e){const t=this.state(),i=[...t.dataSources(),...t.customSources()];for(const s of i){const i=s.paneViews(t);if(null!==i)for(const t of i)t.makeSureIsUpdated?.(e)}}_drawBackground(e,t){const i=this._chartModel(),s=i.backgroundTopColor().value(),o=i.backgroundColor().value();if(this._state?.mode()===zi.PaneMode.Widget){const i=this._state?.model().panes().indexOf(this._state)??0,n=this._state?.model().mainPane(),r=i>(n?this._state?.model().panes().indexOf(n)??0:0)?o:s;(0,Kt.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,r)}else s===o?(0,Kt.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,o):(0,$t.clearRectWithGradient)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,s,o)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;if(!this.state().containsMainSeries())return;const s=i.paneViews();for(const i of s){e.save();const s=i.renderer(t);s&&s.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crosshairSource();i.invalidateLockPosition(),i.visible||null===mt.crosshairLock.value()||i.updateAllViews((0,wi.sourceChangeEvent)(i.id())),this._drawSourceImpl(e,t,$n,qn,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved(),i.customSourceBeingMoved()].filter((e=>!!e));for(const o of s){(i.paneForSource(o)===this.state()||(0,Po.isDataSource)(o)&&o.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,$n,qn,o)}}_drawTopViews(e,t){
+for(const i of this.state().sourcesByGroup().all())i.topPaneViews&&this._drawSourceImpl(e,t,Kn,qn,i)}_drawSources(e,t){const i=this.state(),s=i.model(),o=i.sourcesByGroup(),n=o.tradingSources(),r=o.generalSources(),a=o.phantomSources(),l=i.customSources(Co.CustomSourceLayer.Background).slice(),c=i.customSources(Co.CustomSourceLayer.Foreground).slice(),h=i.customSources(Co.CustomSourceLayer.Topmost).slice(),d=s.activeStrategySource().value(),u=s.replayStudyStrategy().value();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,$n,qn,s.gridSource()),this._drawWatermark(e,t);for(const i of l)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of r)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of c)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of a)this._drawSourceImpl(e,t,$n,Gn,i);const _=new Set;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved(),s.customSourceBeingMoved()].filter(tt.notNull).forEach((e=>_.add(e.id())));let p=s.hoveredSource();null!==p&&((0,Po.isDataSource)(p)&&!p.showOnTopOnHovering()||_.has(p.id())||(0,Po.isDataSource)(p)&&!r.includes(p)?p=null:_.add(p.id()));const m=s.selection().allSources().filter((e=>!((0,Po.isDataSource)(e)&&!r.includes(e))&&!_.has(e.id())));m.forEach((e=>_.add(e.id())));for(const i of l)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of r)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of c)this._drawSourceImpl(e,t,$n,qn,i,_);d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Zn,qn,d,_),u&&this._drawSourceImpl(e,t,Zn,qn,u,_);for(const i of n)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of h)this._drawSourceImpl(e,t,$n,Gn,i);for(const i of r)this._drawSourceImpl(e,t,Yn,qn,i,_);for(const i of c)this._drawSourceImpl(e,t,Yn,qn,i,_);for(const i of n)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of h)this._drawSourceImpl(e,t,$n,qn,i,_);for(const i of m)this._drawSourceImpl(e,t,$n,qn,i),i===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Zn,qn,d);for(const i of m)this._drawSourceImpl(e,t,Yn,qn,i);p&&(this._drawSourceImpl(e,t,$n,qn,p),p===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Zn,qn,d),this._drawSourceImpl(e,t,Yn,qn,p));for(const i of a)this._drawSourceImpl(e,t,$n,qn,i,_);{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,o,n){if(n&&n.has(o.id()))return;const r=i(o,this.state());if(r)for(const i of r){const o=i.renderer(t);o&&(e.save(),s(o,e,t),e.restore())}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof rt))return!1;if(t.isEmpty())return!1;return t.commands()[0]instanceof xn}_onStateDestroyed(){this.setState(null)}_onDataSourcesCollectionChanged(){this._startMoveSourceParams=null}_processMouseEnterLeaveMoveHandlers(e,t){
if(null!==this._prevHoveredHittest&&(this._prevHoveredHittest.renderer!==e?.renderer||this._prevHoveredHittest.hittest.data()?.activeItem!==e.hittest.data()?.activeItem)){const e=this._sourceWasSelected(this._prevHoveredHittest);(0,Ut.tryCallHandler)(t,{sourceWasSelected:e},this._prevHoveredHittest.hittest.data()?.mouseLeaveHandler),this._prevHoveredHittest=null}if(!t.isTouch&&null!==e){const i=this._sourceWasSelected(e);this._prevHoveredHittest?.renderer!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t,{sourceWasSelected:i}),this._prevHoveredHittest=e),e.hittest.tryCallMouseMoveHandler(t,{sourceWasSelected:i})}}_startChangeOrMoveLineToolIfNeeded(){if(null!==this._startChangeLineToolParams){const e=this._startChangeLineToolParams;(0,re.trackEvent)("chart_alert","edit","start_change_line_tool_params"),this._chartUndoModel().startChangingLinetool(e.source,e.ownerSource,e.startPoint,e.pointIndex,e.envState)}if(null!==this._startMoveSourceParams){const e=this._startMoveSourceParams;(0,re.trackEvent)("chart_alert","edit","start_moving_sources"),this._chartUndoModel().startMovingSources(e.source,e.startPoint,e.activeItem,e.envState)}this._startMoveSourceParams=null,this._startChangeLineToolParams=null}_trackingModeShouldBeActive(){return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e,t){let i=null;const s=this._chartModel();if(null!==e&&(i=e.isCustom?s.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==i){const e=this._lastClickedSource.id;let i=this._lastClickedSource.isCustom?s.customSourceForName(e):s.dataSourceForId(e);null!==i||this._lastClickedSource.isCustom||(i=s.dataSourceForId(e)),null!==i&&i.onClickOutside&&(i.onClickOutside((0,Kt.getBindingRenderingInfo)(this._canvasBinding),t),this._chartModel().updateSource(i))}this._lastClickedSource=null!==i?{id:i,isCustom:e?.isCustom??!1}:null}async showConfetti(e,t){0}_mouseClickOrTapEvent(e){if(!this.hasState())return;let t=null,i=null;this._mouseTouchDownUpInfo&&this._mouseTouchDownUpInfo.toolCreation&&!this._mouseTouchDownUpInfo.mouseMove||(t=this._dataSourceAtPoint(e.localX,e.localY),i=t&&t.source);const s=this._chartUndoModel(),o=Boolean(t?.hittest.data()?.hideCrosshairLinesOnHover);this._processOutsideClick(t,e),s.model().setActivationChartFloatingTooltipHint(i),!this._isSelectPointModeEnabled()||o||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||s.crosshairSource().trySelectCurrentPoint();const r=this._sourceWasSelected(t);!(0,Lt.isLineToolName)(mt.tool.value())&&null!==t&&t.hittest.tryCallClickOrTapHandler(e,{sourceWasSelected:r})&&s.model().updateSource((0,n.ensureNotNull)(i)),!e.isTouch||this._isSelectPointModeEnabled()||t&&t.source===s.crosshairSource()||this._tryExitTrackingMode(),i&&(0,zs.isLineTool)(i)&&this._lastFinishedToolId!==i.id()&&(0,ee.emit)("drawing_event",i.id(),"click"),this._resetMeasureIfRequired(),this._mouseTouchDownUpInfo=null}_mouseDownOrTouchStartEvent(e,t){
this._pressedMoveStage=1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,this._selectionBeforeMouseDown=new Set(this._chartModel().selection().allSources()),e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null;const i=this._chartModel();if(i.stopTimeScaleAnimation(),this._mouseTouchDownUpInfo={mouseMove:!1,toolCreation:Boolean(i.lineBeingCreated())},e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}(0,ee.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null);const s=this._chartUndoModel(),o=new To.EnvironmentState(e);s.mainSeries().clearGotoDateResult();const r=this.state().defaultPriceScale();if(s.timeScale().isEmpty())return;const a=s.crosshairSource();if(!e.isTouch&&!(0,Lt.isLineDrawnWithPressedButton)(mt.tool.value())){const t=null!==s.lineBeingCreated()?s.model().paneBeingCreatedLineOn():null;null!==t&&t!==this._state?this._setCursorPositionOnExternalPane(t,e.localX,e.localY,o):this.setCursorPosition(e.localX,e.localY,o)}e.isTouch&&(0,Lt.isLineToolName)(mt.tool.value())&&((0,Lt.isLineDrawnWithPressedButton)(mt.tool.value())||null!==a.pane?(0,Lt.isLineDrawnWithPressedButton)(mt.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const l=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();let c=null==l?null:r.coordinateToPrice(e.localY,l),h=i.timeScale().coordinateToIndex(e.localX);if(a.startMeasurePoint()&&a.endMeasurePoint()&&a.clearMeasure(),o.shift()&&(0,mt.toolIsCursor)(mt.tool.value())){const e=s.selection().isEmpty();(null===t||e&&!t.hittest.data()?.hasOwnShortcutsBehaviourFor?.shiftKey)&&(mt.tool.setValue("measure"),(0,wn.trackDrawingToolSelected)("measure","Keyboard shortcut"),e||s.selectionMacro((e=>e.clearSelection())))}if((e.isTouch&&!e.stylus||null===c||!this._tryStartMeasure(e,a,o,c,h))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,a))&&!(this._tryFinishZoom(e)||null!==c&&this._tryStartZoom(e,c,h,o))){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=a.currentPoint(),this._startTrackPoint=new Vt.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(e.localX,e.localY),new To.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t||!s.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,mt.toolIsMeasure)(mt.tool.value())||null!==a.measurePane().value()))return void this._initToolCreationModeParams(e)
;if(null!==c&&((0,Lt.isLineToolName)(mt.tool.value())||s.lineBeingCreated()))return o.shift()||s.selectionMacro((e=>e.clearSelection())),void this._mouseDownEventForLineTool(e,o,h,c)}if((0,mt.toolIsDemonstration)(mt.tool.value())&&o.altOnly()){e.isTouch&&!this.trackingModeEnabled()&&this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(e.localX,e.localY),new To.EnvironmentState(e));const t=this._chartModel().crosshairSource().crosshairDemonstration();t.createHighlighter();const i=this._localCoordinatesToLineDataSourcePoint(a.originX(),a.originY(),(0,n.ensureNotNull)(this.state().mainDataSource()));i&&t.addHighlighterPosition(i)}else{if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseDownOrTouchStartHandler(e,{sourceWasSelected:i})}if(!this._chart.readOnly()){const r=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,o);if(null!==t&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return s.model().setMovingCustomSource(t.source,i),this._preventScrollUntilNextMouseDownOrTouchStart=!0,this._currentMovingHitTest={sourceAtPoint:t,cancelledContainer:s.model().customSourceMovingHitTestData()??void 0},void s.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,n.ensureNotNull)(t.source),(0,n.ensureNotNull)(i))}))}else if(i?.areaName===Ut.AreaName.SourceItemMove){const o=i?.activeItem;if(void 0!==o)return s.startCustomMoving(t.source,o,e),this._currentMovingHitTest={sourceAtPoint:t},void s.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,n.ensureNotNull)(t.source),(0,n.ensureNotNull)(i))}))}}if(null!==t&&this._tryHandleEraserMouseDown(t,o))return;const a=null!==t&&(0,zs.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,mt.lockDrawings)().value()||a)&&null!==t&&!t.isCustom){if(!t.source.userEditEnabled())return;const s=t.hittest.data()?.snappingPrice,a=t.hittest.data()?.snappingIndex;let u=e.localY,_=e.localX;const p=t.hittest.data()?.ownerSourceId,m=p?i.dataSourceForId(p):t.source.ownerSource();if(void 0!==s&&null!==l&&(u=(0,n.ensure)(m?.priceScale()).priceToCoordinate(s,l),c=s),void 0!==a&&(_=i.timeScale().indexToCoordinate(a),h=a),u===e.localY&&_===e.localX||(e={...e,localY:u,localX:_},this.setCursorPosition(e.localX,e.localY,o)),this._tryStartChangingLineTool(e,t,o,h))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,(d=t.hittest.target())===Ut.HitTarget.MovePoint||d===Ut.HitTarget.MovePointBackground&&(0,lo.lastMouseOrTouchEventInfo)().isTouch){if(this._tryStartCloning(e,t,o,r))return;if(this._tryStartMovingLineTool(e,t,o,h))return void(this._currentMovingHitTest={sourceAtPoint:t});this._currentMovingHitTest=null}}if(null!==t&&(0,An.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._state?.hasDataSource(t.source)&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var d;null!==t&&t.hittest.target()===Ut.HitTarget.Regular||(this._processing=!0)}}}_mouseUpOrTouchEndEvent(e){if(!this.hasState())return
;this._pressedMoveStage=0;const t=e.isTouch&&null!==this._startTrackPoint,i=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null;const s=this._chartUndoModel(),o=s.model().customSourceMovingHitTestData();null!==o||s.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const r=s.model(),a=r.crosshairSource(),l=this._dataSourceAtPoint(e.localX,e.localY);if(a.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(a.selection(),(0,Kt.getBindingRenderingInfo)(this._canvasBinding));s.selectionMacro((t=>{let i=null;e.forEach((e=>{null===i&&(i=Xn(l,e)),t.addSourceToSelection(e,i)}))})),a.clearSelection(),(0,re.trackEvent)("GUI","Multiselect","Area Select")}(0,ee.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const c=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const h=new To.EnvironmentState(e),d=mt.tool.value();if(e.isTouch&&((0,mt.toolIsMeasure)(d)||null!==a.measurePane().value())){if(!c&&!e.stylus&&null===a.measurePane().value()&&a.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY);if(!c&&!e.stylus&&this._tryStartMeasure(e,a,h,a.price,a.index))return;if((!c||e.stylus)&&this._tryFinishMeasure(e,a))return}if(e.isTouch&&!c&&!(0,Lt.isLineDrawnWithPressedButton)(d)&&(0,Lt.isLineToolName)(d)&&!s.lineBeingCreated()){if(this._chart.justActivated())return;if(a.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY,h);const t=a.currentPoint(),i=this.state().defaultPriceScale(),o=(0,n.ensure)(this.state().mainDataSource()?.firstValue()),r={index:Math.round(s.timeScale().coordinateToIndex(t.x)),price:i.coordinateToPrice(t.y,o)},c=(0,n.ensureNotNull)(s.createLineTool({pane:this.state(),point:r,linetool:d,actionSource:"Draw"}));return this._mouseTouchDownUpInfo&&(this._mouseTouchDownUpInfo.toolCreation=!0),s.selectionMacro((e=>{e.addSourceToSelection(c)})),s.lineBeingCreated()||(this._finishTool(c,l),e.preventDefault()),void(this._startTouchPoint=null)}const u=s.lineBeingCreated();if(u&&!(0,Lt.isLineDrawnWithPressedButton)(u.toolname)&&e.isTouch&&(this._startTouchPoint||e.stylus)){if(this._startTouchPoint=null,!c||e.stylus){const t=(0,n.ensureNotNull)(u.lastPoint()),i=s.continueCreatingLine({index:t.index,price:t.price},new To.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(u,l),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,s.customMoveBeingProcessed())return void s.endCustomMoving();if(null!==o){if(o.beingMoved&&!o.cancelled){const t=this._sourceWasSelected(l);(0,Ut.tryCallHandler)(e,{sourceWasSelected:t},o.mouseUpHandler,o.touchEndHandler),this.setCursorForTool()}if(r.setMovingCustomSource(null,null),or(e,o))return}
if(r.lineBeingEdited())return s.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,Lt.isLineDrawnWithPressedButton)(d)&&!this._isSelectPointModeEnabled()){const t=s.lineBeingCreated();null!==t&&(kn(),t.finish(),"LineToolBrush"===t.toolname&&(0,ee.emit)("drawing_event",t.id(),"create"));const i=this.state().defaultPriceScale();if(i.isEmpty())return;if(!t)return;const o=(0,n.ensure)(t.ownerSource()?.firstValue()),r=i.coordinateToPrice(e.localY,o),a={index:Math.round(s.timeScale().coordinateToIndex(e.localX)),price:r};return void s.continueCreatingLine(a)}const _=r.crosshairSource().crosshairDemonstration();if(_.isThereUnfinishedHighlighter())return void _.finishHighlighter();if(r.sourcesBeingMoved().length)return s.endMovingSource(!1,!1),r.sourcesBeingMoved().filter(zs.isLineTool).forEach((e=>{this.setCursorForTool(e)})),void r.invalidate(ao.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localXt.projectTime(e,i)));null!==i&&this._chart.chartWidgetCollection().syncScroll(1e3*i,this._chartModel())}}}const p=this._isScrolling,m=this._endScroll(e),g=this._paneWidgetsSharedState.draggingSource();if(null!==g){const t=e.target,i=this._chart.paneByCanvas(t);i&&i!==this&&i.state().mode()===zi.PaneMode.Regular&&(m&&s.undoHistory().undo(),s.mergeToPane(g,i.state()));if(this._chart.timeAxisByCanvas(t))if(r.isUnmergeAvailableForSource(g))m&&s.undoHistory().undo(),s.unmergeToNewBottomPane(g);else{const e=r.panes(),t=(0,n.ensureNotNull)(r.paneForSource(g)),i=e.indexOf(t);i!==e.length-1&&(m&&s.undoHistory().undo(),t.maximized().value()&&s.toggleMaximizedPane(t),s.movePane(i,e.length-1))}this._paneWidgetsSharedState.clearDraggingSource();const o=this._chart.getTimeScale();o&&o.restoreDefaultCursor();const a=this._chart.paneWidgets();for(let e=0;eUt.HitTarget.MovePointBackground||(0,lo.lastMouseOrTouchEventInfo)().isTouch)&&s.selectionMacro((e=>{e.clearSelection();const t=(0,n.ensureNotNull)(l.source);e.addSourceToSelection(t,Xn(l,t))})),e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._mouseTouchDownUpInfo&&(this._mouseTouchDownUpInfo.mouseMove=!0),this._resetMeasureIfRequired();const t=this._dataSourceAtPoint(e.localX,e.localY);this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=e.localX,o=e.localY;this._prevMoveEventPosition=new Vt.Point(s,o);const n=new To.EnvironmentState(e);if(null===this._firstZoomPoint){if(this._updateHoveredSource(t,n,e),
-!e.isTouch&&i.lineBeingCreated()){const e=i.model().paneBeingCreatedLineOn();if(null!==e&&e!==this._state)return void this._setCursorPositionOnExternalPane(e,s,o,n)}e.isTouch||this.setCursorPosition(s,o,n)}else this._processMouseMoveWhileZoom(e,n)}_pressedMouseOrTouchMoveEvent(e){if(!this.hasState()||this._pinching||e.isTouch&&this._contextMenuOpenedOnLastTap)return;this._pressedMoveStage=2,this._mouseTouchDownUpInfo&&(this._mouseTouchDownUpInfo.mouseMove=!0),this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const t=new To.EnvironmentState(e),i=this._chartUndoModel(),s=i.crosshairSource(),o=e.localX,r=e.localY;if(this._prevMoveEventPosition=new Vt.Point(o,r),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const a=mt.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,Lt.isLineToolName)(a)&&!(0,Lt.isLineDrawnWithPressedButton)(a)&&!i.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const l=s.measurePane().value();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,mt.toolIsMeasure)(a)||null!==l))return void(e.stylus?this.setCursorPosition(e.localX,e.localY,new To.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,l||this.state()));const c=i.lineBeingCreated();if(e.isTouch&&!e.stylus&&c&&!(0,Lt.isLineDrawnWithPressedButton)(c.toolname)){if(this._startTouchPoint){const t=(0,n.ensureNotNull)(i.lineBeingCreated()),s=(0,n.ensureNotNull)(i.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,s)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,n.ensureNotNull)(this._initCrossHairPosition),i=new Vt.Point(o,r).subtract(this._startTrackPoint),s=e.add(i);this.setCursorPosition(s.x,s.y,t)}else e.isTouch&&this._preventCrossHairMove()||this.setCursorPosition(o,r,t);const h=this._isSelectPointModeEnabled();if((0,Lt.isLineToolName)(a)&&!(0,Lt.isLineDrawnWithPressedButton)(a)&&!h&&!t.mod())return;if((0,Lt.isLineDrawnWithPressedButton)(a)&&!h){const t=i.lineBeingCreated();if(!t)return;const s=this._localCoordinatesToLineDataSourcePoint(e.localX,e.localY,(0,n.ensureNotNull)(t.ownerSource()));return void(s&&i.continueCreatingLine(s))}const d=i.crosshairSource().crosshairDemonstration();if(d.isThereUnfinishedHighlighter()){const e=this._localCoordinatesToLineDataSourcePoint(s.originX(),s.originY(),(0,n.ensureNotNull)(this.state().mainDataSource()));return void(e&&d.addHighlighterPosition(e))}if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(i.timeScale().isEmpty())return;const u=this._options.handleScroll;if((!u.pressedMouseMove||e.isTouch)&&(!u.horzTouchDrag&&!u.vertTouchDrag||!e.isTouch))return
-;if(this._chartModel().dragExportEnabled().value())return;if(i.customMoveBeingProcessed())return void i.processCustomMove(e);const _=i.model().customSourceMovingHitTestData();if(null!==_&&(this._updateCommonTooltip(null,!0),_.cancelled||(i.model().processingCustomSourceMove(),(0,Ut.tryCallHandler)(e,{sourceWasSelected:this._selectionBeforeMouseDown.has(i.model().customSourceBeingMoved())},_.pressedMouseMoveHandler,_.touchMoveHandler)),or(e,_)))return;if(i.model().lineBeingEdited())return void this.setCursorPosition(o,r,t);if(i.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(i.model().sourcesBeingMoved(),e.localX,e.localY,t,i.model().lastHittestData()?.possibleMovingDirections);const p=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new To.EnvironmentState(e),p))return;const m=(0,mt.toolIsMeasure)(a)||s.startMeasurePoint()&&s.endMeasurePoint();this._chart.readOnly()||!t.mod()||(0,Lt.isLineToolName)(a)||m||h?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this.setCursorPosition(e.localX,e.localY,new To.EnvironmentState(e))):this._isSelecting||(s.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){if(!this.hasState())return;const t=this._chartUndoModel();if(!t)return;const i=t.crosshairSource();e.isTouch||null!==i.measurePane().value()&&null===i.endMeasurePoint()||this._clearCursorPosition();if(this._chartModel().setHoveredSource(null,null),null!==this._prevHoveredHittest){const t=this._sourceWasSelected(this._prevHoveredHittest);(0,Ut.tryCallHandler)(e,{sourceWasSelected:t},this._prevHoveredHittest.hittest.data()?.mouseLeaveHandler),this._prevHoveredHittest=null}this._updateCommonTooltip(null),this._chart.setActivePaneWidget(null)}_mouseDoubleClickOrDoubleTapEvent(e){if(!this.hasState())return;const t=!this._chart.readOnly()&&!(0,Lt.isLineToolName)(mt.tool.value())&&this._dataSourceAtPoint(e.localX,e.localY)||null,i=this._sourceWasSelected(t);if(null!==t&&t.isCustom)t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i});else if(null!==t&&(e.isTouch||t.hittest.target()>Ut.HitTarget.MovePointBackground))t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i})&&!(0,Ut.shouldDefaultActionBeExecuted)(e,(0,n.ensureNotNull)(t.hittest.data()),"doubleClickHandler","doubleTapHandler")||this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,Lt.isLineToolName)(mt.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new To.EnvironmentState(e).mod()&&!t.maximized().value()?(t.collapsed().value()||t.collapsingAvailable().value())&&this._chartUndoModel().toggleCollapsedPane(this.state()):this._chartUndoModel().toggleMaximizedPane(this.state())}}_contextMenuEvent(e){const t=this._chartUndoModel();if(t.crosshairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return t.crosshairSource().clearMeasure(),void(0,mt.resetToCursor)(!0)
-;if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,mt.toolIsCursor)(mt.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,mt.resetToCursor)(!0),this.setCursorForTool(),void(t.lineBeingCreated()&&t.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i?i.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const o=i&&i.hittest?i.hittest.target():0,n=o>=Ut.HitTarget.Regular||o>=Ut.HitTarget.MovePointBackground&&e.isTouch;if(t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),t.addSourceToSelection(s,Xn(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s)if((0,Po.isDataSource)(s)&&s.hasContextMenu())s.isSelectionEnabled()?this.showContextMenuForSelection(e,void 0,i.hittest):this.showContextMenuForSources([s],e,void 0,void 0,i.hittest);else{const t=this._sourceWasSelected(i);i.hittest.tryCallContextMenuHandler(e,{sourceWasSelected:t})}}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_localCoordinatesToLineDataSourcePoint(e,t,i){const s=this.state().defaultPriceScale();if(s.isEmpty())return null;const o=new Vt.Point(e,t),r=(0,n.ensure)(i.firstValue());return o.price=s.coordinateToPrice(t,r),o.index=Math.round(this._chartUndoModel().timeScale().coordinateToIndex(e)),o}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crosshairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(i.x,e.localY),new To.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof zo.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t0;e--)t(o[e])&&t(o[e-1])&&o.splice(e,1);o.length&&t(o[0])&&o.splice(0,1),o.length&&t(o[o.length-1])&&o.splice(o.length-1,1),Io.ContextMenuManager.showMenu(o,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){const t=this._chart.actions(),i=[];if(this._chart.model().model().resetScalesAvailable().value()&&(i.push(t.chartReset),i.push(new zo.Separator)),!this.state().isEmpty()&&l.enabled("datasource_copypaste")&&this.state().mode()===zi.PaneMode.Regular){const{createPasteAction:t,createActionCopyPrice:s}=await(0,Go.actionsProviderModule)(),o=s(this.state(),e.localY),n=t(this._chart,this.state())
-;(o||n)&&(o&&i.push(o),n&&i.push(n),i.push(new zo.Separator))}i[i.length-1]instanceof zo.Separator||i.push(new zo.Separator),i.push(this._createLockTimeAxisAction(e)),i.push(new zo.Separator),i[i.length-1]instanceof zo.Separator||i.push(new zo.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(i.push(t.applyStudiesToAllCharts),i.push(new zo.Separator));const s=t.paneRemoveAllDrawingTools.getState().disabled;s||i.push(t.paneRemoveAllDrawingTools);const o=t.paneRemoveAllStudies.getState().disabled;return o||i.push(t.paneRemoveAllStudies),s&&o||i.push(new zo.Separator),i.push(t.hideAllMarks),i.push(new zo.Separator),l.enabled("show_chart_property_page")&&i.push(t.chartProperties),i[i.length-1]instanceof zo.Separator&&i.pop(),i}_loadAndCreateLegendWidget(){Promise.all([i.e(3644),i.e(3439),i.e(1171),i.e(2537),i.e(8752),i.e(7780),i.e(2112),i.e(7691),i.e(7369),i.e(2227),i.e(2477),i.e(8093),i.e(5093)]).then(i.bind(i,6639)).then((e=>{if(this._isDestroyed||!this._options.legendWidgetEnabled||this._legendWidget)return;const t=e.LegendWidget,i=(0,ge.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!ze.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled,pineSourceStatusEnabled:this._options.pineSourceStatusEnabled,alertStatusEnabled:this._options.alertStatusEnabled};const s=(0,ft.combine)(((e,t)=>tr&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),o=(0,ft.combine)(((e,t)=>null!==e?e===this._state:(0,mt.toolIsMeasure)(t)),this._chartModel().crosshairSource().measurePane().weakReference(),mt.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),o.ownership(),i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart),onLegendRowFocused:()=>{this._chart.chartWidgetCollection().activeChartWidget.setValue(this._chart)}}),this._div.prepend(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,
-n.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}_loadAndCreatePaneControlsWidget(e){Promise.all([i.e(3644),i.e(3439),i.e(1171),i.e(2537),i.e(8752),i.e(7780),i.e(2112),i.e(7691),i.e(7369),i.e(2227),i.e(2477),i.e(8093),i.e(5093)]).then(i.bind(i,24028)).then((t=>{if(this._isDestroyed||this._state!==e)return;const i=t.PaneControlsWidget;this._paneControls=new i(this._chartUndoModel(),e,{backgroundThemeName:this._chart.backgroundTopTheme(),anySeparatorSelected:this._anySeparatorSelected.weakReference()},this._div),this._paneControls.updateWidgetModeByWidth(this._size.width),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new ResizeObserver(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),this._state?.collapsed().value()&&this._chartModel().fullUpdate()}))}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+2*Wn;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive().value()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crosshairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive().value()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crosshairSource().visible&&this._updateLineToolUsingMagnetOrShift(To.EnvironmentState.create((0,Vs.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,Lt.isLineToolName)(mt.tool.value())&&t.crosshairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(mt.isStudyEditingNow.value()&&this.setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this.setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(Ns.TabNames.symbol);else if((0,zs.isLineTool)(e)||(0,Ws.isStudy)(e)){let i;const s=t?.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=er.get(e))}this._chart.showChartPropertiesForSource(e,i).then((e=>{this._editDialog=e}))}}_initToolCreationModeParams(e){this._startTouchPoint=new Vt.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crosshairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crosshairSource();this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint())
-;const s=e.pageX,o=e.pageY,r=(0,n.ensureNotNull)(this._initCrossHairPosition),a=new Vt.Point(s,o).subtract((0,n.ensureNotNull)(this._startTouchPoint)),l=r.add(a);this.setCursorPosition(l.x,l.y,new To.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(e){const t=this.state();for(const i of t.leftPriceScales())t.recalculatePriceScale(i,e);for(const i of t.rightPriceScales())t.recalculatePriceScale(i,e);for(const i of t.sourcesByGroup().overlayPriceScaleSources())(0,zs.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){const t=0===mt.crosshairLock.value()?.type;return new zo.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:jn,statName:"LockCursorInTime",checkable:!0,checked:t,onExecute:()=>this._toggleLockTimeAxis(e.localX,!t)}})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i);if(null!==s)return void mt.crosshairLock.setValue({type:0,time:s})}mt.crosshairLock.setValue(null)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){const s=this._chartUndoModel(),o=s.model();let n=!1;const r=e&&e.source,a=this._chart.readOnly();if(o.crosshairSource().isReplaySelection())this._setCursorClassName("none");else if(!(!a||e&&(0,zs.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())a&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const l=mt.tool.value();let c=null;if(!this._processing&&((0,mt.toolIsCursor)(l)||(0,mt.toolIsEraser)(l)&&!a||t.mod()||!s.lineBeingCreated())){const t=e?.hittest;n=Boolean(t?.data()?.hideCrosshairLinesOnHover),t&&t.target()>Ut.HitTarget.MovePointBackground?(c=r,!r?.isHoveredEnabled()||(0,mt.toolIsEraser)(l)&&r===s.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(r,t.data(),0)):o.setHoveredSource(null,null)}a?this.setCursorForTool(c,t,ei.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(c,t,e?.hittest.data()?.cursorType));const h=o.customSourceBeingMoved(),d=null!==h?[h]:o.sourcesBeingMoved();if((!d.length||null!==e&&-1===d.indexOf(e.source))&&this._updateCommonTooltip(e),!a&&null!==e&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case ei.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ei.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case ei.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ei.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crosshairSource().setLinesShouldBeHidden(n)}async _createErrorBlock(){const e=new(await Ks())
-;return this._div.insertBefore(e.container,this._topCanvasBinding.canvasElement.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!l.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let o;if(i&&!i.isEmpty()){const e=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();o=i.coordinateToPrice(this._contextMenuY,(0,n.ensureNotNull)(e))}return(0,ee.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:o,callback:t=>{[...t].forEach((t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new zo.Separator:new zo.Action({actionId:"Chart.ExternalActionId",options:{label:t.text,onExecute:t.click}}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}}))}}),e}_highlightPriceAxisesByLabel(e){this._state?.mode()===zi.PaneMode.Regular&&(this._lhsPriceAxisesContainer.setHighlightedPriceAxises(e),this._rhsPriceAxisesContainer.setHighlightedPriceAxises(e))}_subscribeToState(){const e=this.state();e.onDestroyed().subscribe(this,this._onStateDestroyed,!0),e.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),e.maximized().subscribe(this._updateVisuallyCollapsed,{callWithLast:!0}),e.collapsed().subscribe(this._updateVisuallyCollapsed,{callWithLast:!0}),e.maximized().subscribe(this._updateMaximized,{callWithLast:!0})}_unsubscribeFromState(){const e=this.state();e.onDestroyed().unsubscribeAll(this),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.maximized().unsubscribe(this._updateVisuallyCollapsed),e.collapsed().unsubscribe(this._updateVisuallyCollapsed),e.maximized().unsubscribe(this._updateMaximized),this._maximized.setValue(!1)}_updateAccessibilityAttr(){if(this.hasState()&&this.state().isMainPane().value()){const e=this._chartModel().mainSeries(),t=e.symbol(),s=(0,ht.getTranslatedResolutionModel)(e.interval()).hint,o=a.t(null,{replace:{symbol:t,interval:s}},i(1136));this._topCanvasBinding.canvasElement.setAttribute("aria-label",o)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){0}_paneDblClickOrTapEvent(e){if(this._chart.readOnly())return;const t=this._dataSourceAtPoint(e.localX,e.localY);if(null!==t&&(0,zs.isEditableTextLineTool)(t.source)){const e=t.source.textEditingActivationTime();null!==e&&performance.now()-e<500&&this.processDoubleClickOnSource(t.source,t.hittest)}}}class ar{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){
-return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,n.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0,n.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,n.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var lr,cr=i(19679),hr=i(95772);i(20715);!function(e){e[e.BorderSize=1]="BorderSize",e[e.OffsetSize=5]="OffsetSize"}(lr||(lr={}));const dr={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},ur=new dt.TranslatedString("change session",a.t(null,void 0,i(87041))),_r=a.t(null,void 0,i(94031));class pr{constructor(e,t,i,s,o){this._rendererOptions=null,this._onLabelHovered=new ae.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,tt.merge)((0,tt.clone)(dr),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("div"),this._element.style.display="flex",this._backgroundBasedTheme=o;const n=e.model().model().rendererOptionsProvider(),r=()=>this.backgroundColor(),a=()=>{throw new Error("Time axis does not support real price scales")},l={titlesProvider:i,stubContextMenuProvider:async(e,t)=>{const i=await s(e,t),o=this.getContextMenuActions(!0);return 0===o.length?i:i.concat(new zo.Separator,o)},backgroundBasedTheme:o.spawnOwnership(),onActiveOrHoveredChart:(0,ft.combine)(((e,t)=>e||t),this.chart.isActive().weakReference(),this.chart.isHovered().weakReference()).ownership(),rendererOptionsProvider:n,getBackgroundTopColor:r,getBackgroundBottomColor:r,requestRepaint:()=>{this.chart.model().model().invalidate(ao.InvalidationMask.timeScale(ao.InvalidationLevel.Light,!0))},showHorizontalBorder:!0};this._lhsStubContainer=new Vo(this._properties,"left",a,l,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new Vo(this._properties,"right",a,l,this._options.priceAxisLabelsOptions,this),this._rhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("div"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,
-Kt.createBoundCanvas)(this._dv,(0,Ft.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const c=this._canvasBinding.canvasElement;c.style.position="absolute",c.style.zIndex="1",c.style.left="0",c.style.top="0",this._topCanvasBinding=(0,Kt.createBoundCanvas)(this._dv,(0,Ft.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=cr.MINUTE_SPAN,this._mouseEventHandler=new Wt.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=(0,Ft.size)({width:0,height:0}),(0,mt.hideMarksOnBars)().subscribe(this,(()=>this.chart.model().model().lightUpdate()))}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._rhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.destroy(),this._rhsStubContainer.destroy(),this.chart.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._backgroundBasedTheme.release(),(0,mt.hideMarksOnBars)().unsubscribeAll(this)}setCursor(e){let t="";"grabbing"!==e&&"ew-resize"!==e||(t="time-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}restoreDefaultCursor(){this.setCursor("")}getElement(){return this._element}optimalHeight(){const e=this.rendererOptions();return Math.ceil(e.borderSize+e.offsetSize+e.fontSize+e.paddingTop+e.paddingBottom+e.labelBottomOffset)}setSizes(e,t,i){this.size&&(0,Ft.equalSizes)(this.size,e)||(this.size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px"),this._lhsStubContainer.setSizes(e.height,t),this._rhsStubContainer.setSizes(e.height,i)}rendererOptions(){if(!this._rendererOptions||this._rendererOptions.fontSize!==this.fontSize()){const e=this.fontSize();this._rendererOptions={borderSize:1,offsetSize:5,fontSize:e,font:(0,si.makeFont)(e,m.CHART_FONT_FAMILY,""),widthCache:new Qt.TextWidthCache,paddingTop:3*e/12,paddingBottom:3*e/12,paddingHorizontal:9*e/12,labelBottomOffset:4*e/12}}return this._rendererOptions}backgroundColor(){return this.chart.model().model().backgroundColor().value()}lineColor(){const e=this._properties.childs().lineColor.value()
-;if(0===(0,Nt.parseRgba)(e)[3]){const e=this.chart.model().model().lastPane();if(e&&e.collapsed().value())return this.chart.properties().childs().paneProperties.childs().separatorColor.value()}return e}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,si.makeFont)(this.fontSize(),m.CHART_FONT_FAMILY)}baseBoldFont(){return(0,si.makeFont)(this.fontSize(),m.CHART_FONT_FAMILY,"","bold")}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}onLabelHovered(){return this._onLabelHovered}getScreenshotData(){return{content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this.size.width,contentHeight:this.size.height,lhsStub:this._lhsStubContainer.getScreenshotData(),rhsStub:this._rhsStubContainer.getScreenshotData()}}getContextMenuActions(e){const t=this.chart,i=t.actions(),s=[];if(e||(t.model().timeScale().resetAvailable().value()&&(s.push(i.timeScaleReset),s.push(new zo.Separator)),this._options.timezoneMenuEnabled&&s.push(i.applyTimeZone),s.push(i.sessionBreaks)),!t.model().mainSeries().isDWM()){const e=t.model()?.mainSeries().symbolInfo();if(e){const i=t.model().mainSeries().properties().childs().sessionId,o=(e.subsessions||[]).filter((e=>!e.private));if(o.length>1){const e=o.map((e=>new zo.Action({actionId:"Chart.SetSession",options:{label:(0,hr.translateSessionDescription)(e.description),checkable:!0,checked:i.value()===e.id,statName:"SetSession",onExecute:()=>{t.model().setProperty(i,e.id,ur)}}}))),n=new zo.Action({actionId:"Chart.SetSession",options:{label:_r,statName:"SetSession",subItems:e}});s.push(n)}}}return!t.onWidget()&&l.enabled("show_chart_property_page")&&l.enabled("chart_property_page_scales")&&i.scalesProperties&&(s.length&&s.push(new zo.Separator),s.push(i.scalesProperties)),s}update(){if(!this.chart.hasModel())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=cr.YEAR_SPAN;for(const t of e)this._minVisibleSpan=Math.min(t.span,this._minVisibleSpan)}}updatePriceAxisStubs(){const e=this.chart.model().model(),t=this.chart.hasMaximizedPane()?(0,n.ensureNotNull)(this.chart.maximizedPaneWidget()).state():e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount();this._lhsStubContainer.setScales([],i.left,t.leftPriceScales().length,i.left+i.right),this._rhsStubContainer.setScales([],i.right,t.rightPriceScales().length,i.left+i.right)}paint(e){if(e.level===ao.InvalidationLevel.None||0===this.size.width||0===this.size.height)return;(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const t=(0,Kt.getContext2D)(this._topCanvasBinding.canvasElement);if(e.level>ao.InvalidationLevel.Cursor){const i=(0,Kt.getContext2D)(this._canvasBinding.canvasElement),s=(0,Kt.getBindingRenderingInfo)(this._canvasBinding);this.drawBackground(i,s),this.chart.hasModel()&&(this.drawBorder(i,s),this.drawTickMarks(i,s),
-this.drawBackLabels(i,s),this.drawCrossHairLabel(t,s)),this._lhsStubContainer.paintStubs(e),this._rhsStubContainer.paintStubs(e)}this.drawCrossHairLabel(t,(0,Kt.getBindingRenderingInfo)(this._topCanvasBinding))}drawBackground(e,t){if((0,Kt.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,this.backgroundColor()),!this.chart.hasModel())return;const i=this.chart.model();if(!i.timeScale().isEmpty()){const s=i.model().selection().lineDataSources().filter((e=>!e.isFixed())).reduce(((e,t)=>{const i=t.timeAxisPoints();return 0===i.length?e:e.concat(i)}),[]);s.length>0&&this._highlightBackground(e,s,t)}const s=i.model().crosshairSource();s.startMeasurePoint()&&this._highlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t.verticalPixelRatio)),s=t.bitmapSize.width;e.fillRect(0,0,s,i),e.restore()}drawTickMarks(e,t){const i=this.chart.model().timeScale().marks();if(!i||0===i.length)return;let s=i.reduce(((e,t)=>e.span>t.span?e:t),i[0]).span;s>30&&s<40&&(s=30),e.save(),e.strokeStyle=this.lineColor();const o=this.rendererOptions(),n=o.borderSize+o.offsetSize+o.paddingTop+o.fontSize/2;e.textAlign="center",e.textBaseline="middle",e.fillStyle=this.textColor(),(0,Kt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{e.font=this.baseFont();for(let t=0;t=s&&e.fillText(o.label,o.coord,n)}})),e.restore()}drawBackLabels(e,t){e.save();const i=new Set,s=this.chart.model().model();let o=s.dataSources();const n=s.selection().allSources();for(const e of n)i.add(e);s.hoveredSource()&&i.add(s.hoveredSource());for(const e of s.sourcesBeingMoved())i.add(e);const r=s.customSourceBeingMoved();null!==r&&i.add(r);const a=s.lineBeingEdited()??s.lineBeingCreated();a&&i.add(a),i.add(this.chart.model().crosshairSource()),o=o.concat(s.customSources());const l=this.rendererOptions();for(let s=0;s=s&&(s=a,n=r),a<=i&&(i=a,o=r)}}return n&&t.push(n),o&&t.push(o),t}_zoomAvailable(){const e=this.chart.model().model();return!e.timeScale().isEmpty()&&e.zoomEnabled()&&this._options.pressedMouseMoveScale&&!e.chartFloatingTooltipVisible().value()}_mouseDownOrTouchStartEvent(e){if(this._mousedown||!this._zoomAvailable())return;this._mousedown=!0;const t=this.chart.model();t.timeScale().isEmpty()||t.startScaleTime(e.localX)}_pressedMouseOrTouchMoveEvent(e){this._zoomAvailable()&&this.chart.model().scaleTimeTo(e.localX)}_mouseUpOrTouchEndEvent(e){this._zoomAvailable()&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_contextMenuOrTouchContextMenuEvent(e){this._options.contextMenuEnabled&&Io.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"TimeScaleContextMenu"},{menuName:"TimeScaleContextMenu"})}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){(0,re.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}}var mr,gr,fr,yr,vr=i(85459),Sr=i.n(vr),br=i(76662),wr=i(10341),Cr=i(1395);function Tr(e,t){
-return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}function Pr(e,t){return!!Re.Interval.isEqual(e.res,t.res)&&Tr(e.val,t.val)}!function(e){e.extractErrorReason=function(e){return e.params[1]}}(mr||(mr={})),function(e){e.Default="default",e.FullSingleSession="full_single_session"}(gr||(gr={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(fr||(fr={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(yr||(yr={}));var xr=i(22961);const Mr={duration:250,easing:br.easingFunc.easeOutCubic};class Ir{constructor(e){this._onFinishCalled=!1,this._options={...Mr,...e},this._startTime=performance.now()}getStartPosition(){return this._options.from}getPosition(e){const t=this._calculateProgress(e);return 1===t?(this._options.onFinish&&!this._onFinishCalled&&(this._options.onFinish(!0),this._onFinishCalled=!0),this._options.to):(0,xr.lerp)(this._options.from,this._options.to,this._options.easing(t))}finished(e){return 1===this._calculateProgress(e)}onFinish(e){this._onFinishCalled||(this._options.onFinish?.(e),this._onFinishCalled=!0)}_calculateProgress(e){const t=e-this._startTime;return t>=this._options.duration?1:t/this._options.duration}}var Ar=i(92848),Lr=i(22455);function kr(e,t,i,s){let o=null;if(i.currencyConversionEnabled()&&(0,Lr.isActingAsSymbolSource)(e)){const n=i.availableCurrencies(),r=t.currency(n),a=e.currency();null!==r&&null!==r.selectedCurrency&&!r.allCurrenciesAreOriginal&&r.selectedCurrency!==a&&(s&&null===a||null!==a&&n.convertible(a))&&(o=r.selectedCurrency)}return o}const Er=new dt.TranslatedString("toggle collapsed pane state",a.t(null,void 0,i(46054)));class Dr extends st.UndoCommand{constructor(e,t){super(Er),this._chartModel=e,this._paneIndex=t}redo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}undo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}}const Br=new dt.TranslatedString("toggle maximized pane state",a.t(null,void 0,i(63095)));class Vr extends st.UndoCommand{constructor(e,t){super(Br),this._model=e;const i=e.maximizedPane().value(),s=null===i?null:e.panes().indexOf(i);this._maximizedPaneIndex=t===i?null:e.panes().indexOf(t),this._prevMaximizedPaneIndex=s}redo(){this._setMaximizedPane(this._maximizedPaneIndex)}undo(){this._setMaximizedPane(this._prevMaximizedPaneIndex)}_setMaximizedPane(e){this._model.setMaximizedPane(null===e?null:this._model.panes()[e])}}const Rr=new dt.TranslatedString("move all scales to left",a.t(null,void 0,i(64077))),Nr=new dt.TranslatedString("move all scales to right",a.t(null,void 0,i(19013))),Or=(0,ne.getLogger)("Chart.MergeAllScales");class Fr extends st.UndoCommand{constructor(e,t,i,s,o,n){super(n),this._model=e,this._paneIndex=e.panes().indexOf(t),this._targetPosition=s,this._targetIndex=o,this._scaleId=i.id(),this._sourcePosition=t.priceScalePosition(i),"overlay"!==this._sourcePosition&&(this._sourceIndex=t.priceScaleIndex(i,this._sourcePosition))}redo(){const e=this._model.panes()[this._paneIndex],t=(0,
-n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._targetPosition,this._targetIndex),this._model.fullUpdate()}undo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._sourcePosition,this._sourceIndex),this._model.fullUpdate()}}var Wr=i(13896);class Hr extends st.UndoCommand{constructor(e,t,i,s){super(s,void 0,!Wr.lineToolsDoNotAffectChartInvalidation),this._createdIds=[],this._actionSourceWasSent=!1,this._model=e,this._withoutShift=i,this._origStates=t.map((e=>e.state(!0)));const o=e.lineToolsGroupModel();this._origGroups=t.map((e=>{const t=o.groupForLineTool(e);return t&&t.id}))}redo(){const e=this._model.lineToolsGroupModel();let t;this._actionSourceWasSent||(t="Clone",this._actionSourceWasSent=!0);const i=this._origStates.map(((i,s)=>{const o=(0,n.ensureNotNull)(this._model.dataSourceForId(i.id)),r=0===this._createdIds.length?void 0:(0,n.ensureDefined)(this._createdIds[s]),a=(0,zs.cloneLineTool)(this._model,o,!this._withoutShift,r,t);void 0!==i.sharingMode&&a.share(i.sharingMode);const l=(0,n.ensureNotNull)(o.priceScale());(0,n.ensureNotNull)(this._model.paneForSource(o)).addDataSource(a,l,!1);const c=this._origGroups[s];if(null!==c){const t=e.groupForId(c);t&&t.addLineTools([a])}return this._model.updateSource(a),a}));0===this._createdIds.length&&(this._createdIds=i.map((e=>e.id()))),this._model.selectionMacro((e=>{e.clearSelection(),i.forEach((t=>{e.addSourceToSelection(t)}))})),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=this._model.lineToolsGroupModel();this._createdIds.forEach((t=>{const i=(0,n.ensureNotNull)(this._model.dataSourceForId(t)),s=e.groupForLineTool(i);null!==s&&s.excludeLineTool(i),this._model.removeSource(i)}))}newIds(){return this._createdIds}}class zr extends st.UndoCommand{constructor(e,t,i,s=!0){super(t,i,s),this._invalidateViaSync=!1,this._chartModel=e}redo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSynchronizationInLayoutAction((async()=>this._redo())):this._redo()}undo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSynchronizationInLayoutAction((async()=>this._undo())):this._undo()}}var Ur=i(97217);function jr(e,t,i){let s=[];const o=e.children(t,!1,i);for(let t=0;t{e.children(t,!1,i).forEach((e=>{s.has(e)||(s.add(e),o(e))}))};return t.forEach(o),t.filter((e=>!s.has(e))).map((t=>jr(e,t,i))).reduce(((e,t)=>e.concat(t)),[])}function qr(e,t){return Gr(e,t,!0).reduce(((e,t)=>((0,Ur.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e)),[[],[]])}function $r(e,t){qr(e,t).reverse().forEach((t=>{t.map((t=>e.dataSourceForId(t))).filter(tt.notNull).forEach((t=>{e.removeSource(t)}))}))}var Kr=i(29603);class Yr extends zr{constructor({chartModel:e,title:t,lineDataSourceIds:i}){super(e,t,void 0,!Wr.lineToolsDoNotAffectChartInvalidation),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._lineDataSourceIds=i}
-_redo(){const e=this._lineDataSourceIds.map((e=>(0,n.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._groupLineToolsByGroups(e).forEach(((e,t)=>{const i=new Kr.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)})),e.forEach((e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,n.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)}))}_undo(){for(let e=this._undoState.shift();e;e=this._undoState.shift())this._chartModel.restoreSource(!1,e.paneIndex,null,e.state,null)?.share(e.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach((e=>e.undo()))}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce(((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e}),new Map)}}var Zr=i(2258),Xr=i(42516);const Jr=(0,ne.getLogger)("Chart.RemoveSourcesUndoCommand"),Qr=new dt.TranslatedString("remove line data sources",a.t(null,void 0,i(38199)));class ea extends zr{constructor(e,t,i){super(e,i,void 0,(0,Xr.sourcesAffectState)(t)),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[s,o]=qr(e,t);this._sourceIds=s,this._lineDataSourceIds=o,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const r=t[0];1===t.length&&(0,Ws.isStudy)(r)&&(this._initialPriceScaleMode=(0,n.ensureNotNull)(r.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}_redo(){this._chartModel.panes().length;const e=this._sourceIds.map((e=>(0,n.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._sourceStates=e.map((e=>{const t=e.state(!1);return null===t&&(0,Ws.isStudyStub)(e)?e.getDescriptor():t}));const t=e.map((e=>(0,n.ensureNotNull)(this._chartModel.paneForSource(e))));this._paneIndexes=t.map((e=>this._chartModel.panes().indexOf(e))),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new Yr({title:Qr,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map(((e,i)=>{const s=e.priceScale();if(null===s)return null;const o=t[i].priceScalePosition(s);return{id:s.id(),position:o,priceScaleIndex:t[i].priceScaleIndex(s,o)}}));const i=new Set;e.forEach(((e,t)=>{i.add(this._paneIndexes[t])})),this._paneStates=e.map(((e,s)=>{const o=this._paneIndexes[s];return i.has(o)?t[s].state({includeSources:!1,withData:!0}):null})),this._restorePanes=e.map((e=>this._chartModel.removeSource(e)))}_undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._sourceStates[t];if(null!==i){let s=null;s=(0,Zr.isStudyStubDescriptor)(i)?this._chartModel.restoreStudyStub(i):this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],i,this._priceScalePositionIds[t]),s&&e.push(s)}}
-e.some(((t,i)=>t.id()!==this._sourceIds[e.length-i-1]))&&Jr.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,n.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}class ta extends st.UndoCommand{constructor(e,t,i,s=!0){super(i,s,(0,Xr.sourcesAffectState)(t)),this._newStates=[],this._model=e,this._savedStates=t.map((e=>e.state(!1)))}redo(){this._applyState(this._newStates)}undo(){0===this._newStates.length&&this.saveNewState(),this._applyState(this._savedStates)}saveNewState(){const e=this._savedStates.filter(tt.notNull).map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e.id))));this._newStates=e.map((e=>e.state(!1)))}_applyState(e){for(const t of e)if(null!==t){const e=this._model.dataSourceForId(t.id);if(null!==e)if((0,Ws.isStudy)(e)){const i=t.state.inputs,s=e.properties().childs().inputs.childs();for(const e in i)s[e]&&s[e].setValue(i[e])}else{const i=e;this._model.restoreLineToolState(i,t,!0),i.synchronizeAlert(!0)}}}}class ia extends st.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const s=(0,n.ensureNotNull)(t.priceScale());this._initialPriceScaleId=s.id(),this._initialPriceScaleState=(0,n.ensureNotNull)(t.priceScale()).state();const o=(0,n.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=o.priceScalePosition(s),this._initialPriceScaleIndex=o.priceScaleIndex(s,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(o)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,delete t.hasCalculatedPriceRange,t}_originalPriceScaleState(){return this._initialPriceScaleState}}class sa extends ia{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,n.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(e)}));const s=this._chartModel.createPane(this.targetPaneIndex(e)),o=s.findSuitableScale(e);s.bulkActionMacro((()=>{s.addDataSource(e,o,!1),i.forEach((e=>s.addDataSource(e,o,!1)))}));const r=(0,n.ensureNotNull)(e.priceScale());r.restoreState(this._newPriceScaleState(s.isOverlay(e))),r.setHeight(s.height()),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,n.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e)));const t=this._chartModel.detachSource(e);(0,n.assert)(t,"Undo of detaching must remove pane")}));const s=this._chartModel.panes()[this._initialPaneIndex];let o=s.getPriceScaleById(this._initialPriceScaleId)
-;null===o&&(o=s.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),s.bulkActionMacro((()=>{s.addDataSource(e,o,!0),i.forEach((e=>s.addDataSource(e,o,!1)))}));const r=(0,n.ensureNotNull)(e.priceScale());r.restoreState(this._originalPriceScaleState()),r.setHeight(s.height()),this._chartModel.fullUpdate()}}class oa extends sa{constructor(e,t,i){super(e,t,i)}targetPaneIndex(e){const t=this._chartModel.panes();if(!t[this._initialPaneIndex].containsMainSeries()||e===this._chartModel.mainSeries())return this._initialPaneIndex+1;for(let e=this._initialPaneIndex+1;e=0;e--)if(t[e].mode()===zi.PaneMode.Regular)return e>0&&t[e].containsMainSeries()&&t[e-1].mode()===zi.PaneMode.Widget?e-1:e;return 0}}class ra extends sa{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}class aa extends ia{constructor(e,t,i,s){super(e,t,i),this._restorePane=!1,this._keepZOrder=s??!1,this._initialZOrder=t.zorder()}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),s=(0,n.ensureNotNull)(this._chartModel.paneForSource(i)),o=this._chartModel.children(i,!0,!0);s.bulkActionMacro((()=>{o.forEach((e=>this._chartModel.detachSource(e))),this._restorePane=this._chartModel.detachSource(i)}));const r="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,r),l=0===a.dataSources().length;if(t.bulkActionMacro((()=>{t.addDataSource(i,a,this._keepZOrder),o.forEach((e=>t.addDataSource(e,a,this._keepZOrder)))})),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){const e=(0,n.ensureNotNull)(i.priceScale());e.restoreState(this._newPriceScaleState(t.isOverlay(i))),e.setHeight(t.height())}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,n.ensureNotNull)(this._chartModel.paneForSource(t)),s=this._chartModel.children(t,!0,!0);i.bulkActionMacro((()=>{s.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(t)}));let o=e.getPriceScaleById(this._initialPriceScaleId);null===o&&(o=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro((()=>{t.setZorder(this._initialZOrder),e.addDataSource(t,o,!0),
-s.forEach((t=>e.addDataSource(t,o,!1)))}));const r=(0,n.ensureNotNull)(t.priceScale());r.restoreState(this._originalPriceScaleState()),r.setHeight(e.height()),this._chartModel.fullUpdate()}}class la extends aa{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){const e=this._chartModel.panes();for(let t=this._initialPaneIndex-1;t>=0;t--)if(e[t].mode()===zi.PaneMode.Regular)return t;throw new Error("No regular pane found above for merging")}}class ca extends aa{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){const e=this._chartModel.panes();for(let t=this._initialPaneIndex+1;tUt.HitTarget.MovePointBackground))t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i})&&!(0,Ut.shouldDefaultActionBeExecuted)(e,(0,n.ensureNotNull)(t.hittest.data()),"doubleClickHandler","doubleTapHandler")||this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,Lt.isLineToolName)(mt.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new To.EnvironmentState(e).mod()&&!t.maximized().value()?(t.collapsed().value()||t.collapsingAvailable().value())&&this._chartUndoModel().toggleCollapsedPane(this.state()):this._chartUndoModel().toggleMaximizedPane(this.state())}}_contextMenuEvent(e){const t=this._chartUndoModel()
+;if(t.crosshairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return t.crosshairSource().clearMeasure(),void(0,mt.resetToCursor)(!0);if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,mt.toolIsCursor)(mt.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,mt.resetToCursor)(!0),this.setCursorForTool(),void(t.lineBeingCreated()&&t.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i?i.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const o=i&&i.hittest?i.hittest.target():0,n=o>=Ut.HitTarget.Regular||o>=Ut.HitTarget.MovePointBackground&&e.isTouch;if(t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),t.addSourceToSelection(s,Xn(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s)if((0,Po.isDataSource)(s)&&s.hasContextMenu())s.isSelectionEnabled()?this.showContextMenuForSelection(e,void 0,i.hittest):this.showContextMenuForSources([s],e,void 0,void 0,i.hittest);else{const t=this._sourceWasSelected(i);i.hittest.tryCallContextMenuHandler(e,{sourceWasSelected:t})}}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_localCoordinatesToLineDataSourcePoint(e,t,i){const s=this.state().defaultPriceScale();if(s.isEmpty())return null;const o=new Vt.Point(e,t),r=(0,n.ensure)(i.firstValue());return o.price=s.coordinateToPrice(t,r),o.index=Math.round(this._chartUndoModel().timeScale().coordinateToIndex(e)),o}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crosshairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new Vt.Point(e.localX,e.localY),new Vt.Point(i.x,e.localY),new To.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof zo.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t0;e--)t(o[e])&&t(o[e-1])&&o.splice(e,1);o.length&&t(o[0])&&o.splice(0,1),o.length&&t(o[o.length-1])&&o.splice(o.length-1,1),Io.ContextMenuManager.showMenu(o,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){const t=this._chart.actions(),i=[];if(this._chart.model().model().resetScalesAvailable().value()&&(i.push(t.chartReset),i.push(new zo.Separator)),
+!this.state().isEmpty()&&l.enabled("datasource_copypaste")&&this.state().mode()===zi.PaneMode.Regular){const{createPasteAction:t,createActionCopyPrice:s}=await(0,Go.actionsProviderModule)(),o=s(this.state(),e.localY),n=t(this._chart,this.state());(o||n)&&(o&&i.push(o),n&&i.push(n),i.push(new zo.Separator))}i[i.length-1]instanceof zo.Separator||i.push(new zo.Separator),i.push(this._createLockTimeAxisAction(e)),i.push(new zo.Separator),i[i.length-1]instanceof zo.Separator||i.push(new zo.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(i.push(t.applyStudiesToAllCharts),i.push(new zo.Separator));const s=t.paneRemoveAllDrawingTools.getState().disabled;s||i.push(t.paneRemoveAllDrawingTools);const o=t.paneRemoveAllStudies.getState().disabled;return o||i.push(t.paneRemoveAllStudies),s&&o||i.push(new zo.Separator),i.push(t.hideAllMarks),i.push(new zo.Separator),l.enabled("show_chart_property_page")&&i.push(t.chartProperties),i[i.length-1]instanceof zo.Separator&&i.pop(),i}_loadAndCreateLegendWidget(){Promise.all([i.e(3644),i.e(3439),i.e(1171),i.e(2537),i.e(8752),i.e(7780),i.e(2112),i.e(7691),i.e(7369),i.e(2227),i.e(2477),i.e(8093),i.e(5093)]).then(i.bind(i,6639)).then((e=>{if(this._isDestroyed||!this._options.legendWidgetEnabled||this._legendWidget)return;const t=e.LegendWidget,i=(0,ge.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!ze.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled,pineSourceStatusEnabled:this._options.pineSourceStatusEnabled,alertStatusEnabled:this._options.alertStatusEnabled};const s=(0,ft.combine)(((e,t)=>tr&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),o=(0,ft.combine)(((e,t)=>null!==e?e===this._state:(0,mt.toolIsMeasure)(t)),this._chartModel().crosshairSource().measurePane().weakReference(),mt.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),o.ownership(),i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart),onLegendRowFocused:()=>{this._chart.chartWidgetCollection().activeChartWidget.setValue(this._chart)}}),this._div.prepend(this._legendWidget.getElement()),this._legendWidget.updateLayout(),
+this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,n.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}_loadAndCreatePaneControlsWidget(e){Promise.all([i.e(3644),i.e(3439),i.e(1171),i.e(2537),i.e(8752),i.e(7780),i.e(2112),i.e(7691),i.e(7369),i.e(2227),i.e(2477),i.e(8093),i.e(5093)]).then(i.bind(i,24028)).then((t=>{if(this._isDestroyed||this._state!==e)return;const i=t.PaneControlsWidget;this._paneControls=new i(this._chartUndoModel(),e,{backgroundThemeName:this._chart.backgroundTopTheme(),anySeparatorSelected:this._anySeparatorSelected.weakReference()},this._div),this._paneControls.updateWidgetModeByWidth(this._size.width),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new ResizeObserver(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),this._state?.collapsed().value()&&this._chartModel().fullUpdate()}))}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+2*Wn;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive().value()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crosshairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive().value()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crosshairSource().visible&&this._updateLineToolUsingMagnetOrShift(To.EnvironmentState.create((0,Vs.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,Lt.isLineToolName)(mt.tool.value())&&t.crosshairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(mt.isStudyEditingNow.value()&&this.setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this.setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(Ns.TabNames.symbol);else if((0,zs.isLineTool)(e)||(0,Ws.isStudy)(e)){let i;const s=t?.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=er.get(e))}this._chart.showChartPropertiesForSource(e,i).then((e=>{this._editDialog=e}))}}_initToolCreationModeParams(e){this._startTouchPoint=new Vt.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crosshairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,
+i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crosshairSource();this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint());const s=e.pageX,o=e.pageY,r=(0,n.ensureNotNull)(this._initCrossHairPosition),a=new Vt.Point(s,o).subtract((0,n.ensureNotNull)(this._startTouchPoint)),l=r.add(a);this.setCursorPosition(l.x,l.y,new To.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(e){const t=this.state();for(const i of t.leftPriceScales())t.recalculatePriceScale(i,e);for(const i of t.rightPriceScales())t.recalculatePriceScale(i,e);for(const i of t.sourcesByGroup().overlayPriceScaleSources())(0,zs.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){const t=0===mt.crosshairLock.value()?.type;return new zo.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:jn,statName:"LockCursorInTime",checkable:!0,checked:t,onExecute:()=>this._toggleLockTimeAxis(e.localX,!t)}})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i);if(null!==s)return void mt.crosshairLock.setValue({type:0,time:s})}mt.crosshairLock.setValue(null)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){const s=this._chartUndoModel(),o=s.model();let n=!1;const r=e&&e.source,a=this._chart.readOnly();if(o.crosshairSource().isReplaySelection())this._setCursorClassName("none");else if(!(!a||e&&(0,zs.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())a&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const l=mt.tool.value();let c=null;if(!this._processing&&((0,mt.toolIsCursor)(l)||(0,mt.toolIsEraser)(l)&&!a||t.mod()||!s.lineBeingCreated())){const t=e?.hittest;n=Boolean(t?.data()?.hideCrosshairLinesOnHover),t&&t.target()>Ut.HitTarget.MovePointBackground?(c=r,!r?.isHoveredEnabled()||(0,mt.toolIsEraser)(l)&&r===s.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(r,t.data(),0)):o.setHoveredSource(null,null)}a?this.setCursorForTool(c,t,ei.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(c,t,e?.hittest.data()?.cursorType));const h=o.customSourceBeingMoved(),d=null!==h?[h]:o.sourcesBeingMoved();if((!d.length||null!==e&&-1===d.indexOf(e.source))&&this._updateCommonTooltip(e),!a&&null!==e&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case ei.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ei.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case ei.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ei.PaneCursorType.DiagonalNwSeResize:
+this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crosshairSource().setLinesShouldBeHidden(n)}async _createErrorBlock(){const e=new(await Ks());return this._div.insertBefore(e.container,this._topCanvasBinding.canvasElement.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!l.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let o;if(i&&!i.isEmpty()){const e=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();o=i.coordinateToPrice(this._contextMenuY,(0,n.ensureNotNull)(e))}return(0,ee.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:o,callback:t=>{[...t].forEach((t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new zo.Separator:new zo.Action({actionId:"Chart.ExternalActionId",options:{label:t.text,onExecute:t.click}}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}}))}}),e}_highlightPriceAxisesByLabel(e){this._state?.mode()===zi.PaneMode.Regular&&(this._lhsPriceAxisesContainer.setHighlightedPriceAxises(e),this._rhsPriceAxisesContainer.setHighlightedPriceAxises(e))}_subscribeToState(){const e=this.state();e.onDestroyed().subscribe(this,this._onStateDestroyed,!0),e.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),e.maximized().subscribe(this._updateVisuallyCollapsed,{callWithLast:!0}),e.collapsed().subscribe(this._updateVisuallyCollapsed,{callWithLast:!0}),e.maximized().subscribe(this._updateMaximized,{callWithLast:!0})}_unsubscribeFromState(){const e=this.state();e.onDestroyed().unsubscribeAll(this),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.maximized().unsubscribe(this._updateVisuallyCollapsed),e.collapsed().unsubscribe(this._updateVisuallyCollapsed),e.maximized().unsubscribe(this._updateMaximized),this._maximized.setValue(!1)}_updateAccessibilityAttr(){if(this.hasState()&&this.state().isMainPane().value()){const e=this._chartModel().mainSeries(),t=e.symbol(),s=(0,ht.getTranslatedResolutionModel)(e.interval()).hint,o=a.t(null,{replace:{symbol:t,interval:s}},i(1136));this._topCanvasBinding.canvasElement.setAttribute("aria-label",o)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){0}_paneDblClickOrTapEvent(e){if(this._chart.readOnly())return;const t=this._dataSourceAtPoint(e.localX,e.localY);if(null!==t&&(0,zs.isEditableTextLineTool)(t.source)){const e=t.source.textEditingActivationTime();null!==e&&performance.now()-e<500&&this.processDoubleClickOnSource(t.source,t.hittest)}}}class ar{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),
+this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,n.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0,n.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,n.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var lr,cr=i(19679),hr=i(95772);i(20715);!function(e){e[e.BorderSize=1]="BorderSize",e[e.OffsetSize=5]="OffsetSize"}(lr||(lr={}));const dr={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},ur=new dt.TranslatedString("change session",a.t(null,void 0,i(87041))),_r=a.t(null,void 0,i(94031));class pr{constructor(e,t,i,s,o){this._rendererOptions=null,this._onLabelHovered=new ae.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,tt.merge)((0,tt.clone)(dr),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("div"),this._element.style.display="flex",this._backgroundBasedTheme=o;const n=e.model().model().rendererOptionsProvider(),r=()=>this.backgroundColor(),a=()=>{throw new Error("Time axis does not support real price scales")},l={titlesProvider:i,stubContextMenuProvider:async(e,t)=>{const i=await s(e,t),o=this.getContextMenuActions(!0);return 0===o.length?i:i.concat(new zo.Separator,o)},backgroundBasedTheme:o.spawnOwnership(),onActiveOrHoveredChart:(0,ft.combine)(((e,t)=>e||t),this.chart.isActive().weakReference(),this.chart.isHovered().weakReference()).ownership(),rendererOptionsProvider:n,getBackgroundTopColor:r,getBackgroundBottomColor:r,requestRepaint:()=>{this.chart.model().model().invalidate(ao.InvalidationMask.timeScale(ao.InvalidationLevel.Light,!0))},showHorizontalBorder:!0};this._lhsStubContainer=new Vo(this._properties,"left",a,l,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new Vo(this._properties,"right",a,l,this._options.priceAxisLabelsOptions,this),this._rhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("div"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",
+this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,Kt.createBoundCanvas)(this._dv,(0,Ft.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const c=this._canvasBinding.canvasElement;c.style.position="absolute",c.style.zIndex="1",c.style.left="0",c.style.top="0",this._topCanvasBinding=(0,Kt.createBoundCanvas)(this._dv,(0,Ft.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=cr.MINUTE_SPAN,this._mouseEventHandler=new Wt.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=(0,Ft.size)({width:0,height:0}),(0,mt.hideMarksOnBars)().subscribe(this,(()=>this.chart.model().model().lightUpdate()))}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._rhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.destroy(),this._rhsStubContainer.destroy(),this.chart.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._backgroundBasedTheme.release(),(0,mt.hideMarksOnBars)().unsubscribeAll(this)}setCursor(e){let t="";"grabbing"!==e&&"ew-resize"!==e||(t="time-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}restoreDefaultCursor(){this.setCursor("")}getElement(){return this._element}optimalHeight(){const e=this.rendererOptions();return Math.ceil(e.borderSize+e.offsetSize+e.fontSize+e.paddingTop+e.paddingBottom+e.labelBottomOffset)}setSizes(e,t,i){this.size&&(0,Ft.equalSizes)(this.size,e)||(this.size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px"),this._lhsStubContainer.setSizes(e.height,t),this._rhsStubContainer.setSizes(e.height,i)}rendererOptions(){if(!this._rendererOptions||this._rendererOptions.fontSize!==this.fontSize()){const e=this.fontSize();this._rendererOptions={borderSize:1,offsetSize:5,fontSize:e,font:(0,si.makeFont)(e,m.CHART_FONT_FAMILY,""),widthCache:new Qt.TextWidthCache,paddingTop:3*e/12,paddingBottom:3*e/12,paddingHorizontal:9*e/12,labelBottomOffset:4*e/12}}
+return this._rendererOptions}backgroundColor(){return this.chart.model().model().backgroundColor().value()}lineColor(){const e=this._properties.childs().lineColor.value();if(0===(0,Nt.parseRgba)(e)[3]){const e=this.chart.model().model().lastPane();if(e&&e.collapsed().value())return this.chart.properties().childs().paneProperties.childs().separatorColor.value()}return e}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,si.makeFont)(this.fontSize(),m.CHART_FONT_FAMILY)}baseBoldFont(){return(0,si.makeFont)(this.fontSize(),m.CHART_FONT_FAMILY,"","bold")}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}onLabelHovered(){return this._onLabelHovered}getScreenshotData(){return{content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this.size.width,contentHeight:this.size.height,lhsStub:this._lhsStubContainer.getScreenshotData(),rhsStub:this._rhsStubContainer.getScreenshotData()}}getContextMenuActions(e){const t=this.chart,i=t.actions(),s=[];if(e||(t.model().timeScale().resetAvailable().value()&&(s.push(i.timeScaleReset),s.push(new zo.Separator)),this._options.timezoneMenuEnabled&&s.push(i.applyTimeZone),s.push(i.sessionBreaks)),!t.model().mainSeries().isDWM()){const e=t.model()?.mainSeries().symbolInfo();if(e){const i=t.model().mainSeries().properties().childs().sessionId,o=(e.subsessions||[]).filter((e=>!e.private));if(o.length>1){const e=o.map((e=>new zo.Action({actionId:"Chart.SetSession",options:{label:(0,hr.translateSessionDescription)(e.description),checkable:!0,checked:i.value()===e.id,statName:"SetSession",onExecute:()=>{t.model().setProperty(i,e.id,ur)}}}))),n=new zo.Action({actionId:"Chart.SetSession",options:{label:_r,statName:"SetSession",subItems:e}});s.push(n)}}}return!t.onWidget()&&l.enabled("show_chart_property_page")&&l.enabled("chart_property_page_scales")&&i.scalesProperties&&(s.length&&s.push(new zo.Separator),s.push(i.scalesProperties)),s}update(){if(!this.chart.hasModel())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=cr.YEAR_SPAN;for(const t of e)this._minVisibleSpan=Math.min(t.span,this._minVisibleSpan)}}updatePriceAxisStubs(){const e=this.chart.model().model(),t=this.chart.hasMaximizedPane()?(0,n.ensureNotNull)(this.chart.maximizedPaneWidget()).state():e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount();this._lhsStubContainer.setScales([],i.left,t.leftPriceScales().length,i.left+i.right),this._rhsStubContainer.setScales([],i.right,t.rightPriceScales().length,i.left+i.right)}paint(e){if(e.level===ao.InvalidationLevel.None||0===this.size.width||0===this.size.height)return;(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,Kt.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const t=(0,Kt.getContext2D)(this._topCanvasBinding.canvasElement);if(e.level>ao.InvalidationLevel.Cursor){const i=(0,
+Kt.getContext2D)(this._canvasBinding.canvasElement),s=(0,Kt.getBindingRenderingInfo)(this._canvasBinding);this.drawBackground(i,s),this.chart.hasModel()&&(this.drawBorder(i,s),this.drawTickMarks(i,s),this.drawBackLabels(i,s),this.drawCrossHairLabel(t,s)),this._lhsStubContainer.paintStubs(e),this._rhsStubContainer.paintStubs(e)}this.drawCrossHairLabel(t,(0,Kt.getBindingRenderingInfo)(this._topCanvasBinding))}drawBackground(e,t){if((0,Kt.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,this.backgroundColor()),!this.chart.hasModel())return;const i=this.chart.model();if(!i.timeScale().isEmpty()){const s=i.model().selection().lineDataSources().filter((e=>!e.isFixed())).reduce(((e,t)=>{const i=t.timeAxisPoints();return 0===i.length?e:e.concat(i)}),[]);s.length>0&&this._highlightBackground(e,s,t)}const s=i.model().crosshairSource();s.startMeasurePoint()&&this._highlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t.verticalPixelRatio)),s=t.bitmapSize.width;e.fillRect(0,0,s,i),e.restore()}drawTickMarks(e,t){const i=this.chart.model().timeScale().marks();if(!i||0===i.length)return;let s=i.reduce(((e,t)=>e.span>t.span?e:t),i[0]).span;s>30&&s<40&&(s=30),e.save(),e.strokeStyle=this.lineColor();const o=this.rendererOptions(),n=o.borderSize+o.offsetSize+o.paddingTop+o.fontSize/2;e.textAlign="center",e.textBaseline="middle",e.fillStyle=this.textColor(),(0,Kt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{e.font=this.baseFont();for(let t=0;t=s&&e.fillText(o.label,o.coord,n)}})),e.restore()}drawBackLabels(e,t){e.save();const i=new Set,s=this.chart.model().model();let o=s.dataSources();const n=s.selection().allSources();for(const e of n)i.add(e);s.hoveredSource()&&i.add(s.hoveredSource());for(const e of s.sourcesBeingMoved())i.add(e);const r=s.customSourceBeingMoved();null!==r&&i.add(r);const a=s.lineBeingEdited()??s.lineBeingCreated();a&&i.add(a),i.add(this.chart.model().crosshairSource()),o=o.concat(s.customSources());const l=this.rendererOptions();for(let s=0;s=s&&(s=a,n=r),a<=i&&(i=a,o=r)}}return n&&t.push(n),o&&t.push(o),t}_zoomAvailable(){const e=this.chart.model().model();return!e.timeScale().isEmpty()&&e.zoomEnabled()&&this._options.pressedMouseMoveScale&&!e.chartFloatingTooltipVisible().value()}_mouseDownOrTouchStartEvent(e){if(this._mousedown||!this._zoomAvailable())return;this._mousedown=!0;const t=this.chart.model();t.timeScale().isEmpty()||t.startScaleTime(e.localX)}_pressedMouseOrTouchMoveEvent(e){this._zoomAvailable()&&this.chart.model().scaleTimeTo(e.localX)}_mouseUpOrTouchEndEvent(e){this._zoomAvailable()&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_contextMenuOrTouchContextMenuEvent(e){this._options.contextMenuEnabled&&Io.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"TimeScaleContextMenu"},{menuName:"TimeScaleContextMenu"})}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){(0,
+re.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}}var mr,gr,fr,yr,vr=i(85459),Sr=i.n(vr),br=i(76662),wr=i(10341),Cr=i(1395);function Tr(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}function Pr(e,t){return!!Re.Interval.isEqual(e.res,t.res)&&Tr(e.val,t.val)}!function(e){e.extractErrorReason=function(e){return e.params[1]}}(mr||(mr={})),function(e){e.Default="default",e.FullSingleSession="full_single_session"}(gr||(gr={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(fr||(fr={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(yr||(yr={}));var xr=i(22961);const Mr={duration:250,easing:br.easingFunc.easeOutCubic};class Ir{constructor(e){this._onFinishCalled=!1,this._options={...Mr,...e},this._startTime=performance.now()}getStartPosition(){return this._options.from}getPosition(e){const t=this._calculateProgress(e);return 1===t?(this._options.onFinish&&!this._onFinishCalled&&(this._options.onFinish(!0),this._onFinishCalled=!0),this._options.to):(0,xr.lerp)(this._options.from,this._options.to,this._options.easing(t))}finished(e){return 1===this._calculateProgress(e)}onFinish(e){this._onFinishCalled||(this._options.onFinish?.(e),this._onFinishCalled=!0)}_calculateProgress(e){const t=e-this._startTime;return t>=this._options.duration?1:t/this._options.duration}}var Ar=i(92848),Lr=i(22455);function kr(e,t,i,s){let o=null;if(i.currencyConversionEnabled()&&(0,Lr.isActingAsSymbolSource)(e)){const n=i.availableCurrencies(),r=t.currency(n),a=e.currency();null!==r&&null!==r.selectedCurrency&&!r.allCurrenciesAreOriginal&&r.selectedCurrency!==a&&(s&&null===a||null!==a&&n.convertible(a))&&(o=r.selectedCurrency)}return o}const Er=new dt.TranslatedString("toggle collapsed pane state",a.t(null,void 0,i(46054)));class Dr extends st.UndoCommand{constructor(e,t){super(Er),this._chartModel=e,this._paneIndex=t}redo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}undo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}}const Br=new dt.TranslatedString("toggle maximized pane state",a.t(null,void 0,i(63095)));class Vr extends st.UndoCommand{constructor(e,t){super(Br),this._model=e;const i=e.maximizedPane().value(),s=null===i?null:e.panes().indexOf(i);this._maximizedPaneIndex=t===i?null:e.panes().indexOf(t),this._prevMaximizedPaneIndex=s}redo(){this._setMaximizedPane(this._maximizedPaneIndex)}undo(){this._setMaximizedPane(this._prevMaximizedPaneIndex)}_setMaximizedPane(e){this._model.setMaximizedPane(null===e?null:this._model.panes()[e])}}const Rr=new dt.TranslatedString("move all scales to left",a.t(null,void 0,i(64077))),Nr=new dt.TranslatedString("move all scales to right",a.t(null,void 0,i(19013))),Or=(0,ne.getLogger)("Chart.MergeAllScales");class Fr extends st.UndoCommand{constructor(e,t,i,s,o,n){super(n),this._model=e,this._paneIndex=e.panes().indexOf(t),this._targetPosition=s,this._targetIndex=o,this._scaleId=i.id(),
+this._sourcePosition=t.priceScalePosition(i),"overlay"!==this._sourcePosition&&(this._sourceIndex=t.priceScaleIndex(i,this._sourcePosition))}redo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._targetPosition,this._targetIndex),this._model.fullUpdate()}undo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._sourcePosition,this._sourceIndex),this._model.fullUpdate()}}var Wr=i(13896);class Hr extends st.UndoCommand{constructor(e,t,i,s){super(s,void 0,!Wr.lineToolsDoNotAffectChartInvalidation),this._createdIds=[],this._actionSourceWasSent=!1,this._model=e,this._withoutShift=i,this._origStates=t.map((e=>e.state(!0)));const o=e.lineToolsGroupModel();this._origGroups=t.map((e=>{const t=o.groupForLineTool(e);return t&&t.id}))}redo(){const e=this._model.lineToolsGroupModel();let t;this._actionSourceWasSent||(t="Clone",this._actionSourceWasSent=!0);const i=this._origStates.map(((i,s)=>{const o=(0,n.ensureNotNull)(this._model.dataSourceForId(i.id)),r=0===this._createdIds.length?void 0:(0,n.ensureDefined)(this._createdIds[s]),a=(0,zs.cloneLineTool)(this._model,o,!this._withoutShift,r,t);void 0!==i.sharingMode&&a.share(i.sharingMode);const l=(0,n.ensureNotNull)(o.priceScale());(0,n.ensureNotNull)(this._model.paneForSource(o)).addDataSource(a,l,!1);const c=this._origGroups[s];if(null!==c){const t=e.groupForId(c);t&&t.addLineTools([a])}return this._model.updateSource(a),a}));0===this._createdIds.length&&(this._createdIds=i.map((e=>e.id()))),this._model.selectionMacro((e=>{e.clearSelection(),i.forEach((t=>{e.addSourceToSelection(t)}))})),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=this._model.lineToolsGroupModel();this._createdIds.forEach((t=>{const i=(0,n.ensureNotNull)(this._model.dataSourceForId(t)),s=e.groupForLineTool(i);null!==s&&s.excludeLineTool(i),this._model.removeSource(i)}))}newIds(){return this._createdIds}}class zr extends st.UndoCommand{constructor(e,t,i,s=!0){super(t,i,s),this._invalidateViaSync=!1,this._chartModel=e}redo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSynchronizationInLayoutAction((async()=>this._redo())):this._redo()}undo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSynchronizationInLayoutAction((async()=>this._undo())):this._undo()}}var Ur=i(97217);function jr(e,t,i){let s=[];const o=e.children(t,!1,i);for(let t=0;t{e.children(t,!1,i).forEach((e=>{s.has(e)||(s.add(e),o(e))}))};return t.forEach(o),t.filter((e=>!s.has(e))).map((t=>jr(e,t,i))).reduce(((e,t)=>e.concat(t)),[])}function qr(e,t){return Gr(e,t,!0).reduce(((e,t)=>((0,Ur.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e)),[[],[]])}function $r(e,t){qr(e,t).reverse().forEach((t=>{t.map((t=>e.dataSourceForId(t))).filter(tt.notNull).forEach((t=>{e.removeSource(t)}))}))}var Kr=i(29603);class Yr extends zr{
+constructor({chartModel:e,title:t,lineDataSourceIds:i}){super(e,t,void 0,!Wr.lineToolsDoNotAffectChartInvalidation),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._lineDataSourceIds=i}_redo(){const e=this._lineDataSourceIds.map((e=>(0,n.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._groupLineToolsByGroups(e).forEach(((e,t)=>{const i=new Kr.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)})),e.forEach((e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,n.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)}))}_undo(){for(let e=this._undoState.shift();e;e=this._undoState.shift())this._chartModel.restoreSource(!1,e.paneIndex,null,e.state,null)?.share(e.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach((e=>e.undo()))}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce(((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e}),new Map)}}var Zr=i(2258),Xr=i(42516);const Jr=(0,ne.getLogger)("Chart.RemoveSourcesUndoCommand"),Qr=new dt.TranslatedString("remove line data sources",a.t(null,void 0,i(38199)));class ea extends zr{constructor(e,t,i){super(e,i,void 0,(0,Xr.sourcesAffectState)(t)),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[s,o]=qr(e,t);this._sourceIds=s,this._lineDataSourceIds=o,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const r=t[0];1===t.length&&(0,Ws.isStudy)(r)&&(this._initialPriceScaleMode=(0,n.ensureNotNull)(r.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}_redo(){this._chartModel.panes().length;const e=this._sourceIds.map((e=>(0,n.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._sourceStates=e.map((e=>{const t=e.state(!1);return null===t&&(0,Ws.isStudyStub)(e)?e.getDescriptor():t}));const t=e.map((e=>(0,n.ensureNotNull)(this._chartModel.paneForSource(e))));this._paneIndexes=t.map((e=>this._chartModel.panes().indexOf(e))),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new Yr({title:Qr,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map(((e,i)=>{const s=e.priceScale();if(null===s)return null;const o=t[i].priceScalePosition(s);return{id:s.id(),position:o,priceScaleIndex:t[i].priceScaleIndex(s,o)}}));const i=new Set;e.forEach(((e,t)=>{i.add(this._paneIndexes[t])})),this._paneStates=e.map(((e,s)=>{const o=this._paneIndexes[s];return i.has(o)?t[s].state({includeSources:!1,withData:!0}):null})),this._restorePanes=e.map((e=>this._chartModel.removeSource(e)))}_undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._sourceStates[t];if(null!==i){let s=null;s=(0,
+Zr.isStudyStubDescriptor)(i)?this._chartModel.restoreStudyStub(i):this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],i,this._priceScalePositionIds[t]),s&&e.push(s)}}e.some(((t,i)=>t.id()!==this._sourceIds[e.length-i-1]))&&Jr.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,n.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}class ta extends st.UndoCommand{constructor(e,t,i,s=!0){super(i,s,(0,Xr.sourcesAffectState)(t)),this._newStates=[],this._model=e,this._savedStates=t.map((e=>e.state(!1)))}redo(){this._applyState(this._newStates)}undo(){0===this._newStates.length&&this.saveNewState(),this._applyState(this._savedStates)}saveNewState(){const e=this._savedStates.filter(tt.notNull).map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e.id))));this._newStates=e.map((e=>e.state(!1)))}_applyState(e){for(const t of e)if(null!==t){const e=this._model.dataSourceForId(t.id);if(null!==e)if((0,Ws.isStudy)(e)){const i=t.state.inputs,s=e.properties().childs().inputs.childs();for(const e in i)s[e]&&s[e].setValue(i[e])}else{const i=e;this._model.restoreLineToolState(i,t,!0),i.synchronizeAlert(!0)}}}}class ia extends st.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const s=(0,n.ensureNotNull)(t.priceScale());this._initialPriceScaleId=s.id(),this._initialPriceScaleState=(0,n.ensureNotNull)(t.priceScale()).state();const o=(0,n.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=o.priceScalePosition(s),this._initialPriceScaleIndex=o.priceScaleIndex(s,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(o)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,delete t.hasCalculatedPriceRange,t}_originalPriceScaleState(){return this._initialPriceScaleState}}class sa extends ia{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,n.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(e)}));const s=this._chartModel.createPane(this.targetPaneIndex(e)),o=s.findSuitableScale(e);s.bulkActionMacro((()=>{s.addDataSource(e,o,!1),i.forEach((e=>s.addDataSource(e,o,!1)))}));const r=(0,n.ensureNotNull)(e.priceScale());r.restoreState(this._newPriceScaleState(s.isOverlay(e))),r.setHeight(s.height()),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,n.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e)));const t=this._chartModel.detachSource(e);(0,
+n.assert)(t,"Undo of detaching must remove pane")}));const s=this._chartModel.panes()[this._initialPaneIndex];let o=s.getPriceScaleById(this._initialPriceScaleId);null===o&&(o=s.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),s.bulkActionMacro((()=>{s.addDataSource(e,o,!0),i.forEach((e=>s.addDataSource(e,o,!1)))}));const r=(0,n.ensureNotNull)(e.priceScale());r.restoreState(this._originalPriceScaleState()),r.setHeight(s.height()),this._chartModel.fullUpdate()}}class oa extends sa{constructor(e,t,i){super(e,t,i)}targetPaneIndex(e){const t=this._chartModel.panes();if(!t[this._initialPaneIndex].containsMainSeries()||e===this._chartModel.mainSeries())return this._initialPaneIndex+1;for(let e=this._initialPaneIndex+1;e=0;e--)if(t[e].mode()===zi.PaneMode.Regular)return e>0&&t[e].containsMainSeries()&&t[e-1].mode()===zi.PaneMode.Widget?e-1:e;return 0}}class ra extends sa{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}class aa extends ia{constructor(e,t,i,s){super(e,t,i),this._restorePane=!1,this._keepZOrder=s??!1,this._initialZOrder=t.zorder()}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),s=(0,n.ensureNotNull)(this._chartModel.paneForSource(i)),o=this._chartModel.children(i,!0,!0);s.bulkActionMacro((()=>{o.forEach((e=>this._chartModel.detachSource(e))),this._restorePane=this._chartModel.detachSource(i)}));const r="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,r),l=0===a.dataSources().length;if(t.bulkActionMacro((()=>{t.addDataSource(i,a,this._keepZOrder),o.forEach((e=>t.addDataSource(e,a,this._keepZOrder)))})),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){const e=(0,n.ensureNotNull)(i.priceScale());e.restoreState(this._newPriceScaleState(t.isOverlay(i))),e.setHeight(t.height())}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,n.ensureNotNull)(this._chartModel.paneForSource(t)),s=this._chartModel.children(t,!0,!0);i.bulkActionMacro((()=>{s.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(t)}));let o=e.getPriceScaleById(this._initialPriceScaleId)
+;null===o&&(o=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro((()=>{t.setZorder(this._initialZOrder),e.addDataSource(t,o,!0),s.forEach((t=>e.addDataSource(t,o,!1)))}));const r=(0,n.ensureNotNull)(t.priceScale());r.restoreState(this._originalPriceScaleState()),r.setHeight(e.height()),this._chartModel.fullUpdate()}}class la extends aa{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){const e=this._chartModel.panes();for(let t=this._initialPaneIndex-1;t>=0;t--)if(e[t].mode()===zi.PaneMode.Regular)return t;throw new Error("No regular pane found above for merging")}}class ca extends aa{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){const e=this._chartModel.panes();for(let t=this._initialPaneIndex+1;t{const i=(0,n.ensureNotNull)(e.paneForSource(t)),s=e.panes().indexOf(i),o=this._sourcesByPanes.get(s)||[];o.push(t.id()),this._sourcesByPanes.set(s,o)})),Array.from(this._sourcesByPanes.keys()).forEach((t=>{const i=e.panes()[t],s=new Map,o=new Set(i.sourcesByGroup().multipaneSources());i.sourcesByGroup().allIncludingHidden().filter((e=>!o.has(e))).forEach((e=>{s.set(e.id(),e.zorder())})),this._originalState.set(t,s)}))}undo(){this._originalState.forEach(((e,t)=>{const i=this._model.panes()[t],s=new Map;e.forEach(((e,t)=>{const o=(0,n.ensureNotNull)(i.dataSourceForId(t));s.set(o,e)})),i.setZOrders(s)}))}redo(){this._sourcesByPanes.forEach(((e,t)=>{const i=this._model.panes()[t],s=e.map((e=>(0,n.ensureNotNull)(i.dataSourceForId(e))));this._paneOperation(i,s)}))}}class Pa extends Ta{constructor(e,t){super(e,t,ma.format({title:Ca(t[0])}))}_paneOperation(e,t){e.bringToFront(t)}}class xa extends Ta{constructor(e,t){super(e,t,ga.format({title:Ca(t[0])}))}_paneOperation(e,t){e.sendToBack(t)}}class Ma extends Ta{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertAfter(t,this._targetSource)}}class Ia extends Ma{constructor(e,t,i){super(e,t,i,fa.format({title:Ca(t[0]),targetTitle:Ca(i)}))}}class Aa extends Ta{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertBefore(t,this._targetSource)}}class La extends Aa{constructor(e,t,i){super(e,t,i,ya.format({title:Ca(t[0]),targetTitle:Ca(i)}))}}function ka(e,t){const i=t[0],s=e.sourcesByGroup().all().filter((e=>e.zorder()e.zorder()>i.zorder()));if(0===s.length)throw new Error("Cannot bring forward source that alreadt on back");let o=s[0];if((0,zs.isLineTool)(o)){
const t=e.model().lineToolsGroupModel().groupForLineTool(o);if(null!==t){const e=t.lineTools();o=e[e.length-1]}}return o}class Ba extends Ma{constructor(e,t,i){super(e,i,Da(t,i),Sa.format({title:Ca(i[0])}))}}function Va(e,t){return(0,n.ensureNotNull)(e.paneForSource(t.lineTools()[0]))}class Ra extends Aa{constructor(e,t){super(e,t.lineTools(),ka(Va(e,t),t.lineTools()),ba.format({title:t.name().value()}))}}class Na extends Ma{constructor(e,t){super(e,t.lineTools(),Da(Va(e,t),t.lineTools()),wa.format({title:t.name().value()}))}}const Oa=new dt.TranslatedString("rearrange panes",a.t(null,void 0,i(2618)));class Fa extends st.UndoCommand{constructor(e,t,i){if(super(Oa),this._chartModel=e,this._index=t,(0,tt.isNumber)(i))this._dstIndex=i;else{const s="up"===i?-1:1;this._dstIndex=t+s,e.panes()[this._dstIndex].mode()===zi.PaneMode.Widget&&(this._dstIndex=this._dstIndex+s)}}redo(){this._checkIndices()&&this._chartModel.movePane(this._index,this._dstIndex)}undo(){this._checkIndices()&&this._chartModel.movePane(this._dstIndex,this._index)}_checkIndices(){const e=this._chartModel.panes().length;return this._index>=0&&this._index=0&&this._dstIndex{e.setValue(t[i].val),(e.dependents?.()??[]).forEach((e=>Ua(e,t[i].dependenValues)))}))}function ja(e,t){return"string"==typeof t?(0,Wa.propertyByPath)(e,t):t}class Ga extends st.UndoCommand{constructor(e,t,i,s,o=!0){super(i,void 0,o);const n=e.pathToRoot();this._targetObj=(0,Wa.isRootPath)(n)?n:e,this._newValue=t,this._oldValue=e.value(),this._dependentValues=za(e),this._model=s}redo(e){(0,yi.allowSavingDefaults)(!0),ja(e.chartWidgetCollection,this._targetObj).setValue(this._newValue),(0,yi.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,wi.globalChangeEvent)()),this._model.lightUpdate()}undo(e){(0,yi.allowSavingDefaults)(!0);const t=ja(e.chartWidgetCollection,this._targetObj);t.setValue(this._oldValue),Ua(t,this._dependentValues),(0,yi.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,wi.globalChangeEvent)()),this._model.lightUpdate()}}class qa extends st.UndoCommand{constructor(e,t,i,s,o,n){super(s),this._prevPriceAxisProps={},this._dependentValues=[],this._intervalChangeWasTracked=!1,this._property=e,this._mainSeries=i,this._value=t,this._model=o,this._chartWidget=n}redo(){const e=this._mainSeries,t=e.properties().childs();this._dependentValues=za(this._property),this._prevResolution=t.interval.value(),this._prevValue=this._property.value(),this._storePriceAxisProps(),(0,yi.allowSavingDefaults)(!0);const i=t.interval.value(),s=this._model.defaultResolutions(),o=(0,ht.getResolutionByChartStyle)(this._value,i,s);de.linking.interval.setValue(o),e.setChartStyleWithIntervalIfNeeded(this._value,o),(0,xt.setLastUsedStyle)(this._value,e.symbolInfo()),(0,xt.preparePriceAxisProperties)(t),(0,yi.allowSavingDefaults)(!1),this._invalidateModel(),
this._chartWidget.screen.show(!0)}undo(){const e=this._mainSeries;(0,yi.allowSavingDefaults)(!0),e.setChartStyleWithIntervalIfNeeded(this._prevValue,this._prevResolution),this._restorePriceAxisProps(),de.linking.interval.setValue(this._prevResolution),Ua(this._property,this._dependentValues),(0,yi.allowSavingDefaults)(!1),this._invalidateModel(),this._chartWidget.screen.show(!0)}_storePriceAxisProps(){const e=this._mainSeries.priceScale();this._prevPriceAxisProps=e.mode()}_restorePriceAxisProps(){this._mainSeries.priceScale().setMode(this._prevPriceAxisProps)}_invalidateModel(){this._model&&(this._model.recalculateAllPanes((0,wi.sourceChangeEvent)(this._model.mainSeries().id())),this._model.lightUpdate())}}const $a=new dt.TranslatedString("change date range",a.t(null,void 0,i(16979)));class Ka extends st.UndoCommand{constructor(e,t){super($a),this._modelsData=[],this._rangeOptions=t,this._modelsData.push({model:e,prevResolution:e.mainSeries().properties().childs().interval.value(),barSpacing:e.timeScale().barSpacing(),rightOffset:e.timeScale().rightOffset(),rangeOptions:e.appliedTimeFrame().value()})}redo(){for(const e of this._modelsData){const t=e.model.mainSeries(),i=t.properties().childs().interval;Re.Interval.isEqual(this._rangeOptions.res,i.value())?t.loadDataTo(this._rangeOptions.val):(t.setDefaultTimeframe(this._rangeOptions.val),t.setSymbolParams({interval:this._rangeOptions.res}))}}undo(){for(const e of this._modelsData){const t=e.model.mainSeries(),i=t.properties().childs().interval;e.prevResolution!==i.value()?(null!==e.rangeOptions&&t.setDefaultTimeframe(e.rangeOptions.val),t.setSymbolParams({interval:e.prevResolution})):null!==e.rangeOptions&&t.loadDataTo(e.rangeOptions.val);const s=e.model.timeScale();s.setBarSpacing(e.barSpacing),s.setRightOffset(e.rightOffset)}}canMerge(e){return e instanceof Ka&&Pr(e._rangeOptions,this._rangeOptions)}merge(e){if(!(e instanceof Ka))throw new Error("Invalid command to merge");this._modelsData=this._modelsData.concat(e._modelsData)}}function Ya(e){return e.properties().visible.value()}function Za(e){return!Ya(e)}class Xa{constructor(e,t,i){this._instanceId=(0,fe.randomHashN)(6),this._onChanged=new ae.Delegate,this._lineToolsSet=new Set,this._lineTools=[...e],this._lineToolsSet=new Set(this._lineTools),this._name=new O.WatchedValue(t),this.id=i||(0,fe.randomHashN)(6)}instanceId(){return this._instanceId}lineTools(){return this._lineTools}name(){return this._name}setName(e){this._doAndFireOnChange((()=>{this._name.setValue(e)}))}isActualSymbol(){return this._lineTools.length>0&&this._lineTools[0].isActualSymbol()&&this._lineTools[0].isActualCurrency()&&this._lineTools[0].isActualUnit()}symbol(){return this._lineTools[0].symbol()}currencyId(){return this._lineTools[0].properties().childs().currencyId.value()??null}unitId(){return this._lineTools[0].properties().childs().unitId.value()??null}sharingMode(){return this._lineTools[0].sharingMode()}share(e){this._lineTools.forEach((t=>t.share(e)))}containsLineTool(e){return this._lineToolsSet.has(e)}addLineTools(e){
@@ -669,7 +668,7 @@ this._onWidget&&(o?this._widgetCustomer="cme":r&&(this._widgetCustomer=r)),this.
;const e=this._paneWidgets.value();for(let t=0;t!!(0,Ws.isStudy)(t)&&e(t.metaInfo())))}model(){return(0,n.ensureNotNull)(this._model)}id(){return this._id}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}properties(){return this._properties}mainSeriesProperties(){return this._mainSeriesProperties}readOnly(){return Boolean(this._options.readOnly)}isActive(){return this._isActive.readonly()}isHovered(){return this._isHovered.readonly()}crossHairSyncEnabled(){return this._chartWidgetCollection.lock.crosshair.value()}isVisible(){return this._isVisible.value()}setVisible(e){this._isVisible.setValue(e)}visible(){return this._isVisible.readonly()}isCollapsed(){
return this._collapsed.value()}setCollapsed(e){this._collapsed.setValue(e)}collapsed(){return this._collapsed.readonly()}isJustClonedChart(){return!!(this._options||{}).justCloned}removeAllDrawingTools(){!!this.model().model().allLineTools().find((e=>e.isLocked?.()))?(0,cg.confirmRemovingLockedLineTools)(cg.DeleteLockedLineToolReason.RemoveAll).then((e=>{this.model().removeAllDrawingTools(e)})):this.model().removeAllDrawingTools(!0)}removeAllStudies(){this.model().removeAllStudies()}removeAllStudiesDrawingTools(){!!this.model().model().allLineTools().find((e=>e.isLocked?.()))?(0,cg.confirmRemovingLockedLineTools)(cg.DeleteLockedLineToolReason.RemoveAll).then((e=>{this.model().removeAllStudiesAndDrawingTools(e)})):this.model().removeAllStudiesAndDrawingTools(!0)}removeSelectedSources(){this.removeDataSources(this.model().selection().dataSources())}removeDataSources(e){const t=this.model(),i=e.filter((e=>e!==t.mainSeries()&&e!==t.lineBeingCreated()&&e.isUserDeletable()));if(0===i.length)return;let s=null;(0,Ws.isStudy)(i[0])&&((0,n.assert)(1===i.length,"Cannot remove several studies (no multi select for studies)"),s=i[0]);i.find((e=>e.hasAlert().value()));const o=!!i.find((e=>(0,zs.isLineTool)(e)&&e.isLocked?.()));if(s&&s.hasChildren()){const e=s.getAllChildren().map((e=>e.name(!0)));(0,fs.showDeleteStudyTreeConfirm)(e,(()=>{t.removeSelectedSources()}))}else o?(0,cg.showDeleteLockedLineToolsConfirm)(cg.DeleteLockedLineToolReason.RemoveSelected,(e=>{e||t.selectionMacro((e=>{i.filter((e=>(0,zs.isLineTool)(e)&&e.isLocked?.())).forEach((t=>{e.removeSourceFromSelection(t)}))})),t.removeSelectedSources()})):t.removeSelectedSources()}getSymbol(e){if(!this._model)return this._setSymbolIntervalContentOverrides.symbol||window.DEFAULT_SYMBOL;if(!e)return this._symbolWV.value();const t=this._model.mainSeries().properties().childs();return t.shortName&&t.shortName.value()?t.shortName?.value()??"":t.symbol?.value()??""}setSymbol(e){this._model?(this._symbolWV.setValue(e),this._model.setSymbol(this._model.mainSeries(),e)):(this._mainSeriesProperties.merge({symbol:e}),this._symbolWV.setValue(e),this._setSymbolIntervalContentOverrides.symbol=e)}setResolution(e){this._model?(this._resolutionWV.setValue(e),this._model.setResolution(this._model.mainSeries(),e)):(this._mainSeriesProperties.merge({interval:e}),this._resolutionWV.setValue(e),this._setSymbolIntervalContentOverrides.interval=e)}getResolution(){return this._resolutionWV.value()}symbolWV(){return this._symbolWV.readonly()}symbolInfoWV(){return this._symbolInfoWV}resolutionWV(){return this._resolutionWV.readonly()}loadRange(e){if(this._model){this.screen.show();this._model.loadRange(e)||this.screen.hide()}}async showGeneralChartProperties(e,t){if(!l.enabled("show_chart_property_page"))return Promise.resolve(null);const s=await this._showChartProperties(this.model().mainSeries(),e,{doNotCloseOnBgClick:!0,onResetToDefault:async()=>{this.model().restorePreferences()
;const[e,t]=await Promise.all([Promise.resolve().then(i.bind(i,22489)),Promise.resolve().then(i.bind(i,71843))]),s=e.getCurrentTheme().name;t.loadTheme(this.chartWidgetCollection(),{themeName:s,standardTheme:!0})},shouldReturnFocus:t?.shouldReturnFocus});if(null===s)return null;const o=()=>{s.hide(),this._chartWidgetCollection.activeChartWidget.unsubscribe(o)};return this._chartWidgetCollection.activeChartWidget.subscribe(o),s}showChartPropertiesForSource(e,t,i,s){return l.enabled("property_pages")&&e.userEditEnabled()?e===this.model().model().mainSeries()?this.showGeneralChartProperties(t):((i=i||{}).onResetToDefault=()=>{((0,zs.isLineTool)(e)||(0,Ws.isStudy)(e))&&this.model().restorePropertiesForSource.bind(this._model,e)},this._showChartProperties(e,t,i,s)):Promise.resolve(null)}toggleCompareOrAdd(){this._compareDialog.visible().value()?this._compareDialog.hide():this._compareDialog.show()}tags(){return this._model?this._model.calculateDefaultTags():[]}options(){return this._options}ownerDocument(){return(0,n.ensureNotNull)(this._parent).ownerDocument}async showChartPropertiesForSources(e){if(!l.enabled("property_pages"))return Promise.resolve(null);const{sources:t,title:s,tabName:o,renamable:r}=e,c=(0,n.ensureNotNull)(this._model),h=Ds(t.map((e=>e.properties().childs()))),d=Ds(t.map((e=>e.properties().childs().intervalsVisibilities))),[{createPropertyPage:u},{getSelectionStylePropertiesDefinitions:_},{getSelectionIntervalsVisibilitiesPropertiesDefinition:p},{getSelectionCoordinatesPropertyDefinition:m}]=await Promise.all([Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,60567)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,6255)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,73863)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,97578))]);return async function(e){const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(4752),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(8894),i.e(5743),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(1979),i.e(4495),i.e(9487),i.e(445),i.e(846),i.e(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(4059),i.e(1488),i.e(903),i.e(4633),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(769),i.e(9928),i.e(8604),i.e(5893),i.e(624),i.e(6780)]).then(i.bind(i,66512)),s=new t(e);return null!==Ms&&(Ms.hide(),Ms=s),s.show(),s}({sources:t,propertyPages:[u(_(h,c),"style",a.t(null,void 0,i(92516))),u({definitions:[m(t,c)]},"displacement",a.t(null,void 0,i(70132))),u(p(d,c),"visibility",a.t(null,void 0,i(40091)))],undoModel:c,title:s,activeTabId:o,renamable:r})}getPriceAxisWidthChangedByName(e){return"left"===e?this._lhsPriceAxisWidthChanged:this._rhsPriceAxisWidthChanged}getPriceAxisMaxWidthByName(e){return"left"===e?this._lhsAxesWidth:this._rhsAxesWidth}timeAxisHeight(){
-return null!==this._timeAxisWidget?this._timeAxisWidget.size.height:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){return null!==this._model}onRedraw(){return this._redraw}copyLineToOtherCharts(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources().filter((e=>e.isSynchronizable()));e.model().copyToOtherCharts(t,!0)}toggleLockSelectedObject(){const e=this.model();e.selection().lineDataSources().forEach((t=>{const i=t.properties().frozen.value();e.setProperty(t.properties().frozen,!i,(i?Sg:bg).format({title:new dt.TranslatedString(t.name(),t.title(pa.TitleDisplayTarget.StatusLine))}),Wr.lineToolsDoNotAffectChartInvalidation)}))}hideDataSources(e){if(e.length){const t=e.map((e=>e.properties().visible)),i=e.map((()=>!1));this.model().setProperties(t,i,vg.format({title:new dt.TranslatedString(e[0].name(),e[0].title(pa.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}paneWidgetsWV(){return this._paneWidgets}paneWidgets(){return this._paneWidgets.value()}paneWidgetSeparators(e){const t=this.paneWidgets().indexOf(e),i={};return this._paneSeparators.forEach((e=>{e.topPaneIndex()===t&&(i.separatorBelow=e),e.bottomPaneIndex()===t&&(i.separatorAbove=e)})),i}activePaneWidget(){return this._activePaneWidget.readonly()}paneByState(e){return this._paneWidgets.value().find((t=>t.state()===e))??null}paneByCanvas(e){return this._paneWidgets.value().find((t=>t.hasCanvas(e)))??null}timeAxisByCanvas(e){return this._timeAxisWidget?.hasCanvas(e)?this._timeAxisWidget:null}selectPointMode(){return(0,n.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){const e=(0,n.ensureNotNull)(this._model).model();e.cancelRequestSelectPoint(),e.setReplayStatus(e.isInReplay().value()?3:0),e.clearCurrentPosition()}requestSelectPoint(e,t){const i=(0,n.ensureNotNull)(this._model);return e.selectPointMode===mt.SelectPointMode.Replay&&i.model().setReplayStatus(1),new Promise(((s,o)=>{const n=()=>!!this.isVisible()||(o("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,mt.resetToCursor)(!0),i.lineBeingCreated()&&i.cancelCreatingLine();let r=!1;const a={};i.model().onPointSelected().subscribe(a,((e,t)=>{r=!0,this._isVisible.unsubscribe(n),this._hideHint(),s({point:e,pane:t})}),!0),i.model().requestSelectPoint(e),this.startTrackingMode(),void 0!==t&&this._showEventHint(t),this._isVisible.subscribe(n),this.selectPointMode().subscribe((()=>{setTimeout((()=>{r||(this.selectPointMode().value()===mt.SelectPointMode.None&&this._hideHint(),i.model().onPointSelected().unsubscribeAll(a),this._isVisible.unsubscribe(n),o("cancelled"))}))}),{once:!0})}))}showReplayOrderConfirmationDialog(){return this.model().isInReplay().value(),Promise.resolve()}showSourceProperties(e,t){e===this.model().mainSeries()&&(t=Ns.TabNames.symbol),
+return null!==this._timeAxisWidget?this._timeAxisWidget.size.height:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){return null!==this._model}onRedraw(){return this._redraw}copyLineToOtherCharts(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources().filter((e=>e.isSynchronizable()));e.model().copyToOtherCharts(t,!0)}toggleLockSelectedObject(){const e=this.model();e.selection().lineDataSources().forEach((t=>{const i=t.properties().frozen.value();e.setProperty(t.properties().frozen,!i,(i?Sg:bg).format({title:new dt.TranslatedString(t.name(),t.title(pa.TitleDisplayTarget.StatusLine))}),Wr.lineToolsDoNotAffectChartInvalidation)}))}hideDataSources(e){if(e.length){const t=e.map((e=>e.properties().visible)),i=e.map((()=>!1));this.model().setProperties(t,i,vg.format({title:new dt.TranslatedString(e[0].name(),e[0].title(pa.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}paneWidgetsWV(){return this._paneWidgets}paneWidgets(){return this._paneWidgets.value()}paneWidgetSeparators(e){const t=this.paneWidgets().indexOf(e),i={};return this._paneSeparators.forEach((e=>{e.topPaneIndex()===t&&(i.separatorBelow=e),e.bottomPaneIndex()===t&&(i.separatorAbove=e)})),i}activePaneWidget(){return this._activePaneWidget.readonly()}paneByState(e){return this._paneWidgets.value().find((t=>t.hasState()&&t.state()===e))??null}paneByCanvas(e){return this._paneWidgets.value().find((t=>t.hasCanvas(e)))??null}timeAxisByCanvas(e){return this._timeAxisWidget?.hasCanvas(e)?this._timeAxisWidget:null}selectPointMode(){return(0,n.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){const e=(0,n.ensureNotNull)(this._model).model();e.cancelRequestSelectPoint(),e.setReplayStatus(e.isInReplay().value()?3:0),e.clearCurrentPosition()}requestSelectPoint(e,t){const i=(0,n.ensureNotNull)(this._model);return e.selectPointMode===mt.SelectPointMode.Replay&&i.model().setReplayStatus(1),new Promise(((s,o)=>{const n=()=>!!this.isVisible()||(o("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,mt.resetToCursor)(!0),i.lineBeingCreated()&&i.cancelCreatingLine();let r=!1;const a={};i.model().onPointSelected().subscribe(a,((e,t)=>{r=!0,this._isVisible.unsubscribe(n),this._hideHint(),s({point:e,pane:t})}),!0),i.model().requestSelectPoint(e),this.startTrackingMode(),void 0!==t&&this._showEventHint(t),this._isVisible.subscribe(n),this.selectPointMode().subscribe((()=>{setTimeout((()=>{r||(this.selectPointMode().value()===mt.SelectPointMode.None&&this._hideHint(),i.model().onPointSelected().unsubscribeAll(a),this._isVisible.unsubscribe(n),o("cancelled"))}))}),{once:!0})}))}showReplayOrderConfirmationDialog(){return this.model().isInReplay().value(),Promise.resolve()}showSourceProperties(e,t){e===this.model().mainSeries()&&(t=Ns.TabNames.symbol),
this.showChartPropertiesForSource(e,t)}onScroll(){return this._onScroll}onZoom(){return this._onZoom}onTagsChanged(){return this._tagsChanged}onWidget(){return this._onWidget}containsVolume(){return this.model().dataSources().some((e=>(0,Ws.isStudy)(e)&&"Volume"===e.metaInfo().shortId))}containsStudy(e){return this.containsStudyByPredicate((t=>t.id===e||t.fullId===e))}isSmall(){return this._width()<550||this._height()<300}onCmeWidget(){return"cme"===this._widgetCustomer}widgetCustomer(){return this._widgetCustomer}compareSymbols(){return this._compareSymbols}images(e){window.TradingView.printing=!0;const t=this.model().selection().allSources();this.model().selectionMacro((e=>e.clearSelection())),this.model().model().recalculateAllPanes((0,wi.globalChangeEvent)());const i=(t,i)=>{t.paint(i,ao.InvalidationMask.timeScale(ao.InvalidationLevel.Light,!0).invalidationForTimeScale());const s={showCollapsedStudies:Boolean(e?.showCollapsedStudies),status:e?.status};return t.getScreenshotData(s)},s=[],o=this.maximizedPaneWidget();if(null!==o){const e=this._paneWidgets.value().indexOf(o);s.push(i(o,ao.InvalidationMask.light().invalidationForPane(e)))}else{const e=this._paneWidgets.value();e.forEach(((t,o)=>{s.push(i(t,ao.InvalidationMask.light().invalidationForPane(o))),o{t.forEach((t=>{e.addSourceToSelection(t)}))})),this.model().model().recalculateAllPanes((0,wi.globalChangeEvent)()),this.model().model().lightUpdate();const r=this.mainSeriesQuotesAndMetainfo();return{panes:s,timeAxis:n,colors:{text:this.properties().childs().scalesProperties.childs().textColor.value(),bg:this.properties().childs().paneProperties.childs().background.value(),scales:this.properties().childs().scalesProperties.childs().lineColor.value()},meta:r.meta,ohlc:r.ohlc,quotes:r.quotes}}insertStudy(e,t,i,s,o){return this._insertStudyOrReplaceStub(e,t,void 0,i,s,o)}replaceStubByStudy(e,t,i,s,o,n){return e.updateDescriptor(t),this._insertStudyOrReplaceStub(t,i,e,s,o,n)}addOverlayStudy(e,t,i){const s=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async o=>{if(!o)return null;await(0,os.studyMetaInfoRepository)().requestMetaInfo();const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]),r={allowExtendTimeScale:i};if(l.enabled("use_overrides_for_overlay")){const e=(0,h.factoryDefaults)("study_Overlay@tv-basicstudies.style");r.style=e}return n.setPropertiesState(r),n.setForceOverlay(t),n.insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))})):Promise.resolve(null)}addCompareStudy(e){const t=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async i=>i?(await(0,
os.studyMetaInfoRepository)().requestMetaInfo(),t.createStudyInserter({type:"java",studyId:"Compare@tv-basicstudies"},[]).insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))):null)):Promise.resolve(null)}showIndicators(e,t){if(window.studyMarket)return window.studyMarket.visible().value()?void window.studyMarket.hide():(window.studyMarket.show(e,t),window.studyMarket)}setSaveChartService(e){this._saveChartService=e,null!==this._lineToolsSynchronizer&&this._lineToolsSynchronizer.setSaveChartService(e)}getSaveChartService(){return this._saveChartService}mainSeriesQuotesAndMetainfo(){let e,t,i;const s=this._model&&this._model.mainSeries();if(s){const o=e=>null==e?"":s.formatter().format(e,{signNegative:!0,useRtlFormat:!1}),n=e=>null==e?"":e+"";e={resolution:s.interval(),symbol:s.symbol(),values:s.legendValuesProvider().getValues(null)};const r=s.symbolInfo();r&&(e.symbol=r.full_name,e.description=r.description,e.exchange=r.exchange);const a=s.bars().last();null!==a&&(t=a.value.slice(1,5).map(o));const l=s.quotes();l&&(i={change:o(l.change),changePercent:n(l.change_percent),last:o(l.last_price)})}return{meta:e,ohlc:t,quotes:i}}isMultipleLayout(){return this._isMultipleLayout}updateCrossHairPositionIfNeeded(){if(this._model){const e=(0,lo.lastMouseOrTouchEventInfo)();if(e.isTouch){const t=this.maximizedPaneWidget()||this._paneWidgets.value()[0];if(t.hasState()&&(!e.stylus&&(this._isLineToolModeExceptBrush()||(0,mt.toolIsMeasure)(mt.tool.value()))||this.selectPointMode().value()!==mt.SelectPointMode.None)){const e=.5*this._model.model().timeScale().width(),i=.5*t.state().defaultPriceScale().height();t.setCursorPosition(e,i)}const i=this._model.model().crosshairSource();i.updateAllViews((0,wi.sourceChangeEvent)(i.id()))}}}trackingModePaneWidget(){if(!(0,lo.lastMouseOrTouchEventInfo)().isTouch)return null;for(const e of this.paneWidgets())if(e.trackingModeEnabled())return e;return null}startTrackingMode(){if((0,lo.lastMouseOrTouchEventInfo)().isTouch){this.exitTrackingMode(),this.updateCrossHairPositionIfNeeded();const e=this.maximizedPaneWidget()||this._paneWidgets.value()[0],t=this.model().model().crosshairSource().currentPoint();e.startTrackingMode(t,t)}}exitTrackingMode(){(0,lo.lastMouseOrTouchEventInfo)().isTouch&&this.paneWidgets().some((e=>e.trackingModeEnabled()))&&(this.paneWidgets().forEach((e=>e.exitTrackingMode())),this.model().model().clearCurrentPosition())}onToolChanged(){const e=this.model().model();e.lineBeingCreated()&&!e.lineBeingCreateFromExternal()&&this._cancelCreatingLine(),this.selectPointMode().value()!==mt.SelectPointMode.None&&this.cancelRequestSelectPoint(),this.exitTrackingMode()}setInLoadingState(e){this._inLoadingState=e}paint(e){const t=e??ao.InvalidationMask.full();t.validationActions().forEach((e=>e()));const i=this.maximizedPaneWidget();this._paneWidgets.value().forEach(((e,s)=>{null!==i&&i!==e||e.paint(t.invalidationForPane(s),t.invalidationForTimeScale())})),this._timeAxisWidget&&this._timeAxisWidget.paint(t.invalidationForTimeScale()),this._redraw.fire()}GUIResetScales(){
(0,re.trackEvent)("GUI","Reset Scales"),null!==this._model&&this._model.resetScales()}applyOverrides(e){const t={};for(const[i,s]of Object.entries(e))i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=s);if((0,h.applyPropertiesOverrides)(this.properties(),void 0,!1,t,void 0),l.enabled("use_localstorage_for_settings")&&this.properties().saveDefaults(),this._model){(0,h.applyPropertiesOverrides)(this._model.model().properties(),void 0,!1,t),(0,h.applyPropertiesOverrides)(this._model.mainSeries().properties(),void 0,!1,t,"mainSeriesProperties"),this._model.model().sessions().applyOverrides(t);const e=this._model.model().watermarkSource();null!==e&&e.applyOverrides(t),l.enabled("use_localstorage_for_settings")&&(this._model.model().properties().saveDefaults(),this._model.mainSeries().properties().saveDefaults())}}showFundamentals(e){this.showIndicators(e?[e]:void 0,"financials")}maximizedPaneWidget(){return this._paneWidgets.value().find((e=>e.maximized().value()))??null}hasMaximizedPane(){return null!==this.maximizedPaneWidget()}setActive(e){(0,lo.lastMouseOrTouchEventInfo)().isTouch&&(e&&this.selectPointMode().value()!==mt.SelectPointMode.None?this.startTrackingMode():this.exitTrackingMode());for(const e of this._paneWidgets.value())e.update();e||this.model().selectionMacro((e=>{e.clearSelection()})),this._isActive.setValue(e)}justActivated(){return this._justActivated}setActivePaneWidget(e){this._activePaneWidget.setValue(e)}onPaneWidgetDestroyed(e){this._activePaneWidget.value()===e&&this._activePaneWidget.setValue(null)}getResizerDetacher(){return this._options}toggleFullscreen(){const e=this.getResizerDetacher();e.fullscreenable.value()&&(e.fullscreen.value()?e.exitFullscreen():e.requestFullscreen())}async generalPropertiesDefinitions(){return await(0,os.studyMetaInfoRepository)().findAllJavaStudies(),this._getChartPropertyDefinitionsViewModel().then((e=>e.propertyPages()))}propertiesDefinitionsForSource(e){return(0,zs.isLineTool)(e)||(0,Ws.isStudy)(e)||(0,Us.isStudyLineTool)(e)?e.getPropertyDefinitionsViewModel().then((e=>null===e?null:e.propertyPages())).catch((e=>(gg.logWarn(e),null))):Promise.resolve(null)}backgroundTopTheme(){return this._backgroundTopTheme.readonly()}backgroundBasedTheme(){return this._backgroundBasedTheme.readonly()}backgroundBottomTheme(){return this._backgroundBottomTheme.readonly()}state(e){if(this._model){const t=this._model.state(e);return t.chartId=this.id(),t}return this._content}lineToolsAndGroupsDTO(){return(0,n.ensureNotNull)(this._lineToolsSynchronizer).prepareDTO()}applyLineToolUpdateNotification(e,t){return(0,n.ensureNotNull)(this._lineToolsSynchronizer).applyLineToolUpdateNotification(e,t)}reloadAllLineTools(){(0,n.ensureNotNull)(this._lineToolsSynchronizer).reloadAllLineTools()}startApplyingLineToolUpdateNotification(){this._lineToolsSynchronizer?.startApplyingLineToolUpdateNotification()}endApplyingLineToolUpdateNotification(){this._lineToolsSynchronizer?.endApplyingLineToolUpdateNotification()}applyAlertIdByExternalSource(e,t){
@@ -715,99 +714,99 @@ xt.isTimeBasedStyle)(s.model().mainSeries().style())&&setTimeout(this._chartWidg
;const Mf=["LineToolTrendLine","LineToolRay","LineToolInfoLine","LineToolExtended","LineToolRegressionTrend","LineToolRotatedRectangle","LineToolParallelChannel","LineToolFlatBottom","LineToolDisjointAngle","LineToolPitchfork","LineToolSchiffPitchfork","LineToolSchiffPitchfork2","LineToolInsidePitchfork","LineToolVertLine","LineToolCrossLine","LineToolHorzLine","LineToolHorzRay","LineToolTrendAngle"];function If(e,t=!1,s=!1){if(!l.enabled("popup_hints"))return()=>{};const o=e.getContainer();let r=null,c=null;return mt.tool.subscribe(h),mt.createdLineTool.subscribe(null,u),mt.finishedLineTool.subscribe(null,_),e.layoutSizesChanged().subscribe(p),t||ze.CheckMobile.any()||!g("hint.startFocusedZoom")||(c=function(e,t){let i=!1;const s=o=>{o?(i&&t(o),e.onZoom().unsubscribe(null,s)):i||(t(o),i=!0)};return e.onZoom().subscribe(null,s),()=>e.onZoom().unsubscribe(null,s)}(e,(function(e){if(!g("hint.startFocusedZoom"))return;if(e)r&&(c=null,f("hint.startFocusedZoom"));else{m(a.t(null,void 0,i(81712)).format({key:(0,gt.humanReadableModifiers)(gt.Modifiers.Mod,!1)}),"hint.startFocusedZoom")}}))),()=>{mt.tool.unsubscribe(h),mt.createdLineTool.unsubscribe(null,u),mt.finishedLineTool.unsubscribe(null,_),e.layoutSizesChanged().unsubscribe(p),c?.()};function h(){const e=mt.tool.value(),t=ze.CheckMobile.any();if(!t&&(0,mt.toolIsDemonstration)(e)&&g("hint.demonstrationCursorSelected")){return void m(a.t(null,void 0,i(87133)).format({key:(0,gt.humanReadableModifiers)(gt.Modifiers.Alt,!1)}),"hint.demonstrationCursorSelected")}if(s&&t&&(o=e,Mf.includes(o)))return void async function(){0}();var o;if("LineToolTextAbsolute"===e&&g("hint.anchoredTextWillBeRemoved"))return void m(a.t(null,void 0,i(77705)),"hint.anchoredTextWillBeRemoved");if(!g("hint.touchPainting"))return;const n=(0,Lt.isLineToolDrawWithoutPoints)(e);!(0,Lt.isStudyLineToolName)(e)||"LineToolRegressionTrend"===e||n||t?(0,Lt.isLineToolName)(e)&&!(0,Lt.isLineDrawnWithPressedButton)(e)&&!n&&t?m(a.t(null,void 0,i(60663)),"hint.touchPainting"):r&&r.hide():m(a.t(null,void 0,i(14985)),"hint.touchPainting")}function u(){const e=mt.tool.value();"LineToolPath"===e&&g("hint.finishBuildPathByDblClick")?m(a.t(null,void 0,i(75296)),"hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&g("hint.finishBuildPolylineByDblClick")&&m(a.t(null,void 0,i(17409)),"hint.finishBuildPolylineByDblClick")}function _(){if(r){const e=mt.tool.value();"LineToolPath"===e?f("hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&f("hint.finishBuildPolylineByDblClick")}}function p(){if(!g("hint.startResizingChartInLayout"))return;m(ze.CheckMobile.any()?a.t(null,void 0,i(36539)):a.t(null,void 0,i(9430)),"hint.startResizingChartInLayout")}function m(e,t){if(r)r.show(e,f.bind(null,t));else{const s=mt.tool.value();Promise.all([i.e(6195),i.e(628),i.e(2227),i.e(6166)]).then(i.bind(i,91759)).then((i=>{r=new i.ChartEventHintRenderer(o),s===mt.tool.value()&&r.show(e,f.bind(null,t))}))}}function g(e){return!Boolean(d.getBool(e))}function f(e){d.setValue(e,!0,{forceFlush:!0}),(0,n.ensureNotNull)(r).destroy(),
null!==c&&c(),r=null}}class Af{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}function Lf(e,t){return`${e}__${t}`}function kf(e){for(const t of Object.keys(e)){const i=e[t];if((0,tt.isObject)(i))throw new Error(`Study with non-simple inputs cannot be created: ${t}=${JSON.stringify(i)}`)}return e}class Ef{constructor(e,t,i,s){this.sessionid="",this._chartApiMessagerProvider=e,this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._metadataRequestNextNumber=1,this._studyMetaInfoCache=i,this.studiesAccessController=s,this._connected=!1,this._enabled=!1,this._studyEngine=t,this._callbacks={},this._serverTimeOffset=0,this._studyEngine.on("configuration_received",(()=>{this._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",((...e)=>{const t=e[0];if(!Array.isArray(t)||t.length<6)return;const i={time:t.value[0]/1e3,open:t.value[1],high:t.value[2],low:t.value[3],close:t.value[4],volume:t.value[5]};this._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={},this._studySpecs=new Map,this._isNonCountedStudy=()=>!0,this.defaultResolutions=this.defaultResolutions.bind(this)}destroy(){this._studyEngine.destroy(),this._studyEngine=null}purgeCache(){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache()}resetCache(){this._studyEngine.resetCache()}defaultResolutions(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]}availableCurrencies(){const e=this._studyEngine.supportedCurrencies().map((e=>"string"==typeof e?{id:e,code:e}:e));return Promise.resolve(e)}availableUnits(){return Promise.resolve(this._studyEngine.supportedUnits())}async availablePriceSources(e){return await this._studyEngine.supportedPriceSources(e)??[]}supportedSymbolsTypes(){return this._studyEngine.supportedSymbolsTypes()??[]}symbolsGrouping(){const e={};for(const[t,i]of Object.entries(this._studyEngine.symbolsGrouping()))e[t]=i instanceof RegExp?i:new RegExp(i);return e}start(){this._enabled=!0,this._fireEvent("start_enabled")}unsubscribe(e,t){const i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}chartCreateSession(e,t){return this._studyEngine.chartCreateSession(e),!1}chartDeleteSession(e){return this._studyEngine.chartDeleteSession(e),!1}createSession(e,t){this._chartApiMessagerProvider.createChartApiMessager(e,this),this._sessions[e]=t,this._notificationHandlers[e]={},this.connected()&&t.onMessage({method:"connected",params:[]})}removeSession(e){delete this._sessions[e],delete this._notificationHandlers[e],this._studyEngine.stopSources(e)}connected(){return this._connected}connect(){this._enabled?this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]})):this.on("start_enabled",(()=>{this.connect()}))}disconnect(){this._connected=!1,this._notifySessions({method:"disconnected",params:[]}),this.purgeCache(),this.studyCounter=0}
switchTimezone(e,t){return this._studyEngine.switchTimezone(e,t),!1}receiveLocalResponse(e){this._dispatchNotification(e),this._fireEvent("message_"+e.method,void 0,!0)}getMarks(e,t,i,s,o){const n=s;this._studyEngine.getMarks(e,t,i,n,o)}getTimescaleMarks(e,t,i,s,o){const n=s;this._studyEngine.getTimescaleMarks(e,t,i,n,o)}resolveSymbol(e,t,i,s){return this._notificationHandlers[e][t]=new Af(s,t),this._studyEngine.resolveSymbol(e,t,i),!1}requestFirstBarTime(e,t,i,s){throw new Error("Method not implemented.")}createSeries(e,t,i,s,o,n,r,a){this._notificationHandlers[e][t]=new Af((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t);const l={countBack:n||300};return null!==r&&"time-range"===r.type&&(l.to=1e3*r.to,l.from=1e3*r.from),this._studyEngine.createSeries(e,t,i,s,o,l),!1}removeSeries(e,t){return delete this._notificationHandlers[e][t],this._studyEngine.removeSeries(e,t),!1}setVisibleTimeRange(e,t,i,s,o,r,a,l,c,h){let d=s,u=!0!==(a=a||{}).applyDefaultRightMargin&&void 0===a.percentRightMargin&&void 0!==o?o:null;const _=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,t)),(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,t)));null!==_&&(d=_.timeToSessionStart(1e3*d)/1e3,null!==u&&(u=_.timeToSessionStart(1e3*u)/1e3));const p=()=>{const s=this._studyEngine.sessionTimeScale(e);if(null===s)return void(h&&h(new Error("Session time scale is not available")));const o=s.indexOfTime(1e3*d);let _;if(null===u)_=s.lastSessionBarIndex();else{const e=s.indexOfTime(1e3*u);_=e&&e.index}if(null===o||null===_)return void(h&&h(new Error("Bars are not available")));let p=o.index;if(o.timeMs<1e3*d&&(p+=1),!1===r){const e=(0,n.ensureNotNull)(s.firstSessionBarIndex());p_?h&&h(new Error("Invalid visible range")):(this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesTimeframeUpdate(t,i,p,_,a,c),l&&setTimeout(l,0))};if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*s))return void p();const m=this._chartApiMessagerProvider.getChartApiMessager(e).beforeSeriesCompleted,g=this._chartApiMessagerProvider.getChartApiMessager(e).seriesError;function f(e,s){e===t&&s===i&&(m.unsubscribe(null,f),g.unsubscribe(null,y),p())}function y(e,s){e===t&&s===i&&m.unsubscribe(null,f)}void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=window.setTimeout((()=>{delete this._setVisibleRangeTimeout[e],m.subscribe(null,f,!0),g.subscribe(null,y,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*s)}),0)}modifySeries(e,t,i,s,o,n,r,a){return this._notificationHandlers[e][t]=new Af((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t),this._studyEngine.modifySeries(e,t,s,o,i,n),!1}requestMoreData(e,t,i,s){const o="number"==typeof t?t:i;return this._studyEngine.extendSeriesRange(e,o),!1}allStudiesMetadata(){return this._studyMetaInfoCache.studiesMetadata()}requestMetadata(){return new Promise((e=>{const t=this.studiesAccessController.getEnabledTools();e({
-method:"studies_metadata",params:["metadata_"+this._metadataRequestNextNumber++,{errors:[],hash:"",metainfo:t,migrations:[]}]})}))}setIsNonCountedStudyFn(e){this._isNonCountedStudy=e}canCreateStudy(e,t,i){return this._isNonCountedStudy(t.id)||this.studyCounter<210?{success:!0}:{success:!1,reason:"general",limitValue:210}}getStudyCounter(e){return this.studyCounter}getFundamentalCounter(e){return 0}createStudy(e,t,i,s,o,n,r,a){if(!this.canCreateStudy(e,a).success){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}return this._notificationHandlers[e][t]=new Af(r,t),this._studySpecs.set(Lf(e,t),a),this._studyEngine.createStudy(e,t,s,i,o,kf(n)),this._isNonCountedStudy(a.id)||this.studyCounter++,!0}removeStudy(e,t){if(this._notificationHandlers[e][t]){delete this._notificationHandlers[e][t];const i=Lf(e,t),s=(0,n.ensureDefined)(this._studySpecs.get(i));this._studySpecs.delete(i),this._studyEngine.removeStudy(e,t),this._isNonCountedStudy(s.id)||this.studyCounter--}return!1}modifyStudy(e,t,i,s,o,n){return this._notificationHandlers[e][t]=new Af(o,t),this._studyEngine.modifyStudy(e,t,i,kf(s)),!1}notifyStudy(e,t,i,s){throw new Error("Method not implemented.")}createPointset(e,t,i,s,o,n,r){return this._notificationHandlers[e][t]=new Af(r,t),this._studyEngine.createPointset(e,t,s,o,n),!1}modifyPointset(e,t,i,s,o){throw new Error("Method not implemented.")}removePointset(e,t){return this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t),!1}requestMoreTickmarks(e,t,i,s){return this._studyEngine.requestMoreTickmarks(e,i),!1}setFutureTickmarksMode(e,t){throw new Error("Method not implemented.")}serverTime(){return this._studyEngine.serverTime()}quoteCreateSession(e){return this._studyEngine.quoteCreateSession(e),!1}quoteDeleteSession(e){return this._studyEngine.quoteDeleteSession(e),!1}quoteAddSymbols(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((e=>!!e))),this._studyEngine.quoteAddSymbols(e,t),!1}quoteRemoveSymbols(e,t){return this._studyEngine.quoteRemoveSymbols(e,t),!1}quoteFastSymbols(e,t){return this._studyEngine.quoteFastSymbols(e,t),!1}quoteSetFields(e,t){return this._studyEngine.quoteSetFields(e,t),!1}quoteHibernateAll(e){return this._studyEngine.quoteHibernateAll(e),!1}searchSymbols(e,t,i,s,o){this._studyEngine.searchSymbols(e,t,i,s,o)}_applyTimeFrame(e,t,i,s,o){let r,a,l={},c=!0;if("period-back"===o.type){const t=this._studyEngine.getSeriesLastBarTime(e,i);if(null===t)return;a=t/1e3;const s=Re.Interval.parse(o.value),h=(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,i));r=(0,Td.alignPeriodsBackForVisibleRange)(h.session,h.session_holidays,h.corrections,s.letter(),s.multiplier(),1,t)/1e3;const d=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,i)),h);null!==d&&(a=d.timeToExchangeTradingDay(1e3*a)/1e3,r=d.timeToExchangeTradingDay(1e3*r)/1e3),l={applyDefaultRightMargin:!0},c=this._studyEngine.hasStudyWithExtendedTimeScale(e)}else r=o.from,a=o.to
-;this.setVisibleTimeRange(e,i,s,r,a,c,l,void 0,o,void 0)}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){const s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(let e=0;ethis.isToolEnabled(e.description)||e.is_hidden_study))}isToolEnabled(e){const t=this._findTool(e);return"black"===this._studiesAccess.type?!(t&&!t.grayed):!!t}isToolGrayed(e){const t=this._findTool(e);return!(!t||!t.grayed)}_findTool(e){let t=null;for(let i=0;i{this._toolbarThemeChanged.fire(e)},this._opts=e,k.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){k.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){
-const e=this._opts.chartWidgetCollection.getAll().every((e=>null!==e.model().model().getThemeNameIfStdTheme()));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,Vf.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,k.setTheme)(e),t&&(0,L.syncTheme)()}getCurrentThemeName(){return(0,L.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}function Nf(e){return e in Of}const Of={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute",isAnchored:!0},note:{name:"LineToolNote"},text_note:{name:"LineToolTextNote"},anchored_note:{name:"LineToolNoteAbsolute",isAnchored:!0},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},comment:{name:"LineToolComment"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},image:{name:"LineToolImage"},table:{name:"LineToolTable"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},anchored_vwap:{name:"LineToolAnchoredVWAP"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},fib_channel:{name:"LineToolFibChannel"},xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{
-name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},emoji:{name:"LineToolEmoji"},sticker:{name:"LineToolSticker"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}};const Ff=new ae.Delegate;var Wf=i(44862),Hf=i(51829);function zf(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(Hf.SessionStage.LASTBAR_SESSION)/1e3}class Uf{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){return this._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){return this._timeScale.usePercentageRightOffset().spawn()}isEmpty(){return this._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){return this._timeScale.points().size()}leftVisibleBarUTCTime(){const e=this._timeScale.visibleBarsStrictRange()?.firstBar()??null;return null===e?null:this._timeScale.indexToTimePoint(e)}}const jf=new dt.TranslatedString("change timezone",a.t(null,void 0,i(20137)));class Gf{constructor(e){this._onTimezoneChanged=new ae.Delegate,this._chartWidget=e,
-this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,(e=>{this._onTimezoneChanged.fire(e.value())})),e.onAboutToBeDestroyed().subscribe(this,(()=>{this._timezoneProperty.unsubscribeAll(this)}),!0)}availableTimezones(){return Pe.availableTimezones}getTimezone(){const e=this._timezoneProperty.value();return(0,n.ensureDefined)(this.availableTimezones().find((t=>t.id===e)))}setTimezone(e,t){(0,n.assert)((0,Pe.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),t?.disableUndo?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,jf)}onTimezoneChanged(){return this._onTimezoneChanged}}class qf{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){return this._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){return this._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){return this._priceScale.getStudies().map((e=>e.id()))}currency(){const e=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);return null===t?null:{readOnly:t.readOnly,selectedCurrency:t.selectedCurrency,originalCurrencies:Array.from(t.originalCurrencies),currencies:e.getItems().filter((e=>!t.baseCurrencies.has(e))),symbols:Array.from(t.symbols)}}setCurrency(e){const t=this.currency()?.currencies;t&&e&&!t.includes(e)?console.warn("The provided currency is not supported by your datafeed!"):this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){const e=this._chartModel.availableUnits(),t=this._priceScale.unit(e);return null===t?null:{readOnly:0===t.availableGroups.size,selectedUnit:t.selectedUnit,originalUnits:Array.from(t.originalUnits),availableGroups:Array.from(t.availableGroups),symbols:Array.from(t.symbols)}}setUnit(e){!e||this._chartModel.availableUnits().unitGroupById(e)?this._chartUndoModel.setPriceScaleUnit(this._priceScale,e):console.warn("The provided unit is not supported by your datafeed!")}coordinateToPrice(e){const t=this._priceScale.mainSource()?.firstValue();return null==t?null:this._priceScale.coordinateToPrice(e,t)}measureUnitId(){const e=this._priceScale.measureUnitId(this._chartModel.availableUnits());return null===e?null:{selectedMeasureUnitId:e.selectedMeasureUnitId}}}function $f(e){return{id:e.id(),name:(t=e.toolname,Object.keys(Of).find((e=>Of[e].name===t))||null)};var t}function Kf(e){return{id:e.id(),name:e.metaInfo().description}}
-const Yf=new dt.TranslatedString("change pane height",a.t(null,void 0,i(14691)));class Zf extends st.UndoCommand{constructor(e,t,i){super(Yf),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map((e=>e.stretchFactor()))}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){const e=this._model.panes();for(let t=0;t!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){return t===e.mainSeries()?function(e){return{id:e.id(),name:"Main Series"}}(e.mainSeries()):(0,Ws.isStudy)(t)?Kf(t):(0,zs.isLineTool)(t)?$f(t):null}(e,t))).filter(tt.notNull).filter((e=>null!==e.name))}getHeight(){return this._pane.height()}setHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length>1,"Unable to change pane's height if there is only one pane");const s=i.indexOf(this._pane);(0,n.assert)(-1!==s,"Invalid pane index");const o=new Zf(t,s,e);this._chartWidget.model().undoHistory().pushUndoCommand(o)}moveTo(e){const t=this.paneIndex();t!==e&&((0,n.assert)(e>=0&&e({...e,id:e.id,localizedName:void 0!==e.name?(0,Jf.getTranslatedInputTitle)(e.name):""})))}function ey(e){const t={};if(e.defaults){const i=(0,Al.default)(e.defaults);t.defaults=i}return void 0!==e.plots&&(t.plots=(0,Al.default)(e.plots)),void 0!==e.styles&&(t.styles=(0,Al.default)(e.styles)),void 0!==e.bands&&(t.bands=(0,Al.default)(e.bands)),void 0!==e.filledAreas&&(t.filledAreas=(0,Al.default)(e.filledAreas)),void 0!==e.palettes&&(t.palettes=(0,Al.default)(e.palettes)),t}var ty=i(82130);class iy{constructor(e,t){this._onStudyCompleted=new ae.Delegate,this._onStudyError=new ae.Delegate,this._isStudyDestroyed=!1,this._study=e,this._chartWidget=t,this._undoModel=this._chartWidget.model(),this._model=this._undoModel.model(),this._study.onAboutToBeDestroyed().subscribe(this,(()=>{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this),this._isStudyDestroyed=!0})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){case gh.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case gh.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return Qf(this._study.metaInfo())}getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map((t=>{const i=e[t];return{id:t,value:(0,tt.isObject)(i)?i.v:i}}))}getStyleInfo(){return ey(this._study.metaInfo())}getStyleValues(){const{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}=this._study.properties().state();return{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}}setInputValues(e){const t=this.getInputValues();for(const i of e){void 0!==t.find((e=>e.id===i.id))?this._study.properties().childs().inputs.childs()[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&new la(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new ca(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new na(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new oa(this._model,this._study,null).redo()}paneIndex(){return this._model.panes().indexOf(this._model.paneForSource(this._study))}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){
-this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){return new qf(this._undoModel,(0,n.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,n.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,n.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,n.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),new Tl(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,n.assert)(i===t,"Study should be on the main pane"),new Pl(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new Tl(this._model,this._study,i,"left",null).redo();break;case"new-right":new Tl(this._model,this._study,i,"right",null).redo();break;default:const s=this._model.dataSourceForId(e);if(null===s)throw new Error(`There is no study with entityId='${e}'`);const o=i===this._model.paneForSource(s);(0,n.assert)(o,"Both studies should be on the same pane");const r=(0,n.ensureNotNull)(s.priceScale()),a=kr(this._study,r,this._model),l=ih(this._study,r,this._model);new Pl(this._model,this._study,i,r,null).redo(),null!==a&&new bl(this._model,r,a,null).redo(),null!==l&&new wl(this._model,r,l,null).redo()}}isVisible(){return this._study.properties().childs().visible.value()}setVisible(e){this._study.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,Wf.applyOverridesToStudy)(this._study,e)}hasPlots(){return this._study.metaInfo().plots.length>0}dataLength(){if(this._study.status().type!==gh.StudyStatusType.Completed)return 0;return this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){const e=this._study.status();return e.type===gh.StudyStatusType.Undefined||e.type===gh.StudyStatusType.Loading}hasError(){return this._study.status().type===gh.StudyStatusType.Error}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,ty.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}setProperties(e){this._study.properties().mergeAndFire(e)}async applyToEntireLayout(){const{ActionsProvider:e}=await(0,Go.actionsProviderModule)();if(this._isStudyDestroyed)return;const t=new e(this._chartWidget),i=(await t.contextMenuActionsForSources([this._study],(0,n.ensureNotNull)(this._chartWidget.model().paneForSource(this._study)))).find((e=>"applyStudyToEntireLayout"===e.id));i&&i.execute()}status(){return{...this._study.status()}}title(){return this._study.title(pa.TitleDisplayTarget.StatusLine)}symbolsResolved(){
-return this._study.symbolsResolved()}study(){return this._study}}const sy=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function oy(e){const t=sy.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function ny(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}const ry=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class ay{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(e,t){return this._source.properties().state(ry,e,t)}setProperties(e,t){(0,yi.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,yi.allowSavingDefaults)(!1)}getPoints(){let e=this._source.points();const t=oy(this._source);return e.length>t&&((0,n.assert)(ny(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;const t=oy(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource())),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}getAnchoredPosition(){return this._source.positionPercents()}setAnchoredPosition(e){const t=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void 0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void 0===t||null===i||null===s)return;const o={logical:s,screen:t},n=new Map;n.set(i,e),this._model.startMovingSources([this._source],o,null,new Map),this._model.moveSources(o,n),this._model.endMovingSources(!0)}ownerSourceId(){return(0,n.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;const i=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){return this._source.isSourceHidden()}getRawPoints(){return this._source.points()}getNormalizedPoints(){
-return this._source.normalizedPoints()}setRawPoint(e,t){this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...t},e),this._model.changeLinePoint({...t}),this._model.endChangingLinetool(!1)}move(e,t){this._model.startMovingSources([this._source],{logical:e,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(e))},null,new Map),this._model.moveSources({logical:t,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(t))},new Map),this._model.endMovingSources(!1)}dataAndViewsReady(){return this._source.dataAndViewsReady()}zorder(){return this._source.zorder()}symbol(){return this._source.properties().symbol.value()}currency(){return this._source.properties().currencyId.value()}unit(){return this._source.properties().unitId.value()}share(e){this._undoModel.shareLineTools([this._source],e)}setVisible(e,t=!1){this._undoModel.setProperty(this._source.properties().visible,e,null,t)}sharingMode(){return this._source.sharingMode().value()}lineDataSource(){return this._source}template(){return this._source.template()}}class ly{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){return this._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&new la(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new ca(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new na(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new oa(this._model,this._series,null).redo()}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._series)&&this._undoModel.mergeSourceUp(this._series)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._series)&&this._undoModel.mergeSourceDown(this._series)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._series)&&this._undoModel.unmergeSourceUp(this._series)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._series)&&this._undoModel.unmergeSourceDown(this._series)}detachToRight(){new Tl(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new Tl(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new Tl(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){const t=(0,n.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":new Tl(this._model,this._series,t,"left",null).redo();break;case"new-right":new Tl(this._model,this._series,t,"right",null).redo();break;case"no-scale":(0,n.assert)(t.actionNoScaleIsEnabled(this._series),"Unable to leave a pane without any non-overlay price scale"),new Tl(this._model,this._series,t,"overlay",null).redo();break;default:const i=this._model.dataSourceForId(e);if(null===i)throw new Error(`There is no study with entityId='${e}'`);const s=this._model.paneForSource(i)===t;(0,
-n.assert)(s,"Study should be on the main pane");const o=(0,n.ensureNotNull)(i.priceScale());new Pl(this._model,this._series,t,o,null).redo()}}isVisible(){return this._series.properties().childs().visible.value()}setVisible(e){this._series.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._series])}sendToBack(){this._model.sendToBack([this._series])}entityId(){return this._series.id()}chartStyleProperties(e,t){return t?this._series.properties().childs()[cy(e)].state():this._series.properties().childs()[cy(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[cy(e)].mergeAndFire(t)}barsCount(){return this._series.bars().size()}endOfData(){return this._series.endOfData()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}series(){return this._series}isLoading(){return this._series.isLoading()}isInReplay(){return this._series.isInReplay()}data(){return this._series.data()}priceScale(){return new qf(this._undoModel,this._series.priceScale())}seriesErrorMessage(){return this._series.seriesErrorMessage()}compositeStatusVW(){return this._series.compositeStatusVW()}properties(){return this._series.properties()}_pane(){return(0,n.ensureNotNull)(this._model.paneForSource(this._series))}}function cy(e){switch(e){case 0:return"barStyle";case 1:return"candleStyle";case 2:return"lineStyle";case 14:return"lineWithMarkersStyle";case 15:return"steplineStyle";case 3:return"areaStyle";case 16:return"hlcAreaStyle";case 4:return"renkoStyle";case 5:return"kagiStyle";case 6:return"pnfStyle";case 7:return"pbStyle";case 8:return"haStyle";case 9:return"hollowCandleStyle";case 10:return"baselineStyle";case 11:return"rangeStyle";case 12:return"hiloStyle";case 13:return"columnStyle";case 17:return"volFootprintStyle";case 18:return"tpoStyle";case 19:return"volCandlesStyle";case 20:return"svpStyle";case 21:return"hlcBarsStyle";default:(0,n.ensureNever)(e)}throw new Error(`unsupported chart style: ${e}`)}var hy=i(32112);function dy(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:o,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||o||n)}function uy(e,t){e.isLoading()&&!e.isFailed()||t(e.isFailed());const i=e.seriesSource().symbolInstanceId(),s=e.dataEvents(),o=e.symbolParams(),n=()=>{s.completed().unsubscribe(null,r),(dy(e,o)||e.seriesSource().symbolInstanceId()===i)&&t(!1)},r=()=>{s.error().unsubscribe(null,n),(dy(e,o)||e.seriesSource().symbolInstanceId()===i)&&t(!0)};s.completed().subscribe(null,n,!0),s.error().subscribe(null,r,!0)}class _y{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,n.ensureDefined)(this._groupById(e));return(0,vi.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,
-n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._model.dataSourceForId(t));(0,n.assert)((0,zs.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}addShapeToGroup(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._model.dataSourceForId(t));(0,n.assert)((0,zs.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,s)}availableZOrderOperations(e){const t=(0,n.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,n.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,n.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,n.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,zs.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}var py=i(18041);const my=new dt.TranslatedString("change price to bar ratio",a.t(null,void 0,i(2509))),gy=new dt.TranslatedString("toggle lock scale",a.t(null,void 0,i(49695)));function fy(e,t){return t.map((t=>(0,n.ensureNotNull)(e.dataSourceForId(t))))}class yy{constructor(e,t){this._visibleBarsChanged=new ae.Delegate,this._crosshairMoved=new ae.Delegate,this._dataSourceHovered=new ae.Delegate,this._ranges=null,this._zoomUndoStackIsNotEmpty=null,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap,this._selectionApi=null,this._lollipopSourcesApi=null,this._prevVisibleRange=null,this._prevHoveredSourceId=null,this._onSymbolChangedDelegate=new ae.Delegate,this._chartWidget=e,this._activateChart=t,this._timezoneApi=new Gf(e),this._chartWidget.withModel(this,(()=>{this._chartWidget.model().crosshairSource().moved().subscribe(this,this._onCrosshairMoved),
-this._chartWidget.model().model().hoveredSourceChanged().subscribe(this,this._onHoveredSourceChanged),this._chartWidget.model().timeScale().logicalRangeChanged().subscribe(this,this._onLogicalRangeChanged),this._chartWidget.model().mainSeries().dataEvents().symbolResolved().subscribe(this,this._onSymbolChanged)})),this._widgetLinkingGroupIndex=e.linkingGroupIndex().spawn(),this._widgetLinkingGroupIndex.subscribe((e=>this._apiLinkingGroupIndex.setValue(e))),this._apiLinkingGroupIndex=new O.WatchedValue(this._widgetLinkingGroupIndex.value()),this._apiLinkingGroupIndex.subscribe((e=>{this._widgetLinkingGroupIndex.value()!==e&&(this._chartWidget.hasModel()?this._chartWidget.model().setLinkingGroupIndex(e):this._widgetLinkingGroupIndex.setValue(e))})),this._chartWidget.onAboutToBeDestroyed().subscribe(this,this._destroy,!0)}setActive(){this._activateChart()}getPriceToBarRatio(){return this._chartWidget.model().model().mainSeriesScaleRatioProperty().value()}setPriceToBarRatio(e,t){const i=this._chartWidget.model(),s=i.model(),o=s.mainSeriesScaleRatioProperty();t?.disableUndo?new gp(o,e,null,s).redo():i.setScaleRatioProperty(o,e,my)}isPriceToBarRatioLocked(){return this._chartWidget.model().model().mainSeries().priceScale().isLockScale()}setPriceToBarRatioLocked(e,t){const i=this._chartWidget.model(),s=i.model(),o=s.mainSeries().priceScale();t?.disableUndo?new Nl({lockScale:e},o,null,s).redo():i.setPriceScaleMode({lockScale:e},o,gy)}id(){return this._chartWidget.id()}onDataLoaded(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())}onSymbolChanged(){return this._makeSubscriptionFromDelegate(this._onSymbolChangedDelegate)}onIntervalChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())}onVisibleRangeChanged(){return this._makeSubscriptionFromDelegate(this._visibleBarsChanged)}onChartTypeChanged(){const e=this._chartWidget.model().mainSeries().onStyleChanged();return this._makeSubscriptionFromDelegate(e)}onSeriesTimeframe(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesTimeFrame())}onSeriesError(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesError())}dataReady(e){const t=!this._chartWidget.hasModel()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t}whenChartReady(e){this._chartWidget.withModel(this,e)}crossHairMoved(){return this._makeSubscriptionFromDelegate(this._crosshairMoved)}onHoveredSourceChanged(){return this._makeSubscriptionFromDelegate(this._dataSourceHovered)}setVisibleRange(e,t){return new Promise(((i,s)=>{const o=e=>{clearTimeout(n),s(e)},n=setTimeout((()=>o(new Error("Rejected by timeout"))),t?.rejectByTimeout??1e4);this._chartWidget.setVisibleTimeRange(e.from,e.to,t,(()=>{clearTimeout(n),i()}),o)}))}async setSymbol(e,t){(0,tt.isFunction)(t)&&(t={dataReady:t})
-;const{dataReady:i,doNotActivateChart:s,initiatorName:o="chart api"}=t||{};if(e===this.symbol()||this._chartWidget.hasModel()&&this._chartWidget.model().mainSeries().symbolSameAsResolved(e))return i?.(),!0;s||this._activateChart();const n=this._chartWidget.chartWidgetCollection(),r=await n.setSymbol(e,void 0,this._chartWidget);return r&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}async setResolution(e,t){(0,tt.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s,initiatorName:o="Chart api"}=t||{},n=Re.Interval.normalize(e);if(null===n||n===this.resolution())return i?.(),!0;s||this._activateChart();const r=await this._chartWidget.chartWidgetCollection().setResolution(n,void 0,this._chartWidget);return r&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}async setChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)return t?.(),!0;const i=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);return uy(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllShapes(){return this._chartWidget.model().model().allLineTools().map($f).filter((e=>null!==e.name))}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(Kf)}getStudyTemplateSnapshot(e,t,i){return(0,py.getStudyTemplateSaveData)(e,this._chartWidget.model().model(),t,i)}getStudyTemplateDescString(){const e=(0,py.getStudyTemplateMetaInfo)(this._chartWidget.model().model());return(0,py.getStudyTemplateDescString)(e.indicators)}async applyStudyTemplateByRecord(e){if(!e)return;const{name:t,id:i,is_default:s}=e,o=e=>this._chartWidget.model().applyStudyTemplate(JSON.parse(e.content),t);s?await z.backend.getStandardStudyTemplateById(i,o):await z.backend.getStudyTemplateById(i).then(o)}chartTemplate(){return this._chartWidget.model().model().template()}applyChartTempalte(e){this._chartWidget.chartWidgetCollection().applyTheme(e)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.hasMaximizedPane()){let t=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));const s=i/t;return e.map((e=>Math.round(e.stretchFactor()/s*100)/100))}return e.map((e=>e.height()))}setAllPanesHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");const s=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{const o=e*s;i[t].setStretchFactor(o)})),t.fullUpdate()}maximizeChart(){this._chartWidget.requestFullscreen()}isMaximized(){return this._chartWidget.inFullscreen()}
-restoreChart(){this._chartWidget.exitFullscreen()}restoreChartPreferences(){this._chartWidget.model().restorePreferences()}availableZOrderOperations(e){const t=fy(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}bringForward(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}insertAfter(e,t){const i=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertAfter(s,o)}insertBefore(e,t){const i=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertBefore(s,o)}sessions(){return this._chartWidget.model().model().sessions()?.get()??null}chartModel(){return this._chartWidget.model().model()}chartUndoModel(){return this._chartWidget.model()}chartWidget(){return this._chartWidget}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");const i=this._chartWidget.model().model().dataSourceForId(e);if(!i)return;const s=i.properties();s&&s.visible&&s.visible.setValue(t)}async createStudy(e,t,i,s,o,n){if("function"==typeof o)return console.warn('"createStudy" does not take "callback" parameter anymore'),Promise.resolve(null);if(n=n||{},"string"!=typeof e)return this._createStudy(e);e=e.toLowerCase();const r=await(0,os.studyMetaInfoRepository)().findAllJavaStudies(),a=ns.StudyMetaInfo.findStudyMetaInfoByDescription(r,e);if(n.checkLimit){const e=this._chartWidget.model().canCreateStudy({id:a.id});if(!e.success)return(0,wr.showTooManyStudiesNotice)(e.limitValue),Promise.resolve(null)}const l=(n.disableUndo?this._chartWidget.model().model():this._chartWidget.model()).createStudyInserter({type:"java",studyId:a.id},[]);if(l.setForceOverlay(!!t),n.priceScale&&l.setPreferredPriceScale(function(e){switch(e){case"no-scale":return"overlay";case"as-series":return"as-series";case"new-left":return"left";case"new-right":return"right";default:throw new Error(`The pricescale "${e}" is invalid, the only valid options are "no-scale", "as-series", "new-left" and "new-right".`)}}(n.priceScale)),n.allowChangeCurrency&&l.setAllowChangeCurrency(!0),n.allowChangeUnit&&l.setAllowChangeUnit(!0),Array.isArray(s)){console.warn("Passing study inputs as an ordered array is now deprecated. Please use an object where keys correspond to the inputs of your study instead.");const e={};for(let t=0;tPromise.resolve({inputs:s||{},parentSources:[]}))).then((e=>(o&&(0,Wf.applyOverridesToStudy)(e,o),i&&e.setUserEditEnabled(!1),e.id())))}
-waitForStudyCreated(e){return this._chartWidget.model().model().waitForStudy(e)}compileFailedStudies(){return this._chartWidget.model().model().studiesWV().value().filter((e=>e.isPine()&&e.hasCompileError()))}getStudyById(e){const t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw new Error("There is no such study");return this._getStudyApi(t)}getSeries(){const e=this._chartWidget.model(),t=e.mainSeries();return new ly(t,e)}createShape(e,t){return this.createMultipointShape([e],t)}async createMultipointShape(e,t){const i=()=>new Error(`Cannot create "${s.shape}" shape`),s=Object.assign({},{filled:!0},t),o=Of[s.shape]||Of.flag;const r=this._chartWidget.model().model(),a=r.mainSeries();if(r.timeScale().isEmpty())throw i();const l=void 0!==s.ownerStudyId?r.dataSourceForId(s.ownerStudyId)??a:a,c=r.paneForSource(l),h=this._convertUserPointsToDataSource(e);if(null===h||null===c)throw i();if(o.onlySelectable)throw new Error(`Cannot create "${s.shape}" shape`);if("LineToolIcon"===o.name){const e=s;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!s.hasOwnProperty("icon"))throw new Error("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}await(0,xo.ensureLineToolLoaded)(o.name);const d=(0,zs.createLineToolProperties)(r.backgroundTheme().spawnOwnership(),o.name,!r.readOnly());if((0,zs.prepareLineToolPropertiesByOwnerSource)(d,l),s.overrides)for(const e in s.overrides)d.hasChild(e)?(0,n.ensureDefined)(d.child(e)).mergeAndFire(s.overrides[e]):ny(o.name)&&-1!==["profitLevel","stopLevel"].indexOf(e)&&d.addProperty(e,s.overrides[e]);let u;void 0!==d.hasChild("text")&&s.text&&(0,n.ensureDefined)(d.child("text")).setValue(s.text),d.hasChild("filled")&&s.filled&&(0,n.ensureDefined)(d.child("filled")).setValue(!0),u=s.disableUndo?this._chartWidget.model().model():this._chartWidget.model();const _=u.createLineTool({pane:c,point:h[0],linetool:o.name,properties:d,ownerSource:l,actionSource:"API"});if(null===_)throw d.destroy(),i();if(_.properties()!==d&&d.destroy(),ny(o.name)){if(h.length>2)throw new Error(`Wrong points count for ${s.shape}. Required 1 or 2`);2===h.length&&(_.startChanging(1,h[1]),_.setPoint(1,h[1]),_.endChanging(!0,!1))}else{const e=_.pointsCount();if(e!==h.length&&-1!==e)throw new Error(`Wrong points count for ${s.shape}. Required ${e}`);const t=new To.EnvironmentState(void 0,!0),i=(0,Lt.isLineDrawnWithPressedButton)(o.name);for(let e=1;e{const i={};return t.forEach((t=>{void 0!==e[t]&&(i[t]=e[t])})),i})(e,["name","base_name","ticker","description","long_description","type","session","session_display","session_holidays","corrections","exchange","exchange","listed_exchange","timezone","format","pricescale","minmov","fractional","minmove2","variable_tick_size","has_intraday","supported_resolutions","intraday_multipliers","has_seconds","has_ticks","seconds_multipliers","has_daily","daily_multipliers","has_weekly_and_monthly","weekly_multipliers","monthly_multipliers","has_empty_bars","visible_plots_set","volume_precision","data_status","delay","expired","expiration_date","sector","industry","currency_code","original_currency_code","unit_id","original_unit_id","unit_conversion_types","subsession_id","subsessions","price_source_id","price_sources","logo_urls","exchange_logo","pro_name","library_custom_fields"]);return t.pro_name=e.pro_name,t}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){const e={from:0,to:0
-},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const s=i.firstBar(),o=i.lastBar(),r=this._convertIndexToPublicTime(o);if(null===r)return e;const a=Math.max((0,n.ensureNotNull)(t.points().range().value()).firstIndex,s);return e.from=(0,n.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=r,e}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())return null;return this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){return this._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){return this._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){return this._chartWidget.getTimezone()}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!l.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),Promise.all([i.e(2578),i.e(9498)]).then(i.bind(i,99207)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}setDragExportEnabled(e){l.enabled("chart_drag_export")?this._chartWidget.model().model().setDragExportEnabled(e):console.error("feature is not enabled")}canZoomOut(){return!this._chartWidget.model().zoomStack().isEmpty()}canZoomOutWV(){if(!this._zoomUndoStackIsNotEmpty){const e=new O.WatchedValue(!1);this._zoomUndoStackIsNotEmpty=e.spawn(),this._chartWidget.withModel(this,(()=>{const t=this._chartWidget.model().zoomStack();t.onChange().subscribe(this,(()=>e.setValue(!t.isEmpty())))}))}return this._zoomUndoStackIsNotEmpty.readonly()}zoomOut(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}shapesGroupController(){return new _y(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==mt.SelectPointMode.None}requestSelectBar(){return this.isSelectBarRequested()?Promise.reject("already requested"):new Promise(((e,t)=>{this._chartWidget.requestSelectPoint({pointType:"time"}).then((t=>{e(this._convertTimeToPublic((0,n.ensureDefined)(t.point.time)))})).catch((()=>{t("cancelled")}))}))}cancelSelectBar(){
-this.isSelectBarRequested()&&this._chartWidget.cancelRequestSelectPoint()}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return zf(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return function(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return e.startOfBar(0)/1e3}(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=()=>new Error(`Cannot create "${t.shape}" shape`),s=t.shape;if(Nf(s)&&!0!==Of[s].isAnchored)throw console.warn(`${s} is not an anchored shape. It can be created using createShape or createMultipointShape`),i();const o=this._chartWidget.model().model(),n=o.mainSeries();if(o.timeScale().isEmpty())throw i();const r=void 0!==t.ownerStudyId?o.dataSourceForId(t.ownerStudyId):n,a=this._convertPositionPercentToPricedPoint(e,r);if(null===a)throw i();return this.createMultipointShape([a],t)}properties(){return this._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);return t.cloneLineTools([i],!1)[0]}shareLineTools(e,t){const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}getLollipopSourcesApi(){throw new Error("getLollipopSourcesApi is not supported")}clickAtLatestUpdatesLollipop(){throw new Error("clickAtLatestUpdatesLollipop is not supported")}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}chartProto(){return kg.prototype}ranges(){throw new Error("not implemented")}getTimeScale(){return new Uf(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,Vf.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}async syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();if(i)return t.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e=1,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");const s=i??!0,o=(0,
-n.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,s);return delete o.clientId,o}async applyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,n.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,n.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}studyMetaIntoRepository(){return(0,os.studyMetaInfoRepository)()}replayStatus(){return this._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){return this._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s,o){return this._chartWidget.model().insertStudyWithoutCheck(new ns.StudyMetaInfo(e,o),t,i,s)}copyEntityToClipboard(e){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([t])}pasteFromClipboard(){this._chartWidget.chartWidgetCollection().clipboard.uiRequestPaste()}inactivityGaps(){return this._chartWidget.model().model().inactivityGaps()}setInactivityGapsSession(e){this._chartWidget.model().model().setInactivityGapsSession(e)}_destroy(){this._zoomUndoStackIsNotEmpty?.destroy(),this._chartWidget.hasModel()&&(this._chartWidget.model().crosshairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged),this._chartWidget.model().zoomStack().onChange().unsubscribeAll(this)),this._chartWidget.modelCreated().unsubscribeAll(this),this._widgetLinkingGroupIndex.destroy()}async _createTradingPrimitive(e){const t=this._chartWidget.model(),i=t.model(),s=(0,n.ensureNotNull)(i.paneForSource(i.mainSeries()));await(0,xo.ensureLineToolLoaded)(e);const o={pane:s,point:(()=>{const e=(0,n.ensureNotNull)(t.mainSeries().bars().last());return{index:e.index,price:e.value[4],interval:i.mainSeries().interval()}})(),linetool:e,actionSource:"API"};return i.createLineTool(o).adapter()}_createStudy(e){return Promise.reject("Pine Script® and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToPricedPoint(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),o=t.firstValue();if(null==o||!isFinite(o)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width()),r=i.indexToTimePoint(n);if(null===r)return null;return{price:s.coordinateToPrice(e.y*s.height(),o),time:r}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),o=i.data();if(t.timeScale().isEmpty())return null;const r=e.map((e=>e.time||0)),a=this._alignPoints(r),l=(e,t,r)=>{const a=s.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,n.ensureNotNull)(s.valueAt(a)),h=(0,n.ensureNotNull)(s.range().value());if(e>c&&a===h.lastIndex){
-const t=(0,n.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(ee.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));c.entityValues[t.id()]={isHovered:s,values:o,title:i.header()}}this._crosshairMoved.fire(c)}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,n.ensureNotNull)(e.mainSeries().symbolInfo()),s=e.mainSeries().interval(),o=new Cd.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,Td.newBarBuilder)(s,o,o),intervalObj:Re.Interval.parse(s)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new Xf(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new iy(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new ay(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,n.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=i.normalizeBarIndex(e.index);return{price:e.price,
-time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),o=i.symbolInfo();if(t.timeScale().isEmpty()||!Re.Interval.isDWM(s)||null===o)return e;const n=(0,Jd.createDwmAligner)(s,o);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=this.getVisibleRange();null!==this._prevVisibleRange&&(0,tt.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!l.enabled("saveload_separate_drawings_storage"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}_onSymbolChanged(e){var t;this._onSymbolChangedDelegate.fire({name:(t=e).name,base_name:t.base_name,ticker:t.ticker,description:t.description,long_description:t.long_description,type:t.type,session:t.session,session_display:t.session_display,session_holidays:t.session_holidays,corrections:t.corrections,exchange:t.exchange,listed_exchange:t.listed_exchange,timezone:t.timezone,format:t.format,pricescale:t.pricescale,minmov:t.minmov,fractional:t.fractional,minmove2:t.minmove2,variable_tick_size:t.variable_tick_size,has_intraday:t.has_intraday,supported_resolutions:t.supported_resolutions,intraday_multipliers:t.intraday_multipliers,has_seconds:t.has_seconds,has_ticks:t["is-tickbars-available"],seconds_multipliers:t.seconds_multipliers,build_seconds_from_ticks:t.build_seconds_from_ticks,has_daily:t.has_daily,daily_multipliers:t.daily_multipliers,has_weekly_and_monthly:t.has_weekly_and_monthly,weekly_multipliers:t.weekly_multipliers,monthly_multipliers:t.monthly_multipliers,has_empty_bars:t.has_empty_bars,visible_plots_set:t.visible_plots_set,volume_precision:t.volume_precision,data_status:t.data_status,delay:t.delay,expired:t.expired,expiration_date:t.expiration_date,sector:t.sector,industry:t.industry,currency_code:t.currency_code,original_currency_code:t.original_currency_code,unit_id:t.unit_id,original_unit_id:t.original_unit_id,unit_conversion_types:t.unit_conversion_types,subsession_id:t.subsession_id,subsessions:t.subsessions,price_source_id:t.price_source_id,price_sources:t.source2?[t.source2]:[],logo_urls:t.library_custom_fields?.logo_urls,exchange_logo:t.library_custom_fields?.exchange_logo,library_custom_fields:t.library_custom_fields})}}var vy=i(52092);class Sy{loginRequired(){throw new Error("Not implemented")}onGoProDialog(e,t){throw new Error("Not implemented")}}function by(){throw new Error("not implemented")}function wy(e){const t=new O.WatchedValue(e.value()),i=t=>{(0,yi.allowSavingDefaults)(!0),e.setValue(t),(0,yi.allowSavingDefaults)(!1)};return t.subscribe(i),e.subscribe(t,(()=>{t.setValue(e.value())})),t.spawn((()=>{
-e.unsubscribeAll(t),t.unsubscribe(i)}))}class Cy extends Sy{constructor(e){super(),this.linking=de.linking,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._studyTemplatesDrawer=null,this._fontIconsSettingsDrawer=null,this._favoriteDrawingsToolbar=null,this._webview=null,this._activeChartWidgetWV=new O.WatchedValue(null),this._activeChartRangeState=new Bf.WatchedObject({ranges:[]}),this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null,this._chartWidgets=new WeakMap,this._layoutSettingsDrawer=null,this._magnetEnabledWV=null,this._magnetModeWV=null,this._magnetSnapsToIndicatorsWV=null,this._drawOnAllCharts=(0,ye.convertPropertyToWatchedValue)((0,mt.drawOnAllCharts)()),this._replayApi=null,this._pineEditorApi=null,this._backtestingStrategyApi=null,this._supportTicketData=null,this._activeChartWidgetChangedDelegate=new ae.Delegate,this._alerts=null,this._activateChart=e=>{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:n,sharingChartService:r=null,webview:a=null,favoriteServices:l,alertsServices:c,supportTicketData:h=null}=e;this._chartApiInstance=t,this._chartWidgetCollection=i,this._studyMarket=s,this._saveChartService=o,this._sharingChartService=r,this._loadChartService=n,this._favoriteServices=l,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=de.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=a,this._alertService=null,this._supportTicketData=h;const d=i.lock;this._symbolSync=d.symbol.spawn(),this._intervalSync=d.interval.spawn(),this._dateRangeSync=d.dateRange.spawn(),this._crosshairSync=d.crosshair.spawn(),this._timeSync=d.trackTime.spawn(),this._chartWidgetCollection.activeChartWidget.subscribe((()=>this._onActiveChartChanged()),{callWithLast:!0}),ee.subscribe("toggle_currency_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_currency_menu",...e)}),this),ee.subscribe("toggle_unit_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_unit_menu",...e)}),this)}destroy(){this._supportedChartStylesSpawn.destroy(),this._intervalsService?.destroy(),this._themesApi?.destroy(),this._widgebarApi?.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),this._pineEditorApi?.destroy(),this._isDestroyed=!0,this._magnetEnabledWV?.destroy(),this._magnetModeWV?.destroy(),this._magnetSnapsToIndicatorsWV?.destroy(),
-ee.unsubscribeAll("toggle_currency_menu_inner",this),ee.unsubscribeAll("toggle_unit_menu_inner",this)}themes(){return null===this._themesApi&&(this._themesApi=new Rf({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:this._saveChartService?.getSaveAsController()??null,ChartLayoutRename:this._saveChartService?.getRenameController()??null,ChartLayoutCreate:this._saveChartService?.getCreateController()??null,ChartLayoutLoad:this._loadChartService,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){ee.subscribe(e,t,void 0)}unsubscribe(e,t){ee.unsubscribe(e,t,void 0)}onActiveChartChanged(){return this._activeChartWidgetChangedDelegate}webview(){return by(),this._webview}connect(){by()}disconnect(){by()}onConnectionStatusChanged(e){by()}isConnected(){by()}supportTicketData(){return this._supportTicketData}setPublishChartOptions(e){by()}publishChart(e){by()}studyTemplatesDrawerApi(){by()}fontIconsSettingsDrawer(){by()}intervalsService(){by()}alertService(){by()}async alerts(){by()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,mt.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,mt.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,mt.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,mt.drawOnAllChartsMode)().setValue(e)}currencies(){return this._chartApiInstance?.availableCurrencies()??Promise.reject()}units(){return this._chartApiInstance?.availableUnits()??Promise.reject()}disableTrackingEvents(){(0,re.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync}crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){by()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}*charts(){for(let e=0;e=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){by()}setWatchlistApiPromise(e){by()}news(){by()}setNewsApiPromise(e){by()}widgetbar(){by()}setWidgetbarApiPromise(e){by()}getChartStorage(){return getChartStorage()}setDebugMode(e){l.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?l.setEnabled(e,t):lu.addPlusButtonProperty.setValue(t)}magnetEnabled(){return null===this._magnetEnabledWV&&(this._magnetEnabledWV=wy((0,mt.properties)().childs().magnet)),this._magnetEnabledWV}magnetMode(){return null===this._magnetModeWV&&(this._magnetModeWV=wy((0,mt.properties)().childs().magnetMode)),this._magnetModeWV}magnetSnapsToIndicators(){return null===this._magnetSnapsToIndicatorsWV&&(this._magnetSnapsToIndicatorsWV=wy((0,mt.properties)().childs().magnetSnapsToIndicators)),this._magnetSnapsToIndicatorsWV}flushBufferedData(){Ff.fire()}chartWidgetCollectionState(e){return this._chartWidgetCollection.state(e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}watermark(){{
-const e=P_.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){Cy.setContextMenuOptions(e)}changeSymbol(e,t,i,s="API"){de.linking.setIntervalAndLogInitiator((0,n.ensureNotNull)(Re.Interval.normalize(t)),s),de.linking.setSymbolAndLogInitiator(e,s),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}closePopupsAndDialogs(){Io.ContextMenuManager.hideAll(),ee.emit(vy.CLOSE_POPUPS_AND_DIALOGS_COMMAND)}startFullscreen(){return this._chartWidgetCollection.startFullscreen()}exitFullscreen(){return this._chartWidgetCollection.exitFullscreen()}getFavoriteChartStylesService(){by()}getFavoriteIntervalsService(){by()}getFavoriteCurrencyUnitConversionApi(){by()}getIntervals(){let e=[];const t=(0,ht.getCustomResolutions)();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),(0,ht.mergeResolutions)(e,t)}getLinetoolsFavoritesStore(){by()}getSavedCharts(e){z.backend.getCharts().then(e)}getStudiesList(){return(0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata().filter((e=>!e.is_hidden_study)).map((e=>e.description))}getStudyInputs(e){return Qf(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getStudyStyles(e){return ey(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return e?.(t),t}hasChartChanges(){return this._chartWidgetCollection.hasChanges()}async loadChart(e){{this._chartApiInstance?.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name));const t=await this._chartWidgetCollection.loadContent(e.json);this._chartWidgetCollection.unloadUnusedCharts(),this._chartApiInstance?.connect(),de.linking.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),ee.emit("chart_loaded"),t.contentMigrated&&ee.emit("chart_migrated")}}async loadChartFromServer(e){await(this._loadChartService?.loadChart(e,!1))}async loadLayoutFromServerByLayoutId(e,t,i){await(this._loadChartService?.loadChartByUrl(e,!!t,i))}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}async createNewLayout(e){by()}lockAllDrawingTools(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new O.WatchedValue((0,mt.lockDrawings)().value()),this._lockDrawingsWatchedValue.subscribe((e=>{(0,mt.lockDrawings)().setValue(e)})),(0,mt.lockDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._lockDrawingsWatchedValue).setValue((0,mt.lockDrawings)().value())}))),this._lockDrawingsWatchedValue}hideAllDrawingTools(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new O.WatchedValue((0,mt.hideAllDrawings)().value()),this._hideDrawingsWatchedValue.subscribe((e=>{(0,
-mt.hideAllDrawings)().setValue(e)})),(0,mt.hideAllDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideDrawingsWatchedValue).setValue((0,mt.hideAllDrawings)().value())}))),this._hideDrawingsWatchedValue}hideAllIndicators(){return null===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=new O.WatchedValue((0,mt.hideAllIndicators)().value()),this._hideIndicatorsWatchedValue.subscribe((e=>{(0,mt.hideAllIndicators)().setValue(e)})),(0,mt.hideAllIndicators)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideIndicatorsWatchedValue).setValue((0,mt.hideAllIndicators)().value())}))),this._hideIndicatorsWatchedValue}logs(){return{getLogHistory:ne.getLogHistory,enable:window.lon,disable:window.loff}}mainSeriesPriceFormatter(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}onContextMenu(e){ee.subscribe("onContextMenu",(t=>{t.callback(e(t.unixtime,t.price))}),void 0)}onGrayedObjectClicked(e){ee.subscribe("onGrayedObjectClicked",e,void 0)}removeChartFromServer(e,t){z.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;const i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}selectedLineTool(){const e=Object.keys(Of),t=mt.tool.value();for(let i=0;i{t&&(t(e),t=null)};(0,j.showConfirm)({title:e.title,text:e.body||"",onClose:()=>{i(!1)},onConfirm:e=>{i(!0),e.dialogClose()}})}showLoadChartDialog(){this._loadChartService?.showLoadDialog()}persistentLogger(){return null}showNoticeDialog(e){(0,j.showWarning)({title:e.title,text:e.body||"",onClose:e.callback})}showSupportDialog(){by()}showSaveAsChartDialog(){const e=this._saveChartService;e&&window.runOrSignIn((()=>{e.saveChartAs()}),{source:"Save as chart dialogue"})}showRenameChartDialog(){by()}saveChartOrShowTitleDialog(e,t,i){by()}showCreateAlertDialog(){by()}createGoProDialog(e){by()}setUserInfo(e){by()}openMobileChartPicker(){by()}closeMobileChartPicker(){by()}takeClientScreenshot(e){return this._chartWidgetCollection.clientSnapshot(e)}
-takeScreenshot(){return this._chartWidgetCollection.takeScreenshot()}trading(){by()}waitTrading(){by()}viewMode(){by()}viewModeWatchedValue(){by()}async dummyBrokerController(){return Promise.reject("Not implemented")}pineLibApi(){return by(),{saveNew,saveNext,requestBuiltinScripts}}resetCache(){(0,r.getChartingLibraryGlobalContext)().ChartApiInstance.resetCache()}getSymbolAliasService(){throw new Error("not supported")}static setContextMenuOptions(e){void 0!==e.items_processor&&Io.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&Io.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new yy(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}_toggleUnitConversionMenu(e,t,i,s,o){if(t)return void ee.emit(e,t,-1,-1,"");const r=this._chartWidgetCollection.getAll(),a=r.findIndex((e=>e.model().model().id()===i));if(-1===a)return;const l=(0,n.ensureDefined)(r[a]).paneWidgets().findIndex((e=>e.state().id()===s));-1!==l&&ee.emit(e,t,a,l,o)}_onBeforeActiveChartChanged(){0}_onActiveChartChanged(){this._onBeforeActiveChartChanged(),this._activeChartWidgetWV.setValue(this.activeChart()),this._activeChartWidgetChangedDelegate.fire(),this._onAfterActiveChartChanged()}_onAfterActiveChartChanged(){this._updateActiveChartRangeState()}_updateActiveChartRangeState(){0}}i(4783),i(45);var Ty=i(78136),Py=i(19979);const xy={ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",br:"br",ru:"ru",sv_SE:"se",th_TH:"th",tr:"tr",uk:"uk",vi_VN:"vn",zh_CN:"cn",zh_TW:"tw"};function My(e){return xy[e]||"www"}var Iy=i(33065),Ay=i(70893),Ly=i(50946);i(59449);const ky={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-cold-gray-900"],shadow:Rt.colorsPalette["color-cold-gray-700"],text:Rt.colorsPalette["color-white"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-cold-gray-800"],20),logo:Rt.colorsPalette["color-white"],platformBgColor:Rt.colorsPalette["color-cold-gray-900"],platformFgColor:Rt.colorsPalette["color-cold-gray-200"]},Ey={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-white"],shadow:Rt.colorsPalette["color-cold-gray-150"],text:Rt.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-white"],20),logo:Rt.colorsPalette["color-cold-gray-900"],platformBgColor:Rt.colorsPalette["color-white"],platformFgColor:Rt.colorsPalette["color-cold-gray-900"]}
-;const Dy=new Map([["logo-old-style",Ly],["tradingview-old-style",Ay]]),By=l.enabled("adaptive_logo"),Vy=l.enabled("small_no_display"),Ry=l.enabled("38914"),Ny="site_branding",Oy="widget_branding",Fy="widget_referral_branding",Wy="widget_custom_branding",Hy="widget_custom_no_powered_branding",zy="fundamental_branding",Uy="fundamental_custom_branding",jy="fundamental_custom_no_powered_branding",Gy="library_branding",qy="library_custom_branding",$y="library_custom_no_powered_branding",Ky=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Yy=window.urlParams||{},Zy=window.initData||{};Yy.no_referral_id&&enable(Yy.referral_id||"","aggressive");const Xy=a.t(null,void 0,i(98856)),Jy=Ry?a.t(null,void 0,i(44676)):a.t(null,void 0,i(92800));a.t(null,void 0,i(46768)),a.t(null,void 0,i(83470)),a.t(null,void 0,i(3140));var Qy;!function(e){e[e.OldFontAdditionalVerticalOffset=0]="OldFontAdditionalVerticalOffset",e[e.NewFontAdditionalVerticalOffset=.1]="NewFontAdditionalVerticalOffset",e[e.StrokeWidth=4]="StrokeWidth",e[e.StaticLogoHorizontalTextOffset=5]="StaticLogoHorizontalTextOffset",e[e.TextWidthCompensation=2]="TextWidthCompensation",e[e.AdaptiveWidthToHideText=500]="AdaptiveWidthToHideText",e[e.WidthToHideLogoIfSmallNoDisplayEnabled=480]="WidthToHideLogoIfSmallNoDisplayEnabled",e[e.TextAdditionalCropWidth=11]="TextAdditionalCropWidth",e[e.BadgeLogoMargin=-11]="BadgeLogoMargin",e[e.BadgeTextMargin=-8]="BadgeTextMargin",e[e.TextAnimatedAlphaStart=.3]="TextAnimatedAlphaStart",e[e.TextAnimatedAlphaEnd=1]="TextAnimatedAlphaEnd",e[e.AnimationDuration=200]="AnimationDuration"}(Qy||(Qy={}));(0,ze.onWidget)();class ev extends Ad.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Ny,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._tradingviewLogoLinkToPath="",this._cubicBezier=new br.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this);this._visible.subscribe(s),this._dark=t.dark().spawn(),this._dark.subscribe(s),this._checkLayout(),this._layout!==Wy&&this._layout!==Uy||(this._left=8,this._bottom=5);const o=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,Ol.default)(o,200),o(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),
-this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Hy&&this._layout!==jy)return[];if(!this._visible.value())return[];if(this._layout===Ny&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=this._model.mainPane();if(!t)return[];const i=l.enabled("move_logo_to_main_pane");let s=!1;if(e.maximized().value())s=!0;else if(i)s=t.collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane().value();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes();for(let i=t.length-1;i>=0;--i){const o=t[i];if(!o.collapsed().value()){s=o===e;break}}}else s=e.isLast();return s?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e){return this._paneHeight=e.mediaSize.height,this._canvasWidth=e.mediaSize.width,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Hy&&this._layout!==jy&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new Ut.HitTestResult(Ut.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?ei.PaneCursorType.Pointer:ei.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){const e="https://"+function(e){return My(e)+".tradingview.com"}((Zy.querySettings?.locale??Zy.currentLocaleInfo?.language)||"en");let t=new URL(e);if(this._customLogoLink)return this._customLogoLink;if(this._layout===Gy||this._layout===qy){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"}this._tradingviewLogoLinkToPath&&(t.pathname=this._tradingviewLogoLinkToPath),t.searchParams.append("utm_source",window.location.origin),t.searchParams.append("utm_medium","library"),e&&t.searchParams.append("utm_campaign",e)}return t.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Yy.utm=!0,(0,Kt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),
-this._powBy=new rv(this._layout,e?.name||"",this._model,(()=>this._model.fullUpdate())),this._custom=new av(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null,this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Yy.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"),l.enabled("link_to_tradingview")?this._layout=qy:this._layout=$y):(e.tradingviewLogoLinkToPath&&(this._tradingviewLogoLinkToPath=e.tradingviewLogoLinkToPath.replace(/^\//,"")),this._layout=Gy,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){if(null!==this._openAnimation)return;null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._openAnimation=(0,xr.doAnimate)({from:e,to:1,duration:200*(1-e),easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_startCloseAnimation(){if(null!==this._closeAnimation)return;null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._closeAnimation=(0,xr.doAnimate)({from:e,to:0,duration:200*e,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if((0,ze.isSymphonyEmbed)())return!1;if(this._layout===Ny)return this._model.isSnapshot()||this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function tv(e){return!Vy||e>480}function iv(e){return!By||e>500}let sv={},ov={};class nv{constructor(){this._topLeftPoint=null,this._hitTestHeight=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,Gt.pointInBox)(e,t)}_getHitTestBox(){const e=this._topLeftPoint;if(e){const{x:t,y:i}=e;return(0,Vt.box)(e,new Vt.Point(t+this.width,i+(this._hitTestHeight??this.height)))}}}class rv extends nv{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._textAnimatedAlpha=1,this._textAnimatedAlphaStart=1,this._textAdditionalCropWidth=0,this._textAnimatedAlphaEnd=1,this._badgeData={logoMargin:0,textMargin:0,width:0},this._invertTextCropDirection=!1,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._maximizedAnimationTextWidth=0,this._logoWidth=0,this._textWidthCache=new Qt.TextWidthCache,this._pixelRatio={horizontalPixelRatio:NaN,verticalPixelRatio:NaN},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||e===Oy,
-this._alwaysMaximized=l.enabled("logo_always_maximized")||this._model.isSnapshot()&&!ze.CheckMobile.any()||!1,this._fontSize=this._showAnimatedBranding||this._layout===Fy?11:14,this._showAnimatedBranding||this._layout!==Wy&&this._layout!==Uy||(this._fontSize=12),this._sizeConstants=(this._model.isSnapshot(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,logoTextOffset:6}),this.width=this._minimizedAnimationWidth(),this._animatedWidth=this.width,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}animationStep(){const e=this._minimizedAnimationWidth(),t=this._maximizedAnimationWidth();return(this._animatedWidth-e)/(t-e)}animatedDrawStep(e){const t=this._minimizedAnimationWidth(),i=this._maximizedAnimationWidth();this._animatedWidth=t+e*(i-t),this._textAnimatedAlpha=this._textAnimatedAlphaStart+e*(this._textAnimatedAlphaEnd-this._textAnimatedAlphaStart)}draw(e,t,i,s){const{brandCircleSize:o,logoLeftOffset:n,leftOffset:r,bottomOffset:a}=this._sizeConstants;this._needDisplayImage&&tv(s)&&(e=new Vt.Point(e.x+r,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y);const{horizontalPixelRatio:l,verticalPixelRatio:c}=i;(0,Iy.equalPixelRatios)(i,this._pixelRatio)||(this._textWidthCache.reset(),this._pixelRatio={horizontalPixelRatio:l,verticalPixelRatio:c});const h=this._colors;if(this._showAnimatedBranding){if(this._needDisplayImage){const e=this._getLogoImage(h.logo);this.width=this._animatedWidth,this._drawLogo(t,e,this._animatedWidth,this._animatedWidth,this._animatedWidth>this._sizeConstants.brandCircleSize)}}else if(this._layout===Wy||this._layout===Uy){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),t.restore()}else if(tv(s))if(this._needDisplayImage){const e=this._getLogoImage(h.logo);t.save(),this._drawBgCircle(t,o/2);const{width:i,height:r}=e.logoImage.viewBox(),a=new Vt.Point(Math.round((o-i)/2)-1+n,Math.floor((o-r)/2)+1);this._drawLogoImage(t,a,e.logoImage);const l=iv(s);l&&(t.translate(o+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=o,l&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=iv(s);e&&(t.save(),t.translate(Ky?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_minimizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._badgeData.logoMargin+this._badgeData.width}
-_maximizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._sizeConstants.logoTextOffset+this._maximizedAnimationTextWidth+this._badgeData.width+this._badgeData.textMargin}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,o){const{brandCircleSize:n,logoLeftOffset:r,logoTextOffset:a}=this._sizeConstants;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const{logoImage:l,textImage:c,proBadgeImage:h}=t,{width:d,height:u}=l.viewBox(),_=new Vt.Point(Math.round((n-d)/2)-1+r,Math.floor((n-u)/2)+1);if(o){const t=new Vt.Point(_.x+d+a,_.y),i=e.globalAlpha;e.globalAlpha*=this._textAnimatedAlpha;const o=s-this._sizeConstants.brandCircleSize-a-this._badgeData.logoMargin-this._badgeData.width;this._drawImageCropWidth(e,t,c,o),e.globalAlpha=i}if(h){const{width:t,height:i}=h.viewBox();h.render(e,{targetViewBox:{x:_.x+this.width-t,y:Math.floor((n-i)/2)+1,width:t,height:i}})}this._drawLogoImage(e,_,l),e.restore()}_init(){ov={},sv={},this._checkLayout(),this.show&&(this._updateColors(),this._updateHeight(),this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_updateHeight(){this._needDisplayImage?this.height=this._sizeConstants.brandCircleSize:this.height=this._fontSize+2}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){const e=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:0,height:0})),t=(0,Kt.getPrescaledContext2D)(e);t.font=this._fontSize+this._font;const i=this._needDisplayImage?this._getLogoImage(this._colors.logo):null;let s=i?i.textImage.viewBox().width+this._sizeConstants.textAsImageWidthCompensation:Math.ceil(t.measureText(this._txt).width)+2+8;s%2==0&&(s+=1),this._maximizedAnimationTextWidth=s,this._textWidthCache.reset(),this._logoWidth=i?.logoImage.viewBox().width??0,this._animatedWidth=this._alwaysMaximized?this._maximizedAnimationWidth():this._minimizedAnimationWidth()}_updateColors(){this._colors=this._model.dark().value()?ky:Ey}_getLogoImage(e){return function(e,t,i,s,o){const r=ov,a=[t,i,o&&"tradeWith"].filter(Boolean).join("-"),l=r[a];if(void 0!==l)return l;const[c,h,d]=function(e,t,i){return i?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style",void 0]}(0,0,o),u=e=>e.replace(/fill="#[\da-f]{6}"/gi,`fill="${i}"`),_={logoImage:e(u((0,n.ensureDefined)(Dy.get(c)))),textImage:e(u((0,n.ensureDefined)(Dy.get(h)))),proBadgeImage:d?e(u((0,n.ensureDefined)(Dy.get(d)))):void 0};return r[a]=_,_}(Mo.svgRenderer,this._model.dark().value()?"dark":"light",e,0,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case Oy:case Fy:case Wy:case zy:case Uy:case qy:case Gy:case Ny:this.show=!0;break;case Hy:
-case jy:case $y:this.show=!1}switch(this._layout){case Gy:this._needDisplayImage=!0,this._txt=Xy;break;case qy:this._txt=Jy}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save();const{logoMargin:o,textMargin:n}=this._badgeData;e.beginPath();const{width:r,height:a}=i.viewBox();e.rect(t.x-this._textAdditionalCropWidth,t.y,s+this._textAdditionalCropWidth,a),e.clip(),i.render(e,{targetViewBox:{x:t.x-(this._invertTextCropDirection?r-s-o+n:0),y:t.y,width:r,height:a}}),e.restore()}_drawBgCircle(e,t){const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,o,n,r){e.save(),(0,$t.drawRoundRect)(e,t-1,i-1,s+2,o+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,$t.drawRoundRect)(e,t,i,s,o,r??n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){const{width:s,height:o}=i.viewBox();i.render(e,{targetViewBox:{x:t.x,y:t.y,width:s,height:o}})}}class av extends nv{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case Wy:case Hy:case Uy:case jy:case qy:case $y:this.show=!0;break;case Ny:case Oy:case Fy:case zy:case Gy:this.show=!1}}}var lv=i(55279),cv=i(48961);class hv{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var dv=i(68028);class uv{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){
-return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class _v{symbol(e){return new uv(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new _v),this._instance}_model(){return dv.CustomStatusModel.getInstance()}}_v._instance=null;var pv=i(22692),mv=i(15754);var gv=i(23745),fv=i(10980),yv=i(43222);class vv{constructor(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new ae.Delegate,this.seriesError=new ae.Delegate}onSymbolResolved(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})}onSymbolError(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})}onStudyError(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})}onSeriesLoading(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})}onSeriesCompleted(e,t,i){this.beforeSeriesCompleted.fire(e,t),this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})}onSeriesError(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)}onStudyCompleted(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})}onStudyLoading(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})}onTickmarksUpdated(e,t){const i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)}onTimescaleUpdate(e,t){const i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex,clearTickMarks:e.clearTickMarks}]};this._server.receiveLocalResponse(i)}onTimescaleCompleted(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})}onSeriesTimeframeUpdate(e,t,i,s,o,n){const r={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,o]};this._server.receiveLocalResponse(r)}onPointsetDataUpdate(e,t,i){this.onDataUpdate(e,t,i,null)}onDataUpdate(e,t,i,s){const o={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(o)}onQuotesData(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})}onDepthData(e){this._server.receiveLocalResponse({method:"dd",params:e})}onDepthUpdate(e){this._server.receiveLocalResponse({method:"dpu",params:e})}
-onClearData(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})}_prepareDataUpdateObjects(e){const t={};return e.forEach((e=>{t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t}}class Sv{constructor(){this._instances=new Map}createChartApiMessager(e,t){const i=new vv(t,e);return this._instances.set(e,i),i}getChartApiMessager(e){return(0,n.ensureDefined)(this._instances.get(e),`ChartapiMessager instance for session ${e}`)}}const bv={blue:"#2962ff",gray:"#787B86",green:"#4CAF50",olive:"#808000",teal:"#00897B",new:(e,t)=>(0,Ro.applyTransparency)(e,t)},wv={hline:{style_dashed:qt.LINESTYLE_DASHED,style_dotted:qt.LINESTYLE_DOTTED,style_solid:qt.LINESTYLE_SOLID}},Cv={line:"line"};class Tv{get(e){return NaN}set(e){}indexOf(e){return NaN}adopt(e,t,i){return NaN}}var Pv=i(60911);class xv{constructor(e,t){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>this._ctx.symbol.isLastBar},this.input={bool:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("boolean"==typeof e,"Study input value should be a boolean"),e},int:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("number"==typeof e,"Study input value should be a number"),e},source:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)((e=>{switch(e){case"open":case"high":case"low":case"close":case"hl2":case"hlc3":case"ohlc4":return!0;default:return!1}})(e),"Study input value should be a series source"),this._ctx.new_var(Py.Std[e](this._ctx))},string:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a string"),e},symbol:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a symbol string"),e}},this.request={security:(e,t)=>{const i=this._symbolIndexByTickerId.get(e);this._addedTickerIds.has(e)||this._ctx.new_sym(e,Py.Std.period(this._ctx)),(0,n.assert)(void 0!==i,`Unknown tickerId ${e}`);const s=this._ctx.new_unlimited_var(Py.Std.time(this._ctx));this._ctx.select_sym(i);const o=this._ctx.new_unlimited_var(Py.Std.time(this._ctx)),r=t?.expression?.()??this.close();return this._ctx.select_sym(0),this._ctx.new_var(r.adopt(o,s,0))}},this.runtime={error:e=>{Py.Std.error(e)}},this.math={max:(e,...t)=>{const i=e=>(0,Hd.isNumber)(e)?e:e.get(0),s=Math.max(i(e),...t.map(i));return(0,Hd.isNumber)(e)?s:this._ctx.new_var(s)},min:(e,...t)=>{const i=e=>(0,Hd.isNumber)(e)?e:e.get(0),s=Math.min(i(e),...t.map(i));return(0,Hd.isNumber)(e)?s:this._ctx.new_var(s)},negative:e=>(0,Hd.isNumber)(e)?-e:this._ctx.new_var(-e.get(0))},this.ta={change:e=>this._ctx.new_var(Py.Std.change(e)),correlation:(e,t,i)=>this._ctx.new_var(Py.Std.correlation(e,t,i,this._ctx)),cum:e=>this._ctx.new_var(Py.Std.cum(e.get(0),this._ctx)),ema:(e,t)=>this._ctx.new_var(Py.Std.ema(e,t,this._ctx)),
-rma:(e,t)=>this._ctx.new_var(Py.Std.rma(e,t,this._ctx)),sma:(e,t)=>this._ctx.new_var(Py.Std.sma(e,t,this._ctx)),vwap:(e,t,i)=>{const[s,o,n]=Py.Std.vwapBands(e,t,i,this._ctx);return[this._ctx.new_var(s),this._ctx.new_var(o),this._ctx.new_var(n)]},wma:(e,t)=>this._ctx.new_var(Py.Std.wma(e,t,this._ctx))},this.ticker={modify:(e,t)=>{let i;if((0,Pv.isEncodedExtendedSymbol)(e))i=e;else{const s={symbol:e,session:t};i=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(s)}return this._symbolIndexByTickerId.has(i)||this._symbolIndexByTickerId.set(i,++this._symbolIndex),i}},this.timeframe={change:e=>{if(isNaN(Py.Std.time(this._ctx)))return!1;const t=(0,Td.newBarBuilder)(e,this._ctx.symbol.session,null);t.moveTo(Py.Std.time(this._ctx));return 0===t.startOfBar(0)-Py.Std.time(this._ctx)},isDWM:()=>this._ctx.symbol.isdwm()},this._addedTickerIds=new Set,this._symbolIndexByTickerId=new Map,this._returnValues=[],this._ctx=e,this._inputCallback=t,this._inputIndex=0,this._symbolIndex=0}open(){return this._ctx.new_var(Py.Std.open(this._ctx))}high(){return this._ctx.new_var(Py.Std.high(this._ctx))}low(){return this._ctx.new_var(Py.Std.low(this._ctx))}close(){return this._ctx.new_var(Py.Std.close(this._ctx))}volume(){return this._ctx.new_var(Py.Std.volume(this._ctx))}year(){return Py.Std.year(this._ctx)}na(e){return!!Py.Std.na(e)}series(e){return this._ctx.new_var(e)}fill(e,t,i){}hline(e,t){return{id:""}}indicator(e){}plot(e,t){const i="number"==typeof e?e:e.get(0),s=void 0===t?.offset?i:{offset:t.offset,value:i};return this._returnValues.push(s),{id:""}}getReturnValues(){return this._returnValues}setMinimumAdditionalDepth(e){this._ctx.setMinimumAdditionalDepth(e)}}var Mv=i(18330);const Iv=e=>{switch(e){case"data_window":return Ts.InputDisplayFlags.DataWindow;case"none":return Ts.InputDisplayFlags.None;default:return Ts.InputDisplayFlags.All}},Av=e=>{switch(e){case"data_window":return 2;case"none":return 0;default:return 15}};class Lv{constructor(){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>!1},this.input={bool:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,inline:i?.inline,id:this._getNextInputId(),name:t,type:"bool"}),e),int:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"integer"}),e),source:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"source"}),new Tv),string:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,options:i?.options,type:"text"}),e),symbol:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"symbol"}),e)},this.math={max:e=>(0,Hd.isNumber)(e)?0:new Tv,min:e=>(0,Hd.isNumber)(e)?0:new Tv,negative:e=>(0,Hd.isNumber)(e)?0:new Tv},this.ta={change:e=>new Tv,correlation:(e,t,i)=>new Tv,
-cum:e=>new Tv,ema:()=>new Tv,rma:()=>new Tv,sma:()=>new Tv,vwap:()=>[new Tv,new Tv,new Tv],wma:()=>new Tv},this.request={security:e=>(this._tickers.push(e),new Tv)},this.runtime={error:e=>{throw new Error(e)}},this.ticker={modify:()=>""},this.timeframe={change:()=>!1,isDWM:()=>!1},this._bands=[],this._defaults={},this._filledAreas=[],this._format={type:"inherit"},this._inputs=[],this._overlay=!1,this._plots=[],this._shortTitle="",this._styles={},this._tickers=[],this._title="",this._version=1}getStudyName(){return this._title}getStudyMetainfo(){var e,t;return{_metainfoVersion:53,bands:this._bands,defaults:this._defaults,description:this._title,filledAreas:this._filledAreas,format:this._format,id:(e=this._title,t=this._version,`${e}@tv-basicstudies-${t}`),inputs:this._inputs,is_price_study:this._overlay,palettes:{},plots:this._plots,shortDescription:this._shortTitle,styles:this._styles}}getTickers(){return this._tickers}open(){return new Tv}high(){return new Tv}low(){return new Tv}close(){return new Tv}volume(){return new Tv}year(){return 0}na(e){return!1}series(e){return new Tv}fill(e,t,i){const s=this._getNextFillId(),o=this._plots.some((t=>t.id===e.id)),n=this._plots.some((e=>e.id===t.id)),r=this._bands.some((t=>t.id===e.id)),a=this._bands.some((e=>e.id===t.id)),l=o&&n;l||r&&a||this.runtime.error(`Could not find pair of plots or pair of hlines with ids ${e.id} ${t.id}`);const c=l?"plot_plot":"hline_hline";this._filledAreas.push({fillgaps:!1,id:s,isHidden:!1,objAId:e.id,objBId:t.id,title:i?.title??(l?"Plots Background":"Hlines Background"),type:c}),void 0===this._defaults.filledAreasStyle&&(this._defaults.filledAreasStyle={}),this._defaults.filledAreasStyle[s]=(e=>{if((e=>void 0===e?.color)(e))return{bottomColor:e?.bottomColor,fillType:"gradient",topColor:e?.topColor,visible:"all"===e?.display};return{fillType:void 0,color:e?.color??"TODO",visible:"all"===e?.display}})(i)}hline(e,t){const i=this._getNextBandId();this._bands.push({id:i,isHidden:!1,name:t?.title??"Level"}),void 0===this._defaults.bands&&(this._defaults.bands=[]);const s={color:t?.color??"#808080",linestyle:t?.linestyle??wv.hline.style_dashed,linewidth:t?.linewidth??1,value:e,visible:"none"!==t?.display,name:""};return this._defaults.bands.push(s),{id:i}}indicator(e){void 0!==e.title&&(this._title=e.title),void 0!==e.shortTitle&&(this._shortTitle=e.shortTitle),void 0!==e.format&&(this._format={type:e.format,precision:e.precision}),void 0!==e.version&&(this._version=e.version),this._overlay=!!e.overlay}plot(e,t){const i=this._getNextPlotId();return this._plots.push({type:t?.style??"line",id:i}),void 0===this._defaults.styles&&(this._defaults.styles={}),this._defaults.styles[i]=(e=>{switch(e?.style){case void 0:case"line":return{color:e?.color??"#0496FF",display:Av(e?.display),linestyle:Mv.LineStyle.Solid,linewidth:e?.linewidth??1,plottype:jd.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0};default:throw new Error("")}})(t),this._styles[i]={isHidden:!1,joinPoints:!1,title:t?.title??"Plot"},{id:i}}setMinimumAdditionalDepth(e){}_input(e){
-this._inputs.push(e),void 0===this._defaults.inputs&&(this._defaults.inputs={}),this._defaults.inputs[e.id]=(0,n.ensureDefined)(e.defval,"study input default value")}_getNextInputId(){return`in_${this._inputs.length}`}_getNextPlotId(){return`plot_${this._plots.length}`}_getNextBandId(){return`hline_${this._bands.length}`}_getNextFillId(){return`fill_${this._filledAreas.length}`}}var kv=i(4659);class Ev{build(e){const t=new Lv;return e(t),{name:t.getStudyName(),metainfo:t.getStudyMetainfo(),constructor:class{main(t,i,s){try{const s=new xv(t,i);e(s);const o=s.getReturnValues();return 0===o.length?null:o}catch(e){Py.Std.error(this._getErrorMessage(e))}}_getErrorMessage(e){if(e instanceof kv.StudyError)throw e;return(e instanceof Error?e.message:null==e?"Unknown error":e.toString()).replace(/:/g,"")}}}}}const Dv={palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:13,fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies",defaults:{},linkedToSeries:!1};class Bv{constructor(){this._metainfoCache=[]}studiesMetadata(){return 0===this._metainfoCache.length&&(this._metainfoCache=(0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary.map((e=>new ns.StudyMetaInfo(e.metainfo))),this._metainfoCache.push(new ns.StudyMetaInfo(Dv))),this._metainfoCache}}var Vv=i(78966),Rv=i.n(Vv);class Nv{createMarketStatusWatcher(e,t,i,s){return new(Rv())(e,t,i,s)}}class Ov{constructor(e){this._studyLibrary=e}findStudyObject(e){e.endsWith("!")&&(e=e.slice(0,-1));const t=e.split("@")[0],i=this._studyLibrary.filter((i=>i.metainfo.id===e||i.metainfo.shortDescription===t));if(0===i.length)return null;return i[0]}}var Fv,Wv=i(63193),Hv=i(56052),zv=i(82433),Uv=i(47132),jv=i(16329);class Gv{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,o=this.bars,n=o.length,r=s.time,a=0===n?NaN:o[n-1].time;0===n||a{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=window.setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)));this._logWarning("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}resetCache(){this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null===e||l.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})}_logMessage(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logWarning(e){console.warn(`${this._logMessagePrefix()}${e}`)}_logError(e){console.error(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(new Date).toISOString()} FEED [${this._symbolInfo.name}|${this._resolution}${e?"|"+e:""}${t?"|"+t:""}]: `}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),
-this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._firstDataRequest=!0,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,n.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,Pt.lowerbound)(this._cache.bars,i,((e,t)=>e.time{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${$v(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),qv(this._symbolInfo,this._resolution),this.resetCache.bind(this)),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(qv(this._symbolInfo,this._resolution)),
-this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),$v(s.bars[0].time),$v(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,Pt.lowerbound)(this._cache.bars,t,((e,t)=>e.time{if(!this._destroyed)if(r)this._logMessage("getBars callback is already called before",!0);else{if(r=!0,e.length>0){const t=` [${$v(e[0].time)} ... ${$v(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${n}`)}else this._logMessage(`Receiving bars: barset is empty, requested range: ${n}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(r?this._logMessage("getBars callback is already called before",!0):(r=!0,
-this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))}))}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format($v(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?(this._logMessage("EOD received"),this._setEndOfData()):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())}_setEndOfData(){this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?this._logWarning("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&this._logWarning("noData should be set when there is no data in the requested period and earlier only")}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(l.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&this._logError(`Wrong bars values: all ${s.join(", ")} properties should be numbers`)}}_getExpectedBarPropertyNames(){switch(this._symbolInfo.visible_plots_set){case"c":return["close","time"];case"hlc":return["high","low","close","time"];default:return["high","low","open","close","time"]}}_putToCache(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],
-this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}resetCache(){this._forEachThread(((e,t)=>t.resetCache()))}subscribe(e,t,i,s,o){const n=qv(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,o)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void this._logWarning("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):this._logWarning("Data thread doesnt exist: "+e)}_createThread(e,t){return new Kv(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,Jd.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}_logWarning(e){console.warn(`${(new Date).toISOString()} FEED: ${e}`)}}class Zv{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;se.id===Xv.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===Xv.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===Xv.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new jv.SessionsSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new jv.SessionsSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new jv.SessionsSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,Td.newBarBuilder)(this.period,e,t)}bartime(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,n.ensureDefined)(this.timezone,"symbol instrument timezone");let i=(0,Ce.utc_to_cal)(t,e);return i=this.session.spec.correctTradingDay(i),(0,Ce.cal_to_utc)(t,i)}lastbar(e){if(isNaN(e.time))return;let t=e.time;if(this.dwm_aligner){const e=(0,Ce.get_cal_from_unix_timestamp_ms)(this.dwm_aligner.sessionSrc().timezone,t);(!this._shouldAlignDwmBarsToMainSeries||this.dwm_aligner.sessionTgt().spec.includesDay(e))&&(this.dwm_aligner.moveTo(t),t=this.dwm_aligner.startOfBar(0))}const i=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=(0,Hd.isNumber)(e.volume)&&e.volume>=0?e.volume:NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.projectionTime=e.projectionTime||NaN,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}class Qv{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e=0){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=Py.Std.max(this.mindepth,e),NaN)}set(e){
-this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){let e=Py.Std.na(this.mindepth)?Py.Std.max_series_default_size:Py.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new eS(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new tS(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}function iS(e){return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class sS{constructor(e,t,i,s,o,n,r,a,l,c,h){this._body=n,this._symbols=[],this._runner=o,this._inputCallback=a,this._out=r,this._nonseriesOut=l,
-this._ctx=new tS(this.add_sym(e,t,i,s,h,c)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var o;if(null!=s)if(null===(o=s)||Array.isArray(o)||"composite"!==o.type)this._processResult(s);else for(let e=0;e1&&this._runner.host.enableDwmAligning&&r.enable_dwm_aligning(this._symbols[0].session,r.session),r}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){this._symbols=null,this._ctx?.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;var i;this._out&&e&&(!isNaN(t.symbol.time)||iS(e))&&(iS(e)?(i=e,Array.isArray(i)||"projection"!==i.type||(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):!function(e){return!Array.isArray(e)&&("non_series_bars"===e.type||"projection"===e.type)}(e)?this._out(t.symbol,e):e.bars.forEach((e=>{this._out(t.symbol,e)})))}}class oS{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,o,n,r){const a=new Jv(e,t,i,s,o,r,n);return this._symbols.push(a),a}get_sym(e){return this._symbols[e]}out(e,t){if(this._nonseriesUpdate){const i=Object.assign({},this._nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;const e=this.host,t=new sS(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],s=this._symbols,o=Object.assign({},e.dataRange,{countBack:(e.dataRange.countBack??0)+this._script.maxAdditionalDepth()}),r=s[0],a=(t,s,o)=>{i.push(e.datafeed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,o,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))},l=(t,i)=>{"series"===(i.nonseries?"nonseries":"series")?this.update(t,i):i.lastBar?(this._nonseriesUpdate=i,i.lastBar.isLastBar=!0,this._symbols[0].lastbar(i.lastBar),this._nonseriesUpdate=null):e.nonseriesOut(s[0],i)},c=()=>o;a(r,c,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{function i(i,s){let o=(0,Jd.createTimeToBarTimeAligner)(i,s)(e);const r=(0,Jd.createDwmAligner)(i,s);return null!==r&&(o=r.timeToExchangeTradingDay(o)),{to:o,countBack:(0,n.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(let e=1;e=0;t--){const i=e[t],s=this._barsets[t],o=s.count();for(let e=0;ee.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof kv.StudyError))throw e;this.host.onErrorCallback(e.message,e.title)}}}class nS{constructor(e){this.runner=new oS(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}class rS{constructor(e,t,i,s,o,n,r,a,l,c,h){this.listeners=t,this._isRecalculated=!1,this._symbolInfo=a,this.engine=new nS({datafeed:e,tickerid:i,currencyCode:s,unitId:o,subsessionId:h,period:n,body:r,sessionId:c,symbolInfo:a,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,input:()=>{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new Gv(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){const i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const s={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},o=t[7];this._barset||(this._barset=new Gv((0,n.ensureDefined)(e.info,"bar builder item output symbol info")));const r=t[8],a=t[9];if(r instanceof Array&&a)for(let e=0;e{o&&e.regular_session&&(e.session=e.regular_session),this._subs=this._host.subscribe(e,s,a,(e=>{this.listeners.fire(e)}),(e=>{this.listeners.onError(e)}))}),(e=>{this.listeners.onError(e)}))}stop(){this._subs&&this._host.unsubscribe(this._subs)}}var hS=i(99955);class dS{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,Td.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,Td.newBarBuilder)(this._period,e.symbol.session,null):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(0,n.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,s=t.alignTime(i),o=e.new_var(s),r=Py.Std.na(s),a=o.get(1),l=Py.Std.na(a)?1:Py.Std.neq(s,a),c=e.new_var(),h=e.new_var(),d=e.new_var(),u=e.new_var(),_=c.get(1),p=h.get(1),m=d.get(1),g=u.get(1),f=r?NaN:l?Py.Std.open(e):_,y=r?NaN:l?Py.Std.high(e):Py.Std.max(Py.Std.high(e),p),v=r?NaN:l?Py.Std.low(e):Py.Std.min(Py.Std.low(e),m),S=r?NaN:Py.Std.close(e),b=r?NaN:l?Py.Std.volume(e):Py.Std.volume(e)+g,w=r?NaN:i,C=e.symbol.isBarClosed&&t.isLastBar(0,i),T=this._generateEmptyBars&&l?this._extrapolate(a,s):void 0,P=e.new_var(Py.Std.close(e)).get(1),x=T instanceof Array?P:NaN;return c.set(f),h.set(y),d.set(v),u.set(b),[s,f,y,v,S,b,w,C,T,x]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(0,hS.extrapolateBarsFrontToTime)((0,n.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}const uS=e=>{console.error(e),Py.Std.error(e)},_S=Re.Interval.parse("1M").inMilliseconds(0);class pS{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,o,n,r,a,l,c,h){const d=l(r),u=((e,t,i,s,o,n,r,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(o.has_empty_bars?"_":"")+"_"+r.countBack+"_"+r.to+"_"+Boolean(a))(e,t,i,s,r,a,d,c,h);let _=this._getCache(u);return _||(_=this._createItem(e,t,i,s,r,d,a,c,h),this._putCache(u,_)),_.listeners.addListener(o,n),{key:u,listener:o}}unsubscribe(e){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,n.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t{const s=mS(e,t,i),o=t(s);return void 0!==o?o:s}))}(e,t,i):(0,tt.isObject)(e)&&((0,tt.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((o=>{const n=mS(e[o],t,i),r=t(n);s[o]=void 0!==r?r:n})),s}(e,t,i):e}function gS(e,t,i){const s=mS(e,t,i),o=t(s);return void 0!==o?o:s}var fS,yS=i(92211);function vS(e,t){return e.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit",e[e.ExtendedExtrapolateLimit=45e4]="ExtendedExtrapolateLimit"}(fS||(fS={}));class SS{constructor(e,t,i){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=Re.Interval.parse(t),this._extrapolateLimit=i??(l.enabled("extended_extrapolation_limit")?45e4:2e5),this._session=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),this._barBuilder=(0,Td.newBarBuilder)(t,this._session,null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}
-futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],s=this._barsTimes[this._barsTimes.length-1],o=i>s?this._barsTimes.length:(0,Pt.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,n.assert)(-1!==this._projectionFirstIndex,"something went wrong"),s!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this.ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this.timeOfBarIndex(i.index+t,0);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&ðis._lastRealBarTimeMs){this.ensureExtrapolatedToFutureTime(e);let t=(0,Pt.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,n.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs){const e=this.timeOfBarIndex(0,0);return null===e?null:{index:0,timeMs:e.timeMs}}return null}let t=(0,Pt.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){
-this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||vS(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t;return this._calculateBarPattern(s,e,null)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:ethis._extrapolateLimit)break;c++}return r}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length)||[];return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){
-const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,n.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,e,this._futureBarsCache[0]-1,this._extrapolateLimit,!0).times;this._futureBarsCache=t.concat(this._futureBarsCache)}_extendHistoryCacheToTimeFromRight(e){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs>=e)return;if((0,n.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||vS(this._futureBarsCache,this._extrapolateLimit))&&(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t,o=e-i;return this._calculateBarPattern(s,null,o)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times)))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||vS(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||vS(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}function bS(e){return 60*e*60*1e3}function wS(e){return 60*e*1e3}const CS=[{divisor:1,weight:18},{divisor:(TS=1,1e3*TS),weight:19},{divisor:wS(1),weight:20},{divisor:wS(5),weight:21},{divisor:wS(30),weight:22},{divisor:bS(1),weight:30},{divisor:bS(3),weight:31},{divisor:bS(6),weight:32},{divisor:bS(12),weight:33}];var TS,PS;function xS(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime()
-;for(let e=CS.length-1;e>=0;--e)if(Math.floor(i/CS[e].divisor)!==Math.floor(s/CS[e].divisor))return CS[e].weight}return 18}function MS(e,t,i=0){if(0===e.length)return[];let s=i,o=i;const n=[];for(;s=t.length?(n.push({old:s,new:Fh.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[o].timeMs?(s!==o&&n.push({old:s,new:o}),s++,o++):e[s].timeMs{if(e.new===t.new&&e.new===Fh.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===Fh.INVALID_TIME_POINT_INDEX)return-1;if(t.new===Fh.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function IS(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}!function(e){e[e.FutureTickMarksLimit=1e3]="FutureTickMarksLimit"}(PS||(PS={}));class AS{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[],this._needRebuildEndOfPeriod=l.enabled("end_of_period_timescale_marks"),this._shouldAlignDwmBarsToMainSeries=l.enabled("align_dwm_bars_to_main_series")}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,Pt.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const s=[];for(let t=e;tIS(e,i+t)));return s.concat(o)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,Ce.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,Pt.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;s=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return Fh.INVALID_TIME_POINT_INDEX;s=t.timeMs!==e?t.index+1:t.index}return(!t||o>0&&e<=r[o-1])&&(0,n.assert)(s>i,"data must have unique sorted times"),i=s,s}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceStudyBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}replaceBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t,i){return this._setBarsTimes(e,t,i)}_setBarsTimes(e,t,i){const s=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),s&&this._cleanupPointsData(this._sortedTimePoints);const o=[];this._pointDataByTimePoint.forEach(((e,t)=>{o.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),o.sort(((e,t)=>e.timeMs-t.timeMs));const n=this._updateTimeScalePoints(o);return this._applyTimeScaleChanges(n,i||!1)}_replaceInstanceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this._setBarsTimes(e,t);const i=[],s=(0,Pt.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const r=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const o={index:0,instances:t};this._pointDataByTimePoint.set(i,o),null!==s&&s.push({timeMs:i,pointData:o})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,Pt.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==o.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=LS(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const o=MS(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===Fh.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let o=0;for(;t+o1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=xS(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0),clearTickMarks:!0}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0};const s=[];for(let t=e.pointsIndex;t[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["backgrounds",e=>[e.start,e.stop]]]),ES=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);class DS{main(e){return[Py.Std.open(e),Py.Std.high(e),Py.Std.low(e),Py.Std.close(e),Py.Std.volume(e),Py.Std.updatetime(e),void 0,void 0,void 0,void 0]}}const BS=(0,ne.getLogger)("ChartApi.PointsetsManager");class VS{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}
-createPointset(e,t,i,s,o){let n=this._pointsetsDataBySymbol.get(t);void 0===n&&(n=new Map,this._pointsetsDataBySymbol.set(t,n));const r=[];for(const t of s){const[s,n,a]=t;if("number"!=typeof s||Number.isNaN(s)){BS.logWarn(`Pointset time is invalid: id=${e}, ${s} of type ${typeof s}`);continue}const l=o(a||i);r.push({point:t,extrapolation:l.extrapolateTimeWithOffsetToTime(1e3*s,n)})}s.length===r.length&&n.set(e,{resolution:i,points:r})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(Re.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const o=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const r=this._refreshPointsetData(e,t,i,s);null!==r&&o.set(n,r)})),o}_refreshPointsetData(e,t,i,s){if(Re.Interval.isEqual(e.resolution,t))for(let s=0;s ${t}`),null;o.push({index:i,value:[r.index,r.timeMs/1e3]})}return o}}const RS=-5e6,NS="pre_post_market_sessions",OS=l.enabled(NS),FS=l.enabled("pay_attention_to_ticker_not_symbol");class WS{constructor(e,t,i,s){this._chartApiMessagerProvider=t,this._marketStatusWatcherProvider=i,this._studyLibrary=s,this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._barsCoefficientsCache={},this._externalDatafeed=e,(0,gc.default)(e.getVolumeProfileResolutionForPeriod)&&(0,Uv.overwriteVolumeProfileResolutionForPeriodGetter)(((t,i,s,o)=>(0,n.ensure)(e.getVolumeProfileResolutionForPeriod)(t,i,s,o))),this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,this._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),this._datafeedConfiguration=function(e){const t=(0,tt.merge)({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;const s=[];for(let e=0;e{this._serverTimeOffset=e-(new Date).valueOf()/1e3})),
-this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo={},this._depthInfo={},this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new Yv(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout);const o=(e,t,i)=>{const s=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),o=(0,Td.newBarBuilder)(t,s,s);return e=>{if(e&&e.count()){const t=1e3*this.getCurrentUTCTime();o.moveTo(t),o.indexOfBar(t)>=0&&e.setLastBarClosed(!1)}i(e)}};this._pineDatafeed=new pS({resolve:(e,t,i,s)=>{this._resolveSymbolByName(e,t,(e=>i(JS(e))),s)},subscribe:(e,t,i,s,n)=>this._cachedDatafeed.subscribe(e,t,i,o(e,t,s),(e=>n(e??"Unknown datafeed error"))),unsubscribe:e=>this._cachedDatafeed.unsubscribe(e)})}destroy(){for(const e of Object.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(const e of Object.keys(this._pointsetsManagers))this._pointsetsManagers[e].destroy();this._quotesInfo={},this._pointsetsManagers={}}purgeCache(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((e=>{this._pointsetsManagers[e].destroy()})),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((e=>{this._timeScales[e].destroy()})),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((e=>{this._symbolExtrapolators[e].destroy()})),this._symbolExtrapolators={}}purgeDataCache(){this._cachedDatafeed.purgeCache()}resetCache(){this._cachedDatafeed.resetCache()}serverTimeOffset(){return this._serverTimeOffset}getCurrentUTCTime(){return(new Date).valueOf()/1e3+this._serverTimeOffset}serverTime(){return 1e3*this.getCurrentUTCTime()}switchTimezone(e,t){this._timeScales[e].setTimezone(t);const i=this._timeScales[e].tickMarks();null!==i&&this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(0,i)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}supportedResolutions(){return this._datafeedConfiguration.supported_resolutions}supportedCurrencies(){return this._datafeedConfiguration.currency_codes||[]}supportedUnits(){return this._datafeedConfiguration.units||{}}supportedPriceSources(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(JS(e).price_sources)}),(e=>{i(e)}))}))}supportedSymbolsTypes(){return this._datafeedConfiguration.symbols_types||[]}symbolsGrouping(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}}getMarks(e,t,i,s,o){const r={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,
-n.ensure)(e.full_name),o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),this._externalDatafeed.getMarks(JS(e),t,i,(t=>{const i=t.map((e=>(e.time=Number(e.time),e)));this._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(i)));const a=(0,Jd.createDwmAligner)(o,e),c=l.enabled("two_character_bar_marks_labels"),h=i.map((e=>{const t=e;return t.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,t.direction=(0,et.default)(e.color)?r[e.color]:r.red,t.onClicked=()=>{ee.emit("onMarkClick",e.id)},t.label=e.label?c?e.label.slice(0,2):e.label[0]:"",t}));s(h)}),o))}getTimescaleMarks(e,t,i,s,o){this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks&&(this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,n.ensure)(e.full_name),o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),this._externalDatafeed.getTimescaleMarks(JS(e),t,i,(t=>{this._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(t)));const i=(0,Jd.createDwmAligner)(o,e),r=t.map((e=>{const t=e;return t.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,t}));s(r)}),o))}getSeriesLastBarTime(e,t){const i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs}getSeriesInterval(e,t){const i=this._studiesCache[e][t];return i?i.resolution:null}onSessionSeriesError(e){this.stopSources(e);const t=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}stopSources(e){for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}}getSeriesSymbolInfo(e,t){const i=this._studiesCache[e][t];return i?i.symbolInfo:null}modifySeries(e,t,i,s,o,r){const a=this._mainSeriesRecord(e);if(null===a||a.guid!==t){if(null!==a&&a.error)return this._studiesCache[e][t].symbolId=i,this._studiesCache[e][t].resolution=s,void(this._studiesCache[e][t].turnaround=o);this._stopSourcesTree(e,t),this.createSeries(e,t,o,i,s,{countBack:0},!0);for(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];if(s&&"study"===s.type&&s.parentId===t){this._studiesNonSeriesTimes[e][i]=null;const t=this._studiesCache[e][s.parentId];this._createStudy(t.symbolId,t.resolution,s.studyObject,e,i,s.turnaround,s.parentId,(0,n.ensure)(s.inputs))}}}else this._modifyMainSeries(e,i,s,o,r)}createStudy(e,t,i,s,o,n){const r=this._studiesCache[e][i],a=this._studyLibrary.findStudyObject(o);if(null===a)return $S("Study does not exist: "+o),void this._chartApiMessagerProvider.getChartApiMessager(e).onStudyError(t,s,"unknown study name");const l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i},this._studiesNonSeriesTimes[e][t]=null,
-this._createStudy(r.symbolId,r.resolution,l,e,t,s,i,n)}modifyStudy(e,t,i,s){const o=this._studiesCache[e][t];if(!o)throw Error("This should never happen");const n=this._studiesCache[e][o.parentId];o.inputs=s,o.turnaround=i,o.engine&&(o.engine.stop(),this._pineDatafeed.removeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(n.symbolId,n.resolution,o.studyObject,e,t,i,o.parentId,s)}sessionTimeScale(e){return this._timeScales[e]||null}isTimeScaleExtendedTo(e,t){const i=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(i.resolution)&&null!=i.symbolInfo){const e=(0,Jd.createDwmAligner)(i.resolution,i.symbolInfo);null!==e&&(t=e.timeToSessionStart(t))}const s=this._timeScales[e].indexOfTime(t);return null!==s&&s.index>=0}ensureExtendedTo(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");setTimeout((()=>{this._recreateSourcesForDataRange(t,{to:i})}),0)}extendSeriesRange(e,t){let i=this._timeScales[e].firstSeriesBarTime();if(null===i)return void this._logMessage("Nothing to extend - there is no points on time scale");const s=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(s.resolution)&&null!=s.symbolInfo){const e=(0,Jd.createDwmAligner)(s.resolution,s.symbolInfo);null!==e&&(i=e.timeToExchangeTradingDay(i))}const o=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s.symbolId))),r=this._barsCoefficients(o,s.resolution),a=r.barsCoefficient||1;if(!r.barsCoefficient){const i=this._getSeriesData(e,s.guid);null!==i&&(r.expectedBarsCount=i.length+t)}setTimeout((()=>{this._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}seriesTurnaround(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround}createSeries(e,t,i,s,o,r,a){this._setEndOfData(e,t,i,!1);const c=new DS;this._studiesCache[e]=this._studiesCache[e]||{};const h=this._getSeriesData(e,t),d=this._studiesCache[e][t],u=this._seriesCount(e),_=this._mainSeriesRecord(e),p=function(e){let{dataRange:t}=e;const{oldStudyRecord:i,resolution:s,symbolId:o,seriesCount:r,oldData:a,mainSeriesRecord:l,timeScales:c,session:h}=e;if(!i||Re.Interval.isEqual(i.resolution,s)&&i.symbolId===o)void 0!==t.countBack&&null!==a&&0!==a.length&&(t.to=a[0].timeMs),i&&null!=i.firstLoadedTimeMs?t.to=void 0!==t.to?Math.min(i.firstLoadedTimeMs,t.to):i.firstLoadedTimeMs:i||0===r||null!==l&&(null!=l.firstLoadedTimeMs?(t.to=l.firstLoadedTimeMs,t.countBack=0):t=Object.assign({},l.dataRange));else if(1===r)t=Object.assign({},i.initialDatarange);else{const e=c[h].firstSeriesBarTime();(void 0===t.to||null!==e&&e{const a=[];if(void 0!==r){const e=(r.data||[]).reduce(((e,t)=>Math.max(e,t[0]||0)),-1);if(null!=r.projectionTime)for(let t=0;t<=e;++t)a.push(r.projectionTime+t)}let l=null,c=null;const h=s?this._getSymbolExtrapolator(e,s,o):null;if(void 0!==n){const i=n.map((e=>e.timeMs)).concat(a);null!==h&&h.replaceBarsTimesTail(i,n.length),c=this._timeScales[e].replaceBarsTimesTail(t,i),l=n}else{const i=this._getSeriesData(e,t)||[],s=i.map((e=>e.timeMs)).concat(a);null!==h&&h.setBarsTimes(s,i.length),c=this._timeScales[e].setSeriesBarsTimes(t,s),l=i}if(this._applyTimeScaleUpdate(e,c),0===l.length&&void 0===r)return;this._timeScales[e].fillIndexesInRows(l);const d=void 0!==r?this._prepareSeriesNonSeriesData(e,t,r):null;this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,l,d)},g=s=>{const o=this._studiesCache[e][t];o.completed=!0,this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesError(t,i,s),l.enabled("clear_bars_on_series_error")&&(o.isMain?this.onSessionSeriesError(e):this._clearSeriesData(e,t))};this._computeStudy(e,c,s,o,t,[],p,jS(e,t),(function(){return-1/0}),{onDataReadyCallback:(r,l,c,h)=>{const d=this._studiesCache[e][t];if(!d)throw Error("This should never happen");if(d.symbolInfo=c,d.firstLoadedTimeMs=h.firstLoadedTimeMs,d.completed=!0,this._updateMainTsBuilder(e),a&&this._pointsetsManagers[e].invalidatePointsetsForSymbol(c.full_name,o),0!==r.length){const i=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s))),a=this._barsCoefficients(i,o);a.expectedBarsCount&&a.barsCount&&(a.barsCoefficient=Math.min(Math.max(a.barsCoefficient||1,Math.floor(a.expectedBarsCount/(r.length-a.barsCount)+.5)),100)),a.barsCount=r.length,this._clearSeriesData(e,t)}else!h.endOfData&&d.isMain&&setTimeout((()=>{this._studiesCache[e]&&this._recreateSourcesForDataRange(e,{countBack:10})}),0);m(c),h.endOfData&&(this._logMessage("Series has no more data on server: {0}".format(c.full_name)),this._setEndOfData(e,t,i)),0===r.length&&this._clearSeriesData(e,t),this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i,c.data_status),this._updateTimeScaleState(e)},onRealtimeCallback:(s,n,r,a,l)=>{m(l,s),this._timeScales[e].fillIndexesInRows(s);const c=s[s.length-1];if(n){if(!this._studiesCache[e][t])throw Error("This should never happen");this._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c)))}else this._logMessage("Last bar update: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c))),this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,s,null);this._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:e=>{this._logMessage("Series symbol resolve error: "+e),g(e||"resolve error")},onErrorCallback:e=>{this._logMessage("Series error: "+e),g(e)},
-onNonSeriesDataUpdate:(s,o)=>{if("projection"!==s.type)throw new Error("unexpected non-series data type for series "+s.type);const r=this._getSeriesData(e,t);if(null!==r)m((0,n.ensure)(o.info),0===r.length?void 0:[r[r.length-1]],s);else{const o=this._prepareSeriesNonSeriesData(e,t,s);this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,[],o)}}})}removeStudy(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),this._pineDatafeed.removeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setStudyBarsTimes(t,[],!0);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]}removeSeries(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}requestMoreTickmarks(e,t){const i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);const s=i.firstFutureBarIndex(),o=i.tickMarks(s);this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(s,o)}chartCreateSession(e){this._pointsetsManagers[e]=new VS,this._timeScales[e]=new AS,this._studiesNonSeriesTimes[e]={}}chartDeleteSession(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]}removePointset(e,t){this._pointsetsManagers[e].removePointset(t)}async createPointset(e,t,i,s,o){const n=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===n)return;let r;try{r=(await n).symbolInfo}catch(e){return}this._pointsetsManagers[e].createPointset(t,r.full_name,s,o,((t=s)=>this._getSymbolExtrapolator(e,r,t))),null===this._refreshPointsetsTimerId&&(this._refreshPointsetsTimerId=window.setTimeout((()=>{this._refreshPointsetsTimerId=null,this._refreshPointsets(this._invalidatedPointsetSessions),this._invalidatedPointsetSessions.clear()}),0)),this._invalidatedPointsetSessions.add(e)}searchSymbols(e,t,i,s,o){this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));this._externalDatafeed.searchSymbols(e,t,i,(e=>{this._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),e.forEach((e=>{XS(e.logo_urls,e.exchange_logo,e)})),s(e)}),o)}resolveSymbol(e,t,i){this._symbolIdToSymbolRequestString.set(US(e,t),i),this._resolvePromisesBySymbolId.set(US(e,t),new Promise(((s,o)=>{this._resolveSymbolImpl(i,(o=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolResolved(t,o),s({symbolInfo:o,requestedSymbol:i})}),(i=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolError(t,i),o(i)}))})))}quoteCreateSession(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}}quoteDeleteSession(e){this._stopQuotesSubscription(e),
-delete this._quotesInfo[e]}quoteSetFields(e,t){}quoteAddSymbols(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)}quoteRemoveSymbols(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((e=>t.indexOf(e)<0)),this._restartQuotesSubscription(e)}quoteFastSymbols(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)}quoteHibernateAll(e){}depthCreateSession(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}}depthDeleteSession(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]}depthSetSymbol(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)}hasStudyWithExtendedTimeScale(e){for(const t of this._getStudiesCacheSessionKeys(e)){if("study"===this._studiesCache[e][t].type&&this._studyCanExtendTimeScale(e,t))return!0}return!1}_stopDepthSubscription(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth?.(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)}_restartDepthSubscription(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)}_startDepthSubscription(e){const t=this._depthInfo[e].symbol;if(!t)return;const i=e=>e.map((e=>({p:e.price,v:e.volume}))),s=e=>({s:t,bids:i(e.bids),asks:i(e.asks)}),o=t=>{t.snapshot?this._chartApiMessagerProvider.getChartApiMessager(e).onDepthData([e,s(t)]):this._chartApiMessagerProvider.getChartApiMessager(e).onDepthUpdate([e,s(t)])};this._externalDatafeed.subscribeDepth&&(this._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(t,(t=>{this._depthInfo[e]&&o(t)})))}_restartQuotesSubscription(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)}async _startQuotesSubscription(e){const t={},i={},s=(t,i)=>{const s="ok"===t.s,o=this._marketStatusWatchers[e][t.n],n={...t,symbolname:t.n,status:t.s,values:{...t.v,change:s?t.v.ch:void 0,last_price:s?t.v.lp:void 0,change_percent:s?t.v.chp:void 0,current_session:s?t.v.cs:o&&o.marketStatus(),pricescale:i.pricescale,minmov:i.minmov,minmove2:i.minmove2||0,fractional:i.fractional||!1}};XS(i.logo_urls,i.exchange_logo,n.values),(o&&s?t.v.cs:void 0)&&o.stop(),this._chartApiMessagerProvider.getChartApiMessager(e).onQuotesData([e,n])},o=n=>{n.forEach((r=>{const a=r.n;if(i[a]?.size>0){const t=[...i[a]].map((e=>({...r,n:e})));if(l.enabled("charting_library_debug_mode")){const t=void 0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for symbol ${a} ${t}: ${JSON.stringify(n)}`)}setTimeout((()=>o(t)),0)}if(void 0!==t[r.n]&&null!==t[r.n])s(r,t[r.n]);else if(l.enabled("charting_library_debug_mode")){const t=void 0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for unexpected symbol ${a} ${t}: ${JSON.stringify(n)}`)}}))},r=async e=>{try{const[s,o]=KS(e),r=await new Promise(((e,t)=>{this._resolveSymbolByName(s,o,e,t)})),a=(0,n.ensure)(r.ticker)
-;return t[a]=t[e]=JS(r),a===e?a:(void 0===i[a]&&(i[a]=new Set),a!==e&&i[a].add(e),a)}catch{return null}},a=async e=>[...new Set((await Promise.all([...new Set(e)].map(r))).filter((e=>null!==e)))];if(this._externalDatafeed.getQuotes&&!l.enabled("charting_library")){const[t,i]=await Promise.all([a(this._quotesInfo[e].symbols),a(this._quotesInfo[e].fastSymbols)]),s={};if(l.enabled("charting_library_debug_mode")){const e=WS.debugGetQuotesRequestId++;this._logMessage(`QUOTES Requesting data for symbols ${JSON.stringify(t)} with request ID ${e}`);for(const i of t){const t=1e4;s[i]=window.setTimeout((()=>{this._logMessage(`QUOTES Timeout after waiting ${t/1e3} seconds for data symbol ${i} with request ID ${e}`)}),t)}}this._externalDatafeed.getQuotes(t,(n=>{if(l.enabled("charting_library_debug_mode"))for(const e of n)void 0!==s[e.n]&&clearTimeout(s[e.n]),delete s[e.n];this._quotesInfo[e]&&0!==this._quotesInfo[e].symbols.length&&(o(n),this._quotesInfo[e].listenerGUID=e,l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Subscribing listenerGUID ${this._quotesInfo[e].listenerGUID} to data for symbols ${JSON.stringify(t)} and fast symbols ${JSON.stringify(i)}`),this._externalDatafeed.subscribeQuotes(t,i,o,this._quotesInfo[e].listenerGUID))}),(e=>{this._logMessage(`QUOTES Error getting data for symbols ${JSON.stringify(t)}: ${e}`)}))}else!this._externalDatafeed.getQuotes&&l.enabled("trading_terminal")&&setTimeout((()=>{o(this._quotesInfo[e].symbols.map((e=>({n:e,s:"ok",v:{}}))))}));this._createMarketStatusWatchers(e,this._quotesInfo[e].symbols)}_createMarketStatusWatchers(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;ithis._resolveSymbolByName(t,i,r,(o=>{$S(`Error resolving for market status watcher ${qS(t,i.currency,i.unit,i.session)}:\n${o}`),this.quoteRemoveSymbols(e,[s]),a(o)}))),e,s,this._chartApiMessagerProvider)}}}_filteredSymbols(e){const t=[];return e.forEach((e=>{e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t}_refreshPointsets(e){e.forEach((e=>{const t=this._studiesCache[e];if(null==t)return;let i=null;for(const e of Object.keys(t)){const s=t[e];if("series"===s.type){i=s;break}}if(null===i||null==i.symbolInfo)return;const s=i.symbolInfo;this._pointsetsManagers[e].getUpdatesForSymbol(i.symbolInfo.full_name,i.resolution,((t=i.resolution)=>this._getSymbolExtrapolator(e,s,t)),this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}))}_recreateSourcesForDataRange(e,t){const i=[];for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];if(o&&"series"===o.type&&!this._isEndOfData(e,s,o.turnaround)&&(this._stopSourcesTree(e,s),i.push(s)),o&&"study"===o.type&&this._studyCanExtendTimeScale(e,s)&&!this._isEndOfData(e,s,o.turnaround)){const i=this._studiesCache[e][(0,
-n.ensure)(o.parentId)];o.dataRange=t,this._createStudy(i.symbolId,i.resolution,o.studyObject,e,s,o.turnaround,(0,n.ensure)(o.parentId),(0,n.ensure)(o.inputs))}}i.forEach((i=>{this._startSourcesTree(e,i,Object.assign({},t))}));for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];"series"===i.type&&this._isEndOfData(e,t,i.turnaround)&&this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i.turnaround,(0,n.ensure)(i.engine).runner.host.symbolInfo.data_status)}this._updateTimeScaleState(e)}_startSourcesTree(e,t,i){const s=this._studiesCache[e][t];this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0);for(const i of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][i];o&&"study"===o.type&&o.parentId===t&&this._createStudy(s.symbolId,s.resolution,o.studyObject,e,i,o.turnaround,o.parentId,(0,n.ensure)(o.inputs))}}_clearSeriesData(e,t){const i={};i[t]={turnaround:this._studiesCache[e][t].turnaround};for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];"study"===o.type&&this._studyCanExtendTimeScale(e,s)||("study"!==o.type||o.parentId!==t||this._studyCanExtendTimeScale(e,s)||(i[s]={turnaround:o.turnaround}))}this._chartApiMessagerProvider.getChartApiMessager(e).onClearData(i)}_prepareSeriesNonSeriesData(e,t,i){const s=i.data[i.data.length-1],o=this._getSeriesData(e,t),r=null===o?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:r.map(((e,t)=>({time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]})))}},indexes:this._timeScales[e].convertTimesToIndexes(r.map((e=>{const t=e[0]||0;return t<0?(0,n.ensure)(o)[(0,n.ensure)(o).length+t].timeMs:i.projectionTime+t})))}}_seriesCount(e){let t=0;for(const i of this._getStudiesCacheSessionKeys(e)){"series"===this._studiesCache[e][i].type&&(t+=1)}return t}_modifyMainSeries(e,t,i,s,o){this.stopSources(e);const r=this._mainSeriesRecord(e);let a=!1;for(const n of this._getStudiesCacheSessionKeys(e)){const c=this._studiesCache[e][n];if(c&&"series"===c.type)if((0,Wv.default)(r)||c.guid!==r.guid)this.createSeries(e,c.guid,c.turnaround,c.symbolId,i,{countBack:0},!0);else{a=r.symbolId!==t||r.resolution!==i;const n=ZS(o),c={countBack:n||0};l.enabled("request_only_visible_range_on_reset")&&n&&(delete this._objectsDataCache[jS(e,r.guid)],delete this._studiesCache[e][r.guid]),this.createSeries(e,r.guid,s,t,i,c,!0)}}for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];if(i&&"study"===i.type){this._studiesNonSeriesTimes[e][t]=null;const s=this._studiesCache[e][(0,n.ensure)(i.parentId)];this._createStudy(s.symbolId,s.resolution,i.studyObject,e,t,i.turnaround,i.parentId,(0,n.ensure)(i.inputs))}}a&&this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}_mainSeriesRecord(e){let t=null,i=null;for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];if("series"===o.type&&(null===t&&(t=o),o.isMain)){i=o;break}}return null===i&&(i=t),
-null!==i&&(i.isMain=!0),i}_stopSourcesTree(e,t){for(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}this._pineDatafeed.removeUnused()}_getSeriesData(e,t){return this._objectsDataCache[jS(e,t)]||null}_resolveSymbolImpl(e,t,i){var s;(0,Pv.isEncodedExtendedSymbol)(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(new Date).toISOString()} ${s}`));const[o,n]=KS(e);this._resolveSymbolByName(o,n,t,i)}_getSymbolExtrapolator(e,t,i){const s=(0,n.ensure)(Re.Interval.normalize(i)),o=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s);let r=this._symbolExtrapolators[o];return void 0===r&&(r=new SS(t,s),this._symbolExtrapolators[o]=r),r}_barsCoefficients(e,t){const i=(0,Pv.decodeExtendedSymbol)(e);if(!("type"in i)||void 0===i.type)return{};const s=e+t;return this._barsCoefficientsCache[s]||(this._barsCoefficientsCache[s]={}),this._barsCoefficientsCache[s]}_studyCanExtendTimeScale(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==i&&(l.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||l.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id||l.enabled("inactivity_gaps")&&"InactivityGaps@tv-basicstudies-1"===i.id)}_stopQuotesSubscription(e){this._quotesInfo[e].listenerGUID&&(l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Unsubscribe listenerGUID=${this._quotesInfo[e].listenerGUID}`),this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)}_removeMarketStatusWatchers(e){Object.keys(this._marketStatusWatchers[e]||{}).forEach((t=>{this._marketStatusWatchers[e][t].stop()})),this._marketStatusWatchers[e]={}}_logMessage(e){l.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} ${e}`)}_resolveSymbolByName(e,t,i,s){let o;const n=t&&t.currency,r=t&&t.unit,a=t&&t.session,l=GS(e,n,r,a);(0,Wv.default)(this._resolveRequests[l])?(o=this._resolveSymbolInternal(e,n||void 0,r||void 0,a||void 0),this._resolveRequests[l]=o,o.then((t=>{this._resolveRequests[GS(e,t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),n,r,a)]=o})).catch((()=>{}))):o=this._resolveRequests[l],o.then(i).catch(s)}_resolveSymbolInternal(e,t,i,s){return new Promise(((o,n)=>{const r=qS(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(r));let a=!0;this._externalDatafeed.resolveSymbol(e,(e=>{a&&$S("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),this._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(r,JSON.stringify(e)))
-;const t=function(e,t){if(e.ticker||(e.ticker=e.symbol||e.name),e.full_name=t.shouldUseTickerNotSymbol?e.ticker:`${e.exchange}:${e.name}`,e.pro_name=e.full_name,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions){const t=[];for(const i of e.supported_resolutions){const e=Re.Interval.parse(i);e.isValid()&&!e.isRange()&&t.push(e.value())}e.supported_resolutions=t}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,delete e.has_ticks,!0===t.shouldUseSubsessions&&Array.isArray(e.subsessions))for(let t=0;t!Re.Interval.isValid(e))).forEach((e=>{
-i("supported_resolutions field contains invalid value: "+e)})),OS||(void 0!==e.subsessions&&i(`Symbol info contains subsessions but the ${NS} feature is not enabled, so the subsessions will be ignored`),void 0!==e.subsession_id&&i(`Symbol info contains a subsession ID but the ${NS} feature is not enabled, so the subsession ID will be ignored`));!0===e.build_seconds_from_ticks&&i("build_seconds_from_ticks is true but building seconds from ticks is only available in Trading Platform.")}(t),this._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(r,JSON.stringify(t))),o(t)}),(e=>{this._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(r,e)),n(e)}),{currencyCode:t,unitId:i,session:s}),a=!1}))}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){const s=this._callbacks[e];for(let e=0;e{const _=Re.Interval.parse(s);if((0,Hv.default)(i.supported_resolutions)&&i.supported_resolutions.length>0&&(0,lS.findSuitableResolutionToBuildFrom)(s,i).error)h.onSymbolErrorCallback(`unsupported resolution: ${i.ticker}, ${s}`);else{if(Re.Interval.isDWM(s)&&void 0!==r.to){const e=(0,Jd.createDwmAligner)(s,i);null!==e&&(r.to=e.timeToExchangeTradingDay(r.to))}if(r.from&&r.to){const e=(0,Td.getPeriodsBetweenDates)(i.session,i.session_holidays,i.corrections,_.letter(),_.multiplier(),r.from,r.to);r.countBack=Math.max(e,r.countBack)}try{const _=new nS({datafeed:this._pineDatafeed,unitId:i.unit_id,currencyCode:i.currency_code,tickerid:c,symbolInfo:JS(i),period:s,body:t,sessionId:e,onErrorCallback:h.onErrorCallback,dataRange:r,subsessionId:i.subsession_id,forceAlignBars:!l.enabled("disable_sameinterval_aligning")&&(0,Jd.isAlignmentEnabled)(),enableDwmAligning:l.enabled("align_dwm_bars_to_main_series")||!this._studyCanExtendTimeScale(e,o),input:e=>n[e],out:(e,t)=>{!function(e,t,i){const s=e.time,o="number"==typeof t?[t]:t;for(let e=0;eu[n].timeMs;r?u.push({index:p(s,u.length),value:[s/1e3].concat(o),timeMs:s}):(u[n].index=p(s,n),u[n].value=[s/1e3].concat(o),u[n].timeMs=s),d||h.onRealtimeCallback([u[u.length-1]],r,u.length,m,i)}(e,t,i)},nonseriesOut:(e,t)=>{h.onNonSeriesDataUpdate(t,e)},setNoMoreData:()=>{g=!0},recalc:(e,s)=>{d=!1,u.endOfData=g,u.emptyBarCount=s.emptyBarCount,(!("error"in t)||(0,Wv.default)(t.error)||(0,gc.default)(t.error)&&null===t.error())&&(null!==a&&(this._objectsDataCache[a]=u),h.onDataReadyCallback(u,m,i,s))}});if(!this._studiesCache[e]||!this._studiesCache[e][o])throw Error("This should never happen");this._studiesCache[e][o].engine=_}catch(e){if(!((0,
-zv.default)(e)&&"studyError"in e&&e.studyError))throw e;h.onErrorCallback(zS(e,"unknown study error"))}}},y=()=>this._studiesCache[e]&&this._studiesCache[e][o]&&this._studiesCache[e][o].activeResolve===_;this._studiesCache[e][o].activeResolve=_;const v=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===v)throw new Error("This should never happen");let S,b;try{const e=await v;S=e.symbolInfo,b=e.requestedSymbol}catch(e){return void(y()&&h.onSymbolErrorCallback(zS(e,"unknown symbol error")))}y()&&f(S,b)}_getDataRangeForStudy(e,t){const i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)},o=this._studiesCache[e][i.parentId];return this._studyCanExtendTimeScale(e,t)&&o?.completed?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s}_seriesDataRange(e,t){const i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange}_createStudy(e,t,i,s,o,r,a,l){this._studiesCache[s][o].completed=!1;const c=(e=>{if(Array.isArray(e))return e;const t=[],i=this._studiesCache[s][o].metainfo.inputs;if((0,Hv.default)(i))for(let s=0;s{const n=this._studiesCache[s][o];if(n.completed=!0,e.length>0&&(n.firstLoadedTimeMs=e[0].timeMs),e=YS(e),this._setEndOfData(s,o,r,!this._studyCanExtendTimeScale(s,o)||e.endOfData),this._studyCanExtendTimeScale(s,o)){const t=e.map((e=>e.timeMs)),i=this._timeScales[s].setStudyBarsTimes(o,t);this._applyTimeScaleUpdate(s,i)}this._timeScales[s].fillIndexesInRows(e),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,e,t),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyCompleted(o,r),this._updateTimeScaleState(s)},d=e=>{if(0===e.size)return{};const t={},i=this._studiesCache[s][o].metainfo;return e.forEach(((e,s)=>{t[(0,n.ensure)(i.plots)[s].id]=e})),{data:{offsets:t},indexes:[]}};let u=null,_=!1;this._computeStudy(s,i,e,t,o,c,this._getDataRangeForStudy(s,o),null,(()=>{if(this._studyCanExtendTimeScale(s,o))return-1/0;if(null===u){const e=this._getSeriesData(s,a)?.[0];if(void 0===e)return 1/0;u=e.timeMs}return u}),{onDataReadyCallback:(e,t,i)=>{_&&0===e.length||h(e,d(t))},onRealtimeCallback:(e,t,i,n,a)=>{const l=YS(e);if(this._studyCanExtendTimeScale(s,o)){const e=l.map((e=>e.timeMs)),t=this._timeScales[s].replaceStudyBarsTimesTail(o,e);this._applyTimeScaleUpdate(s,t)}this._timeScales[s].fillIndexesInRows(l),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,l,d(n)),this._updateTimeScaleState(s)},onSymbolErrorCallback:()=>{this._studiesCache[s][o].completed=!0,this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,"error in series")},onErrorCallback:(e,t)=>{if(this._studiesCache[s][o].completed=!0,t){const i={error:e,title:t};this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,i)}else this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,e)},onNonSeriesDataUpdate:(e,t)=>{
-switch(_=!0,e.type){case"projection":break;case"study_gap":const t=this._timeScales[s].replaceStudyBarsTimesTail(o,e.times);this._applyTimeScaleUpdate(s,t);break;case"study_graphics":{const t={data:{graphicsCmds:e.data?.graphicsCmds,isUpdate:e.data?.isUpdate},indexes:[]},i=function(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,s=new Set;kS.forEach(((e,o)=>{const n=t[o];if(n)for(const t of n)for(const o of t.data){const t=e(o);for(const e of t)i.set(e,-1),s.add(e)}}));const o=Array.from(s).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),ES.forEach(((e,s)=>{const o=t[s];if(o)for(const t of o)for(const s of t.data)e(s,i)})),o}(t);this._studiesNonSeriesTimes[s][o]=i,t.indexes=this._timeScales[s].convertTimesToIndexes(i),h([],t);break}case"non_series_data":{const t={data:e.data,indexes:[]},i=t?.data?.data?.pivots,n=void 0!==i;let r=function(e){const t={};gS(e,(e=>{(0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});const i=Object.keys(t).map(Number).sort(((e,t)=>e-t));return i.forEach(((e,i)=>{t[e]=i})),Object.assign(e,gS(e,(e=>((0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(e[i.slice(0,-3)]=t[e[i]])})),e)),{visitInstances:!0})),i}(t),a=this._timeScales[s].convertTimesToIndexes(r,n);if(n){const e=new Set,t=[],s=[];let o=0;for(let n=a.length-1;n>=0;n--){const l=a[n];e.has(l)||l===Fh.INVALID_TIME_POINT_INDEX?(i.splice(n,1),o++):(t.unshift(r[n]),s.unshift(l),e.add(l))}o>0&&i.forEach(((e,t)=>{e.startIndex=t,e.endIndex=t+1})),r=t,a=s}this._studiesNonSeriesTimes[s][o]=r,t.indexes=a,h([],t);break}default:$S("unsupported non-series data type for study "+e.type)}}})}_isEndOfData(e,t,i){const s=e+"!"+t+"@"+i;return Boolean(this._endOfData[s])}_setEndOfData(e,t,i,s){const o=e+"!"+t+"@"+i;this._endOfData[o]=!1!==s}_applyTimeScaleUpdate(e,t){if(null===t)return;const i=[];for(const t of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][t];if(s&&"study"===s.type){const o=this._studiesNonSeriesTimes[e][t];if(o){const n={indexes:this._timeScales[e].convertTimesToIndexes(o),data:{indexes_replace:!0}};i.push({objId:t,turnaround:s.turnaround,data:[],nonSeriesData:n})}}}this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleUpdate(t,i),Promise.resolve().then((()=>{const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=t.symbolInfo,s=(s=t.resolution)=>this._getSymbolExtrapolator(e,i,s);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,s,this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}}))}_updateMainTsBuilder(e){const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}}_updateTimeScaleState(e){if(!this._studiesCache[e])return;let t=!0,i=!0;for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s]
-;"InactivityGaps@tv-basicstudies-1"!==o?.metainfo?.id&&(i=i&&this._isEndOfData(e,s,o.turnaround),t=t&&o.completed)}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleCompleted(i))}_getStudiesCacheSessionKeys(e){return void 0!==this._studiesCache[e]?Object.keys(this._studiesCache[e]):[]}}WS.debugGetQuotesRequestId=1;const HS=WS;function zS(e,t){return"string"==typeof e?e:(0,zv.default)(e)&&e&&"message"in e&&(0,et.default)(e.message)?e.message:t}function US(e,t){return e+"_"+t}function jS(e,t){return e+"_"+t}function GS(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}function qS(e,t,i,s){return[e,t,i,s].filter((e=>(0,et.default)(e)&&e.length>0)).join("|")}function $S(e){console.warn(`${(new Date).toISOString()} ${e}`)}function KS(e){const t=(0,Pv.decodeExtendedSymbol)(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:"currency-id"in i&&i["currency-id"],unit:"unit-id"in i&&i["unit-id"],session:"session"in i?i.session===Xv.SubsessionId.Regular?void 0:i.session:void 0}]}function YS(e){const t=e.findIndex((e=>e.index!==RS));return-1===t?[]:0===t?e:e.slice(t)}function ZS(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]??null:null}}return null}function XS(e,t,i){if(i.logoid=void 0,i["base-currency-logoid"]=void 0,i["currency-logoid"]=void 0,e){if("string"==typeof e)return void $S("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=t}t&&(i.provider_id=t,i.country=void 0)}function JS(e){return e.timezone=e.timezone,e}(0,A.setClasses)();const QS=(0,r.getChartingLibraryGlobalContext)(),eb=(0,r.getChartingLibraryOwner)(),tb=new class{constructor(e,t){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Oe(e.document),this._viewportType=ze.CheckMobile.iOS()&&!(0,He.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Fe(this._window.document);const i={alive:new O.WatchedValue(!0),fullscreenable:new O.WatchedValue(!0),container:new O.WatchedValue(t),
-width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Ne(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=t?.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),ib=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ue(i,e.negotiations.width))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ue(i,e.negotiations.height))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=this._createDOM(t),s={name:t,canNegotiate:{
-width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=je(e);Ge(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=je(e);Ge(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,alive:new O.WatchedValue(!0),container:new O.WatchedValue(i),visible:new O.WatchedValue(!0),fullscreen:new O.WatchedValue(!1),fullscreenable:new O.WatchedValue("right"===t||"center"===t),rdState:new Ne};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e;const t=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,o=this._areas.right,n=this._areas.top,r=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),h=this._height.value();let d=0,u=0,_=0,p=0,m=0,g=0,f=0,y=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);y=this._setHeight(l,e,h),this._setWidth(l,e,c)}if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=y+"px")}let v=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=y+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(v=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);_=this._setWidth(i,e,c),_&&(_+=4),_&&1===v&&(v=4);const s=i.container.value();e&&s&&(s.style.top=t+y+v+"px"),this._setHeight(i,e,h-t-y)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-_;qe||(t-=300),m=this._setWidth(s,e,t),m&&1===v&&(v=4),this._setHeight(s,e,h-y-d-v)}if(e===this._recalcSingleRunToken&&o){
-const e=this._processVisibility(o);let t=c-_-m;qe||(t-=300),p=this._setWidth(o,e,t),p&&1===v&&(v=4),this._setHeight(o,e,h-y-d-v);const i=o.container.value();e&&i&&(i.style.top=d+y+v+"px")}const S=m+p;let b=0,w=c-_-m-p-(S?4:0);const C=Boolean(m||!S);if(!p&&m&&(w+=4),e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r),t=r.container.value();e&&t&&(t.style.left=_+"px",t.classList.toggle("no-border-top-left-radius",!_),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(r,e,w);const i=h-y;b=Math.min(300,i-0),u=this._setHeight(r,e,i)+4}const T=Boolean(d&&(_||S));if(this._container.classList.toggle("layout-with-border-radius",T),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=_+"px",t.style.top=d+y+v+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!_),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!_&&S)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-y-v;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&p?`${p+4}px`:`${p}px`,e.style.top=y+d+v+"px",e.style.borderTopRightRadius=T&&p?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return Ye(e);if(this._width.value()<=567||this._height.value()<=445&&!Ke){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t{QS.ChartApiInstance.start()})),"function"==typeof rb){const e=rb({Std:Py.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void ab.resolve();const t=QS.JSServer;for(const i of e)if("function"==typeof i){const e=(new Ev).build(i);t.studyLibrary.push.call(t.studyLibrary,e)}else t.studyLibrary.push.call(t.studyLibrary,i);ab.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),ab.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),ab.resolve())}else ab.resolve();QS.widgetReady=e=>{ee.subscribe("onChartReady",e,null)};const yb=ob.theme?.toLowerCase()??$s.StdTheme.Light;var vb;function Sb(e){QS.__defaultsOverrides=QS.__defaultsOverrides||{},(0,ge.deepExtend)(QS.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}vb=yb,L.themes[vb]&&(0,k.setTheme)(vb),async function(e){if(!db||void 0===e)return;try{const{overrideStandardThemes:t}=await i.e(2413).then(i.bind(i,79736));t(e)}catch(e){console.error("Error applying custom themes",e)}}(eb.customThemes).then(cb.resolve).catch(cb.resolve),QS.applyStudiesOverrides=e=>{e&&(QS.chartWidgetCollection?QS.chartWidgetCollection.applyStudiesOverrides?.(e):ns.StudyMetaInfo.mergeDefaultsOverrides(e))},QS.applyOverrides=e=>{Sb(e),QS.chartWidgetCollection&&QS.chartWidgetCollection.applyOverrides(e)},QS.doWhenApiIsReady=e=>{QS.tradingViewApi?e():lb.promise.then(e)},QS.applyTradingCustomization=e=>{if(e.order)for(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];if(e.position)for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t];return null===fb?Promise.resolve():fb.then((t=>{function i(e){const t={};for(const i of Object.keys(e??{})){const s=i.split(".");let o=t;for(const e of s.slice(0,s.length-1))o.hasOwnProperty(e)||(o[e]={}),o=o[e];o[s[s.length-1]]=e[i]}return t}if(null===t)return;const s=i(e.brokerOrder),o=i(e.brokerPosition);t?.overrideTradedGroupStyles({order:{lightTheme:s,darkTheme:s},position:{lightTheme:o,darkTheme:o}})}))},
-QS.changeTheme=(e,t)=>{const i=L.themes[e.toLowerCase()];return i?QS.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},QS.getTheme=()=>QS.tradingViewApi.themes().getCurrentThemeName(),QS.customThemes=async()=>{if(!db)return Promise.reject(new Error("The library_custom_color_themes feature must be enabled to use the custom themes API"));return new((await i.e(2413).then(i.bind(i,82753))).CustomThemesApi)},QS.is_authenticated=!1;JSON.parse(QS.urlParams.brokerConfig);a.t(null,void 0,i(94566)),a.t(null,void 0,i(92800)),a.t(null,void 0,i(44676));let bb=null;const wb=(0,me.createDeferredPromise)();let Cb;const Tb=()=>{if(l.setEnabled("charting_library_export_chart_data",!QS.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===ob.debug||l.enabled("charting_library_debug_mode")),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){const e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=ob.studiesOverrides&&ns.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(ob.studiesOverrides)),(0,n.assert)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Sb(JSON.parse(ob.overrides));const e=ob.numeric_formatting?JSON.parse(ob.numeric_formatting):void 0;e&&("string"==typeof e.decimal_sign&&(ue.formatterOptionsLibraryOverrides.decimalSign=e.decimal_sign[0]),"string"==typeof e.grouping_separator&&(ue.formatterOptionsLibraryOverrides.groupingSeparator=e.grouping_separator[0]));const t=new Sv,s=new Nv,c=new Bv,h=ob.studiesAccess&&JSON.parse(ob.studiesAccess)||{type:"black",tools:[]},d=new Df(h,c),u=new Ov((0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary),_=new HS(eb.datafeed,t,s,u);QS.ChartApiInstance=new Ef(t,_,c,d);const p=eb.customFormatters;p&&(p.timeFormatter&&(_e.customFormatters.timeFormatter=p.timeFormatter),p.dateFormatter&&(_e.customFormatters.dateFormatter=p.dateFormatter),p.tickMarkFormatter&&(_e.customFormatters.tickMarkFormatter=p.tickMarkFormatter),p.priceFormatterFactory&&(_e.customFormatters.priceFormatterFactory=p.priceFormatterFactory),p.studyFormatterFactory&&(_e.customFormatters.studyFormatterFactory=p.studyFormatterFactory)),eb.customTimezones&&De.instance().addTimezones(eb.customTimezones);const m=ob.chartContent?JSON.parse(ob.chartContent).json:void 0,g=ob.chartContentExtendedData?JSON.parse(ob.chartContentExtendedData):m?m.extendedData:void 0,f=ob.interval||"D",v=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),o=s[2].toLowerCase(),r=parseInt(s[1]),l="y"===o?12*r+"M":r+o,c=Re.Interval.parse(l.toUpperCase()),h=Re.Interval.parse(e.resolution);return{text:e.title||{y:a.t(null,{plural:"{count}y",count:r,context:"short_N_year"},i(46766)),m:a.t(null,{plural:"{count}m",count:r,context:"short_N_month"},i(58590)),d:a.t(null,{plural:"{count}d",count:r,context:"short_N_day"},i(47801))
-}[o]||`${r}${o}`,description:e.description||"",value:{value:c.value(),type:"period-back"},targetResolution:h.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(ob.timeFrames)),S={resizerBridge:gb,padding:l.enabled("border_around_the_chart")?2:0,content:m,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(QS.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:ob.timezone,defSymbol:ob.symbol??"",defInterval:m?"":f,compareSymbols:ob.compareSymbols&&JSON.parse(ob.compareSymbols),defTimeframe:(b=eb.timeframe,b?"string"==typeof b?b:{...b,type:"time-range"}:b),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:sb},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:ob.time_scale&&JSON.parse(ob.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"),price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"),indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==bt.STATUS_DELAYED&&t!==bt.STATUS_DELAYED_STREAMING&&t!==bt.STATUS_EOD&&t!==bt.STATUS_READY)return[];return v.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),
-backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,layoutFullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:ob.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var b;hb&&((0,xf.createFavoriteDrawingToolbar)(),S.widgetOptions.isDrawingToolbarVisible=P.isDrawingToolbarVisible),g&&(S.metaInfo={id:g.uid,name:g.name,description:g.description,uid:g.uid,username:""}),eb.additionalSymbolInfoFields&&(0,lv.setAdditionalSymbolInfoFields)(eb.additionalSymbolInfoFields);const w=eb.symbolSearchComplete;w&&(0,cv.setSymbolSearchCompleteOverrideFunction)(w);const C=QS.chartWidgetCollection=new Pf(S);let x=!1;C.onAboutToBeDestroyed.subscribe(null,(()=>{x=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,ft.combine)(((e,t)=>{const s=e??t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new ev(t,i,s.ownership())}),Co.CustomSourceLayer.Topmost)}(C),QS.studyMarket=new pe(C),Je.registerService(Xe.CHART_WIDGET_COLLECTION_SERVICE,C),C.activeChartWidget.subscribe((e=>{ee.emit("activeChartChanged",C.getAll().indexOf(e))})),QS.saver=new N.ChartSaver(C);const A=new I.ChartChangesWatcher(C,QS.saver,ee),k=new Z(C,QS.saver,A);C.setSaveChartService(k);const E=new oe(C);QS.chartWidget=C.activeChartWidget.value(),QS.pro=new TradingView.Pro;const B=function(e){if(!pb)return null;const t=JSON.parse(ob.favorites);t.intervals=t.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(Cb=new he({chartWidgetCollection:e.chartWidgetCollection}));let s;const o=ob.header_widget_buttons_mode;"fullsize"===o&&(s=["full"]);"compact"===o&&(s=["small"]);const n=(0,gv.shouldShowQuickSearchOnLib)()?function(e){const t=t=>Promise.all([i.e(9520),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(3359),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(8260),i.e(1979),i.e(7780),i.e(445),i.e(846),i.e(1667),i.e(3290),i.e(6870),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(1890),i.e(1727),i.e(9754)]).then(i.bind(i,11065)).then((i=>{const s=new(0,i.GlobalSearchDialogRenderer)(e);return null!==Ve&&Ve.hide(),s.show(t),Ve=s,s}));return(0,D.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:D.Modifiers.Mod+75,handler:()=>t()}),t}(e.loadChartService):void 0;return new T(new y,{chartSaver:QS.saver,chartApiInstance:QS.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:t.chartTypes,defaultFavoriteIntervals:t.intervals,resizerBridge:pb,studyMarket:QS.studyMarket,studyTemplates:Cb,allowedModes:s,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:e.chartChangesWatcher,onClick:Ab,snapshotUrl:e.snapshotUrl,openGlobalSearch:n})}({chartWidgetCollection:C,saveChartService:k,chartChangesWatcher:A,
-loadChartService:E,snapshotUrl:ob.snapshotUrl});null!==B?B.load().then((e=>{bb=e.getComponent(),wb.resolve()})):(wb.promise.catch((()=>{})),wb.reject("header widget is not loaded"));const V=function(e){if(mb){const t=ob.toolbarbg&&/^[0-9a-f]+$/i.test(ob.toolbarbg)?String(ob.toolbarbg):void 0;if(t){const e=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new M({bgColor:t,chartWidgetCollection:e,drawingsAccess:ob.drawingsAccess?JSON.parse(ob.drawingsAccess):void 0,resizerBridge:mb,onClick:Ab})}return null}(C),R=null;QS.tradingViewApi=new Cy({chartWidgetCollection:C,chartApiInstance:QS.ChartApiInstance,saveChartService:k,loadChartService:E,studyMarket:null});if(de.linking.bindToChartWidgetCollection(C),isNaN(ob.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(ob.studyCountLimit))),!isNaN(ob.ssreqdelay)){const e=Math.max(0,+(0,n.ensureDefined)(ob.ssreqdelay));(0,Ty.setSearchRequestDelay)(e)}QS.ChartApiInstance.connect(),(async()=>{const{LineToolPropertiesWidget:e}=await Promise.all([i.e(7617),i.e(8185),i.e(1681),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(7827),i.e(8220),i.e(9590),i.e(1667),i.e(9836),i.e(3290),i.e(6178),i.e(7777),i.e(2227),i.e(3179),i.e(1890),i.e(6193),i.e(6376),i.e(2306)]).then(i.bind(i,36699));x||(QS.lineToolPropertiesToolbar=new e(C))})();const O=document.querySelector(".tv-content");null!==O&&O.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),lb.resolve(),C.undoHistory.undoStack().onChange().subscribe(null,(0,o.default)((e=>{e?.affectsState()&&ee.emit("onAutoSaveNeeded")}),1e3*(Number(ob.autoSaveDelay)||5),{leading:!1,trailing:!0}));let F=!1;function W(){V&&V.load(nb.signal),R&&R.load(nb.signal).then((e=>{QS.footerWidget=e.getComponent()}))}QS.chartWidget.withModel(null,(()=>{QS.ChartApiInstance.on("realtime_tick",(e=>{ee.emit("onTick",e)}));if(!L.savedThemeName()&&yb){const e=L.getStdTheme(yb);e&&e.content&&void 0===m&&C.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:yb,standardTheme:!0,syncState:!0,noUndo:!0}).then((()=>QS.applyOverrides(QS.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&ee.subscribeToAll(((...e)=>{console.log(`${(new Date).toISOString()} Event "${e[0]}", arguments: ${JSON.stringify(e.slice(1))}`)})),F)return;F=!0,If(C),function(e,t){const s=a.t(null,void 0,i(37367)).format({emoji:"👍"}),o=a.t(null,void 0,i(69804)).format({emoji:"👍"}),r=a.t(null,void 0,i(6655)).format({emoji:"👍"});ee.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),ee.on("onClientScreenshotCopiedToClipboard",(()=>h(o)),null),ee.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(r)),null);let l=null;const c=e.getContainer();function h(e){
-l?l.show(e):Promise.all([i.e(5371),i.e(2307),i.e(2227),i.e(92)]).then(i.bind(i,1524)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(C,{seriesControlBarEnabled:l.enabled("timeframes_toolbar")});P_.getInstance().setWidgetCollection(QS.chartWidgetCollection)})),C.getAll().some((e=>e.isInitialized()))?W():function(e,t){const i=e.getAll(),s=()=>{t(),i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(C,W),ee.subscribe("chart_load_requested",(e=>{QS.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{nb.abort(),QS.widgetbar&&(QS.widgetbar.destroy(),QS.widgetbar=null),QS.chartWidgetCollection&&(QS.chartWidgetCollection.destroy(),QS.chartWidgetCollection=null),QS.ChartApiInstance&&QS.ChartApiInstance.disconnect(),(0,Ze.destroyQuoteSessions)(),QS.ChartApiInstance&&(QS.ChartApiInstance.destroy(),QS.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(eb.saveLoadAdapter?E.setCustomAdapter(eb.saveLoadAdapter):QS.urlParams.chartsStorageUrl&&QS.urlParams.clientId?E.initialize(QS.urlParams.clientId,QS.urlParams.userId,QS.urlParams.chartsStorageUrl,QS.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1))),void 0!==eb.imageStorageAdapter&&l.enabled("image_drawingtool")&&(0,fv.setImageStorageAdapter)(eb.imageStorageAdapter);const Pb=(0,me.createDeferredPromise)();function xb(){Pb.resolve()}eb.loadLastChart&&l.enabled("saveload_storage_customization")?E.getCharts().then((e=>{if(0===e.length)return void xb();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];E.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,ob.chartContent=JSON.stringify({json:i}),xb()})).catch(xb)})).catch(xb):xb();const Mb=async function(){if(l.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,67387));return Bm=e.LineToolsSynchronizer,!0}return!1}(),Ib=(0,me.createDeferredPromise)();function Ab(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Ib.promise,Pb.promise,QS.loadedCustomCss,Mb,cb.promise]).then((()=>{const e=document.querySelector(".loading-indicator");if(e&&(e.style.display="none"),setTimeout(Tb,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",o="ga",t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=Number(new Date),r=i.createElement(s),a=i.getElementsByTagName(s)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(r,a);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[2];QS.ga("create","UA-112911840-1","auto"),QS.ga("set","anonymizeIp",!0),QS.ga("set",{hostname:e,page:e,referrer:e}),QS.ga("send","pageview")}var t,i,s,o,r,a})),(()=>{let e=!0;eb.datafeed.onReady((t=>{
-e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),QS.configurationData=t,Ib.resolve()})),e=!1})(),QS.createShortcutAction=(()=>{const e=D.createGroup({desc:"API",order:yv.ACTION_API_GROUP_ORDER});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?R(s.split("+")):Array.isArray(s)?R(s):0),handler:i})}})(),QS.initializationFinished=()=>{QS.chartWidgetCollection.undoHistory.clearStack()},QS.headerReady=()=>wb.promise,function e(t=0,i=10){const s={received:!1};QS.dispatchEvent(new CustomEvent("innerWindowLoad",{detail:s})),!s.received&&t{e(t+1,i)}),10*Math.pow(2,t))}(),QS.createButton=e=>{if(null===bb)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1;const t=(0,fe.randomHash)();return bb.addButton(t,e)??t},QS.removeButton=e=>{if(null===bb)throw new Error("Cannot remove button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return bb.removeButton(e)},QS.createDropdown=e=>{if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,fe.randomHash)();return bb?(bb.addDropdown(t,e),Promise.resolve(new hv(bb,t))):wb.promise.then((()=>((0,n.ensureNotNull)(bb).addDropdown(t,e),new hv((0,n.ensureNotNull)(bb),t))))},QS.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[t]})),e},QS.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,ve.property)()))),QS.getPaneButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Se.property)()))),QS.getDateFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(be.dateFormatProperty))),QS.getTimeHoursFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(we.timeHoursFormatProperty))),QS.getCurrencyAndUnitVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Be.currencyUnitVisibilityProperty)()))),QS.customSymbolStatus=()=>_v.getInstance();QS.urlParams.debugBroker,new Set(["connectionStatus"]);const Lb=ob.locale||"en",kb=Dt.getInstance();kb.createElement(document),kb.setLocale(Lb),QS.customChartDescriptionFunction&&kb.setCustomProvider(QS.customChartDescriptionFunction);const Eb=Sm.getInstance();Eb.createElement(document),Eb.setLocale(Lb),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,B.humanReadableHash)(9):`${(0,B.humanReadableModifiers)(B.Modifiers.Alt,!1)} + ${(0,B.humanReadableHash)(90)}`,t=`${(0,B.humanReadableModifiers)(B.Modifiers.Mod,!1)} + ${(0,B.humanReadableHash)(75)}`,s=a.t(null,void 0,i(7697)),o=[a.t(null,{replace:{shortcut:e}},i(85166)),a.t(null,{replace:{shortcut:t}
-},i(57959)),a.t(null,void 0,i(36332)),a.t(null,void 0,i(9687)),a.t(null,void 0,i(40490)),a.t(null,void 0,i(27884))],n=document.createElement("p");n.innerText=s;const r=document.createElement("ul");o.forEach((e=>{const t=document.createElement("li");t.innerText=e,r.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(r),document.body.insertBefore(c,document.body.firstChild)}(),window.addEventListener("keydown",(e=>{const t=(0,B.hashFromEvent)(e);9!==t&&t!==D.Modifiers.Shift+9||(0,pv.updateTabIndexes)()})),new zo.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{(0,pv.updateTabIndexes)();const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,mv.createScopedVisibleElementFilter)(document.documentElement)).sort(pv.navigationOrderComparator);void 0!==e&&e.focus()},hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:D.Modifiers.Alt+90,hotkeyGroup:(0,D.createGroup)({desc:"Global shortcuts"})}})},52959:(e,t,i)=>{"use strict";function s(){return window}function o(){const e=s();return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>o})},29063:(e,t,i)=>{"use strict";i.r(t);var s=i(21097),o=i(51768),n=i(76422),r=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim();return s?{type:"text",data:s}:{type:"none"}}function u(e,t){let i=!1;const s=e.children;for(let e=0;e{(0,r.hide)(),t.removeEventListener("blur",s),t.removeEventListener("active-descendant-blur",s)};t.addEventListener("blur",s),t.addEventListener("active-descendant-blur",s)}}a((()=>{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,r.showOnElement)(t,{content:d(t)});const i=()=>{(0,r.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",_,!0),document.addEventListener("active-descendant-focus",_,!0)}));var p=i(48096),m=i(11417);var g=i(39527);function f(e){return()=>{e()}}var y=i(3343),v=i(34811),S=i(15754);const b=(e=document.documentElement,t)=>document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>t=>{if(1!==t.nodeType)return NodeFilter.FILTER_SKIP;const i=t;return(0,S.isInertRoot)(i)?NodeFilter.FILTER_REJECT:(0,S.isVisibilityVisible)(i)&&i.matches(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP})(t));const w=(e=document.documentElement)=>b(e,S.FOCUSABLE_SELECTOR);const C=`[${v.FOCUS_TRAP_DATA_ATTRIBUTE}="true"]`;class T{constructor(){this._handleMouseDown=()=>{this._forwardTab=void 0},this._handleKeyDown=e=>{this._forwardTab=void 0,[9,y.Modifiers.Shift+9].includes((0,y.hashFromEvent)(e))&&(this._forwardTab=!e.shiftKey)},this._handleFocus=e=>{const t=e.target;if(void 0===this._forwardTab||!(t instanceof HTMLElement))return;const i=this._findDeepestFocusTrapElement(document.documentElement);if(!(i instanceof HTMLElement)||!i||i.contains(t))return;e.preventDefault(),e.stopPropagation(),t.blur();const s=i.compareDocumentPosition(t);if(s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_FOLLOWING){const e=this._forwardTab?x(i):x(i,!0);e instanceof HTMLElement&&e.focus()}},document.documentElement.addEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.addEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.addEventListener("mousedown",this._handleMouseDown,{capture:!0})}destroy(){document.documentElement.removeEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.removeEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.removeEventListener("mousedown",this._handleMouseDown,{capture:!0})}_findDeepestFocusTrapElement(e){const t=e.querySelectorAll(C);let i=null,s=-1;return t.forEach((t=>{const o=this._calculateParentCount(t,e);o>s&&(s=o,i=t)})),i}_calculateParentCount(e,t){let i=0,s=e.parentElement;for(;s&&s!==t;)"true"===s.getAttribute(v.FOCUS_TRAP_DATA_ATTRIBUTE)&&i++,s=s.parentElement;return i}}const P=f((()=>new T));function x(e,t){
-return t?function(e){return function(e){for(e.currentNode=e.root;null!==e.lastChild(););return e.currentNode===e.root?null:e.currentNode}(w(e))}(e):function(e){return t=w(e),t.currentNode=t.root,t.nextNode();var t}(e)}const M=f((()=>{P()}));var I=i(99247);let A;function L(e){window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,o.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):availableOffersWrapper.runOrUpdate((e=>{Object.keys(e).forEach((t=>{const i=t;e[i].available_for_anons||delete e[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:e},m.TVLocalStorage.removeItem("trial_availiable")}))}A=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,A.subscribe(null,L),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,A.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//,/^\/pine\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS"),A.fire()},window.loginUser=function(e){window.user=(0,g.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=L,window.TradingView.setTrialAvailiable=e=>{m.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate,M(),(0,I.initMouseClickAutoBlurHandler)()},43229:(e,t,i)=>{"use strict";i.d(t,{AsyncResourceWrapper:()=>s});class s{constructor(e,t){this._destroyed=!1,this._callbacks=[],this._resource={pendingResource:e},this._destroyFn=t,e.then((e=>{if(this._destroyed)this._destroyFn?.(e);else{this._resource.resource=e;for(const t of this._callbacks)t(e)}})).finally((()=>{this._callbacks=[]}))}destroy(){this._resource.resource&&this._destroyFn?.(this._resource.resource),this._resource={pendingResource:Promise.reject("Resource is destroyed").catch((()=>{}))},this._callbacks=[],this._destroyed=!0}callFunction(e){
-this._destroyed||(this._resource.resource?e(this._resource.resource):this._callbacks.push(e))}get(){return this._destroyed||!this._resource.resource?null:this._resource.resource}promise(){return this._resource.pendingResource}}},52859:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>r,applyAlpha:()=>n,applyTransparency:()=>l,colorFromBackground:()=>u,colorToInteger:()=>g,generateColor:()=>o,getLuminance:()=>h,gradientColorAtPercent:()=>_,isHexColor:()=>d,resetTransparency:()=>c,rgbaFromInteger:()=>p,rgbaToInteger:()=>m,transparencyToAlpha:()=>a});var s=i(24377);function o(e,t,i){if(t=t||0,!d(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(a(t)))):e;const[o,n,r]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(a(t));return(0,s.rgbaToString)([o,n,r,l])}function n(e,t,i){const o=(0,s.tryParseRgba)(e);if(null===o)throw new Error(`Invalid color: ${e}`);const[n,r,a,l]=o,c=(0,s.normalizeAlphaComponent)(t*(i?l:1));return(0,s.rgbaToString)((0,s.rgba)([n,r,a],c))}function r(e){return 100*(1-e)}function a(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function l(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),o=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],a(t)*o))}function c(e){return"transparent"===e?e:d(e)?e.slice(0,7):(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function h(e){const t=(0,s.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function d(e){return 0===e.indexOf("#")}function u(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function _(e,t,i){const[o,n,r,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(o+i*(l-o)),Math.round(n+i*(c-n)),Math.round(r+i*(h-r)),a+i*(d-a));return(0,s.rgbaToString)(u)}function p(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},29970:(e,t,i)=>{"use strict";i.d(t,{colorsAreCloseEnough:()=>h,isColorDark:()=>_});var s,o=i(81251),n=i(24377);function r(e){return e<0&&(e+=2*Math.PI),e}function a(e,t){const[i,s,o]=e,[n,a,l]=t,c=(Math.sqrt(s**2+o**2)+Math.sqrt(a**2+l**2))/2,h=.5*(1-Math.sqrt(Math.pow(c,7)/(Math.pow(c,7)+6103515625))),d=(1+h)*s,u=(1+h)*a,_=Math.sqrt(d*d+o*o),p=Math.sqrt(u*u+l*l),m=0===o&&0===d?0:r(Math.atan2(o,d)),g=0===l&&0===u?0:r(Math.atan2(l,u)),f=n-i,y=p-_;let v;const S=_*p;0===S?v=0:(v=g-m,v<-Math.PI?v+=2*Math.PI:v>Math.PI&&(v-=2*Math.PI));const b=2*Math.sqrt(S)*Math.sin(v/2),w=(i+n)/2,C=(_+p)/2;let T;const P=m+g;T=_*p==0?P:Math.abs(m-g)<=Math.PI?P/2:P<2*Math.PI?(P+2*Math.PI)/2:(P-2*Math.PI)/2
-;const x=1-.17*Math.cos(T-Math.PI/6)+.24*Math.cos(2*T)+.32*Math.cos(3*T+Math.PI/30)-.2*Math.cos(4*T-Math.PI/180*63),M=Math.PI/6*Math.exp(-Math.pow((T-Math.PI/180*275)/(Math.PI/180*25),2)),I=2*Math.sqrt(Math.pow(C,7)/(Math.pow(C,7)+6103515625)),A=1+.015*Math.pow(w-50,2)/Math.sqrt(20+Math.pow(w-50,2)),L=1+.045*C,k=1+.015*C*x,E=-Math.sin(2*M)*I;return Math.sqrt(Math.pow(f/(1*A),2)+Math.pow(y/(1*L),2)+Math.pow(b/(1*k),2)+E*(y/(1*L))*(b/(1*k)))}!function(e){e[e.Pow25In7=6103515625]="Pow25In7",e[e.LWeight=1]="LWeight",e[e.CWeight=1]="CWeight",e[e.HWeight=1]="HWeight"}(s||(s={}));const l=[127,127,127];function c(e){const t=e[3],i=e.slice(0,3);for(let e=0;e<3;e++)i[e]=Math.round(i[e]*t+l[e]*(1-t));return i}function h(e,t){return a(g(p(c((0,n.parseRgba)(e)))),g(p(c((0,n.parseRgba)(t)))))<3}const d=(0,o.default)((()=>g(p([0,0,0])))),u=(0,o.default)((()=>g(p([255,255,255]))));function _(e){const t=g(p(c((0,n.parseRgba)(e))));return a(t,d()).04045?Math.pow((o+.055)/1.055,2.4):o/12.92),l=100*(n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92),c=100*(r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92);return[.4124*a+.3576*l+.1805*c,.2126*a+.7152*l+.0722*c,.0193*a+.1192*l+.9505*c]}var m;function g(e){const[t,i,s]=e,o=t/95.047,n=i/100,r=s/108.883,a=o>.008856?Math.pow(o,1/3):7.787*o+16/116,l=n>.008856?Math.pow(n,1/3):7.787*n+16/116;return[116*l-16,500*(a-l),200*(l-(r>.008856?Math.pow(r,1/3):7.787*r+16/116))]}!function(e){e[e.X=95.047]="X",e[e.Y=100]="Y",e[e.Z=108.883]="Z"}(m||(m={}))},22961:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>r,lerp:()=>s});const o={from:0,duration:250,easing:i(76662).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...o,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const o=(i=!i||i<1e12?performance.now():i)-e,n=o>=this._options.duration||t===this._options.to,r=s(this._options.from,this._options.to,this._options.easing(o/this._options.duration)),a=n?this._options.to:r,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function r(e){return new n(e)}},32925:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>o});var s=i(9343);new class{constructor(e,t){this._test=e[t]={}}provide(e,t){this._test[e]=t}}(window,"qaGlobals"),(0,s.getLogger)("Fetch");function o(e,t,i={}){return window.fetch(e,t)}},67225:(e,t,i)=>{"use strict";i.d(t,{GradientColorCache:()=>o});var s=i(52859);class o{constructor(){this._color1="",this._color2="",this._colors=new Map}gradientColor(e,t,i){if(t===e)return t;i=Math.max(0,Math.min(100,Math.round(100*i))),this._color1===e&&this._color2===t||(this._colors.clear(),this._color1=e,this._color2=t)
-;let o=this._colors.get(i);return void 0===o&&(o=(0,s.gradientColorAtPercent)(e,t,i/100),this._colors.set(i,o)),o}}},49251:(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 o=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=o.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])}}},18113:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>o});let s=null;function o(){return s}},24640:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>b,forceLTRStr:()=>u,forceLTRStrSsr:()=>_,forceRTLStr:()=>m,getLTRScrollLeft:()=>g,getLTRScrollLeftOffset:()=>f,isRtl:()=>o,startWithLTR:()=>d,stripLTRMarks:()=>h,stripLTRStrSsr:()=>p});var s=i(64531);const o=()=>"rtl"===window.document.dir,n="",r="",a="",l="",c=new RegExp(n+"|"+r+"|"+a+"|"+l,"g");function h(e){return""!==e&&o()&&null!=e?e.replace(c,""):e}function d(e){return""!==e&&o()&&null!=e?n+e:e}function u(e){return""!==e&&o()&&null!=e?r+e+l:e}function _(e){return r+e+l}function p(e){return e.startsWith(r)&&e.endsWith(l)?e.slice(1,-1):e}function m(e){return""!==e&&o()&&null!=e?a+e+l:e}function g(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function f(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}var y;!function(e){e.LTR="ltr",e.RTL="rtl",e.UNKNOWN=""}(y||(y={}));const v=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,S=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function b(e){const t=v.exec(e);return t?S.test(t[0])?"rtl":"ltr":""}},76662:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},59672:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(6342),i.e(8185),i.e(2202),i.e(8894),i.e(5743),i.e(6954),i.e(2227),i.e(2077)]).then(i.bind(i,3014))}i.d(t,{loadChangeIntervalDialog:()=>s})},59613:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(59672);let o=null;function n(e){const t=o=(0,s.loadChangeIntervalDialog)().then((i=>{t===o&&i.showChangeIntervalDialog(e)}));return t}},92572:(e,t,i)=>{"use strict";function s(e){return Promise.all([i.e(7629),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(2537),i.e(8894),i.e(5743),i.e(9487),i.e(3329),i.e(4678),i.e(4059),i.e(861),i.e(2227),i.e(9418),i.e(3179),i.e(4426),i.e(9928),i.e(8604),i.e(1859)]).then(i.bind(i,62256)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s})},70347:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()};window.TradingView.runOrSigninWithFeature=s},16708:(e,t,i)=>{"use strict";i.d(t,{DeleteLockedLineToolReason:()=>s,confirmRemovingLockedLineTools:()=>d,showDeleteLockedLineToolsConfirm:()=>h})
-;var s,o=i(11542),n=i(3615),r=i(5734),a=i(89947);!function(e){e[e.RemoveSelected=0]="RemoveSelected",e[e.RemoveAll=1]="RemoveAll"}(s||(s={}));const l=o.t(null,void 0,i(41019)),c=o.t(null,void 0,i(41019));async function h(e,t){if(r.doNotShowDeleteLockedLineConfirmProperty.value())return void t(a.deleteLockedLineToolsProperty.value());const{getContent:h}=await Promise.all([i.e(7328),i.e(3425),i.e(6052),i.e(1065),i.e(4598)]).then(i.bind(i,30627));(0,n.showConfirm)({title:o.t(null,void 0,i(71692)),content:h(e===s.RemoveSelected?l:c),id:`${r.doNotShowDeleteLockedLineKey}-confirm`,mainButtonText:o.t(null,void 0,i(93123)),mainButtonIntent:"danger",cancelButtonText:o.t(null,void 0,i(99024)),onConfirm:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!0),t(!0),e()},onCancel:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!1),t(!1),e()}})}function d(e){return new Promise((t=>{h(e,t)}))}},31237:(e,t,i)=>{"use strict";i.d(t,{showDeleteStudyTreeConfirm:()=>r});var s=i(11542),o=i(3615);const n=5;function r(e,t){let r,a="";if(e.length>n){const t=e.length-n+1;r=e.slice(0,n-1),a=s.t(null,{plural:"and {nameCount} more indicators.",count:t},i(31550)).format({nameCount:t.toString()})}else r=e;const l=''+r.map((e=>`- ${e}
`)).join("")+"
"+a,c=s.t(null,void 0,i(4995))+l;(0,o.showConfirm)({title:s.t(null,void 0,i(97767)),html:c,mainButtonText:s.t(null,void 0,i(67410)),mainButtonIntent:"danger",cancelButtonText:s.t(null,void 0,i(4543)),onConfirm:({dialogClose:e})=>{t(),e()}})}},10341:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),o=i(3615);function n(e){(0,o.showWarning)({title:s.t(null,void 0,i(66719)),text:s.t(null,{replace:{number:`${e}`}},i(86146))})}},55279:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>o});let s=[];function o(e){s=e}function n(){return s}},84526:(e,t,i)=>{"use strict";function s(e){Promise.all([i.e(8622),i.e(8185),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3359),i.e(445),i.e(2112),i.e(9036),i.e(2227),i.e(9418),i.e(2477),i.e(9374)]).then(i.bind(i,46069)).then((({SymbolInfoDialogImpl:t})=>{t.getInstance().show(e)}))}i.d(t,{showSymbolInfoDialog:()=>s})},12362:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>d});var s=i(50279),o=i(50151),n=(i(11542),i(14411)),r=i(23024),a=i(48096),l=i(37103),c=i(81593);function h(e,t){e.content=JSON.stringify(t)}new WeakMap;new TextEncoder;class d{constructor(e){this._prevChartState=null,this._chartSavedDelegate=new a.Delegate,this._chartAboutToBeSavedDelegate=new a.Delegate,this._chartSizeLimitExceededDelegate=new a.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,o){if(l.enabled("saveload_separate_drawings_storage")){const n=await(0,r.getChartStorage)(),a=this.layoutId(),l=i=>n.saveLineToolsAndGroups(i,e,t,s,o);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){
-const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){const s=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{const t=e&&l.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),o=this._getCommonSavingInfo(!1);return h(o,i),s.chartName&&(o.name=s.chartName),o.name&&0!==o.name.length||!s.defaultChartName||(o.name=s.defaultChartName),s.autoSave&&(o.autoSave=!0),o}),((t,i)=>{(0,o.assert)(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this.layoutId()===t.uid&&this._chartWidgetCollection.metaInfo.name.setValue(i.name??""),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid,data:i}),this._prevChartState&&delete this._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){const t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return h(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}isSaveInProcess(){return this._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,o){let n=!1;return e?n=!0:(t=!0,s=!1),this._chartWidgetCollection.state({withData:!!e,skipLineToolsFromOtherSymbols:!!i,wipeSensitiveData:!!s,skipLineTools:o,skipHiddenSources:n,addOnlyActiveChart:!t})}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols()[t.activeChartWidget.value().id()],s={...(o=i,{...o,legs:JSON.stringify(o.legs??[])})};var o;const n=t.metaInfo,r=n.id.value();return null!==r&&(s.id=r),s.name=n.name.value()||"",s.description=n.description.value()||"",s.is_realtime=s.is_realtime=e?"0":"1",s}async _saveLineToolsToStorage(){if(l.enabled("saveload_separate_drawings_storage")){this.layoutId();0;const[e,t]=this._chartWidgetCollection.getAll().reduce(((e,t)=>{const i=t.lineToolsSynchronizer();if(i){e[0]||=i.hasUnsavedMigrationsFromChartState();const t=i.flushPendingSavings();t&&e[1].push(t)}return e}),[!1,[]]);return t.length&&await Promise.all(t),t.length>0&&e}return!1}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.invalidateAll()))}_saveChartImpl(e,t,i,s,o,n){let r;r=s=>{t.uid||t.uid!==this.layoutId()||(t.id=s.result,t.uid=`${s.result}`,this._chartWidgetCollection.metaInfo.id.setValue(t.id),this._chartWidgetCollection.metaInfo.uid.setValue(t.uid)),i(t,e)},e.name?c.backend.saveChart(e.name,e.short_name,e.resolution,e,t).then(r).catch((async e=>{const t=e instanceof Response?e:void 0,i=e instanceof Error?e:void 0;this._savingToken=null;const o=s.bind(null,{status:t?.status,message:t?.statusText??i?.message??"Unknown error"});o()})):s({status:-1,
-message:"Saving chart with empty name is not allowed"})}async _saveChart(e,t,o,r){const a=this._chartWidgetCollection.metaInfo,c={name:a.name.value(),description:a.description.value(),uid:a.uid.value(),id:a.id.value(),lastModified:a.lastModified.value(),username:a.username.value(),isPrivate:a.isPrivate.value()};let h=r.changes??n.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage()&&(h|=1)}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id)return this._chartSavedDelegate.fire(!0),void t(c,i);0;const n=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.markAsValidatedBecauseOfSavingToContent())),t(e,i));return this._saveChartImpl(i,c,n,o,r,e)}this._chartSavedDelegate.fire(!0),t(c,e(d))}}},71846:(e,t,i)=>{"use strict";var s=i(12362).ChartSaverBase;i.i18next(null,void 0,i(49947));t.ChartSaver=class extends s{constructor(e){super(e)}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}publishChart(e){}publishScript(e,t,i){}isScriptNameValid(e){return""!==e.trim()&&e.length<=64}isScriptDescriptionValid(e){return""!==e.trim()&&e.length<=7e4}isScriptDescribersValid(e,t){return this.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(new Promise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},19e3:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},29242:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},58043:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const o=e.length;for(;is})},39527:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],r=t[i];if(r===e)return;const a=Array.isArray(r);if(r&&(o(r)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&o(n)?n:{},e[i]=s(t,r)}else void 0!==r&&(e[i]=r)}))})),e):e}function o(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},88723:(e,t,i)=>{"use strict";function s(){
-let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},39058:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},4168:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>s.guid,randomHash:()=>s.randomHash,randomHashN:()=>s.randomHashN});var s=i(4226)},50470:(e,t,i)=>{"use strict";i.d(t,{parseHtml:()=>n,parseHtmlElement:()=>r});const s=new WeakMap;var o;function n(e,t){let i,o;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(o=s.get(i)),o||(o=i.ownerDocument.createRange(),o.selectNodeContents(i),s&&s.set(i,o)),o.createContextualFragment(e)}function r(e,t){const i=n(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}!function(e){e[e.Element=1]="Element",e[e.Document=9]="Document"}(o||(o={}))},26867:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const o=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(o.join(", "))&&e.preventDefault()}},53470:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},34369:e=>{e.exports=''},93544:e=>{e.exports=''},53573:e=>{e.exports=''},34487:e=>{e.exports=''},11890:e=>{
-e.exports=''},5845:e=>{e.exports=''},94839:e=>{e.exports=''},29453:e=>{e.exports=''},50946:e=>{e.exports=''},70893:e=>{
+method:"studies_metadata",params:["metadata_"+this._metadataRequestNextNumber++,{errors:[],hash:"",metainfo:t,migrations:[]}]})}))}setIsNonCountedStudyFn(e){this._isNonCountedStudy=e}canCreateStudy(e,t,i){return this._isNonCountedStudy(t.id)||this.studyCounter<210?{success:!0}:{success:!1,reason:"general",limitValue:210}}getStudyCounter(e){return this.studyCounter}getFundamentalCounter(e){return 0}createStudy(e,t,i,s,o,n,r,a){if(!this.canCreateStudy(e,a).success){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}return this._notificationHandlers[e][t]=new Af(r,t),this._studySpecs.set(Lf(e,t),a),this._studyEngine.createStudy(e,t,s,i,o,kf(n)),this._isNonCountedStudy(a.id)||this.studyCounter++,!0}removeStudy(e,t){if(this._notificationHandlers[e][t]){delete this._notificationHandlers[e][t];const i=Lf(e,t),s=(0,n.ensureDefined)(this._studySpecs.get(i));this._studySpecs.delete(i),this._studyEngine.removeStudy(e,t),this._isNonCountedStudy(s.id)||this.studyCounter--}return!1}modifyStudy(e,t,i,s,o,n){return this._notificationHandlers[e][t]=new Af(o,t),this._studyEngine.modifyStudy(e,t,i,kf(s)),!1}notifyStudy(e,t,i,s){throw new Error("Method not implemented.")}createPointset(e,t,i,s,o,n,r){return this._notificationHandlers[e][t]=new Af(r,t),this._studyEngine.createPointset(e,t,s,o,n),!1}modifyPointset(e,t,i,s,o){throw new Error("Method not implemented.")}removePointset(e,t){return this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t),!1}requestMoreTickmarks(e,t,i,s){return this._studyEngine.requestMoreTickmarks(e,i),!1}setFutureTickmarksMode(e,t){throw new Error("Method not implemented.")}serverTime(){return this._studyEngine.serverTime()}quoteCreateSession(e){return this._studyEngine.quoteCreateSession(e),!1}quoteDeleteSession(e){return this._studyEngine.quoteDeleteSession(e),!1}quoteAddSymbols(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((e=>!!e))),this._studyEngine.quoteAddSymbols(e,t),!1}quoteRemoveSymbols(e,t){return this._studyEngine.quoteRemoveSymbols(e,t),!1}quoteFastSymbols(e,t){return this._studyEngine.quoteFastSymbols(e,t),!1}quoteSetFields(e,t){return this._studyEngine.quoteSetFields(e,t),!1}quoteHibernateAll(e){return this._studyEngine.quoteHibernateAll(e),!1}searchSymbols(e,t,i,s,o){this._studyEngine.searchSymbols(e,t,i,s,o)}depthCreateSession(e){this._studyEngine.depthCreateSession(e)}depthDeleteSession(e){this._studyEngine.depthDeleteSession(e)}depthSetSymbol(e,t){this._studyEngine.depthSetSymbol(e,t)}depthClearSymbol(e){}depthSetScale(e,t){}_applyTimeFrame(e,t,i,s,o){let r,a,l={},c=!0;if("period-back"===o.type){const t=this._studyEngine.getSeriesLastBarTime(e,i);if(null===t)return;a=t/1e3;const s=Re.Interval.parse(o.value),h=(0,n.ensureNotNull)(this._studyEngine.getSeriesSymbolInfo(e,i));r=(0,Td.alignPeriodsBackForVisibleRange)(h.session,h.session_holidays,h.corrections,s.letter(),s.multiplier(),1,t)/1e3;const d=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,i)),h)
+;null!==d&&(a=d.timeToExchangeTradingDay(1e3*a)/1e3,r=d.timeToExchangeTradingDay(1e3*r)/1e3),l={applyDefaultRightMargin:!0},c=this._studyEngine.hasStudyWithExtendedTimeScale(e)}else r=o.from,a=o.to;this.setVisibleTimeRange(e,i,s,r,a,c,l,void 0,o,void 0)}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){const s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(let e=0;ethis.isToolEnabled(e.description)||e.is_hidden_study))}isToolEnabled(e){const t=this._findTool(e);return"black"===this._studiesAccess.type?!(t&&!t.grayed):!!t}isToolGrayed(e){const t=this._findTool(e);return!(!t||!t.grayed)}_findTool(e){let t=null;for(let i=0;i{this._toolbarThemeChanged.fire(e)},this._opts=e,
+k.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){k.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>null!==e.model().model().getThemeNameIfStdTheme()));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,Vf.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,k.setTheme)(e),t&&(0,L.syncTheme)()}getCurrentThemeName(){return(0,L.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}function Nf(e){return e in Of}const Of={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute",isAnchored:!0},note:{name:"LineToolNote"},text_note:{name:"LineToolTextNote"},anchored_note:{name:"LineToolNoteAbsolute",isAnchored:!0},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},comment:{name:"LineToolComment"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},image:{name:"LineToolImage"},table:{name:"LineToolTable"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},anchored_vwap:{name:"LineToolAnchoredVWAP"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},fib_channel:{name:"LineToolFibChannel"},
+xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},emoji:{name:"LineToolEmoji"},sticker:{name:"LineToolSticker"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}};const Ff=new ae.Delegate;var Wf=i(44862),Hf=i(51829);function zf(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(Hf.SessionStage.LASTBAR_SESSION)/1e3}class Uf{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){return this._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){return this._timeScale.usePercentageRightOffset().spawn()}isEmpty(){return this._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){return this._timeScale.points().size()}leftVisibleBarUTCTime(){const e=this._timeScale.visibleBarsStrictRange()?.firstBar()??null;return null===e?null:this._timeScale.indexToTimePoint(e)}}
+const jf=new dt.TranslatedString("change timezone",a.t(null,void 0,i(20137)));class Gf{constructor(e){this._onTimezoneChanged=new ae.Delegate,this._chartWidget=e,this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,(e=>{this._onTimezoneChanged.fire(e.value())})),e.onAboutToBeDestroyed().subscribe(this,(()=>{this._timezoneProperty.unsubscribeAll(this)}),!0)}availableTimezones(){return Pe.availableTimezones}getTimezone(){const e=this._timezoneProperty.value();return(0,n.ensureDefined)(this.availableTimezones().find((t=>t.id===e)))}setTimezone(e,t){(0,n.assert)((0,Pe.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),t?.disableUndo?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,jf)}onTimezoneChanged(){return this._onTimezoneChanged}}class qf{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){return this._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){return this._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){return this._priceScale.getStudies().map((e=>e.id()))}currency(){const e=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);return null===t?null:{readOnly:t.readOnly,selectedCurrency:t.selectedCurrency,originalCurrencies:Array.from(t.originalCurrencies),currencies:e.getItems().filter((e=>!t.baseCurrencies.has(e))),symbols:Array.from(t.symbols)}}setCurrency(e){const t=this.currency()?.currencies;t&&e&&!t.includes(e)?console.warn("The provided currency is not supported by your datafeed!"):this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){const e=this._chartModel.availableUnits(),t=this._priceScale.unit(e);return null===t?null:{readOnly:0===t.availableGroups.size,selectedUnit:t.selectedUnit,originalUnits:Array.from(t.originalUnits),availableGroups:Array.from(t.availableGroups),symbols:Array.from(t.symbols)}}setUnit(e){!e||this._chartModel.availableUnits().unitGroupById(e)?this._chartUndoModel.setPriceScaleUnit(this._priceScale,e):console.warn("The provided unit is not supported by your datafeed!")}coordinateToPrice(e){const t=this._priceScale.mainSource()?.firstValue();return null==t?null:this._priceScale.coordinateToPrice(e,t)}measureUnitId(){const e=this._priceScale.measureUnitId(this._chartModel.availableUnits());return null===e?null:{selectedMeasureUnitId:e.selectedMeasureUnitId}}}function $f(e){
+return{id:e.id(),name:(t=e.toolname,Object.keys(Of).find((e=>Of[e].name===t))||null)};var t}function Kf(e){return{id:e.id(),name:e.metaInfo().description}}const Yf=new dt.TranslatedString("change pane height",a.t(null,void 0,i(14691)));class Zf extends st.UndoCommand{constructor(e,t,i){super(Yf),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map((e=>e.stretchFactor()))}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){const e=this._model.panes();for(let t=0;t!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){return t===e.mainSeries()?function(e){return{id:e.id(),name:"Main Series"}}(e.mainSeries()):(0,Ws.isStudy)(t)?Kf(t):(0,zs.isLineTool)(t)?$f(t):null}(e,t))).filter(tt.notNull).filter((e=>null!==e.name))}getHeight(){return this._pane.height()}setHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length>1,"Unable to change pane's height if there is only one pane");const s=i.indexOf(this._pane);(0,n.assert)(-1!==s,"Invalid pane index");const o=new Zf(t,s,e);this._chartWidget.model().undoHistory().pushUndoCommand(o)}moveTo(e){const t=this.paneIndex();t!==e&&((0,n.assert)(e>=0&&e({...e,id:e.id,localizedName:void 0!==e.name?(0,Jf.getTranslatedInputTitle)(e.name):""})))}function ey(e){const t={};if(e.defaults){const i=(0,Al.default)(e.defaults);t.defaults=i}return void 0!==e.plots&&(t.plots=(0,Al.default)(e.plots)),void 0!==e.styles&&(t.styles=(0,Al.default)(e.styles)),void 0!==e.bands&&(t.bands=(0,Al.default)(e.bands)),void 0!==e.filledAreas&&(t.filledAreas=(0,Al.default)(e.filledAreas)),void 0!==e.palettes&&(t.palettes=(0,Al.default)(e.palettes)),t}var ty=i(82130);class iy{constructor(e,t){this._onStudyCompleted=new ae.Delegate,this._onStudyError=new ae.Delegate,this._isStudyDestroyed=!1,this._study=e,this._chartWidget=t,this._undoModel=this._chartWidget.model(),this._model=this._undoModel.model(),this._study.onAboutToBeDestroyed().subscribe(this,(()=>{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this),this._isStudyDestroyed=!0})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){case gh.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case gh.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return Qf(this._study.metaInfo())}getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map((t=>{const i=e[t];return{id:t,value:(0,tt.isObject)(i)?i.v:i}}))}getStyleInfo(){return ey(this._study.metaInfo())}getStyleValues(){const{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}=this._study.properties().state();return{styles:e,bands:t,filledAreas:i,palettes:s,graphics:o,ohlcPlots:n,filledAreasStyle:r}}setInputValues(e){const t=this.getInputValues();for(const i of e){void 0!==t.find((e=>e.id===i.id))?this._study.properties().childs().inputs.childs()[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&new la(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new ca(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new na(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new oa(this._model,this._study,null).redo()}paneIndex(){return this._model.panes().indexOf(this._model.paneForSource(this._study))}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}unmergeUpWithUndo(){
+this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){return new qf(this._undoModel,(0,n.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,n.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,n.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,n.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),new Tl(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,n.assert)(i===t,"Study should be on the main pane"),new Pl(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new Tl(this._model,this._study,i,"left",null).redo();break;case"new-right":new Tl(this._model,this._study,i,"right",null).redo();break;default:const s=this._model.dataSourceForId(e);if(null===s)throw new Error(`There is no study with entityId='${e}'`);const o=i===this._model.paneForSource(s);(0,n.assert)(o,"Both studies should be on the same pane");const r=(0,n.ensureNotNull)(s.priceScale()),a=kr(this._study,r,this._model),l=ih(this._study,r,this._model);new Pl(this._model,this._study,i,r,null).redo(),null!==a&&new bl(this._model,r,a,null).redo(),null!==l&&new wl(this._model,r,l,null).redo()}}isVisible(){return this._study.properties().childs().visible.value()}setVisible(e){this._study.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,Wf.applyOverridesToStudy)(this._study,e)}hasPlots(){return this._study.metaInfo().plots.length>0}dataLength(){if(this._study.status().type!==gh.StudyStatusType.Completed)return 0;return this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){const e=this._study.status();return e.type===gh.StudyStatusType.Undefined||e.type===gh.StudyStatusType.Loading}hasError(){return this._study.status().type===gh.StudyStatusType.Error}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,ty.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}setProperties(e){this._study.properties().mergeAndFire(e)}async applyToEntireLayout(){const{ActionsProvider:e}=await(0,Go.actionsProviderModule)();if(this._isStudyDestroyed)return;const t=new e(this._chartWidget),i=(await t.contextMenuActionsForSources([this._study],(0,n.ensureNotNull)(this._chartWidget.model().paneForSource(this._study)))).find((e=>"applyStudyToEntireLayout"===e.id));i&&i.execute()}status(){return{
+...this._study.status()}}title(){return this._study.title(pa.TitleDisplayTarget.StatusLine)}symbolsResolved(){return this._study.symbolsResolved()}study(){return this._study}}const sy=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function oy(e){const t=sy.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function ny(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}const ry=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class ay{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(e,t){return this._source.properties().state(ry,e,t)}setProperties(e,t){(0,yi.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,yi.allowSavingDefaults)(!1)}getPoints(){let e=this._source.points();const t=oy(this._source);return e.length>t&&((0,n.assert)(ny(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;const t=oy(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource())),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}getAnchoredPosition(){return this._source.positionPercents()}setAnchoredPosition(e){const t=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void 0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void 0===t||null===i||null===s)return;const o={logical:s,screen:t},n=new Map;n.set(i,e),this._model.startMovingSources([this._source],o,null,new Map),this._model.moveSources(o,n),this._model.endMovingSources(!0)}ownerSourceId(){return(0,n.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;const i=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){
+return this._source.isSourceHidden()}getRawPoints(){return this._source.points()}getNormalizedPoints(){return this._source.normalizedPoints()}setRawPoint(e,t){this._model.startChangingLinetool(this._source,(0,n.ensureNotNull)(this._source.ownerSource()),{...t},e),this._model.changeLinePoint({...t}),this._model.endChangingLinetool(!1)}move(e,t){this._model.startMovingSources([this._source],{logical:e,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(e))},null,new Map),this._model.moveSources({logical:t,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(t))},new Map),this._model.endMovingSources(!1)}dataAndViewsReady(){return this._source.dataAndViewsReady()}zorder(){return this._source.zorder()}symbol(){return this._source.properties().symbol.value()}currency(){return this._source.properties().currencyId.value()}unit(){return this._source.properties().unitId.value()}share(e){this._undoModel.shareLineTools([this._source],e)}setVisible(e,t=!1){this._undoModel.setProperty(this._source.properties().visible,e,null,t)}sharingMode(){return this._source.sharingMode().value()}lineDataSource(){return this._source}template(){return this._source.template()}}class ly{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){return this._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&new la(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new ca(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new na(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new oa(this._model,this._series,null).redo()}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._series)&&this._undoModel.mergeSourceUp(this._series)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._series)&&this._undoModel.mergeSourceDown(this._series)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._series)&&this._undoModel.unmergeSourceUp(this._series)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._series)&&this._undoModel.unmergeSourceDown(this._series)}detachToRight(){new Tl(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new Tl(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new Tl(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){const t=(0,n.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":new Tl(this._model,this._series,t,"left",null).redo();break;case"new-right":new Tl(this._model,this._series,t,"right",null).redo();break;case"no-scale":(0,n.assert)(t.actionNoScaleIsEnabled(this._series),"Unable to leave a pane without any non-overlay price scale"),new Tl(this._model,this._series,t,"overlay",null).redo();break;default:const i=this._model.dataSourceForId(e)
+;if(null===i)throw new Error(`There is no study with entityId='${e}'`);const s=this._model.paneForSource(i)===t;(0,n.assert)(s,"Study should be on the main pane");const o=(0,n.ensureNotNull)(i.priceScale());new Pl(this._model,this._series,t,o,null).redo()}}isVisible(){return this._series.properties().childs().visible.value()}setVisible(e){this._series.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._series])}sendToBack(){this._model.sendToBack([this._series])}entityId(){return this._series.id()}chartStyleProperties(e,t){return t?this._series.properties().childs()[cy(e)].state():this._series.properties().childs()[cy(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[cy(e)].mergeAndFire(t)}barsCount(){return this._series.bars().size()}endOfData(){return this._series.endOfData()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}series(){return this._series}isLoading(){return this._series.isLoading()}isInReplay(){return this._series.isInReplay()}data(){return this._series.data()}priceScale(){return new qf(this._undoModel,this._series.priceScale())}seriesErrorMessage(){return this._series.seriesErrorMessage()}compositeStatusVW(){return this._series.compositeStatusVW()}properties(){return this._series.properties()}_pane(){return(0,n.ensureNotNull)(this._model.paneForSource(this._series))}}function cy(e){switch(e){case 0:return"barStyle";case 1:return"candleStyle";case 2:return"lineStyle";case 14:return"lineWithMarkersStyle";case 15:return"steplineStyle";case 3:return"areaStyle";case 16:return"hlcAreaStyle";case 4:return"renkoStyle";case 5:return"kagiStyle";case 6:return"pnfStyle";case 7:return"pbStyle";case 8:return"haStyle";case 9:return"hollowCandleStyle";case 10:return"baselineStyle";case 11:return"rangeStyle";case 12:return"hiloStyle";case 13:return"columnStyle";case 17:return"volFootprintStyle";case 18:return"tpoStyle";case 19:return"volCandlesStyle";case 20:return"svpStyle";case 21:return"hlcBarsStyle";default:(0,n.ensureNever)(e)}throw new Error(`unsupported chart style: ${e}`)}var hy=i(32112);function dy(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:o,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||o||n)}function uy(e,t){e.isLoading()&&!e.isFailed()||t(e.isFailed());const i=e.seriesSource().symbolInstanceId(),s=e.dataEvents(),o=e.symbolParams(),n=()=>{s.completed().unsubscribe(null,r),(dy(e,o)||e.seriesSource().symbolInstanceId()===i)&&t(!1)},r=()=>{s.error().unsubscribe(null,n),(dy(e,o)||e.seriesSource().symbolInstanceId()===i)&&t(!0)};s.completed().subscribe(null,n,!0),s.error().subscribe(null,r,!0)}class _y{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,
+n.ensureDefined)(this._groupById(e));return(0,vi.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._model.dataSourceForId(t));(0,n.assert)((0,zs.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}addShapeToGroup(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._model.dataSourceForId(t));(0,n.assert)((0,zs.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,s)}availableZOrderOperations(e){const t=(0,n.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){const i=(0,n.ensureDefined)(this._groupById(e)),s=(0,n.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,n.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,n.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,n.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,zs.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}var py=i(18041);const my=new dt.TranslatedString("change price to bar ratio",a.t(null,void 0,i(2509))),gy=new dt.TranslatedString("toggle lock scale",a.t(null,void 0,i(49695)));function fy(e,t){return t.map((t=>(0,n.ensureNotNull)(e.dataSourceForId(t))))}class yy{constructor(e,t){this._visibleBarsChanged=new ae.Delegate,this._crosshairMoved=new ae.Delegate,this._dataSourceHovered=new ae.Delegate,this._ranges=null,this._zoomUndoStackIsNotEmpty=null,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap,this._selectionApi=null,this._lollipopSourcesApi=null,this._prevVisibleRange=null,this._prevHoveredSourceId=null,this._onSymbolChangedDelegate=new ae.Delegate,this._chartWidget=e,this._activateChart=t,this._timezoneApi=new Gf(e),this._chartWidget.withModel(this,(()=>{
+this._chartWidget.model().crosshairSource().moved().subscribe(this,this._onCrosshairMoved),this._chartWidget.model().model().hoveredSourceChanged().subscribe(this,this._onHoveredSourceChanged),this._chartWidget.model().timeScale().logicalRangeChanged().subscribe(this,this._onLogicalRangeChanged),this._chartWidget.model().mainSeries().dataEvents().symbolResolved().subscribe(this,this._onSymbolChanged)})),this._widgetLinkingGroupIndex=e.linkingGroupIndex().spawn(),this._widgetLinkingGroupIndex.subscribe((e=>this._apiLinkingGroupIndex.setValue(e))),this._apiLinkingGroupIndex=new O.WatchedValue(this._widgetLinkingGroupIndex.value()),this._apiLinkingGroupIndex.subscribe((e=>{this._widgetLinkingGroupIndex.value()!==e&&(this._chartWidget.hasModel()?this._chartWidget.model().setLinkingGroupIndex(e):this._widgetLinkingGroupIndex.setValue(e))})),this._chartWidget.onAboutToBeDestroyed().subscribe(this,this._destroy,!0)}setActive(){this._activateChart()}getPriceToBarRatio(){return this._chartWidget.model().model().mainSeriesScaleRatioProperty().value()}setPriceToBarRatio(e,t){const i=this._chartWidget.model(),s=i.model(),o=s.mainSeriesScaleRatioProperty();t?.disableUndo?new gp(o,e,null,s).redo():i.setScaleRatioProperty(o,e,my)}isPriceToBarRatioLocked(){return this._chartWidget.model().model().mainSeries().priceScale().isLockScale()}setPriceToBarRatioLocked(e,t){const i=this._chartWidget.model(),s=i.model(),o=s.mainSeries().priceScale();t?.disableUndo?new Nl({lockScale:e},o,null,s).redo():i.setPriceScaleMode({lockScale:e},o,gy)}id(){return this._chartWidget.id()}onDataLoaded(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())}onSymbolChanged(){return this._makeSubscriptionFromDelegate(this._onSymbolChangedDelegate)}onIntervalChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())}onVisibleRangeChanged(){return this._makeSubscriptionFromDelegate(this._visibleBarsChanged)}onChartTypeChanged(){const e=this._chartWidget.model().mainSeries().onStyleChanged();return this._makeSubscriptionFromDelegate(e)}onSeriesTimeframe(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesTimeFrame())}onSeriesError(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesError())}dataReady(e){const t=!this._chartWidget.hasModel()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t}whenChartReady(e){this._chartWidget.withModel(this,e)}crossHairMoved(){return this._makeSubscriptionFromDelegate(this._crosshairMoved)}onHoveredSourceChanged(){return this._makeSubscriptionFromDelegate(this._dataSourceHovered)}setVisibleRange(e,t){return new Promise(((i,s)=>{const o=e=>{clearTimeout(n),s(e)},n=setTimeout((()=>o(new Error("Rejected by timeout"))),t?.rejectByTimeout??1e4);this._chartWidget.setVisibleTimeRange(e.from,e.to,t,(()=>{clearTimeout(n),i()
+}),o)}))}async setSymbol(e,t){(0,tt.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s,initiatorName:o="chart api"}=t||{};if(e===this.symbol()||this._chartWidget.hasModel()&&this._chartWidget.model().mainSeries().symbolSameAsResolved(e))return i?.(),!0;s||this._activateChart();const n=this._chartWidget.chartWidgetCollection(),r=await n.setSymbol(e,void 0,this._chartWidget);return r&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}async setResolution(e,t){(0,tt.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s,initiatorName:o="Chart api"}=t||{},n=Re.Interval.normalize(e);if(null===n||n===this.resolution())return i?.(),!0;s||this._activateChart();const r=await this._chartWidget.chartWidgetCollection().setResolution(n,void 0,this._chartWidget);return r&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}async setChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)return t?.(),!0;const i=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);return uy(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllShapes(){return this._chartWidget.model().model().allLineTools().map($f).filter((e=>null!==e.name))}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(Kf)}getStudyTemplateSnapshot(e,t,i){return(0,py.getStudyTemplateSaveData)(e,this._chartWidget.model().model(),t,i)}getStudyTemplateDescString(){const e=(0,py.getStudyTemplateMetaInfo)(this._chartWidget.model().model());return(0,py.getStudyTemplateDescString)(e.indicators)}async applyStudyTemplateByRecord(e){if(!e)return;const{name:t,id:i,is_default:s}=e,o=e=>this._chartWidget.model().applyStudyTemplate(JSON.parse(e.content),t);s?await z.backend.getStandardStudyTemplateById(i,o):await z.backend.getStudyTemplateById(i).then(o)}chartTemplate(){return this._chartWidget.model().model().template()}applyChartTempalte(e){this._chartWidget.chartWidgetCollection().applyTheme(e)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.hasMaximizedPane()){let t=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));const s=i/t;return e.map((e=>Math.round(e.stretchFactor()/s*100)/100))}return e.map((e=>e.height()))}setAllPanesHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,n.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");const s=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{const o=e*s;i[t].setStretchFactor(o)})),t.fullUpdate()}maximizeChart(){
+this._chartWidget.requestFullscreen()}isMaximized(){return this._chartWidget.inFullscreen()}restoreChart(){this._chartWidget.exitFullscreen()}restoreChartPreferences(){this._chartWidget.model().restorePreferences()}availableZOrderOperations(e){const t=fy(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}bringForward(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}insertAfter(e,t){const i=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertAfter(s,o)}insertBefore(e,t){const i=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertBefore(s,o)}sessions(){return this._chartWidget.model().model().sessions()?.get()??null}chartModel(){return this._chartWidget.model().model()}chartUndoModel(){return this._chartWidget.model()}chartWidget(){return this._chartWidget}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");const i=this._chartWidget.model().model().dataSourceForId(e);if(!i)return;const s=i.properties();s&&s.visible&&s.visible.setValue(t)}async createStudy(e,t,i,s,o,n){if("function"==typeof o)return console.warn('"createStudy" does not take "callback" parameter anymore'),Promise.resolve(null);if(n=n||{},"string"!=typeof e)return this._createStudy(e);e=e.toLowerCase();const r=await(0,os.studyMetaInfoRepository)().findAllJavaStudies(),a=ns.StudyMetaInfo.findStudyMetaInfoByDescription(r,e);if(n.checkLimit){const e=this._chartWidget.model().canCreateStudy({id:a.id});if(!e.success)return(0,wr.showTooManyStudiesNotice)(e.limitValue),Promise.resolve(null)}const l=(n.disableUndo?this._chartWidget.model().model():this._chartWidget.model()).createStudyInserter({type:"java",studyId:a.id},[]);if(l.setForceOverlay(!!t),n.priceScale&&l.setPreferredPriceScale(function(e){switch(e){case"no-scale":return"overlay";case"as-series":return"as-series";case"new-left":return"left";case"new-right":return"right";default:throw new Error(`The pricescale "${e}" is invalid, the only valid options are "no-scale", "as-series", "new-left" and "new-right".`)}}(n.priceScale)),n.allowChangeCurrency&&l.setAllowChangeCurrency(!0),n.allowChangeUnit&&l.setAllowChangeUnit(!0),Array.isArray(s)){console.warn("Passing study inputs as an ordered array is now deprecated. Please use an object where keys correspond to the inputs of your study instead.");const e={};for(let t=0;tPromise.resolve({inputs:s||{},parentSources:[]
+}))).then((e=>(o&&(0,Wf.applyOverridesToStudy)(e,o),i&&e.setUserEditEnabled(!1),e.id())))}waitForStudyCreated(e){return this._chartWidget.model().model().waitForStudy(e)}compileFailedStudies(){return this._chartWidget.model().model().studiesWV().value().filter((e=>e.isPine()&&e.hasCompileError()))}getStudyById(e){const t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw new Error("There is no such study");return this._getStudyApi(t)}getSeries(){const e=this._chartWidget.model(),t=e.mainSeries();return new ly(t,e)}createShape(e,t){return this._createMultipointShape(this._convertUserPointsToDataSource([e]),t)}async createMultipointShape(e,t){return this._createMultipointShape(this._convertUserPointsToDataSource(e),t)}getShapeById(e){const t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw new Error("There is no such shape");return this._getLineDataSourceApi(t)}removeEntity(e,t){const i=this._chartWidget.model().model().dataSourceForId(e);i?t&&t.disableUndo?$r(this._chartWidget.model().model(),[i]):this._chartWidget.model().removeSource(i,!0,!0):console.warn(`Can't find a source with id: ${e}`)}removeEntityWithUndo(e){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.model().removeSource(t,!1)}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}selection(){return null===this._selectionApi&&(this._selectionApi=new hy.SelectionApi(this._chartWidget.model().model())),this._selectionApi}showPropertiesDialog(e){const t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error(`Study or shape ${e} does not exist`);this._chartWidget.showChartPropertiesForSource(t)}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}drawOnAllCharts(e){(0,mt.drawOnAllCharts)().setValue(e)}createOrderLine(){throw new Error("createOrderLine is only available on Trading Platform")}createPositionLine(){throw new Error("createPositionLine is only available on Trading Platform")}createExecutionShape(){throw new Error("createExecutionShape is only available on Trading Platform")}symbol(){return this._chartWidget.symbolWV().value()}symbolExt(){const e=this._chartWidget.model().mainSeries().symbolInfo();if(null===e)return null;const t=((e,t)=>{const i={};return t.forEach((t=>{void 0!==e[t]&&(i[t]=e[t])})),i
+})(e,["name","base_name","ticker","description","long_description","type","session","session_display","session_holidays","corrections","exchange","exchange","listed_exchange","timezone","format","pricescale","minmov","fractional","minmove2","variable_tick_size","has_intraday","supported_resolutions","intraday_multipliers","has_seconds","has_ticks","seconds_multipliers","has_daily","daily_multipliers","has_weekly_and_monthly","weekly_multipliers","monthly_multipliers","has_empty_bars","visible_plots_set","volume_precision","data_status","delay","expired","expiration_date","sector","industry","currency_code","original_currency_code","unit_id","original_unit_id","unit_conversion_types","subsession_id","subsessions","price_source_id","price_sources","logo_urls","exchange_logo","pro_name","library_custom_fields"]);return t.pro_name=e.pro_name,t}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){const e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const s=i.firstBar(),o=i.lastBar(),r=this._convertIndexToPublicTime(o);if(null===r)return e;const a=Math.max((0,n.ensureNotNull)(t.points().range().value()).firstIndex,s);return e.from=(0,n.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=r,e}getVisibleBarsRange(){const e=this._chartWidget.model().timeScale(),t=e.visibleBarsStrictRange();if(null===t)return null;const i=this._convertIndexToPublicTime(t.firstBar()),s=t.lastBar()-Math.max(0,Math.ceil(e.rightOffset())),o=this._convertIndexToPublicTime(s);return null===i||null===o?null:{from:i,to:o}}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())return null;return this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){return this._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){return this._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){return this._chartWidget.getTimezone()}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!l.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),
+Promise.all([i.e(2578),i.e(9498)]).then(i.bind(i,99207)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}setDragExportEnabled(e){l.enabled("chart_drag_export")?this._chartWidget.model().model().setDragExportEnabled(e):console.error("feature is not enabled")}canZoomOut(){return!this._chartWidget.model().zoomStack().isEmpty()}canZoomOutWV(){if(!this._zoomUndoStackIsNotEmpty){const e=new O.WatchedValue(!1);this._zoomUndoStackIsNotEmpty=e.spawn(),this._chartWidget.withModel(this,(()=>{const t=this._chartWidget.model().zoomStack();t.onChange().subscribe(this,(()=>e.setValue(!t.isEmpty())))}))}return this._zoomUndoStackIsNotEmpty.readonly()}zoomOut(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}shapesGroupController(){return new _y(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==mt.SelectPointMode.None}requestSelectBar(){return this.isSelectBarRequested()?Promise.reject("already requested"):new Promise(((e,t)=>{this._chartWidget.requestSelectPoint({pointType:"time"}).then((t=>{e(this._convertTimeToPublic((0,n.ensureDefined)(t.point.time)))})).catch((()=>{t("cancelled")}))}))}cancelSelectBar(){this.isSelectBarRequested()&&this._chartWidget.cancelRequestSelectPoint()}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return zf(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return function(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return e.startOfBar(0)/1e3}(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=()=>new Error(`Cannot create "${t.shape}" shape`),s=t.shape;if(Nf(s)&&!0!==Of[s].isAnchored)throw console.warn(`${s} is not an anchored shape. It can be created using createShape or createMultipointShape`),i();const o=this._chartWidget.model().model(),n=o.mainSeries();if(o.timeScale().isEmpty())throw i();const r=void 0!==t.ownerStudyId?o.dataSourceForId(t.ownerStudyId):n,a=this._convertPositionPercentToDataSource(e,r);if(null===a)throw i();return this._createMultipointShape([a],t)}properties(){return this._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);return t.cloneLineTools([i],!1)[0]}shareLineTools(e,t){
+const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}getLollipopSourcesApi(){throw new Error("getLollipopSourcesApi is not supported")}clickAtLatestUpdatesLollipop(){throw new Error("clickAtLatestUpdatesLollipop is not supported")}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}chartProto(){return kg.prototype}ranges(){throw new Error("not implemented")}getTimeScale(){return new Uf(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,Vf.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}async syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();if(i)return t.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e=1,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");const s=i??!0,o=(0,n.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,s);return delete o.clientId,o}async applyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,n.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,n.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}studyMetaIntoRepository(){return(0,os.studyMetaInfoRepository)()}replayStatus(){return this._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){return this._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s,o){return this._chartWidget.model().insertStudyWithoutCheck(new ns.StudyMetaInfo(e,o),t,i,s)}copyEntityToClipboard(e){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([t])}pasteFromClipboard(){this._chartWidget.chartWidgetCollection().clipboard.uiRequestPaste()}inactivityGaps(){return this._chartWidget.model().model().inactivityGaps()}setInactivityGapsSession(e){this._chartWidget.model().model().setInactivityGapsSession(e)}_destroy(){this._zoomUndoStackIsNotEmpty?.destroy(),this._chartWidget.hasModel()&&(this._chartWidget.model().crosshairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged),this._chartWidget.model().zoomStack().onChange().unsubscribeAll(this)),this._chartWidget.modelCreated().unsubscribeAll(this),this._widgetLinkingGroupIndex.destroy()}async _createTradingPrimitive(e){const t=this._chartWidget.model(),i=t.model(),s=(0,
+n.ensureNotNull)(i.paneForSource(i.mainSeries()));await(0,xo.ensureLineToolLoaded)(e);const o={pane:s,point:(()=>{const e=(0,n.ensureNotNull)(t.mainSeries().bars().last());return{index:e.index,price:e.value[4],interval:i.mainSeries().interval()}})(),linetool:e,actionSource:"API"};return i.createLineTool(o).adapter()}_createStudy(e){return Promise.reject("Pine Script® and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToDataSource(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),o=t.firstValue();if(null==o||!isFinite(o)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width());return{price:s.coordinateToPrice(e.y*s.height(),o),index:n}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),o=i.data();if(t.timeScale().isEmpty())return null;const r=e.map((e=>e.time||0)),a=this._alignPoints(r),l=(e,t,r)=>{const a=s.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,n.ensureNotNull)(s.valueAt(a)),h=(0,n.ensureNotNull)(s.range().value());if(e>c&&a===h.lastIndex){const t=(0,n.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(enew Error(`Cannot create "${s.shape}" shape`),s=Object.assign({},{filled:!0},t),o=Of[s.shape]||Of.flag;const r=this._chartWidget.model().model(),a=r.mainSeries();if(r.timeScale().isEmpty())throw i();const l=void 0!==s.ownerStudyId?r.dataSourceForId(s.ownerStudyId)??a:a,c=r.paneForSource(l);if(null===e||null===c)throw i();if(o.onlySelectable)throw new Error(`Cannot create "${s.shape}" shape`);if("LineToolIcon"===o.name){const e=s;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!s.hasOwnProperty("icon"))throw new Error("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}await(0,xo.ensureLineToolLoaded)(o.name);const h=(0,zs.createLineToolProperties)(r.backgroundTheme().spawnOwnership(),o.name,!r.readOnly());if((0,zs.prepareLineToolPropertiesByOwnerSource)(h,l),s.overrides)for(const e in s.overrides)h.hasChild(e)?(0,n.ensureDefined)(h.child(e)).mergeAndFire(s.overrides[e]):ny(o.name)&&-1!==["profitLevel","stopLevel"].indexOf(e)&&h.addProperty(e,s.overrides[e]);let d;void 0!==h.hasChild("text")&&s.text&&(0,n.ensureDefined)(h.child("text")).setValue(s.text),h.hasChild("filled")&&s.filled&&(0,n.ensureDefined)(h.child("filled")).setValue(!0),
+d=s.disableUndo?this._chartWidget.model().model():this._chartWidget.model();const u=d.createLineTool({pane:c,point:e[0],linetool:o.name,properties:h,ownerSource:l,actionSource:"API"});if(null===u)throw h.destroy(),i();if(u.properties()!==h&&h.destroy(),ny(o.name)){if(e.length>2)throw new Error(`Wrong points count for ${s.shape}. Required 1 or 2`);2===e.length&&(u.startChanging(1,e[1]),u.setPoint(1,e[1]),u.endChanging(!0,!1))}else{const t=u.pointsCount();if(t!==e.length&&-1!==t)throw new Error(`Wrong points count for ${s.shape}. Required ${t}`);const i=new To.EnvironmentState(void 0,!0),n=(0,Lt.isLineDrawnWithPressedButton)(o.name);for(let t=1;te.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));c.entityValues[t.id()]={isHovered:s,values:o,title:i.header()}}this._crosshairMoved.fire(c)}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}
+_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,n.ensureNotNull)(e.mainSeries().symbolInfo()),s=e.mainSeries().interval(),o=new Cd.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,Td.newBarBuilder)(s,o,o),intervalObj:Re.Interval.parse(s)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new Xf(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new iy(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new ay(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,n.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),o=i.symbolInfo();if(t.timeScale().isEmpty()||!Re.Interval.isDWM(s)||null===o)return e;const n=(0,Jd.createDwmAligner)(s,o);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=this.getVisibleRange();null!==this._prevVisibleRange&&(0,tt.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!l.enabled("saveload_separate_drawings_storage"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}_onSymbolChanged(e){var t;this._onSymbolChangedDelegate.fire({name:(t=e).name,base_name:t.base_name,ticker:t.ticker,description:t.description,long_description:t.long_description,type:t.type,session:t.session,session_display:t.session_display,session_holidays:t.session_holidays,corrections:t.corrections,exchange:t.exchange,listed_exchange:t.listed_exchange,timezone:t.timezone,format:t.format,pricescale:t.pricescale,minmov:t.minmov,fractional:t.fractional,minmove2:t.minmove2,variable_tick_size:t.variable_tick_size,has_intraday:t.has_intraday,supported_resolutions:t.supported_resolutions,intraday_multipliers:t.intraday_multipliers,has_seconds:t.has_seconds,has_ticks:t["is-tickbars-available"],seconds_multipliers:t.seconds_multipliers,build_seconds_from_ticks:t.build_seconds_from_ticks,has_daily:t.has_daily,daily_multipliers:t.daily_multipliers,has_weekly_and_monthly:t.has_weekly_and_monthly,weekly_multipliers:t.weekly_multipliers,monthly_multipliers:t.monthly_multipliers,has_empty_bars:t.has_empty_bars,visible_plots_set:t.visible_plots_set,volume_precision:t.volume_precision,data_status:t.data_status,
+delay:t.delay,expired:t.expired,expiration_date:t.expiration_date,sector:t.sector,industry:t.industry,currency_code:t.currency_code,original_currency_code:t.original_currency_code,unit_id:t.unit_id,original_unit_id:t.original_unit_id,unit_conversion_types:t.unit_conversion_types,subsession_id:t.subsession_id,subsessions:t.subsessions,price_source_id:t.price_source_id,price_sources:t.source2?[t.source2]:[],logo_urls:t.library_custom_fields?.logo_urls,exchange_logo:t.library_custom_fields?.exchange_logo,library_custom_fields:t.library_custom_fields})}}var vy=i(52092);class Sy{loginRequired(){throw new Error("Not implemented")}onGoProDialog(e,t){throw new Error("Not implemented")}}function by(){throw new Error("not implemented")}function wy(e){const t=new O.WatchedValue(e.value()),i=t=>{(0,yi.allowSavingDefaults)(!0),e.setValue(t),(0,yi.allowSavingDefaults)(!1)};return t.subscribe(i),e.subscribe(t,(()=>{t.setValue(e.value())})),t.spawn((()=>{e.unsubscribeAll(t),t.unsubscribe(i)}))}class Cy extends Sy{constructor(e){super(),this.linking=de.linking,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._studyTemplatesDrawer=null,this._fontIconsSettingsDrawer=null,this._favoriteDrawingsToolbar=null,this._webview=null,this._activeChartWidgetWV=new O.WatchedValue(null),this._activeChartRangeState=new Bf.WatchedObject({ranges:[]}),this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null,this._chartWidgets=new WeakMap,this._layoutSettingsDrawer=null,this._magnetEnabledWV=null,this._magnetModeWV=null,this._magnetSnapsToIndicatorsWV=null,this._drawOnAllCharts=(0,ye.convertPropertyToWatchedValue)((0,mt.drawOnAllCharts)()),this._replayApi=null,this._pineEditorApi=null,this._backtestingStrategyApi=null,this._supportTicketData=null,this._activeChartWidgetChangedDelegate=new ae.Delegate,this._alerts=null,this._activateChart=e=>{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:n,sharingChartService:r=null,webview:a=null,favoriteServices:l,alertsServices:c,supportTicketData:h=null}=e;this._chartApiInstance=t,this._chartWidgetCollection=i,this._studyMarket=s,this._saveChartService=o,this._sharingChartService=r,this._loadChartService=n,this._favoriteServices=l,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=de.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=a,this._alertService=null,this._supportTicketData=h;const d=i.lock;this._symbolSync=d.symbol.spawn(),this._intervalSync=d.interval.spawn(),this._dateRangeSync=d.dateRange.spawn(),this._crosshairSync=d.crosshair.spawn(),
+this._timeSync=d.trackTime.spawn(),this._chartWidgetCollection.activeChartWidget.subscribe((()=>this._onActiveChartChanged()),{callWithLast:!0}),ee.subscribe("toggle_currency_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_currency_menu",...e)}),this),ee.subscribe("toggle_unit_menu_inner",((...e)=>{this._toggleUnitConversionMenu("toggle_unit_menu",...e)}),this)}destroy(){this._supportedChartStylesSpawn.destroy(),this._intervalsService?.destroy(),this._themesApi?.destroy(),this._widgebarApi?.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),this._pineEditorApi?.destroy(),this._isDestroyed=!0,this._magnetEnabledWV?.destroy(),this._magnetModeWV?.destroy(),this._magnetSnapsToIndicatorsWV?.destroy(),ee.unsubscribeAll("toggle_currency_menu_inner",this),ee.unsubscribeAll("toggle_unit_menu_inner",this)}themes(){return null===this._themesApi&&(this._themesApi=new Rf({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:this._saveChartService?.getSaveAsController()??null,ChartLayoutRename:this._saveChartService?.getRenameController()??null,ChartLayoutCreate:this._saveChartService?.getCreateController()??null,ChartLayoutLoad:this._loadChartService,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){ee.subscribe(e,t,void 0)}unsubscribe(e,t){ee.unsubscribe(e,t,void 0)}onActiveChartChanged(){return this._activeChartWidgetChangedDelegate}webview(){return by(),this._webview}connect(){by()}disconnect(){by()}onConnectionStatusChanged(e){by()}isConnected(){by()}supportTicketData(){return this._supportTicketData}setPublishChartOptions(e){by()}publishChart(e){by()}studyTemplatesDrawerApi(){by()}fontIconsSettingsDrawer(){by()}intervalsService(){by()}alertService(){by()}async alerts(){by()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,mt.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,mt.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,mt.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,mt.drawOnAllChartsMode)().setValue(e)}currencies(){return this._chartApiInstance?.availableCurrencies()??Promise.reject()}units(){return this._chartApiInstance?.availableUnits()??Promise.reject()}disableTrackingEvents(){(0,re.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync}
+crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){by()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}*charts(){for(let e=0;e=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){by()}setWatchlistApiPromise(e){by()}news(){by()}setNewsApiPromise(e){by()}widgetbar(){by()}
+setWidgetbarApiPromise(e){by()}getChartStorage(){return getChartStorage()}setDebugMode(e){l.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?l.setEnabled(e,t):lu.addPlusButtonProperty.setValue(t)}magnetEnabled(){return null===this._magnetEnabledWV&&(this._magnetEnabledWV=wy((0,mt.properties)().childs().magnet)),this._magnetEnabledWV}magnetMode(){return null===this._magnetModeWV&&(this._magnetModeWV=wy((0,mt.properties)().childs().magnetMode)),this._magnetModeWV}magnetSnapsToIndicators(){return null===this._magnetSnapsToIndicatorsWV&&(this._magnetSnapsToIndicatorsWV=wy((0,mt.properties)().childs().magnetSnapsToIndicators)),this._magnetSnapsToIndicatorsWV}flushBufferedData(){Ff.fire()}chartWidgetCollectionState(e){return this._chartWidgetCollection.state(e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}watermark(){{const e=P_.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){Cy.setContextMenuOptions(e)}changeSymbol(e,t,i,s="API"){de.linking.setIntervalAndLogInitiator((0,n.ensureNotNull)(Re.Interval.normalize(t)),s),de.linking.setSymbolAndLogInitiator(e,s),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}closePopupsAndDialogs(){Io.ContextMenuManager.hideAll(),ee.emit(vy.CLOSE_POPUPS_AND_DIALOGS_COMMAND)}startFullscreen(){return this._chartWidgetCollection.startFullscreen()}exitFullscreen(){return this._chartWidgetCollection.exitFullscreen()}getFavoriteChartStylesService(){by()}getFavoriteIntervalsService(){by()}getFavoriteCurrencyUnitConversionApi(){by()}getIntervals(){let e=[];const t=(0,ht.getCustomResolutions)();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),(0,ht.mergeResolutions)(e,t)}getLinetoolsFavoritesStore(){by()}getSavedCharts(e){z.backend.getCharts().then(e)}getStudiesList(){return(0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata().filter((e=>!e.is_hidden_study)).map((e=>e.description))}getStudyInputs(e){return Qf(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getStudyStyles(e){return ey(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return e?.(t),t}hasChartChanges(){return this._chartWidgetCollection.hasChanges()}async loadChart(e){{this._chartApiInstance?.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name));const t=await this._chartWidgetCollection.loadContent(e.json);this._chartWidgetCollection.unloadUnusedCharts(),this._chartApiInstance?.connect(),de.linking.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),ee.emit("chart_loaded"),
+t.contentMigrated&&ee.emit("chart_migrated")}}async loadChartFromServer(e){await(this._loadChartService?.loadChart(e,!1))}async loadLayoutFromServerByLayoutId(e,t,i){await(this._loadChartService?.loadChartByUrl(e,!!t,i))}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}async createNewLayout(e){by()}lockAllDrawingTools(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new O.WatchedValue((0,mt.lockDrawings)().value()),this._lockDrawingsWatchedValue.subscribe((e=>{(0,mt.lockDrawings)().setValue(e)})),(0,mt.lockDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._lockDrawingsWatchedValue).setValue((0,mt.lockDrawings)().value())}))),this._lockDrawingsWatchedValue}hideAllDrawingTools(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new O.WatchedValue((0,mt.hideAllDrawings)().value()),this._hideDrawingsWatchedValue.subscribe((e=>{(0,mt.hideAllDrawings)().setValue(e)})),(0,mt.hideAllDrawings)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideDrawingsWatchedValue).setValue((0,mt.hideAllDrawings)().value())}))),this._hideDrawingsWatchedValue}hideAllIndicators(){return null===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=new O.WatchedValue((0,mt.hideAllIndicators)().value()),this._hideIndicatorsWatchedValue.subscribe((e=>{(0,mt.hideAllIndicators)().setValue(e)})),(0,mt.hideAllIndicators)().subscribe(this,(()=>{(0,n.ensureNotNull)(this._hideIndicatorsWatchedValue).setValue((0,mt.hideAllIndicators)().value())}))),this._hideIndicatorsWatchedValue}logs(){return{getLogHistory:ne.getLogHistory,enable:window.lon,disable:window.loff}}mainSeriesPriceFormatter(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}onContextMenu(e){ee.subscribe("onContextMenu",(t=>{t.callback(e(t.unixtime,t.price))}),void 0)}onGrayedObjectClicked(e){ee.subscribe("onGrayedObjectClicked",e,void 0)}removeChartFromServer(e,t){z.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;const i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}selectedLineTool(){const e=Object.keys(Of),t=mt.tool.value();for(let i=0;i{t&&(t(e),t=null)};(0,j.showConfirm)({title:e.title,text:e.body||"",onClose:()=>{i(!1)},onConfirm:e=>{i(!0),e.dialogClose()}})}showLoadChartDialog(){this._loadChartService?.showLoadDialog()}persistentLogger(){return null}showNoticeDialog(e){(0,j.showWarning)({title:e.title,text:e.body||"",onClose:e.callback})}showSupportDialog(){by()}showSaveAsChartDialog(){const e=this._saveChartService;e&&window.runOrSignIn((()=>{e.saveChartAs()}),{source:"Save as chart dialogue"})}showRenameChartDialog(){by()}saveChartOrShowTitleDialog(e,t,i){by()}showCreateAlertDialog(){by()}createGoProDialog(e){by()}setUserInfo(e){by()}openMobileChartPicker(){by()}closeMobileChartPicker(){by()}takeClientScreenshot(e){return this._chartWidgetCollection.clientSnapshot(e)}takeScreenshot(){return this._chartWidgetCollection.takeScreenshot()}trading(){by()}waitTrading(){by()}viewMode(){by()}viewModeWatchedValue(){by()}async dummyBrokerController(){return Promise.reject("Not implemented")}pineLibApi(){return by(),{saveNew,saveNext,requestBuiltinScripts}}resetCache(){(0,r.getChartingLibraryGlobalContext)().ChartApiInstance.resetCache()}getSymbolAliasService(){throw new Error("not supported")}static setContextMenuOptions(e){void 0!==e.items_processor&&Io.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&Io.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new yy(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}_toggleUnitConversionMenu(e,t,i,s,o){if(t)return void ee.emit(e,t,-1,-1,"");const r=this._chartWidgetCollection.getAll(),a=r.findIndex((e=>e.model().model().id()===i));if(-1===a)return;const l=(0,n.ensureDefined)(r[a]).paneWidgets().findIndex((e=>e.state().id()===s));-1!==l&&ee.emit(e,t,a,l,o)}_onBeforeActiveChartChanged(){0}_onActiveChartChanged(){this._onBeforeActiveChartChanged(),this._activeChartWidgetWV.setValue(this.activeChart()),this._activeChartWidgetChangedDelegate.fire(),this._onAfterActiveChartChanged()}_onAfterActiveChartChanged(){this._updateActiveChartRangeState()}_updateActiveChartRangeState(){0}}i(4783),i(45);var Ty=i(78136),Py=i(19979);const xy={ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",br:"br",ru:"ru",sv_SE:"se",th_TH:"th",tr:"tr",uk:"uk",vi_VN:"vn",zh_CN:"cn",zh_TW:"tw"};function My(e){return xy[e]||"www"}var Iy=i(33065),Ay=i(70893),Ly=i(50946);i(59449);const ky={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-cold-gray-900"],
+shadow:Rt.colorsPalette["color-cold-gray-700"],text:Rt.colorsPalette["color-white"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-cold-gray-800"],20),logo:Rt.colorsPalette["color-white"],platformBgColor:Rt.colorsPalette["color-cold-gray-900"],platformFgColor:Rt.colorsPalette["color-cold-gray-200"]},Ey={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-white"],shadow:Rt.colorsPalette["color-cold-gray-150"],text:Rt.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-white"],20),logo:Rt.colorsPalette["color-cold-gray-900"],platformBgColor:Rt.colorsPalette["color-white"],platformFgColor:Rt.colorsPalette["color-cold-gray-900"]};const Dy=new Map([["logo-old-style",Ly],["tradingview-old-style",Ay]]),By=l.enabled("adaptive_logo"),Vy=l.enabled("small_no_display"),Ry=l.enabled("38914"),Ny="site_branding",Oy="widget_branding",Fy="widget_referral_branding",Wy="widget_custom_branding",Hy="widget_custom_no_powered_branding",zy="fundamental_branding",Uy="fundamental_custom_branding",jy="fundamental_custom_no_powered_branding",Gy="library_branding",qy="library_custom_branding",$y="library_custom_no_powered_branding",Ky=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Yy=window.urlParams||{},Zy=window.initData||{};Yy.no_referral_id&&enable(Yy.referral_id||"","aggressive");const Xy=a.t(null,void 0,i(98856)),Jy=Ry?a.t(null,void 0,i(44676)):a.t(null,void 0,i(92800));a.t(null,void 0,i(46768)),a.t(null,void 0,i(83470)),a.t(null,void 0,i(3140));var Qy;!function(e){e[e.OldFontAdditionalVerticalOffset=0]="OldFontAdditionalVerticalOffset",e[e.NewFontAdditionalVerticalOffset=.1]="NewFontAdditionalVerticalOffset",e[e.StrokeWidth=4]="StrokeWidth",e[e.StaticLogoHorizontalTextOffset=5]="StaticLogoHorizontalTextOffset",e[e.TextWidthCompensation=2]="TextWidthCompensation",e[e.AdaptiveWidthToHideText=500]="AdaptiveWidthToHideText",e[e.WidthToHideLogoIfSmallNoDisplayEnabled=480]="WidthToHideLogoIfSmallNoDisplayEnabled",e[e.TextAdditionalCropWidth=11]="TextAdditionalCropWidth",e[e.BadgeLogoMargin=-11]="BadgeLogoMargin",e[e.BadgeTextMargin=-8]="BadgeTextMargin",e[e.TextAnimatedAlphaStart=.3]="TextAnimatedAlphaStart",e[e.TextAnimatedAlphaEnd=1]="TextAnimatedAlphaEnd",e[e.AnimationDuration=200]="AnimationDuration"}(Qy||(Qy={}));(0,ze.onWidget)();class ev extends Ad.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Ny,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._tradingviewLogoLinkToPath="",this._cubicBezier=new br.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this)
+;this._visible.subscribe(s),this._dark=t.dark().spawn(),this._dark.subscribe(s),this._checkLayout(),this._layout!==Wy&&this._layout!==Uy||(this._left=8,this._bottom=5);const o=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,Ol.default)(o,200),o(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Hy&&this._layout!==jy)return[];if(!this._visible.value())return[];if(this._layout===Ny&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=this._model.mainPane();if(!t)return[];const i=l.enabled("move_logo_to_main_pane");let s=!1;if(e.maximized().value())s=!0;else if(i)s=t.collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane().value();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes();for(let i=t.length-1;i>=0;--i){const o=t[i];if(!o.collapsed().value()){s=o===e;break}}}else s=e.isLast();return s?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e){return this._paneHeight=e.mediaSize.height,this._canvasWidth=e.mediaSize.width,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Hy&&this._layout!==jy&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new Ut.HitTestResult(Ut.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?ei.PaneCursorType.Pointer:ei.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){const e="https://"+function(e){return My(e)+".tradingview.com"}((Zy.querySettings?.locale??Zy.currentLocaleInfo?.language)||"en");let t=new URL(e);if(this._customLogoLink)return this._customLogoLink;if(this._layout===Gy||this._layout===qy){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"}
+this._tradingviewLogoLinkToPath&&(t.pathname=this._tradingviewLogoLinkToPath),t.searchParams.append("utm_source",window.location.origin),t.searchParams.append("utm_medium","library"),e&&t.searchParams.append("utm_campaign",e)}return t.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Yy.utm=!0,(0,Kt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new rv(this._layout,e?.name||"",this._model,(()=>this._model.fullUpdate())),this._custom=new av(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null,this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Yy.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"),l.enabled("link_to_tradingview")?this._layout=qy:this._layout=$y):(e.tradingviewLogoLinkToPath&&(this._tradingviewLogoLinkToPath=e.tradingviewLogoLinkToPath.replace(/^\//,"")),this._layout=Gy,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){if(null!==this._openAnimation)return;null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._openAnimation=(0,xr.doAnimate)({from:e,to:1,duration:200*(1-e),easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_startCloseAnimation(){if(null!==this._closeAnimation)return;null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._closeAnimation=(0,xr.doAnimate)({from:e,to:0,duration:200*e,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if((0,ze.isSymphonyEmbed)())return!1;if(this._layout===Ny)return this._model.isSnapshot()||this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function tv(e){return!Vy||e>480}function iv(e){return!By||e>500}let sv={},ov={};class nv{constructor(){this._topLeftPoint=null,this._hitTestHeight=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,Gt.pointInBox)(e,t)}_getHitTestBox(){const e=this._topLeftPoint;if(e){const{x:t,y:i}=e;return(0,
+Vt.box)(e,new Vt.Point(t+this.width,i+(this._hitTestHeight??this.height)))}}}class rv extends nv{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._textAnimatedAlpha=1,this._textAnimatedAlphaStart=1,this._textAdditionalCropWidth=0,this._textAnimatedAlphaEnd=1,this._badgeData={logoMargin:0,textMargin:0,width:0},this._invertTextCropDirection=!1,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._maximizedAnimationTextWidth=0,this._logoWidth=0,this._textWidthCache=new Qt.TextWidthCache,this._pixelRatio={horizontalPixelRatio:NaN,verticalPixelRatio:NaN},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||e===Oy,this._alwaysMaximized=l.enabled("logo_always_maximized")||this._model.isSnapshot()&&!ze.CheckMobile.any()||!1,this._fontSize=this._showAnimatedBranding||this._layout===Fy?11:14,this._showAnimatedBranding||this._layout!==Wy&&this._layout!==Uy||(this._fontSize=12),this._sizeConstants=(this._model.isSnapshot(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,logoTextOffset:6}),this.width=this._minimizedAnimationWidth(),this._animatedWidth=this.width,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}animationStep(){const e=this._minimizedAnimationWidth(),t=this._maximizedAnimationWidth();return(this._animatedWidth-e)/(t-e)}animatedDrawStep(e){const t=this._minimizedAnimationWidth(),i=this._maximizedAnimationWidth();this._animatedWidth=t+e*(i-t),this._textAnimatedAlpha=this._textAnimatedAlphaStart+e*(this._textAnimatedAlphaEnd-this._textAnimatedAlphaStart)}draw(e,t,i,s){const{brandCircleSize:o,logoLeftOffset:n,leftOffset:r,bottomOffset:a}=this._sizeConstants;this._needDisplayImage&&tv(s)&&(e=new Vt.Point(e.x+r,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y);const{horizontalPixelRatio:l,verticalPixelRatio:c}=i;(0,Iy.equalPixelRatios)(i,this._pixelRatio)||(this._textWidthCache.reset(),this._pixelRatio={horizontalPixelRatio:l,verticalPixelRatio:c});const h=this._colors;if(this._showAnimatedBranding){if(this._needDisplayImage){const e=this._getLogoImage(h.logo);this.width=this._animatedWidth,this._drawLogo(t,e,this._animatedWidth,this._animatedWidth,this._animatedWidth>this._sizeConstants.brandCircleSize)}}else if(this._layout===Wy||this._layout===Uy){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),t.restore()}else if(tv(s))if(this._needDisplayImage){const e=this._getLogoImage(h.logo)
+;t.save(),this._drawBgCircle(t,o/2);const{width:i,height:r}=e.logoImage.viewBox(),a=new Vt.Point(Math.round((o-i)/2)-1+n,Math.floor((o-r)/2)+1);this._drawLogoImage(t,a,e.logoImage);const l=iv(s);l&&(t.translate(o+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=o,l&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=iv(s);e&&(t.save(),t.translate(Ky?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_minimizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._badgeData.logoMargin+this._badgeData.width}_maximizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._sizeConstants.logoTextOffset+this._maximizedAnimationTextWidth+this._badgeData.width+this._badgeData.textMargin}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,o){const{brandCircleSize:n,logoLeftOffset:r,logoTextOffset:a}=this._sizeConstants;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const{logoImage:l,textImage:c,proBadgeImage:h}=t,{width:d,height:u}=l.viewBox(),_=new Vt.Point(Math.round((n-d)/2)-1+r,Math.floor((n-u)/2)+1);if(o){const t=new Vt.Point(_.x+d+a,_.y),i=e.globalAlpha;e.globalAlpha*=this._textAnimatedAlpha;const o=s-this._sizeConstants.brandCircleSize-a-this._badgeData.logoMargin-this._badgeData.width;this._drawImageCropWidth(e,t,c,o),e.globalAlpha=i}if(h){const{width:t,height:i}=h.viewBox();h.render(e,{targetViewBox:{x:_.x+this.width-t,y:Math.floor((n-i)/2)+1,width:t,height:i}})}this._drawLogoImage(e,_,l),e.restore()}_init(){ov={},sv={},this._checkLayout(),this.show&&(this._updateColors(),this._updateHeight(),this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_updateHeight(){this._needDisplayImage?this.height=this._sizeConstants.brandCircleSize:this.height=this._fontSize+2}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){const e=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:0,height:0})),t=(0,Kt.getPrescaledContext2D)(e);t.font=this._fontSize+this._font;const i=this._needDisplayImage?this._getLogoImage(this._colors.logo):null;let s=i?i.textImage.viewBox().width+this._sizeConstants.textAsImageWidthCompensation:Math.ceil(t.measureText(this._txt).width)+2+8;s%2==0&&(s+=1),this._maximizedAnimationTextWidth=s,this._textWidthCache.reset(),this._logoWidth=i?.logoImage.viewBox().width??0,this._animatedWidth=this._alwaysMaximized?this._maximizedAnimationWidth():this._minimizedAnimationWidth()}_updateColors(){
+this._colors=this._model.dark().value()?ky:Ey}_getLogoImage(e){return function(e,t,i,s,o){const r=ov,a=[t,i,o&&"tradeWith"].filter(Boolean).join("-"),l=r[a];if(void 0!==l)return l;const[c,h,d]=function(e,t,i){return i?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style",void 0]}(0,0,o),u=e=>e.replace(/fill="#[\da-f]{6}"/gi,`fill="${i}"`),_={logoImage:e(u((0,n.ensureDefined)(Dy.get(c)))),textImage:e(u((0,n.ensureDefined)(Dy.get(h)))),proBadgeImage:d?e(u((0,n.ensureDefined)(Dy.get(d)))):void 0};return r[a]=_,_}(Mo.svgRenderer,this._model.dark().value()?"dark":"light",e,0,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case Oy:case Fy:case Wy:case zy:case Uy:case qy:case Gy:case Ny:this.show=!0;break;case Hy:case jy:case $y:this.show=!1}switch(this._layout){case Gy:this._needDisplayImage=!0,this._txt=Xy;break;case qy:this._txt=Jy}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save();const{logoMargin:o,textMargin:n}=this._badgeData;e.beginPath();const{width:r,height:a}=i.viewBox();e.rect(t.x-this._textAdditionalCropWidth,t.y,s+this._textAdditionalCropWidth,a),e.clip(),i.render(e,{targetViewBox:{x:t.x-(this._invertTextCropDirection?r-s-o+n:0),y:t.y,width:r,height:a}}),e.restore()}_drawBgCircle(e,t){const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,o,n,r){e.save(),(0,$t.drawRoundRect)(e,t-1,i-1,s+2,o+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,$t.drawRoundRect)(e,t,i,s,o,r??n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){const{width:s,height:o}=i.viewBox();i.render(e,{targetViewBox:{x:t.x,y:t.y,width:s,height:o}})}}class av extends nv{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){
+this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case Wy:case Hy:case Uy:case jy:case qy:case $y:this.show=!0;break;case Ny:case Oy:case Fy:case zy:case Gy:this.show=!1}}}var lv=i(55279),cv=i(48961);class hv{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var dv=i(68028);class uv{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class _v{symbol(e){return new uv(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new _v),this._instance}_model(){return dv.CustomStatusModel.getInstance()}}_v._instance=null;var pv=i(22692),mv=i(15754);var gv=i(23745),fv=i(10980),yv=i(43222);class vv{constructor(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new ae.Delegate,this.seriesError=new ae.Delegate}onSymbolResolved(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})}onSymbolError(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})}onStudyError(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})}onSeriesLoading(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})}onSeriesCompleted(e,t,i){this.beforeSeriesCompleted.fire(e,t),this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})}onSeriesError(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)}onStudyCompleted(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})}onStudyLoading(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})}onTickmarksUpdated(e,t){const i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)}onTimescaleUpdate(e,t){const i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex,clearTickMarks:e.clearTickMarks}]};this._server.receiveLocalResponse(i)}
+onTimescaleCompleted(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})}onSeriesTimeframeUpdate(e,t,i,s,o,n){const r={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,o]};this._server.receiveLocalResponse(r)}onPointsetDataUpdate(e,t,i){this.onDataUpdate(e,t,i,null)}onDataUpdate(e,t,i,s){const o={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(o)}onQuotesData(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})}onDepthData(e){this._server.receiveLocalResponse({method:"dd",params:e})}onDepthUpdate(e){this._server.receiveLocalResponse({method:"dpu",params:e})}onClearData(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})}_prepareDataUpdateObjects(e){const t={};return e.forEach((e=>{t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t}}class Sv{constructor(){this._instances=new Map}createChartApiMessager(e,t){const i=new vv(t,e);return this._instances.set(e,i),i}getChartApiMessager(e){return(0,n.ensureDefined)(this._instances.get(e),`ChartapiMessager instance for session ${e}`)}}const bv={blue:"#2962ff",gray:"#787B86",green:"#4CAF50",olive:"#808000",teal:"#00897B",new:(e,t)=>(0,Ro.applyTransparency)(e,t)},wv={hline:{style_dashed:qt.LINESTYLE_DASHED,style_dotted:qt.LINESTYLE_DOTTED,style_solid:qt.LINESTYLE_SOLID}},Cv={line:"line"};class Tv{get(e){return NaN}set(e){}indexOf(e){return NaN}adopt(e,t,i){return NaN}}var Pv=i(60911);class xv{constructor(e,t){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>this._ctx.symbol.isLastBar},this.input={bool:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("boolean"==typeof e,"Study input value should be a boolean"),e},int:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("number"==typeof e,"Study input value should be a number"),e},source:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)((e=>{switch(e){case"open":case"high":case"low":case"close":case"hl2":case"hlc3":case"ohlc4":return!0;default:return!1}})(e),"Study input value should be a series source"),this._ctx.new_var(Py.Std[e](this._ctx))},string:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a string"),e},symbol:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a symbol string"),e}},this.request={security:(e,t)=>{const i=this._symbolIndexByTickerId.get(e);this._addedTickerIds.has(e)||this._ctx.new_sym(e,Py.Std.period(this._ctx)),(0,n.assert)(void 0!==i,`Unknown tickerId ${e}`);const s=this._ctx.new_unlimited_var(Py.Std.time(this._ctx));this._ctx.select_sym(i)
+;const o=this._ctx.new_unlimited_var(Py.Std.time(this._ctx)),r=t?.expression?.()??this.close();return this._ctx.select_sym(0),this._ctx.new_var(r.adopt(o,s,0))}},this.runtime={error:e=>{Py.Std.error(e)}},this.math={max:(e,...t)=>{const i=e=>(0,Hd.isNumber)(e)?e:e.get(0),s=Math.max(i(e),...t.map(i));return(0,Hd.isNumber)(e)?s:this._ctx.new_var(s)},min:(e,...t)=>{const i=e=>(0,Hd.isNumber)(e)?e:e.get(0),s=Math.min(i(e),...t.map(i));return(0,Hd.isNumber)(e)?s:this._ctx.new_var(s)},negative:e=>(0,Hd.isNumber)(e)?-e:this._ctx.new_var(-e.get(0))},this.ta={change:e=>this._ctx.new_var(Py.Std.change(e)),correlation:(e,t,i)=>this._ctx.new_var(Py.Std.correlation(e,t,i,this._ctx)),cum:e=>this._ctx.new_var(Py.Std.cum(e.get(0),this._ctx)),ema:(e,t)=>this._ctx.new_var(Py.Std.ema(e,t,this._ctx)),rma:(e,t)=>this._ctx.new_var(Py.Std.rma(e,t,this._ctx)),sma:(e,t)=>this._ctx.new_var(Py.Std.sma(e,t,this._ctx)),vwap:(e,t,i)=>{const[s,o,n]=Py.Std.vwapBands(e,t,i,this._ctx);return[this._ctx.new_var(s),this._ctx.new_var(o),this._ctx.new_var(n)]},wma:(e,t)=>this._ctx.new_var(Py.Std.wma(e,t,this._ctx))},this.ticker={modify:(e,t)=>{let i;if((0,Pv.isEncodedExtendedSymbol)(e))i=e;else{const s={symbol:e,session:t};i=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(s)}return this._symbolIndexByTickerId.has(i)||this._symbolIndexByTickerId.set(i,++this._symbolIndex),i}},this.timeframe={change:e=>{if(isNaN(Py.Std.time(this._ctx)))return!1;const t=(0,Td.newBarBuilder)(e,this._ctx.symbol.session,null);t.moveTo(Py.Std.time(this._ctx));return 0===t.startOfBar(0)-Py.Std.time(this._ctx)},isDWM:()=>this._ctx.symbol.isdwm()},this._addedTickerIds=new Set,this._symbolIndexByTickerId=new Map,this._returnValues=[],this._ctx=e,this._inputCallback=t,this._inputIndex=0,this._symbolIndex=0}open(){return this._ctx.new_var(Py.Std.open(this._ctx))}high(){return this._ctx.new_var(Py.Std.high(this._ctx))}low(){return this._ctx.new_var(Py.Std.low(this._ctx))}close(){return this._ctx.new_var(Py.Std.close(this._ctx))}volume(){return this._ctx.new_var(Py.Std.volume(this._ctx))}year(){return Py.Std.year(this._ctx)}na(e){return!!Py.Std.na(e)}series(e){return this._ctx.new_var(e)}fill(e,t,i){}hline(e,t){return{id:""}}indicator(e){}plot(e,t){const i="number"==typeof e?e:e.get(0),s=void 0===t?.offset?i:{offset:t.offset,value:i};return this._returnValues.push(s),{id:""}}getReturnValues(){return this._returnValues}setMinimumAdditionalDepth(e){this._ctx.setMinimumAdditionalDepth(e)}}var Mv=i(18330);const Iv=e=>{switch(e){case"data_window":return Ts.InputDisplayFlags.DataWindow;case"none":return Ts.InputDisplayFlags.None;default:return Ts.InputDisplayFlags.All}},Av=e=>{switch(e){case"data_window":return 2;case"none":return 0;default:return 15}};class Lv{constructor(){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>!1},this.input={bool:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,inline:i?.inline,id:this._getNextInputId(),name:t,type:"bool"}),e),int:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,
+display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"integer"}),e),source:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"source"}),new Tv),string:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,options:i?.options,type:"text"}),e),symbol:(e,t,i)=>(this._input({confirm:i?.confirm,defval:e,display:Iv(i?.display),group:i?.group,id:this._getNextInputId(),inline:i?.inline,name:t,type:"symbol"}),e)},this.math={max:e=>(0,Hd.isNumber)(e)?0:new Tv,min:e=>(0,Hd.isNumber)(e)?0:new Tv,negative:e=>(0,Hd.isNumber)(e)?0:new Tv},this.ta={change:e=>new Tv,correlation:(e,t,i)=>new Tv,cum:e=>new Tv,ema:()=>new Tv,rma:()=>new Tv,sma:()=>new Tv,vwap:()=>[new Tv,new Tv,new Tv],wma:()=>new Tv},this.request={security:e=>(this._tickers.push(e),new Tv)},this.runtime={error:e=>{throw new Error(e)}},this.ticker={modify:()=>""},this.timeframe={change:()=>!1,isDWM:()=>!1},this._bands=[],this._defaults={},this._filledAreas=[],this._format={type:"inherit"},this._inputs=[],this._overlay=!1,this._plots=[],this._shortTitle="",this._styles={},this._tickers=[],this._title="",this._version=1}getStudyName(){return this._title}getStudyMetainfo(){var e,t;return{_metainfoVersion:53,bands:this._bands,defaults:this._defaults,description:this._title,filledAreas:this._filledAreas,format:this._format,id:(e=this._title,t=this._version,`${e}@tv-basicstudies-${t}`),inputs:this._inputs,is_price_study:this._overlay,palettes:{},plots:this._plots,shortDescription:this._shortTitle,styles:this._styles}}getTickers(){return this._tickers}open(){return new Tv}high(){return new Tv}low(){return new Tv}close(){return new Tv}volume(){return new Tv}year(){return 0}na(e){return!1}series(e){return new Tv}fill(e,t,i){const s=this._getNextFillId(),o=this._plots.some((t=>t.id===e.id)),n=this._plots.some((e=>e.id===t.id)),r=this._bands.some((t=>t.id===e.id)),a=this._bands.some((e=>e.id===t.id)),l=o&&n;l||r&&a||this.runtime.error(`Could not find pair of plots or pair of hlines with ids ${e.id} ${t.id}`);const c=l?"plot_plot":"hline_hline";this._filledAreas.push({fillgaps:!1,id:s,isHidden:!1,objAId:e.id,objBId:t.id,title:i?.title??(l?"Plots Background":"Hlines Background"),type:c}),void 0===this._defaults.filledAreasStyle&&(this._defaults.filledAreasStyle={}),this._defaults.filledAreasStyle[s]=(e=>{if((e=>void 0===e?.color)(e))return{bottomColor:e?.bottomColor,fillType:"gradient",topColor:e?.topColor,visible:"all"===e?.display};return{fillType:void 0,color:e?.color??"TODO",visible:"all"===e?.display}})(i)}hline(e,t){const i=this._getNextBandId();this._bands.push({id:i,isHidden:!1,name:t?.title??"Level"}),void 0===this._defaults.bands&&(this._defaults.bands=[]);const s={color:t?.color??"#808080",linestyle:t?.linestyle??wv.hline.style_dashed,linewidth:t?.linewidth??1,value:e,visible:"none"!==t?.display,name:""};return this._defaults.bands.push(s),{id:i}}
+indicator(e){void 0!==e.title&&(this._title=e.title),void 0!==e.shortTitle&&(this._shortTitle=e.shortTitle),void 0!==e.format&&(this._format={type:e.format,precision:e.precision}),void 0!==e.version&&(this._version=e.version),this._overlay=!!e.overlay}plot(e,t){const i=this._getNextPlotId();return this._plots.push({type:t?.style??"line",id:i}),void 0===this._defaults.styles&&(this._defaults.styles={}),this._defaults.styles[i]=(e=>{switch(e?.style){case void 0:case"line":return{color:e?.color??"#0496FF",display:Av(e?.display),linestyle:Mv.LineStyle.Solid,linewidth:e?.linewidth??1,plottype:jd.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0};default:throw new Error("")}})(t),this._styles[i]={isHidden:!1,joinPoints:!1,title:t?.title??"Plot"},{id:i}}setMinimumAdditionalDepth(e){}_input(e){this._inputs.push(e),void 0===this._defaults.inputs&&(this._defaults.inputs={}),this._defaults.inputs[e.id]=(0,n.ensureDefined)(e.defval,"study input default value")}_getNextInputId(){return`in_${this._inputs.length}`}_getNextPlotId(){return`plot_${this._plots.length}`}_getNextBandId(){return`hline_${this._bands.length}`}_getNextFillId(){return`fill_${this._filledAreas.length}`}}var kv=i(4659);class Ev{build(e){const t=new Lv;return e(t),{name:t.getStudyName(),metainfo:t.getStudyMetainfo(),constructor:class{main(t,i,s){try{const s=new xv(t,i);e(s);const o=s.getReturnValues();return 0===o.length?null:o}catch(e){Py.Std.error(this._getErrorMessage(e))}}_getErrorMessage(e){if(e instanceof kv.StudyError)throw e;return(e instanceof Error?e.message:null==e?"Unknown error":e.toString()).replace(/:/g,"")}}}}}const Dv={palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:13,fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies",defaults:{},linkedToSeries:!1};class Bv{constructor(){this._metainfoCache=[]}studiesMetadata(){return 0===this._metainfoCache.length&&(this._metainfoCache=(0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary.map((e=>new ns.StudyMetaInfo(e.metainfo))),this._metainfoCache.push(new ns.StudyMetaInfo(Dv))),this._metainfoCache}}var Vv=i(78966),Rv=i.n(Vv);class Nv{createMarketStatusWatcher(e,t,i,s){return new(Rv())(e,t,i,s)}}class Ov{constructor(e){this._studyLibrary=e}findStudyObject(e){e.endsWith("!")&&(e=e.slice(0,-1));const t=e.split("@")[0],i=this._studyLibrary.filter((i=>i.metainfo.id===e||i.metainfo.shortDescription===t));if(0===i.length)return null;return i[0]}}var Fv,Wv=i(63193),Hv=i(56052),zv=i(82433),Uv=i(47132),jv=i(16329);class Gv{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,
+this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,o=this.bars,n=o.length,r=s.time,a=0===n?NaN:o[n-1].time;0===n||a{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=window.setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)))
+;this._logWarning("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}resetCache(){this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null===e||l.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})}_logMessage(e,t){(l.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logWarning(e){console.warn(`${this._logMessagePrefix()}${e}`)}_logError(e){console.error(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(new Date).toISOString()} FEED [${this._symbolInfo.name}|${this._resolution}${e?"|"+e:""}${t?"|"+t:""}]: `}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._firstDataRequest=!0,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,n.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,Pt.lowerbound)(this._cache.bars,i,((e,t)=>e.time{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${$v(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){
+return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),qv(this._symbolInfo,this._resolution),this.resetCache.bind(this)),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(qv(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),$v(s.bars[0].time),$v(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,Pt.lowerbound)(this._cache.bars,t,((e,t)=>e.time{if(!this._destroyed)if(r)this._logMessage("getBars callback is already called before",!0);else{if(r=!0,e.length>0){const t=` [${$v(e[0].time)} ... ${$v(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${n}`)}else this._logMessage(`Receiving bars: barset is empty, requested range: ${n}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(r?this._logMessage("getBars callback is already called before",!0):(r=!0,this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))}))}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format($v(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?this._setEndOfData():this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())}_setEndOfData(){this._logMessage("EOD received"),this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?this._logWarning("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&this._setEndOfData()}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(l.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&this._logError(`Wrong bars values: all ${s.join(", ")} properties should be numbers`)}}_getExpectedBarPropertyNames(){switch(this._symbolInfo.visible_plots_set){case"c":return["close","time"];case"hlc":return["high","low","close","time"];default:return["high","low","open","close","time"]}}_putToCache(e){if(0===e.length)return!0
+;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}resetCache(){this._forEachThread(((e,t)=>t.resetCache()))}subscribe(e,t,i,s,o){const n=qv(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,o)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void this._logWarning("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):this._logWarning("Data thread doesnt exist: "+e)}_createThread(e,t){return new Kv(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,Jd.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}_logWarning(e){console.warn(`${(new Date).toISOString()} FEED: ${e}`)}}class Zv{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;se.id===Xv.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===Xv.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===Xv.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new jv.SessionsSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new jv.SessionsSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new jv.SessionsSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,Td.newBarBuilder)(this.period,e,t)}bartime(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,n.ensureDefined)(this.timezone,"symbol instrument timezone");let i=(0,Ce.utc_to_cal)(t,e);return i=this.session.spec.correctTradingDay(i),(0,Ce.cal_to_utc)(t,i)}lastbar(e){if(isNaN(e.time))return;let t=e.time;if(this.dwm_aligner){const e=(0,Ce.get_cal_from_unix_timestamp_ms)(this.dwm_aligner.sessionSrc().timezone,t);!this._shouldAlignDwmBarsToMainSeries||this.dwm_aligner.sessionTgt().spec.includesDay(e)?(this.dwm_aligner.moveTo(t),
+t=this.dwm_aligner.startOfBar(0)):this._canExtendTimeScale&&this.utcTimezone&&((0,Ce.set_hms)(e,0,0,0,0,this.utcTimezone),t=(0,Ce.cal_to_utc)(this.utcTimezone,e))}const i=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=(0,Hd.isNumber)(e.volume)&&e.volume>=0?e.volume:NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.projectionTime=e.projectionTime||NaN,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}class Qv{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e=0){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=Py.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){let e=Py.Std.na(this.mindepth)?Py.Std.max_series_default_size:Py.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new eS(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new tS(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}function iS(e){return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class sS{constructor(e,t,i,s,o,n,r,a,l,c,h){this._body=n,this._symbols=[],this._runner=o,this._inputCallback=a,this._out=r,this._nonseriesOut=l,this._ctx=new tS(this.add_sym(e,t,i,s,h,c)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var o;if(null!=s)if(null===(o=s)||Array.isArray(o)||"composite"!==o.type)this._processResult(s);else for(let e=0;e1&&this._runner.host.enableDwmAligning&&r.enable_dwm_aligning(this._symbols[0].session,r.session),r}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){this._symbols=null,this._ctx?.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;var i;this._out&&e&&(!isNaN(t.symbol.time)||iS(e))&&(iS(e)?(i=e,Array.isArray(i)||"projection"!==i.type||(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):!function(e){return!Array.isArray(e)&&("non_series_bars"===e.type||"projection"===e.type)}(e)?this._out(t.symbol,e):e.bars.forEach((e=>{this._out(t.symbol,e)})))}}class oS{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,o,n,r){const a=new Jv(e,t,i,s,o,r,n);return this._symbols.push(a),a}get_sym(e){return this._symbols[e]}out(e,t){if(this._nonseriesUpdate){const i=Object.assign({},this._nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;const e=this.host,t=new sS(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],s=this._symbols,o=Object.assign({},e.dataRange,{countBack:(e.dataRange.countBack??0)+this._script.maxAdditionalDepth()
+}),r=s[0],a=(t,s,o)=>{i.push(e.datafeed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,o,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))},l=(t,i)=>{"series"===(i.nonseries?"nonseries":"series")?this.update(t,i):i.lastBar?(this._nonseriesUpdate=i,i.lastBar.isLastBar=!0,"projection"===i.type&&(i.lastBar.projectionTime=i.lastBar.time),this._symbols[0].lastbar(i.lastBar),this._nonseriesUpdate=null):e.nonseriesOut(s[0],i)},c=()=>o;a(r,c,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{function i(i,s){let o=(0,Jd.createTimeToBarTimeAligner)(i,s)(e);const r=(0,Jd.createDwmAligner)(i,s);return null!==r&&(o=r.timeToExchangeTradingDay(o)),{to:o,countBack:(0,n.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(let e=1;e=0;t--){const i=e[t],s=this._barsets[t],o=s.count();for(let e=0;ee.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof kv.StudyError))throw e;this.host.onErrorCallback(e.message,e.title)}}}class nS{constructor(e){this.runner=new oS(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}class rS{constructor(e,t,i,s,o,n,r,a,l,c,h){this.listeners=t,this._isRecalculated=!1,this._symbolInfo=a,this.engine=new nS({datafeed:e,tickerid:i,currencyCode:s,unitId:o,subsessionId:h,period:n,body:r,sessionId:c,symbolInfo:a,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,input:()=>{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){
+this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new Gv(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){const i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const s={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},o=t[7];this._barset||(this._barset=new Gv((0,n.ensureDefined)(e.info,"bar builder item output symbol info")));const r=t[8],a=t[9];if(r instanceof Array&&a)for(let e=0;e{o&&e.regular_session&&(e.session=e.regular_session),this._subs=this._host.subscribe(e,s,a,(e=>{this.listeners.fire(e)}),(e=>{this.listeners.onError(e)}))}),(e=>{this.listeners.onError(e)}))}stop(){this._subs&&this._host.unsubscribe(this._subs)}}var hS=i(99955);class dS{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,Td.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,Td.newBarBuilder)(this._period,e.symbol.session,null):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(0,n.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,s=t.alignTime(i),o=e.new_var(s),r=Py.Std.na(s),a=o.get(1),l=Py.Std.na(a)?1:Py.Std.neq(s,a),c=e.new_var(),h=e.new_var(),d=e.new_var(),u=e.new_var(),_=c.get(1),p=h.get(1),m=d.get(1),g=u.get(1),f=r?NaN:l?Py.Std.open(e):_,y=r?NaN:l?Py.Std.high(e):Py.Std.max(Py.Std.high(e),p),v=r?NaN:l?Py.Std.low(e):Py.Std.min(Py.Std.low(e),m),S=r?NaN:Py.Std.close(e),b=r?NaN:l?Py.Std.volume(e):Py.Std.volume(e)+g,w=r?NaN:i,C=e.symbol.isBarClosed&&t.isLastBar(0,i),T=this._generateEmptyBars&&l?this._extrapolate(a,s):void 0,P=e.new_var(Py.Std.close(e)).get(1),x=T instanceof Array?P:NaN;return c.set(f),h.set(y),d.set(v),u.set(b),[s,f,y,v,S,b,w,C,T,x]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(0,hS.extrapolateBarsFrontToTime)((0,n.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}
+const uS=e=>{console.error(e),Py.Std.error(e)},_S=Re.Interval.parse("1M").inMilliseconds(0);class pS{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,o,n,r,a,l,c,h){const d=l(r),u=((e,t,i,s,o,n,r,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(o.has_empty_bars?"_":"")+"_"+r.countBack+"_"+r.to+"_"+Boolean(a))(e,t,i,s,r,a,d,c,h);let _=this._getCache(u);return _||(_=this._createItem(e,t,i,s,r,d,a,c,h),this._putCache(u,_)),_.listeners.addListener(o,n),{key:u,listener:o}}unsubscribe(e){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,n.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t{const s=mS(e,t,i),o=t(s);return void 0!==o?o:s}))}(e,t,i):(0,tt.isObject)(e)&&((0,tt.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((o=>{const n=mS(e[o],t,i),r=t(n);s[o]=void 0!==r?r:n})),s}(e,t,i):e}function gS(e,t,i){const s=mS(e,t,i),o=t(s)
+;return void 0!==o?o:s}var fS,yS=i(92211);function vS(e,t){return e.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit",e[e.ExtendedExtrapolateLimit=45e4]="ExtendedExtrapolateLimit"}(fS||(fS={}));class SS{constructor(e,t,i){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=Re.Interval.parse(t),this._extrapolateLimit=i??(l.enabled("extended_extrapolation_limit")?45e4:2e5),this._session=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),this._barBuilder=(0,Td.newBarBuilder)(t,this._session,null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],s=this._barsTimes[this._barsTimes.length-1],o=i>s?this._barsTimes.length:(0,Pt.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,n.assert)(-1!==this._projectionFirstIndex,"something went wrong"),s!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this.ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this.timeOfBarIndex(i.index+t,0);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&ðis._lastRealBarTimeMs){this.ensureExtrapolatedToFutureTime(e);let t=(0,Pt.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,n.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs){const e=this.timeOfBarIndex(0,0);return null===e?null:{index:0,timeMs:e.timeMs}}return null}let t=(0,Pt.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||vS(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t;return this._calculateBarPattern(s,e,null)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),
+t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:ethis._extrapolateLimit)break;c++}return r}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length)||[];return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,n.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,e,this._futureBarsCache[0]-1,this._extrapolateLimit,!0).times;this._futureBarsCache=t.concat(this._futureBarsCache)}_extendHistoryCacheToTimeFromRight(e){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs>=e)return;if((0,n.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||vS(this._futureBarsCache,this._extrapolateLimit))&&(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t,o=e-i;return this._calculateBarPattern(s,null,o)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times)))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||vS(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,hS.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){
+null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||vS(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}function bS(e){return 60*e*60*1e3}function wS(e){return 60*e*1e3}const CS=[{divisor:1,weight:18},{divisor:(TS=1,1e3*TS),weight:19},{divisor:wS(1),weight:20},{divisor:wS(5),weight:21},{divisor:wS(30),weight:22},{divisor:bS(1),weight:30},{divisor:bS(3),weight:31},{divisor:bS(6),weight:32},{divisor:bS(12),weight:33}];var TS,PS;function xS(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=CS.length-1;e>=0;--e)if(Math.floor(i/CS[e].divisor)!==Math.floor(s/CS[e].divisor))return CS[e].weight}return 18}function MS(e,t,i=0){if(0===e.length)return[];let s=i,o=i;const n=[];for(;s=t.length?(n.push({old:s,new:Fh.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[o].timeMs?(s!==o&&n.push({old:s,new:o}),s++,o++):e[s].timeMs{if(e.new===t.new&&e.new===Fh.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===Fh.INVALID_TIME_POINT_INDEX)return-1;if(t.new===Fh.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function IS(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}!function(e){e[e.FutureTickMarksLimit=1e3]="FutureTickMarksLimit"}(PS||(PS={}));class AS{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[],this._needRebuildEndOfPeriod=l.enabled("end_of_period_timescale_marks"),this._shouldAlignDwmBarsToMainSeries=l.enabled("align_dwm_bars_to_main_series")}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,Pt.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const s=[];for(let t=e;tIS(e,i+t)));return s.concat(o)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,Ce.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,Pt.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;s=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return Fh.INVALID_TIME_POINT_INDEX;s=t.timeMs!==e?t.index+1:t.index}return(!t||o>0&&e<=r[o-1])&&(0,n.assert)(s>i,"data must have unique sorted times"),i=s,s}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceStudyBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}replaceBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t,i){
+return this._setBarsTimes(e,t,i)}_setBarsTimes(e,t,i){const s=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),s&&this._cleanupPointsData(this._sortedTimePoints);const o=[];this._pointDataByTimePoint.forEach(((e,t)=>{o.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),o.sort(((e,t)=>e.timeMs-t.timeMs));const n=this._updateTimeScalePoints(o);return this._applyTimeScaleChanges(n,i||!1)}_replaceInstanceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this._setBarsTimes(e,t);const i=[],s=(0,Pt.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const r=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const o={index:0,instances:t};this._pointDataByTimePoint.set(i,o),null!==s&&s.push({timeMs:i,pointData:o})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,Pt.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==o.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=LS(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const o=MS(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===Fh.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let o=0;for(;t+o1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=xS(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0),clearTickMarks:!0}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0};const s=[];for(let t=e.pointsIndex;t[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["backgrounds",e=>[e.start,e.stop]]]),ES=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);class DS{main(e){return[Py.Std.open(e),Py.Std.high(e),Py.Std.low(e),Py.Std.close(e),Py.Std.volume(e),Py.Std.updatetime(e),void 0,void 0,void 0,void 0]}}const BS=(0,ne.getLogger)("ChartApi.PointsetsManager");class VS{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,o){let n=this._pointsetsDataBySymbol.get(t);void 0===n&&(n=new Map,this._pointsetsDataBySymbol.set(t,n));const r=[];for(const t of s){const[s,n,a]=t;if("number"!=typeof s||Number.isNaN(s)){BS.logWarn(`Pointset time is invalid: id=${e}, ${s} of type ${typeof s}`);continue}const l=o(a||i);r.push({point:t,extrapolation:l.extrapolateTimeWithOffsetToTime(1e3*s,n)})}s.length===r.length&&n.set(e,{resolution:i,points:r})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(Re.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const o=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const r=this._refreshPointsetData(e,t,i,s);null!==r&&o.set(n,r)})),o}_refreshPointsetData(e,t,i,s){if(Re.Interval.isEqual(e.resolution,t))for(let s=0;s ${t}`),null;o.push({index:i,value:[r.index,r.timeMs/1e3]})}return o}}const RS=-5e6,NS="pre_post_market_sessions",OS=l.enabled(NS),FS=l.enabled("pay_attention_to_ticker_not_symbol");class WS{constructor(e,t,i,s){this._chartApiMessagerProvider=t,this._marketStatusWatcherProvider=i,this._studyLibrary=s,this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},
+this._barsCoefficientsCache={},this._externalDatafeed=e,(0,gc.default)(e.getVolumeProfileResolutionForPeriod)&&(0,Uv.overwriteVolumeProfileResolutionForPeriodGetter)(((t,i,s,o)=>(0,n.ensure)(e.getVolumeProfileResolutionForPeriod)(t,i,s,o))),this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,this._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),this._datafeedConfiguration=function(e){const t=(0,tt.merge)({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;const s=[];for(let e=0;e{this._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo={},this._depthInfo={},this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new Yv(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout);const o=(e,t,i)=>{const s=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),o=(0,Td.newBarBuilder)(t,s,s);return e=>{if(e&&e.count()){const t=1e3*this.getCurrentUTCTime();o.moveTo(t),o.indexOfBar(t)>=0&&e.setLastBarClosed(!1)}i(e)}};this._pineDatafeed=new pS({resolve:(e,t,i,s)=>{this._resolveSymbolByName(e,t,(e=>i(JS(e))),s)},subscribe:(e,t,i,s,n)=>this._cachedDatafeed.subscribe(e,t,i,o(e,t,s),(e=>n(e??"Unknown datafeed error"))),unsubscribe:e=>this._cachedDatafeed.unsubscribe(e)})}destroy(){for(const e of Object.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(const e of Object.keys(this._pointsetsManagers))this._pointsetsManagers[e].destroy();this._quotesInfo={},this._pointsetsManagers={}}purgeCache(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((e=>{this._pointsetsManagers[e].destroy()})),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((e=>{this._timeScales[e].destroy()})),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((e=>{this._symbolExtrapolators[e].destroy()})),this._symbolExtrapolators={}}purgeDataCache(){this._cachedDatafeed.purgeCache()}resetCache(){this._cachedDatafeed.resetCache()}serverTimeOffset(){return this._serverTimeOffset}getCurrentUTCTime(){return(new Date).valueOf()/1e3+this._serverTimeOffset}serverTime(){return 1e3*this.getCurrentUTCTime()}switchTimezone(e,t){
+this._timeScales[e].setTimezone(t);const i=this._timeScales[e].tickMarks();null!==i&&this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(0,i)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}supportedResolutions(){return this._datafeedConfiguration.supported_resolutions}supportedCurrencies(){return this._datafeedConfiguration.currency_codes||[]}supportedUnits(){return this._datafeedConfiguration.units||{}}supportedPriceSources(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(JS(e).price_sources)}),(e=>{i(e)}))}))}supportedSymbolsTypes(){return this._datafeedConfiguration.symbols_types||[]}symbolsGrouping(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}}getMarks(e,t,i,s,o){const r={red:6,green:5,blue:4,yellow:3};this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks&&(this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,n.ensure)(e.full_name),o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),this._externalDatafeed.getMarks(JS(e),t,i,(t=>{const i=t.map((e=>(e.time=Number(e.time),e)));this._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(i)));const a=(0,Jd.createDwmAligner)(o,e),c=l.enabled("two_character_bar_marks_labels"),h=i.map((e=>{const t=e;return t.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,t.direction=(0,et.default)(e.color)?r[e.color]:r.red,t.onClicked=()=>{ee.emit("onMarkClick",e.id)},t.label=e.label?c?e.label.slice(0,2):e.label[0]:"",t}));s(h)}),o))}getTimescaleMarks(e,t,i,s,o){this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks&&(this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format((0,n.ensure)(e.full_name),o,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),this._externalDatafeed.getTimescaleMarks(JS(e),t,i,(t=>{this._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format((0,n.ensure)(e.full_name),o,JSON.stringify(t)));const i=(0,Jd.createDwmAligner)(o,e),r=t.map((e=>{const t=e;return t.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,t}));s(r)}),o))}getSeriesLastBarTime(e,t){const i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs}getSeriesInterval(e,t){const i=this._studiesCache[e][t];return i?i.resolution:null}onSessionSeriesError(e){this.stopSources(e);const t=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}stopSources(e){for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}}getSeriesSymbolInfo(e,t){const i=this._studiesCache[e][t];return i?i.symbolInfo:null}modifySeries(e,t,i,s,o,r){const a=this._mainSeriesRecord(e);if(null===a||a.guid!==t){
+if(null!==a&&a.error)return this._studiesCache[e][t].symbolId=i,this._studiesCache[e][t].resolution=s,void(this._studiesCache[e][t].turnaround=o);this._stopSourcesTree(e,t),this.createSeries(e,t,o,i,s,{countBack:0},!0);for(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];if(s&&"study"===s.type&&s.parentId===t){this._studiesNonSeriesTimes[e][i]=null;const t=this._studiesCache[e][s.parentId];this._createStudy(t.symbolId,t.resolution,s.studyObject,e,i,s.turnaround,s.parentId,(0,n.ensure)(s.inputs))}}}else this._modifyMainSeries(e,i,s,o,r)}createStudy(e,t,i,s,o,n){const r=this._studiesCache[e][i],a=this._studyLibrary.findStudyObject(o);if(null===a)return $S("Study does not exist: "+o),void this._chartApiMessagerProvider.getChartApiMessager(e).onStudyError(t,s,"unknown study name");const l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i},this._studiesNonSeriesTimes[e][t]=null,this._createStudy(r.symbolId,r.resolution,l,e,t,s,i,n)}modifyStudy(e,t,i,s){const o=this._studiesCache[e][t];if(!o)throw Error("This should never happen");const n=this._studiesCache[e][o.parentId];o.inputs=s,o.turnaround=i,o.engine&&(o.engine.stop(),this._pineDatafeed.removeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(n.symbolId,n.resolution,o.studyObject,e,t,i,o.parentId,s)}sessionTimeScale(e){return this._timeScales[e]||null}isTimeScaleExtendedTo(e,t){const i=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(i.resolution)&&null!=i.symbolInfo){const e=(0,Jd.createDwmAligner)(i.resolution,i.symbolInfo);null!==e&&(t=e.timeToSessionStart(t))}const s=this._timeScales[e].indexOfTime(t);return null!==s&&s.index>=0}ensureExtendedTo(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");setTimeout((()=>{this._recreateSourcesForDataRange(t,{to:i})}),0)}extendSeriesRange(e,t){let i=this._timeScales[e].firstSeriesBarTime();if(null===i)return void this._logMessage("Nothing to extend - there is no points on time scale");const s=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(s.resolution)&&null!=s.symbolInfo){const e=(0,Jd.createDwmAligner)(s.resolution,s.symbolInfo);null!==e&&(i=e.timeToExchangeTradingDay(i))}const o=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s.symbolId))),r=this._barsCoefficients(o,s.resolution),a=r.barsCoefficient||1;if(!r.barsCoefficient){const i=this._getSeriesData(e,s.guid);null!==i&&(r.expectedBarsCount=i.length+t)}setTimeout((()=>{this._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}seriesTurnaround(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround}createSeries(e,t,i,s,o,r,a){this._setEndOfData(e,t,i,!1);const c=new DS;this._studiesCache[e]=this._studiesCache[e]||{};const h=this._getSeriesData(e,t),d=this._studiesCache[e][t],u=this._seriesCount(e),_=this._mainSeriesRecord(e),p=function(e){let{dataRange:t}=e
+;const{oldStudyRecord:i,resolution:s,symbolId:o,seriesCount:r,oldData:a,mainSeriesRecord:l,timeScales:c,session:h}=e;if(!i||Re.Interval.isEqual(i.resolution,s)&&i.symbolId===o)void 0!==t.countBack&&null!==a&&0!==a.length&&(t.to=a[0].timeMs),i&&null!=i.firstLoadedTimeMs?t.to=void 0!==t.to?Math.min(i.firstLoadedTimeMs,t.to):i.firstLoadedTimeMs:i||0===r||null!==l&&(null!=l.firstLoadedTimeMs?(t.to=l.firstLoadedTimeMs,t.countBack=0):t=Object.assign({},l.dataRange));else if(1===r)t=Object.assign({},i.initialDatarange);else{const e=c[h].firstSeriesBarTime();(void 0===t.to||null!==e&&e{const a=[];if(void 0!==r){const e=(r.data||[]).reduce(((e,t)=>Math.max(e,t[0]||0)),-1);if(null!=r.projectionTime)for(let t=0;t<=e;++t)a.push(r.projectionTime+t)}let l=null,c=null;const h=s?this._getSymbolExtrapolator(e,s,o):null;if(void 0!==n){const i=n.map((e=>e.timeMs)).concat(a);null!==h&&h.replaceBarsTimesTail(i,n.length),c=this._timeScales[e].replaceBarsTimesTail(t,i),l=n}else{const i=this._getSeriesData(e,t)||[],s=i.map((e=>e.timeMs)).concat(a);null!==h&&h.setBarsTimes(s,i.length),c=this._timeScales[e].setSeriesBarsTimes(t,s),l=i}if(this._applyTimeScaleUpdate(e,c),0===l.length&&void 0===r)return;this._timeScales[e].fillIndexesInRows(l);const d=void 0!==r?this._prepareSeriesNonSeriesData(e,t,r):null;this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,l,d)},g=s=>{const o=this._studiesCache[e][t];o.completed=!0,this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesError(t,i,s),l.enabled("clear_bars_on_series_error")&&(o.isMain?this.onSessionSeriesError(e):this._clearSeriesData(e,t))};this._computeStudy(e,c,s,o,t,[],p,jS(e,t),(function(){return-1/0}),{onDataReadyCallback:(r,l,c,h)=>{const d=this._studiesCache[e][t];if(!d)throw Error("This should never happen");if(d.symbolInfo=c,d.firstLoadedTimeMs=h.firstLoadedTimeMs,d.completed=!0,this._updateMainTsBuilder(e),a&&this._pointsetsManagers[e].invalidatePointsetsForSymbol(c.full_name,o),0!==r.length){const i=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s))),a=this._barsCoefficients(i,o);a.expectedBarsCount&&a.barsCount&&(a.barsCoefficient=Math.min(Math.max(a.barsCoefficient||1,Math.floor(a.expectedBarsCount/(r.length-a.barsCount)+.5)),100)),a.barsCount=r.length,this._clearSeriesData(e,t)}else!h.endOfData&&d.isMain&&setTimeout((()=>{
+this._studiesCache[e]&&this._recreateSourcesForDataRange(e,{countBack:10})}),0);m(c),h.endOfData&&(this._logMessage("Series has no more data on server: {0}".format(c.full_name)),this._setEndOfData(e,t,i)),0===r.length&&this._clearSeriesData(e,t),this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i,c.data_status),this._updateTimeScaleState(e)},onRealtimeCallback:(s,n,r,a,l)=>{m(l,s),this._timeScales[e].fillIndexesInRows(s);const c=s[s.length-1];if(n){if(!this._studiesCache[e][t])throw Error("This should never happen");this._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c)))}else this._logMessage("Last bar update: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c))),this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,s,null);this._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:e=>{this._logMessage("Series symbol resolve error: "+e),g(e||"resolve error")},onErrorCallback:e=>{this._logMessage("Series error: "+e),g(e)},onNonSeriesDataUpdate:(s,o)=>{if("projection"!==s.type)throw new Error("unexpected non-series data type for series "+s.type);const r=this._getSeriesData(e,t);if(null!==r)m((0,n.ensure)(o.info),0===r.length?void 0:[r[r.length-1]],s);else{const o=this._prepareSeriesNonSeriesData(e,t,s);this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,[],o)}}})}removeStudy(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),this._pineDatafeed.removeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setStudyBarsTimes(t,[],!0);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]}removeSeries(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}requestMoreTickmarks(e,t){const i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);const s=i.firstFutureBarIndex(),o=i.tickMarks(s);this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(s,o)}chartCreateSession(e){this._pointsetsManagers[e]=new VS,this._timeScales[e]=new AS,this._studiesNonSeriesTimes[e]={}}chartDeleteSession(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]}removePointset(e,t){this._pointsetsManagers[e].removePointset(t)}async createPointset(e,t,i,s,o){const n=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===n)return;let r;try{r=(await n).symbolInfo}catch(e){return}this._pointsetsManagers[e].createPointset(t,r.full_name,s,o,((t=s)=>this._getSymbolExtrapolator(e,r,t))),
+null===this._refreshPointsetsTimerId&&(this._refreshPointsetsTimerId=window.setTimeout((()=>{this._refreshPointsetsTimerId=null,this._refreshPointsets(this._invalidatedPointsetSessions),this._invalidatedPointsetSessions.clear()}),0)),this._invalidatedPointsetSessions.add(e)}searchSymbols(e,t,i,s,o){this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));this._externalDatafeed.searchSymbols(e,t,i,(e=>{this._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),e.forEach((e=>{XS(e.logo_urls,e.exchange_logo,e)})),s(e)}),o)}resolveSymbol(e,t,i){this._symbolIdToSymbolRequestString.set(US(e,t),i),this._resolvePromisesBySymbolId.set(US(e,t),new Promise(((s,o)=>{this._resolveSymbolImpl(i,(o=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolResolved(t,o),s({symbolInfo:o,requestedSymbol:i})}),(i=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolError(t,i),o(i)}))})))}quoteCreateSession(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}}quoteDeleteSession(e){this._stopQuotesSubscription(e),delete this._quotesInfo[e]}quoteSetFields(e,t){}quoteAddSymbols(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)}quoteRemoveSymbols(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((e=>t.indexOf(e)<0)),this._restartQuotesSubscription(e)}quoteFastSymbols(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)}quoteHibernateAll(e){}depthCreateSession(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}}depthDeleteSession(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]}depthSetSymbol(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)}hasStudyWithExtendedTimeScale(e){for(const t of this._getStudiesCacheSessionKeys(e)){if("study"===this._studiesCache[e][t].type&&this._studyCanExtendTimeScale(e,t))return!0}return!1}_stopDepthSubscription(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth?.(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)}_restartDepthSubscription(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)}_startDepthSubscription(e){const t=this._depthInfo[e].symbol;if(!t)return;const i=e=>e.map((e=>({p:e.price,v:e.volume}))),s=e=>({s:t,bids:i(e.bids),asks:i(e.asks)}),o=t=>{t.snapshot?this._chartApiMessagerProvider.getChartApiMessager(e).onDepthData([e,s(t)]):this._chartApiMessagerProvider.getChartApiMessager(e).onDepthUpdate([e,s(t)])};this._externalDatafeed.subscribeDepth&&(this._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(t,(t=>{this._depthInfo[e]&&o(t)})))}_restartQuotesSubscription(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)}async _startQuotesSubscription(e){const t={},i={},s=(t,i)=>{const s="ok"===t.s,o=this._marketStatusWatchers[e][t.n],n={...t,symbolname:t.n,status:t.s,values:{...t.v,change:s?t.v.ch:void 0,
+last_price:s?t.v.lp:void 0,change_percent:s?t.v.chp:void 0,current_session:s?t.v.cs:o&&o.marketStatus(),pricescale:i.pricescale,minmov:i.minmov,minmove2:i.minmove2||0,fractional:i.fractional||!1}};XS(i.logo_urls,i.exchange_logo,n.values),(o&&s?t.v.cs:void 0)&&o.stop(),this._chartApiMessagerProvider.getChartApiMessager(e).onQuotesData([e,n])},o=n=>{n.forEach((r=>{const a=r.n;if(i[a]?.size>0){const t=[...i[a]].map((e=>({...r,n:e})));if(l.enabled("charting_library_debug_mode")){const t=void 0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for symbol ${a} ${t}: ${JSON.stringify(n)}`)}setTimeout((()=>o(t)),0)}if(void 0!==t[r.n]&&null!==t[r.n])s(r,t[r.n]);else if(l.enabled("charting_library_debug_mode")){const t=void 0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for unexpected symbol ${a} ${t}: ${JSON.stringify(n)}`)}}))},r=async e=>{try{const[s,o]=KS(e),r=await new Promise(((e,t)=>{this._resolveSymbolByName(s,o,e,t)})),a=(0,n.ensure)(r.ticker);return t[a]=t[e]=JS(r),a===e?a:(void 0===i[a]&&(i[a]=new Set),a!==e&&i[a].add(e),a)}catch{return null}},a=async e=>[...new Set((await Promise.all([...new Set(e)].map(r))).filter((e=>null!==e)))];if(this._externalDatafeed.getQuotes&&!l.enabled("charting_library")){const[t,i]=await Promise.all([a(this._quotesInfo[e].symbols),a(this._quotesInfo[e].fastSymbols)]),s={};if(l.enabled("charting_library_debug_mode")){const e=WS.debugGetQuotesRequestId++;this._logMessage(`QUOTES Requesting data for symbols ${JSON.stringify(t)} with request ID ${e}`);for(const i of t){const t=1e4;s[i]=window.setTimeout((()=>{this._logMessage(`QUOTES Timeout after waiting ${t/1e3} seconds for data symbol ${i} with request ID ${e}`)}),t)}}this._externalDatafeed.getQuotes(t,(n=>{if(l.enabled("charting_library_debug_mode"))for(const e of n)void 0!==s[e.n]&&clearTimeout(s[e.n]),delete s[e.n];this._quotesInfo[e]&&0!==this._quotesInfo[e].symbols.length&&(o(n),this._quotesInfo[e].listenerGUID=e,l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Subscribing listenerGUID ${this._quotesInfo[e].listenerGUID} to data for symbols ${JSON.stringify(t)} and fast symbols ${JSON.stringify(i)}`),this._externalDatafeed.subscribeQuotes(t,i,o,this._quotesInfo[e].listenerGUID))}),(e=>{this._logMessage(`QUOTES Error getting data for symbols ${JSON.stringify(t)}: ${e}`)}))}else!this._externalDatafeed.getQuotes&&l.enabled("trading_terminal")&&setTimeout((()=>{o(this._quotesInfo[e].symbols.map((e=>({n:e,s:"ok",v:{}}))))}));this._createMarketStatusWatchers(e,this._quotesInfo[e].symbols)}_createMarketStatusWatchers(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;ithis._resolveSymbolByName(t,i,r,(o=>{
+$S(`Error resolving for market status watcher ${qS(t,i.currency,i.unit,i.session)}:\n${o}`),this.quoteRemoveSymbols(e,[s]),a(o)}))),e,s,this._chartApiMessagerProvider)}}}_filteredSymbols(e){const t=[];return e.forEach((e=>{e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t}_refreshPointsets(e){e.forEach((e=>{const t=this._studiesCache[e];if(null==t)return;let i=null;for(const e of Object.keys(t)){const s=t[e];if("series"===s.type){i=s;break}}if(null===i||null==i.symbolInfo)return;const s=i.symbolInfo;this._pointsetsManagers[e].getUpdatesForSymbol(i.symbolInfo.full_name,i.resolution,((t=i.resolution)=>this._getSymbolExtrapolator(e,s,t)),this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}))}_recreateSourcesForDataRange(e,t){const i=[];for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];if(o&&"series"===o.type&&!this._isEndOfData(e,s,o.turnaround)&&(this._stopSourcesTree(e,s),i.push(s)),o&&"study"===o.type&&this._studyCanExtendTimeScale(e,s)&&!this._isEndOfData(e,s,o.turnaround)){const i=this._studiesCache[e][(0,n.ensure)(o.parentId)];o.dataRange=t,this._createStudy(i.symbolId,i.resolution,o.studyObject,e,s,o.turnaround,(0,n.ensure)(o.parentId),(0,n.ensure)(o.inputs))}}i.forEach((i=>{this._startSourcesTree(e,i,Object.assign({},t))}));for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];"series"===i.type&&this._isEndOfData(e,t,i.turnaround)&&this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesCompleted(t,i.turnaround,(0,n.ensure)(i.engine).runner.host.symbolInfo.data_status)}this._updateTimeScaleState(e)}_startSourcesTree(e,t,i){const s=this._studiesCache[e][t];this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0);for(const i of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][i];o&&"study"===o.type&&o.parentId===t&&this._createStudy(s.symbolId,s.resolution,o.studyObject,e,i,o.turnaround,o.parentId,(0,n.ensure)(o.inputs))}}_clearSeriesData(e,t){const i={};i[t]={turnaround:this._studiesCache[e][t].turnaround};for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];"study"===o.type&&this._studyCanExtendTimeScale(e,s)||("study"!==o.type||o.parentId!==t||this._studyCanExtendTimeScale(e,s)||(i[s]={turnaround:o.turnaround}))}this._chartApiMessagerProvider.getChartApiMessager(e).onClearData(i)}_prepareSeriesNonSeriesData(e,t,i){const s=i.data[i.data.length-1],o=this._getSeriesData(e,t),r=null===o?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:r.map(((e,t)=>({time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]})))}},indexes:this._timeScales[e].convertTimesToIndexes(r.map((e=>{const t=e[0]||0;return t<0?(0,n.ensure)(o)[(0,n.ensure)(o).length+t].timeMs:i.projectionTime+t})))}}_seriesCount(e){let t=0;for(const i of this._getStudiesCacheSessionKeys(e)){"series"===this._studiesCache[e][i].type&&(t+=1)}return t}
+_modifyMainSeries(e,t,i,s,o){this.stopSources(e);const r=this._mainSeriesRecord(e);let a=!1;for(const n of this._getStudiesCacheSessionKeys(e)){const c=this._studiesCache[e][n];if(c&&"series"===c.type)if((0,Wv.default)(r)||c.guid!==r.guid)this.createSeries(e,c.guid,c.turnaround,c.symbolId,i,{countBack:0},!0);else{a=r.symbolId!==t||r.resolution!==i;const n=ZS(o),c={countBack:n||0};l.enabled("request_only_visible_range_on_reset")&&n&&(delete this._objectsDataCache[jS(e,r.guid)],delete this._studiesCache[e][r.guid]),this.createSeries(e,r.guid,s,t,i,c,!0)}}for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];if(i&&"study"===i.type){this._studiesNonSeriesTimes[e][t]=null;const s=this._studiesCache[e][(0,n.ensure)(i.parentId)];this._createStudy(s.symbolId,s.resolution,i.studyObject,e,t,i.turnaround,i.parentId,(0,n.ensure)(i.inputs))}}a&&this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}_mainSeriesRecord(e){let t=null,i=null;for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];if("series"===o.type&&(null===t&&(t=o),o.isMain)){i=o;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i}_stopSourcesTree(e,t){for(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}this._pineDatafeed.removeUnused()}_getSeriesData(e,t){return this._objectsDataCache[jS(e,t)]||null}_resolveSymbolImpl(e,t,i){var s;(0,Pv.isEncodedExtendedSymbol)(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(new Date).toISOString()} ${s}`));const[o,n]=KS(e);this._resolveSymbolByName(o,n,t,i)}_getSymbolExtrapolator(e,t,i){const s=(0,n.ensure)(Re.Interval.normalize(i)),o=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s);let r=this._symbolExtrapolators[o];return void 0===r&&(r=new SS(t,s),this._symbolExtrapolators[o]=r),r}_barsCoefficients(e,t){const i=(0,Pv.decodeExtendedSymbol)(e);if(!("type"in i)||void 0===i.type)return{};const s=e+t;return this._barsCoefficientsCache[s]||(this._barsCoefficientsCache[s]={}),this._barsCoefficientsCache[s]}_studyCanExtendTimeScale(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==i&&(l.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||l.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id||l.enabled("inactivity_gaps")&&"InactivityGaps@tv-basicstudies-1"===i.id)}_stopQuotesSubscription(e){this._quotesInfo[e].listenerGUID&&(l.enabled("charting_library_debug_mode")&&this._logMessage(`QUOTES Unsubscribe listenerGUID=${this._quotesInfo[e].listenerGUID}`),this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)}_removeMarketStatusWatchers(e){Object.keys(this._marketStatusWatchers[e]||{}).forEach((t=>{this._marketStatusWatchers[e][t].stop()
+})),this._marketStatusWatchers[e]={}}_logMessage(e){l.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} ${e}`)}_resolveSymbolByName(e,t,i,s){let o;const n=t&&t.currency,r=t&&t.unit,a=t&&t.session,l=GS(e,n,r,a);(0,Wv.default)(this._resolveRequests[l])?(o=this._resolveSymbolInternal(e,n||void 0,r||void 0,a||void 0),this._resolveRequests[l]=o,o.then((t=>{this._resolveRequests[GS(e,t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),t.currency_id,t.unit_id,t.subsession_id)]=o,this._resolveRequests[GS((0,yS.extractSymbolNameFromSymbolInfo)(t,null),n,r,a)]=o})).catch((()=>{}))):o=this._resolveRequests[l],o.then(i).catch(s)}_resolveSymbolInternal(e,t,i,s){return new Promise(((o,n)=>{const r=qS(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(r));let a=!0;this._externalDatafeed.resolveSymbol(e,(e=>{a&&$S("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),this._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(r,JSON.stringify(e)));const t=function(e,t){if(e.ticker||(e.ticker=e.symbol||e.name),e.full_name=t.shouldUseTickerNotSymbol?e.ticker:`${e.exchange}:${e.name}`,e.pro_name=e.full_name,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions){const t=[];for(const i of e.supported_resolutions){const e=Re.Interval.parse(i);e.isValid()&&!e.isRange()&&t.push(e.value())}e.supported_resolutions=t}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,delete e.has_ticks,!0===t.shouldUseSubsessions&&Array.isArray(e.subsessions))for(let t=0;t!Re.Interval.isValid(e))).forEach((e=>{i("supported_resolutions field contains invalid value: "+e)})),OS||(void 0!==e.subsessions&&i(`Symbol info contains subsessions but the ${NS} feature is not enabled, so the subsessions will be ignored`),void 0!==e.subsession_id&&i(`Symbol info contains a subsession ID but the ${NS} feature is not enabled, so the subsession ID will be ignored`));!0===e.build_seconds_from_ticks&&i("build_seconds_from_ticks is true but building seconds from ticks is only available in Trading Platform.")}(t),this._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(r,JSON.stringify(t))),o(t)}),(e=>{this._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(r,e)),n(e)}),{currencyCode:t,unitId:i,session:s}),a=!1}))}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){const s=this._callbacks[e];for(let e=0;e{const _=Re.Interval.parse(s);if((0,Hv.default)(i.supported_resolutions)&&i.supported_resolutions.length>0&&(0,lS.findSuitableResolutionToBuildFrom)(s,i).error)h.onSymbolErrorCallback(`unsupported resolution: ${i.ticker}, ${s}`);else{if(Re.Interval.isDWM(s)&&void 0!==r.to){const e=(0,Jd.createDwmAligner)(s,i);null!==e&&(r.to=e.timeToExchangeTradingDay(r.to))}if(r.from&&r.to){const e=(0,Td.getPeriodsBetweenDates)(i.session,i.session_holidays,i.corrections,_.letter(),_.multiplier(),r.from,r.to);r.countBack=Math.max(e,r.countBack)}try{const _=new nS({datafeed:this._pineDatafeed,unitId:i.unit_id,currencyCode:i.currency_code,tickerid:c,symbolInfo:JS(i),period:s,body:t,sessionId:e,
+onErrorCallback:h.onErrorCallback,dataRange:r,subsessionId:i.subsession_id,forceAlignBars:!l.enabled("disable_sameinterval_aligning")&&(0,Jd.isAlignmentEnabled)(),enableDwmAligning:l.enabled("align_dwm_bars_to_main_series")||!this._studyCanExtendTimeScale(e,o),input:e=>n[e],out:(e,t)=>{!function(e,t,i){const s=e.time,o="number"==typeof t?[t]:t;for(let e=0;eu[n].timeMs;r?u.push({index:p(s,u.length),value:[s/1e3].concat(o),timeMs:s}):(u[n].index=p(s,n),u[n].value=[s/1e3].concat(o),u[n].timeMs=s),d||h.onRealtimeCallback([u[u.length-1]],r,u.length,m,i)}(e,t,i)},nonseriesOut:(e,t)=>{h.onNonSeriesDataUpdate(t,e)},setNoMoreData:()=>{g=!0},recalc:(e,s)=>{d=!1,u.endOfData=g,u.emptyBarCount=s.emptyBarCount,(!("error"in t)||(0,Wv.default)(t.error)||(0,gc.default)(t.error)&&null===t.error())&&(null!==a&&(this._objectsDataCache[a]=u),h.onDataReadyCallback(u,m,i,s))}});if(!this._studiesCache[e]||!this._studiesCache[e][o])throw Error("This should never happen");this._studiesCache[e][o].engine=_}catch(e){if(!((0,zv.default)(e)&&"studyError"in e&&e.studyError))throw e;h.onErrorCallback(zS(e,"unknown study error"))}}},y=()=>this._studiesCache[e]&&this._studiesCache[e][o]&&this._studiesCache[e][o].activeResolve===_;this._studiesCache[e][o].activeResolve=_;const v=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===v)throw new Error("This should never happen");let S,b;try{const e=await v;S=e.symbolInfo,b=e.requestedSymbol}catch(e){return void(y()&&h.onSymbolErrorCallback(zS(e,"unknown symbol error")))}y()&&f(S,b)}_getDataRangeForStudy(e,t){const i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)},o=this._studiesCache[e][i.parentId];return this._studyCanExtendTimeScale(e,t)&&o?.completed?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s}_seriesDataRange(e,t){const i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange}_createStudy(e,t,i,s,o,r,a,l){this._studiesCache[s][o].completed=!1;const c=(e=>{if(Array.isArray(e))return e;const t=[],i=this._studiesCache[s][o].metainfo.inputs;if((0,Hv.default)(i))for(let s=0;s{const n=this._studiesCache[s][o];if(n.completed=!0,e.length>0&&(n.firstLoadedTimeMs=e[0].timeMs),e=YS(e),this._setEndOfData(s,o,r,!this._studyCanExtendTimeScale(s,o)||e.endOfData),this._studyCanExtendTimeScale(s,o)){const t=e.map((e=>e.timeMs)),i=this._timeScales[s].setStudyBarsTimes(o,t);this._applyTimeScaleUpdate(s,i)}this._timeScales[s].fillIndexesInRows(e),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,e,t),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyCompleted(o,r),this._updateTimeScaleState(s)},d=e=>{if(0===e.size)return{}
+;const t={},i=this._studiesCache[s][o].metainfo;return e.forEach(((e,s)=>{t[(0,n.ensure)(i.plots)[s].id]=e})),{data:{offsets:t},indexes:[]}};let u=null,_=!1;this._computeStudy(s,i,e,t,o,c,this._getDataRangeForStudy(s,o),null,(()=>{if(this._studyCanExtendTimeScale(s,o))return-1/0;if(null===u){const e=this._getSeriesData(s,a)?.[0];if(void 0===e)return 1/0;u=e.timeMs}return u}),{onDataReadyCallback:(e,t,i)=>{_&&0===e.length||h(e,d(t))},onRealtimeCallback:(e,t,i,n,a)=>{const l=YS(e);if(this._studyCanExtendTimeScale(s,o)){const e=l.map((e=>e.timeMs)),t=this._timeScales[s].replaceStudyBarsTimesTail(o,e);this._applyTimeScaleUpdate(s,t)}this._timeScales[s].fillIndexesInRows(l),this._chartApiMessagerProvider.getChartApiMessager(s).onDataUpdate(o,r,l,d(n)),this._updateTimeScaleState(s)},onSymbolErrorCallback:()=>{this._studiesCache[s][o].completed=!0,this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,"error in series")},onErrorCallback:(e,t)=>{this._studiesCache[s][o].completed=!0;let i=e;t&&(i={error:e,title:t}),this._chartApiMessagerProvider.getChartApiMessager(s).onStudyError(o,r,i),this._updateTimeScaleState(s)},onNonSeriesDataUpdate:(e,t)=>{switch(_=!0,e.type){case"projection":break;case"study_gap":const t=this._timeScales[s].replaceStudyBarsTimesTail(o,e.times);this._applyTimeScaleUpdate(s,t);break;case"study_graphics":{const t={data:{graphicsCmds:e.data?.graphicsCmds,isUpdate:e.data?.isUpdate},indexes:[]},i=function(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,s=new Set;kS.forEach(((e,o)=>{const n=t[o];if(n)for(const t of n)for(const o of t.data){const t=e(o);for(const e of t)i.set(e,-1),s.add(e)}}));const o=Array.from(s).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),ES.forEach(((e,s)=>{const o=t[s];if(o)for(const t of o)for(const s of t.data)e(s,i)})),o}(t);this._studiesNonSeriesTimes[s][o]=i,t.indexes=this._timeScales[s].convertTimesToIndexes(i),h([],t);break}case"non_series_data":{const t={data:e.data,indexes:[]},i=t?.data?.data?.pivots,n=void 0!==i;let r=function(e){const t={};gS(e,(e=>{(0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});const i=Object.keys(t).map(Number).sort(((e,t)=>e-t));return i.forEach(((e,i)=>{t[e]=i})),Object.assign(e,gS(e,(e=>((0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(e[i.slice(0,-3)]=t[e[i]])})),e)),{visitInstances:!0})),i}(t),a=this._timeScales[s].convertTimesToIndexes(r,n);if(n){const e=new Set,t=[],s=[];let o=0;for(let n=a.length-1;n>=0;n--){const l=a[n];e.has(l)||l===Fh.INVALID_TIME_POINT_INDEX?(i.splice(n,1),o++):(t.unshift(r[n]),s.unshift(l),e.add(l))}o>0&&i.forEach(((e,t)=>{e.startIndex=t,e.endIndex=t+1})),r=t,a=s}this._studiesNonSeriesTimes[s][o]=r,t.indexes=a,h([],t);break}default:$S("unsupported non-series data type for study "+e.type)}}})}_isEndOfData(e,t,i){const s=e+"!"+t+"@"+i;return Boolean(this._endOfData[s])}_setEndOfData(e,t,i,s){const o=e+"!"+t+"@"+i;this._endOfData[o]=!1!==s}_applyTimeScaleUpdate(e,t){
+if(null===t)return;const i=[];for(const t of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][t];if(s&&"study"===s.type){const o=this._studiesNonSeriesTimes[e][t];if(o){const n={indexes:this._timeScales[e].convertTimesToIndexes(o),data:{indexes_replace:!0}};i.push({objId:t,turnaround:s.turnaround,data:[],nonSeriesData:n})}}}this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleUpdate(t,i),Promise.resolve().then((()=>{const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=t.symbolInfo,s=(s=t.resolution)=>this._getSymbolExtrapolator(e,i,s);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,s,this._timeScales[e]).forEach(((t,i)=>{this._chartApiMessagerProvider.getChartApiMessager(e).onPointsetDataUpdate(i,null,t)}))}}))}_updateMainTsBuilder(e){const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}}_updateTimeScaleState(e){if(!this._studiesCache[e])return;let t=!0,i=!0;for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];"InactivityGaps@tv-basicstudies-1"!==o?.metainfo?.id&&(i=i&&this._isEndOfData(e,s,o.turnaround),t=t&&o.completed)}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&this._chartApiMessagerProvider.getChartApiMessager(e).onTimescaleCompleted(i))}_getStudiesCacheSessionKeys(e){return void 0!==this._studiesCache[e]?Object.keys(this._studiesCache[e]):[]}}WS.debugGetQuotesRequestId=1;const HS=WS;function zS(e,t){return"string"==typeof e?e:(0,zv.default)(e)&&e&&"message"in e&&(0,et.default)(e.message)?e.message:t}function US(e,t){return e+"_"+t}function jS(e,t){return e+"_"+t}function GS(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}function qS(e,t,i,s){return[e,t,i,s].filter((e=>(0,et.default)(e)&&e.length>0)).join("|")}function $S(e){console.warn(`${(new Date).toISOString()} ${e}`)}function KS(e){const t=(0,Pv.decodeExtendedSymbol)(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:"currency-id"in i&&i["currency-id"],unit:"unit-id"in i&&i["unit-id"],session:"session"in i?i.session===Xv.SubsessionId.Regular?void 0:i.session:void 0}]}function YS(e){const t=e.findIndex((e=>e.index!==RS));return-1===t?[]:0===t?e:e.slice(t)}function ZS(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]??null:null}}return null}function XS(e,t,i){if(i.logoid=void 0,i["base-currency-logoid"]=void 0,i["currency-logoid"]=void 0,e){if("string"==typeof e)return void $S("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=t}t&&(i.provider_id=t,i.country=void 0)}function JS(e){return e.timezone=e.timezone,e}(0,A.setClasses)();const QS=(0,r.getChartingLibraryGlobalContext)(),eb=(0,r.getChartingLibraryOwner)(),tb=new class{constructor(e,t){
+this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Oe(e.document),this._viewportType=ze.CheckMobile.iOS()&&!(0,He.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Fe(this._window.document);const i={alive:new O.WatchedValue(!0),fullscreenable:new O.WatchedValue(!0),container:new O.WatchedValue(t),width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Ne(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=t?.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),ib=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i
+;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ue(i,e.negotiations.width))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ue(i,e.negotiations.height))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=je(e);Ge(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=je(e);Ge(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,alive:new O.WatchedValue(!0),container:new O.WatchedValue(i),visible:new O.WatchedValue(!0),fullscreen:new O.WatchedValue(!1),fullscreenable:new O.WatchedValue("right"===t||"center"===t),rdState:new Ne};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e
+;const t=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,o=this._areas.right,n=this._areas.top,r=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),h=this._height.value();let d=0,u=0,_=0,p=0,m=0,g=0,f=0,y=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);y=this._setHeight(l,e,h),this._setWidth(l,e,c)}if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=y+"px")}let v=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=y+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(v=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);_=this._setWidth(i,e,c),_&&(_+=4),_&&1===v&&(v=4);const s=i.container.value();e&&s&&(s.style.top=t+y+v+"px"),this._setHeight(i,e,h-t-y)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-_;qe||(t-=300),m=this._setWidth(s,e,t),m&&1===v&&(v=4),this._setHeight(s,e,h-y-d-v)}if(e===this._recalcSingleRunToken&&o){const e=this._processVisibility(o);let t=c-_-m;qe||(t-=300),p=this._setWidth(o,e,t),p&&1===v&&(v=4),this._setHeight(o,e,h-y-d-v);const i=o.container.value();e&&i&&(i.style.top=d+y+v+"px")}const S=m+p;let b=0,w=c-_-m-p-(S?4:0);const C=Boolean(m||!S);if(!p&&m&&(w+=4),e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r),t=r.container.value();e&&t&&(t.style.left=_+"px",t.classList.toggle("no-border-top-left-radius",!_),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(r,e,w);const i=h-y;b=Math.min(300,i-0),u=this._setHeight(r,e,i)+4}const T=Boolean(d&&(_||S));if(this._container.classList.toggle("layout-with-border-radius",T),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=_+"px",t.style.top=d+y+v+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!_),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!_&&S)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-y-v;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&p?`${p+4}px`:`${p}px`,e.style.top=y+d+v+"px",e.style.borderTopRightRadius=T&&p?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return Ye(e);if(this._width.value()<=567||this._height.value()<=445&&!Ke){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t{QS.ChartApiInstance.start()})),"function"==typeof rb){const e=rb({Std:Py.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void ab.resolve();const t=QS.JSServer;for(const i of e)if("function"==typeof i){const e=(new Ev).build(i);t.studyLibrary.push.call(t.studyLibrary,e)}else t.studyLibrary.push.call(t.studyLibrary,i);ab.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),ab.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),ab.resolve())}else ab.resolve();QS.widgetReady=e=>{ee.subscribe("onChartReady",e,null)};const yb=ob.theme?.toLowerCase()??$s.StdTheme.Light;var vb;function Sb(e){QS.__defaultsOverrides=QS.__defaultsOverrides||{},(0,ge.deepExtend)(QS.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}vb=yb,L.themes[vb]&&(0,k.setTheme)(vb),async function(e){if(!db||void 0===e)return;try{
+const{overrideStandardThemes:t}=await i.e(2413).then(i.bind(i,79736));t(e)}catch(e){console.error("Error applying custom themes",e)}}(eb.customThemes).then(cb.resolve).catch(cb.resolve),QS.applyStudiesOverrides=e=>{e&&(QS.chartWidgetCollection?QS.chartWidgetCollection.applyStudiesOverrides?.(e):ns.StudyMetaInfo.mergeDefaultsOverrides(e))},QS.applyOverrides=e=>{Sb(e),QS.chartWidgetCollection&&QS.chartWidgetCollection.applyOverrides(e)},QS.doWhenApiIsReady=e=>{QS.tradingViewApi?e():lb.promise.then(e)},QS.applyTradingCustomization=e=>{if(e.order)for(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];if(e.position)for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t];return null===fb?Promise.resolve():fb.then((t=>{function i(e){const t={};for(const i of Object.keys(e??{})){const s=i.split(".");let o=t;for(const e of s.slice(0,s.length-1))o.hasOwnProperty(e)||(o[e]={}),o=o[e];o[s[s.length-1]]=e[i]}return t}if(null===t)return;const s=i(e.brokerOrder),o=i(e.brokerPosition);t?.overrideTradedGroupStyles({order:{lightTheme:s,darkTheme:s},position:{lightTheme:o,darkTheme:o}})}))},QS.changeTheme=(e,t)=>{const i=L.themes[e.toLowerCase()];return i?QS.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},QS.getTheme=()=>QS.tradingViewApi.themes().getCurrentThemeName(),QS.customThemes=async()=>{if(!db)return Promise.reject(new Error("The library_custom_color_themes feature must be enabled to use the custom themes API"));return new((await i.e(2413).then(i.bind(i,82753))).CustomThemesApi)},QS.is_authenticated=!1;JSON.parse(QS.urlParams.brokerConfig);a.t(null,void 0,i(94566)),a.t(null,void 0,i(92800)),a.t(null,void 0,i(44676));let bb=null;const wb=(0,me.createDeferredPromise)();let Cb;const Tb=()=>{if(l.setEnabled("charting_library_export_chart_data",!QS.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===ob.debug||l.enabled("charting_library_debug_mode")),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){const e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=ob.studiesOverrides&&ns.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(ob.studiesOverrides)),(0,n.assert)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Sb(JSON.parse(ob.overrides));const e=ob.numeric_formatting?JSON.parse(ob.numeric_formatting):void 0;e&&("string"==typeof e.decimal_sign&&(ue.formatterOptionsLibraryOverrides.decimalSign=e.decimal_sign[0]),"string"==typeof e.grouping_separator&&(ue.formatterOptionsLibraryOverrides.groupingSeparator=e.grouping_separator[0]));const t=new Sv,s=new Nv,c=new Bv,h=ob.studiesAccess&&JSON.parse(ob.studiesAccess)||{type:"black",tools:[]},d=new Df(h,c),u=new Ov((0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary),_=new HS(eb.datafeed,t,s,u);QS.ChartApiInstance=new Ef(t,_,c,d)
+;const p=eb.customFormatters;p&&(p.timeFormatter&&(_e.customFormatters.timeFormatter=p.timeFormatter),p.dateFormatter&&(_e.customFormatters.dateFormatter=p.dateFormatter),p.tickMarkFormatter&&(_e.customFormatters.tickMarkFormatter=p.tickMarkFormatter),p.priceFormatterFactory&&(_e.customFormatters.priceFormatterFactory=p.priceFormatterFactory),p.studyFormatterFactory&&(_e.customFormatters.studyFormatterFactory=p.studyFormatterFactory)),eb.customTimezones&&De.instance().addTimezones(eb.customTimezones);const m=ob.chartContent?JSON.parse(ob.chartContent).json:void 0,g=ob.chartContentExtendedData?JSON.parse(ob.chartContentExtendedData):m?m.extendedData:void 0,f=ob.interval||"D",v=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),o=s[2].toLowerCase(),r=parseInt(s[1]),l="y"===o?12*r+"M":r+o,c=Re.Interval.parse(l.toUpperCase()),h=Re.Interval.parse(e.resolution);return{text:e.title||{y:a.t(null,{plural:"{count}y",count:r,context:"short_N_year"},i(46766)),m:a.t(null,{plural:"{count}m",count:r,context:"short_N_month"},i(58590)),d:a.t(null,{plural:"{count}d",count:r,context:"short_N_day"},i(47801))}[o]||`${r}${o}`,description:e.description||"",value:{value:c.value(),type:"period-back"},targetResolution:h.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(ob.timeFrames)),S={resizerBridge:gb,padding:l.enabled("border_around_the_chart")?2:0,content:m,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(QS.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:ob.timezone,defSymbol:ob.symbol??"",defInterval:m?"":f,compareSymbols:ob.compareSymbols&&JSON.parse(ob.compareSymbols),defTimeframe:(b=eb.timeframe,b?"string"==typeof b?b:{...b,type:"time-range"}:b),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:sb},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:ob.time_scale&&JSON.parse(ob.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"),
+price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"),indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==bt.STATUS_DELAYED&&t!==bt.STATUS_DELAYED_STREAMING&&t!==bt.STATUS_EOD&&t!==bt.STATUS_READY)return[];return v.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,layoutFullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:ob.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var b;hb&&((0,xf.createFavoriteDrawingToolbar)(),S.widgetOptions.isDrawingToolbarVisible=P.isDrawingToolbarVisible),g&&(S.metaInfo={id:g.uid,name:g.name,description:g.description,uid:g.uid,username:""}),eb.additionalSymbolInfoFields&&(0,lv.setAdditionalSymbolInfoFields)(eb.additionalSymbolInfoFields);const w=eb.symbolSearchComplete;w&&(0,cv.setSymbolSearchCompleteOverrideFunction)(w);const C=QS.chartWidgetCollection=new Pf(S);let x=!1;C.onAboutToBeDestroyed.subscribe(null,(()=>{x=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,ft.combine)(((e,t)=>{const s=e??t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new ev(t,i,s.ownership())}),Co.CustomSourceLayer.Topmost)}(C),QS.studyMarket=new pe(C),Je.registerService(Xe.CHART_WIDGET_COLLECTION_SERVICE,C),C.activeChartWidget.subscribe((e=>{ee.emit("activeChartChanged",C.getAll().indexOf(e))})),QS.saver=new N.ChartSaver(C);const A=new I.ChartChangesWatcher(C,QS.saver,ee),k=new Z(C,QS.saver,A);C.setSaveChartService(k);const E=new oe(C);QS.chartWidget=C.activeChartWidget.value(),QS.pro=new TradingView.Pro;const B=function(e){if(!pb)return null;const t=JSON.parse(ob.favorites);t.intervals=t.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(Cb=new he({chartWidgetCollection:e.chartWidgetCollection}));let s;const o=ob.header_widget_buttons_mode;"fullsize"===o&&(s=["full"]);"compact"===o&&(s=["small"]);const n=(0,gv.shouldShowQuickSearchOnLib)()?function(e){
+const t=t=>Promise.all([i.e(9520),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(6032),i.e(3672),i.e(3359),i.e(3425),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(8260),i.e(1979),i.e(7780),i.e(445),i.e(846),i.e(1667),i.e(3290),i.e(6870),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(1890),i.e(1727),i.e(9754)]).then(i.bind(i,11065)).then((i=>{const s=new(0,i.GlobalSearchDialogRenderer)(e);return null!==Ve&&Ve.hide(),s.show(t),Ve=s,s}));return(0,D.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:D.Modifiers.Mod+75,handler:()=>t()}),t}(e.loadChartService):void 0;return new T(new y,{chartSaver:QS.saver,chartApiInstance:QS.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:t.chartTypes,defaultFavoriteIntervals:t.intervals,resizerBridge:pb,studyMarket:QS.studyMarket,studyTemplates:Cb,allowedModes:s,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:e.chartChangesWatcher,onClick:Ab,snapshotUrl:e.snapshotUrl,openGlobalSearch:n})}({chartWidgetCollection:C,saveChartService:k,chartChangesWatcher:A,loadChartService:E,snapshotUrl:ob.snapshotUrl});null!==B?B.load().then((e=>{bb=e.getComponent(),wb.resolve()})):(wb.promise.catch((()=>{})),wb.reject("header widget is not loaded"));const V=function(e){if(mb){const t=ob.toolbarbg&&/^[0-9a-f]+$/i.test(ob.toolbarbg)?String(ob.toolbarbg):void 0;if(t){const e=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new M({bgColor:t,chartWidgetCollection:e,drawingsAccess:ob.drawingsAccess?JSON.parse(ob.drawingsAccess):void 0,resizerBridge:mb,onClick:Ab})}return null}(C),R=null;QS.tradingViewApi=new Cy({chartWidgetCollection:C,chartApiInstance:QS.ChartApiInstance,saveChartService:k,loadChartService:E,studyMarket:null});if(de.linking.bindToChartWidgetCollection(C),isNaN(ob.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(ob.studyCountLimit))),!isNaN(ob.ssreqdelay)){const e=Math.max(0,+(0,n.ensureDefined)(ob.ssreqdelay));(0,Ty.setSearchRequestDelay)(e)}QS.ChartApiInstance.connect(),(async()=>{const{LineToolPropertiesWidget:e}=await Promise.all([i.e(7617),i.e(8185),i.e(1681),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(2537),i.e(3359),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(7827),i.e(8220),i.e(9590),i.e(1667),i.e(9836),i.e(3290),i.e(6178),i.e(7777),i.e(2227),i.e(3179),i.e(1890),i.e(6193),i.e(6376),i.e(2306)]).then(i.bind(i,36699));x||(QS.lineToolPropertiesToolbar=new e(C))})();const O=document.querySelector(".tv-content");null!==O&&O.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),lb.resolve(),C.undoHistory.undoStack().onChange().subscribe(null,(0,o.default)((e=>{e?.affectsState()&&ee.emit("onAutoSaveNeeded")}),1e3*(Number(ob.autoSaveDelay)||5),{leading:!1,trailing:!0}));let F=!1;function W(){
+V&&V.load(nb.signal),R&&R.load(nb.signal).then((e=>{QS.footerWidget=e.getComponent()}))}QS.chartWidget.withModel(null,(()=>{QS.ChartApiInstance.on("realtime_tick",(e=>{ee.emit("onTick",e)}));if(!L.savedThemeName()&&yb){const e=L.getStdTheme(yb);e&&e.content&&void 0===m&&C.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:yb,standardTheme:!0,syncState:!0,noUndo:!0}).then((()=>QS.applyOverrides(QS.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&ee.subscribeToAll(((...e)=>{console.log(`${(new Date).toISOString()} Event "${e[0]}", arguments: ${JSON.stringify(e.slice(1))}`)})),F)return;F=!0,If(C),function(e,t){const s=a.t(null,void 0,i(37367)).format({emoji:"👍"}),o=a.t(null,void 0,i(69804)).format({emoji:"👍"}),r=a.t(null,void 0,i(6655)).format({emoji:"👍"});ee.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),ee.on("onClientScreenshotCopiedToClipboard",(()=>h(o)),null),ee.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(r)),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(5371),i.e(2307),i.e(2227),i.e(92)]).then(i.bind(i,1524)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(C,{seriesControlBarEnabled:l.enabled("timeframes_toolbar")});P_.getInstance().setWidgetCollection(QS.chartWidgetCollection)})),C.getAll().some((e=>e.isInitialized()))?W():function(e,t){const i=e.getAll(),s=()=>{t(),i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(C,W),ee.subscribe("chart_load_requested",(e=>{QS.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{nb.abort(),QS.widgetbar&&(QS.widgetbar.destroy(),QS.widgetbar=null),QS.chartWidgetCollection&&(QS.chartWidgetCollection.destroy(),QS.chartWidgetCollection=null),QS.ChartApiInstance&&QS.ChartApiInstance.disconnect(),(0,Ze.destroyQuoteSessions)(),QS.ChartApiInstance&&(QS.ChartApiInstance.destroy(),QS.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(eb.saveLoadAdapter?E.setCustomAdapter(eb.saveLoadAdapter):QS.urlParams.chartsStorageUrl&&QS.urlParams.clientId?E.initialize(QS.urlParams.clientId,QS.urlParams.userId,QS.urlParams.chartsStorageUrl,QS.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1))),void 0!==eb.imageStorageAdapter&&l.enabled("image_drawingtool")&&(0,fv.setImageStorageAdapter)(eb.imageStorageAdapter);const Pb=(0,me.createDeferredPromise)();function xb(){Pb.resolve()}eb.loadLastChart&&l.enabled("saveload_storage_customization")?E.getCharts().then((e=>{if(0===e.length)return void xb();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];E.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,ob.chartContent=JSON.stringify({json:i}),xb()})).catch(xb)})).catch(xb):xb();const Mb=async function(){
+if(l.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,67387));return Bm=e.LineToolsSynchronizer,!0}return!1}(),Ib=(0,me.createDeferredPromise)();function Ab(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Ib.promise,Pb.promise,QS.loadedCustomCss,Mb,cb.promise]).then((()=>{const e=document.querySelector(".loading-indicator");if(e&&(e.style.display="none"),setTimeout(Tb,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",o="ga",t.GoogleAnalyticsObject=o,t[o]=t[o]||function(){(t[o].q=t[o].q||[]).push(arguments)},t[o].l=Number(new Date),r=i.createElement(s),a=i.getElementsByTagName(s)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(r,a);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[2];QS.ga("create","UA-112911840-1","auto"),QS.ga("set","anonymizeIp",!0),QS.ga("set",{hostname:e,page:e,referrer:e}),QS.ga("send","pageview")}var t,i,s,o,r,a})),(()=>{let e=!0;eb.datafeed.onReady((t=>{e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),QS.configurationData=t,Ib.resolve()})),e=!1})(),QS.createShortcutAction=(()=>{const e=D.createGroup({desc:"API",order:yv.ACTION_API_GROUP_ORDER});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?R(s.split("+")):Array.isArray(s)?R(s):0),handler:i})}})(),QS.initializationFinished=()=>{QS.chartWidgetCollection.undoHistory.clearStack()},QS.headerReady=()=>wb.promise,function e(t=0,i=10){const s={received:!1};QS.dispatchEvent(new CustomEvent("innerWindowLoad",{detail:s})),!s.received&&t{e(t+1,i)}),10*Math.pow(2,t))}(),QS.createButton=e=>{if(null===bb)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1;const t=(0,fe.randomHash)();return bb.addButton(t,e)??t},QS.removeButton=e=>{if(null===bb)throw new Error("Cannot remove button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return bb.removeButton(e)},QS.createDropdown=e=>{if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,fe.randomHash)();return bb?(bb.addDropdown(t,e),Promise.resolve(new hv(bb,t))):wb.promise.then((()=>((0,n.ensureNotNull)(bb).addDropdown(t,e),new hv((0,n.ensureNotNull)(bb),t))))},QS.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[t]})),e},QS.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,ve.property)()))),QS.getPaneButtonsVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Se.property)()))),QS.getDateFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(be.dateFormatProperty))),
+QS.getTimeHoursFormat=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)(we.timeHoursFormatProperty))),QS.getCurrencyAndUnitVisibility=(0,s.default)((()=>(0,ye.convertPropertyToWatchedValue)((0,Be.currencyUnitVisibilityProperty)()))),QS.customSymbolStatus=()=>_v.getInstance();QS.urlParams.debugBroker,new Set(["connectionStatus"]);const Lb=ob.locale||"en",kb=Dt.getInstance();kb.createElement(document),kb.setLocale(Lb),QS.customChartDescriptionFunction&&kb.setCustomProvider(QS.customChartDescriptionFunction);const Eb=Sm.getInstance();Eb.createElement(document),Eb.setLocale(Lb),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,B.humanReadableHash)(9):`${(0,B.humanReadableModifiers)(B.Modifiers.Alt,!1)} + ${(0,B.humanReadableHash)(90)}`,t=`${(0,B.humanReadableModifiers)(B.Modifiers.Mod,!1)} + ${(0,B.humanReadableHash)(75)}`,s=a.t(null,void 0,i(7697)),o=[a.t(null,{replace:{shortcut:e}},i(85166)),a.t(null,{replace:{shortcut:t}},i(57959)),a.t(null,void 0,i(36332)),a.t(null,void 0,i(9687)),a.t(null,void 0,i(40490)),a.t(null,void 0,i(27884))],n=document.createElement("p");n.innerText=s;const r=document.createElement("ul");o.forEach((e=>{const t=document.createElement("li");t.innerText=e,r.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(r),document.body.insertBefore(c,document.body.firstChild)}(),window.addEventListener("keydown",(e=>{const t=(0,B.hashFromEvent)(e);9!==t&&t!==D.Modifiers.Shift+9||(0,pv.updateTabIndexes)()})),new zo.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{(0,pv.updateTabIndexes)();const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,mv.createScopedVisibleElementFilter)(document.documentElement)).sort(pv.navigationOrderComparator);void 0!==e&&e.focus()},hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:D.Modifiers.Alt+90,hotkeyGroup:(0,D.createGroup)({desc:"Global shortcuts"})}})},52959:(e,t,i)=>{"use strict";function s(){return window}function o(){const e=s();return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>o})},29063:(e,t,i)=>{"use strict";i.r(t);var s=i(21097),o=i(51768),n=i(76422),r=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim();return s?{type:"text",data:s}:{type:"none"}}function u(e,t){let i=!1;const s=e.children;for(let e=0;e{(0,r.hide)(),t.removeEventListener("blur",s),t.removeEventListener("active-descendant-blur",s)};t.addEventListener("blur",s),t.addEventListener("active-descendant-blur",s)}}a((()=>{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,r.showOnElement)(t,{content:d(t)});const i=()=>{(0,r.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",_,!0),document.addEventListener("active-descendant-focus",_,!0)}));var p=i(48096),m=i(11417);var g=i(39527);function f(e){return()=>{e()}}var y=i(3343),v=i(34811),S=i(15754);const b=(e=document.documentElement,t)=>document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>t=>{if(1!==t.nodeType)return NodeFilter.FILTER_SKIP;const i=t;return(0,S.isInertRoot)(i)?NodeFilter.FILTER_REJECT:(0,S.isVisibilityVisible)(i)&&i.matches(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP})(t));const w=(e=document.documentElement)=>b(e,S.FOCUSABLE_SELECTOR);const C=`[${v.FOCUS_TRAP_DATA_ATTRIBUTE}="true"]`;class T{constructor(){this._handleMouseDown=()=>{this._forwardTab=void 0},this._handleKeyDown=e=>{this._forwardTab=void 0,[9,y.Modifiers.Shift+9].includes((0,y.hashFromEvent)(e))&&(this._forwardTab=!e.shiftKey)},this._handleFocus=e=>{const t=e.target;if(void 0===this._forwardTab||!(t instanceof HTMLElement))return;const i=this._findDeepestFocusTrapElement(document.documentElement);if(!(i instanceof HTMLElement)||!i||i.contains(t))return;e.preventDefault(),e.stopPropagation(),t.blur()
+;const s=i.compareDocumentPosition(t);if(s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_FOLLOWING){const e=this._forwardTab?x(i):x(i,!0);e instanceof HTMLElement&&e.focus()}},document.documentElement.addEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.addEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.addEventListener("mousedown",this._handleMouseDown,{capture:!0})}destroy(){document.documentElement.removeEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.removeEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.removeEventListener("mousedown",this._handleMouseDown,{capture:!0})}_findDeepestFocusTrapElement(e){const t=e.querySelectorAll(C);let i=null,s=-1;return t.forEach((t=>{const o=this._calculateParentCount(t,e);o>s&&(s=o,i=t)})),i}_calculateParentCount(e,t){let i=0,s=e.parentElement;for(;s&&s!==t;)"true"===s.getAttribute(v.FOCUS_TRAP_DATA_ATTRIBUTE)&&i++,s=s.parentElement;return i}}const P=f((()=>new T));function x(e,t){return t?function(e){return function(e){for(e.currentNode=e.root;null!==e.lastChild(););return e.currentNode===e.root?null:e.currentNode}(w(e))}(e):function(e){return t=w(e),t.currentNode=t.root,t.nextNode();var t}(e)}const M=f((()=>{P()}));var I=i(99247);let A;function L(e){window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,o.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):availableOffersWrapper.runOrUpdate((e=>{Object.keys(e).forEach((t=>{const i=t;e[i].available_for_anons||delete e[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:e},m.TVLocalStorage.removeItem("trial_availiable")}))}A=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,A.subscribe(null,L),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,A.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//,/^\/pine\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),
+window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS"),A.fire()},window.loginUser=function(e){window.user=(0,g.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=L,window.TradingView.setTrialAvailiable=e=>{m.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate,M(),(0,I.initMouseClickAutoBlurHandler)()},43229:(e,t,i)=>{"use strict";i.d(t,{AsyncResourceWrapper:()=>s});class s{constructor(e,t){this._destroyed=!1,this._callbacks=[],this._resource={pendingResource:e},this._destroyFn=t,e.then((e=>{if(this._destroyed)this._destroyFn?.(e);else{this._resource.resource=e;for(const t of this._callbacks)t(e)}})).finally((()=>{this._callbacks=[]}))}destroy(){this._resource.resource&&this._destroyFn?.(this._resource.resource),this._resource={pendingResource:Promise.reject("Resource is destroyed").catch((()=>{}))},this._callbacks=[],this._destroyed=!0}callFunction(e){this._destroyed||(this._resource.resource?e(this._resource.resource):this._callbacks.push(e))}get(){return this._destroyed||!this._resource.resource?null:this._resource.resource}promise(){return this._resource.pendingResource}}},52859:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>r,applyAlpha:()=>n,applyTransparency:()=>l,colorFromBackground:()=>u,colorToInteger:()=>g,generateColor:()=>o,getLuminance:()=>h,gradientColorAtPercent:()=>_,isHexColor:()=>d,resetTransparency:()=>c,rgbaFromInteger:()=>p,rgbaToInteger:()=>m,transparencyToAlpha:()=>a});var s=i(24377);function o(e,t,i){if(t=t||0,!d(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(a(t)))):e;const[o,n,r]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(a(t));return(0,s.rgbaToString)([o,n,r,l])}function n(e,t,i){const o=(0,s.tryParseRgba)(e);if(null===o)throw new Error(`Invalid color: ${e}`);const[n,r,a,l]=o,c=(0,s.normalizeAlphaComponent)(t*(i?l:1));return(0,s.rgbaToString)((0,s.rgba)([n,r,a],c))}function r(e){return 100*(1-e)}function a(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function l(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),o=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],a(t)*o))}function c(e){return"transparent"===e?e:d(e)?e.slice(0,7):(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function h(e){const t=(0,s.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function d(e){return 0===e.indexOf("#")}function u(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function _(e,t,i){const[o,n,r,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(o+i*(l-o)),Math.round(n+i*(c-n)),Math.round(r+i*(h-r)),a+i*(d-a));return(0,s.rgbaToString)(u)}function p(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256
+;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},29970:(e,t,i)=>{"use strict";i.d(t,{colorsAreCloseEnough:()=>h,isColorDark:()=>_});var s,o=i(81251),n=i(24377);function r(e){return e<0&&(e+=2*Math.PI),e}function a(e,t){const[i,s,o]=e,[n,a,l]=t,c=(Math.sqrt(s**2+o**2)+Math.sqrt(a**2+l**2))/2,h=.5*(1-Math.sqrt(Math.pow(c,7)/(Math.pow(c,7)+6103515625))),d=(1+h)*s,u=(1+h)*a,_=Math.sqrt(d*d+o*o),p=Math.sqrt(u*u+l*l),m=0===o&&0===d?0:r(Math.atan2(o,d)),g=0===l&&0===u?0:r(Math.atan2(l,u)),f=n-i,y=p-_;let v;const S=_*p;0===S?v=0:(v=g-m,v<-Math.PI?v+=2*Math.PI:v>Math.PI&&(v-=2*Math.PI));const b=2*Math.sqrt(S)*Math.sin(v/2),w=(i+n)/2,C=(_+p)/2;let T;const P=m+g;T=_*p==0?P:Math.abs(m-g)<=Math.PI?P/2:P<2*Math.PI?(P+2*Math.PI)/2:(P-2*Math.PI)/2;const x=1-.17*Math.cos(T-Math.PI/6)+.24*Math.cos(2*T)+.32*Math.cos(3*T+Math.PI/30)-.2*Math.cos(4*T-Math.PI/180*63),M=Math.PI/6*Math.exp(-Math.pow((T-Math.PI/180*275)/(Math.PI/180*25),2)),I=2*Math.sqrt(Math.pow(C,7)/(Math.pow(C,7)+6103515625)),A=1+.015*Math.pow(w-50,2)/Math.sqrt(20+Math.pow(w-50,2)),L=1+.045*C,k=1+.015*C*x,E=-Math.sin(2*M)*I;return Math.sqrt(Math.pow(f/(1*A),2)+Math.pow(y/(1*L),2)+Math.pow(b/(1*k),2)+E*(y/(1*L))*(b/(1*k)))}!function(e){e[e.Pow25In7=6103515625]="Pow25In7",e[e.LWeight=1]="LWeight",e[e.CWeight=1]="CWeight",e[e.HWeight=1]="HWeight"}(s||(s={}));const l=[127,127,127];function c(e){const t=e[3],i=e.slice(0,3);for(let e=0;e<3;e++)i[e]=Math.round(i[e]*t+l[e]*(1-t));return i}function h(e,t){return a(g(p(c((0,n.parseRgba)(e)))),g(p(c((0,n.parseRgba)(t)))))<3}const d=(0,o.default)((()=>g(p([0,0,0])))),u=(0,o.default)((()=>g(p([255,255,255]))));function _(e){const t=g(p(c((0,n.parseRgba)(e))));return a(t,d()).04045?Math.pow((o+.055)/1.055,2.4):o/12.92),l=100*(n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92),c=100*(r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92);return[.4124*a+.3576*l+.1805*c,.2126*a+.7152*l+.0722*c,.0193*a+.1192*l+.9505*c]}var m;function g(e){const[t,i,s]=e,o=t/95.047,n=i/100,r=s/108.883,a=o>.008856?Math.pow(o,1/3):7.787*o+16/116,l=n>.008856?Math.pow(n,1/3):7.787*n+16/116;return[116*l-16,500*(a-l),200*(l-(r>.008856?Math.pow(r,1/3):7.787*r+16/116))]}!function(e){e[e.X=95.047]="X",e[e.Y=100]="Y",e[e.Z=108.883]="Z"}(m||(m={}))},22961:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>r,lerp:()=>s});const o={from:0,duration:250,easing:i(76662).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...o,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation()
+;const o=(i=!i||i<1e12?performance.now():i)-e,n=o>=this._options.duration||t===this._options.to,r=s(this._options.from,this._options.to,this._options.easing(o/this._options.duration)),a=n?this._options.to:r,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function r(e){return new n(e)}},32925:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>o});var s=i(9343);new class{constructor(e,t){this._test=e[t]={}}provide(e,t){this._test[e]=t}}(window,"qaGlobals"),(0,s.getLogger)("Fetch");function o(e,t,i={}){return window.fetch(e,t)}},67225:(e,t,i)=>{"use strict";i.d(t,{GradientColorCache:()=>o});var s=i(52859);class o{constructor(){this._color1="",this._color2="",this._colors=new Map}gradientColor(e,t,i){if(t===e)return t;i=Math.max(0,Math.min(100,Math.round(100*i))),this._color1===e&&this._color2===t||(this._colors.clear(),this._color1=e,this._color2=t);let o=this._colors.get(i);return void 0===o&&(o=(0,s.gradientColorAtPercent)(e,t,i/100),this._colors.set(i,o)),o}}},49251:(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 o=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=o.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])}}},18113:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>o});let s=null;function o(){return s}},24640:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>b,forceLTRStr:()=>u,forceLTRStrSsr:()=>_,forceRTLStr:()=>m,getLTRScrollLeft:()=>g,getLTRScrollLeftOffset:()=>f,isRtl:()=>o,startWithLTR:()=>d,stripLTRMarks:()=>h,stripLTRStrSsr:()=>p});var s=i(64531);const o=()=>"rtl"===window.document.dir,n="",r="",a="",l="",c=new RegExp(n+"|"+r+"|"+a+"|"+l,"g");function h(e){return""!==e&&o()&&null!=e?e.replace(c,""):e}function d(e){return""!==e&&o()&&null!=e?n+e:e}function u(e){return""!==e&&o()&&null!=e?r+e+l:e}function _(e){return r+e+l}function p(e){return e.startsWith(r)&&e.endsWith(l)?e.slice(1,-1):e}function m(e){return""!==e&&o()&&null!=e?a+e+l:e}function g(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function f(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}var y;!function(e){e.LTR="ltr",e.RTL="rtl",e.UNKNOWN=""}(y||(y={}));const v=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,S=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function b(e){const t=v.exec(e);return t?S.test(t[0])?"rtl":"ltr":""}},76662:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},59672:(e,t,i)=>{"use strict";function s(){
+return Promise.all([i.e(6342),i.e(8185),i.e(2202),i.e(8894),i.e(5743),i.e(6954),i.e(2227),i.e(2077)]).then(i.bind(i,3014))}i.d(t,{loadChangeIntervalDialog:()=>s})},59613:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(59672);let o=null;function n(e){const t=o=(0,s.loadChangeIntervalDialog)().then((i=>{t===o&&i.showChangeIntervalDialog(e)}));return t}},92572:(e,t,i)=>{"use strict";function s(e){return Promise.all([i.e(7629),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(1171),i.e(8933),i.e(2537),i.e(8894),i.e(5743),i.e(9487),i.e(3329),i.e(4678),i.e(4059),i.e(861),i.e(2227),i.e(9418),i.e(3179),i.e(4426),i.e(9928),i.e(8604),i.e(1859)]).then(i.bind(i,62256)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s})},70347:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()};window.TradingView.runOrSigninWithFeature=s},16708:(e,t,i)=>{"use strict";i.d(t,{DeleteLockedLineToolReason:()=>s,confirmRemovingLockedLineTools:()=>d,showDeleteLockedLineToolsConfirm:()=>h});var s,o=i(11542),n=i(3615),r=i(5734),a=i(89947);!function(e){e[e.RemoveSelected=0]="RemoveSelected",e[e.RemoveAll=1]="RemoveAll"}(s||(s={}));const l=o.t(null,void 0,i(41019)),c=o.t(null,void 0,i(41019));async function h(e,t){if(r.doNotShowDeleteLockedLineConfirmProperty.value())return void t(a.deleteLockedLineToolsProperty.value());const{getContent:h}=await Promise.all([i.e(7328),i.e(3425),i.e(6052),i.e(1065),i.e(4598)]).then(i.bind(i,30627));(0,n.showConfirm)({title:o.t(null,void 0,i(71692)),content:h(e===s.RemoveSelected?l:c),id:`${r.doNotShowDeleteLockedLineKey}-confirm`,mainButtonText:o.t(null,void 0,i(93123)),mainButtonIntent:"danger",cancelButtonText:o.t(null,void 0,i(99024)),onConfirm:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!0),t(!0),e()},onCancel:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!1),t(!1),e()}})}function d(e){return new Promise((t=>{h(e,t)}))}},31237:(e,t,i)=>{"use strict";i.d(t,{showDeleteStudyTreeConfirm:()=>r});var s=i(11542),o=i(3615);const n=5;function r(e,t){let r,a="";if(e.length>n){const t=e.length-n+1;r=e.slice(0,n-1),a=s.t(null,{plural:"and {nameCount} more indicators.",count:t},i(31550)).format({nameCount:t.toString()})}else r=e;const l=''+r.map((e=>`- ${e}
`)).join("")+"
"+a,c=s.t(null,void 0,i(4995))+l;(0,o.showConfirm)({title:s.t(null,void 0,i(97767)),html:c,mainButtonText:s.t(null,void 0,i(67410)),mainButtonIntent:"danger",cancelButtonText:s.t(null,void 0,i(4543)),onConfirm:({dialogClose:e})=>{t(),e()}})}},10341:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),o=i(3615);function n(e){(0,o.showWarning)({title:s.t(null,void 0,i(66719)),text:s.t(null,{replace:{number:`${e}`}},i(86146))})}},55279:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>o});let s=[];function o(e){s=e}
+function n(){return s}},84526:(e,t,i)=>{"use strict";function s(e){Promise.all([i.e(8622),i.e(8185),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3359),i.e(445),i.e(2112),i.e(9036),i.e(2227),i.e(9418),i.e(2477),i.e(9374)]).then(i.bind(i,46069)).then((({SymbolInfoDialogImpl:t})=>{t.getInstance().show(e)}))}i.d(t,{showSymbolInfoDialog:()=>s})},12362:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>d});var s=i(50279),o=i(50151),n=(i(11542),i(14411)),r=i(23024),a=i(48096),l=i(37103),c=i(81593);function h(e,t){e.content=JSON.stringify(t)}new WeakMap;new TextEncoder;class d{constructor(e){this._prevChartState=null,this._chartSavedDelegate=new a.Delegate,this._chartAboutToBeSavedDelegate=new a.Delegate,this._chartSizeLimitExceededDelegate=new a.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,o){if(l.enabled("saveload_separate_drawings_storage")){const n=await(0,r.getChartStorage)(),a=this.layoutId(),l=i=>n.saveLineToolsAndGroups(i,e,t,s,o);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){const s=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{const t=e&&l.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),o=this._getCommonSavingInfo(!1);return h(o,i),s.chartName&&(o.name=s.chartName),o.name&&0!==o.name.length||!s.defaultChartName||(o.name=s.defaultChartName),s.autoSave&&(o.autoSave=!0),o}),((t,i)=>{(0,o.assert)(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this.layoutId()===t.uid&&this._chartWidgetCollection.metaInfo.name.setValue(i.name??""),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid,data:i}),this._prevChartState&&delete this._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){const t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return h(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}isSaveInProcess(){return this._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,o){let n=!1;return e?n=!0:(t=!0,s=!1),this._chartWidgetCollection.state({withData:!!e,skipLineToolsFromOtherSymbols:!!i,wipeSensitiveData:!!s,skipLineTools:o,skipHiddenSources:n,addOnlyActiveChart:!t})}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols()[t.activeChartWidget.value().id()],s={...(o=i,{...o,legs:JSON.stringify(o.legs??[])})};var o;const n=t.metaInfo,r=n.id.value();return null!==r&&(s.id=r),s.name=n.name.value()||"",s.description=n.description.value()||"",
+s.is_realtime=s.is_realtime=e?"0":"1",s}async _saveLineToolsToStorage(){if(l.enabled("saveload_separate_drawings_storage")){this.layoutId();0;const[e,t]=this._chartWidgetCollection.getAll().reduce(((e,t)=>{const i=t.lineToolsSynchronizer();if(i){e[0]||=i.hasUnsavedMigrationsFromChartState();const t=i.flushPendingSavings();t&&e[1].push(t)}return e}),[!1,[]]);return t.length&&await Promise.all(t),t.length>0&&e}return!1}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.invalidateAll()))}_saveChartImpl(e,t,i,s,o,n){let r;r=s=>{t.uid||t.uid!==this.layoutId()||(t.id=s.result,t.uid=`${s.result}`,this._chartWidgetCollection.metaInfo.id.setValue(t.id),this._chartWidgetCollection.metaInfo.uid.setValue(t.uid)),i(t,e)},e.name?c.backend.saveChart(e.name,e.short_name,e.resolution,e,t).then(r).catch((async e=>{const t=e instanceof Response?e:void 0,i=e instanceof Error?e:void 0;this._savingToken=null;const o=s.bind(null,{status:t?.status,message:t?.statusText??i?.message??"Unknown error"});o()})):s({status:-1,message:"Saving chart with empty name is not allowed"})}async _saveChart(e,t,o,r){const a=this._chartWidgetCollection.metaInfo,c={name:a.name.value(),description:a.description.value(),uid:a.uid.value(),id:a.id.value(),lastModified:a.lastModified.value(),username:a.username.value(),isPrivate:a.isPrivate.value()};let h=r.changes??n.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage()&&(h|=1)}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id)return this._chartSavedDelegate.fire(!0),void t(c,i);0;const n=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.markAsValidatedBecauseOfSavingToContent())),t(e,i));return this._saveChartImpl(i,c,n,o,r,e)}this._chartSavedDelegate.fire(!0),t(c,e(d))}}},71846:(e,t,i)=>{"use strict";var s=i(12362).ChartSaverBase;i.i18next(null,void 0,i(49947));t.ChartSaver=class extends s{constructor(e){super(e)}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}publishChart(e){}publishScript(e,t,i){}isScriptNameValid(e){return""!==e.trim()&&e.length<=64}isScriptDescriptionValid(e){return""!==e.trim()&&e.length<=7e4}isScriptDescribersValid(e,t){return this.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(new Promise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},19e3:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},29242:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},58043:(e,t,i)=>{"use strict"
+;function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const o=e.length;for(;is})},39527:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],r=t[i];if(r===e)return;const a=Array.isArray(r);if(r&&(o(r)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&o(n)?n:{},e[i]=s(t,r)}else void 0!==r&&(e[i]=r)}))})),e):e}function o(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},88723:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},39058:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},4168:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>s.guid,randomHash:()=>s.randomHash,randomHashN:()=>s.randomHashN});var s=i(4226)},50470:(e,t,i)=>{"use strict";i.d(t,{parseHtml:()=>n,parseHtmlElement:()=>r});const s=new WeakMap;var o;function n(e,t){let i,o;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(o=s.get(i)),o||(o=i.ownerDocument.createRange(),o.selectNodeContents(i),s&&s.set(i,o)),o.createContextualFragment(e)}function r(e,t){const i=n(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}!function(e){e[e.Element=1]="Element",e[e.Document=9]="Document"}(o||(o={}))},26867:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const o=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(o.join(", "))&&e.preventDefault()}},53470:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},34369:e=>{e.exports=''},93544:e=>{
+e.exports=''},53573:e=>{e.exports=''},34487:e=>{e.exports=''},11890:e=>{e.exports=''},5845:e=>{e.exports=''},94839:e=>{e.exports=''},29453:e=>{e.exports=''},50946:e=>{e.exports=''},70893:e=>{
e.exports=''},1457:e=>{
e.exports=''},55824:e=>{e.exports=''},99875:e=>{e.exports=''},2872:e=>{e.exports=''},7983:e=>{e.exports=''},39267:e=>{e.exports=''},16911:e=>{e.exports=''},6862:e=>{e.exports=''},54190:e=>{e.exports=''},25191:e=>{
e.exports=''},93379:e=>{e.exports=''},84959:e=>{e.exports=''},97874:e=>{e.exports=''},1866:e=>{
diff --git a/charting_library/bundles/runtime.1d4ed3742895f7c63ed9.js b/charting_library/bundles/runtime.ddf792da21403fea7e07.js
similarity index 99%
rename from charting_library/bundles/runtime.1d4ed3742895f7c63ed9.js
rename to charting_library/bundles/runtime.ddf792da21403fea7e07.js
index a54ec1ae..c46686c9 100644
--- a/charting_library/bundles/runtime.1d4ed3742895f7c63ed9.js
+++ b/charting_library/bundles/runtime.ddf792da21403fea7e07.js
@@ -1,7 +1,7 @@
(()=>{"use strict";var e,a,c,d,f,b={},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,o),c.loaded=!0,c.exports}o.m=b,o.c=t,o._plural={ar:(e,a=6,c=(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5))=>null==e?0:+c,cs:(e,a=3,c=(1==e?0:e>=2&&e<=4?1:2))=>null==e?0:+c,ru:(e,a=3,c=(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2))=>null==e?0:+c,ro:(e,a=3,c=(1==e?0:e%100>19||e%100==0&&0!=e?2:1))=>null==e?0:+c,pl:(e,a=3,c=(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2))=>null==e?0:+c,pt:(e,a=2,c=1!=e)=>null==e?0:+c,de:(e,a=2,c=1!=e)=>null==e?0:+c,en:(e,a=2,c=1!=e)=>null==e?0:+c,es:(e,a=2,c=1!=e)=>null==e?0:+c,sv:(e,a=2,c=1!=e)=>null==e?0:+c,it:(e,a=2,c=1!=e)=>null==e?0:+c,tr:(e,a=2,c=1!=e)=>null==e?0:+c,el:(e,a=2,c=1!=e)=>null==e?0:+c,fr:(e,a=2,c=e>1)=>null==e?0:+c,fa:(e,a=1,c=0)=>null==e?0:+c,ja:(e,a=1,c=0)=>null==e?0:+c,ko:(e,a=1,c=0)=>null==e?0:+c,th:(e,a=1,c=0)=>null==e?0:+c,vi:(e,a=1,c=0)=>null==e?0:+c,zh:(e,a=1,c=0)=>null==e?0:+c,he_IL:(e,a=4,c=(1==e?0:2==e?1:e>10&&e%10==0?2:3))=>null==e?0:+c,ca_ES:(e,a=2,c=1!=e)=>null==e?0:+c,nl_NL:(e,a=2,c=1!=e)=>null==e?0:+c,hu_HU:(e,a=2,c=1!=e)=>null==e?0:+c,id_ID:(e,a=1,c=0)=>null==e?0:+c,ms_MY:(e,a=1,c=0)=>null==e?0:+c,zh_TW:(e,a=1,c=0)=>null==e?0:+c},e=[],o.O=(a,c,d,f)=>{if(!c){var b=1/0;for(r=0;r=f)&&Object.keys(o.O).every((e=>o.O[e](c[l])))?c.splice(l--,1):(t=!1,f0&&e[r-1][2]>f;r--)e[r]=e[r-1];e[r]=[c,d,f]},o.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return o.d(a,{a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var f=Object.create(null);o.r(f);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&d&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,o.d(f,b),f},o.d=(e,a)=>{for(var c in a)o.o(a,c)&&!o.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((a,c)=>(o.f[c](e,a),a)),[])),
o.u=e=>7617===e?"__LANG__.7617.cd80164477ae293d1bdf.js":8370===e?"__LANG__.8370.fa349b4816cd5b9bc50e.js":3721===e?"__LANG__.3721.cb0d7b01382649fffd1d.js":3581===e?"__LANG__.3581.29b14493cc3e702d776e.js":5121===e?"__LANG__.5121.a92442628878335f4f3c.js":7336===e?"__LANG__.7336.6e18afbcefc01fb0a06e.js":2346===e?"__LANG__.2346.a49a3f3441f33cfb055f.js":9520===e?"__LANG__.9520.56af53115bbb024475fe.js":91===e?"__LANG__.91.cfe4af4f43df761935ee.js":7871===e?"__LANG__.7871.59122d3f77e952e748d7.js":4040===e?"__LANG__.4040.6a01859316957dfa346e.js":8955===e?"__LANG__.8955.700afc0c6907cb35f040.js":2578===e?"__LANG__.2578.938cf92f5dab5e5b0f6a.js":3198===e?"__LANG__.3198.c73543d008f163aced66.js":3644===e?"__LANG__.3644.019797455a157bd8d965.js":1550===e?"__LANG__.1550.c851f7f3d80aa5a0a934.js":6342===e?"__LANG__.6342.85f957808125f840ce9a.js":8836===e?"__LANG__.8836.0ee8ffb3a9c55b7b58b3.js":4856===e?"__LANG__.4856.c3871a39af69453cb6ce.js":5234===e?"__LANG__.5234.986cc7933e7bf3aef5ec.js":2342===e?"__LANG__.2342.b15afe64e782db72472d.js":9426===e?"__LANG__.9426.516b9333f7265e656acf.js":6645===e?"__LANG__.6645.7ba6974e274efb237aba.js":3355===e?"__LANG__.3355.ac5731fdbc557b4fa953.js":3181===e?"__LANG__.3181.6f1f41b2f4a774e55fab.js":8896===e?"__LANG__.8896.55c7f87523b7cd780aed.js":9494===e?"__LANG__.9494.f0f29843a7ef74e68b5a.js":1427===e?"__LANG__.1427.108225f7c40f4967981f.js":7952===e?"__LANG__.7952.85afde6421df8ba2eb90.js":1308===e?"__LANG__.1308.bf60d54f92e58a11cef1.js":6760===e?"__LANG__.6760.f123afd5d94dec4ab450.js":6155===e?"__LANG__.6155.1bb6d590d58258e4ca2b.js":2303===e?"__LANG__.2303.b9f2005c3298b17e69c5.js":1432===e?"__LANG__.1432.16a1c5ab4a09534bf143.js":8763===e?"__LANG__.8763.1b022d608d6fadf0e635.js":7850===e?"__LANG__.7850.345c7f95940b47ec4aa3.js":7122===e?"__LANG__.7122.9f21877d4815945ac06f.js":4543===e?"__LANG__.4543.7f9d6f608dc178e710a6.js":5111===e?"__LANG__.5111.c4904e57d6f3d3bab2bf.js":5402===e?"__LANG__.5402.19446f1f611894261d5a.js":6290===e?"__LANG__.6290.a78fc99d10230f3f6323.js":8736===e?"__LANG__.8736.4e59a9d79d389b2f9ccd.js":7598===e?"__LANG__.7598.37348e19233483f5b004.js":3240===e?"__LANG__.3240.cbd133da26a90520ef36.js":4752===e?"__LANG__.4752.4b2e6ffeff801779d651.js":4109===e?"__LANG__.4109.f06cf21015312cc5fb37.js":1095===e?"__LANG__.1095.2b72aa95ba31c5a3e7d2.js":8975===e?"__LANG__.8975.32960d0fab142040a5de.js":3462===e?"__LANG__.3462.d46273e3a7aeebabb3ce.js":6778===e?"__LANG__.6778.7e992b7f13f1141f18e1.js":8622===e?"__LANG__.8622.0923d68d9f576c1c99b8.js":7629===e?"__LANG__.7629.f0fcaddae9863eeae12f.js":7328===e?"__LANG__.7328.846a89c55684c7825f53.js":6729===e?"__LANG__.6729.8f853252801947d589ee.js":8535===e?"__LANG__.8535.3d432e94419675297fed.js":5700===e?"__LANG__.5700.7faeb0b70cce839eea0c.js":1715===e?"__LANG__.1715.cdf667ccc2f352cc7781.js":1874===e?"__LANG__.1874.6736f182b5b04f0b0337.js":1629===e?"__LANG__.1629.ae7b8f399cea7d558be2.js":1861===e?"__LANG__.1861.7dfa9c241aa5b48b3e82.js":7037===e?"__LANG__.7037.07cb1c1fbb6b7560f350.js":({92:"chart-screenshot-hint",139:"get-error-card",319:"line-tool-table",
341:"line-tool-schiff-pitchfork2",360:"demonstration-highlighter",380:"line-tool-price-note",507:"study-pane-views",569:"line-tool-arrow-mark",574:"line-tool-horizontal-ray",607:"study-property-pages-with-definitions",620:"tablecontext-menu",688:"line-tool-callout",731:"add-compare-dialog",906:"line-tool-fib-speed-resistance-fan",925:"line-tool-extended",961:"line-tool-path",1155:"line-tool-5points-pattern",1277:"line-tool-balloon",1282:"line-tool-vertical-line",1313:"line-tool-pitch-fan",1314:"line-tool-position",1455:"line-tool-date-and-price-range",1470:"line-tool-arrow-marker",1506:"line-tool-fib-timezone",1583:"lt-pane-views",1584:"context-menu-renderer",1713:"line-tool-sine-line",1754:"symbol-search-dialog",1859:"go-to-date-dialog-impl",1890:"line-tools-icons",1963:"line-tool-gann-complex",2050:"line-tool-parallel-channel",2077:"change-interval-dialog",2087:"line-tool-highlighter",2183:"study-inputs-pane-views",2232:"line-tool-order",2283:"line-tool-fib-channel",2306:"floating-toolbars",2312:"line-tool-text",2377:"hammerjs",2413:"custom-themes-api",2704:"currency-label-menu",2816:"line-tool-fib-circles",2878:"drawing-toolbar",2962:"chart-floating-tooltip",3005:"header-toolbar",3030:"new-confirm-inputs-dialog",3248:"line-tool-note",3314:"line-tool-fib-wedge",3378:"line-tool-head-and-shoulders",3383:"line-tool-triangle-pattern",3555:"price-scale-mode-buttons-renderer",3596:"general-property-page",3710:"line-tool-fib-speed-resistance-arcs",3723:"line-tool-fib-retracement",3866:"line-tool-poly-line",3945:"line-tool-projection",3952:"line-tool-risk-reward",3966:"line-tool-comment",4013:"custom-intervals-add-dialog",4015:"line-tool-rotated-rectangle",4079:"series-pane-views",4201:"line-tool-horizontal-line",4273:"line-tool-date-range",4389:"take-chart-image-impl",4598:"delete-locked-line-confirm-dialog-content",4602:"line-tool-three-drivers",4674:"line-tool-signpost",4731:"line-tool-trend-based-fib-extension",4862:"object-tree-dialog",4934:"line-tool-ray",4981:"line-tool-gann-fan",5009:"load-chart-dialog",5055:"line-tool-pitchfork",5093:"chart-widget-gui",5122:"line-tool-brush",5206:"line-tool-bars-pattern",5231:"line-tool-image",5248:"library-studies",5283:"line-tool-abcd",5500:"line-tool-anchored-vwap",5516:"restricted-toolset",5529:"line-tool-emoji",5551:"favorite-drawings-api",5565:"ichart-storage",5572:"chart-floating-tooltip-activation-hint",5592:"chart-text-editor-renderer",5598:"lt-stickers-atlas",5639:"currency-label-menu-events",5695:"line-tool-volume-profile",5967:"line-tool-arc",6124:"chart-storage-library-http",6166:"chart-event-hint",6265:"new-edit-object-dialog",6336:"line-tool-gann-fixed",6432:"line-tool-triangle",6456:"study-market",6477:"line-tool-price-range",6484:"line-tool-price-label",6602:"chart-actions-provider",6631:"study-template-dialog",6740:"line-tool-cypher-pattern",6748:"line-tool-circle",6780:"source-properties-editor",7038:"insert-image-dialog",7078:"general-chart-properties-dialog",7127:"line-tool-trend-based-fib-time",7129:"line-tools-synchronizer",7175:"line-tool-schiff-pitchfork",
-7203:"line-tool-cross-line",7260:"chart-bottom-toolbar",7271:"compare-model",7488:"line-tool-info-line",7539:"studies",7553:"react-popper",7563:"line-tool-ghost-feed",7648:"show-theme-save-dialog",7660:"line-tool-ellipse",7806:"line-tool-icon",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8061:"line-tool-bezier-quadro",8090:"line-tool-fib-spiral",8313:"chart-storage-external-adapter",8334:"line-tool-time-cycles",8372:"line-tool-trend-angle",8422:"line-tool-rectangle",8468:"line-tool-inside-pitchfork",8537:"lt-property-pages-with-definitions",8607:"line-tool-arrow",8673:"line-tool-trend-line",8820:"line-tool-flag-mark",8890:"simple-dialog",8949:"line-tool-sticker",9014:"line-tool-bezier-cubic",9039:"lollipop-tooltip-renderer",9123:"line-tool-text-note",9310:"line-tool-flat-bottom",9374:"symbol-info-dialog-impl",9445:"line-tool-cyclic-lines",9478:"line-tool-gann-square",9498:"export-data",9534:"line-tool-prediction",9581:"line-tool-disjoint-channel",9685:"series-icons-map",9748:"line-tool-regression-trend",9754:"global-search-dialog",9790:"favorite-indicators"}[e]||e)+"."+{4:"e9f7877e2088cf681289",92:"20aec3fd3e04096eae8a",139:"9bac6b5005b2fe097cf3",159:"cbc87a51dd6c9a180ef8",319:"bfad5173227ff4b17ee9",341:"a9eb3484dc231697e64a",360:"7ab37b19fbd43b62435c",380:"0beb21ac39ce88afd40a",445:"947b894960c6e4035c0e",507:"ab403205125f170be9e2",509:"f24584403d44ed8cf3ed",569:"f0be320dc06ad56040bf",574:"7ff8a41f54edcb4ad73d",607:"c82ef5c409f191cc7c5d",620:"bcf3249fc32562e96280",624:"3b396e1376ddaa5e6358",628:"84f8ec3b19bcd5e342c8",683:"0d6a0e2ec02f15fe66eb",688:"0c88ce61641b39b90734",731:"3cab117ede5b1696d880",769:"cfef16111d0547178795",844:"c1e23fb55ad878f2607f",846:"baf9aedca844155d20c9",861:"d4f5022cd90ecd9d2455",903:"ef8462a4afcb96b7c33a",906:"d3f7742cd1f166c581ca",917:"41b6aa03c55ba682d104",925:"e847213b4f2f0347eec1",961:"654ee1abe8bd1c5165c5",986:"af29b1f88812e58c9f6c",1065:"1a73602ef366a609998c",1155:"6b6008c2c60cff13d7f4",1166:"a76cf4fe58acee8e54a9",1171:"e0f88030f3be0449d302",1277:"1e3ca2deba9ec68bfb74",1282:"3b73ca25e6d4f290597f",1313:"916eb4d87cdda49b9337",1314:"2506e7de45c96e5a349c",1450:"0f90392e173237a41bdd",1455:"68694affc8c3e0026b38",1470:"a0c22c988dfd930151e0",1485:"b8e04ff5bf844d3451c6",1488:"7a2557d0f4174d30ac4e",1506:"fc2e96a3d5be8f6cf400",1553:"ee2f0024a59277fd480e",1583:"46eba403be0c79c4c268",1584:"8c4f4cb9afe40b12ae55",1667:"ec7c9e13d3905c94b87f",1681:"890334aa5a1cc78f12c8",1697:"43150b369abc9d0324cd",1713:"7c959039148dcdcb411c",1727:"7ff9031cf392f780ce22",1754:"20a5ff1d11fd823861a0",1859:"31645b04b5b7067c6f13",1890:"593acab581cc4008ee11",1963:"39d46b134506f3af6fa4",1979:"286be1b48da9ba13da09",2050:"2a03f458a0e8196446f8",2077:"c0b97c344387b26d21f6",2087:"68a78bdd28274b4eee9e",2112:"0195ddd98768340d8fec",2164:"fcf5a0c7415d9ec1cd7c",2183:"46d4342f0c3b4c3d2ace",2202:"fddc8c100feabdd18b24",2227:"c1c4b4d4d12f9774793f",2232:"29d5136824af61f3f42d",2283:"7bfc63a600845bb7c674",2306:"e8ff289dd4e8225bc29e",2307:"66d27ab06c446545a05e",2312:"cd23d9dd0093c019ab0c",2318:"141ae360b6739148b2e9",
+7203:"line-tool-cross-line",7260:"chart-bottom-toolbar",7271:"compare-model",7488:"line-tool-info-line",7539:"studies",7553:"react-popper",7563:"line-tool-ghost-feed",7648:"show-theme-save-dialog",7660:"line-tool-ellipse",7806:"line-tool-icon",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8061:"line-tool-bezier-quadro",8090:"line-tool-fib-spiral",8313:"chart-storage-external-adapter",8334:"line-tool-time-cycles",8372:"line-tool-trend-angle",8422:"line-tool-rectangle",8468:"line-tool-inside-pitchfork",8537:"lt-property-pages-with-definitions",8607:"line-tool-arrow",8673:"line-tool-trend-line",8820:"line-tool-flag-mark",8890:"simple-dialog",8949:"line-tool-sticker",9014:"line-tool-bezier-cubic",9039:"lollipop-tooltip-renderer",9123:"line-tool-text-note",9310:"line-tool-flat-bottom",9374:"symbol-info-dialog-impl",9445:"line-tool-cyclic-lines",9478:"line-tool-gann-square",9498:"export-data",9534:"line-tool-prediction",9581:"line-tool-disjoint-channel",9685:"series-icons-map",9748:"line-tool-regression-trend",9754:"global-search-dialog",9790:"favorite-indicators"}[e]||e)+"."+{4:"e9f7877e2088cf681289",92:"20aec3fd3e04096eae8a",139:"9bac6b5005b2fe097cf3",159:"cbc87a51dd6c9a180ef8",319:"bfad5173227ff4b17ee9",341:"a9eb3484dc231697e64a",360:"7ab37b19fbd43b62435c",380:"0beb21ac39ce88afd40a",445:"947b894960c6e4035c0e",507:"ab403205125f170be9e2",509:"f24584403d44ed8cf3ed",569:"f0be320dc06ad56040bf",574:"7ff8a41f54edcb4ad73d",607:"c82ef5c409f191cc7c5d",620:"bcf3249fc32562e96280",624:"3b396e1376ddaa5e6358",628:"84f8ec3b19bcd5e342c8",683:"0d6a0e2ec02f15fe66eb",688:"0c88ce61641b39b90734",731:"3cab117ede5b1696d880",769:"cfef16111d0547178795",844:"c1e23fb55ad878f2607f",846:"baf9aedca844155d20c9",861:"d4f5022cd90ecd9d2455",903:"ef8462a4afcb96b7c33a",906:"d3f7742cd1f166c581ca",917:"41b6aa03c55ba682d104",925:"e847213b4f2f0347eec1",961:"654ee1abe8bd1c5165c5",986:"af29b1f88812e58c9f6c",1065:"1a73602ef366a609998c",1155:"6b6008c2c60cff13d7f4",1166:"a76cf4fe58acee8e54a9",1171:"e0f88030f3be0449d302",1277:"1e3ca2deba9ec68bfb74",1282:"3b73ca25e6d4f290597f",1313:"916eb4d87cdda49b9337",1314:"2506e7de45c96e5a349c",1450:"0f90392e173237a41bdd",1455:"68694affc8c3e0026b38",1470:"a0c22c988dfd930151e0",1485:"d2c9ddbfe2c9c5be9408",1488:"7a2557d0f4174d30ac4e",1506:"fc2e96a3d5be8f6cf400",1553:"ee2f0024a59277fd480e",1583:"46eba403be0c79c4c268",1584:"8c4f4cb9afe40b12ae55",1667:"ec7c9e13d3905c94b87f",1681:"890334aa5a1cc78f12c8",1697:"43150b369abc9d0324cd",1713:"7c959039148dcdcb411c",1727:"98e9d718a90f5c1c2f73",1754:"20a5ff1d11fd823861a0",1859:"31645b04b5b7067c6f13",1890:"593acab581cc4008ee11",1963:"39d46b134506f3af6fa4",1979:"286be1b48da9ba13da09",2050:"2a03f458a0e8196446f8",2077:"c0b97c344387b26d21f6",2087:"68a78bdd28274b4eee9e",2112:"0195ddd98768340d8fec",2164:"fcf5a0c7415d9ec1cd7c",2183:"46d4342f0c3b4c3d2ace",2202:"fddc8c100feabdd18b24",2227:"c1c4b4d4d12f9774793f",2232:"29d5136824af61f3f42d",2283:"7bfc63a600845bb7c674",2306:"e8ff289dd4e8225bc29e",2307:"66d27ab06c446545a05e",2312:"cd23d9dd0093c019ab0c",2318:"141ae360b6739148b2e9",
2377:"6e30e0c48af40bf2f6c0",2413:"91c6261b25d95d0206c9",2475:"1ed8b62332af605c5bee",2477:"44f2c96353966357ded8",2537:"757e1b655415c200c3d1",2641:"6bc828587e178a0d5a82",2647:"a5bd9c1c3a60a1a33fbc",2704:"7b67895aa33526804d36",2745:"73995b6670d622d97310",2816:"8233da87004918cf16a9",2878:"6b7c3410c1316a4d200d",2891:"ac7f12fc1eff206762f9",2962:"ee7512aef60ddf211a3a",3005:"2a1db3d6309536cde3c0",3014:"0d409362ec30f40d042e",3030:"dcc30f3b10fd6f3fbf5d",3179:"78787edf30f25d297844",3248:"676be3f4442ff78d5909",3290:"6910babced1a4b7d82c4",3314:"61f270a9e021377493ed",3329:"3b6659d129ab817bf283",3359:"1b4513bbb949dd541093",3378:"22b0af1ad7bc3caff507",3383:"7639e6b21de21984b315",3425:"af0c72a8ad3cbb55c070",3439:"6edfdd8233c74ba93ffe",3460:"74c66fe5d6bb7d727f80",3476:"8eebafed8a9bfd4d994f",3555:"8233b5c0f504dc44029c",3596:"79d509486a68c67bd42f",3637:"e64dc1e10403bb8fd262",3672:"570d4e00cc01ba41bcbb",3710:"acc36603d066c9ff74f4",3723:"7335c975cc2059982d78",3853:"4937ff6eb025cfe033b4",3866:"03d73838d0c3f6e6175f",3945:"ba7b0e3fd2be17890ee3",3946:"9d95111f4d6d5b4bfe5c",3952:"3892601e661ca0cce990",3966:"6ed22a54d039cd836365",4013:"b8d6122ddbbdb8e39789",4015:"945c9c31a5cee9d3ec48",4059:"661b68c32b4d54e6e0b3",4079:"d0fc27c1b07f5dd20dee",4201:"78f078e0d615080aa096",4240:"8d07b4c64394ebb30caf",4248:"5196f36fe87bffc5d369",4273:"0132e0e4462b6a180a0e",4389:"6e666e01441227ae61e3",4422:"0cb0df3f853033542a6d",4426:"4117c7a82199deed7db8",4495:"5a1c9623236398857e9d",4587:"97df39319183f566cbed",4598:"929d7a8647b3a31b6ab6",4602:"bccaa58617af6b80394c",4633:"41bc9073db4c6464bfe9",4674:"dc3ff0721cdfd2f1f2d7",4678:"42e9586c89b5320f9169",4719:"84dbe54b64e289f139c3",4731:"dc36aa4a1036fb9527b0",4765:"61e6a00741e34817e943",4862:"254833ed6030cf146329",4931:"f6d9da1269f09f247d63",4934:"3acbaa057b9c87dd7988",4981:"c59f4d3b2dc0a2024eaf",5009:"d56997e275ea6c8ce8e8",5055:"a88013f12dd83e1452ad",5093:"4ec424eb56739ee22285",5122:"89cef390d6784c56bef1",5206:"52a3e11d9b3b5bc1646b",5231:"e3ddef45e551d908b5f6",5248:"39ff0f3eccbe95f714c4",5283:"be622efff93d74be8bbb",5371:"9de35d41d3d3e039c8de",5386:"400def58328bce500f3d",5410:"d55fe54ddbf5d3a1d03e",5445:"7b009df16b3b27c38689",5456:"5550ada1b5274d2b1fc9",5500:"ee34ab83987798413131",5516:"85a0d8dc30a084c60f7d",5529:"6cae9429d8424851a2a2",5551:"201637bb9164a0295e57",5563:"83a4f87818bf4ff2bfe8",5565:"1144e5a1b4f8503ee572",5572:"c120f2a52855c1fe7d0f",5592:"b48fc8c98953c7eda089",5598:"9df1e0887f8f2a9647cd",5639:"cce0f47b553a89bc56af",5695:"301c7c0b2d7d0d350c2e",5705:"3cfd1fd3b91f816a5125",5743:"771457a25aa42edee0ff",5834:"69ab2e5fa5d329989319",5893:"e5c9a9c5e41a157ad197",5967:"5875f32d774104aec9cc",6025:"bd352ea0e85294a25497",6032:"c695879e27813308dd9e",6043:"72c78cd6a493066e3f6a",6052:"280b181318e81a6ba94d",6094:"6f20060bb84156233774",6124:"6b7203a5d4ce2ebe7728",6166:"523a7e995356abbe4417",6178:"21167b99135337cfb9e1",6193:"15a1126a4ea5d5a80cbc",6195:"2a2e890e37c620dd8a6b",6265:"361202b1c34b1599dc84",6336:"a290d202d5b312334a52",6376:"482cfbb8133455c17c92",6432:"3ebd6a05e3dfa3144914",6456:"2204b6a90bef20ca1042",
6477:"a6e3dd8f0814081210f4",6484:"3f630bc80a66fbab32c7",6602:"5db78c705ae2a12ecca3",6631:"53e20cb6fcfea8a141f8",6633:"ce659c5f85016e2da899",6668:"0e223b3dc3e6bb3bdb80",6697:"6e2317eb6e10b3735190",6740:"96f4b196b30af8149b1c",6748:"55c4519e230a1ecdb2a0",6780:"7a5c1b3e221693ee044c",6864:"279ef4c9539497429e92",6870:"24242fd039923007864f",6954:"080101562d2c5bb23540",6956:"bcfe4e0c904e0632995c",7038:"aa6d69b04635c68a27c7",7078:"3c4da8067ded124e4550",7127:"05844bc9d761ae4120b3",7129:"9ffb159f9a256ce9891e",7175:"a89eba2b1fd6dbea7597",7203:"e2d5a96e3878862a52a0",7260:"6ceb4aef3a79d9831607",7271:"f01e49e03e8825756d78",7369:"d67754d2d1e6cd4a44cc",7399:"7fd926a23ad78726980d",7437:"7596a99a3f7c5f7d8009",7463:"75e07b6f3ad409e47e9e",7488:"49e58aee829a5e999fc4",7519:"01180f215ff7af433df6",7539:"3ad353a5758b0064f87a",7553:"b1e6942ddf9308862833",7563:"75238f216412b5b0e268",7648:"459f47945f2aa1d9d634",7660:"e25d052f78f749289278",7682:"0af9f99ebcf82f1d5e87",7691:"4fb3dccf1633e286214e",7777:"30fdb48f3b1c2bddfa9a",7780:"98495589560ea0cb6ff5",7806:"f1cb45a285a1a13e744c",7827:"f9257d961450fe4aaccb",7833:"1fe6e910e77fd7261449",7903:"213d45b03f5212091898",7987:"44402958fd0934b94ac1",8020:"e90e05d2b7455360cb92",8061:"d3d3437db87092392682",8090:"64de1f98a3e94f14b9d1",8093:"15bdc35e257d730d0e71",8185:"fefab7a1a5f120cf5ab9",8220:"2a38ccbdd84f1abe7915",8260:"2d3311187bd6b3c611b2",8313:"9c1267d07e48b8d8f53f",8334:"4d1e9c3ebcc966dc3fbb",8372:"599f71b4f74f08c1cc64",8402:"8d6877692120b620a62f",8422:"216a3e91b03758570d50",8468:"365a9361e977be1706b4",8537:"6830c12ee5b23fa3f44b",8604:"f5c94c10beff56dd17a0",8607:"df25e780dfd698c5a129",8673:"e757c9194429a5eb95fe",8752:"2a3dca6ff062a372cc7c",8820:"8a8c7003ba1bc6c0214c",8823:"d0f6a13ebe9b55e5ae25",8890:"3c45f27ba6b780f9400c",8894:"1683e77c7e5628df4950",8933:"6cb7f1f9073b85d8c845",8949:"e181251198aaa1117d54",9002:"444dbc0f0b0d52291fab",9014:"31c32a1a84600d0f1c1f",9036:"9953ef9e5769935c7d74",9039:"1afddcf7bdf27af86d03",9123:"ad640e5494bbbc11419c",9297:"6ea3acdbf182c6c13ce8",9310:"a66b1a03e022c1dcb27e",9323:"dd7d6e1bcd754d2b0e8c",9374:"0c0a6ebf536991d0d4a2",9378:"dbb8d40e653f515b8f67",9418:"963c6d55bb9a6e9d6402",9445:"3903f31dd6234b01103e",9468:"c4efc189b2e620d1c20a",9478:"fb2d6fbc8234a4cab300",9487:"18e48cb0664ad0850dcc",9498:"0e123d391a9c2338f4ae",9534:"c451035dd0fa34ea862a",9581:"1029215755374bd9b1bf",9590:"01544016ba818c77f7df",9646:"be31e7fc19174a6d5c4a",9658:"63d5629b678ac1549bcd",9685:"0fab90a4ed52f242db2f",9742:"66d9c870e64bb83a87e4",9748:"012a564374d0cb602844",9754:"f532e65043c071476f6b",9790:"fa8f30be53475647c1ed",9836:"ddd6d83413044c8048bf",9928:"65ec9af0076c17eaa8c1",9965:"f8cf217d1e8bc83d432b",9970:"08d56f22bb40e2ab1088"}[e]+".js",o.miniCssF=e=>e+"."+{4:"975cc7b264b6bd3c596d",159:"3e4f89ce6749c1e5f8df",445:"8577632fdab29ee53ddf",509:"7e5e9ba6624b240fc4c7",628:"b8ffba49e1636aade6c4",683:"9ce134321e5f7ed1c4ad",844:"4db113a94ddabe52ea7c",846:"783c8fdad80b7ee894e8",861:"d3c8a2d509847638ea25",903:"e764dd9f961674c26dbd",1065:"d8e66f4c4d6c2e5e9e51",1166:"fa77c9e386a131cac9da",1171:"146c7925be9f43c9c767",
1450:"8f1c6b9900df1caf5e97",1488:"720d3939e07b55dd54ff",1667:"a0f6cab48aafa4924d69",1681:"df517de208b59f042c3b",1697:"042d72d2c0eaafd88d54",1979:"727d53fabf38782d4a1f",2112:"10fd79bdcf7d87919e93",2202:"414409a383bce0796e9b",2307:"2fb1c26f9bc4323a9ce1",2318:"8bdd9c9cc1661e5b303f",2537:"a8e87c60a250a6212b03",2641:"8fe6a787670a4a8ef383",2647:"a9ca47adf1a97f5f023d",3014:"b5b7477b23dda9a91666",3290:"dfbe2771427c6e7a0057",3329:"e21e82febf357ba86937",3359:"515b38c2fad56295e0d7",3425:"2c71d427960b55da9a78",3439:"18a88ac7f1dc31fa83da",3460:"ee113a455fc80caafc76",3476:"30d51195eb2fb72fcf64",3637:"9a63d1db88d74be3cc39",3672:"362fa6a7ab1f3e3b06c4",3853:"4ae445e5f095a01ba045",3946:"7318655b786d7fb40f50",4059:"b6fc40ed6b3d8311f086",4240:"56bc31ea089745c54b33",4248:"9515eeb06dd8e381efe7",4422:"78e9455cd23b69174473",4495:"be501b970b417ba6c2a8",4587:"2fb5f6f3eb739c16078d",4633:"add1585dafb8756f4ac1",4678:"3a91d5cb712d91b3d494",4719:"a3b6b5f9792e79b01fbc",4765:"e81302eea6c8be4f4718",5371:"76e4283712e58a36266a",5445:"093db358753a840ab939",5563:"2020d73e26d49ab4f152",5743:"efabcbfa402a97d8655c",5834:"79247ad88246410e4399",6032:"128b53aa00cd47668af0",6043:"16c0fd7539d08ad5ffd3",6052:"d49d6f461c53e70b38bc",6094:"a6a9dab4a3149840bbeb",6178:"39e6202ba00cf6f84f33",6195:"dd31c566c5cea85cb34d",6633:"50b8e8846c82b9394624",6697:"401ea4c022390e1da1c1",6870:"bf8e610b24f018b18606",6954:"d4ea7d03cf19941c7fa4",6956:"bb51b63e079c12f34d9d",7369:"488cdb889af5bc213e7a",7399:"f60e2fa80861d26a1fe2",7463:"0c60a2665496872c6cc1",7519:"a7570fbc77731eca9b60",7682:"0b2eb20106b0fa40dbc9",7691:"ce7b2959f31f83034b45",7777:"891d2b2ce44704ebece2",7780:"dad95b9e4df028f98405",7827:"6ac93924147c2fb8d322",7833:"f2e1edd6097be38e73da",8185:"fbb750fd312778403036",8220:"dd6dce5d2a6f56d0f41e",8260:"62352517083dd5dfd292",8752:"52267c3fa7dd7ef53af4",8894:"b07b23323d7ced0545c0",8933:"45a42558763ddf6de336",9002:"bb4d91a9e1bdd3b5c7da",9036:"0585c4fac59f4fe82f95",9297:"f956807450cbc2bb54ad",9323:"b86e76f1c9dea8b48f7e",9468:"8628031453e97b61d8a0",9487:"31287178347f44fad165",9590:"56ae013b90ba2722383d",9646:"1f177ff6c1d61bbb7d1a",9658:"a9e76e41b28aa8a84efe",9742:"4d4891102ba1094f3993",9836:"c5a2f31610f22e588456",9965:"99898a3b8bbfa6046421",9970:"3bc725690d7178ac1772"}[e]+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},f="tradingview:",o.l=(e,a,c,b)=>{if(d[e])d[e].push(a);else{var t,l;if(void 0!==c)for(var n=document.getElementsByTagName("script"),r=0;r{t.onerror=t.onload=null,clearTimeout(_);var f=d[e];if(delete d[e],
diff --git a/charting_library/charting_library.cjs.js b/charting_library/charting_library.cjs.js
index 1d444640..6e58365c 100644
--- a/charting_library/charting_library.cjs.js
+++ b/charting_library/charting_library.cjs.js
@@ -1 +1 @@
-"use strict";var e,t,i,o,r,n,a,s,l,d,c,h,g,u,C,p,S,m,y,T,_,b,P,L,w,A,f,v,I,O,R,D,x,k,V,F,W,E,M,B,N,U,H,j,z,G,$,J,K,q,Z,Q,Y,X,ee,te,ie,oe,re,ne,ae,se,le,de,ce,he,ge,ue,Ce,pe,Se,me,ye,Te,_e,be,Pe,Le,we,Ae,fe,ve,Ie,Oe,Re,De;function xe(e,t){const i={...e};for(const o in t)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==t[o]&&(i[o]=t[o]):i[o]=xe(e[o],t[o]);return i}exports.ActionId=void 0,(e=exports.ActionId||(exports.ActionId={})).UnknownAction="UnknownAction",e.Spinner="Spinner",e.Loading="Loading",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertsClone="Alerts.Clone",e.AlertsRemove="Alerts.Remove",e.AlertsRemoveAll="Alerts.RemoveAll",e.AlertsRemoveFiltered="Alerts.RemoveFiltered",e.AlertsRemoveAllInactive="Alerts.RemoveAllInactive",e.AlertsRemoveAllWatchlistInactive="Alerts.RemoveAllWatchlistInactive",e.AlertsRemoveFires="Alerts.RemoveFires",e.AlertsRestart="Alerts.Restart",e.AlertsRestartAllInactive="Alerts.RestartAllInactive",e.AlertsRestartFilteredInactive="Alerts.RestartFilteredInactive",e.AlertsStop="Alerts.Stop",e.AlertsStopAll="Alerts.StopAll",e.AlertsStopFilteredActive="Alerts.StopFilteredActive",e.AlertsExportFiresToCSV="Alerts.ExportFiresToCSV",e.AlertsLogClear="AlertsLog.Clear",e.AlertsLogRemoveFiltered="AlertsLog.RemoveFiltered",e.ChartAddIndicatorToAllCharts="Chart.AddIndicatorToAllCharts",e.ChartAddSymbolToWatchList="Chart.AddSymbolToWatchList",e.ChartAlertLabelToggleExtendLines="Chart.AlertLabel.ToggleExtendLines",e.ChartApplyIndicatorsToAllCharts="Chart.ApplyIndicatorsToAllCharts",e.ChartIndicatorApplyChildIndicator="Chart.Indicator.ApplyChildIndicator",e.ChartIndicatorApplyFinancials="Chart.Indicator.ApplyFinancials",e.ChartIndicatorAbout="Chart.Indicator.About",e.ChartIndicatorPineLogs="Chart.Indicator.PineLogs",e.ChartIndicatorPineSource="Chart.Indicator.PineSource",e.ChartIndicatorAddFavorites="Chart.Indicator.AddFavorites",e.ChartChangeTimeZone="Chart.ChangeTimeZone",e.ChartClipboardCopyPrice="Chart.Clipboard.CopyPrice",e.ChartClipboardCopyLineTools="Chart.Clipboard.CopyLineTools",e.ChartClipboardCopySource="Chart.Clipboard.CopySource",e.ChartClipboardPasteSource="Chart.Clipboard.PasteSource",e.ChartCrosshairLockVerticalCursor="Chart.Crosshair.LockVerticalCursor",e.ChartCrosshairPlusButtonDrawHorizontalLine="Chart.Crosshair.PlusButton.DrawHorizontalLine",e.ChartCustomActionId="Chart.CustomActionId",e.ChartDialogsShowChangeInterval="Chart.Dialogs.ShowChangeInterval",e.ChartDialogsShowChangeSymbol="Chart.Dialogs.ShowChangeSymbol",e.ChartDialogsShowCompareOrAddSymbol="Chart.Dialogs.ShowCompareOrAddSymbol",e.ChartDialogsShowGeneralSettings="Chart.Dialogs.ShowGeneralSettings",e.ChartDialogsShowGeneralSettingsLegendTab="Chart.Dialogs.ShowGeneralSettings.LegendTab",e.ChartDialogsShowGeneralSettingsSymbolTab="Chart.Dialogs.ShowGeneralSettings.SymbolTab",e.ChartDialogsShowGeneralScalesTab="Chart.Dialogs.ShowGeneralSettings.ScalesTab",e.ChartDialogsShowGeneralSettingsEventsTab="Chart.Dialogs.ShowGeneralSettings.EventsTab",e.ChartDialogsShowGeneralSettingsAlertsTab="Chart.Dialogs.ShowGeneralSettings.AlertsTab",e.ChartDialogsShowGoToDate="Chart.Dialogs.ShowGoToDate",e.ChartDialogsShowInsertIndicators="Chart.Dialogs.ShowInsertIndicators",e.ChartDialogsShowInsertFinancials="Chart.Dialogs.ShowInsertFinancials",e.ChartDialogsShowInsertSeasonals="Chart.Dialogs.ShowInsertSeasonals",e.ChartDialogsShowInsertStockBonds="Chart.Dialogs.ShowInsertStockBonds",e.ChartDialogsShowInsertAnalysis="Chart.Dialogs.ShowInsertAnalysis",e.ChartDialogsShowInsertTechnicals="Chart.Dialogs.ShowInsertTechnicals",e.ChartDialogsShowInsertForecast="Chart.Dialogs.ShowInsertForecast",e.ChartDialogsShowInsertOptions="Chart.Dialogs.ShowInsertOptions",e.ChartDetailsMetricsActionId="Chart.Dialogs.DetailsMetrics",e.ChartDialogsShowInsertEconomyIndicators="Chart.Dialogs.ShowInsertEconomyIndicators",e.ChartDialogsShowSymbolInfo="Chart.Dialogs.ShowSymbolInfo",e.ChartDrawingToolbarToggleVisibility="Chart.DrawingToolbar.ToggleVisibility",e.ChartExternalActionId="Chart.ExternalActionId",e.ChartFavoriteDrawingToolsToolbarHide="Chart.FavoriteDrawingToolsToolbar.Hide",e.ChartIndicatorShowSettingsDialog="Chart.Indicator.ShowSettingsDialog",e.ChartLegendToggleLastDayChangeValuesVisibility="Chart.Legend.ToggleLastDayChangeValuesVisibility",e.ChartLinkingGroupSync="Chart.LinkingGroupSync",e.ChartLinkingGroupSyncChangeGroup="Chart.LinkingGroupSync.ChangeGroup",e.ChartLegendToggleBarChangeValuesVisibility="Chart.Legend.ToggleBarChangeValuesVisibility",e.ChartLegendTogglePriceSourceVisibility="Chart.Legend.TogglePriceSourceVisibility",e.ChartLegendToggleIndicatorArgumentsVisibility="Chart.Legend.ToggleIndicatorArgumentsVisibility",e.ChartLegendToggleIndicatorTitlesVisibility="Chart.Legend.ToggleIndicatorTitlesVisibility",e.ChartLegendToggleIndicatorValuesVisibility="Chart.Legend.ToggleIndicatorValuesVisibility",e.ChartLegendToggleOhlcValuesVisibility="Chart.Legend.ToggleOhlcValuesVisibility",e.ChartLegendToggleOpenMarketStatusVisibility="Chart.Legend.ToggleOpenMarketStatusVisibility",e.ChartLegendToggleSymbolVisibility="Chart.Legend.ToggleSymbolVisibility",e.ChartLegendToggleVolumeVisibility="Chart.Legend.ToggleVolumeVisibility",e.ChartLines="Chart.Lines",e.ChartLinesToggleBidAskLinesVisibility="Chart.Lines.ToggleBidAskLinesVisibility",e.ChartLinesToggleHighLowLinesVisibility="Chart.Lines.ToggleHighLowLinesVisibility",e.ChartLinesToggleAverageLineVisibility="Chart.Lines.ToggleAverageLineVisibility",e.ChartLinesTogglePrePostMarketPriceLineVisibility="Chart.Lines.TogglePrePostMarketPriceLineVisibility",e.ChartLinesToggleSeriesPrevCloseLineVisibility="Chart.Lines.ToggleSeriesPrevCloseLineVisibility",e.ChartLinesToggleSeriesPriceLineVisibility="Chart.Lines.ToggleSeriesPriceLineVisibility",e.ChartLineToolBarsPatternToggleFlipped="Chart.LineTool.BarsPattern.ToggleFlipped",e.ChartLineToolBarsPatternToggleMirrored="Chart.LineTool.BarsPattern.ToggleMirrored",e.ChartLineToolRiskRewardReverse="Chart.LineTool.RiskReward.Reverse",e.ChartLineToolClone="Chart.LineTool.Clone",e.ChartLineToolCreateLimitOrderFromState="Chart.LineTool.CreateLimitOrderFromState",e.ChartLineToolElliotChangeDegreeProperty="Chart.LineTool.Elliot.ChangeDegreeProperty",e.ChartLineToolNoSync="Chart.LineTool.NoSync",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.ChartLineToolSyncInLayout="Chart.LineTool.SyncInLayout",e.ChartLineToolSyncGlobally="Chart.LineTool.SyncGlobally",e.ChartLineToolTemplates="Chart.LineTool.Templates",e.ChartLineToolTemplatesApply="Chart.LineTool.Templates.Apply",e.ChartLineToolTemplatesApplyDefaults="Chart.LineTool.Templates.ApplyDefaults",e.ChartLineToolTemplatesSaveAs="Chart.LineTool.Templates.SaveAs",e.ChartLineToolToolbarChangeFontSizeProperty="Chart.LineTool.Toolbar.ChangeFontSizeProperty",e.ChartLineToolToolbarChangeLineStyleToDashed="Chart.LineTool.Toolbar.ChangeLineStyleToDashed",e.ChartLineToolToolbarChangeLineStyleToDotted="Chart.LineTool.Toolbar.ChangeLineStyleToDotted",e.ChartLineToolToolbarChangeLineStyleToSolid="Chart.LineTool.Toolbar.ChangeLineStyleToSolid",e.ChartMarksToggleVisibility="Chart.Marks.ToggleVisibility",e.ChartMoveChartInLayout="Chart.MoveChartInLayout",e.ChartMoveChartInLayoutBack="Chart.MoveChartInLayout.Back",e.ChartMoveChartInLayoutForward="Chart.MoveChartInLayout.Forward",e.ChartTpoResetAllMergesAndSplits="Chart.TPO.ResetAllMergesAndSplits",e.ChartTpoSplitBlock="Chart.TPO.SplitBlock",e.ChartTpoMergeBlock="Chart.TPO.MergeBlock",e.ChartObjectTreeShow="Chart.ObjectTree.Show",e.ChartDataWindowShow="Chart.DataWindow.Show",e.ChartPaneControlsDeletePane="Chart.PaneControls.DeletePane",e.ChartPaneControlsMaximizePane="Chart.PaneControls.MaximizePane",e.ChartPaneControlsMinimizePane="Chart.PaneControls.MinimizePane",e.ChartPaneControlsMovePaneDown="Chart.PaneControls.MovePaneDown",e.ChartPaneControlsMovePaneUp="Chart.PaneControls.MovePaneUp",e.ChartPaneControlsCollapsePane="Chart.PaneControls.CollapsePane",e.ChartPaneControlsRestorePane="Chart.PaneControls.RestorePane",e.ChartPriceScaleLabels="Chart.PriceScale.Labels",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.ChartPriceScaleLabelsToggleNoOverlappingLabelsVisibility="Chart.PriceScale.Labels.ToggleNoOverlappingLabelsVisibility",e.ChartPriceScaleLabelsToggleSeriesLastValueVisibility="Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",e.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility="Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",e.ChartPriceScaleLabelsToggleSymbolPrevCloseValueVisibility="Chart.PriceScale.Labels.ToggleSymbolPrevCloseValueVisibility",e.ChartPriceScaleMergeAllScales="Chart.PriceScale.MergeAllScales",e.ChartPriceScaleMergeAllScalesToLeft="Chart.PriceScale.MergeAllScalesToLeft",e.ChartPriceScaleMergeAllScalesToRight="Chart.PriceScale.MergeAllScalesToRight",e.ChartPriceScaleMoveToLeft="Chart.PriceScale.MoveToLeft",e.ChartPriceScaleMoveToRight="Chart.PriceScale.MoveToRight",e.ChartPriceScaleReset="Chart.PriceScale.Reset",e.ChartPriceScaleToggleAddOrderPlusButtonVisibility="Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",e.ChartPriceScaleToggleAutoScale="Chart.PriceScale.ToggleAutoScale",e.ChartPriceScaleToggleAutoScaleSeriesOnly="Chart.PriceScale.ToggleAutoScaleSeriesOnly",e.ChartPriceScaleToggleCountdownToBarCloseVisibility="Chart.PriceScale.ToggleCountdownToBarCloseVisibility",e.ChartPriceScaleToggleIndexedTo100="Chart.PriceScale.ToggleIndexedTo100",e.ChartPriceScaleToggleInvertScale="Chart.PriceScale.ToggleInvertScale",e.ChartPriceScaleToggleLogarithmic="Chart.PriceScale.ToggleLogarithmic",e.ChartPriceScaleTogglePercentage="Chart.PriceScale.TogglePercentage",e.ChartPriceScaleToggleRegular="Chart.PriceScale.ToggleRegular",e.ChartRedo="Chart.Redo",e.ChartRemoveAllIndicators="Chart.RemoveAllIndicators",e.ChartRemoveAllIndicatorsAndLineTools="Chart.RemoveAllIndicatorsAndLineTools",e.ChartRemoveAllLineTools="Chart.RemoveAllLineTools",e.ChartScalesReset="Chart.Scales.Reset",e.ChartScalesToggleLockPriceToBarRatio="Chart.Scales.ToggleLockPriceToBarRatio",e.ChartScrollToLineTool="Chart.ScrollToLineTool",e.ChartSelectedObjectHide="Chart.SelectedObject.Hide",e.ChartSelectedObjectRemove="Chart.SelectedObject.Remove",e.ChartSelectedObjectShow="Chart.SelectedObject.Show",e.ChartSelectedObjectShowSettingsDialog="Chart.SelectedObject.ShowSettingsDialog",e.ChartSelectedObjectInsertRowTable="Chart.SelectedObject.InsertRowTable",e.ChartSelectedObjectInsertColumnTable="Chart.SelectedObject.InsertColumnTable",e.ChartSelectedObjectRemoveRowTable="Chart.SelectedObject.RemoveRowTable",e.ChartSelectedObjectRemoveColumnTable="Chart.SelectedObject.RemoveColumnTable",e.ChartSelectedObjectToggleLocked="Chart.SelectedObject.ToggleLocked",e.ChartSelectedObjectToggleAnchored="Chart.SelectedObject.ToggleAnchored",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.ChartSetSession="Chart.SetSession",e.ChartSourceChangePriceScale="Chart.Source.ChangePriceScale",e.ChartSourceMergeDown="Chart.Source.MergeDown",e.ChartSourceMergeUp="Chart.Source.MergeUp",e.ChartSourceMoveToNoScale="Chart.Source.MoveToNoScale",e.ChartSourceMoveToOtherScale="Chart.Source.MoveToOtherScale",e.ChartSourceMoveToPane="Chart.Source.MoveToPane",e.ChartSourceUnmergeDown="Chart.Source.UnmergeDown",e.ChartSourceUnmergeUp="Chart.Source.UnmergeUp",e.ChartSourceVisualOrder="Chart.Source.VisualOrder",e.ChartSourceVisualOrderBringForward="Chart.Source.VisualOrder.BringForward",e.ChartSourceVisualOrderBringToFront="Chart.Source.VisualOrder.BringToFront",e.ChartSourceVisualOrderSendBackward="Chart.Source.VisualOrder.SendBackward",e.ChartSourceVisualOrderSendToBack="Chart.Source.VisualOrder.SendToBack",e.ChartSourceResetInputPoints="Chart.Source.ResetInputPoints",e.ChartOpenTableView="Chart.OpenTableView",e.ChartThemeApply="Chart.Theme.Apply",e.ChartThemeApplyCustom="Chart.Theme.Apply.Custom",e.ChartThemeSaveAs="Chart.Theme.SaveAs",e.ChartTimeScaleReset="Chart.TimeScale.Reset",e.ChartUndo="Chart.Undo",e.ChartShowAllIdeas="Chart.ShowAllIdeas",e.ChartShowIdeasOfFollowedUsers="Chart.ShowIdeasOfFollowedUsers",e.ChartShowMyIdeasOnly="Chart.ShowMyIdeasOnly",e.ChartToggleVisibilityAllLineTools="Chart.ToggleVisibility.AllLineTools",e.ChartToggleVisibilityContinuousContractSwitch="Chart.ToggleVisibility.ContinuousContractSwitch",e.ChartToggleVisibilityContractExpiration="Chart.ToggleVisibility.ContractExpiration",e.ChartToggleVisibilityDividends="Chart.ToggleVisibility.Dividends",e.ChartToggleVisibilityEarnings="Chart.ToggleVisibility.Earnings",e.ChartToggleVisibilityEconomicEvents="Chart.ToggleVisibility.EconomicEvents",e.ChartToggleVisibilitySplits="Chart.ToggleVisibility.Splits",e.ChartToggleVisibilityLatestNewsAndMinds="Chart.ToggleVisibility.LatestNewsAndMinds",e.ChartToggleVisibilityKeyFactsToday="Chart.ToggleVisibility.KeyFactsToday",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.NoteCreate="Note.Create",e.NoteEdit="Note.Edit",e.NoteRemove="Note.Remove",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRemoveItem="ObjectsTree.RemoveItem",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem",e.ObjectsTreeToggleItemLocked="ObjectsTree.ToggleItemLocked",e.ObjectsTreeToggleItemVisibility="ObjectsTree.ToggleItemVisibility",e.PineEditorConsoleCopyMessage="PineEditor.Console.CopyMessage",e.PineEditorConsoleToggleVisibility="PineEditor.Console.ToggleVisibility",e.PineEditorConsoleClear="PineEditor.Console.Clear",e.ScreenerColumnRemove="Screener.Column.Remove",e.ScreenerFilterChange="Screener.Filter.Change",e.ScreenerFilterReset="Screener.Filter.Reset",e.ScreenerToggleVisibilityCurrency="Screener.ToggleVisibility.Currency",e.ScreenerToggleVisibilityDescription="Screener.ToggleVisibility.Description",e.ScreenerToggleVisibilityRating="Screener.ToggleVisibility.Rating",e.ScreenerToggleVisibilitySymbolType="Screener.ToggleVisibility.SymbolType",e.TradingAddOrder="Trading.AddOrder",e.TradingCancelOrder="Trading.CancelOrder",e.TradingClosePosition="Trading.ClosePosition",e.TradingCustomActionId="Trading.CustomActionId",e.TradingDOMPlaceLimitOrder="Trading.DOMPlaceLimitOrder",e.TradingDOMPlaceMarketOrder="Trading.DOMPlaceMarketOrder",e.TradingDOMPlaceStopLimitOrder="Trading.DOMPlaceStopLimitOrder",e.TradingDOMPlaceStopOrder="Trading.DOMPlaceStopOrder",e.TradingEditOrder="Trading.EditOrder",e.TradingModifyPosition="Trading.ModifyPosition",e.TradingReversePosition="Trading.ReversePosition",e.TradingSellBuyButtonsToggleVisibility="Trading.SellBuyButtonsToggleVisibility",e.TradingTradeFromChart="Trading.TradeFromChart",e.TradingNoOverlapMode="Trading.NoOverlapMode",e.TradingShowSelectBrokerPanel="Trading.ShowSelectBrokerPanel",e.TradingOrderTitle="Trading.OrderTitle",e.TradingPositionTitle="Trading.PositionTitle",e.WatchlistActions="Watchlist.Actions",e.WatchlistAddSelectedSymbolsToCompare="Watchlist.AddSelectedSymbolsToCompare ",e.WatchlistAddSymbolToCompare="Watchlist.AddSymbolToCompare",e.WatchlistAddSymbolToSection="Watchlist.AddSymbolToSection",e.WatchlistChangeFlaggedGroupColor="Watchlist.ChangeFlaggedGroupColor",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreate="Watchlist.Create",e.WatchlistAddSelectedSymbols="Watchlist.AddSelectedSymbols",e.WatchlistAddSelectedSymbolsLists="Watchlist.AddSelectedSymbols.Lists",e.WatchlistGetDisplayedTickerDescription="Watchlist.GetDisplayedTickerDescription",e.WatchlistCreateSection="Watchlist.CreateSection",e.WatchlistFlagSelectedSymbols="Watchlist.FlagSelectedSymbols",e.WatchlistFlagSymbol="Watchlist.FlagSymbol",e.WatchlistOpenSymbolChart="Watchlist.OpenSymbolChart",e.WatchlistOpenSymbolOverview="Watchlist.OpenSymbolOverview",e.WatchlistRemoveSection="Watchlist.RemoveSection",e.WatchlistRemoveSymbol="Watchlist.RemoveSymbol",e.WatchlistRenameSection="Watchlist.RenameSection",e.WatchlistUnflagAllSymbols="Watchlist.UnflagAllSymbols",e.WatchlistUnflagSelectedSymbols="Watchlist.UnflagSelectedSymbols",e.WatchlistUnflagSymbol="Watchlist.UnflagSymbol",function(e){e.extractErrorReason=function(e){return e.params[1]}}(t||(t={})),function(e){e.Default="default",e.FullSingleSession="full_single_session"}(i||(i={})),exports.TimeFrameType=void 0,(o=exports.TimeFrameType||(exports.TimeFrameType={})).PeriodBack="period-back",o.TimeRange="time-range",function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={})),exports.MarketStatus=void 0,(n=exports.MarketStatus||(exports.MarketStatus={})).Open="market",n.Pre="pre_market",n.Post="post_market",n.Close="out_of_session",n.Holiday="holiday",exports.MenuItemType=void 0,(a=exports.MenuItemType||(exports.MenuItemType={})).Separator="separator",a.Action="action",exports.ClearMarksMode=void 0,(s=exports.ClearMarksMode||(exports.ClearMarksMode={}))[s.All=0]="All",s[s.BarMarks=1]="BarMarks",s[s.TimeScaleMarks=2]="TimeScaleMarks",exports.LineStudyPlotStyle=void 0,(l=exports.LineStudyPlotStyle||(exports.LineStudyPlotStyle={}))[l.Line=0]="Line",l[l.Histogram=1]="Histogram",l[l.Cross=3]="Cross",l[l.Area=4]="Area",l[l.Columns=5]="Columns",l[l.Circles=6]="Circles",l[l.LineWithBreaks=7]="LineWithBreaks",l[l.AreaWithBreaks=8]="AreaWithBreaks",l[l.StepLine=9]="StepLine",l[l.StepLineWithDiamonds=10]="StepLineWithDiamonds",l[l.StepLineWithBreaks=11]="StepLineWithBreaks",exports.StudyPlotType=void 0,(d=exports.StudyPlotType||(exports.StudyPlotType={})).Line="line",d.Colorer="colorer",d.BarColorer="bar_colorer",d.BgColorer="bg_colorer",d.TextColorer="text_colorer",d.OhlcColorer="ohlc_colorer",d.CandleWickColorer="wick_colorer",d.CandleBorderColorer="border_colorer",d.UpColorer="up_colorer",d.DownColorer="down_colorer",d.Shapes="shapes",d.Chars="chars",d.Arrows="arrows",d.Data="data",d.DataOffset="dataoffset",d.OhlcOpen="ohlc_open",d.OhlcHigh="ohlc_high",d.OhlcLow="ohlc_low",d.OhlcClose="ohlc_close",function(e){e.AlertCondition="alertcondition"}(c||(c={})),exports.StudyPlotDisplayTarget=void 0,(h=exports.StudyPlotDisplayTarget||(exports.StudyPlotDisplayTarget={}))[h.None=0]="None",h[h.Pane=1]="Pane",h[h.DataWindow=2]="DataWindow",h[h.PriceScale=4]="PriceScale",h[h.StatusLine=8]="StatusLine",h[h.All=15]="All",function(e){e[e.None=0]="None",e[e.Pane=1]="Pane",e[e.DataWindow=2]="DataWindow",e[e.PriceScale=4]="PriceScale",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(g||(g={})),exports.OhlcStudyPlotStyle=void 0,(u=exports.OhlcStudyPlotStyle||(exports.OhlcStudyPlotStyle={})).OhlcBars="ohlc_bars",u.OhlcCandles="ohlc_candles",function(e){e.Auto="auto",e.Tiny="tiny",e.Small="small",e.Normal="normal",e.Large="large",e.Huge="huge"}(C||(C={})),exports.StudyInputType=void 0,(p=exports.StudyInputType||(exports.StudyInputType={})).Integer="integer",p.Float="float",p.Price="price",p.Bool="bool",p.Text="text",p.Symbol="symbol",p.Session="session",p.Source="source",p.Resolution="resolution",p.Time="time",p.BarTime="bar_time",p.Color="color",p.Textarea="text_area",function(e){e[e.None=0]="None",e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(S||(S={})),function(e){e.InitialCapital="initial_capital",e.Currency="currency",e.DefaultQTYValue="default_qty_value",e.DefaultQTYType="default_qty_type",e.Pyramiding="pyramiding",e.ComissionValue="commission_value",e.ComissionType="commission_type",e.BacktestFillLimitsAssumtion="backtest_fill_limits_assumption",e.Slippage="slippage",e.CalcOnOrderFills="calc_on_order_fills",e.CalcOnEveryTick="calc_on_every_tick",e.MarginLong="margin_long",e.MarginShort="margin_short",e.UseBarMagnifier="use_bar_magnifier",e.ProcessOrdersOnClose="process_orders_on_close",e.FillOrdersOnStandardOHLC="fill_orders_on_standard_ohlc"}(m||(m={})),function(e){e.Fixed="fixed",e.CashPerOrder="cash_per_order",e.PercentOfEquity="percent_of_equity"}(y||(y={})),function(e){e.Percent="percent",e.CashPerContract="cash_per_contract",e.CashPerOrder="cash_per_order"}(T||(T={})),function(e){e.FirstBar="first_visible_bar_time",e.LastBar="last_visible_bar_time",e.Realtime="subscribeRealtime"}(_||(_={})),function(e){e.FgColor="__chart_fgcolor",e.BgColor="__chart_bgcolor"}(b||(b={})),exports.StudyTargetPriceScale=void 0,(P=exports.StudyTargetPriceScale||(exports.StudyTargetPriceScale={}))[P.Right=0]="Right",P[P.Left=1]="Left",P[P.NoScale=2]="NoScale",function(e){e[e.Right=0]="Right",e[e.Left=1]="Left",e[e.None=2]="None"}(L||(L={})),exports.FilledAreaType=void 0,(w=exports.FilledAreaType||(exports.FilledAreaType={})).TypePlots="plot_plot",w.TypeHlines="hline_hline",function(e){e[e.StopLoss=0]="StopLoss",e[e.TrailingStop=1]="TrailingStop",e[e.GuaranteedStop=2]="GuaranteedStop"}(A||(A={})),function(e){e.Futures="futures",e.Options="options",e.Others="others",e.FutureAndOptions="futureAndOptions"}(f||(f={})),function(e){e.PerContract="contract",e.Fixed="fixed",e.Percent="percent",e.Disabled="disabled"}(v||(v={})),function(e){e.Stocks="stocks",e.Futures="futures",e.Forex="forex",e.Crypto="crypto",e.Others="others"}(I||(I={})),function(e){e.Symbol="symbol"}(O||(O={})),function(e){e[e.Critical=0]="Critical",e[e.Informational=1]="Informational"}(R||(R={})),function(e){e[e.PopUp=0]="PopUp",e[e.Notification=1]="Notification"}(D||(D={})),function(e){e.Quantity="qty",e.OrderSide="side",e.Price="price",e.Duration="duration",e.Brackets="brackets",e.StopLossType="slType"}(x||(x={})),function(e){e[e.CONNECTED=1]="CONNECTED",e[e.CONNECTING=2]="CONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED",e[e.ERROR=4]="ERROR"}(k||(k={})),exports.ConnectionStatus=void 0,(V=exports.ConnectionStatus||(exports.ConnectionStatus={}))[V.Connected=1]="Connected",V[V.Connecting=2]="Connecting",V[V.Disconnected=3]="Disconnected",V[V.Error=4]="Error",function(e){e[e.LIMIT=1]="LIMIT",e[e.MARKET=2]="MARKET",e[e.STOP=3]="STOP",e[e.STOPLIMIT=4]="STOPLIMIT"}(F||(F={})),exports.OrderType=void 0,(W=exports.OrderType||(exports.OrderType={}))[W.Limit=1]="Limit",W[W.Market=2]="Market",W[W.Stop=3]="Stop",W[W.StopLimit=4]="StopLimit",function(e){e[e.BUY=1]="BUY",e[e.SELL=-1]="SELL"}(E||(E={})),exports.Side=void 0,(M=exports.Side||(exports.Side={}))[M.Buy=1]="Buy",M[M.Sell=-1]="Sell",function(e){e[e.CANCELED=1]="CANCELED",e[e.FILLED=2]="FILLED",e[e.INACTIVE=3]="INACTIVE",e[e.PLACING=4]="PLACING",e[e.REJECTED=5]="REJECTED",e[e.WORKING=6]="WORKING"}(B||(B={})),function(e){e[e.ALL=0]="ALL",e[e.CANCELED=1]="CANCELED",e[e.FILLED=2]="FILLED",e[e.INACTIVE=3]="INACTIVE",e[e.REJECTED=5]="REJECTED",e[e.WORKING=6]="WORKING"}(N||(N={})),exports.OrderStatus=void 0,(U=exports.OrderStatus||(exports.OrderStatus={}))[U.Canceled=1]="Canceled",U[U.Filled=2]="Filled",U[U.Inactive=3]="Inactive",U[U.Placing=4]="Placing",U[U.Rejected=5]="Rejected",U[U.Working=6]="Working",exports.OrderStatusFilter=void 0,(H=exports.OrderStatusFilter||(exports.OrderStatusFilter={}))[H.All=0]="All",H[H.Canceled=1]="Canceled",H[H.Filled=2]="Filled",H[H.Inactive=3]="Inactive",H[H.Rejected=5]="Rejected",H[H.Working=6]="Working",function(e){e[e.Order=1]="Order",e[e.Position=2]="Position"}(j||(j={})),function(e){e[e.ORDER=1]="ORDER",e[e.POSITION=2]="POSITION"}(z||(z={})),exports.ParentType=void 0,(G=exports.ParentType||(exports.ParentType={}))[G.Order=1]="Order",G[G.Position=2]="Position",G[G.IndividualPosition=3]="IndividualPosition",function(e){e[e.StopLoss=0]="StopLoss",e[e.TakeProfit=1]="TakeProfit",e[e.TrailingStop=2]="TrailingStop",e[e.GuaranteedStop=3]="GuaranteedStop"}($||($={})),function(e){e[e.LIMITPRICE=1]="LIMITPRICE",e[e.STOPPRICE=2]="STOPPRICE",e[e.TAKEPROFIT=3]="TAKEPROFIT",e[e.STOPLOSS=4]="STOPLOSS"}(J||(J={})),exports.OrderTicketFocusControl=void 0,(K=exports.OrderTicketFocusControl||(exports.OrderTicketFocusControl={}))[K.LimitPrice=1]="LimitPrice",K[K.StopPrice=2]="StopPrice",K[K.TakeProfit=3]="TakeProfit",K[K.StopLoss=4]="StopLoss",K[K.Quantity=5]="Quantity",function(e){e[e.ERROR=0]="ERROR",e[e.SUCCESS=1]="SUCCESS"}(q||(q={})),exports.NotificationType=void 0,(Z=exports.NotificationType||(exports.NotificationType={}))[Z.Error=0]="Error",Z[Z.Success=1]="Success",function(e){e[e.Demo=1]="Demo",e[e.Real=0]="Real"}(Q||(Q={})),exports.OrderOrPositionMessageType=void 0,(Y=exports.OrderOrPositionMessageType||(exports.OrderOrPositionMessageType={})).Information="information",Y.Warning="warning",Y.Error="error",function(e){e.Demo="demo",e.Live="live"}(X||(X={})),function(e){e[e.LogOut=0]="LogOut",e[e.FailedRestoring=1]="FailedRestoring",e[e.Offline=2]="Offline",e[e.APIError=3]="APIError",e[e.TwoFactorRequired=4]="TwoFactorRequired",e[e.CancelAuthorization=5]="CancelAuthorization",e[e.TimeOutForAuthorization=6]="TimeOutForAuthorization",e[e.OauthError=7]="OauthError",e[e.BrokenConnection=8]="BrokenConnection",e[e.Reconnect=9]="Reconnect",e[e.FailedSignIn=10]="FailedSignIn"}(ee||(ee={})),function(e){e[e.None=0]="None",e[e.Pips=1]="Pips",e[e.Ticks=2]="Ticks"}(te||(te={})),function(e){e.Halted="HALTED",e.NotShortable="NOT-SHORTABLE",e.HardToBorrow="HARD-TO-BORROW"}(ie||(ie={})),function(e){e[e.Limit=1]="Limit",e[e.Stop=2]="Stop"}(oe||(oe={})),function(e){e.Disallowed="disallowed",e.Allowed="allowed",e.AllowedWithWarning="allowed_with_warning"}(re||(re={})),function(e){e.PlaceOrder="place_order",e.ModifyOrder="modify_order",e.CancelOrder="cancel_order",e.CancelMultipleOrders="cancel_multiple_orders",e.ModifyPosition="modify_position",e.ClosePosition="close_position",e.ModifyIndividualPosition="modify_individual_position",e.CloseIndividualPosition="close_individual_position",e.CloseNetPosition="close_net_position"}(ne||(ne={})),exports.StandardFormatterName=void 0,(ae=exports.StandardFormatterName||(exports.StandardFormatterName={})).Date="date",ae.DateOrDateTime="dateOrDateTime",ae.Default="default",ae.Fixed="fixed",ae.FixedInCurrency="fixedInCurrency",ae.VariablePrecision="variablePrecision",ae.FormatQuantity="formatQuantity",ae.FormatPrice="formatPrice",ae.FormatPriceForexSup="formatPriceForexSup",ae.FormatPriceInCurrency="formatPriceInCurrency",ae.IntegerSeparated="integerSeparated",ae.LocalDate="localDate",ae.LocalDateOrDateTime="localDateOrDateTime",ae.Percentage="percentage",ae.Pips="pips",ae.Profit="profit",ae.ProfitInInstrumentCurrency="profitInInstrumentCurrency",ae.ProfitInPercent="profitInPercent",ae.Side="side",ae.PositionSide="positionSide",ae.Status="status",ae.Symbol="symbol",ae.Text="text",ae.Type="type",ae.MarginPercent="marginPercent",ae.Empty="empty",exports.OverridePriceAxisLastValueMode=void 0,(se=exports.OverridePriceAxisLastValueMode||(exports.OverridePriceAxisLastValueMode={}))[se.LastPriceAndPercentageValue=0]="LastPriceAndPercentageValue",se[se.LastValueAccordingToScale=1]="LastValueAccordingToScale",exports.OverrideLineStyle=void 0,(le=exports.OverrideLineStyle||(exports.OverrideLineStyle={}))[le.Solid=0]="Solid",le[le.Dotted=1]="Dotted",le[le.Dashed=2]="Dashed",function(e){e[e.Offline=0]="Offline",e[e.Resolving=1]="Resolving",e[e.Loading=2]="Loading",e[e.Ready=3]="Ready",e[e.InvalidSymbol=4]="InvalidSymbol",e[e.Snapshot=5]="Snapshot",e[e.EOD=6]="EOD",e[e.Pulse=7]="Pulse",e[e.Delayed=8]="Delayed",e[e.DelayedSteaming=9]="DelayedSteaming",e[e.NoBars=10]="NoBars",e[e.Replay=11]="Replay",e[e.Error=12]="Error",e[e.CalculationError=13]="CalculationError",e[e.UnsupportedResolution=14]="UnsupportedResolution"}(de||(de={})),function(e){e[e.Markers=0]="Markers",e[e.Stepline=1]="Stepline",e[e.Simple=2]="Simple"}(ce||(ce={})),exports.ChartStyle=void 0,(he=exports.ChartStyle||(exports.ChartStyle={}))[he.Bar=0]="Bar",he[he.Candle=1]="Candle",he[he.Line=2]="Line",he[he.Area=3]="Area",he[he.Renko=4]="Renko",he[he.Kagi=5]="Kagi",he[he.PnF=6]="PnF",he[he.LineBreak=7]="LineBreak",he[he.HeikinAshi=8]="HeikinAshi",he[he.HollowCandle=9]="HollowCandle",he[he.Baseline=10]="Baseline",he[he.Range=11]="Range",he[he.HiLo=12]="HiLo",he[he.Column=13]="Column",he[he.LineWithMarkers=14]="LineWithMarkers",he[he.Stepline=15]="Stepline",he[he.HLCArea=16]="HLCArea",he[he.VolFootprint=17]="VolFootprint",he[he.TPO=18]="TPO",he[he.VolCandle=19]="VolCandle",he[he.SVP=20]="SVP",he[he.HLCBars=21]="HLCBars",exports.TimeHoursFormat=void 0,(ge=exports.TimeHoursFormat||(exports.TimeHoursFormat={})).TwentyFourHours="24-hours",ge.TwelveHours="12-hours",function(e){e[e.Initial=2]="Initial",e[e.SeriesZOrderIsAlwaysZero=3]="SeriesZOrderIsAlwaysZero",e[e.Current=3]="Current"}(ue||(ue={})),exports.PlDisplay=void 0,(Ce=exports.PlDisplay||(exports.PlDisplay={}))[Ce.Money=0]="Money",Ce[Ce.Pips=1]="Pips",Ce[Ce.Percentage=2]="Percentage",exports.TradedGroupHorizontalAlignment=void 0,(pe=exports.TradedGroupHorizontalAlignment||(exports.TradedGroupHorizontalAlignment={}))[pe.Left=0]="Left",pe[pe.Center=1]="Center",pe[pe.Right=2]="Right",exports.PlDisplay.Money,exports.PlDisplay.Money,exports.TradedGroupHorizontalAlignment.Right,function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(Se||(Se={})),function(e){e[e.Unavailable=0]="Unavailable",e[e.AvailableReadonlyAlwaysDisabled=1]="AvailableReadonlyAlwaysDisabled",e[e.AvailableReadonlyAlwaysEnabled=2]="AvailableReadonlyAlwaysEnabled",e[e.Available=3]="Available"}(me||(me={})),function(e){e[e.ViewportChangeUserAction=0]="ViewportChangeUserAction",e[e.DataUpdate=1]="DataUpdate",e[e.SeriesRestart=2]="SeriesRestart",e[e.SeriesCompleted=3]="SeriesCompleted",e[e.StudyCreation=4]="StudyCreation"}(ye||(ye={})),function(e){e[e.Chart=0]="Chart"}(Te||(Te={})),exports.VisibilityType=void 0,(_e=exports.VisibilityType||(exports.VisibilityType={})).AlwaysOn="alwaysOn",_e.VisibleOnMouseOver="visibleOnMouseOver",_e.AlwaysOff="alwaysOff",exports.PriceScaleMode=void 0,(be=exports.PriceScaleMode||(exports.PriceScaleMode={}))[be.Normal=0]="Normal",be[be.Log=1]="Log",be[be.Percentage=2]="Percentage",be[be.IndexedTo100=3]="IndexedTo100",exports.SeriesType=void 0,(Pe=exports.SeriesType||(exports.SeriesType={}))[Pe.Bars=0]="Bars",Pe[Pe.Candles=1]="Candles",Pe[Pe.Line=2]="Line",Pe[Pe.Area=3]="Area",Pe[Pe.HeikenAshi=8]="HeikenAshi",Pe[Pe.HollowCandles=9]="HollowCandles",Pe[Pe.Baseline=10]="Baseline",Pe[Pe.HiLo=12]="HiLo",Pe[Pe.Column=13]="Column",Pe[Pe.LineWithMarkers=14]="LineWithMarkers",Pe[Pe.Stepline=15]="Stepline",Pe[Pe.HLCArea=16]="HLCArea",Pe[Pe.VolCandle=19]="VolCandle",Pe[Pe.HLCBars=21]="HLCBars",Pe[Pe.Renko=4]="Renko",Pe[Pe.Kagi=5]="Kagi",Pe[Pe.PointAndFigure=6]="PointAndFigure",Pe[Pe.LineBreak=7]="LineBreak",function(e){e.Value="_seriesId"}(Le||(Le={})),function(e){e[e.InvalidSymbol=0]="InvalidSymbol",e[e.ReplayUnsupported=1]="ReplayUnsupported",e[e.UnsupportedDepth=2]="UnsupportedDepth",e[e.UnsupportedIntradyReplay=3]="UnsupportedIntradyReplay"}(we||(we={})),exports.HHistDirection=void 0,(Ae=exports.HHistDirection||(exports.HHistDirection={})).LeftToRight="left_to_right",Ae.RightToLeft="right_to_left",function(e){e.Relative="relative",e.Absolute="absolute"}(fe||(fe={})),function(e){e.UpDown="Up/Down",e.Total="Total",e.Delta="Delta"}(ve||(ve={})),exports.MarkLocation=void 0,(Ie=exports.MarkLocation||(exports.MarkLocation={})).AboveBar="AboveBar",Ie.BelowBar="BelowBar",Ie.Top="Top",Ie.Bottom="Bottom",Ie.Right="Right",Ie.Left="Left",Ie.Absolute="Absolute",Ie.AbsoluteUp="AbsoluteUp",Ie.AbsoluteDown="AbsoluteDown",function(e){e.Left="left",e.Center="center",e.Right="right"}(Oe||(Oe={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(Re||(Re={})),exports.LineStyle=void 0,(De=exports.LineStyle||(exports.LineStyle={}))[De.Solid=0]="Solid",De[De.Dotted=1]="Dotted",De[De.Dashed=2]="Dashed";const ke={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,news:!1,datawindow:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[],indicators:[],drawingTools:[]}},Ve=JSON.parse('[{"iso":"en","dir":"ltr","language":"en"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"de","dir":"ltr","language":"de"},{"iso":"fr","dir":"ltr","language":"fr"},{"iso":"ca","dir":"ltr","language":"ca_ES"},{"iso":"es","dir":"ltr","language":"es"},{"iso":"it","dir":"ltr","language":"it"},{"iso":"pl","dir":"ltr","language":"pl"},{"iso":"hu","dir":"ltr","language":"hu_HU"},{"iso":"sv","dir":"ltr","language":"sv"},{"iso":"tr","dir":"ltr","language":"tr"},{"iso":"ru","dir":"ltr","language":"ru"},{"iso":"pt","dir":"ltr","language":"pt"},{"iso":"id","dir":"ltr","language":"id_ID"},{"iso":"ms","dir":"ltr","language":"ms_MY"},{"iso":"th","dir":"ltr","language":"th"},{"iso":"vi","dir":"ltr","language":"vi"},{"iso":"ja","dir":"ltr","language":"ja"},{"iso":"ko","dir":"ltr","language":"ko"},{"iso":"zh-Hans","dir":"ltr","language":"zh"},{"iso":"zh-Hant","dir":"ltr","language":"zh_TW"},{"iso":"ar","dir":"rtl","language":"ar"},{"iso":"he","dir":"rtl","language":"he_IL"}]');let Fe=!1;function We(){return"CL v30.0.0 (internal id a7798f5b2167d88489048eb7e1527e9bf896690e @ 2025-09-18T15:48:20.147Z)"}const Ee=class{constructor(e){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");e.overrides?.["mainSeriesProperties.priceAxisProperties.lockScale"]&&(console.warn("mainSeriesProperties.priceAxisProperties.lockScale can not be set to true within the widget constructor"),delete e.overrides["mainSeriesProperties.priceAxisProperties.lockScale"]),this._options=xe(ke,e);"dark"===(this._options.theme??"light").toLowerCase()&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),(this._options.debug||this._options.debug_broker)&&(Fe||(Fe=!0,console.log("Using CL v30.0.0 (internal id a7798f5b2167d88489048eb7e1527e9bf896690e @ 2025-09-18T15:48:20.147Z)"))),this._innerWindowLoaded=new Promise((e=>{this._innerWindowResolver=e})),this._create()}setDebugMode(e){this._innerAPI().setDebugMode(e)}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._doWhenInnerApiLoaded((t=>{t.onGrayedObjectClicked(e)}))}onShortcut(e,t){this._doWhenInnerWindowLoaded((i=>{i.createShortcutAction(e,t)}))}subscribe(e,t){this._doWhenInnerApiLoaded((i=>{i.subscribe(e,t)}))}unsubscribe(e,t){this._doWhenInnerApiLoaded((i=>{i.unsubscribe(e,t)}))}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._doWhenInnerApiLoaded((e=>{e.closePopupsAndDialogs()}))}selectLineTool(e,t){return this._innerAPI().selectLineTool(e,t)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e,t){this._innerAPI().saveChart(e,t)}async load(e,t){return this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){return this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._doWhenInnerApiLoaded((t=>{t.onContextMenu(e)}))}createButton(e){return this._innerWindow().createButton(e)}removeButton(e){this._innerWindow().removeButton(e)}createDropdown(e){return this._innerWindow().createDropdown(e)}showNoticeDialog(e){this._doWhenInnerApiLoaded((t=>{t.showNoticeDialog(e)}))}showConfirmDialog(e){this._doWhenInnerApiLoaded((t=>{t.showConfirmDialog(e)}))}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}getStudyInputs(e){return this._innerAPI().getStudyInputs(e)}getStudyStyles(e){return this._innerAPI().getStudyStyles(e)}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(e){this._options=xe(this._options,{overrides:e}),this._doWhenInnerWindowLoaded((t=>{t.applyOverrides(e)}))}applyTradingCustomization(e){return new Promise(((t,i)=>{this._doWhenInnerWindowLoaded((o=>{o.applyTradingCustomization(e).then(t).catch(i)}))}))}applyStudiesOverrides(e){this._doWhenInnerWindowLoaded((t=>{t.applyStudiesOverrides(e)}))}watchList(){return this._innerAPI().watchlist()}news(){return this._innerAPI().news()}widgetbar(){return this._innerAPI().widgetbar()}activeChart(){return this._innerAPI().activeChart()}activeChartIndex(){return this._innerAPI().activeChartIndex()}setActiveChart(e){return this._innerAPI().setActiveChart(e)}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}resetLayoutSizes(e){this._innerAPI().resetLayoutSizes(e)}setLayoutSizes(e,t){this._innerAPI().setLayoutSizes(e,t)}changeTheme(e,t){return this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._doWhenInnerApiLoaded((e=>{e.takeScreenshot()}))}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllChartsEnabled(){return this._innerAPI().drawOnAllChartsEnabled()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setDateRangeLinkingEnabled(e){this._innerAPI().setDateRangeLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}dateRangeSync(){return this._innerAPI().dateRangeSync()}setFeatureEnabled(e,t){this._innerAPI().setFeatureEnabled(e,t)}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}navigationButtonsVisibility(){return this._innerWindow().getNavigationButtonsVisibility()}paneButtonsVisibility(){return this._innerWindow().getPaneButtonsVisibility()}dateFormat(){return this._innerWindow().getDateFormat()}timeHoursFormat(){return this._innerWindow().getTimeHoursFormat()}currencyAndUnitVisibility(){return this._innerWindow().getCurrencyAndUnitVisibility()}supportedChartTypes(){return this._innerAPI().supportedChartTypes()}watermark(){return this._innerAPI().watermark()}customSymbolStatus(){return this._innerWindow().customSymbolStatus()}setCSSCustomProperty(e,t){if(!1===e.startsWith("--"))throw new Error("customPropertyName should begin with a double hyphen");this._innerWindow().document.body.style.setProperty(e,t)}getCSSCustomPropertyValue(e){if(!1===e.startsWith("--"))throw new Error("customPropertyName should begin with a double hyphen");const t=this._innerWindow().document.body,i=t.style.getPropertyValue(e);if(i)return i;return getComputedStyle(t).getPropertyValue(e)}unloadUnusedCharts(){this._innerAPI().unloadUnusedCharts()}async customThemes(){return this._innerWindow().customThemes()}resetCache(){this._innerAPI().resetCache()}linking(){return this._innerAPI().linking}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_doWhenInnerWindowLoaded(e){this._ready?e(this._innerWindow()):this._innerWindowLoaded.then((()=>{e(this._innerWindow())}))}_doWhenInnerApiLoaded(e){this._doWhenInnerWindowLoaded((t=>{t.doWhenApiIsReady((()=>e(this._innerAPI())))}))}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px",Me&&setTimeout((()=>{this._iFrame.style.height=window.innerHeight+"px"}),30))}async _create(){const e=this._options.enabled_features?.includes("iframe_loading_same_origin")??!1,t=e||(this._options.enabled_features?.includes("iframe_loading_compatibility_mode")??!1),i=e&&(this._options.enabled_features?.includes("iframe_loading_root_path")??!1),[o,r]=this._render(!t,e,i),n=this._options.container,a="string"==typeof n?document.getElementById(n):n;if(null===a)throw new Error(`There is no such element - #${this._options.container}`);a.innerHTML=o,this._iFrame=a.querySelector(`#${this._id}`);const s=this._iFrame;e&&await this._innerWindowEvent("sameOriginLoad"),t&&(s.contentWindow?(s.contentWindow.document.open(),s.contentWindow.document.write(r),s.contentWindow.document.close()):console.warn("Unable to locate contentWindow for the created iframe. Please try disabling the `iframe_loading_compatibility_mode` featureset.")),this._innerWindow().addEventListener("innerWindowLoad",(e=>{e.detail.received=!0,function(e,t){if(void 0===e)throw new Error(`${t} is undefined`);return e}(this._innerWindowResolver,"_innerWindowResolver")()}),{once:!0}),(this._options.autosize||this._options.fullscreen)&&(s.style.width="100%",this._options.fullscreen||(s.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded.then((()=>{try{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const e of this._readyHandlers)try{e.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}catch(e){if(e instanceof Error&&/widgetReady is not a function/.test(e.message))throw new Error(`There was an error when loading the library. Usually this error means the library failed to load its static files. Check that the library files are available at ${window.location.host}/${this._options.library_path||""} or correct the library_path option.`)}}))}_innerWindowEvent(e){return new Promise((t=>{this._innerWindow().addEventListener(e,t,{once:!0})}))}_render(e,t,i){const o=window;if(o[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters,brokerFactory:this._options.broker_factory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,rss_news_title:this._options.rss_news_title,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode,customTranslateFunction:this._options.custom_translate_function,symbolSearchComplete:this._options.symbol_search_complete,contextMenu:this._options.context_menu,settingsOverrides:this._options.settings_overrides,timeframe:this._options.timeframe,customTimezones:this._options.custom_timezones,customChartDescriptionFunction:this._options.custom_chart_description_function,customThemes:this._options.custom_themes,imageStorageAdapter:this._options.image_storage_adapter},this._options.saved_data)o[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(o[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");if(this._options.library_path&&!this._options.library_path.endsWith("/")&&console.warn("library_path option should contain a trailing forward slash"),this._options.locale){const e=encodeURIComponent(this._options.locale);Ve.findIndex((t=>t.language===e))>=0||(console.warn("locale isn't supported. Using default of `en`."),this._options.locale="en")}const r=function(e,t){const i=new URL(`${e||""}`,location.href).href,o=JSON.parse('["bundles/runtime.1d4ed3742895f7c63ed9.js","bundles/__LANG__.938.5f20502c9172fdac1c7f.js","bundles/481.7c6283292170510c91f1.css","bundles/8971.352a74bc5eebf8040884.js","bundles/library.15664647653f41254b4d.js"]'),r=encodeURIComponent(t),n=Ve.find((e=>e.language===r))??{iso:"en",dir:"ltr"},a=`lang="${n.iso}" dir="${n.dir}"`,s=`\n${function(e,t,i){if(void 0===e)return"";const o=[],r=[];for(const n of e)n.endsWith(".js")?o.push(`