From d9c8aa3bd8ecf8b783dce6e003581924fce5786f Mon Sep 17 00:00:00 2001 From: louisnw Date: Wed, 28 Jun 2023 18:36:32 +0100 Subject: [PATCH] v1.0.13 NEW FEATURE: Polygon.io Full integration - Added `polygon` to the common methods, allowing for data to be pulled from polygon.io. (`chart.polygon.`) - Added the `PolygonChart` object, which allows for a plug and play solution with the Polygon API. - Check the docs for more details and examples! Enhancements: - Added `clear_markers` and `clear_horizontal_lines` to the common methods. - Added the `maximize` parameter to the `Chart` object, which maximizes the chart window when shown. - The Legend will now show Line values, and can be disabled using the `lines` parameter. - Added the `name` parameter to the `set` method of line, using the column within the dataframe as the value and using its name within the legend. - Added the `scale_candles_only` parameter to all Chart objects, which prevents the autoscaling of Lines. - new `screenshot` method, which returns a bytes object of the displayed chart. Fixes: - `chart.lines()` now returns a copy of the list rather than the original. --- README.md | 8 +- docs/source/conf.py | 2 +- docs/source/docs.md | 53 +- docs/source/index.md | 4 +- docs/source/polygon.md | 135 +++++ docs/source/polygonchart.png | Bin 0 -> 127232 bytes lightweight_charts/__init__.py | 2 +- lightweight_charts/{js.py => abstract.py} | 618 ++++++---------------- lightweight_charts/chart.py | 109 ++-- lightweight_charts/js/callback.js | 208 ++++++++ lightweight_charts/js/funcs.js | 167 ++++++ lightweight_charts/{pkg.py => js/pkg.js} | 4 +- lightweight_charts/polygon.py | 211 +++++--- lightweight_charts/util.py | 2 +- lightweight_charts/widgets.py | 56 +- setup.py | 2 +- 16 files changed, 932 insertions(+), 649 deletions(-) create mode 100644 docs/source/polygon.md create mode 100644 docs/source/polygonchart.png rename lightweight_charts/{js.py => abstract.py} (62%) create mode 100644 lightweight_charts/js/callback.js create mode 100644 lightweight_charts/js/funcs.js rename lightweight_charts/{pkg.py => js/pkg.js} (99%) diff --git a/README.md b/README.md index 0ed62ba..05a87b6 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,10 @@ ___ 1. Simple and easy to use. 2. Blocking or non-blocking GUI. 3. Streamlined for live data, with methods for updating directly from tick data. -4. Supports: - * PyQt -> [`QtChart`](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#qtchart) - * wxPython -> [`WxChart`](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#wxchart) - * Streamlit -> [`StreamlitChart`](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#streamlitchart) - * asyncio -> [`show_async()`](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#show-async) - * Jupyter Notebooks -> [`JupyterChart`](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#jupyterchart) +4. __Supports:__ Jupyter Notebooks, PyQt, wxPython, Streamlit, and asyncio. 5. [Callbacks](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#callbacks) allowing for timeframe (1min, 5min, 30min etc.) selectors, searching, and more. 6. Multi-Pane Charts using the [`SubChart`](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#subchart). +7. Direct integration of market data through [Polygon.io's](https://polygon.io) market data API. ___ ### 1. Display data from a csv: diff --git a/docs/source/conf.py b/docs/source/conf.py index 471ffbe..7cc4cec 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,7 +1,7 @@ project = 'lightweight-charts-python' copyright = '2023, louisnw' author = 'louisnw' -release = '1.0.12' +release = '1.0.13' extensions = ["myst_parser"] diff --git a/docs/source/docs.md b/docs/source/docs.md index b4481dc..215fc70 100644 --- a/docs/source/docs.md +++ b/docs/source/docs.md @@ -99,6 +99,16 @@ ___ Removes a horizontal line at the given price. ___ +### `clear_markers` + +Clears the markers displayed on the data. +___ + +### `clear_horizontal_lines` + +Clears the horizontal lines displayed on the data. +___ + ### `price_scale` `mode: 'normal'/'logarithmic'/'percentage'/'index100'` | `align_labels: bool` | `border_visible: bool` | `border_color: str` | `text_color: str` | `entire_text_only: bool` | `ticks_visible: bool` | `scale_margin_top: float` | `scale_margin_bottom: float` @@ -169,7 +179,7 @@ Sets the title label for the chart. ___ ### `legend` -`visible: bool` | `ohlc: bool` | `percent: bool` | `color: str` | `font_size: int` | `font_family: str` +`visible: bool` | `ohlc: bool` | `percent: bool` | `lines: bool` | `color: str` | `font_size: int` | `font_family: str` Configures the legend of the chart. ___ @@ -201,7 +211,9 @@ ___ Shows the hidden candles on the chart. ___ - +### `polygon` +Used to access Polygon.io's API (see [here](https://lightweight-charts-python.readthedocs.io/en/latest/polygon.html)) +___ ### `create_subchart` `volume_enabled: bool` | `position: 'left'/'right'/'top'/'bottom'`, `width: float` | `height: float` | `sync: bool/str` | `-> SubChart` @@ -222,7 +234,7 @@ ___ ## Chart -`volume_enabled: bool` | `width: int` | `height: int` | `x: int` | `y: int` | `on_top: bool` | `debug: bool` | +`volume_enabled: bool` | `width: int` | `height: int` | `x: int` | `y: int` | `on_top: bool` | `maximize: bool` | `debug: bool` | `api: object` | `topbar: bool` | `searchbox: bool` The main object used for the normal functionality of lightweight-charts-python, built on the pywebview library. @@ -250,6 +262,27 @@ ___ Show the chart asynchronously. This should be utilised when using [Callbacks](#callbacks). +### `screenshot` +`-> bytes` + +Takes a screenshot of the chart, and returns a bytes object containing the image. For example: + +```python +if __name__ == '__main__': + chart = Chart() + df = pd.read_csv('ohlcv.csv') + chart.set(df) + chart.show() + + img = chart.screenshot() + with open('screenshot.png', 'wb') as f: + f.write(img) +``` + +```{important} +This method must be called after the chart window is open. +``` + ___ ## Line @@ -264,11 +297,21 @@ The `line` object should only be accessed from the [`create_line`](#create-line) ___ ### `set` -`data: pd.DataFrame` +`data: pd.DataFrame` `name: str` Sets the data for the line. -This should be given as a DataFrame, with the columns: `time | value` +When not using the `name` parameter, the columns should be named: `time | value`. + +Otherwise, the method will use the column named after the string given in `name`. This name will also be used within the legend of the chart. For example: +```python +line = chart.create_line() + +# DataFrame with columns: date | SMA 50 +df = pd.read_csv('sma50.csv') + +line.set(df, name='SMA 50') +``` ___ ### `update` diff --git a/docs/source/index.md b/docs/source/index.md index d4aba20..05b6e69 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -1,11 +1,11 @@ ```{toctree} :hidden: -:caption: Contents -:maxdepth: 3 docs +polygon Github Repository ``` ```{include} ../../README.md +``` diff --git a/docs/source/polygon.md b/docs/source/polygon.md new file mode 100644 index 0000000..1f468e9 --- /dev/null +++ b/docs/source/polygon.md @@ -0,0 +1,135 @@ +# Polygon.io + +[Polygon.io's](https://polygon.io) market data API is directly integrated within lightweight-charts-python, and is easy to use within the library. +___ +## Requirements +To use data from Polygon, there are certain libraries (not listed as requirements) that must be installed: +* Static data requires the `requests` library. +* Live data requires the `websockets` library. +___ +## `polygon` +`polygon` is a [Common Method](https://lightweight-charts-python.readthedocs.io/en/latest/docs.html#common-methods), and can be accessed from within any chart type. + +`chart.polygon.` + +The `stock`, `option`, `index`, `forex`, and `crypto` methods of `chart.polygon` have common parameters: + +* `timeframe`: The timeframe to be used (`'1min'`, `'5min'`, `'H'`, `'2D'`, `'5W'` etc.) +* `start_date`: The start date given in the format `YYYY-MM-DD`. +* `end_date`: The end date given in the same format. By default this is `'now'`, which uses the time now. +* `limit`: The maximum number of base aggregates to be queried to create the aggregate results. +* `live`: When set to `True`, a websocket connection will be used to update the chart or subchart in real-time. +* These methods will also return a boolean representing whether the request was successful. + +```{important} +When using live data and the standard `show` method, the `block` parameter __must__ be set to `True` in order for the data to congregate on the chart (`chart.show(block=True)`). +If `show_async` is used with live data, `block` can be either value. + +``` +___ + +### Example: + +```python +from lightweight_charts import Chart + +if __name__ == '__main__': + chart = Chart() + chart.polygon.api_key('') + chart.polygon.stock( + symbol='AAPL', + timeframe='5min', + start_date='2023-06-09' + ) + chart.show(block=True) +``` +___ + +### `api_key` +`key: str` + +Sets the API key for the chart. Subsequent `SubChart` objects will inherit the API key given to the parent chart. +___ +### `stock` +`symbol: str` | `timeframe: str` | `start_date: str` | `end_date: str` | `limit: int` | `live: bool` | `-> bool` + +Requests and displays stock data pulled from Polygon.io. +___ + +### `option` +`symbol: str` | `timeframe: str` | `start_date: str` | `expiration` | `right: 'C' | 'P'` | `strike: int | float` | `end_date: str` | `limit: int` | `live: bool` | `-> bool` + +Requests and displays option data pulled from Polygon.io. + +A formatted option ticker (SPY251219C00650000) can also be given to the `symbol` parameter, allowing for `expiration`, `right`, and `strike` to be left blank. +___ + +### `index` +`symbol: str` | `timeframe: str` | `start_date: str` | `end_date: str` | `limit: int` | `live: bool` | `-> bool` + +Requests and displays index data pulled from Polygon.io. + +___ + +### `forex` +`fiat_pair: str` | `timeframe: str` | `start_date: str` | `end_date: str` | `limit: int` | `live: bool` | `-> bool` + +Requests and displays a forex pair pulled from Polygon.io. + +The two currencies should be separated by a '-' (`USD-CAD`, `GBP-JPY`, etc.). + +___ + +### `crypto` +`crypto_pair: str` | `timeframe: str` | `start_date: str` | `end_date: str` | `limit: int` | `live: bool` | `-> bool` + +Requests and displays a crypto pair pulled from Polygon.io. + +The two currencies should be separated by a '-' (`BTC-USD`, `ETH-BTC`, etc.). + +___ + +### `log` +`info: bool` + +If `True`, informational log messages (connection, subscriptions etc.) will be displayed in the console. + +Data errors will always be shown in the console. +___ + +## PolygonChart + +`api_key: str` | `live: bool` | `num_bars: int` + +The `PolygonChart` provides an easy and complete way to use the Polygon.io API within lightweight-charts-python. + +This object requires the `requests` library for static data, and the `websockets` library for live data. + +All data is requested within the chart window through searching and selectors. + +As well as the parameters from the CHART LINK object, PolygonChart also has the parameters: + +* `api_key`: The user's Polygon.io API key. +* `num_bars`: The target number of bars to be displayed on the chart +* `limit`: The maximum number of base aggregates to be queried to create the aggregate results. +* `end_date`: The end date of the time window. +* `timeframe_options`: The selectors to be included within the timeframe selector. +* `security_options`: The selectors to be included within the security selector. +* `live`: If True, the chart will update in real-time. +___ + +### Example + +```python +from lightweight_charts import PolygonChart + +if __name__ == '__main__': + chart = PolygonChart(api_key='', + num_bars=200, + limit=5000, + live=True) + chart.show(block=True) +``` + +![PolygonChart png](https://github.com/louisnw01/lightweight-charts-python/blob/main/docs/source/polygonchart.png) + diff --git a/docs/source/polygonchart.png b/docs/source/polygonchart.png new file mode 100644 index 0000000000000000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u zSp|#mZ_6RoJ_%Ph-|jsF@m@!Y)7^dxzoa?y1(m7P3TM&E9t@5H}!n1 zWQJZ7ID_5?szl-Lz!aXG8CtMd#e`2?b~wuL6R4XRa_ykTIW)k+yS41gx~85eP#6^0 zQfZF6eLR}QRh-M5@%lH8VRg-ZN-ai!E~%lrDTu^*MXv%R`sZ-b*fG^NPnKX~8p`hJ zX}X`?4JZ0m};xyt}5#r^qQ)8<7J9FjKMFhv?(t}_k2CTI-z!W7>1mjV<`c< z=ZvYAGkjypvX>qCN}OhJ*2ACvET@byC;l^nos{+I|Ddf0zumhbm=%~Equ&$xKqq5w zCQnUFWP(4A&ms2}%pnKr+UlnS70dAj8!JyZWPb9ffd5M0jAUpCrjbP5actG;~x%(NqN%IHSg1ztV8y@bBq<1GD z+{my}Yzx_iHq@;^zbPz>;?kB4&_ZpcglBgC<7vAT4QqecEf@_{+I1~IqK^5tHYe`S=X{89-&eer}#%VK5=E$Q1#i(=wxFCoj0zlZSuybiMW`>k10 zQtUC|+_y+IQ)m8keAB2_!1fTp%4xFb6t*W6t{Z7 zV>+w1t<0EpE0ge9ya>CfDRjS;q3@!RS$0|Ye#IX4@?^@PQ??(AZaP@fFdHE!!C$@< ztxpSv1TOpH?bVBpXuHGHwcRzY5^6=A)%$PVy(o{KdPdD8WZ1@=Y&jqkz3r^B_|6Ca eAHQ8lYlOTQ*CWwJi4`E=>zuje+2S+KG5-riL`dxb literal 0 HcmV?d00001 diff --git a/lightweight_charts/__init__.py b/lightweight_charts/__init__.py index f42ac51..d0a59b6 100644 --- a/lightweight_charts/__init__.py +++ b/lightweight_charts/__init__.py @@ -1,4 +1,4 @@ -from .js import LWC +from .abstract import LWC from .chart import Chart from .widgets import JupyterChart from .polygon import PolygonChart diff --git a/lightweight_charts/js.py b/lightweight_charts/abstract.py similarity index 62% rename from lightweight_charts/js.py rename to lightweight_charts/abstract.py index 46dfa4a..2e31555 100644 --- a/lightweight_charts/js.py +++ b/lightweight_charts/abstract.py @@ -1,12 +1,51 @@ -import pandas as pd +import os from datetime import timedelta, datetime -from typing import Union, Literal, Dict +from base64 import b64decode +import pandas as pd +from typing import Union, Literal, Dict, List -from lightweight_charts.pkg import LWC_4_0_1 -from lightweight_charts.util import LINE_STYLE, MARKER_POSITION, MARKER_SHAPE, CROSSHAIR_MODE, _crosshair_mode, _line_style, \ +from lightweight_charts.util import LINE_STYLE, MARKER_POSITION, MARKER_SHAPE, CROSSHAIR_MODE, _crosshair_mode, \ + _line_style, \ MissingColumn, _js_bool, _price_scale_mode, PRICE_SCALE_MODE, _marker_position, _marker_shape, IDGen +JS = {} +current_dir = os.path.dirname(os.path.abspath(__file__)) +for file in ('pkg', 'funcs', 'callback'): + with open(os.path.join(current_dir, 'js', f'{file}.js'), 'r') as f: + JS[file] = f.read() + +HTML = f""" + + + + lightweight-charts-python + + + + + +
+ + + +""" + + class SeriesCommon: def _set_interval(self, df: pd.DataFrame): common_interval = pd.to_datetime(df['time']).diff().value_counts() @@ -14,6 +53,11 @@ class SeriesCommon: self._interval = common_interval.index[0] except IndexError: raise IndexError('Not enough bars within the given data to calculate the interval/timeframe.') + self.run_script(f''' + if ({self.id}.toolBox) {{ + {self.id}.toolBox.interval = {self._interval.total_seconds()*1000} + }} + ''') def _df_datetime_format(self, df: pd.DataFrame): df = df.copy() @@ -95,12 +139,27 @@ class SeriesCommon: Removes a horizontal line at the given price. """ self.run_script(f''' - {self.id}.horizontal_lines.forEach(function (line) {{ - if ({price} === line.price) {{ - {self.id}.series.removePriceLine(line.line); - {self.id}.horizontal_lines.splice({self.id}.horizontal_lines.indexOf(line), 1) - }} - }});''') + {self.id}.horizontal_lines.forEach(function (line) {{ + if ({price} === line.price) {{ + {self.id}.series.removePriceLine(line.line); + {self.id}.horizontal_lines.splice({self.id}.horizontal_lines.indexOf(line), 1) + }} + }});''') + + def clear_markers(self): + """ + Clears the markers displayed on the data.\n + """ + self.run_script(f'''{self.id}.markers = []; {self.id}.series.setMarkers([]])''') + + def clear_horizontal_lines(self): + """ + Clears the horizontal lines displayed on the data.\n + """ + self.run_script(f''' + {self.id}.horizontal_lines.forEach(function (line) {{{self.id}.series.removePriceLine(line.line);}}); + {self.id}.horizontal_lines = []; + ''') def title(self, title: str): self.run_script(f'{self.id}.series.applyOptions({{title: "{title}"}})') @@ -123,30 +182,43 @@ class SeriesCommon: class Line(SeriesCommon): - def __init__(self, parent, color, width, price_line, price_label): - self._parent = parent - self._rand = self._parent._rand + def __init__(self, chart, color, width, price_line, price_label): + self.color = color + self.name = '' + self._chart = chart + self._rand = chart._rand self.id = f'window.{self._rand.generate()}' - self.run_script = self._parent.run_script + self.run_script = self._chart.run_script self.run_script(f''' {self.id} = {{ - series: {self._parent.id}.chart.addLineSeries({{ + series: {self._chart.id}.chart.addLineSeries({{ color: '{color}', lineWidth: {width}, lastValueVisible: {_js_bool(price_label)}, priceLineVisible: {_js_bool(price_line)}, + {"""autoscaleInfoProvider: () => ({ + priceRange: { + minValue: 1_000_000_000, + maxValue: 0, + }, + }),""" if self._chart._scale_candles_only else ''} }}), markers: [], horizontal_lines: [], - }} - ''') + }}''') - def set(self, data: pd.DataFrame): + def set(self, data: pd.DataFrame, name=None): """ Sets the line data.\n - :param data: columns: date/time, value + :param data: If the name parameter is not used, the columns should be named: date/time, value. + :param name: The column of the DataFrame to use as the line value. When used, the Line will be named after this column. """ - df = self._parent._df_datetime_format(data) + df = self._df_datetime_format(data) + if name: + if name not in data: + raise NameError(f'No column named "{name}".') + self.name = name + df = df.rename(columns={name: 'value'}) self._last_bar = df.iloc[-1] self.run_script(f'{self.id}.series.setData({df.to_dict("records")})') @@ -155,7 +227,7 @@ class Line(SeriesCommon): Updates the line data.\n :param series: labels: date/time, value """ - series = self._parent._series_datetime_format(series) + series = self._series_datetime_format(series) self._last_bar = series self.run_script(f'{self.id}.series.update({series.to_dict()})') @@ -163,9 +235,9 @@ class Line(SeriesCommon): """ Irreversibly deletes the line, as well as the object that contains the line. """ - self._parent._lines.remove(self) + self._chart._lines.remove(self) self.run_script(f''' - {self._parent.id}.chart.removeSeries({self.id}.series) + {self._chart.id}.chart.removeSeries({self.id}.series) delete {self.id} ''') del self @@ -174,7 +246,7 @@ class Line(SeriesCommon): class Widget: def __init__(self, topbar): self._chart = topbar._chart - self.method = None + self._method = None class TextWidget(Widget): @@ -193,7 +265,7 @@ class SwitcherWidget(Widget): def __init__(self, topbar, method, *options, default): super().__init__(topbar) self.value = default - self.method = method.__name__ + self._method = method.__name__ self._chart.run_script(f''' makeSwitcher({self._chart.id}, {list(options)}, '{default}', {self._chart._js_api_code}, '{method.__name__}', '{topbar.active_background_color}', '{topbar.active_text_color}', '{topbar.text_color}', '{topbar.hover_color}') @@ -224,13 +296,15 @@ class TopBar: def _widget_with_method(self, method_name): for widget in self._widgets.values(): - if widget.method == method_name: + if widget._method == method_name: return widget class LWC(SeriesCommon): - def __init__(self, volume_enabled: bool = True, inner_width: float = 1.0, inner_height: float = 1.0, dynamic_loading: bool = False): + def __init__(self, volume_enabled: bool = True, inner_width: float = 1.0, inner_height: float = 1.0, dynamic_loading: bool = False, + scale_candles_only: bool = False): self.volume_enabled = volume_enabled + self._scale_candles_only = scale_candles_only self._inner_width = inner_width self._inner_height = inner_height self._dynamic_loading = dynamic_loading @@ -248,6 +322,7 @@ class LWC(SeriesCommon): self._charts = {self.id: self} self._lines = [] self._js_api_code = None + self._return_q = None self._background_color = '#000000' self._volume_up_color = 'rgba(83,141,131,0.8)' @@ -340,7 +415,7 @@ class LWC(SeriesCommon): timer = null; }}, 50); }}); - ''') if self._dynamic_loading else self.run_script(f'{self.id}.series.setData({bars})') + ''') if self._dynamic_loading else self.run_script(f'{self.id}.candleData = {bars}; {self.id}.series.setData({self.id}.candleData)') def fit(self): """ @@ -423,12 +498,11 @@ class LWC(SeriesCommon): self._lines.append(Line(self, color, width, price_line, price_label)) return self._lines[-1] - def lines(self): + def lines(self) -> List[Line]: """ Returns all lines for the chart. - :return: """ - return self._lines + return self._lines.copy() def price_scale(self, mode: PRICE_SCALE_MODE = 'normal', align_labels: bool = True, border_visible: bool = False, border_color: str = None, text_color: str = None, entire_text_only: bool = False, @@ -461,7 +535,6 @@ class LWC(SeriesCommon): secondsVisible: {_js_bool(seconds_visible)}, borderVisible: {_js_bool(border_visible)}, {f'borderColor: "{border_color}",' if border_color else ''} - }} }})''') @@ -584,39 +657,64 @@ class LWC(SeriesCommon): }} }})''') - def legend(self, visible: bool = False, ohlc: bool = True, percent: bool = True, color: str = None, + def legend(self, visible: bool = False, ohlc: bool = True, percent: bool = True, lines: bool = True, color: str = None, font_size: int = None, font_family: str = None): """ Configures the legend of the chart. """ - if visible: - self.run_script(f''' - {f"{self.id}.legend.style.color = '{color}'" if color else ''} - {f"{self.id}.legend.style.fontSize = {font_size}" if font_size else ''} - {f"{self.id}.legend.style.fontFamily = '{font_family}'" if font_family else ''} - - {self.id}.chart.subscribeCrosshairMove((param) => {{ - if (param.time){{ - let data = param.seriesData.get({self.id}.series); - if (!data) {{return}} - let ohlc = `O ${{legendItemFormat(data.open)}} - | H ${{legendItemFormat(data.high)}} - | L ${{legendItemFormat(data.low)}} - | C ${{legendItemFormat(data.close)}} ` - let percentMove = ((data.close-data.open)/data.open)*100 - let percent = `| ${{percentMove >= 0 ? '+' : ''}}${{percentMove.toFixed(2)}} %` - let finalString = '' - {'finalString += ohlc' if ohlc else ''} - {'finalString += percent' if percent else ''} - {self.id}.legend.innerHTML = finalString - }} - else {{ - {self.id}.legend.innerHTML = '' - }} - }});''') + if not visible: + return + lines_code = '' + for i, line in enumerate(self._lines): + lines_code += f'''finalString += `
â–¨{f' {line.name}'} : + ${{legendItemFormat(param.seriesData.get({line.id}.series).value)}}`;''' + + self.run_script(f''' + {f"{self.id}.legend.style.color = '{color}'" if color else ''} + {f"{self.id}.legend.style.fontSize = {font_size}" if font_size else ''} + {f"{self.id}.legend.style.fontFamily = '{font_family}'" if font_family else ''} + + {self.id}.chart.subscribeCrosshairMove((param) => {{ + if (param.time){{ + let data = param.seriesData.get({self.id}.series); + if (!data) {{return}} + let ohlc = `O ${{legendItemFormat(data.open)}} + | H ${{legendItemFormat(data.high)}} + | L ${{legendItemFormat(data.low)}} + | C ${{legendItemFormat(data.close)}} ` + let percentMove = ((data.close-data.open)/data.open)*100 + let percent = `| ${{percentMove >= 0 ? '+' : ''}}${{percentMove.toFixed(2)}} %` + let finalString = '' + {'finalString += ohlc' if ohlc else ''} + {'finalString += percent' if percent else ''} + {lines_code if lines else ''} + {self.id}.legend.innerHTML = finalString+'' + }} + else {{ + {self.id}.legend.innerHTML = '' + }} + }});''') def spinner(self, visible): self.run_script(f"{self.id}.spinner.style.display = '{'block' if visible else 'none'}'") + def screenshot(self) -> bytes: + """ + Takes a screenshot. This method can only be used after the chart window is visible. + :return: a bytes object containing a screenshot of the chart. + """ + self.run_script(f''' + let canvas = {self.id}.chart.takeScreenshot() + canvas.toBlob(function(blob) {{ + const reader = new FileReader(); + reader.onload = function(event) {{ + {self._js_api_code}(`return__{self.id}__${{event.target.result}}`) + }}; + reader.readAsDataURL(blob); + }}) + ''') + serial_data = self._return_q.get() + return b64decode(serial_data.split(',')[1]) + def create_subchart(self, volume_enabled: bool = True, position: Literal['left', 'right', 'top', 'bottom'] = 'left', width: float = 0.5, height: float = 0.5, sync: Union[bool, str] = False, topbar: bool = False, searchbox: bool = False): @@ -633,6 +731,7 @@ class SubChart(LWC): self._position = position self._rand = self._chart._rand self._js_api_code = self._chart._js_api_code + self._return_q = self._chart._return_q self.run_script = self._chart.run_script self._charts = self._chart._charts self.id = f'window.{self._rand.generate()}' @@ -655,407 +754,4 @@ class SubChart(LWC): ''', run_last=True) -SCRIPT = """ -document.getElementById('wrapper').style.backgroundColor = '#000000' -function makeChart(innerWidth, innerHeight, autoSize=true) { - let chart = { - markers: [], - horizontal_lines: [], - div: document.createElement('div'), - wrapper: document.createElement('div'), - legend: document.createElement('div'), - scale: { - width: innerWidth, - height: innerHeight - }, - } - chart.chart = LightweightCharts.createChart(chart.div, { - width: window.innerWidth*innerWidth, - height: window.innerHeight*innerHeight, - layout: { - textColor: '#d1d4dc', - background: { - color:'#000000', - type: LightweightCharts.ColorType.Solid, - }, - fontSize: 12 - }, - rightPriceScale: { - scaleMargins: {top: 0.3, bottom: 0.25}, - }, - timeScale: {timeVisible: true, secondsVisible: false}, - crosshair: { - mode: LightweightCharts.CrosshairMode.Normal, - vertLine: { - labelBackgroundColor: 'rgb(46, 46, 46)' - }, - horzLine: { - labelBackgroundColor: 'rgb(55, 55, 55)' - } - }, - grid: { - vertLines: {color: 'rgba(29, 30, 38, 5)'}, - horzLines: {color: 'rgba(29, 30, 58, 5)'}, - }, - handleScroll: {vertTouchDrag: true}, - }) - let up = 'rgba(39, 157, 130, 100)' - let down = 'rgba(200, 97, 100, 100)' - chart.series = chart.chart.addCandlestickSeries({color: 'rgb(0, 120, 255)', upColor: up, borderUpColor: up, wickUpColor: up, - downColor: down, borderDownColor: down, wickDownColor: down, lineWidth: 2, - }) - chart.volumeSeries = chart.chart.addHistogramSeries({ - color: '#26a69a', - priceFormat: {type: 'volume'}, - priceScaleId: '', - }) - chart.series.priceScale().applyOptions({ - scaleMargins: {top: 0.2, bottom: 0.2}, - }); - chart.volumeSeries.priceScale().applyOptions({ - scaleMargins: {top: 0.8, bottom: 0}, - }); - chart.legend.style.position = 'absolute' - chart.legend.style.zIndex = 1000 - chart.legend.style.width = `${(chart.scale.width*100)-8}vw` - chart.legend.style.top = '10px' - chart.legend.style.left = '10px' - chart.legend.style.fontFamily = 'Monaco' - chart.legend.style.fontSize = '11px' - chart.legend.style.color = 'rgb(191, 195, 203)' - - chart.wrapper.style.width = `${100*innerWidth}%` - chart.wrapper.style.height = `${100*innerHeight}%` - chart.div.style.position = 'relative' - chart.wrapper.style.display = 'flex' - chart.wrapper.style.flexDirection = 'column' - - chart.div.appendChild(chart.legend) - chart.wrapper.appendChild(chart.div) - document.getElementById('wrapper').append(chart.wrapper) - - if (!autoSize) { - return chart - } - let topBarOffset = 0 - window.addEventListener('resize', function() { - if ('topBar' in chart) { - topBarOffset = chart.topBar.offsetHeight - } - chart.chart.resize(window.innerWidth*innerWidth, (window.innerHeight*innerHeight)-topBarOffset) - }); - return chart -} -function makeHorizontalLine(chart, lineId, price, color, width, style, axisLabelVisible, text) { - let priceLine = { - price: price, - color: color, - lineWidth: width, - lineStyle: style, - axisLabelVisible: axisLabelVisible, - title: text, - }; - let line = { - line: chart.series.createPriceLine(priceLine), - price: price, - id: lineId, - }; - chart.horizontal_lines.push(line) -} -function legendItemFormat(num) { -return num.toFixed(2).toString().padStart(8, ' ') -} -function syncCrosshairs(childChart, parentChart) { - let parent = 0 - let child = 0 - - let parentCrosshairHandler = (e) => { - parent ++ - if (parent < 10) { - return - } - child = 0 - parentChart.applyOptions({crosshair: { horzLine: { - visible: true, - labelVisible: true, - }}}) - childChart.applyOptions({crosshair: { horzLine: { - visible: false, - labelVisible: false, - }}}) - - childChart.unsubscribeCrosshairMove(childCrosshairHandler) - if (e.time !== undefined) { - let xx = childChart.timeScale().timeToCoordinate(e.time); - childChart.setCrosshairXY(xx,300,true); - } else if (e.point !== undefined){ - childChart.setCrosshairXY(e.point.x,300,false); - } - childChart.subscribeCrosshairMove(childCrosshairHandler) - } - - let childCrosshairHandler = (e) => { - child ++ - if (child < 10) { - return - } - parent = 0 - childChart.applyOptions({crosshair: {horzLine: { - visible: true, - labelVisible: true, - }}}) - parentChart.applyOptions({crosshair: {horzLine: { - visible: false, - labelVisible: false, - }}}) - - parentChart.unsubscribeCrosshairMove(parentCrosshairHandler) - if (e.time !== undefined) { - let xx = parentChart.timeScale().timeToCoordinate(e.time); - parentChart.setCrosshairXY(xx,300,true); - } else if (e.point !== undefined){ - parentChart.setCrosshairXY(e.point.x,300,false); - } - parentChart.subscribeCrosshairMove(parentCrosshairHandler) - } - parentChart.subscribeCrosshairMove(parentCrosshairHandler) - childChart.subscribeCrosshairMove(childCrosshairHandler) -} -""" - -HTML = f""" - - - - lightweight-charts-python - - - - - -
- - -""" - -CALLBACK_SCRIPT = ''' -function makeSearchBox(chart, callbackFunction) { - let searchWindow = document.createElement('div') - searchWindow.style.position = 'absolute' - searchWindow.style.top = '0' - searchWindow.style.bottom = '200px' - searchWindow.style.left = '0' - searchWindow.style.right = '0' - searchWindow.style.margin = 'auto' - searchWindow.style.width = '150px' - searchWindow.style.height = '30px' - searchWindow.style.padding = '10px' - searchWindow.style.backgroundColor = 'rgba(30, 30, 30, 0.9)' - searchWindow.style.border = '2px solid #3C434C' - searchWindow.style.zIndex = '1000' - searchWindow.style.display = 'none' - searchWindow.style.borderRadius = '5px' - - let magnifyingGlass = document.createElement('span'); - magnifyingGlass.style.display = 'inline-block'; - magnifyingGlass.style.width = '12px'; - magnifyingGlass.style.height = '12px'; - magnifyingGlass.style.border = '2px solid rgb(240, 240, 240)'; - magnifyingGlass.style.borderRadius = '50%'; - magnifyingGlass.style.position = 'relative'; - let handle = document.createElement('span'); - handle.style.display = 'block'; - handle.style.width = '7px'; - handle.style.height = '2px'; - handle.style.backgroundColor = 'rgb(240, 240, 240)'; - handle.style.position = 'absolute'; - handle.style.top = 'calc(50% + 7px)'; - handle.style.right = 'calc(50% - 11px)'; - handle.style.transform = 'rotate(45deg)'; - - let sBox = document.createElement('input'); - sBox.type = 'text'; - sBox.style.position = 'relative'; - sBox.style.display = 'inline-block'; - sBox.style.zIndex = '1000'; - sBox.style.textAlign = 'center' - sBox.style.width = '100px' - sBox.style.marginLeft = '15px' - sBox.style.backgroundColor = 'rgba(0, 122, 255, 0.3)' - sBox.style.color = 'rgb(240,240,240)' - sBox.style.fontSize = '20px' - sBox.style.border = 'none' - sBox.style.outline = 'none' - sBox.style.borderRadius = '2px' - - searchWindow.appendChild(magnifyingGlass) - magnifyingGlass.appendChild(handle) - searchWindow.appendChild(sBox) - chart.div.appendChild(searchWindow); - - let yPrice = null - chart.chart.subscribeCrosshairMove((param) => { - if (param.point){ - yPrice = param.point.y; - } - }); - let selectedChart = true - chart.wrapper.addEventListener('mouseover', (event) => { - selectedChart = true - }) - chart.wrapper.addEventListener('mouseout', (event) => { - selectedChart = false - }) - document.addEventListener('keydown', function(event) { - if (!selectedChart) {return} - if (event.altKey && event.code === 'KeyH') { - let price = chart.series.coordinateToPrice(yPrice) - - let colorList = [ - 'rgba(228, 0, 16, 0.7)', - 'rgba(255, 133, 34, 0.7)', - 'rgba(164, 59, 176, 0.7)', - 'rgba(129, 59, 102, 0.7)', - 'rgba(91, 20, 248, 0.7)', - 'rgba(32, 86, 249, 0.7)', - ] - let color = colorList[Math.floor(Math.random()*colorList.length)] - - makeHorizontalLine(chart, 0, price, color, 2, LightweightCharts.LineStyle.Solid, true, '') - } - if (searchWindow.style.display === 'none') { - if (/^[a-zA-Z0-9]$/.test(event.key)) { - searchWindow.style.display = 'block'; - sBox.focus(); - } - } - else if (event.key === 'Enter') { - callbackFunction(`on_search__${chart.id}__${sBox.value}`) - searchWindow.style.display = 'none' - sBox.value = '' - } - else if (event.key === 'Escape') { - searchWindow.style.display = 'none' - sBox.value = '' - } - }); - sBox.addEventListener('input', function() { - sBox.value = sBox.value.toUpperCase(); - }); - return { - window: searchWindow, - box: sBox, - } -} - -function makeSpinner(chart) { - chart.spinner = document.createElement('div') - chart.spinner.style.width = '30px' - chart.spinner.style.height = '30px' - chart.spinner.style.border = '4px solid rgba(255, 255, 255, 0.6)' - chart.spinner.style.borderTop = '4px solid rgba(0, 122, 255, 0.8)' - chart.spinner.style.borderRadius = '50%' - chart.spinner.style.position = 'absolute' - chart.spinner.style.top = '50%' - chart.spinner.style.left = '50%' - chart.spinner.style.zIndex = 1000 - chart.spinner.style.transform = 'translate(-50%, -50%)' - chart.spinner.style.display = 'none' - chart.wrapper.appendChild(chart.spinner) - let rotation = 0; - const speed = 10; // Adjust this value to change the animation speed - function animateSpinner() { - rotation += speed - chart.spinner.style.transform = `translate(-50%, -50%) rotate(${rotation}deg)` - requestAnimationFrame(animateSpinner) - } - animateSpinner(); -} -function makeSwitcher(chart, items, activeItem, callbackFunction, callbackName, activeBackgroundColor, activeColor, inactiveColor, hoverColor) { - let switcherElement = document.createElement('div'); - switcherElement.style.margin = '4px 14px' - switcherElement.style.zIndex = '1000' - - let intervalElements = items.map(function(item) { - let itemEl = document.createElement('button'); - itemEl.style.cursor = 'pointer' - itemEl.style.padding = '2px 5px' - itemEl.style.margin = '0px 4px' - itemEl.style.fontSize = '13px' - itemEl.style.backgroundColor = item === activeItem ? activeBackgroundColor : 'transparent' - itemEl.style.color = item === activeItem ? activeColor : inactiveColor - itemEl.style.border = 'none' - itemEl.style.borderRadius = '4px' - - itemEl.addEventListener('mouseenter', function() { - itemEl.style.backgroundColor = item === activeItem ? activeBackgroundColor : hoverColor - itemEl.style.color = activeColor - }) - itemEl.addEventListener('mouseleave', function() { - itemEl.style.backgroundColor = item === activeItem ? activeBackgroundColor : 'transparent' - itemEl.style.color = item === activeItem ? activeColor : inactiveColor - }) - itemEl.innerText = item; - itemEl.addEventListener('click', function() { - onItemClicked(item); - }); - switcherElement.appendChild(itemEl); - return itemEl; - }); - function onItemClicked(item) { - if (item === activeItem) { - return; - } - intervalElements.forEach(function(element, index) { - element.style.backgroundColor = items[index] === item ? activeBackgroundColor : 'transparent' - element.style.color = items[index] === item ? 'activeColor' : inactiveColor - }); - activeItem = item; - callbackFunction(`${callbackName}__${chart.id}__${item}`); - } - chart.topBar.appendChild(switcherElement) - makeSeperator(chart.topBar) - return switcherElement; -} - -function makeTextBoxWidget(chart, text) { - let textBox = document.createElement('div') - textBox.style.margin = '0px 18px' - textBox.style.position = 'relative' - textBox.style.fontSize = '16px' - textBox.style.color = 'rgb(220, 220, 220)' - textBox.innerText = text - chart.topBar.append(textBox) - makeSeperator(chart.topBar) - return textBox -} -function makeTopBar(chart) { - chart.topBar = document.createElement('div') - chart.topBar.style.backgroundColor = '#191B1E' - chart.topBar.style.borderBottom = '2px solid #3C434C' - chart.topBar.style.display = 'flex' - chart.topBar.style.alignItems = 'center' - chart.wrapper.prepend(chart.topBar) -} -function makeSeperator(topBar) { - let seperator = document.createElement('div') - seperator.style.width = '1px' - seperator.style.height = '20px' - seperator.style.backgroundColor = '#3C434C' - topBar.appendChild(seperator) - } -''' diff --git a/lightweight_charts/chart.py b/lightweight_charts/chart.py index 079eb0c..2f9548f 100644 --- a/lightweight_charts/chart.py +++ b/lightweight_charts/chart.py @@ -1,28 +1,30 @@ import asyncio -import time import multiprocessing as mp import webview -from lightweight_charts.js import LWC, CALLBACK_SCRIPT, TopBar +from lightweight_charts.abstract import LWC, JS, TopBar class CallbackAPI: - def __init__(self, emit): self.emit = emit + def __init__(self, emit_queue, return_queue): + self.emit_q, self.return_q = emit_queue, return_queue def callback(self, message: str): messages = message.split('__') name, chart_id = messages[:2] args = messages[2:] - self.emit.put((name, chart_id, *args)) + self.return_q.put(*args) if name == 'return' else self.emit_q.put((name, chart_id, *args)) class PyWV: - def __init__(self, q, exit, loaded, html, width, height, x, y, on_top, debug, emit): + def __init__(self, q, exit, loaded, html, width, height, x, y, on_top, maximize, debug, emit_queue, return_queue): + if maximize: + width, height = webview.screens[0].width, webview.screens[0].height self.queue = q self.exit = exit self.loaded = loaded self.debug = debug - js_api = CallbackAPI(emit) + js_api = CallbackAPI(emit_queue, return_queue) self.webview = webview.create_window('', html=html, on_top=on_top, js_api=js_api, width=width, height=height, x=x, y=y, background_color='#000000') self.webview.events.loaded += self.on_js_load @@ -40,30 +42,28 @@ class PyWV: except KeyError: return - def on_js_load(self): - self.loaded.set(), self.loop() + def on_js_load(self): self.loaded.set(), self.loop() class Chart(LWC): def __init__(self, volume_enabled: bool = True, width: int = 800, height: int = 600, x: int = None, y: int = None, - on_top: bool = False, debug: bool = False, api: object = None, topbar: bool = False, searchbox: bool = False, - inner_width: float = 1.0, inner_height: float = 1.0, dynamic_loading: bool = False): - super().__init__(volume_enabled, inner_width, inner_height, dynamic_loading) - self._emit = mp.Queue() - self._q = mp.Queue() + on_top: bool = False, maximize: bool = False, debug: bool = False, + api: object = None, topbar: bool = False, searchbox: bool = False, + inner_width: float = 1.0, inner_height: float = 1.0, dynamic_loading: bool = False, scale_candles_only: bool = False): + super().__init__(volume_enabled, inner_width, inner_height, dynamic_loading, scale_candles_only) + self._q, self._emit_q, self._return_q = (mp.Queue() for _ in range(3)) + self._exit, self._loaded = mp.Event(), mp.Event() self._script_func = self._q.put - self._exit = mp.Event() - self._loaded = mp.Event() + self._api = api + self._js_api_code = 'pywebview.api.callback' self._process = mp.Process(target=PyWV, args=(self._q, self._exit, self._loaded, self._html, - width, height, x, y, on_top, debug, self._emit), daemon=True) + width, height, x, y, on_top, maximize, debug, + self._emit_q, self._return_q), daemon=True) self._process.start() self._create_chart() - - self.api = api - self._js_api_code = 'pywebview.api.callback' if not topbar and not searchbox: return - self.run_script(CALLBACK_SCRIPT) + self.run_script(JS['callback']) self.run_script(f'makeSpinner({self.id})') self.topbar = TopBar(self) if topbar else None self._make_search_box() if searchbox else None @@ -80,50 +80,35 @@ class Chart(LWC): else: self._q.put('show') if block: - try: - while 1: - while not self._exit.is_set() and self.polygon._q.empty(): - time.sleep(0.05) - continue - if self._exit.is_set(): - self._exit.clear() - return - value = self.polygon._q.get_nowait() - func, args = value[0], value[1:] - func(*args) - except KeyboardInterrupt: - return + asyncio.run(self.show_async(block=True)) async def show_async(self, block=False): - if not self.loaded: - self._q.put('start') - self._loaded.wait() - self._on_js_load() - else: - self._q.put('show') - if block: - try: - while 1: - while self._emit.empty() and not self._exit.is_set() and self.polygon._q.empty(): - await asyncio.sleep(0.05) - if self._exit.is_set(): - self._exit.clear() - return - elif not self._emit.empty(): - key, chart_id, arg = self._emit.get() - self.api.chart = self._charts[chart_id] - if widget := self.api.chart.topbar._widget_with_method(key): - widget.value = arg - await getattr(self.api, key)() - else: - await getattr(self.api, key)(arg) - continue - value = self.polygon._q.get() - func, args = value[0], value[1:] - func(*args) - except KeyboardInterrupt: - return - asyncio.create_task(self.show_async(block=True)) + self.show(block=False) + if not block: + asyncio.create_task(self.show_async(block=True)) + return + try: + while 1: + while self._emit_q.empty() and not self._exit.is_set() and self.polygon._q.empty(): + await asyncio.sleep(0.05) + if self._exit.is_set(): + self._exit.clear() + return + elif not self._emit_q.empty(): + key, chart_id, arg = self._emit_q.get() + self._api.chart = self._charts[chart_id] + if widget := self._api.chart.topbar._widget_with_method(key): + widget.value = arg + await getattr(self._api, key)() + else: + await getattr(self._api, key)(arg) + continue + value = self.polygon._q.get() + func, args = value[0], value[1:] + func(*args) + except KeyboardInterrupt: + return + def hide(self): """ diff --git a/lightweight_charts/js/callback.js b/lightweight_charts/js/callback.js new file mode 100644 index 0000000..b6700d3 --- /dev/null +++ b/lightweight_charts/js/callback.js @@ -0,0 +1,208 @@ +function makeSearchBox(chart, callbackFunction) { + let searchWindow = document.createElement('div') + searchWindow.style.position = 'absolute' + searchWindow.style.top = '0' + searchWindow.style.bottom = '200px' + searchWindow.style.left = '0' + searchWindow.style.right = '0' + searchWindow.style.margin = 'auto' + searchWindow.style.width = '150px' + searchWindow.style.height = '30px' + searchWindow.style.padding = '10px' + searchWindow.style.backgroundColor = 'rgba(30, 30, 30, 0.9)' + searchWindow.style.border = '2px solid #3C434C' + searchWindow.style.zIndex = '1000' + searchWindow.style.display = 'none' + searchWindow.style.borderRadius = '5px' + + let magnifyingGlass = document.createElement('span'); + magnifyingGlass.style.display = 'inline-block'; + magnifyingGlass.style.width = '12px'; + magnifyingGlass.style.height = '12px'; + magnifyingGlass.style.border = '2px solid rgb(240, 240, 240)'; + magnifyingGlass.style.borderRadius = '50%'; + magnifyingGlass.style.position = 'relative'; + let handle = document.createElement('span'); + handle.style.display = 'block'; + handle.style.width = '7px'; + handle.style.height = '2px'; + handle.style.backgroundColor = 'rgb(240, 240, 240)'; + handle.style.position = 'absolute'; + handle.style.top = 'calc(50% + 7px)'; + handle.style.right = 'calc(50% - 11px)'; + handle.style.transform = 'rotate(45deg)'; + + let sBox = document.createElement('input'); + sBox.type = 'text'; + sBox.style.position = 'relative'; + sBox.style.display = 'inline-block'; + sBox.style.zIndex = '1000'; + sBox.style.textAlign = 'center' + sBox.style.width = '100px' + sBox.style.marginLeft = '15px' + sBox.style.backgroundColor = 'rgba(0, 122, 255, 0.3)' + sBox.style.color = 'rgb(240,240,240)' + sBox.style.fontSize = '20px' + sBox.style.border = 'none' + sBox.style.outline = 'none' + sBox.style.borderRadius = '2px' + + searchWindow.appendChild(magnifyingGlass) + magnifyingGlass.appendChild(handle) + searchWindow.appendChild(sBox) + chart.div.appendChild(searchWindow); + + let yPrice = null + chart.chart.subscribeCrosshairMove((param) => { + if (param.point){ + yPrice = param.point.y; + } + }); + let selectedChart = true + chart.wrapper.addEventListener('mouseover', (event) => { + selectedChart = true + }) + chart.wrapper.addEventListener('mouseout', (event) => { + selectedChart = false + }) + document.addEventListener('keydown', function(event) { + if (!selectedChart) {return} + if (event.altKey && event.code === 'KeyH') { + let price = chart.series.coordinateToPrice(yPrice) + + let colorList = [ + 'rgba(228, 0, 16, 0.7)', + 'rgba(255, 133, 34, 0.7)', + 'rgba(164, 59, 176, 0.7)', + 'rgba(129, 59, 102, 0.7)', + 'rgba(91, 20, 248, 0.7)', + 'rgba(32, 86, 249, 0.7)', + ] + let color = colorList[Math.floor(Math.random()*colorList.length)] + + makeHorizontalLine(chart, 0, price, color, 2, LightweightCharts.LineStyle.Solid, true, '') + } + if (searchWindow.style.display === 'none') { + if (/^[a-zA-Z0-9]$/.test(event.key)) { + searchWindow.style.display = 'block'; + sBox.focus(); + } + } + else if (event.key === 'Enter') { + callbackFunction(`on_search__${chart.id}__${sBox.value}`) + searchWindow.style.display = 'none' + sBox.value = '' + } + else if (event.key === 'Escape') { + searchWindow.style.display = 'none' + sBox.value = '' + } + }); + sBox.addEventListener('input', function() { + sBox.value = sBox.value.toUpperCase(); + }); + return { + window: searchWindow, + box: sBox, + } +} + +function makeSpinner(chart) { + chart.spinner = document.createElement('div') + chart.spinner.style.width = '30px' + chart.spinner.style.height = '30px' + chart.spinner.style.border = '4px solid rgba(255, 255, 255, 0.6)' + chart.spinner.style.borderTop = '4px solid rgba(0, 122, 255, 0.8)' + chart.spinner.style.borderRadius = '50%' + chart.spinner.style.position = 'absolute' + chart.spinner.style.top = '50%' + chart.spinner.style.left = '50%' + chart.spinner.style.zIndex = 1000 + chart.spinner.style.transform = 'translate(-50%, -50%)' + chart.spinner.style.display = 'none' + chart.wrapper.appendChild(chart.spinner) + let rotation = 0; + const speed = 10; // Adjust this value to change the animation speed + function animateSpinner() { + rotation += speed + chart.spinner.style.transform = `translate(-50%, -50%) rotate(${rotation}deg)` + requestAnimationFrame(animateSpinner) + } + animateSpinner(); +} +function makeSwitcher(chart, items, activeItem, callbackFunction, callbackName, activeBackgroundColor, activeColor, inactiveColor, hoverColor) { + let switcherElement = document.createElement('div'); + switcherElement.style.margin = '4px 14px' + switcherElement.style.zIndex = '1000' + + let intervalElements = items.map(function(item) { + let itemEl = document.createElement('button'); + itemEl.style.cursor = 'pointer' + itemEl.style.padding = '2px 5px' + itemEl.style.margin = '0px 4px' + itemEl.style.fontSize = '13px' + itemEl.style.backgroundColor = item === activeItem ? activeBackgroundColor : 'transparent' + itemEl.style.color = item === activeItem ? activeColor : inactiveColor + itemEl.style.border = 'none' + itemEl.style.borderRadius = '4px' + + itemEl.addEventListener('mouseenter', function() { + itemEl.style.backgroundColor = item === activeItem ? activeBackgroundColor : hoverColor + itemEl.style.color = activeColor + }) + itemEl.addEventListener('mouseleave', function() { + itemEl.style.backgroundColor = item === activeItem ? activeBackgroundColor : 'transparent' + itemEl.style.color = item === activeItem ? activeColor : inactiveColor + }) + itemEl.innerText = item; + itemEl.addEventListener('click', function() { + onItemClicked(item); + }); + switcherElement.appendChild(itemEl); + return itemEl; + }); + function onItemClicked(item) { + if (item === activeItem) { + return; + } + intervalElements.forEach(function(element, index) { + element.style.backgroundColor = items[index] === item ? activeBackgroundColor : 'transparent' + element.style.color = items[index] === item ? 'activeColor' : inactiveColor + }); + activeItem = item; + callbackFunction(`${callbackName}__${chart.id}__${item}`); + } + chart.topBar.appendChild(switcherElement) + makeSeperator(chart.topBar) + return switcherElement; +} + +function makeTextBoxWidget(chart, text) { + let textBox = document.createElement('div') + textBox.style.margin = '0px 18px' + textBox.style.position = 'relative' + textBox.style.fontSize = '16px' + textBox.style.color = 'rgb(220, 220, 220)' + textBox.innerText = text + chart.topBar.append(textBox) + makeSeperator(chart.topBar) + return textBox +} +function makeTopBar(chart) { + chart.topBar = document.createElement('div') + chart.topBar.style.backgroundColor = '#191B1E' + chart.topBar.style.borderBottom = '2px solid #3C434C' + chart.topBar.style.display = 'flex' + chart.topBar.style.alignItems = 'center' + chart.wrapper.prepend(chart.topBar) +} + +function makeSeperator(topBar) { + let seperator = document.createElement('div') + seperator.style.width = '1px' + seperator.style.height = '20px' + seperator.style.backgroundColor = '#3C434C' + topBar.appendChild(seperator) + } + + diff --git a/lightweight_charts/js/funcs.js b/lightweight_charts/js/funcs.js new file mode 100644 index 0000000..7317b12 --- /dev/null +++ b/lightweight_charts/js/funcs.js @@ -0,0 +1,167 @@ +function makeChart(innerWidth, innerHeight, autoSize=true) { + let chart = { + markers: [], + horizontal_lines: [], + wrapper: document.createElement('div'), + div: document.createElement('div'), + legend: document.createElement('div'), + scale: { + width: innerWidth, + height: innerHeight + }, + } + chart.chart = LightweightCharts.createChart(chart.div, { + width: window.innerWidth*innerWidth, + height: window.innerHeight*innerHeight, + layout: { + textColor: '#d1d4dc', + background: { + color:'#000000', + type: LightweightCharts.ColorType.Solid, + }, + fontSize: 12 + }, + rightPriceScale: { + scaleMargins: {top: 0.3, bottom: 0.25}, + }, + timeScale: {timeVisible: true, secondsVisible: false}, + crosshair: { + mode: LightweightCharts.CrosshairMode.Normal, + vertLine: { + labelBackgroundColor: 'rgb(46, 46, 46)' + }, + horzLine: { + labelBackgroundColor: 'rgb(55, 55, 55)' + } + }, + grid: { + vertLines: {color: 'rgba(29, 30, 38, 5)'}, + horzLines: {color: 'rgba(29, 30, 58, 5)'}, + }, + handleScroll: {vertTouchDrag: true}, + }) + let up = 'rgba(39, 157, 130, 100)' + let down = 'rgba(200, 97, 100, 100)' + chart.series = chart.chart.addCandlestickSeries({ + color: 'rgb(0, 120, 255)', upColor: up, borderUpColor: up, wickUpColor: up, + downColor: down, borderDownColor: down, wickDownColor: down, lineWidth: 2, + }) + chart.volumeSeries = chart.chart.addHistogramSeries({ + color: '#26a69a', + priceFormat: {type: 'volume'}, + priceScaleId: '', + }) + chart.series.priceScale().applyOptions({ + scaleMargins: {top: 0.2, bottom: 0.2}, + }); + chart.volumeSeries.priceScale().applyOptions({ + scaleMargins: {top: 0.8, bottom: 0}, + }); + chart.legend.style.position = 'absolute' + chart.legend.style.zIndex = 1000 + chart.legend.style.width = `${(chart.scale.width*100)-8}vw` + chart.legend.style.top = '10px' + chart.legend.style.left = '10px' + chart.legend.style.fontFamily = 'Monaco' + chart.legend.style.fontSize = '11px' + chart.legend.style.color = 'rgb(191, 195, 203)' + + chart.wrapper.style.width = `${100*innerWidth}%` + chart.wrapper.style.height = `${100*innerHeight}%` + chart.wrapper.style.display = 'flex' + chart.wrapper.style.flexDirection = 'column' + + chart.div.style.position = 'relative' + chart.div.style.display = 'flex' + + chart.div.appendChild(chart.legend) + chart.wrapper.appendChild(chart.div) + document.getElementById('wrapper').append(chart.wrapper) + + if (!autoSize) { + return chart + } + let topBarOffset = 0 + window.addEventListener('resize', function() { + if ('topBar' in chart) { + topBarOffset = chart.topBar.offsetHeight + } + chart.chart.resize(window.innerWidth*innerWidth, (window.innerHeight*innerHeight)-topBarOffset) + }); + return chart +} +function makeHorizontalLine(chart, lineId, price, color, width, style, axisLabelVisible, text) { + let priceLine = { + price: price, + color: color, + lineWidth: width, + lineStyle: style, + axisLabelVisible: axisLabelVisible, + title: text, + }; + let line = { + line: chart.series.createPriceLine(priceLine), + price: price, + id: lineId, + }; + chart.horizontal_lines.push(line) +} +function legendItemFormat(num) { +return num.toFixed(2).toString().padStart(8, ' ') +} +function syncCrosshairs(childChart, parentChart) { + let parent = 0 + let child = 0 + + let parentCrosshairHandler = (e) => { + parent ++ + if (parent < 10) { + return + } + child = 0 + parentChart.applyOptions({crosshair: { horzLine: { + visible: true, + labelVisible: true, + }}}) + childChart.applyOptions({crosshair: { horzLine: { + visible: false, + labelVisible: false, + }}}) + + childChart.unsubscribeCrosshairMove(childCrosshairHandler) + if (e.time !== undefined) { + let xx = childChart.timeScale().timeToCoordinate(e.time); + childChart.setCrosshairXY(xx,300,true); + } else if (e.point !== undefined){ + childChart.setCrosshairXY(e.point.x,300,false); + } + childChart.subscribeCrosshairMove(childCrosshairHandler) + } + + let childCrosshairHandler = (e) => { + child ++ + if (child < 10) { + return + } + parent = 0 + childChart.applyOptions({crosshair: {horzLine: { + visible: true, + labelVisible: true, + }}}) + parentChart.applyOptions({crosshair: {horzLine: { + visible: false, + labelVisible: false, + }}}) + + parentChart.unsubscribeCrosshairMove(parentCrosshairHandler) + if (e.time !== undefined) { + let xx = parentChart.timeScale().timeToCoordinate(e.time); + parentChart.setCrosshairXY(xx,300,true); + } else if (e.point !== undefined){ + parentChart.setCrosshairXY(e.point.x,300,false); + } + parentChart.subscribeCrosshairMove(parentCrosshairHandler) + } + parentChart.subscribeCrosshairMove(parentCrosshairHandler) + childChart.subscribeCrosshairMove(childCrosshairHandler) +} \ No newline at end of file diff --git a/lightweight_charts/pkg.py b/lightweight_charts/js/pkg.js similarity index 99% rename from lightweight_charts/pkg.py rename to lightweight_charts/js/pkg.js index 9c8742b..39207a2 100644 --- a/lightweight_charts/pkg.py +++ b/lightweight_charts/js/pkg.js @@ -1,9 +1,7 @@ -LWC_4_0_1 = """ /*! * @license * TradingView Lightweight Charts™ v4.1.0-dev+202306102016 * Copyright (c) 2023 TradingView, Inc. * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 */ -!function(){"use strict";var t,i;function s(t,i){const s={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(s)}function e(t,i,s,e){t.beginPath();const h=t.lineWidth%2?.5:0;t.moveTo(s,i+h),t.lineTo(e,i+h),t.stroke()}function h(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function n(t){if(void 0===t)throw new Error("Value is undefined");return t}function r(t){if(null===t)throw new Error("Value is null");return t}function o(t){return r(n(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"}(t||(t={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(i||(i={}));const l={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function a(t){return t<0?0:t>255?255:Math.round(t)||0}function u(t){return t<=0||t>0?t<0?0:t>1?1:Math.round(1e4*t)/1e4:0}const c=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,d=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,f=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,p=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/;function m(t){(t=t.toLowerCase())in l&&(t=l[t]);{const i=p.exec(t)||f.exec(t);if(i)return[a(parseInt(i[1],10)),a(parseInt(i[2],10)),a(parseInt(i[3],10)),u(i.length<5?1:parseFloat(i[4]))]}{const i=d.exec(t);if(i)return[a(parseInt(i[1],16)),a(parseInt(i[2],16)),a(parseInt(i[3],16)),1]}{const i=c.exec(t);if(i)return[a(17*parseInt(i[1],16)),a(17*parseInt(i[2],16)),a(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function v(t){const i=m(t);return{background:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,foreground:(s=i,.199*s[0]+.687*s[1]+.114*s[2]>160?"black":"white")};var s}class b{constructor(){this._listeners=[]}subscribe(t,i,s){const e={callback:t,linkedObject:i,singleshot:!0===s};this._listeners.push(e)}unsubscribe(t){const i=this._listeners.findIndex((i=>t===i.callback));i>-1&&this._listeners.splice(i,1)}unsubscribeAll(t){this._listeners=this._listeners.filter((i=>i.linkedObject!==t))}fire(t,i,s){const e=[...this._listeners];this._listeners=this._listeners.filter((t=>!t.singleshot)),e.forEach((e=>e.callback(t,i,s)))}hasListeners(){return this._listeners.length>0}destroy(){this._listeners=[]}}function g(t,...i){for(const s of i)for(const i in s)void 0!==s[i]&&("object"!=typeof s[i]||void 0===t[i]?t[i]=s[i]:g(t[i],s[i]));return t}function w(t){return"number"==typeof t&&isFinite(t)}function M(t){return"number"==typeof t&&t%1==0}function S(t){return"string"==typeof t}function x(t){return"boolean"==typeof t}function _(t){const i=t;if(!i||"object"!=typeof i)return i;let s,e,h;for(e in s=Array.isArray(i)?[]:{},i)i.hasOwnProperty(e)&&(h=i[e],s[e]=h&&"object"==typeof h?_(h):h);return s}function y(t){return null!==t}function k(t){return null===t?void 0:t}const C="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function T(t,i,s){return void 0===i&&(i=C),`${s=void 0!==s?`${s} `:""}${t}px ${i}`}var P;!function(t){t[t.BorderSize=1]="BorderSize",t[t.TickLength=5]="TickLength"}(P||(P={}));class R{constructor(t){this._rendererOptions={borderSize:1,tickLength:5,fontSize:NaN,font:"",fontFamily:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,baselineOffset:0},this._chartModel=t}options(){const t=this._rendererOptions,i=this._fontSize(),s=this._fontFamily();return t.fontSize===i&&t.fontFamily===s||(t.fontSize=i,t.fontFamily=s,t.font=T(i,s),t.paddingTop=2.5/12*i,t.paddingBottom=t.paddingTop,t.paddingInner=i/12*t.tickLength,t.paddingOuter=i/12*t.tickLength,t.baselineOffset=0),t.color=this._textColor(),t.paneBackgroundColor=this._paneBackgroundColor(),this._rendererOptions}_textColor(){return this._chartModel.options().layout.textColor}_paneBackgroundColor(){return this._chartModel.backgroundTopColor()}_fontSize(){return this._chartModel.options().layout.fontSize}_fontFamily(){return this._chartModel.options().layout.fontFamily}}class D{constructor(){this._renderers=[]}setRenderers(t){this._renderers=t}draw(t,i,s){this._renderers.forEach((e=>{e.draw(t,i,s)}))}}class A{draw(t,i,s){t.useMediaCoordinateSpace((t=>this._drawImpl(t,i,s)))}drawBackground(t,i,s){t.useMediaCoordinateSpace((t=>this._drawBackgroundImpl(t,i,s)))}_drawBackgroundImpl(t,i,s){}}class E extends A{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}_drawImpl({context:t}){if(null===this._data||null===this._data.visibleRange)return;const i=this._data.visibleRange,s=this._data,e=e=>{t.beginPath();for(let h=i.to-1;h>=i.from;--h){const i=s.items[h];t.moveTo(i.x,i.y),t.arc(i.x,i.y,e,0,2*Math.PI)}t.fill()};s.lineWidth>0&&(t.fillStyle=s.backColor,e(s.radius+s.lineWidth)),t.fillStyle=s.lineColor,e(s.radius)}}function O(){return{items:[{x:0,y:0,time:0,price:0}],lineColor:"",backColor:"",radius:0,lineWidth:0,visibleRange:null}}const B={from:0,to:1};class L{constructor(t,i){this._compositeRenderer=new D,this._markersRenderers=[],this._markersData=[],this._invalidated=!0,this._chartModel=t,this._crosshair=i,this._compositeRenderer.setRenderers(this._markersRenderers)}update(t){const i=this._chartModel.serieses();i.length!==this._markersRenderers.length&&(this._markersData=i.map(O),this._markersRenderers=this._markersData.map((t=>{const i=new E;return i.setData(t),i})),this._compositeRenderer.setRenderers(this._markersRenderers)),this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._compositeRenderer}_updateImpl(){const t=this._chartModel.serieses(),i=this._crosshair.appliedIndex(),s=this._chartModel.timeScale();t.forEach(((t,e)=>{var h;const n=this._markersData[e],o=t.markerDataAtIndex(i);if(null===o||!t.visible())return void(n.visibleRange=null);const l=r(t.firstValue());n.lineColor=o.backgroundColor,n.radius=o.radius,n.lineWidth=o.borderWidth,n.items[0].price=o.price,n.items[0].y=t.priceScale().priceToCoordinate(o.price,l.value),n.backColor=null!==(h=o.borderColor)&&void 0!==h?h:this._chartModel.backgroundColorAtYPercentFromTop(n.items[0].y/t.priceScale().height()),n.items[0].time=i,n.items[0].x=s.indexToCoordinate(i),n.visibleRange=B}))}}class z{draw(t,i,s){t.useBitmapCoordinateSpace((t=>this._drawImpl(t,i,s)))}}class I extends z{constructor(t){super(),this._data=t}_drawImpl({context:t,bitmapSize:i,horizontalPixelRatio:h,verticalPixelRatio:n}){if(null===this._data)return;const r=this._data.vertLine.visible,o=this._data.horzLine.visible;if(!r&&!o)return;const l=Math.round(this._data.x*h),a=Math.round(this._data.y*n);t.lineCap="butt",r&&l>=0&&(t.lineWidth=Math.floor(this._data.vertLine.lineWidth*h),t.strokeStyle=this._data.vertLine.color,t.fillStyle=this._data.vertLine.color,s(t,this._data.vertLine.lineStyle),function(t,i,s,e){t.beginPath();const h=t.lineWidth%2?.5:0;t.moveTo(i+h,s),t.lineTo(i+h,e),t.stroke()}(t,l,0,i.height)),o&&a>=0&&(t.lineWidth=Math.floor(this._data.horzLine.lineWidth*n),t.strokeStyle=this._data.horzLine.color,t.fillStyle=this._data.horzLine.color,s(t,this._data.horzLine.lineStyle),e(t,a,0,i.width))}}class N{constructor(t){this._invalidated=!0,this._rendererData={vertLine:{lineWidth:1,lineStyle:0,color:"",visible:!1},horzLine:{lineWidth:1,lineStyle:0,color:"",visible:!1},x:0,y:0},this._renderer=new I(this._rendererData),this._source=t}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){const t=this._source.visible(),i=r(this._source.pane()),s=i.model().options().crosshair,e=this._rendererData;e.horzLine.visible=t&&this._source.horzLineVisible(i),e.vertLine.visible=t&&this._source.vertLineVisible(),e.horzLine.lineWidth=s.horzLine.width,e.horzLine.lineStyle=s.horzLine.style,e.horzLine.color=s.horzLine.color,e.vertLine.lineWidth=s.vertLine.width,e.vertLine.lineStyle=s.vertLine.style,e.vertLine.color=s.vertLine.color,e.x=this._source.appliedX(),e.y=this._source.appliedY()}}function V(t,i,s,e,h,n){t.fillRect(i+n,s,e-2*n,n),t.fillRect(i+n,s+h-n,e-2*n,n),t.fillRect(i,s,n,h),t.fillRect(i+e-n,s,n,h)}function F(t,i,s,e,h,n){t.save(),t.globalCompositeOperation="copy",t.fillStyle=n,t.fillRect(i,s,e,h),t.restore()}function W(t,i){return Array.isArray(t)?t.map((t=>0===t?t:t+i)):t+i}function j(t,i,s,e,h,n){let r,o,l,a;if(Array.isArray(n))if(2===n.length){const t=Math.max(0,n[0]),i=Math.max(0,n[1]);r=t,o=t,l=i,a=i}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");r=Math.max(0,n[0]),o=Math.max(0,n[1]),l=Math.max(0,n[2]),a=Math.max(0,n[3])}else{const t=Math.max(0,n);r=t,o=t,l=t,a=t}t.beginPath(),t.moveTo(i+r,s),t.lineTo(i+e-o,s),0!==o&&t.arcTo(i+e,s,i+e,s+o,o),t.lineTo(i+e,s+h-l),0!==l&&t.arcTo(i+e,s+h,i+e-l,s+h,l),t.lineTo(i+a,s+h),0!==a&&t.arcTo(i,s+h,i,s+h-a,a),t.lineTo(i,s+r),0!==r&&t.arcTo(i,s,i+r,s,r)}function H(t,i,s,e,h,n,r=0,o=0,l=""){if(t.save(),!r||!l||l===n)return j(t,i,s,e,h,o),t.fillStyle=n,t.fill(),void t.restore();const a=r/2;if("transparent"!==n){j(t,i+r,s+r,e-2*r,h-2*r,W(o,-r)),t.fillStyle=n,t.fill()}if("transparent"!==l){j(t,i+a,s+a,e-r,h-r,W(o,-a)),t.lineWidth=r,t.strokeStyle=l,t.closePath(),t.stroke()}t.restore()}function $(t,i,s,e,h,n,r){t.save(),t.globalCompositeOperation="copy";const o=t.createLinearGradient(0,0,0,h);o.addColorStop(0,n),o.addColorStop(1,r),t.fillStyle=o,t.fillRect(i,s,e,h),t.restore()}class U{constructor(t,i){this.setData(t,i)}setData(t,i){this._data=t,this._commonData=i}height(t,i){return this._data.visible?t.fontSize+t.paddingTop+t.paddingBottom:0}draw(t,i,s,e){if(!this._data.visible||0===this._data.text.length)return;const h=this._data.color,n=this._commonData.background,r=t.useBitmapCoordinateSpace((t=>{const r=t.context;r.font=i.font;const o=this._calculateGeometry(t,i,s,e),l=o.bitmap,a=(t,i)=>{o.alignRight?H(r,l.xOutside,l.yTop,l.totalWidth,l.totalHeight,t,l.horzBorder,[l.radius,0,0,l.radius],i):H(r,l.xInside,l.yTop,l.totalWidth,l.totalHeight,t,l.horzBorder,[0,l.radius,l.radius,0],i)};return a(n,"transparent"),this._data.tickVisible&&(r.fillStyle=h,r.fillRect(l.xInside,l.yMid,l.xTick-l.xInside,l.tickHeight)),a("transparent",n),this._data.borderVisible&&(r.fillStyle=i.paneBackgroundColor,r.fillRect(o.alignRight?l.right-l.horzBorder:0,l.yTop,l.horzBorder,l.yBottom-l.yTop)),o}));t.useMediaCoordinateSpace((({context:t})=>{const s=r.media;t.font=i.font,t.textAlign=r.alignRight?"right":"left",t.textBaseline="middle",t.fillStyle=h,t.fillText(this._data.text,s.xText,(s.yTop+s.yBottom)/2+s.textMidCorrection)}))}_calculateGeometry(t,i,s,e){var h;const{context:n,bitmapSize:r,mediaSize:o,horizontalPixelRatio:l,verticalPixelRatio:a}=t,u=this._data.tickVisible||!this._data.moveTextToInvisibleTick?i.tickLength:0,c=this._data.separatorVisible?i.borderSize:0,d=i.paddingTop+this._commonData.additionalPaddingTop,f=i.paddingBottom+this._commonData.additionalPaddingBottom,p=i.paddingInner,m=i.paddingOuter,v=this._data.text,b=i.fontSize,g=s.yMidCorrection(n,v),w=Math.ceil(s.measureText(n,v)),M=b+d+f,S=i.borderSize+p+m+w+u,x=Math.max(1,Math.floor(a));let _=Math.round(M*a);_%2!=x%2&&(_+=1);const y=c>0?Math.max(1,Math.floor(c*l)):0,k=Math.round(S*l),C=Math.round(u*l),T=null!==(h=this._commonData.fixedCoordinate)&&void 0!==h?h:this._commonData.coordinate,P=Math.round(T*a)-Math.floor(.5*a),R=Math.floor(P+x/2-_/2),D=R+_,A="right"===e,E=A?o.width-c:c,O=A?r.width-y:y;let B,L,z;return A?(B=O-k,L=O-C,z=E-u-p-c):(B=O+k,L=O+C,z=E+u+p),{alignRight:A,bitmap:{yTop:R,yMid:P,yBottom:D,totalWidth:k,totalHeight:_,radius:2*l,horzBorder:y,xOutside:B,xInside:O,xTick:L,tickHeight:x,right:r.width},media:{yTop:R/a,yBottom:D/a,xText:z,textMidCorrection:g}}}}class q{constructor(t){this._commonRendererData={coordinate:0,background:"#000",additionalPaddingBottom:0,additionalPaddingTop:0},this._axisRendererData={text:"",visible:!1,tickVisible:!0,moveTextToInvisibleTick:!1,borderColor:"",color:"#FFF",borderVisible:!1,separatorVisible:!1},this._paneRendererData={text:"",visible:!1,tickVisible:!1,moveTextToInvisibleTick:!0,borderColor:"",color:"#FFF",borderVisible:!0,separatorVisible:!0},this._invalidated=!0,this._axisRenderer=new(t||U)(this._axisRendererData,this._commonRendererData),this._paneRenderer=new(t||U)(this._paneRendererData,this._commonRendererData)}text(){return this._updateRendererDataIfNeeded(),this._axisRendererData.text}coordinate(){return this._updateRendererDataIfNeeded(),this._commonRendererData.coordinate}update(){this._invalidated=!0}height(t,i=!1){return Math.max(this._axisRenderer.height(t,i),this._paneRenderer.height(t,i))}getFixedCoordinate(){return this._commonRendererData.fixedCoordinate||0}setFixedCoordinate(t){this._commonRendererData.fixedCoordinate=t}isVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible||this._paneRendererData.visible}isAxisLabelVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible}renderer(t){return this._updateRendererDataIfNeeded(),this._axisRendererData.tickVisible=this._axisRendererData.tickVisible&&t.options().ticksVisible,this._paneRendererData.tickVisible=this._paneRendererData.tickVisible&&t.options().ticksVisible,this._axisRenderer.setData(this._axisRendererData,this._commonRendererData),this._paneRenderer.setData(this._paneRendererData,this._commonRendererData),this._axisRenderer}paneRenderer(){return this._updateRendererDataIfNeeded(),this._axisRenderer.setData(this._axisRendererData,this._commonRendererData),this._paneRenderer.setData(this._paneRendererData,this._commonRendererData),this._paneRenderer}_updateRendererDataIfNeeded(){this._invalidated&&(this._axisRendererData.tickVisible=!0,this._paneRendererData.tickVisible=!1,this._updateRendererData(this._axisRendererData,this._paneRendererData,this._commonRendererData))}}class Y extends q{constructor(t,i,s){super(),this._source=t,this._priceScale=i,this._valueProvider=s}_updateRendererData(t,i,s){t.visible=!1;const e=this._source.options().horzLine;if(!e.labelVisible)return;const h=this._priceScale.firstValue();if(!this._source.visible()||this._priceScale.isEmpty()||null===h)return;const n=v(e.labelBackgroundColor);s.background=n.background,t.color=n.foreground;const r=2/12*this._priceScale.fontSize();s.additionalPaddingTop=r,s.additionalPaddingBottom=r;const o=this._valueProvider(this._priceScale);s.coordinate=o.coordinate,t.text=this._priceScale.formatPrice(o.price,h),t.visible=!0}}const X=/[1-9]/g;class Z{constructor(){this._data=null}setData(t){this._data=t}draw(t,i){if(null===this._data||!1===this._data.visible||0===this._data.text.length)return;const s=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.font,Math.round(i.widthCache.measureText(t,r(this._data).text,X)))));if(s<=0)return;const e=i.paddingHorizontal,h=s+2*e,n=h/2,o=this._data.width;let l=this._data.coordinate,a=Math.floor(l-n)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-n)+.5):a+h>o&&(l-=Math.abs(o-(a+h)),a=Math.floor(l-n)+.5);const u=a+h,c=Math.ceil(0+i.borderSize+i.tickLength+i.paddingTop+i.fontSize+i.paddingBottom);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:s,verticalPixelRatio:e})=>{const h=r(this._data);t.fillStyle=h.background;const n=Math.round(a*s),o=Math.round(0*e),l=Math.round(u*s),d=Math.round(c*e),f=Math.round(2*s);if(t.beginPath(),t.moveTo(n,o),t.lineTo(n,d-f),t.arcTo(n,d,n+f,d,f),t.lineTo(l-f,d),t.arcTo(l,d,l,d-f,f),t.lineTo(l,o),t.fill(),h.tickVisible){const n=Math.round(h.coordinate*s),r=o,l=Math.round((r+i.tickLength)*e);t.fillStyle=h.color;const a=Math.max(1,Math.floor(s)),u=Math.floor(.5*s);t.fillRect(n-u,r,a,l-r)}})),t.useMediaCoordinateSpace((({context:t})=>{const s=r(this._data),h=0+i.borderSize+i.tickLength+i.paddingTop+i.fontSize/2;t.font=i.font,t.textAlign="left",t.textBaseline="middle",t.fillStyle=s.color;const n=i.widthCache.yMidCorrection(t,"Apr0");t.translate(a+e,h+n),t.fillText(s.text,0,0)}))}}class K{constructor(t,i,s){this._invalidated=!0,this._renderer=new Z,this._rendererData={visible:!1,background:"#4c525e",color:"white",text:"",width:0,coordinate:NaN,tickVisible:!0},this._crosshair=t,this._model=i,this._valueProvider=s}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer.setData(this._rendererData),this._renderer}_updateImpl(){const t=this._rendererData;t.visible=!1;const i=this._crosshair.options().vertLine;if(!i.labelVisible)return;const s=this._model.timeScale();if(s.isEmpty())return;t.width=s.width();const e=this._valueProvider();if(null===e)return;t.coordinate=e.coordinate;const h=s.indexToTimeScalePoint(this._crosshair.appliedIndex());t.text=s.formatDateTime(r(h)),t.visible=!0;const n=v(i.labelBackgroundColor);t.background=n.background,t.color=n.foreground,t.tickVisible=s.options().ticksVisible}}class G{constructor(){this._priceScale=null,this._zorder=0}zorder(){return this._zorder}setZorder(t){this._zorder=t}priceScale(){return this._priceScale}setPriceScale(t){this._priceScale=t}labelPaneViews(t){return[]}timeAxisViews(){return[]}visible(){return!0}}var J,Q,tt,it;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet"}(J||(J={}));class st extends G{constructor(t,i){super(),this._pane=null,this._price=NaN,this._index=0,this._visible=!0,this._priceAxisViews=new Map,this._subscribed=!1,this._x=NaN,this._y=NaN,this._originX=NaN,this._originY=NaN,this._model=t,this._options=i,this._markersPaneView=new L(t,this);this._currentPosPriceProvider=((t,i)=>s=>{const e=i(),h=t();if(s===r(this._pane).defaultPriceScale())return{price:h,coordinate:e};{const t=r(s.firstValue());return{price:s.coordinateToPrice(e,t),coordinate:e}}})((()=>this._price),(()=>this._y));const s=((t,i)=>()=>{const s=this._model.timeScale().indexToTime(t()),e=i();return s&&Number.isFinite(e)?{time:s,coordinate:e}:null})((()=>this._index),(()=>this.appliedX()));this._timeAxisView=new K(this,t,s),this._paneView=new N(this)}options(){return this._options}saveOriginCoord(t,i){this._originX=t,this._originY=i}clearOriginCoord(){this._originX=NaN,this._originY=NaN}originCoordX(){return this._originX}originCoordY(){return this._originY}setPosition(t,i,s){this._subscribed||(this._subscribed=!0),this._visible=!0,this._tryToUpdateViews(t,i,s)}appliedIndex(){return this._index}appliedX(){return this._x}appliedY(){return this._y}visible(){return this._visible}clearPosition(){this._visible=!1,this._setIndexToLastSeriesBarIndex(),this._price=NaN,this._x=NaN,this._y=NaN,this._pane=null,this.clearOriginCoord()}paneViews(t){return null!==this._pane?[this._paneView,this._markersPaneView]:[]}horzLineVisible(t){return t===this._pane&&this._options.horzLine.visible}vertLineVisible(){return this._options.vertLine.visible}priceAxisViews(t,i){this._visible&&this._pane===t||this._priceAxisViews.clear();const s=[];return this._pane===t&&s.push(this._createPriceAxisViewOnDemand(this._priceAxisViews,i,this._currentPosPriceProvider)),s}timeAxisViews(){return this._visible?[this._timeAxisView]:[]}pane(){return this._pane}updateAllViews(){this._paneView.update(),this._priceAxisViews.forEach((t=>t.update())),this._timeAxisView.update(),this._markersPaneView.update()}_priceScaleByPane(t){return t&&!t.defaultPriceScale().isEmpty()?t.defaultPriceScale():null}_tryToUpdateViews(t,i,s){this._tryToUpdateData(t,i,s)&&this.updateAllViews()}_tryToUpdateData(t,i,s){const e=this._x,h=this._y,n=this._price,r=this._index,o=this._pane,l=this._priceScaleByPane(s);this._index=t,this._x=isNaN(t)?NaN:this._model.timeScale().indexToCoordinate(t),this._pane=s;const a=null!==l?l.firstValue():null;return null!==l&&null!==a?(this._price=i,this._y=l.priceToCoordinate(i,a)):(this._price=NaN,this._y=NaN),e!==this._x||h!==this._y||r!==this._index||n!==this._price||o!==this._pane}_setIndexToLastSeriesBarIndex(){const t=this._model.serieses().map((t=>t.bars().lastIndex())).filter(y),i=0===t.length?null:Math.max(...t);this._index=null!==i?i:NaN}_createPriceAxisViewOnDemand(t,i,s){let e=t.get(i);return void 0===e&&(e=new Y(this,i,s),t.set(i,e)),e}}function et(t){return"left"===t||"right"===t}!function(t){t.Left="left",t.Right="right"}(Q||(Q={})),function(t){t[t.None=0]="None",t[t.Cursor=1]="Cursor",t[t.Light=2]="Light",t[t.Full=3]="Full"}(tt||(tt={})),function(t){t[t.FitContent=0]="FitContent",t[t.ApplyRange=1]="ApplyRange",t[t.ApplyBarSpacing=2]="ApplyBarSpacing",t[t.ApplyRightOffset=3]="ApplyRightOffset",t[t.Reset=4]="Reset",t[t.Animation=5]="Animation",t[t.StopAnimation=6]="StopAnimation"}(it||(it={}));class ht{constructor(t){this._invalidatedPanes=new Map,this._timeScaleInvalidations=[],this._globalLevel=t}invalidatePane(t,i){const s=function(t,i){return void 0===t?i:{level:Math.max(t.level,i.level),autoScale:t.autoScale||i.autoScale}}(this._invalidatedPanes.get(t),i);this._invalidatedPanes.set(t,s)}fullInvalidation(){return this._globalLevel}invalidateForPane(t){const i=this._invalidatedPanes.get(t);return void 0===i?{level:this._globalLevel}:{level:Math.max(this._globalLevel,i.level),autoScale:i.autoScale}}setFitContent(){this.stopTimeScaleAnimation(),this._timeScaleInvalidations=[{type:0}]}applyRange(t){this.stopTimeScaleAnimation(),this._timeScaleInvalidations=[{type:1,value:t}]}setTimeScaleAnimation(t){this._removeTimeScaleAnimation(),this._timeScaleInvalidations.push({type:5,value:t})}stopTimeScaleAnimation(){this._removeTimeScaleAnimation(),this._timeScaleInvalidations.push({type:6})}resetTimeScale(){this.stopTimeScaleAnimation(),this._timeScaleInvalidations=[{type:4}]}setBarSpacing(t){this.stopTimeScaleAnimation(),this._timeScaleInvalidations.push({type:2,value:t})}setRightOffset(t){this.stopTimeScaleAnimation(),this._timeScaleInvalidations.push({type:3,value:t})}timeScaleInvalidations(){return this._timeScaleInvalidations}merge(t){for(const i of t._timeScaleInvalidations)this._applyTimeScaleInvalidation(i);this._globalLevel=Math.max(this._globalLevel,t._globalLevel),t._invalidatedPanes.forEach(((t,i)=>{this.invalidatePane(i,t)}))}static light(){return new ht(2)}static full(){return new ht(3)}_applyTimeScaleInvalidation(t){switch(t.type){case 0:this.setFitContent();break;case 1:this.applyRange(t.value);break;case 2:this.setBarSpacing(t.value);break;case 3:this.setRightOffset(t.value);break;case 4:this.resetTimeScale();break;case 5:this.setTimeScaleAnimation(t.value);break;case 6:this._removeTimeScaleAnimation()}}_removeTimeScaleAnimation(){const t=this._timeScaleInvalidations.findIndex((t=>5===t.type));-1!==t&&this._timeScaleInvalidations.splice(t,1)}}const nt=".";function rt(t,i){if(!w(t))return"n/a";if(!M(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return("0000000000000000"+t.toString()).slice(-i)}class ot{constructor(t,i){if(i||(i=1),w(t)&&M(t)||(t=100),t<0)throw new TypeError("invalid base");this._priceScale=t,this._minMove=i,this._calculateDecimal()}format(t){const i=t<0?"−":"";return t=Math.abs(t),i+this._formatAsDecimal(t)}_calculateDecimal(){if(this._fractionalLength=0,this._priceScale>0&&this._minMove>0){let t=this._priceScale;for(;t>1;)t/=10,this._fractionalLength++}}_formatAsDecimal(t){const i=this._priceScale/this._minMove;let s=Math.floor(t),e="";const h=void 0!==this._fractionalLength?this._fractionalLength:NaN;if(i>1){let n=+(Math.round(t*i)-s*i).toFixed(this._fractionalLength);n>=i&&(n-=i,s+=1),e=nt+rt(+n.toFixed(this._fractionalLength)*this._minMove,h)}else s=Math.round(s*i)/i,h>0&&(e=nt+rt(0,h));return s.toFixed(0)+e}}class lt extends ot{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class at{constructor(t){this._precision=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this._formatNumber(t):t<999995?i+this._formatNumber(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this._formatNumber(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this._formatNumber(t/1e9)+"B")}_formatNumber(t){let i;const s=Math.pow(10,this._precision);return i=(t=Math.round(t*s)/s)>=1e-15&&t<1?t.toFixed(this._precision).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function ut(t,i,s,e,h,n,r){if(0===i.length||e.from>=i.length||e.to<=0)return;const o=t.context,l=i[e.from];let a=n(t,l),u=l;if(e.to-e.from<2){const t=h/2;o.beginPath();const i={x:l.x-t,y:l.y},s={x:l.x+t,y:l.y};return o.moveTo(i.x,i.y),o.lineTo(s.x,s.y),void r(o,a,i,s)}const c=(t,i)=>{r(o,a,u,i),o.beginPath(),a=t,u=i};let d=u;o.beginPath(),o.moveTo(l.x,l.y);for(let h=e.from+1;h>1,r=e+h;s(t[r],i)?(e=r+1,n-=h+1):n=h}return e}function xt(t,i,s,e=0,h=t.length){let n=h-e;for(;0>1,r=e+h;s(i,t[r])?n=h:(e=r+1,n-=h+1)}return e}var _t,yt;function kt(t,i){return t.time0&&n=e&&(o=n-1),r>0&&rObject.assign(Object.assign({},t),this._series.barColorer().barStyle(t.time))))}_clearVisibleRange(){this._itemsVisibleRange=null}_makeValid(){this._dataInvalidated&&(this._fillRawPoints(),this._dataInvalidated=!1),this._optionsInvalidated&&(this._updateOptions(),this._optionsInvalidated=!1),this._invalidated&&(this._makeValidImpl(),this._invalidated=!1)}_makeValidImpl(){const t=this._series.priceScale(),i=this._model.timeScale();if(this._clearVisibleRange(),i.isEmpty()||t.isEmpty())return;const s=i.visibleStrictRange();if(null===s)return;if(0===this._series.bars().size())return;const e=this._series.firstValue();null!==e&&(this._itemsVisibleRange=Tt(this._items,s,this._extendedVisibleRange),this._convertToCoordinates(t,i,e.value),this._prepareRendererData())}}class Rt extends Pt{constructor(t,i){super(t,i,!0)}_convertToCoordinates(t,i,s){i.indexesToCoordinates(this._items,k(this._itemsVisibleRange)),t.pointsArrayToCoordinates(this._items,s,k(this._itemsVisibleRange))}_createRawItemBase(t,i){return{time:t,price:i,x:NaN,y:NaN}}_fillRawPoints(){const t=this._series.barColorer();this._items=this._series.bars().rows().map((i=>{const s=i.value[3];return this._createRawItem(i.index,s,t)}))}}class Dt extends Rt{constructor(t,i){super(t,i),this._renderer=new D,this._areaRenderer=new bt,this._lineRenderer=new Mt,this._renderer.setRenderers([this._areaRenderer,this._lineRenderer])}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options();this._areaRenderer.setData({lineType:t.lineType,items:this._items,lineStyle:t.lineStyle,lineWidth:t.lineWidth,baseLevelCoordinate:null,invertFilledArea:t.invertFilledArea,visibleRange:this._itemsVisibleRange,barWidth:this._model.timeScale().barSpacing()}),this._lineRenderer.setData({lineType:t.lineType,items:this._items,lineStyle:t.lineStyle,lineWidth:t.lineWidth,visibleRange:this._itemsVisibleRange,barWidth:this._model.timeScale().barSpacing()})}}class At extends z{constructor(){super(...arguments),this._data=null,this._barWidth=0,this._barLineWidth=0}setData(t){this._data=t}_drawImpl({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this._data||0===this._data.bars.length||null===this._data.visibleRange)return;if(this._barWidth=this._calcBarWidth(i),this._barWidth>=2){Math.max(1,Math.floor(i))%2!=this._barWidth%2&&this._barWidth--}this._barLineWidth=this._data.thinBars?Math.min(this._barWidth,Math.floor(i)):this._barWidth;let e=null;const h=this._barLineWidth<=this._barWidth&&this._data.barSpacing>=Math.floor(1.5*i);for(let n=this._data.visibleRange.from;np+v-1&&(h=p+v-1,e=h-u+1),t.fillRect(i,e,a-i,h-e+1)}const i=l+b;let e=Math.max(p,Math.round(r.closeY*s)-o),h=e+u-1;h>p+v-1&&(h=p+v-1,e=h-u+1),t.fillRect(c+1,e,i-c,h-e+1)}}}_calcBarWidth(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(r(this._data).barSpacing,t)))}}class Et extends Pt{constructor(t,i){super(t,i,!1)}_convertToCoordinates(t,i,s){i.indexesToCoordinates(this._items,k(this._itemsVisibleRange)),t.barPricesToCoordinates(this._items,s,k(this._itemsVisibleRange))}_createDefaultItem(t,i,s){return{time:t,open:i.value[0],high:i.value[1],low:i.value[2],close:i.value[3],x:NaN,openY:NaN,highY:NaN,lowY:NaN,closeY:NaN}}_fillRawPoints(){const t=this._series.barColorer();this._items=this._series.bars().rows().map((i=>this._createRawItem(i.index,i,t)))}}class Ot extends Et{constructor(){super(...arguments),this._renderer=new At}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createDefaultItem(t,i,s)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options();this._renderer.setData({bars:this._items,barSpacing:this._model.timeScale().barSpacing(),openVisible:t.openVisible,thinBars:t.thinBars,visibleRange:this._itemsVisibleRange})}}function Bt(t,i,s){return Math.min(Math.max(t,i),s)}function Lt(t,i,s){return i-t<=s}function zt(t){return t<=0?NaN:Math.log(t)/Math.log(10)}function It(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Nt extends vt{constructor(){super(...arguments),this._fillCache=null}_fillStyle(t,i){var s;const{context:e,mediaSize:h}=t,n=this._data,{topFillColor1:r,topFillColor2:o,bottomFillColor1:l,bottomFillColor2:a}=i,u=null!==(s=n.baseLevelCoordinate)&&void 0!==s?s:h.height,c=h.height;if(null!==this._fillCache&&this._fillCache.topFillColor1===r&&this._fillCache.topFillColor2===o&&this._fillCache.bottomFillColor1===l&&this._fillCache.bottomFillColor2===a&&this._fillCache.baseLevelCoordinate===u&&this._fillCache.bottom===c)return this._fillCache.fillStyle;const d=e.createLinearGradient(0,0,0,c),f=Bt(u/c,0,1);return d.addColorStop(0,r),d.addColorStop(f,o),d.addColorStop(f,l),d.addColorStop(1,a),this._fillCache={topFillColor1:r,topFillColor2:o,bottomFillColor1:l,bottomFillColor2:a,fillStyle:d,baseLevelCoordinate:u,bottom:c},d}}class Vt extends wt{constructor(){super(...arguments),this._strokeCache=null}_strokeStyle(t,i){const{context:s,mediaSize:e}=t,h=this._data,{topLineColor:n,bottomLineColor:r}=i,{baseLevelCoordinate:o}=h,l=e.height;if(null!==this._strokeCache&&this._strokeCache.topLineColor===n&&this._strokeCache.bottomLineColor===r&&this._strokeCache.baseLevelCoordinate===o&&this._strokeCache.bottom===l)return this._strokeCache.strokeStyle;const a=s.createLinearGradient(0,0,0,l),u=Bt(o/l,0,1);return a.addColorStop(0,n),a.addColorStop(u,n),a.addColorStop(u,r),a.addColorStop(1,r),this._strokeCache={topLineColor:n,bottomLineColor:r,strokeStyle:a,baseLevelCoordinate:o,bottom:l},a}}class Ft extends Rt{constructor(t,i){super(t,i),this._renderer=new D,this._baselineAreaRenderer=new Nt,this._baselineLineRenderer=new Vt,this._renderer.setRenderers([this._baselineAreaRenderer,this._baselineLineRenderer])}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t=this._series.firstValue();if(null===t)return;const i=this._series.options(),s=this._series.priceScale().priceToCoordinate(i.baseValue.price,t.value),e=this._model.timeScale().barSpacing();this._baselineAreaRenderer.setData({items:this._items,lineWidth:i.lineWidth,lineStyle:i.lineStyle,lineType:i.lineType,baseLevelCoordinate:s,invertFilledArea:!1,visibleRange:this._itemsVisibleRange,barWidth:e}),this._baselineLineRenderer.setData({items:this._items,lineWidth:i.lineWidth,lineStyle:i.lineStyle,lineType:i.lineType,baseLevelCoordinate:s,visibleRange:this._itemsVisibleRange,barWidth:e})}}!function(t){t[t.BarBorderWidth=1]="BarBorderWidth"}(yt||(yt={}));class Wt extends z{constructor(){super(...arguments),this._data=null,this._barWidth=0}setData(t){this._data=t}_drawImpl(t){if(null===this._data||0===this._data.bars.length||null===this._data.visibleRange)return;const{horizontalPixelRatio:i}=t;if(this._barWidth=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const s=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),e=Math.floor(t*s*i),h=Math.floor(t*i),n=Math.min(e,h);return Math.max(Math.floor(i),n)}(this._data.barSpacing,i),this._barWidth>=2){Math.floor(i)%2!=this._barWidth%2&&this._barWidth--}const s=this._data.bars;this._data.wickVisible&&this._drawWicks(t,s,this._data.visibleRange),this._data.borderVisible&&this._drawBorder(t,s,this._data.visibleRange);const e=this._calculateBorderWidth(i);(!this._data.borderVisible||this._barWidth>2*e)&&this._drawCandles(t,s,this._data.visibleRange)}_drawWicks(t,i,s){if(null===this._data)return;const{context:e,horizontalPixelRatio:h,verticalPixelRatio:n}=t;let r="",o=Math.min(Math.floor(h),Math.floor(this._data.barSpacing*h));o=Math.max(Math.floor(h),Math.min(o,this._barWidth));const l=Math.floor(.5*o);let a=null;for(let t=s.from;t2*o)V(e,a,c,u-a+1,d-c+1,o);else{const t=u-a+1;e.fillRect(a,c,t,d-c+1)}l=u}}_drawCandles(t,i,s){if(null===this._data)return;const{context:e,horizontalPixelRatio:h,verticalPixelRatio:n}=t;let r="";const o=this._calculateBorderWidth(h);for(let t=s.from;ta||e.fillRect(u,l,c-u+1,a-l+1)}}}class jt extends Et{constructor(){super(...arguments),this._renderer=new Wt}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createDefaultItem(t,i,s)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options();this._renderer.setData({bars:this._items,barSpacing:this._model.timeScale().barSpacing(),wickVisible:t.wickVisible,borderVisible:t.borderVisible,visibleRange:this._itemsVisibleRange})}}class Ht extends z{constructor(){super(...arguments),this._data=null,this._precalculatedCache=[]}setData(t){this._data=t,this._precalculatedCache=[]}_drawImpl({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this._data||0===this._data.items.length||null===this._data.visibleRange)return;this._precalculatedCache.length||this._fillPrecalculatedCache(i);const e=Math.max(1,Math.floor(s)),h=Math.round(this._data.histogramBase*s)-Math.floor(e/2),n=h+e;for(let i=this._data.visibleRange.from;ie.center?e.right=s.left-i-1:s.left=e.right+i+1))}let e=Math.ceil(this._data.barSpacing*t);for(let t=this._data.visibleRange.from;t0&&e<4)for(let t=this._data.visibleRange.from;te&&(i.roundedCenter>i.center?i.right-=1:i.left+=1)}}}class $t extends Rt{constructor(){super(...arguments),this._renderer=new Ht}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t={items:this._items,barSpacing:this._model.timeScale().barSpacing(),visibleRange:this._itemsVisibleRange,histogramBase:this._series.priceScale().priceToCoordinate(this._series.options().base,r(this._series.firstValue()).value)};this._renderer.setData(t)}}class Ut extends Rt{constructor(){super(...arguments),this._renderer=new Mt}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options(),i={items:this._items,lineStyle:t.lineStyle,lineType:t.lineType,lineWidth:t.lineWidth,visibleRange:this._itemsVisibleRange,barWidth:this._model.timeScale().barSpacing()};this._renderer.setData(i)}}const qt=/[2-9]/g;class Yt{constructor(t=50){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels={},this._cache=new Map,this._maxSize=t}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}measureText(t,i,s){return this._getMetrics(t,i,s).width}yMidCorrection(t,i,s){const e=this._getMetrics(t,i,s);return((e.actualBoundingBoxAscent||0)-(e.actualBoundingBoxDescent||0))/2}_getMetrics(t,i,s){const e=s||qt,h=String(i).replace(e,"0");if(this._cache.has(h))return n(this._cache.get(h)).metrics;if(this._actualSize===this._maxSize){const t=this._tick2Labels[this._oldestTick];delete this._tick2Labels[this._oldestTick],this._cache.delete(t),this._oldestTick++,this._actualSize--}t.save(),t.textBaseline="middle";const r=t.measureText(h);return t.restore(),0===r.width&&i.length||(this._cache.set(h,{metrics:r,tick:this._usageTick}),this._tick2Labels[this._usageTick]=h,this._actualSize++,this._usageTick++),r}}class Xt{constructor(t){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._textWidthCache=t}setParams(t,i,s){this._priceAxisViewRenderer=t,this._rendererOptions=i,this._align=s}draw(t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(t,this._rendererOptions,this._textWidthCache,this._align)}}class Zt{constructor(t,i,s){this._priceAxisView=t,this._textWidthCache=new Yt(50),this._dataSource=i,this._chartModel=s,this._fontSize=-1,this._renderer=new Xt(this._textWidthCache)}renderer(){const t=this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=t.isOverlay(this._dataSource)?t.defaultVisiblePriceScale():this._dataSource.priceScale();if(null===i)return null;const s=t.priceScalePosition(i);if("overlay"===s)return null;const e=this._chartModel.priceAxisRendererOptions();return e.fontSize!==this._fontSize&&(this._fontSize=e.fontSize,this._textWidthCache.reset()),this._renderer.setParams(this._priceAxisView.paneRenderer(),e,s),this._renderer}}var Kt,Gt;!function(t){t[t.HitTestThreshold=7]="HitTestThreshold"}(Kt||(Kt={}));class Jt extends z{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}hitTest(t,i){var s;if(!(null===(s=this._data)||void 0===s?void 0:s.visible))return null;const{y:e,lineWidth:h,externalId:n}=this._data;return i>=e-h-7&&i<=e+h+7?{hitTestData:this._data,externalId:n}:null}_drawImpl({context:t,bitmapSize:i,horizontalPixelRatio:h,verticalPixelRatio:n}){if(null===this._data)return;if(!1===this._data.visible)return;const r=Math.round(this._data.y*n);r<0||r>i.height||(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.floor(this._data.lineWidth*h),s(t,this._data.lineStyle),e(t,r,0,i.width))}}class Qt{constructor(t){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",lineWidth:1,lineStyle:0,visible:!1},this._lineRenderer=new Jt,this._invalidated=!0,this._series=t,this._model=t.model(),this._lineRenderer.setData(this._lineRendererData)}update(){this._invalidated=!0}renderer(){return this._series.visible()?(this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._lineRenderer):null}}class ti extends Qt{constructor(t){super(t)}_updateImpl(){this._lineRendererData.visible=!1;const t=this._series.priceScale(),i=t.mode().mode;if(2!==i&&3!==i)return;const s=this._series.options();if(!s.baseLineVisible||!this._series.visible())return;const e=this._series.firstValue();null!==e&&(this._lineRendererData.visible=!0,this._lineRendererData.y=t.priceToCoordinate(e.value,e.value),this._lineRendererData.color=s.baseLineColor,this._lineRendererData.lineWidth=s.baseLineWidth,this._lineRendererData.lineStyle=s.baseLineStyle)}}class ii extends z{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}data(){return this._data}_drawImpl({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){const e=this._data;if(null===e)return;const h=Math.max(1,Math.floor(i)),n=h%2/2,r=Math.round(e.center.x*i)+n,o=e.center.y*s;t.fillStyle=e.seriesLineColor,t.beginPath();const l=Math.max(2,1.5*e.seriesLineWidth)*i;t.arc(r,o,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=e.fillColor,t.beginPath(),t.arc(r,o,e.radius*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=h,t.strokeStyle=e.strokeColor,t.beginPath(),t.arc(r,o,e.radius*i+h/2,0,2*Math.PI,!1),t.stroke()}}!function(t){t[t.AnimationPeriod=2600]="AnimationPeriod",t[t.Stage1Period=.25]="Stage1Period",t[t.Stage2Period=.275]="Stage2Period",t[t.Stage3Period=.475]="Stage3Period",t[t.Stage1StartCircleRadius=4]="Stage1StartCircleRadius",t[t.Stage1EndCircleRadius=10]="Stage1EndCircleRadius",t[t.Stage1StartFillAlpha=.25]="Stage1StartFillAlpha",t[t.Stage1EndFillAlpha=0]="Stage1EndFillAlpha",t[t.Stage1StartStrokeAlpha=.4]="Stage1StartStrokeAlpha",t[t.Stage1EndStrokeAlpha=.8]="Stage1EndStrokeAlpha",t[t.Stage2StartCircleRadius=10]="Stage2StartCircleRadius",t[t.Stage2EndCircleRadius=14]="Stage2EndCircleRadius",t[t.Stage2StartFillAlpha=0]="Stage2StartFillAlpha",t[t.Stage2EndFillAlpha=0]="Stage2EndFillAlpha",t[t.Stage2StartStrokeAlpha=.8]="Stage2StartStrokeAlpha",t[t.Stage2EndStrokeAlpha=0]="Stage2EndStrokeAlpha",t[t.Stage3StartCircleRadius=14]="Stage3StartCircleRadius",t[t.Stage3EndCircleRadius=14]="Stage3EndCircleRadius",t[t.Stage3StartFillAlpha=0]="Stage3StartFillAlpha",t[t.Stage3EndFillAlpha=0]="Stage3EndFillAlpha",t[t.Stage3StartStrokeAlpha=0]="Stage3StartStrokeAlpha",t[t.Stage3EndStrokeAlpha=0]="Stage3EndStrokeAlpha"}(Gt||(Gt={}));const si=[{start:0,end:.25,startRadius:4,endRadius:10,startFillAlpha:.25,endFillAlpha:0,startStrokeAlpha:.4,endStrokeAlpha:.8},{start:.25,end:.525,startRadius:10,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:.8,endStrokeAlpha:0},{start:.525,end:1,startRadius:14,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:0,endStrokeAlpha:0}];function ei(t,i,s,e){return function(t,i){if("transparent"===t)return t;const s=m(t),e=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${i*e})`}(t,s+(e-s)*i)}function hi(t,i){const s=t%2600/2600;let e;for(const t of si)if(s>=t.start&&s<=t.end){e=t;break}h(void 0!==e,"Last price animation internal logic error");const n=(s-e.start)/(e.end-e.start);return{fillColor:ei(i,n,e.startFillAlpha,e.endFillAlpha),strokeColor:ei(i,n,e.startStrokeAlpha,e.endStrokeAlpha),radius:(r=n,o=e.startRadius,l=e.endRadius,o+(l-o)*r)};var r,o,l}class ni{constructor(t){this._renderer=new ii,this._invalidated=!0,this._stageInvalidated=!0,this._startTime=performance.now(),this._endTime=this._startTime-1,this._series=t}onDataCleared(){this._endTime=this._startTime-1,this.update()}onNewRealtimeDataReceived(){if(this.update(),2===this._series.options().lastPriceAnimation){const t=performance.now(),i=this._endTime-t;if(i>0)return void(i<650&&(this._endTime+=2600));this._startTime=t,this._endTime=t+2600}}update(){this._invalidated=!0}invalidateStage(){this._stageInvalidated=!0}visible(){return 0!==this._series.options().lastPriceAnimation}animationActive(){switch(this._series.options().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this._endTime}}renderer(){return this._invalidated?(this._updateImpl(),this._invalidated=!1,this._stageInvalidated=!1):this._stageInvalidated&&(this._updateRendererDataStage(),this._stageInvalidated=!1),this._renderer}_updateImpl(){this._renderer.setData(null);const t=this._series.model().timeScale(),i=t.visibleStrictRange(),s=this._series.firstValue();if(null===i||null===s)return;const e=this._series.lastValueData(!0);if(e.noData||!i.contains(e.index))return;const h={x:t.indexToCoordinate(e.index),y:this._series.priceScale().priceToCoordinate(e.price,s.value)},n=e.color,r=this._series.options().lineWidth,o=hi(this._duration(),n);this._renderer.setData({seriesLineColor:n,seriesLineWidth:r,fillColor:o.fillColor,strokeColor:o.strokeColor,radius:o.radius,center:h})}_updateRendererDataStage(){const t=this._renderer.data();if(null!==t){const i=hi(this._duration(),t.seriesLineColor);t.fillColor=i.fillColor,t.strokeColor=i.strokeColor,t.radius=i.radius}}_duration(){return this.animationActive()?performance.now()-this._startTime:2599}}var ri,oi;function li(t,i){return It(Math.min(Math.max(t,12),30)*i)}function ai(t,i){switch(t){case"arrowDown":case"arrowUp":return li(i,1);case"circle":return li(i,.8);case"square":return li(i,.7)}}function ui(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(li(t,1))}function ci(t){return Math.max(li(t,.1),3)}function di(t,i,s,e,h){const n=ai("square",s),r=(n-1)/2,o=t-r,l=i-r;return e>=o&&e<=o+n&&h>=l&&h<=l+n}function fi(t,i,s,e,h){const n=(ai("arrowUp",h)-1)/2,r=(It(h/2)-1)/2;i.beginPath(),t?(i.moveTo(s-n,e),i.lineTo(s,e-n),i.lineTo(s+n,e),i.lineTo(s+r,e),i.lineTo(s+r,e+n),i.lineTo(s-r,e+n),i.lineTo(s-r,e)):(i.moveTo(s-n,e),i.lineTo(s,e+n),i.lineTo(s+n,e),i.lineTo(s+r,e),i.lineTo(s+r,e-n),i.lineTo(s-r,e-n),i.lineTo(s-r,e)),i.fill()}function pi(t,i,s,e,h,n){return di(i,s,e,h,n)}!function(t){t[t.MinShapeSize=12]="MinShapeSize",t[t.MaxShapeSize=30]="MaxShapeSize",t[t.MinShapeMargin=3]="MinShapeMargin"}(ri||(ri={}));class mi extends A{constructor(){super(...arguments),this._data=null,this._textWidthCache=new Yt,this._fontSize=-1,this._fontFamily="",this._font=""}setData(t){this._data=t}setParams(t,i){this._fontSize===t&&this._fontFamily===i||(this._fontSize=t,this._fontFamily=i,this._font=T(t,i),this._textWidthCache.reset())}hitTest(t,i){if(null===this._data||null===this._data.visibleRange)return null;for(let s=this._data.visibleRange.from;s=t&&h<=t+s&&n>=i-r&&n<=i+r}(t.text.x,t.text.y,t.text.width,t.text.height,i,s))||function(t,i,s){if(0===t.size)return!1;switch(t.shape){case"arrowDown":case"arrowUp":return pi(0,t.x,t.y,t.size,i,s);case"circle":return function(t,i,s,e,h){const n=2+ai("circle",s)/2,r=t-e,o=i-h;return Math.sqrt(r*r+o*o)<=n}(t.x,t.y,t.size,i,s);case"square":return di(t.x,t.y,t.size,i,s)}}(t,i,s)}function gi(t,i,s,e,h,n,r,o,l){const a=w(s)?s:s.close,u=w(s)?s:s.high,c=w(s)?s:s.low,d=w(i.size)?Math.max(i.size,0):1,f=ui(o.barSpacing())*d,p=f/2;switch(t.size=f,i.position){case"inBar":return t.y=r.priceToCoordinate(a,l),void(void 0!==t.text&&(t.text.y=t.y+p+n+.6*h));case"aboveBar":return t.y=r.priceToCoordinate(u,l)-p-e.aboveBar,void 0!==t.text&&(t.text.y=t.y-p-.6*h,e.aboveBar+=1.2*h),void(e.aboveBar+=f+n);case"belowBar":return t.y=r.priceToCoordinate(c,l)+p+e.belowBar,void 0!==t.text&&(t.text.y=t.y+p+n+.6*h,e.belowBar+=1.2*h),void(e.belowBar+=f+n)}i.position}!function(t){t[t.TextMargin=.1]="TextMargin"}(oi||(oi={}));class wi{constructor(t,i){this._invalidated=!0,this._dataInvalidated=!0,this._autoScaleMarginsInvalidated=!0,this._autoScaleMargins=null,this._renderer=new mi,this._series=t,this._model=i,this._data={items:[],visibleRange:null}}update(t){this._invalidated=!0,this._autoScaleMarginsInvalidated=!0,"data"===t&&(this._dataInvalidated=!0)}renderer(t){if(!this._series.visible())return null;this._invalidated&&this._makeValid();const i=this._model.options().layout;return this._renderer.setParams(i.fontSize,i.fontFamily),this._renderer.setData(this._data),this._renderer}autoScaleMargins(){if(this._autoScaleMarginsInvalidated){if(this._series.indexedMarkers().length>0){const t=this._model.timeScale().barSpacing(),i=ci(t),s=1.5*ui(t)+2*i;this._autoScaleMargins={above:s,below:s}}else this._autoScaleMargins=null;this._autoScaleMarginsInvalidated=!1}return this._autoScaleMargins}_makeValid(){const t=this._series.priceScale(),i=this._model.timeScale(),s=this._series.indexedMarkers();this._dataInvalidated&&(this._data.items=s.map((t=>({time:t.time,x:0,y:0,size:0,shape:t.shape,color:t.color,internalId:t.internalId,externalId:t.id,text:void 0}))),this._dataInvalidated=!1);const e=this._model.options().layout;this._data.visibleRange=null;const h=i.visibleStrictRange();if(null===h)return;const n=this._series.firstValue();if(null===n)return;if(0===this._data.items.length)return;let r=NaN;const o=ci(i.barSpacing()),l={aboveBar:o,belowBar:o};this._data.visibleRange=Tt(this._data.items,h,!0);for(let h=this._data.visibleRange.from;h0&&(u.text={content:a.text,x:0,y:0,width:0,height:0});const c=this._series.dataAt(a.time);null!==c&&gi(u,a,c,l,e.fontSize,o,t,i,n.value)}this._invalidated=!1}}class Mi extends Qt{constructor(t){super(t)}_updateImpl(){const t=this._lineRendererData;t.visible=!1;const i=this._series.options();if(!i.priceLineVisible||!this._series.visible())return;const s=this._series.lastValueData(0===i.priceLineSource);s.noData||(t.visible=!0,t.y=s.coordinate,t.color=this._series.priceLineColor(s.color),t.lineWidth=i.priceLineWidth,t.lineStyle=i.priceLineStyle)}}class Si extends q{constructor(t){super(),this._source=t}_updateRendererData(t,i,s){t.visible=!1,i.visible=!1;const e=this._source;if(!e.visible())return;const h=e.options(),n=h.lastValueVisible,r=""!==e.title(),o=0===h.seriesLastValueMode,l=e.lastValueData(!1);if(l.noData)return;n&&(t.text=this._axisText(l,n,o),t.visible=0!==t.text.length),(r||o)&&(i.text=this._paneText(l,n,r,o),i.visible=i.text.length>0);const a=e.priceLineColor(l.color),u=v(a);s.background=u.background,s.coordinate=l.coordinate,i.borderColor=e.model().backgroundColorAtYPercentFromTop(l.coordinate/e.priceScale().height()),t.borderColor=a,t.color=u.foreground,i.color=u.foreground}_paneText(t,i,s,e){let h="";const n=this._source.title();return s&&0!==n.length&&(h+=`${n} `),i&&e&&(h+=this._source.priceScale().isPercentage()?t.formattedPriceAbsolute:t.formattedPricePercentage),h.trim()}_axisText(t,i,s){return i?s?this._source.priceScale().isPercentage()?t.formattedPricePercentage:t.formattedPriceAbsolute:t.text:""}}class xi{constructor(t,i){this._minValue=t,this._maxValue=i}equals(t){return null!==t&&(this._minValue===t._minValue&&this._maxValue===t._maxValue)}clone(){return new xi(this._minValue,this._maxValue)}minValue(){return this._minValue}maxValue(){return this._maxValue}length(){return this._maxValue-this._minValue}isEmpty(){return this._maxValue===this._minValue||Number.isNaN(this._maxValue)||Number.isNaN(this._minValue)}merge(t){return null===t?this:new xi(Math.min(this.minValue(),t.minValue()),Math.max(this.maxValue(),t.maxValue()))}scaleAroundCenter(t){if(!w(t))return;if(0===this._maxValue-this._minValue)return;const i=.5*(this._maxValue+this._minValue);let s=this._maxValue-i,e=this._minValue-i;s*=t,e*=t,this._maxValue=i+s,this._minValue=i+e}shift(t){w(t)&&(this._maxValue+=t,this._minValue+=t)}toRaw(){return{minValue:this._minValue,maxValue:this._maxValue}}static fromRaw(t){return null===t?null:new xi(t.minValue,t.maxValue)}}class _i{constructor(t,i){this._priceRange=t,this._margins=i||null}priceRange(){return this._priceRange}margins(){return this._margins}toRaw(){return null===this._priceRange?null:{priceRange:this._priceRange.toRaw(),margins:this._margins||void 0}}static fromRaw(t){return null===t?null:new _i(xi.fromRaw(t.priceRange),t.margins)}}class yi extends Qt{constructor(t,i){super(t),this._priceLine=i}_updateImpl(){const t=this._lineRendererData;t.visible=!1;const i=this._priceLine.options();if(!this._series.visible()||!i.lineVisible)return;const s=this._priceLine.yCoord();null!==s&&(t.visible=!0,t.y=s,t.color=i.color,t.lineWidth=i.lineWidth,t.lineStyle=i.lineStyle,t.externalId=this._priceLine.options().id)}}class ki extends q{constructor(t,i){super(),this._series=t,this._priceLine=i}_updateRendererData(t,i,s){t.visible=!1,i.visible=!1;const e=this._priceLine.options(),h=e.axisLabelVisible,n=""!==e.title,r=this._series;if(!h||!r.visible())return;const o=this._priceLine.yCoord();if(null===o)return;n&&(i.text=e.title,i.visible=!0),i.borderColor=r.model().backgroundColorAtYPercentFromTop(o/r.priceScale().height()),t.text=this._formatPrice(e.price),t.visible=!0;const l=v(e.axisLabelColor||e.color);s.background=l.background;const a=e.axisLabelTextColor||l.foreground;t.color=a,i.color=a,s.coordinate=o}_formatPrice(t){const i=this._series.firstValue();return null===i?"":this._series.priceScale().formatPrice(t,i.value)}}class Ci{constructor(t,i){this._series=t,this._options=i,this._priceLineView=new yi(t,this),this._priceAxisView=new ki(t,this),this._panePriceAxisView=new Zt(this._priceAxisView,t,t.model())}applyOptions(t){g(this._options,t),this.update(),this._series.model().lightUpdate()}options(){return this._options}paneView(){return this._priceLineView}labelPaneView(){return this._panePriceAxisView}priceAxisView(){return this._priceAxisView}update(){this._priceLineView.update(),this._priceAxisView.update()}yCoord(){const t=this._series,i=t.priceScale();if(t.model().timeScale().isEmpty()||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.priceToCoordinate(this._options.price,s.value)}}class Ti extends G{constructor(t){super(),this._model=t}model(){return this._model}}const Pi={Bar:(t,i,s,e)=>{var h;const n=i.upColor,l=i.downColor,a=r(t(s,e)),u=o(a.value[0])<=o(a.value[3]);return{barColor:null!==(h=a.color)&&void 0!==h?h:u?n:l}},Candlestick:(t,i,s,e)=>{var h,n,l;const a=i.upColor,u=i.downColor,c=i.borderUpColor,d=i.borderDownColor,f=i.wickUpColor,p=i.wickDownColor,m=r(t(s,e)),v=o(m.value[0])<=o(m.value[3]);return{barColor:null!==(h=m.color)&&void 0!==h?h:v?a:u,barBorderColor:null!==(n=m.borderColor)&&void 0!==n?n:v?c:d,barWickColor:null!==(l=m.wickColor)&&void 0!==l?l:v?f:p}},Area:(t,i,s,e)=>{var h,n,o,l;const a=r(t(s,e));return{barColor:null!==(h=a.lineColor)&&void 0!==h?h:i.lineColor,lineColor:null!==(n=a.lineColor)&&void 0!==n?n:i.lineColor,topColor:null!==(o=a.topColor)&&void 0!==o?o:i.topColor,bottomColor:null!==(l=a.bottomColor)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,s,e)=>{var h,n,o,l,a,u;const c=r(t(s,e));return{barColor:c.value[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,topLineColor:null!==(h=c.topLineColor)&&void 0!==h?h:i.topLineColor,bottomLineColor:null!==(n=c.bottomLineColor)&&void 0!==n?n:i.bottomLineColor,topFillColor1:null!==(o=c.topFillColor1)&&void 0!==o?o:i.topFillColor1,topFillColor2:null!==(l=c.topFillColor2)&&void 0!==l?l:i.topFillColor2,bottomFillColor1:null!==(a=c.bottomFillColor1)&&void 0!==a?a:i.bottomFillColor1,bottomFillColor2:null!==(u=c.bottomFillColor2)&&void 0!==u?u:i.bottomFillColor2}},Line:(t,i,s,e)=>{var h,n;const o=r(t(s,e));return{barColor:null!==(h=o.color)&&void 0!==h?h:i.color,lineColor:null!==(n=o.color)&&void 0!==n?n:i.color}},Histogram:(t,i,s,e)=>{var h;return{barColor:null!==(h=r(t(s,e)).color)&&void 0!==h?h:i.color}}};class Ri{constructor(t){this._findBar=(t,i)=>void 0!==i?i.value:this._series.bars().valueAt(t),this._series=t,this._styleGetter=Pi[t.seriesType()]}barStyle(t,i){return this._styleGetter(this._findBar,this._series.options(),t,i)}}var Di;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(Di||(Di={}));const Ai=30;class Ei{constructor(){this._items=[],this._minMaxCache=new Map,this._rowSearchCache=new Map}last(){return this.size()>0?this._items[this._items.length-1]:null}firstIndex(){return this.size()>0?this._indexAt(0):null}lastIndex(){return this.size()>0?this._indexAt(this._items.length-1):null}size(){return this._items.length}isEmpty(){return 0===this.size()}contains(t){return null!==this._search(t,0)}valueAt(t){return this.search(t)}search(t,i=0){const s=this._search(t,i);return null===s?null:Object.assign(Object.assign({},this._valueAt(s)),{index:this._indexAt(s)})}rows(){return this._items}minMaxOnRangeCached(t,i,s){if(this.isEmpty())return null;let e=null;for(const h of s){e=Oi(e,this._minMaxOnRangeCachedImpl(t,i,h))}return e}setData(t){this._rowSearchCache.clear(),this._minMaxCache.clear(),this._items=t}_indexAt(t){return this._items[t].index}_valueAt(t){return this._items[t]}_search(t,i){const s=this._bsearch(t);if(null===s&&0!==i)switch(i){case-1:return this._searchNearestLeft(t);case 1:return this._searchNearestRight(t);default:throw new TypeError("Unknown search mode")}return s}_searchNearestLeft(t){let i=this._lowerbound(t);return i>0&&(i-=1),i!==this._items.length&&this._indexAt(i)t.indexi.index>t))}_plotMinMax(t,i,s){let e=null;for(let h=t;he.max&&(e.max=t)))}return e}_minMaxOnRangeCachedImpl(t,i,s){if(this.isEmpty())return null;let e=null;const h=r(this.firstIndex()),n=r(this.lastIndex()),o=Math.max(t,h),l=Math.min(i,n),a=Math.ceil(o/Ai)*Ai,u=Math.max(a,Math.floor(l/Ai)*Ai);{const t=this._lowerbound(o),h=this._upperbound(Math.min(l,a,i));e=Oi(e,this._plotMinMax(t,h,s))}let c=this._minMaxCache.get(s);void 0===c&&(c=new Map,this._minMaxCache.set(s,c));for(let t=Math.max(a+1,o);t{this._animationTimeoutId=null,this.model().cursorUpdate()}),0)),i.invalidateStage(),[i]):[]}paneViews(){const t=[];this._isOverlay()||t.push(this._baseHorizontalLineView),t.push(this._paneView,this._priceLineView,this._markersPaneView);const i=this._customPriceLines.map((t=>t.paneView()));return t.push(...i),t}labelPaneViews(t){return[this._panePriceAxisView,...this._customPriceLines.map((t=>t.labelPaneView()))]}priceAxisViews(t,i){if(i!==this._priceScale&&!this._isOverlay())return[];const s=[...this._priceAxisViews];for(const t of this._customPriceLines)s.push(t.priceAxisView());return s}autoscaleInfo(t,i){if(void 0!==this._options.autoscaleInfoProvider){const s=this._options.autoscaleInfoProvider((()=>{const s=this._autoscaleInfoImpl(t,i);return null===s?null:s.toRaw()}));return _i.fromRaw(s)}return this._autoscaleInfoImpl(t,i)}minMove(){return this._options.priceFormat.minMove}formatter(){return this._formatter}updateAllViews(){var t;this._paneView.update(),this._markersPaneView.update();for(const t of this._priceAxisViews)t.update();for(const t of this._customPriceLines)t.update();this._priceLineView.update(),this._baseHorizontalLineView.update(),null===(t=this._lastPriceAnimationPaneView)||void 0===t||t.update()}priceScale(){return r(super.priceScale())}markerDataAtIndex(t){if(!(("Line"===this._seriesType||"Area"===this._seriesType||"Baseline"===this._seriesType)&&this._options.crosshairMarkerVisible))return null;const i=this._data.valueAt(t);if(null===i)return null;return{price:i.value[3],radius:this._markerRadius(),borderColor:this._markerBorderColor(),borderWidth:this._markerBorderWidth(),backgroundColor:this._markerBackgroundColor(t)}}title(){return this._options.title}visible(){return this._options.visible}_isOverlay(){return!et(this.priceScale().id())}_autoscaleInfoImpl(t,i){if(!M(t)||!M(i)||this._data.isEmpty())return null;const s="Line"===this._seriesType||"Area"===this._seriesType||"Baseline"===this._seriesType||"Histogram"===this._seriesType?[3]:[2,1],e=this._data.minMaxOnRangeCached(t,i,s);let h=null!==e?new xi(e.min,e.max):null;if("Histogram"===this.seriesType()){const t=this._options.base,i=new xi(t,t);h=null!==h?h.merge(i):i}return new _i(h,this._markersPaneView.autoScaleMargins())}_markerRadius(){switch(this._seriesType){case"Line":case"Area":case"Baseline":return this._options.crosshairMarkerRadius}return 0}_markerBorderColor(){switch(this._seriesType){case"Line":case"Area":case"Baseline":{const t=this._options.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}_markerBorderWidth(){switch(this._seriesType){case"Line":case"Area":case"Baseline":return this._options.crosshairMarkerBorderWidth}return 0}_markerBackgroundColor(t){switch(this._seriesType){case"Line":case"Area":case"Baseline":{const t=this._options.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.barColorer().barStyle(t).barColor}_recreateFormatter(){switch(this._options.priceFormat.type){case"custom":this._formatter={format:this._options.priceFormat.formatter};break;case"volume":this._formatter=new at(this._options.priceFormat.precision);break;case"percent":this._formatter=new lt(this._options.priceFormat.precision);break;default:{const t=Math.pow(10,this._options.priceFormat.precision);this._formatter=new ot(t,this._options.priceFormat.minMove*t)}}null!==this._priceScale&&this._priceScale.updateFormatter()}_recalculateMarkers(){const t=this.model().timeScale();if(!t.hasPoints()||this._data.isEmpty())return void(this._indexedMarkers=[]);const i=r(this._data.firstIndex());this._indexedMarkers=this._markers.map(((s,e)=>{const h=r(t.timeToIndex(s.time,!0)),n=ht instanceof Bi)).reduce(((t,e)=>{if(s.isOverlay(e)||!e.visible())return t;const h=e.priceScale(),n=e.bars();if(h.isEmpty()||!n.contains(i))return t;const r=n.valueAt(i);if(null===r)return t;const l=o(e.firstValue());return t.concat([h.priceToCoordinate(r.value[3],l.value)])}),[]);if(0===l.length)return e;l.sort(((t,i)=>Math.abs(t-r)-Math.abs(i-r)));const a=l[0];return e=h.coordinateToPrice(a,n),e}}class zi extends z{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}_drawImpl({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:h}){if(null===this._data)return;const n=Math.max(1,Math.floor(e));t.lineWidth=n,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,(()=>{const o=r(this._data);if(o.vertLinesVisible){t.strokeStyle=o.vertLinesColor,s(t,o.vertLineStyle),t.beginPath();for(const s of o.timeMarks){const h=Math.round(s.coord*e);t.moveTo(h,-n),t.lineTo(h,i.height+n)}t.stroke()}if(o.horzLinesVisible){t.strokeStyle=o.horzLinesColor,s(t,o.horzLineStyle),t.beginPath();for(const s of o.priceMarks){const e=Math.round(s.coord*h);t.moveTo(-n,e),t.lineTo(i.width+n,e)}t.stroke()}}))}}class Ii{constructor(t){this._renderer=new zi,this._invalidated=!0,this._pane=t}update(){this._invalidated=!0}renderer(){if(this._invalidated){const t=this._pane.model().options().grid,i={horzLinesVisible:t.horzLines.visible,vertLinesVisible:t.vertLines.visible,horzLinesColor:t.horzLines.color,vertLinesColor:t.vertLines.color,horzLineStyle:t.horzLines.style,vertLineStyle:t.vertLines.style,priceMarks:this._pane.defaultPriceScale().marks(),timeMarks:this._pane.model().timeScale().marks()||[]};this._renderer.setData(i),this._invalidated=!1}return this._renderer}}class Ni{constructor(t){this._paneView=new Ii(t)}paneView(){return this._paneView}}const Vi={logicalOffset:4,coordOffset:1e-4};function Fi(t,i){const s=100*(t-i)/i;return i<0?-s:s}function Wi(t,i){const s=Fi(t.minValue(),i),e=Fi(t.maxValue(),i);return new xi(s,e)}function ji(t,i){const s=100*(t-i)/i+100;return i<0?-s:s}function Hi(t,i){const s=ji(t.minValue(),i),e=ji(t.maxValue(),i);return new xi(s,e)}function $i(t,i){const s=Math.abs(t);if(s<1e-15)return 0;const e=zt(s+i.coordOffset)+i.logicalOffset;return t<0?-e:e}function Ui(t,i){const s=Math.abs(t);if(s<1e-15)return 0;const e=Math.pow(10,s-i.logicalOffset)-i.coordOffset;return t<0?-e:e}function qi(t,i){if(null===t)return null;const s=$i(t.minValue(),i),e=$i(t.maxValue(),i);return new xi(s,e)}function Yi(t,i){if(null===t)return null;const s=Ui(t.minValue(),i),e=Ui(t.maxValue(),i);return new xi(s,e)}function Xi(t){if(null===t)return Vi;const i=Math.abs(t.maxValue()-t.minValue());if(i>=1||i<1e-15)return Vi;const s=Math.ceil(Math.abs(Math.log10(i))),e=Vi.logicalOffset+s;return{logicalOffset:e,coordOffset:1/Math.pow(10,e)}}var Zi;!function(t){t[t.TickSpanEpsilon=1e-14]="TickSpanEpsilon"}(Zi||(Zi={}));class Ki{constructor(t,i){if(this._base=t,this._integralDividers=i,function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this._base))this._fractionalDividers=[2,2.5,2];else{this._fractionalDividers=[];for(let t=this._base;1!==t;){if(t%2==0)this._fractionalDividers.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this._fractionalDividers.push(2,2.5),t/=5}if(this._fractionalDividers.length>100)throw new Error("something wrong with base")}}}tickSpan(t,i,s){const e=0===this._base?0:1/this._base;let h=Math.pow(10,Math.max(0,Math.ceil(zt(t-i)))),n=0,r=this._integralDividers[0];for(;;){const t=Lt(h,e,1e-14)&&h>e+1e-14,i=Lt(h,s*r,1e-14),o=Lt(h,1,1e-14);if(!(t&&i&&o))break;h/=r,r=this._integralDividers[++n%this._integralDividers.length]}if(h<=e+1e-14&&(h=e),h=Math.max(1,h),this._fractionalDividers.length>0&&(o=h,l=1,a=1e-14,Math.abs(o-l)e+1e-14;)h/=r,r=this._fractionalDividers[++n%this._fractionalDividers.length];var o,l,a;return h}}class Gi{constructor(t,i,s,e){this._marks=[],this._priceScale=t,this._base=i,this._coordinateToLogicalFunc=s,this._logicalToCoordinateFunc=e}tickSpan(t,i){if(t=a?1:-1;let f=null,p=0;for(let s=l-c;s>a;s-=u){const e=this._logicalToCoordinateFunc(s,i,!0);null!==f&&Math.abs(e-f)o||(pr(t.zorder())-r(i.zorder())))}var Qi;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(Qi||(Qi={}));const ts=new lt,is=new ot(100,1);class ss{constructor(t,i,s,e){this._height=0,this._internalHeightCache=null,this._priceRange=null,this._priceRangeSnapshot=null,this._invalidatedForRange={isValid:!1,visibleBars:null},this._marginAbove=0,this._marginBelow=0,this._onMarksChanged=new b,this._modeChanged=new b,this._dataSources=[],this._cachedOrderedSources=null,this._marksCache=null,this._scaleStartPoint=null,this._scrollStartPoint=null,this._formatter=is,this._logFormula=Xi(null),this._id=t,this._options=i,this._layoutOptions=s,this._localizationOptions=e,this._markBuilder=new Gi(this,100,this._coordinateToLogical.bind(this),this._logicalToCoordinate.bind(this))}id(){return this._id}options(){return this._options}applyOptions(t){if(g(this._options,t),this.updateFormatter(),void 0!==t.mode&&this.setMode({mode:t.mode}),void 0!==t.scaleMargins){const i=n(t.scaleMargins.top),s=n(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(s<0||s>1||i+s>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${s}`);if(i+s>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+s}`);this._invalidateInternalHeightCache(),this._marksCache=null}}isAutoScale(){return this._options.autoScale}isLog(){return 1===this._options.mode}isPercentage(){return 2===this._options.mode}isIndexedTo100(){return 3===this._options.mode}mode(){return{autoScale:this._options.autoScale,isInverted:this._options.invertScale,mode:this._options.mode}}setMode(t){const i=this.mode();let s=null;void 0!==t.autoScale&&(this._options.autoScale=t.autoScale),void 0!==t.mode&&(this._options.mode=t.mode,2!==t.mode&&3!==t.mode||(this._options.autoScale=!0),this._invalidatedForRange.isValid=!1),1===i.mode&&t.mode!==i.mode&&(!function(t,i){if(null===t)return!1;const s=Ui(t.minValue(),i),e=Ui(t.maxValue(),i);return isFinite(s)&&isFinite(e)}(this._priceRange,this._logFormula)?this._options.autoScale=!0:(s=Yi(this._priceRange,this._logFormula),null!==s&&this.setPriceRange(s))),1===t.mode&&t.mode!==i.mode&&(s=qi(this._priceRange,this._logFormula),null!==s&&this.setPriceRange(s));const e=i.mode!==this._options.mode;e&&(2===i.mode||this.isPercentage())&&this.updateFormatter(),e&&(3===i.mode||this.isIndexedTo100())&&this.updateFormatter(),void 0!==t.isInverted&&i.isInverted!==t.isInverted&&(this._options.invertScale=t.isInverted,this._onIsInvertedChanged()),this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}fontSize(){return this._layoutOptions.fontSize}height(){return this._height}setHeight(t){this._height!==t&&(this._height=t,this._invalidateInternalHeightCache(),this._marksCache=null)}internalHeight(){if(this._internalHeightCache)return this._internalHeightCache;const t=this.height()-this._topMarginPx()-this._bottomMarginPx();return this._internalHeightCache=t,t}priceRange(){return this._makeSureItIsValid(),this._priceRange}setPriceRange(t,i){const s=this._priceRange;(i||null===s&&null!==t||null!==s&&!s.equals(t))&&(this._marksCache=null,this._priceRange=t)}isEmpty(){return this._makeSureItIsValid(),0===this._height||!this._priceRange||this._priceRange.isEmpty()}invertedCoordinate(t){return this.isInverted()?t:this.height()-1-t}priceToCoordinate(t,i){return this.isPercentage()?t=Fi(t,i):this.isIndexedTo100()&&(t=ji(t,i)),this._logicalToCoordinate(t,i)}pointsArrayToCoordinates(t,i,s){this._makeSureItIsValid();const e=this._bottomMarginPx(),h=r(this.priceRange()),n=h.minValue(),o=h.maxValue(),l=this.internalHeight()-1,a=this.isInverted(),u=l/(o-n),c=void 0===s?0:s.from,d=void 0===s?t.length:s.to,f=this._getCoordinateTransformer();for(let s=c;st.updateAllViews()))}updateFormatter(){this._marksCache=null;const t=this._formatterSource();let i=100;null!==t&&(i=Math.round(1/t.minMove())),this._formatter=is,this.isPercentage()?(this._formatter=ts,i=100):this.isIndexedTo100()?(this._formatter=new ot(100,1),i=100):null!==t&&(this._formatter=t.formatter()),this._markBuilder=new Gi(this,i,this._coordinateToLogical.bind(this),this._logicalToCoordinate.bind(this)),this._markBuilder.rebuildTickMarks()}invalidateSourcesCache(){this._cachedOrderedSources=null}_formatterSource(){return this._dataSources[0]||null}_topMarginPx(){return this.isInverted()?this._options.scaleMargins.bottom*this.height()+this._marginBelow:this._options.scaleMargins.top*this.height()+this._marginAbove}_bottomMarginPx(){return this.isInverted()?this._options.scaleMargins.top*this.height()+this._marginAbove:this._options.scaleMargins.bottom*this.height()+this._marginBelow}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null}_logicalToCoordinate(t,i){if(this._makeSureItIsValid(),this.isEmpty())return 0;t=this.isLog()&&t?$i(t,this._logFormula):t;const s=r(this.priceRange()),e=this._bottomMarginPx()+(this.internalHeight()-1)*(t-s.minValue())/s.length();return this.invertedCoordinate(e)}_coordinateToLogical(t,i){if(this._makeSureItIsValid(),this.isEmpty())return 0;const s=this.invertedCoordinate(t),e=r(this.priceRange()),h=e.minValue()+e.length()*((s-this._bottomMarginPx())/(this.internalHeight()-1));return this.isLog()?Ui(h,this._logFormula):h}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_recalculatePriceRangeImpl(){const t=this._invalidatedForRange.visibleBars;if(null===t)return;let i=null;const s=this.sourcesForAutoScale();let e=0,h=0;for(const n of s){if(!n.visible())continue;const s=n.firstValue();if(null===s)continue;const o=n.autoscaleInfo(t.left(),t.right());let l=o&&o.priceRange();if(null!==l){switch(this._options.mode){case 1:l=qi(l,this._logFormula);break;case 2:l=Wi(l,s.value);break;case 3:l=Hi(l,s.value)}if(i=null===i?l:i.merge(r(l)),null!==o){const t=o.margins();null!==t&&(e=Math.max(e,t.above),h=Math.max(e,t.below))}}}if(e===this._marginAbove&&h===this._marginBelow||(this._marginAbove=e,this._marginBelow=h,this._marksCache=null,this._invalidateInternalHeightCache()),null!==i){if(i.minValue()===i.maxValue()){const t=this._formatterSource(),s=5*(null===t||this.isPercentage()||this.isIndexedTo100()?1:t.minMove());this.isLog()&&(i=Yi(i,this._logFormula)),i=new xi(i.minValue()-s,i.maxValue()+s),this.isLog()&&(i=qi(i,this._logFormula))}if(this.isLog()){const t=Yi(i,this._logFormula),s=Xi(t);if(n=s,o=this._logFormula,n.logicalOffset!==o.logicalOffset||n.coordOffset!==o.coordOffset){const e=null!==this._priceRangeSnapshot?Yi(this._priceRangeSnapshot,this._logFormula):null;this._logFormula=s,i=qi(t,s),null!==e&&(this._priceRangeSnapshot=qi(e,s))}}this.setPriceRange(i)}else null===this._priceRange&&(this.setPriceRange(new xi(-.5,.5)),this._logFormula=Xi(null));var n,o;this._invalidatedForRange.isValid=!0}_getCoordinateTransformer(){return this.isPercentage()?Fi:this.isIndexedTo100()?ji:this.isLog()?t=>$i(t,this._logFormula):null}_formatValue(t,i,s){return void 0===i?(void 0===s&&(s=this.formatter()),s.format(t)):i(t)}_formatPrice(t,i){return this._formatValue(t,this._localizationOptions.priceFormatter,i)}_formatPercentage(t,i){return this._formatValue(t,this._localizationOptions.percentageFormatter,i)}}class es{constructor(t,i){this._dataSources=[],this._overlaySourcesByScaleId=new Map,this._height=0,this._width=0,this._stretchFactor=1e3,this._cachedOrderedSources=null,this._destroyed=new b,this._timeScale=t,this._model=i,this._grid=new Ni(this);const s=i.options();this._leftPriceScale=this._createPriceScale("left",s.leftPriceScale),this._rightPriceScale=this._createPriceScale("right",s.rightPriceScale),this._leftPriceScale.modeChanged().subscribe(this._onPriceScaleModeChanged.bind(this,this._leftPriceScale),this),this._rightPriceScale.modeChanged().subscribe(this._onPriceScaleModeChanged.bind(this,this._rightPriceScale),this),this.applyScaleOptions(s)}applyScaleOptions(t){if(t.leftPriceScale&&this._leftPriceScale.applyOptions(t.leftPriceScale),t.rightPriceScale&&this._rightPriceScale.applyOptions(t.rightPriceScale),t.localization&&(this._leftPriceScale.updateFormatter(),this._rightPriceScale.updateFormatter()),t.overlayPriceScales){const i=Array.from(this._overlaySourcesByScaleId.values());for(const s of i){const i=r(s[0].priceScale());i.applyOptions(t.overlayPriceScales),t.localization&&i.updateFormatter()}}}priceScaleById(t){switch(t){case"left":return this._leftPriceScale;case"right":return this._rightPriceScale}return this._overlaySourcesByScaleId.has(t)?n(this._overlaySourcesByScaleId.get(t))[0].priceScale():null}destroy(){this.model().priceScalesOptionsChanged().unsubscribeAll(this),this._leftPriceScale.modeChanged().unsubscribeAll(this),this._rightPriceScale.modeChanged().unsubscribeAll(this),this._dataSources.forEach((t=>{t.destroy&&t.destroy()})),this._destroyed.fire()}stretchFactor(){return this._stretchFactor}setStretchFactor(t){this._stretchFactor=t}model(){return this._model}width(){return this._width}height(){return this._height}setWidth(t){this._width=t,this.updateAllSources()}setHeight(t){this._height=t,this._leftPriceScale.setHeight(t),this._rightPriceScale.setHeight(t),this._dataSources.forEach((i=>{if(this.isOverlay(i)){const s=i.priceScale();null!==s&&s.setHeight(t)}})),this.updateAllSources()}dataSources(){return this._dataSources}isOverlay(t){const i=t.priceScale();return null===i||this._leftPriceScale!==i&&this._rightPriceScale!==i}addDataSource(t,i,s){const e=void 0!==s?s:this._getZOrderMinMax().maxZOrder+1;this._insertDataSource(t,i,e)}removeDataSource(t){const i=this._dataSources.indexOf(t);h(-1!==i,"removeDataSource: invalid data source"),this._dataSources.splice(i,1);const s=r(t.priceScale()).id();if(this._overlaySourcesByScaleId.has(s)){const i=n(this._overlaySourcesByScaleId.get(s)),e=i.indexOf(t);-1!==e&&(i.splice(e,1),0===i.length&&this._overlaySourcesByScaleId.delete(s))}const e=t.priceScale();e&&e.dataSources().indexOf(t)>=0&&e.removeDataSource(t),null!==e&&(e.invalidateSourcesCache(),this.recalculatePriceScale(e)),this._cachedOrderedSources=null}priceScalePosition(t){return t===this._leftPriceScale?"left":t===this._rightPriceScale?"right":"overlay"}leftPriceScale(){return this._leftPriceScale}rightPriceScale(){return this._rightPriceScale}startScalePrice(t,i){t.startScale(i)}scalePriceTo(t,i){t.scaleTo(i),this.updateAllSources()}endScalePrice(t){t.endScale()}startScrollPrice(t,i){t.startScroll(i)}scrollPriceTo(t,i){t.scrollTo(i),this.updateAllSources()}endScrollPrice(t){t.endScroll()}updateAllSources(){this._dataSources.forEach((t=>{t.updateAllViews()}))}defaultPriceScale(){let t=null;return this._model.options().rightPriceScale.visible&&0!==this._rightPriceScale.dataSources().length?t=this._rightPriceScale:this._model.options().leftPriceScale.visible&&0!==this._leftPriceScale.dataSources().length?t=this._leftPriceScale:0!==this._dataSources.length&&(t=this._dataSources[0].priceScale()),null===t&&(t=this._rightPriceScale),t}defaultVisiblePriceScale(){let t=null;return this._model.options().rightPriceScale.visible?t=this._rightPriceScale:this._model.options().leftPriceScale.visible&&(t=this._leftPriceScale),t}recalculatePriceScale(t){null!==t&&t.isAutoScale()&&this._recalculatePriceScaleImpl(t)}resetPriceScale(t){const i=this._timeScale.visibleStrictRange();t.setMode({autoScale:!0}),null!==i&&t.recalculatePriceRange(i),this.updateAllSources()}momentaryAutoScale(){this._recalculatePriceScaleImpl(this._leftPriceScale),this._recalculatePriceScaleImpl(this._rightPriceScale)}recalculate(){this.recalculatePriceScale(this._leftPriceScale),this.recalculatePriceScale(this._rightPriceScale),this._dataSources.forEach((t=>{this.isOverlay(t)&&this.recalculatePriceScale(t.priceScale())})),this.updateAllSources(),this._model.lightUpdate()}orderedSources(){return null===this._cachedOrderedSources&&(this._cachedOrderedSources=Ji(this._dataSources)),this._cachedOrderedSources}onDestroyed(){return this._destroyed}grid(){return this._grid}_recalculatePriceScaleImpl(t){const i=t.sourcesForAutoScale();if(i&&i.length>0&&!this._timeScale.isEmpty()){const i=this._timeScale.visibleStrictRange();null!==i&&t.recalculatePriceRange(i)}t.updateAllViews()}_getZOrderMinMax(){const t=this.orderedSources();if(0===t.length)return{minZOrder:0,maxZOrder:0};let i=0,s=0;for(let e=0;es&&(s=h))}return{minZOrder:i,maxZOrder:s}}_insertDataSource(t,i,s){let e=this.priceScaleById(i);if(null===e&&(e=this._createPriceScale(i,this._model.options().overlayPriceScales)),this._dataSources.push(t),!et(i)){const s=this._overlaySourcesByScaleId.get(i)||[];s.push(t),this._overlaySourcesByScaleId.set(i,s)}e.addDataSource(t),t.setPriceScale(e),t.setZorder(s),this.recalculatePriceScale(e),this._cachedOrderedSources=null}_onPriceScaleModeChanged(t,i,s){i.mode!==s.mode&&this._recalculatePriceScaleImpl(t)}_createPriceScale(t,i){const s=Object.assign({visible:!0,autoScale:!0},_(i)),e=new ss(t,s,this._model.options().layout,this._model.options().localization);return e.setHeight(this.height()),e}}const hs=t=>t.getUTCFullYear();function ns(t,i,s){return i.replace(/yyyy/g,(t=>rt(hs(t),4))(t)).replace(/yy/g,(t=>rt(hs(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,s)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,s)).replace(/MM/g,(t=>rt((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>rt((t=>t.getUTCDate())(t),2))(t))}class rs{constructor(t="yyyy-MM-dd",i="default"){this._dateFormat=t,this._locale=i}format(t){return ns(t,this._dateFormat,this._locale)}}class os{constructor(t){this._formatStr=t||"%h:%m:%s"}format(t){return this._formatStr.replace("%h",rt(t.getUTCHours(),2)).replace("%m",rt(t.getUTCMinutes(),2)).replace("%s",rt(t.getUTCSeconds(),2))}}const ls={dateFormat:"yyyy-MM-dd",timeFormat:"%h:%m:%s",dateTimeSeparator:" ",locale:"default"};class as{constructor(t={}){const i=Object.assign(Object.assign({},ls),t);this._dateFormatter=new rs(i.dateFormat,i.locale),this._timeFormatter=new os(i.timeFormat),this._separator=i.dateTimeSeparator}format(t){return`${this._dateFormatter.format(t)}${this._separator}${this._timeFormatter.format(t)}`}}class us{constructor(t,i=50){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._cache=new Map,this._tick2Labels=new Map,this._format=t,this._maxSize=i}format(t){const i=t.time,s=void 0===i.businessDay?new Date(1e3*i.timestamp).getTime():new Date(Date.UTC(i.businessDay.year,i.businessDay.month-1,i.businessDay.day)).getTime(),e=this._cache.get(s);if(void 0!==e)return e.string;if(this._actualSize===this._maxSize){const t=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(n(t)),this._oldestTick++,this._actualSize--}const h=this._format(t);return this._cache.set(s,{string:h,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,s),this._actualSize++,this._usageTick++,h}}class cs{constructor(t,i){h(t<=i,"right should be >= left"),this._left=t,this._right=i}left(){return this._left}right(){return this._right}count(){return this._right-this._left+1}contains(t){return this._left<=t&&t<=this._right}equals(t){return this._left===t.left()&&this._right===t.right()}}function ds(t,i){return null===t||null===i?t===i:t.equals(i)}class fs{constructor(){this._marksByWeight=new Map,this._cache=null}setTimeScalePoints(t,i){this._removeMarksSinceIndex(i),this._cache=null;for(let s=i;s{t<=s[0].index?i.push(e):s.splice(St(s,t,(i=>i.indexi-t))){if(!this._marksByWeight.get(s))continue;const e=i;i=[];const h=e.length;let r=0;const o=n(this._marksByWeight.get(s)),l=o.length;let a=1/0,u=-1/0;for(let s=0;s=t&&l-u>=t&&(i.push(n),u=l)}for(;rthis._points[this._points.length-1].time.timestamp)return i?this._points.length-1:null;const s=St(this._points,t.timestamp,((t,i)=>t.time.timestamp0}visibleStrictRange(){return this._updateVisibleRange(),this._visibleRange.strictRange()}visibleLogicalRange(){return this._updateVisibleRange(),this._visibleRange.logicalRange()}visibleTimeRange(){const t=this.visibleStrictRange();if(null===t)return null;const i={from:t.left(),to:t.right()};return this.timeRangeForLogicalRange(i)}timeRangeForLogicalRange(t){const i=Math.round(t.from),s=Math.round(t.to),e=r(this._firstIndex()),h=r(this._lastIndex());return{from:r(this.indexToTime(Math.max(e,i))),to:r(this.indexToTime(Math.min(h,s)))}}logicalRangeForTimeRange(t){return{from:r(this.timeToIndex(t.from,!0)),to:r(this.timeToIndex(t.to,!0))}}width(){return this._width}setWidth(t){if(!isFinite(t)||t<=0)return;if(this._width===t)return;const i=this.visibleLogicalRange(),s=this._width;if(this._width=t,this._visibleRangeInvalidated=!0,this._options.lockVisibleTimeRangeOnResize&&0!==s){const i=this._barSpacing*t/s;this._barSpacing=i}if(this._options.fixLeftEdge&&null!==i&&i.left()<=0){const i=s-t;this._rightOffset-=Math.round(i/this._barSpacing)+1,this._visibleRangeInvalidated=!0}this._correctBarSpacing(),this._correctOffset()}indexToCoordinate(t){if(this.isEmpty()||!M(t))return 0;const i=this.baseIndex()+this._rightOffset-t;return this._width-(i+.5)*this._barSpacing-1}indexesToCoordinates(t,i){const s=this.baseIndex(),e=void 0===i?0:i.from,h=void 0===i?t.length:i.to;for(let i=e;ii/2&&!u?s.needAlignCoordinate=!1:s.needAlignCoordinate=c&&t.index<=l||d&&t.index>=a,f++}return this._labels.length=f,this._timeMarksCache=this._labels,this._labels}restoreDefault(){this._visibleRangeInvalidated=!0,this.setBarSpacing(this._options.barSpacing),this.setRightOffset(this._options.rightOffset)}setBaseIndex(t){this._visibleRangeInvalidated=!0,this._baseIndexOrNull=t,this._correctOffset(),this._doFixLeftEdge()}zoom(t,i){const s=this._coordinateToFloatIndex(t),e=this.barSpacing(),h=e+i*(e/10);this.setBarSpacing(h),this._options.rightBarStaysOnScroll||this.setRightOffset(this.rightOffset()+(s-this._coordinateToFloatIndex(t)))}startScale(t){this._scrollStartPoint&&this.endScroll(),null===this._scaleStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scaleStartPoint=t,this._saveCommonTransitionsStartState()))}scaleTo(t){if(null===this._commonTransitionStartState)return;const i=Bt(this._width-t,0,this._width),s=Bt(this._width-r(this._scaleStartPoint),0,this._width);0!==i&&0!==s&&this.setBarSpacing(this._commonTransitionStartState.barSpacing*i/s)}endScale(){null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._clearCommonTransitionsStartState())}startScroll(t){null===this._scrollStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scrollStartPoint=t,this._saveCommonTransitionsStartState()))}scrollTo(t){if(null===this._scrollStartPoint)return;const i=(this._scrollStartPoint-t)/this.barSpacing();this._rightOffset=r(this._commonTransitionStartState).rightOffset+i,this._visibleRangeInvalidated=!0,this._correctOffset()}endScroll(){null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._clearCommonTransitionsStartState())}scrollToRealTime(){this.scrollToOffsetAnimated(this._options.rightOffset)}scrollToOffsetAnimated(t,i=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const s=this._rightOffset,e=performance.now();this._model.setTimeScaleAnimation({finished:t=>(t-e)/i>=1,getPosition:h=>{const n=(h-e)/i;return n>=1?t:s+(t-s)*n}})}update(t,i){this._visibleRangeInvalidated=!0,this._points=t,this._tickMarks.setTimeScalePoints(t,i),this._correctOffset()}visibleBarsChanged(){return this._visibleBarsChanged}logicalRangeChanged(){return this._logicalRangeChanged}optionsApplied(){return this._optionsApplied}baseIndex(){return this._baseIndexOrNull||0}setVisibleRange(t){const i=t.count();this._setBarSpacing(this._width/i),this._rightOffset=t.right()-this.baseIndex(),this._correctOffset(),this._visibleRangeInvalidated=!0,this._model.recalculateAllPanes(),this._model.lightUpdate()}fitContent(){const t=this._firstIndex(),i=this._lastIndex();null!==t&&null!==i&&this.setVisibleRange(new cs(t,i+this._options.rightOffset))}setLogicalRange(t){const i=new cs(t.from,t.to);this.setVisibleRange(i)}formatDateTime(t){return void 0!==this._localizationOptions.timeFormatter?this._localizationOptions.timeFormatter(t.originalTime):this._dateTimeFormatter.format(new Date(1e3*t.time.timestamp))}_isAllScalingAndScrollingDisabled(){const{handleScroll:t,handleScale:i}=this._model.options();return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}_firstIndex(){return 0===this._points.length?null:0}_lastIndex(){return 0===this._points.length?null:this._points.length-1}_rightOffsetForCoordinate(t){return(this._width-1-t)/this._barSpacing}_coordinateToFloatIndex(t){const i=this._rightOffsetForCoordinate(t),s=this.baseIndex()+this._rightOffset-i;return Math.round(1e6*s)/1e6}_setBarSpacing(t){const i=this._barSpacing;this._barSpacing=t,this._correctBarSpacing(),i!==this._barSpacing&&(this._visibleRangeInvalidated=!0,this._resetTimeMarksCache())}_updateVisibleRange(){if(!this._visibleRangeInvalidated)return;if(this._visibleRangeInvalidated=!1,this.isEmpty())return void this._setVisibleRange(ps.invalid());const t=this.baseIndex(),i=this._width/this._barSpacing,s=this._rightOffset+t,e=new cs(s-i+1,s);this._setVisibleRange(new ps(e))}_correctBarSpacing(){const t=this._minBarSpacing();if(this._barSpacingt&&(this._barSpacing=t,this._visibleRangeInvalidated=!0)}}_minBarSpacing(){return this._options.fixLeftEdge&&this._options.fixRightEdge&&0!==this._points.length?this._width/this._points.length:this._options.minBarSpacing}_correctOffset(){const t=this._maxRightOffset();this._rightOffset>t&&(this._rightOffset=t,this._visibleRangeInvalidated=!0);const i=this._minRightOffset();null!==i&&this._rightOffsetthis._formatLabelImpl(t))),this._formattedByWeight.set(t.weight,i)),i.format(t)}_formatLabelImpl(t){const i=function(t,i,s){switch(t){case 0:case 10:return i?s?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this._options.timeVisible,this._options.secondsVisible);if(void 0!==this._options.tickMarkFormatter){const s=this._options.tickMarkFormatter(t.originalTime,i,this._localizationOptions.locale);if(null!==s)return s}return function(t,i,s){const e={};switch(i){case 0:e.year="numeric";break;case 1:e.month="short";break;case 2:e.day="numeric";break;case 3:e.hour12=!1,e.hour="2-digit",e.minute="2-digit";break;case 4:e.hour12=!1,e.hour="2-digit",e.minute="2-digit",e.second="2-digit"}const h=void 0===t.businessDay?new Date(1e3*t.timestamp):new Date(Date.UTC(t.businessDay.year,t.businessDay.month-1,t.businessDay.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(s,e)}(t.time,i,this._localizationOptions.locale)}_setVisibleRange(t){const i=this._visibleRange;this._visibleRange=t,ds(i.strictRange(),this._visibleRange.strictRange())||this._visibleBarsChanged.fire(),ds(i.logicalRange(),this._visibleRange.logicalRange())||this._logicalRangeChanged.fire(),this._resetTimeMarksCache()}_resetTimeMarksCache(){this._timeMarksCache=null}_invalidateTickMarks(){this._resetTimeMarksCache(),this._formattedByWeight.clear()}_updateDateTimeFormatter(){const t=this._localizationOptions.dateFormat;this._options.timeVisible?this._dateTimeFormatter=new as({dateFormat:t,timeFormat:this._options.secondsVisible?"%h:%m:%s":"%h:%m",dateTimeSeparator:" ",locale:this._localizationOptions.locale}):this._dateTimeFormatter=new rs(t,this._localizationOptions.locale)}_doFixLeftEdge(){if(!this._options.fixLeftEdge)return;const t=this._firstIndex();if(null===t)return;const i=this.visibleStrictRange();if(null===i)return;const s=i.left()-t;if(s<0){const t=this._rightOffset-s-1;this.setRightOffset(t)}this._correctBarSpacing()}_doFixRightEdge(){this._correctOffset(),this._correctBarSpacing()}}class ys extends A{constructor(t){super(),this._metricsCache=new Map,this._data=t}_drawImpl(t){}_drawBackgroundImpl(t){if(!this._data.visible)return;const{context:i,mediaSize:s}=t;let e=0;for(const t of this._data.lines){if(0===t.text.length)continue;i.font=t.font;const h=this._metrics(i,t.text);h>s.width?t.zoom=s.width/h:t.zoom=1,e+=t.lineHeight*t.zoom}let h=0;switch(this._data.vertAlign){case"top":h=0;break;case"center":h=Math.max((s.height-e)/2,0);break;case"bottom":h=Math.max(s.height-e,0)}i.fillStyle=this._data.color;for(const t of this._data.lines){i.save();let e=0;switch(this._data.horzAlign){case"left":i.textAlign="left",e=t.lineHeight/2;break;case"center":i.textAlign="center",e=s.width/2;break;case"right":i.textAlign="right",e=s.width-1-t.lineHeight/2}i.translate(e,h),i.textBaseline="top",i.font=t.font,i.scale(t.zoom,t.zoom),i.fillText(t.text,0,t.vertOffset),i.restore(),h+=t.lineHeight*t.zoom}}_metrics(t,i){const s=this._fontCache(t.font);let e=s.get(i);return void 0===e&&(e=t.measureText(i).width,s.set(i,e)),e}_fontCache(t){let i=this._metricsCache.get(t);return void 0===i&&(i=new Map,this._metricsCache.set(t,i)),i}}class ks{constructor(t){this._invalidated=!0,this._rendererData={visible:!1,color:"",lines:[],vertAlign:"center",horzAlign:"center"},this._renderer=new ys(this._rendererData),this._source=t}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){const t=this._source.options(),i=this._rendererData;i.visible=t.visible,i.visible&&(i.color=t.color,i.horzAlign=t.horzAlign,i.vertAlign=t.vertAlign,i.lines=[{text:t.text,font:T(t.fontSize,t.fontFamily,t.fontStyle),lineHeight:1.2*t.fontSize,vertOffset:0,zoom:0}])}}class Cs extends G{constructor(t,i){super(),this._options=i,this._paneView=new ks(this)}priceAxisViews(){return[]}paneViews(){return[this._paneView]}options(){return this._options}updateAllViews(){this._paneView.update()}}!function(t){t[t.Top=0]="Top",t[t.Bottom=1]="Bottom"}(bs||(bs={})),function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(gs||(gs={}));class Ts{constructor(t,i){this._panes=[],this._serieses=[],this._width=0,this._hoveredSource=null,this._priceScalesOptionsChanged=new b,this._crosshairMoved=new b,this._gradientColorsCache=null,this._invalidateHandler=t,this._options=i,this._rendererOptionsProvider=new R(this),this._timeScale=new _s(this,i.timeScale,this._options.localization),this._crosshair=new st(this,i.crosshair),this._magnet=new Li(i.crosshair),this._watermark=new Cs(this,i.watermark),this.createPane(),this._panes[0].setStretchFactor(2e3),this._backgroundTopColor=this._getBackgroundColor(0),this._backgroundBottomColor=this._getBackgroundColor(1)}fullUpdate(){this._invalidate(ht.full())}lightUpdate(){this._invalidate(ht.light())}cursorUpdate(){this._invalidate(new ht(1))}updateSource(t){const i=this._invalidationMaskForSource(t);this._invalidate(i)}hoveredSource(){return this._hoveredSource}setHoveredSource(t){const i=this._hoveredSource;this._hoveredSource=t,null!==i&&this.updateSource(i.source),null!==t&&this.updateSource(t.source)}options(){return this._options}applyOptions(t){g(this._options,t),this._panes.forEach((i=>i.applyScaleOptions(t))),void 0!==t.timeScale&&this._timeScale.applyOptions(t.timeScale),void 0!==t.localization&&this._timeScale.applyLocalizationOptions(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this._priceScalesOptionsChanged.fire(),this._backgroundTopColor=this._getBackgroundColor(0),this._backgroundBottomColor=this._getBackgroundColor(1),this.fullUpdate()}applyPriceScaleOptions(t,i){if("left"===t)return void this.applyOptions({leftPriceScale:i});if("right"===t)return void this.applyOptions({rightPriceScale:i});const s=this.findPriceScale(t);null!==s&&(s.priceScale.applyOptions(i),this._priceScalesOptionsChanged.fire())}findPriceScale(t){for(const i of this._panes){const s=i.priceScaleById(t);if(null!==s)return{pane:i,priceScale:s}}return null}timeScale(){return this._timeScale}panes(){return this._panes}watermarkSource(){return this._watermark}crosshairSource(){return this._crosshair}crosshairMoved(){return this._crosshairMoved}setPaneHeight(t,i){t.setHeight(i),this.recalculateAllPanes()}setWidth(t){this._width=t,this._timeScale.setWidth(this._width),this._panes.forEach((i=>i.setWidth(t))),this.recalculateAllPanes()}createPane(t){const i=new es(this._timeScale,this);void 0!==t?this._panes.splice(t,0,i):this._panes.push(i);const s=void 0===t?this._panes.length-1:t,e=ht.full();return e.invalidatePane(s,{level:0,autoScale:!0}),this._invalidate(e),i}startScalePrice(t,i,s){t.startScalePrice(i,s)}scalePriceTo(t,i,s){t.scalePriceTo(i,s),this.updateCrosshair(),this._invalidate(this._paneInvalidationMask(t,2))}endScalePrice(t,i){t.endScalePrice(i),this._invalidate(this._paneInvalidationMask(t,2))}startScrollPrice(t,i,s){i.isAutoScale()||t.startScrollPrice(i,s)}scrollPriceTo(t,i,s){i.isAutoScale()||(t.scrollPriceTo(i,s),this.updateCrosshair(),this._invalidate(this._paneInvalidationMask(t,2)))}endScrollPrice(t,i){i.isAutoScale()||(t.endScrollPrice(i),this._invalidate(this._paneInvalidationMask(t,2)))}resetPriceScale(t,i){t.resetPriceScale(i),this._invalidate(this._paneInvalidationMask(t,2))}startScaleTime(t){this._timeScale.startScale(t)}zoomTime(t,i){const s=this.timeScale();if(s.isEmpty()||0===i)return;const e=s.width();t=Math.max(1,Math.min(t,e)),s.zoom(t,i),this.recalculateAllPanes()}scrollChart(t){this.startScrollTime(0),this.scrollTimeTo(t),this.endScrollTime()}scaleTimeTo(t){this._timeScale.scaleTo(t),this.recalculateAllPanes()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate()}startScrollTime(t){this._timeScale.startScroll(t)}scrollTimeTo(t){this._timeScale.scrollTo(t),this.recalculateAllPanes()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate()}serieses(){return this._serieses}setAndSaveCurrentPosition(t,i,s,e){this._crosshair.saveOriginCoord(t,i);let h=NaN,n=this._timeScale.coordinateToIndex(t);const r=this._timeScale.visibleStrictRange();null!==r&&(n=Math.min(Math.max(r.left(),n),r.right()));const o=e.defaultPriceScale(),l=o.firstValue();null!==l&&(h=o.coordinateToPrice(i,l)),h=this._magnet.align(h,n,e),this._crosshair.setPosition(n,h,e),this.cursorUpdate(),this._crosshairMoved.fire(this._crosshair.appliedIndex(),{x:t,y:i},s)}setAndSaveCurrentPositionFire(t,i,s,e){this._crosshair.saveOriginCoord(t,i);let h=NaN,n=this._timeScale.coordinateToIndex(t);const r=this._timeScale.visibleStrictRange();null!==r&&(n=Math.min(Math.max(r.left(),n),r.right()));const o=e.defaultPriceScale(),l=o.firstValue();null!==l&&(h=o.coordinateToPrice(i,l)),h=this._magnet.align(h,n,e),this._crosshair.setPosition(n,h,e),this.cursorUpdate(),s&&this._crosshairMoved.fire(this._crosshair.appliedIndex(),{x:t,y:i},null)}clearCurrentPosition(){this.crosshairSource().clearPosition(),this.cursorUpdate(),this._crosshairMoved.fire(null,null,null)}updateCrosshair(){const t=this._crosshair.pane();if(null!==t){const i=this._crosshair.originCoordX(),s=this._crosshair.originCoordY();this.setAndSaveCurrentPosition(i,s,null,t)}this._crosshair.updateAllViews()}updateTimeScale(t,i,s){const e=this._timeScale.indexToTime(0);void 0!==i&&void 0!==s&&this._timeScale.update(i,s);const h=this._timeScale.indexToTime(0),n=this._timeScale.baseIndex(),r=this._timeScale.visibleStrictRange();if(null!==r&&null!==e&&null!==h){const i=r.contains(n),s=e.timestamp>h.timestamp,o=null!==t&&t>n&&!s,l=i&&this._timeScale.options().shiftVisibleRangeOnNewBar;if(o&&!l){const i=t-n;this._timeScale.setRightOffset(this._timeScale.rightOffset()-i)}}this._timeScale.setBaseIndex(t)}recalculatePane(t){null!==t&&t.recalculate()}paneForSource(t){const i=this._panes.find((i=>i.orderedSources().includes(t)));return void 0===i?null:i}recalculateAllPanes(){this._watermark.updateAllViews(),this._panes.forEach((t=>t.recalculate())),this.updateCrosshair()}destroy(){this._panes.forEach((t=>t.destroy())),this._panes.length=0,this._options.localization.priceFormatter=void 0,this._options.localization.percentageFormatter=void 0,this._options.localization.timeFormatter=void 0}rendererOptionsProvider(){return this._rendererOptionsProvider}priceAxisRendererOptions(){return this._rendererOptionsProvider.options()}priceScalesOptionsChanged(){return this._priceScalesOptionsChanged}createSeries(t,i){const s=this._panes[0],e=this._createSeries(i,t,s);return this._serieses.push(e),1===this._serieses.length?this.fullUpdate():this.lightUpdate(),e}removeSeries(t){const i=this.paneForSource(t),s=this._serieses.indexOf(t);h(-1!==s,"Series not found"),this._serieses.splice(s,1),r(i).removeDataSource(t),t.destroy&&t.destroy()}moveSeriesToScale(t,i){const s=r(this.paneForSource(t));s.removeDataSource(t);const e=this.findPriceScale(i);if(null===e){const e=t.zorder();s.addDataSource(t,i,e)}else{const h=e.pane===s?t.zorder():void 0;e.pane.addDataSource(t,i,h)}}fitContent(){const t=ht.light();t.setFitContent(),this._invalidate(t)}setTargetLogicalRange(t){const i=ht.light();i.applyRange(t),this._invalidate(i)}resetTimeScale(){const t=ht.light();t.resetTimeScale(),this._invalidate(t)}setBarSpacing(t){const i=ht.light();i.setBarSpacing(t),this._invalidate(i)}setRightOffset(t){const i=ht.light();i.setRightOffset(t),this._invalidate(i)}setTimeScaleAnimation(t){const i=ht.light();i.setTimeScaleAnimation(t),this._invalidate(i)}stopTimeScaleAnimation(){const t=ht.light();t.stopTimeScaleAnimation(),this._invalidate(t)}defaultVisiblePriceScaleId(){return this._options.rightPriceScale.visible?"right":"left"}backgroundBottomColor(){return this._backgroundBottomColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(t){const i=this._backgroundBottomColor,s=this._backgroundTopColor;if(i===s)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==s||this._gradientColorsCache.bottomColor!==i)this._gradientColorsCache={topColor:s,bottomColor:i,colors:new Map};else{const i=this._gradientColorsCache.colors.get(t);if(void 0!==i)return i}const e=function(t,i,s){const[e,h,n,r]=m(t),[o,l,c,d]=m(i),f=[a(e+s*(o-e)),a(h+s*(l-h)),a(n+s*(c-n)),u(r+s*(d-r))];return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${f[3]})`}(s,i,t/100);return this._gradientColorsCache.colors.set(t,e),e}_paneInvalidationMask(t,i){const s=new ht(i);if(null!==t){const e=this._panes.indexOf(t);s.invalidatePane(e,{level:i})}return s}_invalidationMaskForSource(t,i){return void 0===i&&(i=2),this._paneInvalidationMask(this.paneForSource(t),i)}_invalidate(t){this._invalidateHandler&&this._invalidateHandler(t),this._panes.forEach((t=>t.grid().paneView().update()))}_createSeries(t,i,s){const e=new Bi(this,t,i),h=void 0!==t.priceScaleId?t.priceScaleId:this.defaultVisiblePriceScaleId();return s.addDataSource(e,h),et(h)||e.applyOptions(t),e}_getBackgroundColor(t){const i=this._options.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ps(t){return!w(t)&&!S(t)}function Rs(t){return w(t)}function Ds(t){var i=t.width,s=t.height;if(i<0)throw new Error("Negative width is not allowed for Size");if(s<0)throw new Error("Negative height is not allowed for Size");return{width:i,height:s}}function As(t,i){return t.width===i.width&&t.height===i.height}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(ws||(ws={})),function(t){t[t.LastPriceAndPercentageValue=0]="LastPriceAndPercentageValue",t[t.LastValueAccordingToScale=1]="LastValueAccordingToScale"}(Ms||(Ms={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Ss||(Ss={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(xs||(xs={}));var Es=function(){function t(t){var i=this;this._resolutionListener=function(){return i._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(t){var i=this,s={next:t};return this._observers.push(s),{unsubscribe:function(){i._observers=i._observers.filter((function(t){return t!==s}))}}},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw new Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach((function(i){return i.next(t._window.devicePixelRatio)})),this._reinstallResolutionListener()},t}();var Os=function(){function t(t,i,s){var e;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=Ds({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(e=null==s?void 0:s.allowResizeObserver)||void 0===e||e,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw new Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return Ds({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=Ds(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter((function(i){return i!==t}))},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter((function(i){return i!==t}))},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;As(i,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var s=this;this._bitmapSizeChangedListeners.forEach((function(e){return e.call(s,t,i)}))},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,s=Ds(this._transformBitmapSize(t,this._canvasElementClientSize)),e=As(this.bitmapSize,s)?null:s;null===i&&null===e||null!==i&&null!==e&&As(i,e)||(this._suggestedBitmapSize=e,this._emitSuggestedBitmapSizeChanged(i,e))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var s=this;this._suggestedBitmapSizeChangedListeners.forEach((function(e){return e.call(s,t,i)}))},t.prototype._chooseAndInitObserver=function(){var t=this;this._allowResizeObserver?new Promise((function(t){var i=new ResizeObserver((function(s){t(s.every((function(t){return"devicePixelContentBoxSize"in t}))),i.disconnect()}));i.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1})).then((function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})):this._initDevicePixelRatioObservable()},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=Bs(this._canvasElement);if(null===i)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=function(t){return new Es(t)}(i),this._devicePixelRatioObservable.subscribe((function(){return t._invalidateBitmapSize()})),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var t,i;if(null!==this._canvasElement){var s=Bs(this._canvasElement);if(null!==s){var e=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:s.devicePixelRatio,h=this._canvasElement.getClientRects(),n=void 0!==h[0]?function(t,i){return Ds({width:Math.round(t.left*i+t.width*i)-Math.round(t.left*i),height:Math.round(t.top*i+t.height*i)-Math.round(t.top*i)})}(h[0],e):Ds({width:this._canvasElementClientSize.width*e,height:this._canvasElementClientSize.height*e});this._suggestNewBitmapSize(n)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver((function(i){var s=i.find((function(i){return i.target===t._canvasElement}));if(s&&s.devicePixelContentBoxSize&&s.devicePixelContentBoxSize[0]){var e=s.devicePixelContentBoxSize[0],h=Ds({width:e.inlineSize,height:e.blockSize});t._suggestNewBitmapSize(h)}})),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function Bs(t){return t.ownerDocument.defaultView}var Ls=function(){function t(t,i,s){if(0===i.width||0===i.height)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===s.width||0===s.height)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=s,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function zs(t,i){var s=t.canvasElementClientSize;if(0===s.width||0===s.height)return null;var e=t.bitmapSize;if(0===e.width||0===e.height)return null;var h=t.canvasElement.getContext("2d",i);return null===h?null:new Ls(h,s,e)}const Is="undefined"!=typeof window;function Ns(){return!!Is&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Vs(){return!!Is&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Fs(t){return t+t%2}var Ws,js,Hs,$s,Us,qs,Ys,Xs;function Zs(t,i){return t.position-i.position}function Ks(t,i,s){const e=(t.position-i.position)/(t.time-i.time);return Math.sign(e)*Math.min(Math.abs(e),s)}!function(t){t[t.MaxStartDelay=50]="MaxStartDelay",t[t.EpsilonDistance=1]="EpsilonDistance"}(Ws||(Ws={}));class Gs{constructor(t,i,s,e){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._minSpeed=t,this._maxSpeed=i,this._dumpingCoeff=s,this._minMove=e}addPosition(t,i){if(null!==this._position1){if(this._position1.time===i)return void(this._position1.position=t);if(Math.abs(this._position1.position-t)50)return;let s=0;const e=Ks(this._position1,this._position2,this._maxSpeed),h=Zs(this._position1,this._position2),n=[e],r=[h];if(s+=h,null!==this._position3){const t=Ks(this._position2,this._position3,this._maxSpeed);if(Math.sign(t)===Math.sign(e)){const i=Zs(this._position2,this._position3);if(n.push(t),r.push(i),s+=i,null!==this._position4){const t=Ks(this._position3,this._position4,this._maxSpeed);if(Math.sign(t)===Math.sign(e)){const i=Zs(this._position3,this._position4);n.push(t),r.push(i),s+=i}}}}let o=0;for(let t=0;t({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return e.resizeCanvasElement(i),e}function Qs(t){Is&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}))}!function(t){t[t.ResetClick=500]="ResetClick",t[t.LongTap=240]="LongTap",t[t.PreventFiresTouchEvents=500]="PreventFiresTouchEvents"}(js||(js={})),function(t){t[t.CancelClickManhattanDistance=5]="CancelClickManhattanDistance",t[t.CancelTapManhattanDistance=5]="CancelTapManhattanDistance",t[t.DoubleClickManhattanDistance=5]="DoubleClickManhattanDistance",t[t.DoubleTapManhattanDistance=30]="DoubleTapManhattanDistance"}(Hs||(Hs={}));class te{constructor(t,i,s){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._startPinchMiddlePoint=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!Vs(),this._onFirefoxOutsideMouseUp=t=>{this._mouseUpHandler(t)},this._onMobileSafariDoubleClick=t=>{if(this._firesTouchEvents(t)){const i=this._makeCompatEvent(t);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:s}=this._touchMouseMoveWithDownInfo(ee(t),this._tapPosition);s<30&&!this._cancelTap&&this._processTouchEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}}else{const i=this._makeCompatEvent(t);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:s}=this._touchMouseMoveWithDownInfo(ee(t),this._clickPosition);s<5&&!this._cancelClick&&this._processMouseEvent(i,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=t,this._handler=i,this._options=s,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),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(t){this._unsubscribeMousemove&&this._unsubscribeMousemove();const i=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",i)},this._target.addEventListener("mousemove",i),this._firesTouchEvents(t))return;const s=this._makeCompatEvent(t);this._processMouseEvent(s,this._handler.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(t){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(t))return;const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handler.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(t){const i=ne(t.changedTouches,r(this._activeTouchId));if(null===i)return;if(this._lastTouchEventTimeStamp=he(t),null!==this._startPinchMiddlePoint)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const s=this._touchMouseMoveWithDownInfo(ee(i),r(this._touchMoveStartPosition)),{xOffset:e,yOffset:h,manhattanDistance:n}=s;if(this._touchMoveExceededManhattanDistance||!(n<5)){if(!this._touchMoveExceededManhattanDistance){const t=.5*e,i=h>=t&&!this._options.treatVertTouchDragAsPageScroll(),s=t>h&&!this._options.treatHorzTouchDragAsPageScroll();i||s||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const s=this._makeCompatEvent(t,i);this._processTouchEvent(s,this._handler.touchMoveEvent),se(t)}}}_mouseMoveWithDownHandler(t){if(0!==t.button)return;const i=this._touchMouseMoveWithDownInfo(ee(t),r(this._mouseMoveStartPosition)),{manhattanDistance:s}=i;if(s>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handler.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(t,i){const s=Math.abs(i.x-t.x),e=Math.abs(i.y-t.y);return{xOffset:s,yOffset:e,manhattanDistance:s+e}}_touchEndHandler(t){let i=ne(t.changedTouches,r(this._activeTouchId));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=he(t),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const s=this._makeCompatEvent(t,i);if(this._processTouchEvent(s,this._handler.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:t}=this._touchMouseMoveWithDownInfo(ee(i),this._tapPosition);t<30&&!this._cancelTap&&this._processTouchEvent(s,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(s,this._handler.tapEvent),this._handler.tapEvent&&se(t));0===this._tapCount&&se(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,se(t))}_mouseUpHandler(t){if(0!==t.button)return;const i=this._makeCompatEvent(t);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),Ns()){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(t))if(this._processMouseEvent(i,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:s}=this._touchMouseMoveWithDownInfo(ee(t),this._clickPosition);s<5&&!this._cancelClick&&this._processMouseEvent(i,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(i,this._handler.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(t){if(null!==this._activeTouchId)return;const i=t.changedTouches[0];this._activeTouchId=i.identifier,this._lastTouchEventTimeStamp=he(t);const s=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=ee(i),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const i=this._touchMoveHandler.bind(this),e=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{s.removeEventListener("touchmove",i),s.removeEventListener("touchend",e)},s.addEventListener("touchmove",i,{passive:!1}),s.addEventListener("touchend",e,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),240)}const e=this._makeCompatEvent(t,i);this._processTouchEvent(e,this._handler.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=ee(i))}_mouseDownHandler(t){if(0!==t.button)return;const i=this._target.ownerDocument.documentElement;Ns()&&i.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=ee(t),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const t=this._mouseMoveWithDownHandler.bind(this),s=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",s)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",s)}if(this._mousePressed=!0,this._firesTouchEvents(t))return;const s=this._makeCompatEvent(t);this._processMouseEvent(s,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=ee(t))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));{const t=this._target.ownerDocument,i=t=>{this._handler.mouseDownOutsideEvent&&(t.composed&&this._target.contains(t.composedPath()[0])||t.target&&this._target.contains(t.target)||this._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideTouchEvents=()=>{t.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}Vs()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),Qs(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",(t=>this._checkPinchState(t.touches)),{passive:!0}),this._target.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this._startPinchMiddlePoint&&void 0!==this._handler.pinchEvent){const i=ie(t.touches[0],t.touches[1])/this._startPinchDistance;this._handler.pinchEvent(this._startPinchMiddlePoint,i),se(t)}}),{passive:!1}),this._target.addEventListener("touchend",(t=>{this._checkPinchState(t.touches)})))}_checkPinchState(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)}_startPinch(t){const i=this._target.getBoundingClientRect()||{left:0,top:0};this._startPinchMiddlePoint={x:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,y:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this._startPinchDistance=ie(t[0],t[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent(),this._clearLongTapTimeout()}_stopPinch(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}_mouseLeaveHandler(t){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(t))return;if(!this._acceptMouseLeave)return;const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handler.mouseLeaveEvent),this._acceptMouseLeave=!Vs()}_longTapHandler(t){const i=ne(t.touches,r(this._activeTouchId));if(null===i)return;const s=this._makeCompatEvent(t,i);this._processTouchEvent(s,this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0}_firesTouchEvents(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:he(t){"touchstart"!==t.type&&se(t)}}}}function ie(t,i){const s=t.clientX-i.clientX,e=t.clientY-i.clientY;return Math.sqrt(s*s+e*e)}function se(t){t.cancelable&&t.preventDefault()}function ee(t){return{x:t.pageX,y:t.pageY}}function he(t){return t.timeStamp||performance.now()}function ne(t,i){for(let s=0;s{this._isSettingSize||this._pane.chart().model().lightUpdate()},this._topCanvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||this._pane.chart().model().lightUpdate()},this._pane=t,this._options=i,this._layoutOptions=i.layout,this._rendererOptionsProvider=s,this._isLeft="left"===e,this._cell=document.createElement("div"),this._cell.style.height="100%",this._cell.style.overflow="hidden",this._cell.style.width="25px",this._cell.style.left="0",this._cell.style.position="relative",this._canvasBinding=Js(this._cell,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler);const h=this._canvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this._topCanvasBinding=Js(this._cell,Ds({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler);const n=this._topCanvasBinding.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0";const r={mouseDownEvent:this._mouseDownEvent.bind(this),touchStartEvent:this._mouseDownEvent.bind(this),pressedMouseMoveEvent:this._pressedMouseMoveEvent.bind(this),touchMoveEvent:this._pressedMouseMoveEvent.bind(this),mouseDownOutsideEvent:this._mouseDownOutsideEvent.bind(this),mouseUpEvent:this._mouseUpEvent.bind(this),touchEndEvent:this._mouseUpEvent.bind(this),mouseDoubleClickEvent:this._mouseDoubleClickEvent.bind(this),doubleTapEvent:this._mouseDoubleClickEvent.bind(this),mouseEnterEvent:this._mouseEnterEvent.bind(this),mouseLeaveEvent:this._mouseLeaveEvent.bind(this)};this._mouseEventHandler=new te(this._topCanvasBinding.canvasElement,r,{treatVertTouchDragAsPageScroll:()=>!1,treatHorzTouchDragAsPageScroll:()=>!0})}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose(),null!==this._priceScale&&this._priceScale.onMarksChanged().unsubscribeAll(this),this._priceScale=null}getElement(){return this._cell}fontSize(){return this._layoutOptions.fontSize}rendererOptions(){const t=this._rendererOptionsProvider.options();return this._font!==t.font&&(this._widthCache.reset(),this._font=t.font),t}optimalWidth(){if(null===this._priceScale)return 0;let t=0;const i=this.rendererOptions(),s=r(this._canvasBinding.canvasElement.getContext("2d"));s.save();const e=this._priceScale.marks();s.font=this._baseFont(),e.length>0&&(t=Math.max(this._widthCache.measureText(s,e[0].label),this._widthCache.measureText(s,e[e.length-1].label)));const h=this._backLabels();for(let i=h.length;i--;){const e=this._widthCache.measureText(s,h[i].text());e>t&&(t=e)}const n=this._priceScale.firstValue();if(null!==n&&null!==this._size){const i=this._priceScale.coordinateToPrice(1,n),e=this._priceScale.coordinateToPrice(this._size.height-2,n);t=Math.max(t,this._widthCache.measureText(s,this._priceScale.formatPrice(Math.floor(Math.min(i,e))+.11111111111111,n)),this._widthCache.measureText(s,this._priceScale.formatPrice(Math.ceil(Math.max(i,e))-.11111111111111,n)))}s.restore();const o=t||34;return Fs(Math.ceil(i.borderSize+i.tickLength+i.paddingInner+i.paddingOuter+5+o))}setSize(t){null!==this._size&&As(this._size,t)||(this._size=t,this._isSettingSize=!0,this._canvasBinding.resizeCanvasElement(t),this._topCanvasBinding.resizeCanvasElement(t),this._isSettingSize=!1,this._cell.style.width=`${t.width}px`,this._cell.style.height=`${t.height}px`)}getWidth(){return r(this._size).width}setPriceScale(t){this._priceScale!==t&&(null!==this._priceScale&&this._priceScale.onMarksChanged().unsubscribeAll(this),this._priceScale=t,t.onMarksChanged().subscribe(this._onMarksChanged.bind(this),this))}priceScale(){return this._priceScale}reset(){const t=this._pane.state();this._pane.chart().model().resetPriceScale(t,r(this.priceScale()))}paint(t){if(null===this._size)return;if(1!==t){this._alignLabels(),this._canvasBinding.applySuggestedBitmapSize();const t=zs(this._canvasBinding);null!==t&&(t.useBitmapCoordinateSpace((t=>{this._drawBackground(t),this._drawBorder(t)})),this._drawTickMarks(t),this._drawBackLabels(t))}this._topCanvasBinding.applySuggestedBitmapSize();const i=zs(this._topCanvasBinding);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this._drawCrosshairLabel(i))}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}update(){var t;null===(t=this._priceScale)||void 0===t||t.marks()}_mouseDownEvent(t){if(null===this._priceScale||this._priceScale.isEmpty()||!this._options.handleScale.axisPressedMouseMove.price)return;const i=this._pane.chart().model(),s=this._pane.state();this._mousedown=!0,i.startScalePrice(s,this._priceScale,t.localY)}_pressedMouseMoveEvent(t){if(null===this._priceScale||!this._options.handleScale.axisPressedMouseMove.price)return;const i=this._pane.chart().model(),s=this._pane.state(),e=this._priceScale;i.scalePriceTo(s,e,t.localY)}_mouseDownOutsideEvent(){if(null===this._priceScale||!this._options.handleScale.axisPressedMouseMove.price)return;const t=this._pane.chart().model(),i=this._pane.state(),s=this._priceScale;this._mousedown&&(this._mousedown=!1,t.endScalePrice(i,s))}_mouseUpEvent(t){if(null===this._priceScale||!this._options.handleScale.axisPressedMouseMove.price)return;const i=this._pane.chart().model(),s=this._pane.state();this._mousedown=!1,i.endScalePrice(s,this._priceScale)}_mouseDoubleClickEvent(t){this._options.handleScale.axisDoubleClickReset.price&&this.reset()}_mouseEnterEvent(t){if(null===this._priceScale)return;!this._pane.chart().model().options().handleScale.axisPressedMouseMove.price||this._priceScale.isPercentage()||this._priceScale.isIndexedTo100()||this._setCursor(1)}_mouseLeaveEvent(t){this._setCursor(0)}_backLabels(){const t=[],i=null===this._priceScale?void 0:this._priceScale;return(s=>{for(let e=0;e{t.fillStyle=s.borderColor;const o=Math.max(1,Math.floor(r)),l=Math.floor(.5*r),a=Math.round(e.tickLength*n);t.beginPath();for(const s of i)t.rect(Math.floor(h*n),Math.round(s.coord*r)-l,a,o);t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{var n;t.font=this._baseFont(),t.fillStyle=null!==(n=s.textColor)&&void 0!==n?n:this._layoutOptions.textColor,t.textAlign=this._isLeft?"right":"left",t.textBaseline="middle";const r=this._isLeft?Math.round(h-e.paddingInner):Math.round(h+e.tickLength+e.paddingInner),o=i.map((i=>this._widthCache.yMidCorrection(t,i.label)));for(let s=i.length;s--;){const e=i[s];t.fillText(e.label,r,e.coord+o[s])}}))}_alignLabels(){if(null===this._size||null===this._priceScale)return;let t=this._size.height/2;const i=[],s=this._priceScale.orderedSources().slice(),e=this._pane.state(),h=this.rendererOptions();this._priceScale===e.defaultVisiblePriceScale()&&this._pane.state().orderedSources().forEach((t=>{e.isOverlay(t)&&s.push(t)}));const n=this._priceScale.dataSources()[0],r=this._priceScale;s.forEach((s=>{const h=s.priceAxisViews(e,r);h.forEach((t=>{t.setFixedCoordinate(null),t.isVisible()&&i.push(t)})),n===s&&h.length>0&&(t=h[0].coordinate())})),i.forEach((t=>t.setFixedCoordinate(t.coordinate())));this._priceScale.options().alignLabels&&this._fixLabelOverlap(i,h,t)}_fixLabelOverlap(t,i,s){if(null===this._size)return;const e=t.filter((t=>t.coordinate()<=s)),h=t.filter((t=>t.coordinate()>s));e.sort(((t,i)=>i.coordinate()-t.coordinate())),e.length&&h.length&&h.push(e[0]),h.sort(((t,i)=>t.coordinate()-i.coordinate()));for(const s of t){const t=Math.floor(s.height(i)/2),e=s.coordinate();e>-t&&ethis._size.height-t&&eo-n&&s.setFixedCoordinate(o-n)}for(let t=1;t{if(i.isAxisLabelVisible()){i.renderer(r(this._priceScale)).draw(t,s,this._widthCache,e)}}))}_drawCrosshairLabel(t){if(null===this._size||null===this._priceScale)return;const i=this._pane.chart().model(),s=[],e=this._pane.state(),h=i.crosshairSource().priceAxisViews(e,this._priceScale);h.length&&s.push(h);const n=this.rendererOptions(),o=this._isLeft?"right":"left";s.forEach((i=>{i.forEach((i=>{i.renderer(r(this._priceScale)).draw(t,n,this._widthCache,o)}))}))}_setCursor(t){this._cell.style.cursor=1===t?"ns-resize":"default"}_onMarksChanged(){const t=this.optimalWidth();this._prevOptimalWidth{this._isSettingSize||null===this._state||this._model().lightUpdate()},this._topCanvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||null===this._state||this._model().lightUpdate()},this._chart=t,this._state=i,this._state.onDestroyed().subscribe(this._onStateDestroyed.bind(this),this,!0),this._paneCell=document.createElement("td"),this._paneCell.style.padding="0",this._paneCell.style.position="relative";const s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this._leftAxisCell=document.createElement("td"),this._leftAxisCell.style.padding="0",this._rightAxisCell=document.createElement("td"),this._rightAxisCell.style.padding="0",this._paneCell.appendChild(s),this._canvasBinding=Js(s,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler);const e=this._canvasBinding.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this._topCanvasBinding=Js(s,Ds({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this._rowElement=document.createElement("tr"),this._rowElement.appendChild(this._leftAxisCell),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rightAxisCell),this.updatePriceAxisWidgetsStates(),this._mouseEventHandler=new te(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:()=>null===this._startTrackPoint&&!this._chart.options().handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:()=>null===this._startTrackPoint&&!this._chart.options().handleScroll.horzTouchDrag})}destroy(){null!==this._leftPriceAxisWidget&&this._leftPriceAxisWidget.destroy(),null!==this._rightPriceAxisWidget&&this._rightPriceAxisWidget.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose(),null!==this._state&&this._state.onDestroyed().unsubscribeAll(this),this._mouseEventHandler.destroy()}state(){return r(this._state)}setState(t){null!==this._state&&this._state.onDestroyed().unsubscribeAll(this),this._state=t,null!==this._state&&this._state.onDestroyed().subscribe(de.prototype._onStateDestroyed.bind(this),this,!0),this.updatePriceAxisWidgetsStates()}chart(){return this._chart}getElement(){return this._rowElement}updatePriceAxisWidgetsStates(){if(null!==this._state&&(this._recreatePriceAxisWidgets(),0!==this._model().serieses().length)){if(null!==this._leftPriceAxisWidget){const t=this._state.leftPriceScale();this._leftPriceAxisWidget.setPriceScale(r(t))}if(null!==this._rightPriceAxisWidget){const t=this._state.rightPriceScale();this._rightPriceAxisWidget.setPriceScale(r(t))}}}updatePriceAxisWidgets(){null!==this._leftPriceAxisWidget&&this._leftPriceAxisWidget.update(),null!==this._rightPriceAxisWidget&&this._rightPriceAxisWidget.update()}stretchFactor(){return null!==this._state?this._state.stretchFactor():0}setStretchFactor(t){this._state&&this._state.setStretchFactor(t)}mouseEnterEvent(t){if(!this._state)return;this._onMouseEvent();const i=t.localX,s=t.localY;this._setCrosshairPosition(i,s,t)}mouseDownEvent(t){this._onMouseEvent(),this._mouseTouchDownEvent(),this._setCrosshairPosition(t.localX,t.localY,t)}mouseMoveEvent(t){if(!this._state)return;this._onMouseEvent();const i=t.localX,s=t.localY;this._setCrosshairPosition(i,s,t);const e=this.hitTest(i,s);this._model().setHoveredSource(e&&{source:e.source,object:e.object})}mouseClickEvent(t){null!==this._state&&(this._onMouseEvent(),this._fireClickedDelegate(t))}pressedMouseMoveEvent(t){this._onMouseEvent(),this._pressedMouseTouchMoveEvent(t),this._setCrosshairPosition(t.localX,t.localY,t)}mouseUpEvent(t){null!==this._state&&(this._onMouseEvent(),this._longTap=!1,this._endScroll(t))}tapEvent(t){null!==this._state&&this._fireClickedDelegate(t)}longTapEvent(t){if(this._longTap=!0,null===this._startTrackPoint){const i={x:t.localX,y:t.localY};this._startTrackingMode(i,i,t)}}mouseLeaveEvent(t){null!==this._state&&(this._onMouseEvent(),this._state.model().setHoveredSource(null),this._clearCrosshairPosition())}clicked(){return this._clicked}pinchStartEvent(){this._prevPinchScale=1,this._model().stopTimeScaleAnimation()}pinchEvent(t,i){if(!this._chart.options().handleScale.pinch)return;const s=5*(i-this._prevPinchScale);this._prevPinchScale=i,this._model().zoomTime(t.x,s)}touchStartEvent(t){if(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._mouseTouchDownEvent(),null!==this._startTrackPoint){const i=this._model().crosshairSource();this._initCrosshairPosition={x:i.appliedX(),y:i.appliedY()},this._startTrackPoint={x:t.localX,y:t.localY}}}touchMoveEvent(t){if(null===this._state)return;const i=t.localX,s=t.localY;if(null===this._startTrackPoint)this._pressedMouseTouchMoveEvent(t);else{this._exitTrackingModeOnNextTry=!1;const e=r(this._initCrosshairPosition),h=e.x+(i-this._startTrackPoint.x),n=e.y+(s-this._startTrackPoint.y);this._setCrosshairPosition(h,n,t)}}touchEndEvent(t){0===this.chart().options().trackingMode.exitMode&&(this._exitTrackingModeOnNextTry=!0),this._tryExitTrackingMode(),this._endScroll(t)}hitTest(t,i){const s=this._state;if(null===s)return null;const e=s.orderedSources();for(const h of e){const e=this._hitTestPaneView(h.paneViews(s),t,i);if(null!==e)return{source:h,view:e.view,object:e.object}}return null}setPriceAxisSize(t,i){r("left"===i?this._leftPriceAxisWidget:this._rightPriceAxisWidget).setSize(Ds({width:t,height:this._size.height}))}getSize(){return this._size}setSize(t){As(this._size,t)||(this._size=t,this._isSettingSize=!0,this._canvasBinding.resizeCanvasElement(t),this._topCanvasBinding.resizeCanvasElement(t),this._isSettingSize=!1,this._paneCell.style.width=t.width+"px",this._paneCell.style.height=t.height+"px")}recalculatePriceScales(){const t=r(this._state);t.recalculatePriceScale(t.leftPriceScale()),t.recalculatePriceScale(t.rightPriceScale());for(const i of t.dataSources())if(t.isOverlay(i)){const s=i.priceScale();null!==s&&t.recalculatePriceScale(s),i.updateAllViews()}}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}paint(t){if(0===t)return;if(null===this._state)return;if(t>1&&this.recalculatePriceScales(),null!==this._leftPriceAxisWidget&&this._leftPriceAxisWidget.paint(t),null!==this._rightPriceAxisWidget&&this._rightPriceAxisWidget.paint(t),1!==t){this._canvasBinding.applySuggestedBitmapSize();const t=zs(this._canvasBinding);null!==t&&(t.useBitmapCoordinateSpace((t=>{this._drawBackground(t)})),this._state&&(this._drawGrid(t),this._drawWatermark(t),this._drawSources(t,ae),this._drawSources(t,ue)))}this._topCanvasBinding.applySuggestedBitmapSize();const i=zs(this._topCanvasBinding);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this._drawSources(i,ce),this._drawCrosshair(i))}leftPriceAxisWidget(){return this._leftPriceAxisWidget}rightPriceAxisWidget(){return this._rightPriceAxisWidget}setCrosshair(t,i,s){if(this._state)if(s){const s=t,e=i;this._setCrosshairPositionNoFire(s,e)}else this._state.model().setHoveredSource(null),this._clearCrosshairPosition()}_onStateDestroyed(){null!==this._state&&this._state.onDestroyed().unsubscribeAll(this),this._state=null}_fireClickedDelegate(t){const i=t.localX,s=t.localY;this._clicked.hasListeners()&&this._clicked.fire(this._model().timeScale().coordinateToIndex(i),{x:i,y:s},t)}_drawBackground({context:t,bitmapSize:i}){const{width:s,height:e}=i,h=this._model(),n=h.backgroundTopColor(),r=h.backgroundBottomColor();n===r?F(t,0,0,s,e,r):$(t,0,0,s,e,n,r)}_drawGrid(t){const i=r(this._state).grid().paneView().renderer();null!==i&&i.draw(t,!1)}_drawWatermark(t){const i=this._model().watermarkSource();this._drawSourceImpl(t,ae,oe,i),this._drawSourceImpl(t,ae,le,i)}_drawCrosshair(t){this._drawSourceImpl(t,ae,le,this._model().crosshairSource())}_drawSources(t,i){const s=r(this._state).orderedSources();for(const e of s)this._drawSourceImpl(t,i,oe,e);for(const e of s)this._drawSourceImpl(t,i,le,e)}_drawSourceImpl(t,i,s,e){const h=r(this._state),n=i(e,h),o=h.model().hoveredSource(),l=null!==o&&o.source===e,a=null!==o&&l&&void 0!==o.object?o.object.hitTestData:void 0;for(const i of n){const e=i.renderer();null!==e&&s(e,t,l,a)}}_hitTestPaneView(t,i,s){for(const e of t){const t=e.renderer();if(null!==t&&t.hitTest){const h=t.hitTest(i,s);if(null!==h)return{view:e,object:h}}}return null}_recreatePriceAxisWidgets(){if(null===this._state)return;const t=this._chart,i=this._state.leftPriceScale().options().visible,s=this._state.rightPriceScale().options().visible;i||null===this._leftPriceAxisWidget||(this._leftAxisCell.removeChild(this._leftPriceAxisWidget.getElement()),this._leftPriceAxisWidget.destroy(),this._leftPriceAxisWidget=null),s||null===this._rightPriceAxisWidget||(this._rightAxisCell.removeChild(this._rightPriceAxisWidget.getElement()),this._rightPriceAxisWidget.destroy(),this._rightPriceAxisWidget=null);const e=t.model().rendererOptionsProvider();i&&null===this._leftPriceAxisWidget&&(this._leftPriceAxisWidget=new re(this,t.options(),e,"left"),this._leftAxisCell.appendChild(this._leftPriceAxisWidget.getElement())),s&&null===this._rightPriceAxisWidget&&(this._rightPriceAxisWidget=new re(this,t.options(),e,"right"),this._rightAxisCell.appendChild(this._rightPriceAxisWidget.getElement()))}_preventScroll(t){return t.isTouch&&this._longTap||null!==this._startTrackPoint}_correctXCoord(t){return Math.max(0,Math.min(t,this._size.width-1))}_correctYCoord(t){return Math.max(0,Math.min(t,this._size.height-1))}_setCrosshairPosition(t,i,s){this._model().setAndSaveCurrentPosition(this._correctXCoord(t),this._correctYCoord(i),s,r(this._state))}_setCrosshairPositionNoFire(t,i){this._model().setAndSaveCurrentPositionFire(this._correctXCoord(t),this._correctYCoord(i),!1,r(this._state))}_clearCrosshairPosition(){this._model().clearCurrentPosition()}_tryExitTrackingMode(){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,this._clearCrosshairPosition())}_startTrackingMode(t,i,s){this._startTrackPoint=t,this._exitTrackingModeOnNextTry=!1,this._setCrosshairPosition(i.x,i.y,s);const e=this._model().crosshairSource();this._initCrosshairPosition={x:e.appliedX(),y:e.appliedY()}}_model(){return this._chart.model()}_endScroll(t){if(!this._isScrolling)return;const i=this._model(),s=this.state();if(i.endScrollPrice(s,s.defaultPriceScale()),this._startScrollingPos=null,this._isScrolling=!1,i.endScrollTime(),null!==this._scrollXAnimation){const t=performance.now(),s=i.timeScale();this._scrollXAnimation.start(s.rightOffset(),t),this._scrollXAnimation.finished(t)||i.setTimeScaleAnimation(this._scrollXAnimation)}}_onMouseEvent(){this._startTrackPoint=null}_mouseTouchDownEvent(){if(!this._state)return;if(this._model().stopTimeScaleAnimation(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)r(document.activeElement).blur();else{const t=document.getSelection();null!==t&&t.removeAllRanges()}!this._state.defaultPriceScale().isEmpty()&&this._model().timeScale().isEmpty()}_pressedMouseTouchMoveEvent(t){if(null===this._state)return;const i=this._model(),s=i.timeScale();if(s.isEmpty())return;const e=this._chart.options(),h=e.handleScroll,n=e.kineticScroll;if((!h.pressedMouseMove||t.isTouch)&&(!h.horzTouchDrag&&!h.vertTouchDrag||!t.isTouch))return;const r=this._state.defaultPriceScale(),o=performance.now();if(null!==this._startScrollingPos||this._preventScroll(t)||(this._startScrollingPos={x:t.clientX,y:t.clientY,timestamp:o,localX:t.localX,localY:t.localY}),null!==this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==t.clientX||this._startScrollingPos.y!==t.clientY)){if(t.isTouch&&n.touch||!t.isTouch&&n.mouse){const t=s.barSpacing();this._scrollXAnimation=new Gs(.2/t,7/t,.997,15/t),this._scrollXAnimation.addPosition(s.rightOffset(),this._startScrollingPos.timestamp)}else this._scrollXAnimation=null;r.isEmpty()||i.startScrollPrice(this._state,r,t.localY),i.startScrollTime(t.localX),this._isScrolling=!0}this._isScrolling&&(r.isEmpty()||i.scrollPriceTo(this._state,r,t.localY),i.scrollTimeTo(t.localX),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(s.rightOffset(),o))}}class fe{constructor(t,i,s,e,h){this._invalidated=!0,this._size=Ds({width:0,height:0}),this._canvasSuggestedBitmapSizeChangedHandler=()=>this.paint(3),this._isLeft="left"===t,this._rendererOptionsProvider=s.rendererOptionsProvider,this._options=i,this._borderVisible=e,this._bottomColor=h,this._cell=document.createElement("div"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.overflow="hidden",this._canvasBinding=Js(this._cell,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler)}destroy(){this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose()}getElement(){return this._cell}getSize(){return this._size}setSize(t){As(this._size,t)||(this._size=t,this._canvasBinding.resizeCanvasElement(t),this._cell.style.width=`${t.width}px`,this._cell.style.height=`${t.height}px`,this._invalidated=!0)}paint(t){if(t<3&&!this._invalidated)return;if(0===this._size.width||0===this._size.height)return;this._invalidated=!1,this._canvasBinding.applySuggestedBitmapSize();const i=zs(this._canvasBinding);null!==i&&i.useBitmapCoordinateSpace((t=>{this._drawBackground(t),this._drawBorder(t)}))}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}_drawBorder({context:t,bitmapSize:i,horizontalPixelRatio:s,verticalPixelRatio:e}){if(!this._borderVisible())return;t.fillStyle=this._options.timeScale.borderColor;const h=Math.floor(this._rendererOptionsProvider.options().borderSize*s),n=Math.floor(this._rendererOptionsProvider.options().borderSize*e),r=this._isLeft?i.width-h:0;t.fillRect(r,0,h,n)}_drawBackground({context:t,bitmapSize:i}){F(t,0,0,i.width,i.height,this._bottomColor())}}function pe(t,i){return t.weight>i.weight?t:i}!function(t){t[t.BorderSize=1]="BorderSize",t[t.TickLength=5]="TickLength"}(Ys||(Ys={})),function(t){t[t.Default=0]="Default",t[t.EwResize=1]="EwResize"}(Xs||(Xs={}));class me{constructor(t){this._leftStub=null,this._rightStub=null,this._rendererOptions=null,this._mouseDown=!1,this._size=Ds({width:0,height:0}),this._sizeChanged=new b,this._widthCache=new Yt(5),this._isSettingSize=!1,this._canvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||this._chart.model().lightUpdate()},this._topCanvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||this._chart.model().lightUpdate()},this._chart=t,this._options=t.options().layout,this._element=document.createElement("tr"),this._leftStubCell=document.createElement("td"),this._leftStubCell.style.padding="0",this._rightStubCell=document.createElement("td"),this._rightStubCell.style.padding="0",this._cell=document.createElement("td"),this._cell.style.height="25px",this._cell.style.padding="0",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._canvasBinding=Js(this._dv,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler);const i=this._canvasBinding.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this._topCanvasBinding=Js(this._dv,Ds({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler);const s=this._topCanvasBinding.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this._element.appendChild(this._leftStubCell),this._element.appendChild(this._cell),this._element.appendChild(this._rightStubCell),this._recreateStubs(),this._chart.model().priceScalesOptionsChanged().subscribe(this._recreateStubs.bind(this),this),this._mouseEventHandler=new te(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:()=>!0,treatHorzTouchDragAsPageScroll:()=>!1})}destroy(){this._mouseEventHandler.destroy(),null!==this._leftStub&&this._leftStub.destroy(),null!==this._rightStub&&this._rightStub.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose()}getElement(){return this._element}leftStub(){return this._leftStub}rightStub(){return this._rightStub}mouseDownEvent(t){if(this._mouseDown)return;this._mouseDown=!0;const i=this._chart.model();!i.timeScale().isEmpty()&&this._chart.options().handleScale.axisPressedMouseMove.time&&i.startScaleTime(t.localX)}touchStartEvent(t){this.mouseDownEvent(t)}mouseDownOutsideEvent(){const t=this._chart.model();!t.timeScale().isEmpty()&&this._mouseDown&&(this._mouseDown=!1,this._chart.options().handleScale.axisPressedMouseMove.time&&t.endScaleTime())}pressedMouseMoveEvent(t){const i=this._chart.model();!i.timeScale().isEmpty()&&this._chart.options().handleScale.axisPressedMouseMove.time&&i.scaleTimeTo(t.localX)}touchMoveEvent(t){this.pressedMouseMoveEvent(t)}mouseUpEvent(){this._mouseDown=!1;const t=this._chart.model();t.timeScale().isEmpty()&&!this._chart.options().handleScale.axisPressedMouseMove.time||t.endScaleTime()}touchEndEvent(){this.mouseUpEvent()}mouseDoubleClickEvent(){this._chart.options().handleScale.axisDoubleClickReset.time&&this._chart.model().resetTimeScale()}doubleTapEvent(){this.mouseDoubleClickEvent()}mouseEnterEvent(){this._chart.model().options().handleScale.axisPressedMouseMove.time&&this._setCursor(1)}mouseLeaveEvent(){this._setCursor(0)}getSize(){return this._size}sizeChanged(){return this._sizeChanged}setSizes(t,i,s){As(this._size,t)||(this._size=t,this._isSettingSize=!0,this._canvasBinding.resizeCanvasElement(t),this._topCanvasBinding.resizeCanvasElement(t),this._isSettingSize=!1,this._cell.style.width=`${t.width}px`,this._cell.style.height=`${t.height}px`,this._sizeChanged.fire(t)),null!==this._leftStub&&this._leftStub.setSize(Ds({width:i,height:t.height})),null!==this._rightStub&&this._rightStub.setSize(Ds({width:s,height:t.height}))}optimalHeight(){const t=this._getRendererOptions();return Math.ceil(t.borderSize+t.tickLength+t.fontSize+t.paddingTop+t.paddingBottom+t.labelBottomOffset)}update(){this._chart.model().timeScale().marks()}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}paint(t){if(0===t)return;if(1!==t){this._canvasBinding.applySuggestedBitmapSize();const i=zs(this._canvasBinding);null!==i&&(i.useBitmapCoordinateSpace((t=>{this._drawBackground(t),this._drawBorder(t)})),this._drawTickMarks(i)),null!==this._leftStub&&this._leftStub.paint(t),null!==this._rightStub&&this._rightStub.paint(t)}this._topCanvasBinding.applySuggestedBitmapSize();const i=zs(this._topCanvasBinding);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this._drawLabels([this._chart.model().crosshairSource()],i))}_drawBackground({context:t,bitmapSize:i}){F(t,0,0,i.width,i.height,this._chart.model().backgroundBottomColor())}_drawBorder({context:t,bitmapSize:i,verticalPixelRatio:s}){if(this._chart.options().timeScale.borderVisible){t.fillStyle=this._lineColor();const e=Math.max(1,Math.floor(this._getRendererOptions().borderSize*s));t.fillRect(0,0,i.width,e)}}_drawTickMarks(t){const i=this._chart.model().timeScale(),s=i.marks();if(!s||0===s.length)return;let e=s.reduce(pe,s[0]).weight;e>30&&e<50&&(e=30);const h=this._getRendererOptions(),n=i.options();n.borderVisible&&n.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:e})=>{t.strokeStyle=this._lineColor(),t.fillStyle=this._lineColor();const n=Math.max(1,Math.floor(i)),r=Math.floor(.5*i);t.beginPath();const o=Math.round(h.tickLength*e);for(let e=s.length;e--;){const h=Math.round(s[e].coord*i);t.rect(h-r,0,n,o)}t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{const i=h.borderSize+h.tickLength+h.paddingTop+h.fontSize/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this._textColor(),t.font=this._baseFont();for(const h of s)if(h.weight=e){const s=h.needAlignCoordinate?this._alignTickMarkLabelCoordinate(t,h.coord,h.label):h.coord;t.fillText(h.label,s,i)}}))}_alignTickMarkLabelCoordinate(t,i,s){const e=this._widthCache.measureText(t,s),h=e/2,n=Math.floor(i-h)+.5;return n<0?i+=Math.abs(0-n):n+e>this._size.width&&(i-=Math.abs(this._size.width-(n+e))),i}_drawLabels(t,i){const s=this._getRendererOptions();for(const e of t)for(const t of e.timeAxisViews())t.renderer().draw(i,s)}_lineColor(){return this._chart.options().timeScale.borderColor}_textColor(){return this._options.textColor}_fontSize(){return this._options.fontSize}_baseFont(){return T(this._fontSize(),this._options.fontFamily)}_baseBoldFont(){return T(this._fontSize(),this._options.fontFamily,"bold")}_getRendererOptions(){null===this._rendererOptions&&(this._rendererOptions={borderSize:1,baselineOffset:NaN,paddingTop:NaN,paddingBottom:NaN,paddingHorizontal:NaN,tickLength:5,fontSize:NaN,font:"",widthCache:new Yt,labelBottomOffset:0});const t=this._rendererOptions,i=this._baseFont();if(t.font!==i){const s=this._fontSize();t.fontSize=s,t.font=i,t.paddingTop=3*s/12,t.paddingBottom=3*s/12,t.paddingHorizontal=9*s/12,t.baselineOffset=0,t.labelBottomOffset=4*s/12,t.widthCache.reset()}return this._rendererOptions}_setCursor(t){this._cell.style.cursor=1===t?"ew-resize":"default"}_recreateStubs(){const t=this._chart.model(),i=t.options();i.leftPriceScale.visible||null===this._leftStub||(this._leftStubCell.removeChild(this._leftStub.getElement()),this._leftStub.destroy(),this._leftStub=null),i.rightPriceScale.visible||null===this._rightStub||(this._rightStubCell.removeChild(this._rightStub.getElement()),this._rightStub.destroy(),this._rightStub=null);const s={rendererOptionsProvider:this._chart.model().rendererOptionsProvider()},e=()=>i.leftPriceScale.borderVisible&&t.timeScale().options().borderVisible,h=()=>t.backgroundBottomColor();i.leftPriceScale.visible&&null===this._leftStub&&(this._leftStub=new fe("left",i,s,e,h),this._leftStubCell.appendChild(this._leftStub.getElement())),i.rightPriceScale.visible&&null===this._rightStub&&(this._rightStub=new fe("right",i,s,e,h),this._rightStubCell.appendChild(this._rightStub.getElement()))}}const ve=!!Is&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!Is&&((null===(be=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===be?void 0:be.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var be;class ge{constructor(t,i){var s;this._paneWidgets=[],this._drawRafId=0,this._height=0,this._width=0,this._leftPriceAxisWidth=0,this._rightPriceAxisWidth=0,this._invalidateMask=null,this._drawPlanned=!1,this._clicked=new b,this._crosshairMoved=new b,this._observer=null,this._container=t,this._options=i,this._element=document.createElement("div"),this._element.classList.add("tv-lightweight-charts"),this._element.style.overflow="hidden",this._element.style.direction="ltr",this._element.style.width="100%",this._element.style.height="100%",(s=this._element).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this._tableElement=document.createElement("table"),this._tableElement.setAttribute("cellspacing","0"),this._element.appendChild(this._tableElement),this._onWheelBound=this._onMousewheel.bind(this),we(this._options)&&this._setMouseWheelEventListener(!0),this._model=new Ts(this._invalidateHandler.bind(this),this._options),this.model().crosshairMoved().subscribe(this._onPaneWidgetCrosshairMoved.bind(this),this),this._timeAxisWidget=new me(this),this._tableElement.appendChild(this._timeAxisWidget.getElement());const e=i.autoSize&&this._installObserver();let h=this._options.width,n=this._options.height;if(e||0===h||0===n){const i=t.getBoundingClientRect();h=h||i.width,n=n||i.height}this.resize(h,n),this._syncGuiWithModel(),t.appendChild(this._element),this._updateTimeAxisVisibility(),this._model.timeScale().optionsApplied().subscribe(this._model.fullUpdate.bind(this._model),this),this._model.priceScalesOptionsChanged().subscribe(this._model.fullUpdate.bind(this._model),this)}model(){return this._model}options(){return this._options}paneWidgets(){return this._paneWidgets}timeAxisWidget(){return this._timeAxisWidget}destroy(){this._setMouseWheelEventListener(!1),0!==this._drawRafId&&window.cancelAnimationFrame(this._drawRafId),this._model.crosshairMoved().unsubscribeAll(this),this._model.timeScale().optionsApplied().unsubscribeAll(this),this._model.priceScalesOptionsChanged().unsubscribeAll(this),this._model.destroy();for(const t of this._paneWidgets)this._tableElement.removeChild(t.getElement()),t.clicked().unsubscribeAll(this),t.destroy();this._paneWidgets=[],r(this._timeAxisWidget).destroy(),null!==this._element.parentElement&&this._element.parentElement.removeChild(this._element),this._crosshairMoved.destroy(),this._clicked.destroy(),this._uninstallObserver()}resize(t,i,s=!1){if(this._height===i&&this._width===t)return;const e=function(t){const i=Math.floor(t.width),s=Math.floor(t.height);return Ds({width:i-i%2,height:s-s%2})}(Ds({width:t,height:i}));this._height=e.height,this._width=e.width;const h=this._height+"px",n=this._width+"px";r(this._element).style.height=h,r(this._element).style.width=n,this._tableElement.style.height=h,this._tableElement.style.width=n,s?this._drawImpl(ht.full(),performance.now()):this._model.fullUpdate()}paint(t){void 0===t&&(t=ht.full());for(let i=0;i{let e=0;for(let h=0;h{r("left"===i?this._timeAxisWidget.leftStub():this._timeAxisWidget.rightStub()).drawBitmap(r(t),s,e)};if(this._options.timeScale.visible){const i=this._timeAxisWidget.getBitmapSize();if(null!==t){let h=0;this._isLeftAxisVisible()&&(n("left",h,s),h=r(e.leftPriceAxisWidget()).getBitmapSize().width),this._timeAxisWidget.drawBitmap(t,h,s),h+=i.width,this._isRightAxisVisible()&&n("right",h,s)}s+=i.height}return Ds({width:i,height:s})}_adjustSizeImpl(){let t=0,i=0,s=0;for(const e of this._paneWidgets)this._isLeftAxisVisible()&&(i=Math.max(i,r(e.leftPriceAxisWidget()).optimalWidth())),this._isRightAxisVisible()&&(s=Math.max(s,r(e.rightPriceAxisWidget()).optimalWidth())),t+=e.stretchFactor();i=Fs(i),s=Fs(s);const e=this._width,h=this._height,n=Math.max(e-i-s,0),o=this._options.timeScale.visible;let l=o?this._timeAxisWidget.optimalHeight():0;var a;l=(a=l)+a%2;const u=0+l,c=h{t.updatePriceAxisWidgets()})),3===(null===(s=this._invalidateMask)||void 0===s?void 0:s.fullInvalidation())&&(this._invalidateMask.merge(t),this._updateGui(),this._applyMomentaryAutoScale(this._invalidateMask),this._applyTimeScaleInvalidations(this._invalidateMask,i),t=this._invalidateMask,this._invalidateMask=null)),this.paint(t)}_applyTimeScaleInvalidations(t,i){for(const s of t.timeScaleInvalidations())this._applyTimeScaleInvalidation(s,i)}_applyMomentaryAutoScale(t){const i=this._model.panes();for(let s=0;s{if(this._drawPlanned=!1,this._drawRafId=0,null!==this._invalidateMask){const i=this._invalidateMask;this._invalidateMask=null,this._drawImpl(i,t);for(const s of i.timeScaleInvalidations())if(5===s.type&&!s.value.finished(t)){this.model().setTimeScaleAnimation(s.value);break}}})))}_updateGui(){this._syncGuiWithModel()}_syncGuiWithModel(){const t=this._model.panes(),i=t.length,s=this._paneWidgets.length;for(let t=i;t{const s=i.bars().search(t);null!==s&&h.set(i,s)}))}let n;if(null!==t){const i=null===(e=this._model.timeScale().indexToTimeScalePoint(t))||void 0===e?void 0:e.originalTime;void 0!==i&&(n=i)}const r=this.model().hoveredSource(),o=null!==r&&r.source instanceof Bi?r.source:void 0,l=null!==r&&void 0!==r.object?r.object.externalId:void 0;return{time:n,index:null!=t?t:void 0,point:null!=i?i:void 0,hoveredSeries:o,seriesData:h,hoveredObject:l,touchMouseEventData:null!=s?s:void 0}}_onPaneWidgetClicked(t,i,s){this._clicked.fire((()=>this._getMouseEventParamsImpl(t,i,s)))}_onPaneWidgetCrosshairMoved(t,i,s){this._crosshairMoved.fire((()=>this._getMouseEventParamsImpl(t,i,s)))}_updateTimeAxisVisibility(){const t=this._options.timeScale.visible?"":"none";this._timeAxisWidget.getElement().style.display=t}_isLeftAxisVisible(){return this._paneWidgets[0].state().leftPriceScale().options().visible}_isRightAxisVisible(){return this._paneWidgets[0].state().rightPriceScale().options().visible}_installObserver(){return"ResizeObserver"in window&&(this._observer=new ResizeObserver((t=>{const i=t.find((t=>t.target===this._container));i&&this.resize(i.contentRect.width,i.contentRect.height)})),this._observer.observe(this._container,{box:"border-box"}),!0)}_uninstallObserver(){null!==this._observer&&this._observer.disconnect()}}function we(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Me(t,i,s,e){const h=s.value,n={index:i,time:t,value:[h,h,h,h],originalTime:e};return void 0!==s.color&&(n.color=s.color),n}function Se(t){return void 0!==t.value}function xe(t){return(i,s,e,h)=>{return void 0===(n=e).open&&void 0===n.value?{time:i,index:s,originalTime:h}:t(i,s,e,h);var n}}const _e={Candlestick:xe((function(t,i,s,e){const h={index:i,time:t,value:[s.open,s.high,s.low,s.close],originalTime:e};return void 0!==s.color&&(h.color=s.color),void 0!==s.borderColor&&(h.borderColor=s.borderColor),void 0!==s.wickColor&&(h.wickColor=s.wickColor),h})),Bar:xe((function(t,i,s,e){const h={index:i,time:t,value:[s.open,s.high,s.low,s.close],originalTime:e};return void 0!==s.color&&(h.color=s.color),h})),Area:xe((function(t,i,s,e){const h=s.value,n={index:i,time:t,value:[h,h,h,h],originalTime:e};return void 0!==s.lineColor&&(n.lineColor=s.lineColor),void 0!==s.topColor&&(n.topColor=s.topColor),void 0!==s.bottomColor&&(n.bottomColor=s.bottomColor),n})),Baseline:xe((function(t,i,s,e){const h=s.value,n={index:i,time:t,value:[h,h,h,h],originalTime:e};return void 0!==s.topLineColor&&(n.topLineColor=s.topLineColor),void 0!==s.bottomLineColor&&(n.bottomLineColor=s.bottomLineColor),void 0!==s.topFillColor1&&(n.topFillColor1=s.topFillColor1),void 0!==s.topFillColor2&&(n.topFillColor2=s.topFillColor2),void 0!==s.bottomFillColor1&&(n.bottomFillColor1=s.bottomFillColor1),void 0!==s.bottomFillColor2&&(n.bottomFillColor2=s.bottomFillColor2),n})),Histogram:xe(Me),Line:xe(Me)};function ye(t){return _e[t]}function ke(t){return 60*t*60*1e3}function Ce(t){return 60*t*1e3}const Te=[{divisor:(Pe=1,1e3*Pe),weight:10},{divisor:Ce(1),weight:20},{divisor:Ce(5),weight:21},{divisor:Ce(30),weight:22},{divisor:ke(1),weight:30},{divisor:ke(3),weight:31},{divisor:ke(6),weight:32},{divisor:ke(12),weight:33}];var Pe;function Re(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let s=Te.length-1;s>=0;--s)if(Math.floor(i.getTime()/Te[s].divisor)!==Math.floor(t.getTime()/Te[s].divisor))return Te[s].weight;return 0}function De(t,i=0){if(0===t.length)return;let s=0===i?null:t[i-1].time.timestamp,e=null!==s?new Date(1e3*s):null,h=0;for(let n=i;n1){const i=Math.ceil(h/(t.length-1)),s=new Date(1e3*(t[0].time.timestamp-i));t[0].timeWeight=Re(new Date(1e3*t[0].time.timestamp),s)}}function Ae(t){if(!Ps(t))throw new Error("time must be of type BusinessDay");const i=new Date(Date.UTC(t.year,t.month-1,t.day,0,0,0,0));return{timestamp:Math.round(i.getTime()/1e3),businessDay:t}}function Ee(t){if(!Rs(t))throw new Error("time must be of type isUTCTimestamp");return{timestamp:t}}function Oe(t){return 0===t.length?null:Ps(t[0].time)?Ae:Ee}function Be(t){return Rs(t)?Ee(t):Ps(t)?Ae(t):Ae(Le(t))}function Le(t){const i=new Date(t);if(isNaN(i.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function ze(t){S(t.time)&&(t.time=Le(t.time))}function Ie(t){return{index:0,mapping:new Map,timePoint:t}}function Ne(t){if(void 0!==t&&0!==t.length)return{firstTime:t[0].time.timestamp,lastTime:t[t.length-1].time.timestamp}}function Ve(t){let i;return t.forEach((t=>{void 0===i&&(i=t.originalTime)})),n(i)}function Fe(t){void 0===t.originalTime&&(t.originalTime=t.time)}class We{constructor(){this._pointDataByTimePoint=new Map,this._seriesRowsBySeries=new Map,this._seriesLastTimePoint=new Map,this._sortedTimePoints=[]}destroy(){this._pointDataByTimePoint.clear(),this._seriesRowsBySeries.clear(),this._seriesLastTimePoint.clear(),this._sortedTimePoints=[]}setSeriesData(t,i){let s=0!==this._pointDataByTimePoint.size,e=!1;const h=this._seriesRowsBySeries.get(t);if(void 0!==h)if(1===this._seriesRowsBySeries.size)s=!1,e=!0,this._pointDataByTimePoint.clear();else for(const i of this._sortedTimePoints)i.pointData.mapping.delete(t)&&(e=!0);let n=[];if(0!==i.length){const s=i;s.forEach((t=>Fe(t))),function(t){t.forEach(ze)}(i);const h=r(Oe(i)),o=ye(t.seriesType());n=s.map((i=>{const s=h(i.time);let n=this._pointDataByTimePoint.get(s.timestamp);void 0===n&&(n=Ie(s),this._pointDataByTimePoint.set(s.timestamp,n),e=!0);const r=o(s,n.index,i,i.originalTime);return n.mapping.set(t,r),r}))}s&&this._cleanupPointsData(),this._setRowsToSeries(t,n);let o=-1;if(e){const t=[];this._pointDataByTimePoint.forEach((i=>{t.push({timeWeight:0,time:i.timePoint,pointData:i,originalTime:Ve(i.mapping)})})),t.sort(((t,i)=>t.time.timestamp-i.time.timestamp)),o=this._replaceTimeScalePoints(t)}return this._getUpdateResponse(t,o,function(t,i){const s=Ne(t),e=Ne(i);if(void 0!==s&&void 0!==e)return{lastBarUpdatedOrNewBarsAddedToTheRight:s.lastTime>=e.lastTime&&s.firstTime>=e.firstTime}}(this._seriesRowsBySeries.get(t),h))}removeSeries(t){return this.setSeriesData(t,[])}updateSeriesData(t,i){const s=i;Fe(s),ze(i);const e=r(Oe([i]))(i.time),h=this._seriesLastTimePoint.get(t);if(void 0!==h&&e.timestampt.time.timestampe.time.timestamp?Se(i)&&s.push(i):Se(i)?s[s.length-1]=i:s.splice(-1,1),this._seriesLastTimePoint.set(t,i.time)}_setRowsToSeries(t,i){0!==i.length?(this._seriesRowsBySeries.set(t,i.filter(Se)),this._seriesLastTimePoint.set(t,i[i.length-1].time)):(this._seriesRowsBySeries.delete(t),this._seriesLastTimePoint.delete(t))}_cleanupPointsData(){for(const t of this._sortedTimePoints)0===t.pointData.mapping.size&&this._pointDataByTimePoint.delete(t.time.timestamp)}_replaceTimeScalePoints(t){let i=-1;for(let s=0;s{0!==i.length&&(t=Math.max(t,i[i.length-1].index))})),t}_getUpdateResponse(t,i,s){const e={series:new Map,timeScale:{baseIndex:this._getBaseIndex()}};if(-1!==i)this._seriesRowsBySeries.forEach(((i,h)=>{e.series.set(h,{data:i,info:h===t?s:void 0})})),this._seriesRowsBySeries.has(t)||e.series.set(t,{data:[],info:s}),e.timeScale.points=this._sortedTimePoints,e.timeScale.firstChangedPointIndex=i;else{const i=this._seriesRowsBySeries.get(t);e.series.set(t,{data:i||[],info:s})}return e}}function je(t,i){t.index=i,t.mapping.forEach((t=>{t.index=i}))}function He(t){return{value:t.value[3],time:t.originalTime}}function $e(t){const i=He(t);return void 0!==t.color&&(i.color=t.color),i}function Ue(t){return{open:t.value[0],high:t.value[1],low:t.value[2],close:t.value[3],time:t.originalTime}}const qe={Area:function(t){const i=He(t);return void 0!==t.lineColor&&(i.lineColor=t.lineColor),void 0!==t.topColor&&(i.topColor=t.topColor),void 0!==t.bottomColor&&(i.bottomColor=t.bottomColor),i},Line:$e,Baseline:function(t){const i=He(t);return void 0!==t.topLineColor&&(i.topLineColor=t.topLineColor),void 0!==t.bottomLineColor&&(i.bottomLineColor=t.bottomLineColor),void 0!==t.topFillColor1&&(i.topFillColor1=t.topFillColor1),void 0!==t.topFillColor2&&(i.topFillColor2=t.topFillColor2),void 0!==t.bottomFillColor1&&(i.bottomFillColor1=t.bottomFillColor1),void 0!==t.bottomFillColor2&&(i.bottomFillColor2=t.bottomFillColor2),i},Histogram:$e,Bar:function(t){const i=Ue(t);return void 0!==t.color&&(i.color=t.color),i},Candlestick:function(t){const i=Ue(t),{color:s,borderColor:e,wickColor:h}=t;return void 0!==s&&(i.color=s),void 0!==e&&(i.borderColor=e),void 0!==h&&(i.wickColor=h),i}};function Ye(t){return qe[t]}const Xe={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2}},Ze={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:C,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"},Ke={width:0,height:0,autoSize:!1,layout:{background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:C},crosshair:{vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},grid:{vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},overlayPriceScales:Object.assign({},Xe),leftPriceScale:Object.assign(Object.assign({},Xe),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Xe),{visible:!0}),timeScale:{rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,ticksVisible:!1},watermark:Ze,localization:{locale:Is?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}},Ge={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Je={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Qe={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},th={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},ih={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},sh={color:"#26a69a",base:0},eh={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};class hh{constructor(t,i){this._chartWidget=t,this._priceScaleId=i}applyOptions(t){this._chartWidget.model().applyPriceScaleOptions(this._priceScaleId,t)}options(){return this._priceScale().options()}width(){return et(this._priceScaleId)?this._chartWidget.getPriceAxisWidth(this._priceScaleId):0}_priceScale(){return r(this._chartWidget.model().findPriceScale(this._priceScaleId)).priceScale}}const nh={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class rh{constructor(t){this._priceLine=t}applyOptions(t){this._priceLine.applyOptions(t)}options(){return this._priceLine.options()}priceLine(){return this._priceLine}}class oh{constructor(t,i,s){this._series=t,this._dataUpdatesConsumer=i,this._priceScaleApiProvider=s}priceFormatter(){return this._series.formatter()}priceToCoordinate(t){const i=this._series.firstValue();return null===i?null:this._series.priceScale().priceToCoordinate(t,i.value)}coordinateToPrice(t){const i=this._series.firstValue();return null===i?null:this._series.priceScale().coordinateToPrice(t,i.value)}barsInLogicalRange(t){if(null===t)return null;const i=new ps(new cs(t.from,t.to)).strictRange(),s=this._series.bars();if(s.isEmpty())return null;const e=s.search(i.left(),1),h=s.search(i.right(),-1),n=r(s.firstIndex()),o=r(s.lastIndex());if(null!==e&&null!==h&&e.index>h.index)return{barsBefore:t.from-n,barsAfter:o-t.to};const l={barsBefore:null===e||e.index===n?t.from-n:e.index-n,barsAfter:null===h||h.index===o?o-t.to:o-h.index};return null!==e&&null!==h&&(l.from=e.time.businessDay||e.time.timestamp,l.to=h.time.businessDay||h.time.timestamp),l}setData(t){this._series.seriesType(),this._dataUpdatesConsumer.applyNewData(this._series,t)}update(t){this._series.seriesType(),this._dataUpdatesConsumer.updateData(this._series,t)}dataByIndex(t,i){const s=this._series.bars().search(t,i);return null===s?null:Ye(this.seriesType())(s)}setMarkers(t){const i=t.map((t=>Object.assign(Object.assign({},t),{originalTime:t.time,time:Be(t.time)})));this._series.setMarkers(i)}markers(){return this._series.markers().map((t=>{const{originalTime:i,time:s}=t,e=function(t,i){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.indexOf(e)<0&&(s[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(e=Object.getOwnPropertySymbols(t);h=1)return 0;let i=0;for(;i<8;i++){const s=Math.round(t);if(Math.abs(s-t)<1e-8)return i;t*=10}return i}(i.minMove))}function ch(t){return function(t){if(x(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){const{axisPressedMouseMove:i,axisDoubleClickReset:s}=t.handleScale;x(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),x(s)&&(t.handleScale.axisDoubleClickReset={time:s,price:s})}const i=t.handleScroll;x(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class dh{constructor(t,i){this._dataLayer=new We,this._seriesMap=new Map,this._seriesMapReversed=new Map,this._clickedDelegate=new b,this._crosshairMovedDelegate=new b;const s=void 0===i?_(Ke):g(_(Ke),ch(i));this._chartWidget=new ge(t,s),this._chartWidget.clicked().subscribe((t=>{this._clickedDelegate.hasListeners()&&this._clickedDelegate.fire(this._convertMouseParams(t()))}),this),this._chartWidget.crosshairMoved().subscribe((t=>{this._crosshairMovedDelegate.hasListeners()&&this._crosshairMovedDelegate.fire(this._convertMouseParams(t()))}),this);const e=this._chartWidget.model();this._timeScaleApi=new ah(e,this._chartWidget.timeAxisWidget())}remove(){this._chartWidget.clicked().unsubscribeAll(this),this._chartWidget.crosshairMoved().unsubscribeAll(this),this._timeScaleApi.destroy(),this._chartWidget.destroy(),this._seriesMap.clear(),this._seriesMapReversed.clear(),this._clickedDelegate.destroy(),this._crosshairMovedDelegate.destroy(),this._dataLayer.destroy()}resize(t,i,s){this.autoSizeActive()||this._chartWidget.resize(t,i,s)}addAreaSeries(t){return this._addSeriesImpl("Area",th,t)}addBaselineSeries(t){return this._addSeriesImpl("Baseline",ih,t)}addBarSeries(t){return this._addSeriesImpl("Bar",Je,t)}addCandlestickSeries(t={}){return function(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}(t),this._addSeriesImpl("Candlestick",Ge,t)}addHistogramSeries(t){return this._addSeriesImpl("Histogram",sh,t)}addLineSeries(t){return this._addSeriesImpl("Line",Qe,t)}removeSeries(t){const i=n(this._seriesMap.get(t)),s=this._dataLayer.removeSeries(i);this._chartWidget.model().removeSeries(i),this._sendUpdateToChart(s),this._seriesMap.delete(t),this._seriesMapReversed.delete(i)}applyNewData(t,i){this._sendUpdateToChart(this._dataLayer.setSeriesData(t,i))}updateData(t,i){this._sendUpdateToChart(this._dataLayer.updateSeriesData(t,i))}subscribeClick(t){this._clickedDelegate.subscribe(t)}unsubscribeClick(t){this._clickedDelegate.unsubscribe(t)}subscribeCrosshairMove(t){this._crosshairMovedDelegate.subscribe(t)}setCrosshairXY(t,i,s){this._chartWidget.paneWidgets()[0].setCrosshair(t,i,s)}unsubscribeCrosshairMove(t){this._crosshairMovedDelegate.unsubscribe(t)}priceScale(t){return new hh(this._chartWidget,t)}timeScale(){return this._timeScaleApi}applyOptions(t){this._chartWidget.applyOptions(ch(t))}options(){return this._chartWidget.options()}takeScreenshot(){return this._chartWidget.takeScreenshot()}autoSizeActive(){return this._chartWidget.autoSizeActive()}_addSeriesImpl(t,i,s={}){uh(s.priceFormat);const e=g(_(eh),_(i),s),h=this._chartWidget.model().createSeries(t,e),n=new oh(h,this,this);return this._seriesMap.set(n,h),this._seriesMapReversed.set(h,n),n}_sendUpdateToChart(t){const i=this._chartWidget.model();i.updateTimeScale(t.timeScale.baseIndex,t.timeScale.points,t.timeScale.firstChangedPointIndex),t.series.forEach(((t,i)=>i.setData(t.data,t.info))),i.recalculateAllPanes()}_mapSeriesToApi(t){return n(this._seriesMapReversed.get(t))}_convertMouseParams(t){const i=new Map;t.seriesData.forEach(((t,s)=>{const e=Ye(s.seriesType())(t);h(function(t){return void 0!==t.open||void 0!==t.value}(e)),i.set(this._mapSeriesToApi(s),e)}));const s=void 0===t.hoveredSeries?void 0:this._mapSeriesToApi(t.hoveredSeries);return{time:t.time,logical:t.index,point:t.point,hoveredSeries:s,hoveredObjectId:t.hoveredObject,seriesData:i,sourceEvent:t.touchMouseEventData}}}var fh=Object.freeze({__proto__:null,get ColorType(){return xs},get CrosshairMode(){return J},get LastPriceAnimationMode(){return ws},get LineStyle(){return i},get LineType(){return t},get MismatchDirection(){return Di},get PriceLineSource(){return Ss},get PriceScaleMode(){return Qi},get TickMarkType(){return vs},get TrackingModeExitMode(){return gs},createChart:function(t,i){let s;if(S(t)){const i=document.getElementById(t);h(null!==i,`Cannot find element in DOM with id=${t}`),s=i}else s=t;return new dh(s,i)},isBusinessDay:Ps,isUTCTimestamp:Rs,version:function(){return"4.1.0-dev+202306102016"}});window.LightweightCharts=fh}(); -""" \ No newline at end of file +!function(){"use strict";var t,i;function s(t,i){const s={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[i];t.setLineDash(s)}function e(t,i,s,e){t.beginPath();const h=t.lineWidth%2?.5:0;t.moveTo(s,i+h),t.lineTo(e,i+h),t.stroke()}function h(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function n(t){if(void 0===t)throw new Error("Value is undefined");return t}function r(t){if(null===t)throw new Error("Value is null");return t}function o(t){return r(n(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"}(t||(t={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(i||(i={}));const l={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function a(t){return t<0?0:t>255?255:Math.round(t)||0}function u(t){return t<=0||t>0?t<0?0:t>1?1:Math.round(1e4*t)/1e4:0}const c=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,d=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,f=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,p=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/;function m(t){(t=t.toLowerCase())in l&&(t=l[t]);{const i=p.exec(t)||f.exec(t);if(i)return[a(parseInt(i[1],10)),a(parseInt(i[2],10)),a(parseInt(i[3],10)),u(i.length<5?1:parseFloat(i[4]))]}{const i=d.exec(t);if(i)return[a(parseInt(i[1],16)),a(parseInt(i[2],16)),a(parseInt(i[3],16)),1]}{const i=c.exec(t);if(i)return[a(17*parseInt(i[1],16)),a(17*parseInt(i[2],16)),a(17*parseInt(i[3],16)),1]}throw new Error(`Cannot parse color: ${t}`)}function v(t){const i=m(t);return{background:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,foreground:(s=i,.199*s[0]+.687*s[1]+.114*s[2]>160?"black":"white")};var s}class b{constructor(){this._listeners=[]}subscribe(t,i,s){const e={callback:t,linkedObject:i,singleshot:!0===s};this._listeners.push(e)}unsubscribe(t){const i=this._listeners.findIndex((i=>t===i.callback));i>-1&&this._listeners.splice(i,1)}unsubscribeAll(t){this._listeners=this._listeners.filter((i=>i.linkedObject!==t))}fire(t,i,s){const e=[...this._listeners];this._listeners=this._listeners.filter((t=>!t.singleshot)),e.forEach((e=>e.callback(t,i,s)))}hasListeners(){return this._listeners.length>0}destroy(){this._listeners=[]}}function g(t,...i){for(const s of i)for(const i in s)void 0!==s[i]&&("object"!=typeof s[i]||void 0===t[i]?t[i]=s[i]:g(t[i],s[i]));return t}function w(t){return"number"==typeof t&&isFinite(t)}function M(t){return"number"==typeof t&&t%1==0}function S(t){return"string"==typeof t}function x(t){return"boolean"==typeof t}function _(t){const i=t;if(!i||"object"!=typeof i)return i;let s,e,h;for(e in s=Array.isArray(i)?[]:{},i)i.hasOwnProperty(e)&&(h=i[e],s[e]=h&&"object"==typeof h?_(h):h);return s}function y(t){return null!==t}function k(t){return null===t?void 0:t}const C="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function T(t,i,s){return void 0===i&&(i=C),`${s=void 0!==s?`${s} `:""}${t}px ${i}`}var P;!function(t){t[t.BorderSize=1]="BorderSize",t[t.TickLength=5]="TickLength"}(P||(P={}));class R{constructor(t){this._rendererOptions={borderSize:1,tickLength:5,fontSize:NaN,font:"",fontFamily:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,baselineOffset:0},this._chartModel=t}options(){const t=this._rendererOptions,i=this._fontSize(),s=this._fontFamily();return t.fontSize===i&&t.fontFamily===s||(t.fontSize=i,t.fontFamily=s,t.font=T(i,s),t.paddingTop=2.5/12*i,t.paddingBottom=t.paddingTop,t.paddingInner=i/12*t.tickLength,t.paddingOuter=i/12*t.tickLength,t.baselineOffset=0),t.color=this._textColor(),t.paneBackgroundColor=this._paneBackgroundColor(),this._rendererOptions}_textColor(){return this._chartModel.options().layout.textColor}_paneBackgroundColor(){return this._chartModel.backgroundTopColor()}_fontSize(){return this._chartModel.options().layout.fontSize}_fontFamily(){return this._chartModel.options().layout.fontFamily}}class D{constructor(){this._renderers=[]}setRenderers(t){this._renderers=t}draw(t,i,s){this._renderers.forEach((e=>{e.draw(t,i,s)}))}}class A{draw(t,i,s){t.useMediaCoordinateSpace((t=>this._drawImpl(t,i,s)))}drawBackground(t,i,s){t.useMediaCoordinateSpace((t=>this._drawBackgroundImpl(t,i,s)))}_drawBackgroundImpl(t,i,s){}}class E extends A{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}_drawImpl({context:t}){if(null===this._data||null===this._data.visibleRange)return;const i=this._data.visibleRange,s=this._data,e=e=>{t.beginPath();for(let h=i.to-1;h>=i.from;--h){const i=s.items[h];t.moveTo(i.x,i.y),t.arc(i.x,i.y,e,0,2*Math.PI)}t.fill()};s.lineWidth>0&&(t.fillStyle=s.backColor,e(s.radius+s.lineWidth)),t.fillStyle=s.lineColor,e(s.radius)}}function O(){return{items:[{x:0,y:0,time:0,price:0}],lineColor:"",backColor:"",radius:0,lineWidth:0,visibleRange:null}}const B={from:0,to:1};class L{constructor(t,i){this._compositeRenderer=new D,this._markersRenderers=[],this._markersData=[],this._invalidated=!0,this._chartModel=t,this._crosshair=i,this._compositeRenderer.setRenderers(this._markersRenderers)}update(t){const i=this._chartModel.serieses();i.length!==this._markersRenderers.length&&(this._markersData=i.map(O),this._markersRenderers=this._markersData.map((t=>{const i=new E;return i.setData(t),i})),this._compositeRenderer.setRenderers(this._markersRenderers)),this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._compositeRenderer}_updateImpl(){const t=this._chartModel.serieses(),i=this._crosshair.appliedIndex(),s=this._chartModel.timeScale();t.forEach(((t,e)=>{var h;const n=this._markersData[e],o=t.markerDataAtIndex(i);if(null===o||!t.visible())return void(n.visibleRange=null);const l=r(t.firstValue());n.lineColor=o.backgroundColor,n.radius=o.radius,n.lineWidth=o.borderWidth,n.items[0].price=o.price,n.items[0].y=t.priceScale().priceToCoordinate(o.price,l.value),n.backColor=null!==(h=o.borderColor)&&void 0!==h?h:this._chartModel.backgroundColorAtYPercentFromTop(n.items[0].y/t.priceScale().height()),n.items[0].time=i,n.items[0].x=s.indexToCoordinate(i),n.visibleRange=B}))}}class z{draw(t,i,s){t.useBitmapCoordinateSpace((t=>this._drawImpl(t,i,s)))}}class I extends z{constructor(t){super(),this._data=t}_drawImpl({context:t,bitmapSize:i,horizontalPixelRatio:h,verticalPixelRatio:n}){if(null===this._data)return;const r=this._data.vertLine.visible,o=this._data.horzLine.visible;if(!r&&!o)return;const l=Math.round(this._data.x*h),a=Math.round(this._data.y*n);t.lineCap="butt",r&&l>=0&&(t.lineWidth=Math.floor(this._data.vertLine.lineWidth*h),t.strokeStyle=this._data.vertLine.color,t.fillStyle=this._data.vertLine.color,s(t,this._data.vertLine.lineStyle),function(t,i,s,e){t.beginPath();const h=t.lineWidth%2?.5:0;t.moveTo(i+h,s),t.lineTo(i+h,e),t.stroke()}(t,l,0,i.height)),o&&a>=0&&(t.lineWidth=Math.floor(this._data.horzLine.lineWidth*n),t.strokeStyle=this._data.horzLine.color,t.fillStyle=this._data.horzLine.color,s(t,this._data.horzLine.lineStyle),e(t,a,0,i.width))}}class N{constructor(t){this._invalidated=!0,this._rendererData={vertLine:{lineWidth:1,lineStyle:0,color:"",visible:!1},horzLine:{lineWidth:1,lineStyle:0,color:"",visible:!1},x:0,y:0},this._renderer=new I(this._rendererData),this._source=t}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){const t=this._source.visible(),i=r(this._source.pane()),s=i.model().options().crosshair,e=this._rendererData;e.horzLine.visible=t&&this._source.horzLineVisible(i),e.vertLine.visible=t&&this._source.vertLineVisible(),e.horzLine.lineWidth=s.horzLine.width,e.horzLine.lineStyle=s.horzLine.style,e.horzLine.color=s.horzLine.color,e.vertLine.lineWidth=s.vertLine.width,e.vertLine.lineStyle=s.vertLine.style,e.vertLine.color=s.vertLine.color,e.x=this._source.appliedX(),e.y=this._source.appliedY()}}function V(t,i,s,e,h,n){t.fillRect(i+n,s,e-2*n,n),t.fillRect(i+n,s+h-n,e-2*n,n),t.fillRect(i,s,n,h),t.fillRect(i+e-n,s,n,h)}function F(t,i,s,e,h,n){t.save(),t.globalCompositeOperation="copy",t.fillStyle=n,t.fillRect(i,s,e,h),t.restore()}function W(t,i){return Array.isArray(t)?t.map((t=>0===t?t:t+i)):t+i}function j(t,i,s,e,h,n){let r,o,l,a;if(Array.isArray(n))if(2===n.length){const t=Math.max(0,n[0]),i=Math.max(0,n[1]);r=t,o=t,l=i,a=i}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");r=Math.max(0,n[0]),o=Math.max(0,n[1]),l=Math.max(0,n[2]),a=Math.max(0,n[3])}else{const t=Math.max(0,n);r=t,o=t,l=t,a=t}t.beginPath(),t.moveTo(i+r,s),t.lineTo(i+e-o,s),0!==o&&t.arcTo(i+e,s,i+e,s+o,o),t.lineTo(i+e,s+h-l),0!==l&&t.arcTo(i+e,s+h,i+e-l,s+h,l),t.lineTo(i+a,s+h),0!==a&&t.arcTo(i,s+h,i,s+h-a,a),t.lineTo(i,s+r),0!==r&&t.arcTo(i,s,i+r,s,r)}function H(t,i,s,e,h,n,r=0,o=0,l=""){if(t.save(),!r||!l||l===n)return j(t,i,s,e,h,o),t.fillStyle=n,t.fill(),void t.restore();const a=r/2;if("transparent"!==n){j(t,i+r,s+r,e-2*r,h-2*r,W(o,-r)),t.fillStyle=n,t.fill()}if("transparent"!==l){j(t,i+a,s+a,e-r,h-r,W(o,-a)),t.lineWidth=r,t.strokeStyle=l,t.closePath(),t.stroke()}t.restore()}function $(t,i,s,e,h,n,r){t.save(),t.globalCompositeOperation="copy";const o=t.createLinearGradient(0,0,0,h);o.addColorStop(0,n),o.addColorStop(1,r),t.fillStyle=o,t.fillRect(i,s,e,h),t.restore()}class U{constructor(t,i){this.setData(t,i)}setData(t,i){this._data=t,this._commonData=i}height(t,i){return this._data.visible?t.fontSize+t.paddingTop+t.paddingBottom:0}draw(t,i,s,e){if(!this._data.visible||0===this._data.text.length)return;const h=this._data.color,n=this._commonData.background,r=t.useBitmapCoordinateSpace((t=>{const r=t.context;r.font=i.font;const o=this._calculateGeometry(t,i,s,e),l=o.bitmap,a=(t,i)=>{o.alignRight?H(r,l.xOutside,l.yTop,l.totalWidth,l.totalHeight,t,l.horzBorder,[l.radius,0,0,l.radius],i):H(r,l.xInside,l.yTop,l.totalWidth,l.totalHeight,t,l.horzBorder,[0,l.radius,l.radius,0],i)};return a(n,"transparent"),this._data.tickVisible&&(r.fillStyle=h,r.fillRect(l.xInside,l.yMid,l.xTick-l.xInside,l.tickHeight)),a("transparent",n),this._data.borderVisible&&(r.fillStyle=i.paneBackgroundColor,r.fillRect(o.alignRight?l.right-l.horzBorder:0,l.yTop,l.horzBorder,l.yBottom-l.yTop)),o}));t.useMediaCoordinateSpace((({context:t})=>{const s=r.media;t.font=i.font,t.textAlign=r.alignRight?"right":"left",t.textBaseline="middle",t.fillStyle=h,t.fillText(this._data.text,s.xText,(s.yTop+s.yBottom)/2+s.textMidCorrection)}))}_calculateGeometry(t,i,s,e){var h;const{context:n,bitmapSize:r,mediaSize:o,horizontalPixelRatio:l,verticalPixelRatio:a}=t,u=this._data.tickVisible||!this._data.moveTextToInvisibleTick?i.tickLength:0,c=this._data.separatorVisible?i.borderSize:0,d=i.paddingTop+this._commonData.additionalPaddingTop,f=i.paddingBottom+this._commonData.additionalPaddingBottom,p=i.paddingInner,m=i.paddingOuter,v=this._data.text,b=i.fontSize,g=s.yMidCorrection(n,v),w=Math.ceil(s.measureText(n,v)),M=b+d+f,S=i.borderSize+p+m+w+u,x=Math.max(1,Math.floor(a));let _=Math.round(M*a);_%2!=x%2&&(_+=1);const y=c>0?Math.max(1,Math.floor(c*l)):0,k=Math.round(S*l),C=Math.round(u*l),T=null!==(h=this._commonData.fixedCoordinate)&&void 0!==h?h:this._commonData.coordinate,P=Math.round(T*a)-Math.floor(.5*a),R=Math.floor(P+x/2-_/2),D=R+_,A="right"===e,E=A?o.width-c:c,O=A?r.width-y:y;let B,L,z;return A?(B=O-k,L=O-C,z=E-u-p-c):(B=O+k,L=O+C,z=E+u+p),{alignRight:A,bitmap:{yTop:R,yMid:P,yBottom:D,totalWidth:k,totalHeight:_,radius:2*l,horzBorder:y,xOutside:B,xInside:O,xTick:L,tickHeight:x,right:r.width},media:{yTop:R/a,yBottom:D/a,xText:z,textMidCorrection:g}}}}class q{constructor(t){this._commonRendererData={coordinate:0,background:"#000",additionalPaddingBottom:0,additionalPaddingTop:0},this._axisRendererData={text:"",visible:!1,tickVisible:!0,moveTextToInvisibleTick:!1,borderColor:"",color:"#FFF",borderVisible:!1,separatorVisible:!1},this._paneRendererData={text:"",visible:!1,tickVisible:!1,moveTextToInvisibleTick:!0,borderColor:"",color:"#FFF",borderVisible:!0,separatorVisible:!0},this._invalidated=!0,this._axisRenderer=new(t||U)(this._axisRendererData,this._commonRendererData),this._paneRenderer=new(t||U)(this._paneRendererData,this._commonRendererData)}text(){return this._updateRendererDataIfNeeded(),this._axisRendererData.text}coordinate(){return this._updateRendererDataIfNeeded(),this._commonRendererData.coordinate}update(){this._invalidated=!0}height(t,i=!1){return Math.max(this._axisRenderer.height(t,i),this._paneRenderer.height(t,i))}getFixedCoordinate(){return this._commonRendererData.fixedCoordinate||0}setFixedCoordinate(t){this._commonRendererData.fixedCoordinate=t}isVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible||this._paneRendererData.visible}isAxisLabelVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible}renderer(t){return this._updateRendererDataIfNeeded(),this._axisRendererData.tickVisible=this._axisRendererData.tickVisible&&t.options().ticksVisible,this._paneRendererData.tickVisible=this._paneRendererData.tickVisible&&t.options().ticksVisible,this._axisRenderer.setData(this._axisRendererData,this._commonRendererData),this._paneRenderer.setData(this._paneRendererData,this._commonRendererData),this._axisRenderer}paneRenderer(){return this._updateRendererDataIfNeeded(),this._axisRenderer.setData(this._axisRendererData,this._commonRendererData),this._paneRenderer.setData(this._paneRendererData,this._commonRendererData),this._paneRenderer}_updateRendererDataIfNeeded(){this._invalidated&&(this._axisRendererData.tickVisible=!0,this._paneRendererData.tickVisible=!1,this._updateRendererData(this._axisRendererData,this._paneRendererData,this._commonRendererData))}}class Y extends q{constructor(t,i,s){super(),this._source=t,this._priceScale=i,this._valueProvider=s}_updateRendererData(t,i,s){t.visible=!1;const e=this._source.options().horzLine;if(!e.labelVisible)return;const h=this._priceScale.firstValue();if(!this._source.visible()||this._priceScale.isEmpty()||null===h)return;const n=v(e.labelBackgroundColor);s.background=n.background,t.color=n.foreground;const r=2/12*this._priceScale.fontSize();s.additionalPaddingTop=r,s.additionalPaddingBottom=r;const o=this._valueProvider(this._priceScale);s.coordinate=o.coordinate,t.text=this._priceScale.formatPrice(o.price,h),t.visible=!0}}const X=/[1-9]/g;class Z{constructor(){this._data=null}setData(t){this._data=t}draw(t,i){if(null===this._data||!1===this._data.visible||0===this._data.text.length)return;const s=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.font,Math.round(i.widthCache.measureText(t,r(this._data).text,X)))));if(s<=0)return;const e=i.paddingHorizontal,h=s+2*e,n=h/2,o=this._data.width;let l=this._data.coordinate,a=Math.floor(l-n)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-n)+.5):a+h>o&&(l-=Math.abs(o-(a+h)),a=Math.floor(l-n)+.5);const u=a+h,c=Math.ceil(0+i.borderSize+i.tickLength+i.paddingTop+i.fontSize+i.paddingBottom);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:s,verticalPixelRatio:e})=>{const h=r(this._data);t.fillStyle=h.background;const n=Math.round(a*s),o=Math.round(0*e),l=Math.round(u*s),d=Math.round(c*e),f=Math.round(2*s);if(t.beginPath(),t.moveTo(n,o),t.lineTo(n,d-f),t.arcTo(n,d,n+f,d,f),t.lineTo(l-f,d),t.arcTo(l,d,l,d-f,f),t.lineTo(l,o),t.fill(),h.tickVisible){const n=Math.round(h.coordinate*s),r=o,l=Math.round((r+i.tickLength)*e);t.fillStyle=h.color;const a=Math.max(1,Math.floor(s)),u=Math.floor(.5*s);t.fillRect(n-u,r,a,l-r)}})),t.useMediaCoordinateSpace((({context:t})=>{const s=r(this._data),h=0+i.borderSize+i.tickLength+i.paddingTop+i.fontSize/2;t.font=i.font,t.textAlign="left",t.textBaseline="middle",t.fillStyle=s.color;const n=i.widthCache.yMidCorrection(t,"Apr0");t.translate(a+e,h+n),t.fillText(s.text,0,0)}))}}class K{constructor(t,i,s){this._invalidated=!0,this._renderer=new Z,this._rendererData={visible:!1,background:"#4c525e",color:"white",text:"",width:0,coordinate:NaN,tickVisible:!0},this._crosshair=t,this._model=i,this._valueProvider=s}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer.setData(this._rendererData),this._renderer}_updateImpl(){const t=this._rendererData;t.visible=!1;const i=this._crosshair.options().vertLine;if(!i.labelVisible)return;const s=this._model.timeScale();if(s.isEmpty())return;t.width=s.width();const e=this._valueProvider();if(null===e)return;t.coordinate=e.coordinate;const h=s.indexToTimeScalePoint(this._crosshair.appliedIndex());t.text=s.formatDateTime(r(h)),t.visible=!0;const n=v(i.labelBackgroundColor);t.background=n.background,t.color=n.foreground,t.tickVisible=s.options().ticksVisible}}class G{constructor(){this._priceScale=null,this._zorder=0}zorder(){return this._zorder}setZorder(t){this._zorder=t}priceScale(){return this._priceScale}setPriceScale(t){this._priceScale=t}labelPaneViews(t){return[]}timeAxisViews(){return[]}visible(){return!0}}var J,Q,tt,it;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet"}(J||(J={}));class st extends G{constructor(t,i){super(),this._pane=null,this._price=NaN,this._index=0,this._visible=!0,this._priceAxisViews=new Map,this._subscribed=!1,this._x=NaN,this._y=NaN,this._originX=NaN,this._originY=NaN,this._model=t,this._options=i,this._markersPaneView=new L(t,this);this._currentPosPriceProvider=((t,i)=>s=>{const e=i(),h=t();if(s===r(this._pane).defaultPriceScale())return{price:h,coordinate:e};{const t=r(s.firstValue());return{price:s.coordinateToPrice(e,t),coordinate:e}}})((()=>this._price),(()=>this._y));const s=((t,i)=>()=>{const s=this._model.timeScale().indexToTime(t()),e=i();return s&&Number.isFinite(e)?{time:s,coordinate:e}:null})((()=>this._index),(()=>this.appliedX()));this._timeAxisView=new K(this,t,s),this._paneView=new N(this)}options(){return this._options}saveOriginCoord(t,i){this._originX=t,this._originY=i}clearOriginCoord(){this._originX=NaN,this._originY=NaN}originCoordX(){return this._originX}originCoordY(){return this._originY}setPosition(t,i,s){this._subscribed||(this._subscribed=!0),this._visible=!0,this._tryToUpdateViews(t,i,s)}appliedIndex(){return this._index}appliedX(){return this._x}appliedY(){return this._y}visible(){return this._visible}clearPosition(){this._visible=!1,this._setIndexToLastSeriesBarIndex(),this._price=NaN,this._x=NaN,this._y=NaN,this._pane=null,this.clearOriginCoord()}paneViews(t){return null!==this._pane?[this._paneView,this._markersPaneView]:[]}horzLineVisible(t){return t===this._pane&&this._options.horzLine.visible}vertLineVisible(){return this._options.vertLine.visible}priceAxisViews(t,i){this._visible&&this._pane===t||this._priceAxisViews.clear();const s=[];return this._pane===t&&s.push(this._createPriceAxisViewOnDemand(this._priceAxisViews,i,this._currentPosPriceProvider)),s}timeAxisViews(){return this._visible?[this._timeAxisView]:[]}pane(){return this._pane}updateAllViews(){this._paneView.update(),this._priceAxisViews.forEach((t=>t.update())),this._timeAxisView.update(),this._markersPaneView.update()}_priceScaleByPane(t){return t&&!t.defaultPriceScale().isEmpty()?t.defaultPriceScale():null}_tryToUpdateViews(t,i,s){this._tryToUpdateData(t,i,s)&&this.updateAllViews()}_tryToUpdateData(t,i,s){const e=this._x,h=this._y,n=this._price,r=this._index,o=this._pane,l=this._priceScaleByPane(s);this._index=t,this._x=isNaN(t)?NaN:this._model.timeScale().indexToCoordinate(t),this._pane=s;const a=null!==l?l.firstValue():null;return null!==l&&null!==a?(this._price=i,this._y=l.priceToCoordinate(i,a)):(this._price=NaN,this._y=NaN),e!==this._x||h!==this._y||r!==this._index||n!==this._price||o!==this._pane}_setIndexToLastSeriesBarIndex(){const t=this._model.serieses().map((t=>t.bars().lastIndex())).filter(y),i=0===t.length?null:Math.max(...t);this._index=null!==i?i:NaN}_createPriceAxisViewOnDemand(t,i,s){let e=t.get(i);return void 0===e&&(e=new Y(this,i,s),t.set(i,e)),e}}function et(t){return"left"===t||"right"===t}!function(t){t.Left="left",t.Right="right"}(Q||(Q={})),function(t){t[t.None=0]="None",t[t.Cursor=1]="Cursor",t[t.Light=2]="Light",t[t.Full=3]="Full"}(tt||(tt={})),function(t){t[t.FitContent=0]="FitContent",t[t.ApplyRange=1]="ApplyRange",t[t.ApplyBarSpacing=2]="ApplyBarSpacing",t[t.ApplyRightOffset=3]="ApplyRightOffset",t[t.Reset=4]="Reset",t[t.Animation=5]="Animation",t[t.StopAnimation=6]="StopAnimation"}(it||(it={}));class ht{constructor(t){this._invalidatedPanes=new Map,this._timeScaleInvalidations=[],this._globalLevel=t}invalidatePane(t,i){const s=function(t,i){return void 0===t?i:{level:Math.max(t.level,i.level),autoScale:t.autoScale||i.autoScale}}(this._invalidatedPanes.get(t),i);this._invalidatedPanes.set(t,s)}fullInvalidation(){return this._globalLevel}invalidateForPane(t){const i=this._invalidatedPanes.get(t);return void 0===i?{level:this._globalLevel}:{level:Math.max(this._globalLevel,i.level),autoScale:i.autoScale}}setFitContent(){this.stopTimeScaleAnimation(),this._timeScaleInvalidations=[{type:0}]}applyRange(t){this.stopTimeScaleAnimation(),this._timeScaleInvalidations=[{type:1,value:t}]}setTimeScaleAnimation(t){this._removeTimeScaleAnimation(),this._timeScaleInvalidations.push({type:5,value:t})}stopTimeScaleAnimation(){this._removeTimeScaleAnimation(),this._timeScaleInvalidations.push({type:6})}resetTimeScale(){this.stopTimeScaleAnimation(),this._timeScaleInvalidations=[{type:4}]}setBarSpacing(t){this.stopTimeScaleAnimation(),this._timeScaleInvalidations.push({type:2,value:t})}setRightOffset(t){this.stopTimeScaleAnimation(),this._timeScaleInvalidations.push({type:3,value:t})}timeScaleInvalidations(){return this._timeScaleInvalidations}merge(t){for(const i of t._timeScaleInvalidations)this._applyTimeScaleInvalidation(i);this._globalLevel=Math.max(this._globalLevel,t._globalLevel),t._invalidatedPanes.forEach(((t,i)=>{this.invalidatePane(i,t)}))}static light(){return new ht(2)}static full(){return new ht(3)}_applyTimeScaleInvalidation(t){switch(t.type){case 0:this.setFitContent();break;case 1:this.applyRange(t.value);break;case 2:this.setBarSpacing(t.value);break;case 3:this.setRightOffset(t.value);break;case 4:this.resetTimeScale();break;case 5:this.setTimeScaleAnimation(t.value);break;case 6:this._removeTimeScaleAnimation()}}_removeTimeScaleAnimation(){const t=this._timeScaleInvalidations.findIndex((t=>5===t.type));-1!==t&&this._timeScaleInvalidations.splice(t,1)}}const nt=".";function rt(t,i){if(!w(t))return"n/a";if(!M(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return("0000000000000000"+t.toString()).slice(-i)}class ot{constructor(t,i){if(i||(i=1),w(t)&&M(t)||(t=100),t<0)throw new TypeError("invalid base");this._priceScale=t,this._minMove=i,this._calculateDecimal()}format(t){const i=t<0?"−":"";return t=Math.abs(t),i+this._formatAsDecimal(t)}_calculateDecimal(){if(this._fractionalLength=0,this._priceScale>0&&this._minMove>0){let t=this._priceScale;for(;t>1;)t/=10,this._fractionalLength++}}_formatAsDecimal(t){const i=this._priceScale/this._minMove;let s=Math.floor(t),e="";const h=void 0!==this._fractionalLength?this._fractionalLength:NaN;if(i>1){let n=+(Math.round(t*i)-s*i).toFixed(this._fractionalLength);n>=i&&(n-=i,s+=1),e=nt+rt(+n.toFixed(this._fractionalLength)*this._minMove,h)}else s=Math.round(s*i)/i,h>0&&(e=nt+rt(0,h));return s.toFixed(0)+e}}class lt extends ot{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class at{constructor(t){this._precision=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this._formatNumber(t):t<999995?i+this._formatNumber(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this._formatNumber(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this._formatNumber(t/1e9)+"B")}_formatNumber(t){let i;const s=Math.pow(10,this._precision);return i=(t=Math.round(t*s)/s)>=1e-15&&t<1?t.toFixed(this._precision).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}function ut(t,i,s,e,h,n,r){if(0===i.length||e.from>=i.length||e.to<=0)return;const o=t.context,l=i[e.from];let a=n(t,l),u=l;if(e.to-e.from<2){const t=h/2;o.beginPath();const i={x:l.x-t,y:l.y},s={x:l.x+t,y:l.y};return o.moveTo(i.x,i.y),o.lineTo(s.x,s.y),void r(o,a,i,s)}const c=(t,i)=>{r(o,a,u,i),o.beginPath(),a=t,u=i};let d=u;o.beginPath(),o.moveTo(l.x,l.y);for(let h=e.from+1;h>1,r=e+h;s(t[r],i)?(e=r+1,n-=h+1):n=h}return e}function xt(t,i,s,e=0,h=t.length){let n=h-e;for(;0>1,r=e+h;s(i,t[r])?n=h:(e=r+1,n-=h+1)}return e}var _t,yt;function kt(t,i){return t.time0&&n=e&&(o=n-1),r>0&&rObject.assign(Object.assign({},t),this._series.barColorer().barStyle(t.time))))}_clearVisibleRange(){this._itemsVisibleRange=null}_makeValid(){this._dataInvalidated&&(this._fillRawPoints(),this._dataInvalidated=!1),this._optionsInvalidated&&(this._updateOptions(),this._optionsInvalidated=!1),this._invalidated&&(this._makeValidImpl(),this._invalidated=!1)}_makeValidImpl(){const t=this._series.priceScale(),i=this._model.timeScale();if(this._clearVisibleRange(),i.isEmpty()||t.isEmpty())return;const s=i.visibleStrictRange();if(null===s)return;if(0===this._series.bars().size())return;const e=this._series.firstValue();null!==e&&(this._itemsVisibleRange=Tt(this._items,s,this._extendedVisibleRange),this._convertToCoordinates(t,i,e.value),this._prepareRendererData())}}class Rt extends Pt{constructor(t,i){super(t,i,!0)}_convertToCoordinates(t,i,s){i.indexesToCoordinates(this._items,k(this._itemsVisibleRange)),t.pointsArrayToCoordinates(this._items,s,k(this._itemsVisibleRange))}_createRawItemBase(t,i){return{time:t,price:i,x:NaN,y:NaN}}_fillRawPoints(){const t=this._series.barColorer();this._items=this._series.bars().rows().map((i=>{const s=i.value[3];return this._createRawItem(i.index,s,t)}))}}class Dt extends Rt{constructor(t,i){super(t,i),this._renderer=new D,this._areaRenderer=new bt,this._lineRenderer=new Mt,this._renderer.setRenderers([this._areaRenderer,this._lineRenderer])}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options();this._areaRenderer.setData({lineType:t.lineType,items:this._items,lineStyle:t.lineStyle,lineWidth:t.lineWidth,baseLevelCoordinate:null,invertFilledArea:t.invertFilledArea,visibleRange:this._itemsVisibleRange,barWidth:this._model.timeScale().barSpacing()}),this._lineRenderer.setData({lineType:t.lineType,items:this._items,lineStyle:t.lineStyle,lineWidth:t.lineWidth,visibleRange:this._itemsVisibleRange,barWidth:this._model.timeScale().barSpacing()})}}class At extends z{constructor(){super(...arguments),this._data=null,this._barWidth=0,this._barLineWidth=0}setData(t){this._data=t}_drawImpl({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this._data||0===this._data.bars.length||null===this._data.visibleRange)return;if(this._barWidth=this._calcBarWidth(i),this._barWidth>=2){Math.max(1,Math.floor(i))%2!=this._barWidth%2&&this._barWidth--}this._barLineWidth=this._data.thinBars?Math.min(this._barWidth,Math.floor(i)):this._barWidth;let e=null;const h=this._barLineWidth<=this._barWidth&&this._data.barSpacing>=Math.floor(1.5*i);for(let n=this._data.visibleRange.from;np+v-1&&(h=p+v-1,e=h-u+1),t.fillRect(i,e,a-i,h-e+1)}const i=l+b;let e=Math.max(p,Math.round(r.closeY*s)-o),h=e+u-1;h>p+v-1&&(h=p+v-1,e=h-u+1),t.fillRect(c+1,e,i-c,h-e+1)}}}_calcBarWidth(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(r(this._data).barSpacing,t)))}}class Et extends Pt{constructor(t,i){super(t,i,!1)}_convertToCoordinates(t,i,s){i.indexesToCoordinates(this._items,k(this._itemsVisibleRange)),t.barPricesToCoordinates(this._items,s,k(this._itemsVisibleRange))}_createDefaultItem(t,i,s){return{time:t,open:i.value[0],high:i.value[1],low:i.value[2],close:i.value[3],x:NaN,openY:NaN,highY:NaN,lowY:NaN,closeY:NaN}}_fillRawPoints(){const t=this._series.barColorer();this._items=this._series.bars().rows().map((i=>this._createRawItem(i.index,i,t)))}}class Ot extends Et{constructor(){super(...arguments),this._renderer=new At}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createDefaultItem(t,i,s)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options();this._renderer.setData({bars:this._items,barSpacing:this._model.timeScale().barSpacing(),openVisible:t.openVisible,thinBars:t.thinBars,visibleRange:this._itemsVisibleRange})}}function Bt(t,i,s){return Math.min(Math.max(t,i),s)}function Lt(t,i,s){return i-t<=s}function zt(t){return t<=0?NaN:Math.log(t)/Math.log(10)}function It(t){const i=Math.ceil(t);return i%2==0?i-1:i}class Nt extends vt{constructor(){super(...arguments),this._fillCache=null}_fillStyle(t,i){var s;const{context:e,mediaSize:h}=t,n=this._data,{topFillColor1:r,topFillColor2:o,bottomFillColor1:l,bottomFillColor2:a}=i,u=null!==(s=n.baseLevelCoordinate)&&void 0!==s?s:h.height,c=h.height;if(null!==this._fillCache&&this._fillCache.topFillColor1===r&&this._fillCache.topFillColor2===o&&this._fillCache.bottomFillColor1===l&&this._fillCache.bottomFillColor2===a&&this._fillCache.baseLevelCoordinate===u&&this._fillCache.bottom===c)return this._fillCache.fillStyle;const d=e.createLinearGradient(0,0,0,c),f=Bt(u/c,0,1);return d.addColorStop(0,r),d.addColorStop(f,o),d.addColorStop(f,l),d.addColorStop(1,a),this._fillCache={topFillColor1:r,topFillColor2:o,bottomFillColor1:l,bottomFillColor2:a,fillStyle:d,baseLevelCoordinate:u,bottom:c},d}}class Vt extends wt{constructor(){super(...arguments),this._strokeCache=null}_strokeStyle(t,i){const{context:s,mediaSize:e}=t,h=this._data,{topLineColor:n,bottomLineColor:r}=i,{baseLevelCoordinate:o}=h,l=e.height;if(null!==this._strokeCache&&this._strokeCache.topLineColor===n&&this._strokeCache.bottomLineColor===r&&this._strokeCache.baseLevelCoordinate===o&&this._strokeCache.bottom===l)return this._strokeCache.strokeStyle;const a=s.createLinearGradient(0,0,0,l),u=Bt(o/l,0,1);return a.addColorStop(0,n),a.addColorStop(u,n),a.addColorStop(u,r),a.addColorStop(1,r),this._strokeCache={topLineColor:n,bottomLineColor:r,strokeStyle:a,baseLevelCoordinate:o,bottom:l},a}}class Ft extends Rt{constructor(t,i){super(t,i),this._renderer=new D,this._baselineAreaRenderer=new Nt,this._baselineLineRenderer=new Vt,this._renderer.setRenderers([this._baselineAreaRenderer,this._baselineLineRenderer])}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t=this._series.firstValue();if(null===t)return;const i=this._series.options(),s=this._series.priceScale().priceToCoordinate(i.baseValue.price,t.value),e=this._model.timeScale().barSpacing();this._baselineAreaRenderer.setData({items:this._items,lineWidth:i.lineWidth,lineStyle:i.lineStyle,lineType:i.lineType,baseLevelCoordinate:s,invertFilledArea:!1,visibleRange:this._itemsVisibleRange,barWidth:e}),this._baselineLineRenderer.setData({items:this._items,lineWidth:i.lineWidth,lineStyle:i.lineStyle,lineType:i.lineType,baseLevelCoordinate:s,visibleRange:this._itemsVisibleRange,barWidth:e})}}!function(t){t[t.BarBorderWidth=1]="BarBorderWidth"}(yt||(yt={}));class Wt extends z{constructor(){super(...arguments),this._data=null,this._barWidth=0}setData(t){this._data=t}_drawImpl(t){if(null===this._data||0===this._data.bars.length||null===this._data.visibleRange)return;const{horizontalPixelRatio:i}=t;if(this._barWidth=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const s=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),e=Math.floor(t*s*i),h=Math.floor(t*i),n=Math.min(e,h);return Math.max(Math.floor(i),n)}(this._data.barSpacing,i),this._barWidth>=2){Math.floor(i)%2!=this._barWidth%2&&this._barWidth--}const s=this._data.bars;this._data.wickVisible&&this._drawWicks(t,s,this._data.visibleRange),this._data.borderVisible&&this._drawBorder(t,s,this._data.visibleRange);const e=this._calculateBorderWidth(i);(!this._data.borderVisible||this._barWidth>2*e)&&this._drawCandles(t,s,this._data.visibleRange)}_drawWicks(t,i,s){if(null===this._data)return;const{context:e,horizontalPixelRatio:h,verticalPixelRatio:n}=t;let r="",o=Math.min(Math.floor(h),Math.floor(this._data.barSpacing*h));o=Math.max(Math.floor(h),Math.min(o,this._barWidth));const l=Math.floor(.5*o);let a=null;for(let t=s.from;t2*o)V(e,a,c,u-a+1,d-c+1,o);else{const t=u-a+1;e.fillRect(a,c,t,d-c+1)}l=u}}_drawCandles(t,i,s){if(null===this._data)return;const{context:e,horizontalPixelRatio:h,verticalPixelRatio:n}=t;let r="";const o=this._calculateBorderWidth(h);for(let t=s.from;ta||e.fillRect(u,l,c-u+1,a-l+1)}}}class jt extends Et{constructor(){super(...arguments),this._renderer=new Wt}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createDefaultItem(t,i,s)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options();this._renderer.setData({bars:this._items,barSpacing:this._model.timeScale().barSpacing(),wickVisible:t.wickVisible,borderVisible:t.borderVisible,visibleRange:this._itemsVisibleRange})}}class Ht extends z{constructor(){super(...arguments),this._data=null,this._precalculatedCache=[]}setData(t){this._data=t,this._precalculatedCache=[]}_drawImpl({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){if(null===this._data||0===this._data.items.length||null===this._data.visibleRange)return;this._precalculatedCache.length||this._fillPrecalculatedCache(i);const e=Math.max(1,Math.floor(s)),h=Math.round(this._data.histogramBase*s)-Math.floor(e/2),n=h+e;for(let i=this._data.visibleRange.from;ie.center?e.right=s.left-i-1:s.left=e.right+i+1))}let e=Math.ceil(this._data.barSpacing*t);for(let t=this._data.visibleRange.from;t0&&e<4)for(let t=this._data.visibleRange.from;te&&(i.roundedCenter>i.center?i.right-=1:i.left+=1)}}}class $t extends Rt{constructor(){super(...arguments),this._renderer=new Ht}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t={items:this._items,barSpacing:this._model.timeScale().barSpacing(),visibleRange:this._itemsVisibleRange,histogramBase:this._series.priceScale().priceToCoordinate(this._series.options().base,r(this._series.firstValue()).value)};this._renderer.setData(t)}}class Ut extends Rt{constructor(){super(...arguments),this._renderer=new Mt}_createRawItem(t,i,s){return Object.assign(Object.assign({},this._createRawItemBase(t,i)),s.barStyle(t))}_prepareRendererData(){const t=this._series.options(),i={items:this._items,lineStyle:t.lineStyle,lineType:t.lineType,lineWidth:t.lineWidth,visibleRange:this._itemsVisibleRange,barWidth:this._model.timeScale().barSpacing()};this._renderer.setData(i)}}const qt=/[2-9]/g;class Yt{constructor(t=50){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels={},this._cache=new Map,this._maxSize=t}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels={}}measureText(t,i,s){return this._getMetrics(t,i,s).width}yMidCorrection(t,i,s){const e=this._getMetrics(t,i,s);return((e.actualBoundingBoxAscent||0)-(e.actualBoundingBoxDescent||0))/2}_getMetrics(t,i,s){const e=s||qt,h=String(i).replace(e,"0");if(this._cache.has(h))return n(this._cache.get(h)).metrics;if(this._actualSize===this._maxSize){const t=this._tick2Labels[this._oldestTick];delete this._tick2Labels[this._oldestTick],this._cache.delete(t),this._oldestTick++,this._actualSize--}t.save(),t.textBaseline="middle";const r=t.measureText(h);return t.restore(),0===r.width&&i.length||(this._cache.set(h,{metrics:r,tick:this._usageTick}),this._tick2Labels[this._usageTick]=h,this._actualSize++,this._usageTick++),r}}class Xt{constructor(t){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._textWidthCache=t}setParams(t,i,s){this._priceAxisViewRenderer=t,this._rendererOptions=i,this._align=s}draw(t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(t,this._rendererOptions,this._textWidthCache,this._align)}}class Zt{constructor(t,i,s){this._priceAxisView=t,this._textWidthCache=new Yt(50),this._dataSource=i,this._chartModel=s,this._fontSize=-1,this._renderer=new Xt(this._textWidthCache)}renderer(){const t=this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=t.isOverlay(this._dataSource)?t.defaultVisiblePriceScale():this._dataSource.priceScale();if(null===i)return null;const s=t.priceScalePosition(i);if("overlay"===s)return null;const e=this._chartModel.priceAxisRendererOptions();return e.fontSize!==this._fontSize&&(this._fontSize=e.fontSize,this._textWidthCache.reset()),this._renderer.setParams(this._priceAxisView.paneRenderer(),e,s),this._renderer}}var Kt,Gt;!function(t){t[t.HitTestThreshold=7]="HitTestThreshold"}(Kt||(Kt={}));class Jt extends z{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}hitTest(t,i){var s;if(!(null===(s=this._data)||void 0===s?void 0:s.visible))return null;const{y:e,lineWidth:h,externalId:n}=this._data;return i>=e-h-7&&i<=e+h+7?{hitTestData:this._data,externalId:n}:null}_drawImpl({context:t,bitmapSize:i,horizontalPixelRatio:h,verticalPixelRatio:n}){if(null===this._data)return;if(!1===this._data.visible)return;const r=Math.round(this._data.y*n);r<0||r>i.height||(t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.floor(this._data.lineWidth*h),s(t,this._data.lineStyle),e(t,r,0,i.width))}}class Qt{constructor(t){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",lineWidth:1,lineStyle:0,visible:!1},this._lineRenderer=new Jt,this._invalidated=!0,this._series=t,this._model=t.model(),this._lineRenderer.setData(this._lineRendererData)}update(){this._invalidated=!0}renderer(){return this._series.visible()?(this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._lineRenderer):null}}class ti extends Qt{constructor(t){super(t)}_updateImpl(){this._lineRendererData.visible=!1;const t=this._series.priceScale(),i=t.mode().mode;if(2!==i&&3!==i)return;const s=this._series.options();if(!s.baseLineVisible||!this._series.visible())return;const e=this._series.firstValue();null!==e&&(this._lineRendererData.visible=!0,this._lineRendererData.y=t.priceToCoordinate(e.value,e.value),this._lineRendererData.color=s.baseLineColor,this._lineRendererData.lineWidth=s.baseLineWidth,this._lineRendererData.lineStyle=s.baseLineStyle)}}class ii extends z{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}data(){return this._data}_drawImpl({context:t,horizontalPixelRatio:i,verticalPixelRatio:s}){const e=this._data;if(null===e)return;const h=Math.max(1,Math.floor(i)),n=h%2/2,r=Math.round(e.center.x*i)+n,o=e.center.y*s;t.fillStyle=e.seriesLineColor,t.beginPath();const l=Math.max(2,1.5*e.seriesLineWidth)*i;t.arc(r,o,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=e.fillColor,t.beginPath(),t.arc(r,o,e.radius*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=h,t.strokeStyle=e.strokeColor,t.beginPath(),t.arc(r,o,e.radius*i+h/2,0,2*Math.PI,!1),t.stroke()}}!function(t){t[t.AnimationPeriod=2600]="AnimationPeriod",t[t.Stage1Period=.25]="Stage1Period",t[t.Stage2Period=.275]="Stage2Period",t[t.Stage3Period=.475]="Stage3Period",t[t.Stage1StartCircleRadius=4]="Stage1StartCircleRadius",t[t.Stage1EndCircleRadius=10]="Stage1EndCircleRadius",t[t.Stage1StartFillAlpha=.25]="Stage1StartFillAlpha",t[t.Stage1EndFillAlpha=0]="Stage1EndFillAlpha",t[t.Stage1StartStrokeAlpha=.4]="Stage1StartStrokeAlpha",t[t.Stage1EndStrokeAlpha=.8]="Stage1EndStrokeAlpha",t[t.Stage2StartCircleRadius=10]="Stage2StartCircleRadius",t[t.Stage2EndCircleRadius=14]="Stage2EndCircleRadius",t[t.Stage2StartFillAlpha=0]="Stage2StartFillAlpha",t[t.Stage2EndFillAlpha=0]="Stage2EndFillAlpha",t[t.Stage2StartStrokeAlpha=.8]="Stage2StartStrokeAlpha",t[t.Stage2EndStrokeAlpha=0]="Stage2EndStrokeAlpha",t[t.Stage3StartCircleRadius=14]="Stage3StartCircleRadius",t[t.Stage3EndCircleRadius=14]="Stage3EndCircleRadius",t[t.Stage3StartFillAlpha=0]="Stage3StartFillAlpha",t[t.Stage3EndFillAlpha=0]="Stage3EndFillAlpha",t[t.Stage3StartStrokeAlpha=0]="Stage3StartStrokeAlpha",t[t.Stage3EndStrokeAlpha=0]="Stage3EndStrokeAlpha"}(Gt||(Gt={}));const si=[{start:0,end:.25,startRadius:4,endRadius:10,startFillAlpha:.25,endFillAlpha:0,startStrokeAlpha:.4,endStrokeAlpha:.8},{start:.25,end:.525,startRadius:10,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:.8,endStrokeAlpha:0},{start:.525,end:1,startRadius:14,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:0,endStrokeAlpha:0}];function ei(t,i,s,e){return function(t,i){if("transparent"===t)return t;const s=m(t),e=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${i*e})`}(t,s+(e-s)*i)}function hi(t,i){const s=t%2600/2600;let e;for(const t of si)if(s>=t.start&&s<=t.end){e=t;break}h(void 0!==e,"Last price animation internal logic error");const n=(s-e.start)/(e.end-e.start);return{fillColor:ei(i,n,e.startFillAlpha,e.endFillAlpha),strokeColor:ei(i,n,e.startStrokeAlpha,e.endStrokeAlpha),radius:(r=n,o=e.startRadius,l=e.endRadius,o+(l-o)*r)};var r,o,l}class ni{constructor(t){this._renderer=new ii,this._invalidated=!0,this._stageInvalidated=!0,this._startTime=performance.now(),this._endTime=this._startTime-1,this._series=t}onDataCleared(){this._endTime=this._startTime-1,this.update()}onNewRealtimeDataReceived(){if(this.update(),2===this._series.options().lastPriceAnimation){const t=performance.now(),i=this._endTime-t;if(i>0)return void(i<650&&(this._endTime+=2600));this._startTime=t,this._endTime=t+2600}}update(){this._invalidated=!0}invalidateStage(){this._stageInvalidated=!0}visible(){return 0!==this._series.options().lastPriceAnimation}animationActive(){switch(this._series.options().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this._endTime}}renderer(){return this._invalidated?(this._updateImpl(),this._invalidated=!1,this._stageInvalidated=!1):this._stageInvalidated&&(this._updateRendererDataStage(),this._stageInvalidated=!1),this._renderer}_updateImpl(){this._renderer.setData(null);const t=this._series.model().timeScale(),i=t.visibleStrictRange(),s=this._series.firstValue();if(null===i||null===s)return;const e=this._series.lastValueData(!0);if(e.noData||!i.contains(e.index))return;const h={x:t.indexToCoordinate(e.index),y:this._series.priceScale().priceToCoordinate(e.price,s.value)},n=e.color,r=this._series.options().lineWidth,o=hi(this._duration(),n);this._renderer.setData({seriesLineColor:n,seriesLineWidth:r,fillColor:o.fillColor,strokeColor:o.strokeColor,radius:o.radius,center:h})}_updateRendererDataStage(){const t=this._renderer.data();if(null!==t){const i=hi(this._duration(),t.seriesLineColor);t.fillColor=i.fillColor,t.strokeColor=i.strokeColor,t.radius=i.radius}}_duration(){return this.animationActive()?performance.now()-this._startTime:2599}}var ri,oi;function li(t,i){return It(Math.min(Math.max(t,12),30)*i)}function ai(t,i){switch(t){case"arrowDown":case"arrowUp":return li(i,1);case"circle":return li(i,.8);case"square":return li(i,.7)}}function ui(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(li(t,1))}function ci(t){return Math.max(li(t,.1),3)}function di(t,i,s,e,h){const n=ai("square",s),r=(n-1)/2,o=t-r,l=i-r;return e>=o&&e<=o+n&&h>=l&&h<=l+n}function fi(t,i,s,e,h){const n=(ai("arrowUp",h)-1)/2,r=(It(h/2)-1)/2;i.beginPath(),t?(i.moveTo(s-n,e),i.lineTo(s,e-n),i.lineTo(s+n,e),i.lineTo(s+r,e),i.lineTo(s+r,e+n),i.lineTo(s-r,e+n),i.lineTo(s-r,e)):(i.moveTo(s-n,e),i.lineTo(s,e+n),i.lineTo(s+n,e),i.lineTo(s+r,e),i.lineTo(s+r,e-n),i.lineTo(s-r,e-n),i.lineTo(s-r,e)),i.fill()}function pi(t,i,s,e,h,n){return di(i,s,e,h,n)}!function(t){t[t.MinShapeSize=12]="MinShapeSize",t[t.MaxShapeSize=30]="MaxShapeSize",t[t.MinShapeMargin=3]="MinShapeMargin"}(ri||(ri={}));class mi extends A{constructor(){super(...arguments),this._data=null,this._textWidthCache=new Yt,this._fontSize=-1,this._fontFamily="",this._font=""}setData(t){this._data=t}setParams(t,i){this._fontSize===t&&this._fontFamily===i||(this._fontSize=t,this._fontFamily=i,this._font=T(t,i),this._textWidthCache.reset())}hitTest(t,i){if(null===this._data||null===this._data.visibleRange)return null;for(let s=this._data.visibleRange.from;s=t&&h<=t+s&&n>=i-r&&n<=i+r}(t.text.x,t.text.y,t.text.width,t.text.height,i,s))||function(t,i,s){if(0===t.size)return!1;switch(t.shape){case"arrowDown":case"arrowUp":return pi(0,t.x,t.y,t.size,i,s);case"circle":return function(t,i,s,e,h){const n=2+ai("circle",s)/2,r=t-e,o=i-h;return Math.sqrt(r*r+o*o)<=n}(t.x,t.y,t.size,i,s);case"square":return di(t.x,t.y,t.size,i,s)}}(t,i,s)}function gi(t,i,s,e,h,n,r,o,l){const a=w(s)?s:s.close,u=w(s)?s:s.high,c=w(s)?s:s.low,d=w(i.size)?Math.max(i.size,0):1,f=ui(o.barSpacing())*d,p=f/2;switch(t.size=f,i.position){case"inBar":return t.y=r.priceToCoordinate(a,l),void(void 0!==t.text&&(t.text.y=t.y+p+n+.6*h));case"aboveBar":return t.y=r.priceToCoordinate(u,l)-p-e.aboveBar,void 0!==t.text&&(t.text.y=t.y-p-.6*h,e.aboveBar+=1.2*h),void(e.aboveBar+=f+n);case"belowBar":return t.y=r.priceToCoordinate(c,l)+p+e.belowBar,void 0!==t.text&&(t.text.y=t.y+p+n+.6*h,e.belowBar+=1.2*h),void(e.belowBar+=f+n)}i.position}!function(t){t[t.TextMargin=.1]="TextMargin"}(oi||(oi={}));class wi{constructor(t,i){this._invalidated=!0,this._dataInvalidated=!0,this._autoScaleMarginsInvalidated=!0,this._autoScaleMargins=null,this._renderer=new mi,this._series=t,this._model=i,this._data={items:[],visibleRange:null}}update(t){this._invalidated=!0,this._autoScaleMarginsInvalidated=!0,"data"===t&&(this._dataInvalidated=!0)}renderer(t){if(!this._series.visible())return null;this._invalidated&&this._makeValid();const i=this._model.options().layout;return this._renderer.setParams(i.fontSize,i.fontFamily),this._renderer.setData(this._data),this._renderer}autoScaleMargins(){if(this._autoScaleMarginsInvalidated){if(this._series.indexedMarkers().length>0){const t=this._model.timeScale().barSpacing(),i=ci(t),s=1.5*ui(t)+2*i;this._autoScaleMargins={above:s,below:s}}else this._autoScaleMargins=null;this._autoScaleMarginsInvalidated=!1}return this._autoScaleMargins}_makeValid(){const t=this._series.priceScale(),i=this._model.timeScale(),s=this._series.indexedMarkers();this._dataInvalidated&&(this._data.items=s.map((t=>({time:t.time,x:0,y:0,size:0,shape:t.shape,color:t.color,internalId:t.internalId,externalId:t.id,text:void 0}))),this._dataInvalidated=!1);const e=this._model.options().layout;this._data.visibleRange=null;const h=i.visibleStrictRange();if(null===h)return;const n=this._series.firstValue();if(null===n)return;if(0===this._data.items.length)return;let r=NaN;const o=ci(i.barSpacing()),l={aboveBar:o,belowBar:o};this._data.visibleRange=Tt(this._data.items,h,!0);for(let h=this._data.visibleRange.from;h0&&(u.text={content:a.text,x:0,y:0,width:0,height:0});const c=this._series.dataAt(a.time);null!==c&&gi(u,a,c,l,e.fontSize,o,t,i,n.value)}this._invalidated=!1}}class Mi extends Qt{constructor(t){super(t)}_updateImpl(){const t=this._lineRendererData;t.visible=!1;const i=this._series.options();if(!i.priceLineVisible||!this._series.visible())return;const s=this._series.lastValueData(0===i.priceLineSource);s.noData||(t.visible=!0,t.y=s.coordinate,t.color=this._series.priceLineColor(s.color),t.lineWidth=i.priceLineWidth,t.lineStyle=i.priceLineStyle)}}class Si extends q{constructor(t){super(),this._source=t}_updateRendererData(t,i,s){t.visible=!1,i.visible=!1;const e=this._source;if(!e.visible())return;const h=e.options(),n=h.lastValueVisible,r=""!==e.title(),o=0===h.seriesLastValueMode,l=e.lastValueData(!1);if(l.noData)return;n&&(t.text=this._axisText(l,n,o),t.visible=0!==t.text.length),(r||o)&&(i.text=this._paneText(l,n,r,o),i.visible=i.text.length>0);const a=e.priceLineColor(l.color),u=v(a);s.background=u.background,s.coordinate=l.coordinate,i.borderColor=e.model().backgroundColorAtYPercentFromTop(l.coordinate/e.priceScale().height()),t.borderColor=a,t.color=u.foreground,i.color=u.foreground}_paneText(t,i,s,e){let h="";const n=this._source.title();return s&&0!==n.length&&(h+=`${n} `),i&&e&&(h+=this._source.priceScale().isPercentage()?t.formattedPriceAbsolute:t.formattedPricePercentage),h.trim()}_axisText(t,i,s){return i?s?this._source.priceScale().isPercentage()?t.formattedPricePercentage:t.formattedPriceAbsolute:t.text:""}}class xi{constructor(t,i){this._minValue=t,this._maxValue=i}equals(t){return null!==t&&(this._minValue===t._minValue&&this._maxValue===t._maxValue)}clone(){return new xi(this._minValue,this._maxValue)}minValue(){return this._minValue}maxValue(){return this._maxValue}length(){return this._maxValue-this._minValue}isEmpty(){return this._maxValue===this._minValue||Number.isNaN(this._maxValue)||Number.isNaN(this._minValue)}merge(t){return null===t?this:new xi(Math.min(this.minValue(),t.minValue()),Math.max(this.maxValue(),t.maxValue()))}scaleAroundCenter(t){if(!w(t))return;if(0===this._maxValue-this._minValue)return;const i=.5*(this._maxValue+this._minValue);let s=this._maxValue-i,e=this._minValue-i;s*=t,e*=t,this._maxValue=i+s,this._minValue=i+e}shift(t){w(t)&&(this._maxValue+=t,this._minValue+=t)}toRaw(){return{minValue:this._minValue,maxValue:this._maxValue}}static fromRaw(t){return null===t?null:new xi(t.minValue,t.maxValue)}}class _i{constructor(t,i){this._priceRange=t,this._margins=i||null}priceRange(){return this._priceRange}margins(){return this._margins}toRaw(){return null===this._priceRange?null:{priceRange:this._priceRange.toRaw(),margins:this._margins||void 0}}static fromRaw(t){return null===t?null:new _i(xi.fromRaw(t.priceRange),t.margins)}}class yi extends Qt{constructor(t,i){super(t),this._priceLine=i}_updateImpl(){const t=this._lineRendererData;t.visible=!1;const i=this._priceLine.options();if(!this._series.visible()||!i.lineVisible)return;const s=this._priceLine.yCoord();null!==s&&(t.visible=!0,t.y=s,t.color=i.color,t.lineWidth=i.lineWidth,t.lineStyle=i.lineStyle,t.externalId=this._priceLine.options().id)}}class ki extends q{constructor(t,i){super(),this._series=t,this._priceLine=i}_updateRendererData(t,i,s){t.visible=!1,i.visible=!1;const e=this._priceLine.options(),h=e.axisLabelVisible,n=""!==e.title,r=this._series;if(!h||!r.visible())return;const o=this._priceLine.yCoord();if(null===o)return;n&&(i.text=e.title,i.visible=!0),i.borderColor=r.model().backgroundColorAtYPercentFromTop(o/r.priceScale().height()),t.text=this._formatPrice(e.price),t.visible=!0;const l=v(e.axisLabelColor||e.color);s.background=l.background;const a=e.axisLabelTextColor||l.foreground;t.color=a,i.color=a,s.coordinate=o}_formatPrice(t){const i=this._series.firstValue();return null===i?"":this._series.priceScale().formatPrice(t,i.value)}}class Ci{constructor(t,i){this._series=t,this._options=i,this._priceLineView=new yi(t,this),this._priceAxisView=new ki(t,this),this._panePriceAxisView=new Zt(this._priceAxisView,t,t.model())}applyOptions(t){g(this._options,t),this.update(),this._series.model().lightUpdate()}options(){return this._options}paneView(){return this._priceLineView}labelPaneView(){return this._panePriceAxisView}priceAxisView(){return this._priceAxisView}update(){this._priceLineView.update(),this._priceAxisView.update()}yCoord(){const t=this._series,i=t.priceScale();if(t.model().timeScale().isEmpty()||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.priceToCoordinate(this._options.price,s.value)}}class Ti extends G{constructor(t){super(),this._model=t}model(){return this._model}}const Pi={Bar:(t,i,s,e)=>{var h;const n=i.upColor,l=i.downColor,a=r(t(s,e)),u=o(a.value[0])<=o(a.value[3]);return{barColor:null!==(h=a.color)&&void 0!==h?h:u?n:l}},Candlestick:(t,i,s,e)=>{var h,n,l;const a=i.upColor,u=i.downColor,c=i.borderUpColor,d=i.borderDownColor,f=i.wickUpColor,p=i.wickDownColor,m=r(t(s,e)),v=o(m.value[0])<=o(m.value[3]);return{barColor:null!==(h=m.color)&&void 0!==h?h:v?a:u,barBorderColor:null!==(n=m.borderColor)&&void 0!==n?n:v?c:d,barWickColor:null!==(l=m.wickColor)&&void 0!==l?l:v?f:p}},Area:(t,i,s,e)=>{var h,n,o,l;const a=r(t(s,e));return{barColor:null!==(h=a.lineColor)&&void 0!==h?h:i.lineColor,lineColor:null!==(n=a.lineColor)&&void 0!==n?n:i.lineColor,topColor:null!==(o=a.topColor)&&void 0!==o?o:i.topColor,bottomColor:null!==(l=a.bottomColor)&&void 0!==l?l:i.bottomColor}},Baseline:(t,i,s,e)=>{var h,n,o,l,a,u;const c=r(t(s,e));return{barColor:c.value[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,topLineColor:null!==(h=c.topLineColor)&&void 0!==h?h:i.topLineColor,bottomLineColor:null!==(n=c.bottomLineColor)&&void 0!==n?n:i.bottomLineColor,topFillColor1:null!==(o=c.topFillColor1)&&void 0!==o?o:i.topFillColor1,topFillColor2:null!==(l=c.topFillColor2)&&void 0!==l?l:i.topFillColor2,bottomFillColor1:null!==(a=c.bottomFillColor1)&&void 0!==a?a:i.bottomFillColor1,bottomFillColor2:null!==(u=c.bottomFillColor2)&&void 0!==u?u:i.bottomFillColor2}},Line:(t,i,s,e)=>{var h,n;const o=r(t(s,e));return{barColor:null!==(h=o.color)&&void 0!==h?h:i.color,lineColor:null!==(n=o.color)&&void 0!==n?n:i.color}},Histogram:(t,i,s,e)=>{var h;return{barColor:null!==(h=r(t(s,e)).color)&&void 0!==h?h:i.color}}};class Ri{constructor(t){this._findBar=(t,i)=>void 0!==i?i.value:this._series.bars().valueAt(t),this._series=t,this._styleGetter=Pi[t.seriesType()]}barStyle(t,i){return this._styleGetter(this._findBar,this._series.options(),t,i)}}var Di;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(Di||(Di={}));const Ai=30;class Ei{constructor(){this._items=[],this._minMaxCache=new Map,this._rowSearchCache=new Map}last(){return this.size()>0?this._items[this._items.length-1]:null}firstIndex(){return this.size()>0?this._indexAt(0):null}lastIndex(){return this.size()>0?this._indexAt(this._items.length-1):null}size(){return this._items.length}isEmpty(){return 0===this.size()}contains(t){return null!==this._search(t,0)}valueAt(t){return this.search(t)}search(t,i=0){const s=this._search(t,i);return null===s?null:Object.assign(Object.assign({},this._valueAt(s)),{index:this._indexAt(s)})}rows(){return this._items}minMaxOnRangeCached(t,i,s){if(this.isEmpty())return null;let e=null;for(const h of s){e=Oi(e,this._minMaxOnRangeCachedImpl(t,i,h))}return e}setData(t){this._rowSearchCache.clear(),this._minMaxCache.clear(),this._items=t}_indexAt(t){return this._items[t].index}_valueAt(t){return this._items[t]}_search(t,i){const s=this._bsearch(t);if(null===s&&0!==i)switch(i){case-1:return this._searchNearestLeft(t);case 1:return this._searchNearestRight(t);default:throw new TypeError("Unknown search mode")}return s}_searchNearestLeft(t){let i=this._lowerbound(t);return i>0&&(i-=1),i!==this._items.length&&this._indexAt(i)t.indexi.index>t))}_plotMinMax(t,i,s){let e=null;for(let h=t;he.max&&(e.max=t)))}return e}_minMaxOnRangeCachedImpl(t,i,s){if(this.isEmpty())return null;let e=null;const h=r(this.firstIndex()),n=r(this.lastIndex()),o=Math.max(t,h),l=Math.min(i,n),a=Math.ceil(o/Ai)*Ai,u=Math.max(a,Math.floor(l/Ai)*Ai);{const t=this._lowerbound(o),h=this._upperbound(Math.min(l,a,i));e=Oi(e,this._plotMinMax(t,h,s))}let c=this._minMaxCache.get(s);void 0===c&&(c=new Map,this._minMaxCache.set(s,c));for(let t=Math.max(a+1,o);t{this._animationTimeoutId=null,this.model().cursorUpdate()}),0)),i.invalidateStage(),[i]):[]}paneViews(){const t=[];this._isOverlay()||t.push(this._baseHorizontalLineView),t.push(this._paneView,this._priceLineView,this._markersPaneView);const i=this._customPriceLines.map((t=>t.paneView()));return t.push(...i),t}labelPaneViews(t){return[this._panePriceAxisView,...this._customPriceLines.map((t=>t.labelPaneView()))]}priceAxisViews(t,i){if(i!==this._priceScale&&!this._isOverlay())return[];const s=[...this._priceAxisViews];for(const t of this._customPriceLines)s.push(t.priceAxisView());return s}autoscaleInfo(t,i){if(void 0!==this._options.autoscaleInfoProvider){const s=this._options.autoscaleInfoProvider((()=>{const s=this._autoscaleInfoImpl(t,i);return null===s?null:s.toRaw()}));return _i.fromRaw(s)}return this._autoscaleInfoImpl(t,i)}minMove(){return this._options.priceFormat.minMove}formatter(){return this._formatter}updateAllViews(){var t;this._paneView.update(),this._markersPaneView.update();for(const t of this._priceAxisViews)t.update();for(const t of this._customPriceLines)t.update();this._priceLineView.update(),this._baseHorizontalLineView.update(),null===(t=this._lastPriceAnimationPaneView)||void 0===t||t.update()}priceScale(){return r(super.priceScale())}markerDataAtIndex(t){if(!(("Line"===this._seriesType||"Area"===this._seriesType||"Baseline"===this._seriesType)&&this._options.crosshairMarkerVisible))return null;const i=this._data.valueAt(t);if(null===i)return null;return{price:i.value[3],radius:this._markerRadius(),borderColor:this._markerBorderColor(),borderWidth:this._markerBorderWidth(),backgroundColor:this._markerBackgroundColor(t)}}title(){return this._options.title}visible(){return this._options.visible}_isOverlay(){return!et(this.priceScale().id())}_autoscaleInfoImpl(t,i){if(!M(t)||!M(i)||this._data.isEmpty())return null;const s="Line"===this._seriesType||"Area"===this._seriesType||"Baseline"===this._seriesType||"Histogram"===this._seriesType?[3]:[2,1],e=this._data.minMaxOnRangeCached(t,i,s);let h=null!==e?new xi(e.min,e.max):null;if("Histogram"===this.seriesType()){const t=this._options.base,i=new xi(t,t);h=null!==h?h.merge(i):i}return new _i(h,this._markersPaneView.autoScaleMargins())}_markerRadius(){switch(this._seriesType){case"Line":case"Area":case"Baseline":return this._options.crosshairMarkerRadius}return 0}_markerBorderColor(){switch(this._seriesType){case"Line":case"Area":case"Baseline":{const t=this._options.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}_markerBorderWidth(){switch(this._seriesType){case"Line":case"Area":case"Baseline":return this._options.crosshairMarkerBorderWidth}return 0}_markerBackgroundColor(t){switch(this._seriesType){case"Line":case"Area":case"Baseline":{const t=this._options.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.barColorer().barStyle(t).barColor}_recreateFormatter(){switch(this._options.priceFormat.type){case"custom":this._formatter={format:this._options.priceFormat.formatter};break;case"volume":this._formatter=new at(this._options.priceFormat.precision);break;case"percent":this._formatter=new lt(this._options.priceFormat.precision);break;default:{const t=Math.pow(10,this._options.priceFormat.precision);this._formatter=new ot(t,this._options.priceFormat.minMove*t)}}null!==this._priceScale&&this._priceScale.updateFormatter()}_recalculateMarkers(){const t=this.model().timeScale();if(!t.hasPoints()||this._data.isEmpty())return void(this._indexedMarkers=[]);const i=r(this._data.firstIndex());this._indexedMarkers=this._markers.map(((s,e)=>{const h=r(t.timeToIndex(s.time,!0)),n=ht instanceof Bi)).reduce(((t,e)=>{if(s.isOverlay(e)||!e.visible())return t;const h=e.priceScale(),n=e.bars();if(h.isEmpty()||!n.contains(i))return t;const r=n.valueAt(i);if(null===r)return t;const l=o(e.firstValue());return t.concat([h.priceToCoordinate(r.value[3],l.value)])}),[]);if(0===l.length)return e;l.sort(((t,i)=>Math.abs(t-r)-Math.abs(i-r)));const a=l[0];return e=h.coordinateToPrice(a,n),e}}class zi extends z{constructor(){super(...arguments),this._data=null}setData(t){this._data=t}_drawImpl({context:t,bitmapSize:i,horizontalPixelRatio:e,verticalPixelRatio:h}){if(null===this._data)return;const n=Math.max(1,Math.floor(e));t.lineWidth=n,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,(()=>{const o=r(this._data);if(o.vertLinesVisible){t.strokeStyle=o.vertLinesColor,s(t,o.vertLineStyle),t.beginPath();for(const s of o.timeMarks){const h=Math.round(s.coord*e);t.moveTo(h,-n),t.lineTo(h,i.height+n)}t.stroke()}if(o.horzLinesVisible){t.strokeStyle=o.horzLinesColor,s(t,o.horzLineStyle),t.beginPath();for(const s of o.priceMarks){const e=Math.round(s.coord*h);t.moveTo(-n,e),t.lineTo(i.width+n,e)}t.stroke()}}))}}class Ii{constructor(t){this._renderer=new zi,this._invalidated=!0,this._pane=t}update(){this._invalidated=!0}renderer(){if(this._invalidated){const t=this._pane.model().options().grid,i={horzLinesVisible:t.horzLines.visible,vertLinesVisible:t.vertLines.visible,horzLinesColor:t.horzLines.color,vertLinesColor:t.vertLines.color,horzLineStyle:t.horzLines.style,vertLineStyle:t.vertLines.style,priceMarks:this._pane.defaultPriceScale().marks(),timeMarks:this._pane.model().timeScale().marks()||[]};this._renderer.setData(i),this._invalidated=!1}return this._renderer}}class Ni{constructor(t){this._paneView=new Ii(t)}paneView(){return this._paneView}}const Vi={logicalOffset:4,coordOffset:1e-4};function Fi(t,i){const s=100*(t-i)/i;return i<0?-s:s}function Wi(t,i){const s=Fi(t.minValue(),i),e=Fi(t.maxValue(),i);return new xi(s,e)}function ji(t,i){const s=100*(t-i)/i+100;return i<0?-s:s}function Hi(t,i){const s=ji(t.minValue(),i),e=ji(t.maxValue(),i);return new xi(s,e)}function $i(t,i){const s=Math.abs(t);if(s<1e-15)return 0;const e=zt(s+i.coordOffset)+i.logicalOffset;return t<0?-e:e}function Ui(t,i){const s=Math.abs(t);if(s<1e-15)return 0;const e=Math.pow(10,s-i.logicalOffset)-i.coordOffset;return t<0?-e:e}function qi(t,i){if(null===t)return null;const s=$i(t.minValue(),i),e=$i(t.maxValue(),i);return new xi(s,e)}function Yi(t,i){if(null===t)return null;const s=Ui(t.minValue(),i),e=Ui(t.maxValue(),i);return new xi(s,e)}function Xi(t){if(null===t)return Vi;const i=Math.abs(t.maxValue()-t.minValue());if(i>=1||i<1e-15)return Vi;const s=Math.ceil(Math.abs(Math.log10(i))),e=Vi.logicalOffset+s;return{logicalOffset:e,coordOffset:1/Math.pow(10,e)}}var Zi;!function(t){t[t.TickSpanEpsilon=1e-14]="TickSpanEpsilon"}(Zi||(Zi={}));class Ki{constructor(t,i){if(this._base=t,this._integralDividers=i,function(t){if(t<0)return!1;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this._base))this._fractionalDividers=[2,2.5,2];else{this._fractionalDividers=[];for(let t=this._base;1!==t;){if(t%2==0)this._fractionalDividers.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this._fractionalDividers.push(2,2.5),t/=5}if(this._fractionalDividers.length>100)throw new Error("something wrong with base")}}}tickSpan(t,i,s){const e=0===this._base?0:1/this._base;let h=Math.pow(10,Math.max(0,Math.ceil(zt(t-i)))),n=0,r=this._integralDividers[0];for(;;){const t=Lt(h,e,1e-14)&&h>e+1e-14,i=Lt(h,s*r,1e-14),o=Lt(h,1,1e-14);if(!(t&&i&&o))break;h/=r,r=this._integralDividers[++n%this._integralDividers.length]}if(h<=e+1e-14&&(h=e),h=Math.max(1,h),this._fractionalDividers.length>0&&(o=h,l=1,a=1e-14,Math.abs(o-l)e+1e-14;)h/=r,r=this._fractionalDividers[++n%this._fractionalDividers.length];var o,l,a;return h}}class Gi{constructor(t,i,s,e){this._marks=[],this._priceScale=t,this._base=i,this._coordinateToLogicalFunc=s,this._logicalToCoordinateFunc=e}tickSpan(t,i){if(t=a?1:-1;let f=null,p=0;for(let s=l-c;s>a;s-=u){const e=this._logicalToCoordinateFunc(s,i,!0);null!==f&&Math.abs(e-f)o||(pr(t.zorder())-r(i.zorder())))}var Qi;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(Qi||(Qi={}));const ts=new lt,is=new ot(100,1);class ss{constructor(t,i,s,e){this._height=0,this._internalHeightCache=null,this._priceRange=null,this._priceRangeSnapshot=null,this._invalidatedForRange={isValid:!1,visibleBars:null},this._marginAbove=0,this._marginBelow=0,this._onMarksChanged=new b,this._modeChanged=new b,this._dataSources=[],this._cachedOrderedSources=null,this._marksCache=null,this._scaleStartPoint=null,this._scrollStartPoint=null,this._formatter=is,this._logFormula=Xi(null),this._id=t,this._options=i,this._layoutOptions=s,this._localizationOptions=e,this._markBuilder=new Gi(this,100,this._coordinateToLogical.bind(this),this._logicalToCoordinate.bind(this))}id(){return this._id}options(){return this._options}applyOptions(t){if(g(this._options,t),this.updateFormatter(),void 0!==t.mode&&this.setMode({mode:t.mode}),void 0!==t.scaleMargins){const i=n(t.scaleMargins.top),s=n(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(s<0||s>1||i+s>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${s}`);if(i+s>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+s}`);this._invalidateInternalHeightCache(),this._marksCache=null}}isAutoScale(){return this._options.autoScale}isLog(){return 1===this._options.mode}isPercentage(){return 2===this._options.mode}isIndexedTo100(){return 3===this._options.mode}mode(){return{autoScale:this._options.autoScale,isInverted:this._options.invertScale,mode:this._options.mode}}setMode(t){const i=this.mode();let s=null;void 0!==t.autoScale&&(this._options.autoScale=t.autoScale),void 0!==t.mode&&(this._options.mode=t.mode,2!==t.mode&&3!==t.mode||(this._options.autoScale=!0),this._invalidatedForRange.isValid=!1),1===i.mode&&t.mode!==i.mode&&(!function(t,i){if(null===t)return!1;const s=Ui(t.minValue(),i),e=Ui(t.maxValue(),i);return isFinite(s)&&isFinite(e)}(this._priceRange,this._logFormula)?this._options.autoScale=!0:(s=Yi(this._priceRange,this._logFormula),null!==s&&this.setPriceRange(s))),1===t.mode&&t.mode!==i.mode&&(s=qi(this._priceRange,this._logFormula),null!==s&&this.setPriceRange(s));const e=i.mode!==this._options.mode;e&&(2===i.mode||this.isPercentage())&&this.updateFormatter(),e&&(3===i.mode||this.isIndexedTo100())&&this.updateFormatter(),void 0!==t.isInverted&&i.isInverted!==t.isInverted&&(this._options.invertScale=t.isInverted,this._onIsInvertedChanged()),this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}fontSize(){return this._layoutOptions.fontSize}height(){return this._height}setHeight(t){this._height!==t&&(this._height=t,this._invalidateInternalHeightCache(),this._marksCache=null)}internalHeight(){if(this._internalHeightCache)return this._internalHeightCache;const t=this.height()-this._topMarginPx()-this._bottomMarginPx();return this._internalHeightCache=t,t}priceRange(){return this._makeSureItIsValid(),this._priceRange}setPriceRange(t,i){const s=this._priceRange;(i||null===s&&null!==t||null!==s&&!s.equals(t))&&(this._marksCache=null,this._priceRange=t)}isEmpty(){return this._makeSureItIsValid(),0===this._height||!this._priceRange||this._priceRange.isEmpty()}invertedCoordinate(t){return this.isInverted()?t:this.height()-1-t}priceToCoordinate(t,i){return this.isPercentage()?t=Fi(t,i):this.isIndexedTo100()&&(t=ji(t,i)),this._logicalToCoordinate(t,i)}pointsArrayToCoordinates(t,i,s){this._makeSureItIsValid();const e=this._bottomMarginPx(),h=r(this.priceRange()),n=h.minValue(),o=h.maxValue(),l=this.internalHeight()-1,a=this.isInverted(),u=l/(o-n),c=void 0===s?0:s.from,d=void 0===s?t.length:s.to,f=this._getCoordinateTransformer();for(let s=c;st.updateAllViews()))}updateFormatter(){this._marksCache=null;const t=this._formatterSource();let i=100;null!==t&&(i=Math.round(1/t.minMove())),this._formatter=is,this.isPercentage()?(this._formatter=ts,i=100):this.isIndexedTo100()?(this._formatter=new ot(100,1),i=100):null!==t&&(this._formatter=t.formatter()),this._markBuilder=new Gi(this,i,this._coordinateToLogical.bind(this),this._logicalToCoordinate.bind(this)),this._markBuilder.rebuildTickMarks()}invalidateSourcesCache(){this._cachedOrderedSources=null}_formatterSource(){return this._dataSources[0]||null}_topMarginPx(){return this.isInverted()?this._options.scaleMargins.bottom*this.height()+this._marginBelow:this._options.scaleMargins.top*this.height()+this._marginAbove}_bottomMarginPx(){return this.isInverted()?this._options.scaleMargins.top*this.height()+this._marginAbove:this._options.scaleMargins.bottom*this.height()+this._marginBelow}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null}_logicalToCoordinate(t,i){if(this._makeSureItIsValid(),this.isEmpty())return 0;t=this.isLog()&&t?$i(t,this._logFormula):t;const s=r(this.priceRange()),e=this._bottomMarginPx()+(this.internalHeight()-1)*(t-s.minValue())/s.length();return this.invertedCoordinate(e)}_coordinateToLogical(t,i){if(this._makeSureItIsValid(),this.isEmpty())return 0;const s=this.invertedCoordinate(t),e=r(this.priceRange()),h=e.minValue()+e.length()*((s-this._bottomMarginPx())/(this.internalHeight()-1));return this.isLog()?Ui(h,this._logFormula):h}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_recalculatePriceRangeImpl(){const t=this._invalidatedForRange.visibleBars;if(null===t)return;let i=null;const s=this.sourcesForAutoScale();let e=0,h=0;for(const n of s){if(!n.visible())continue;const s=n.firstValue();if(null===s)continue;const o=n.autoscaleInfo(t.left(),t.right());let l=o&&o.priceRange();if(null!==l){switch(this._options.mode){case 1:l=qi(l,this._logFormula);break;case 2:l=Wi(l,s.value);break;case 3:l=Hi(l,s.value)}if(i=null===i?l:i.merge(r(l)),null!==o){const t=o.margins();null!==t&&(e=Math.max(e,t.above),h=Math.max(e,t.below))}}}if(e===this._marginAbove&&h===this._marginBelow||(this._marginAbove=e,this._marginBelow=h,this._marksCache=null,this._invalidateInternalHeightCache()),null!==i){if(i.minValue()===i.maxValue()){const t=this._formatterSource(),s=5*(null===t||this.isPercentage()||this.isIndexedTo100()?1:t.minMove());this.isLog()&&(i=Yi(i,this._logFormula)),i=new xi(i.minValue()-s,i.maxValue()+s),this.isLog()&&(i=qi(i,this._logFormula))}if(this.isLog()){const t=Yi(i,this._logFormula),s=Xi(t);if(n=s,o=this._logFormula,n.logicalOffset!==o.logicalOffset||n.coordOffset!==o.coordOffset){const e=null!==this._priceRangeSnapshot?Yi(this._priceRangeSnapshot,this._logFormula):null;this._logFormula=s,i=qi(t,s),null!==e&&(this._priceRangeSnapshot=qi(e,s))}}this.setPriceRange(i)}else null===this._priceRange&&(this.setPriceRange(new xi(-.5,.5)),this._logFormula=Xi(null));var n,o;this._invalidatedForRange.isValid=!0}_getCoordinateTransformer(){return this.isPercentage()?Fi:this.isIndexedTo100()?ji:this.isLog()?t=>$i(t,this._logFormula):null}_formatValue(t,i,s){return void 0===i?(void 0===s&&(s=this.formatter()),s.format(t)):i(t)}_formatPrice(t,i){return this._formatValue(t,this._localizationOptions.priceFormatter,i)}_formatPercentage(t,i){return this._formatValue(t,this._localizationOptions.percentageFormatter,i)}}class es{constructor(t,i){this._dataSources=[],this._overlaySourcesByScaleId=new Map,this._height=0,this._width=0,this._stretchFactor=1e3,this._cachedOrderedSources=null,this._destroyed=new b,this._timeScale=t,this._model=i,this._grid=new Ni(this);const s=i.options();this._leftPriceScale=this._createPriceScale("left",s.leftPriceScale),this._rightPriceScale=this._createPriceScale("right",s.rightPriceScale),this._leftPriceScale.modeChanged().subscribe(this._onPriceScaleModeChanged.bind(this,this._leftPriceScale),this),this._rightPriceScale.modeChanged().subscribe(this._onPriceScaleModeChanged.bind(this,this._rightPriceScale),this),this.applyScaleOptions(s)}applyScaleOptions(t){if(t.leftPriceScale&&this._leftPriceScale.applyOptions(t.leftPriceScale),t.rightPriceScale&&this._rightPriceScale.applyOptions(t.rightPriceScale),t.localization&&(this._leftPriceScale.updateFormatter(),this._rightPriceScale.updateFormatter()),t.overlayPriceScales){const i=Array.from(this._overlaySourcesByScaleId.values());for(const s of i){const i=r(s[0].priceScale());i.applyOptions(t.overlayPriceScales),t.localization&&i.updateFormatter()}}}priceScaleById(t){switch(t){case"left":return this._leftPriceScale;case"right":return this._rightPriceScale}return this._overlaySourcesByScaleId.has(t)?n(this._overlaySourcesByScaleId.get(t))[0].priceScale():null}destroy(){this.model().priceScalesOptionsChanged().unsubscribeAll(this),this._leftPriceScale.modeChanged().unsubscribeAll(this),this._rightPriceScale.modeChanged().unsubscribeAll(this),this._dataSources.forEach((t=>{t.destroy&&t.destroy()})),this._destroyed.fire()}stretchFactor(){return this._stretchFactor}setStretchFactor(t){this._stretchFactor=t}model(){return this._model}width(){return this._width}height(){return this._height}setWidth(t){this._width=t,this.updateAllSources()}setHeight(t){this._height=t,this._leftPriceScale.setHeight(t),this._rightPriceScale.setHeight(t),this._dataSources.forEach((i=>{if(this.isOverlay(i)){const s=i.priceScale();null!==s&&s.setHeight(t)}})),this.updateAllSources()}dataSources(){return this._dataSources}isOverlay(t){const i=t.priceScale();return null===i||this._leftPriceScale!==i&&this._rightPriceScale!==i}addDataSource(t,i,s){const e=void 0!==s?s:this._getZOrderMinMax().maxZOrder+1;this._insertDataSource(t,i,e)}removeDataSource(t){const i=this._dataSources.indexOf(t);h(-1!==i,"removeDataSource: invalid data source"),this._dataSources.splice(i,1);const s=r(t.priceScale()).id();if(this._overlaySourcesByScaleId.has(s)){const i=n(this._overlaySourcesByScaleId.get(s)),e=i.indexOf(t);-1!==e&&(i.splice(e,1),0===i.length&&this._overlaySourcesByScaleId.delete(s))}const e=t.priceScale();e&&e.dataSources().indexOf(t)>=0&&e.removeDataSource(t),null!==e&&(e.invalidateSourcesCache(),this.recalculatePriceScale(e)),this._cachedOrderedSources=null}priceScalePosition(t){return t===this._leftPriceScale?"left":t===this._rightPriceScale?"right":"overlay"}leftPriceScale(){return this._leftPriceScale}rightPriceScale(){return this._rightPriceScale}startScalePrice(t,i){t.startScale(i)}scalePriceTo(t,i){t.scaleTo(i),this.updateAllSources()}endScalePrice(t){t.endScale()}startScrollPrice(t,i){t.startScroll(i)}scrollPriceTo(t,i){t.scrollTo(i),this.updateAllSources()}endScrollPrice(t){t.endScroll()}updateAllSources(){this._dataSources.forEach((t=>{t.updateAllViews()}))}defaultPriceScale(){let t=null;return this._model.options().rightPriceScale.visible&&0!==this._rightPriceScale.dataSources().length?t=this._rightPriceScale:this._model.options().leftPriceScale.visible&&0!==this._leftPriceScale.dataSources().length?t=this._leftPriceScale:0!==this._dataSources.length&&(t=this._dataSources[0].priceScale()),null===t&&(t=this._rightPriceScale),t}defaultVisiblePriceScale(){let t=null;return this._model.options().rightPriceScale.visible?t=this._rightPriceScale:this._model.options().leftPriceScale.visible&&(t=this._leftPriceScale),t}recalculatePriceScale(t){null!==t&&t.isAutoScale()&&this._recalculatePriceScaleImpl(t)}resetPriceScale(t){const i=this._timeScale.visibleStrictRange();t.setMode({autoScale:!0}),null!==i&&t.recalculatePriceRange(i),this.updateAllSources()}momentaryAutoScale(){this._recalculatePriceScaleImpl(this._leftPriceScale),this._recalculatePriceScaleImpl(this._rightPriceScale)}recalculate(){this.recalculatePriceScale(this._leftPriceScale),this.recalculatePriceScale(this._rightPriceScale),this._dataSources.forEach((t=>{this.isOverlay(t)&&this.recalculatePriceScale(t.priceScale())})),this.updateAllSources(),this._model.lightUpdate()}orderedSources(){return null===this._cachedOrderedSources&&(this._cachedOrderedSources=Ji(this._dataSources)),this._cachedOrderedSources}onDestroyed(){return this._destroyed}grid(){return this._grid}_recalculatePriceScaleImpl(t){const i=t.sourcesForAutoScale();if(i&&i.length>0&&!this._timeScale.isEmpty()){const i=this._timeScale.visibleStrictRange();null!==i&&t.recalculatePriceRange(i)}t.updateAllViews()}_getZOrderMinMax(){const t=this.orderedSources();if(0===t.length)return{minZOrder:0,maxZOrder:0};let i=0,s=0;for(let e=0;es&&(s=h))}return{minZOrder:i,maxZOrder:s}}_insertDataSource(t,i,s){let e=this.priceScaleById(i);if(null===e&&(e=this._createPriceScale(i,this._model.options().overlayPriceScales)),this._dataSources.push(t),!et(i)){const s=this._overlaySourcesByScaleId.get(i)||[];s.push(t),this._overlaySourcesByScaleId.set(i,s)}e.addDataSource(t),t.setPriceScale(e),t.setZorder(s),this.recalculatePriceScale(e),this._cachedOrderedSources=null}_onPriceScaleModeChanged(t,i,s){i.mode!==s.mode&&this._recalculatePriceScaleImpl(t)}_createPriceScale(t,i){const s=Object.assign({visible:!0,autoScale:!0},_(i)),e=new ss(t,s,this._model.options().layout,this._model.options().localization);return e.setHeight(this.height()),e}}const hs=t=>t.getUTCFullYear();function ns(t,i,s){return i.replace(/yyyy/g,(t=>rt(hs(t),4))(t)).replace(/yy/g,(t=>rt(hs(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,s)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,s)).replace(/MM/g,(t=>rt((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>rt((t=>t.getUTCDate())(t),2))(t))}class rs{constructor(t="yyyy-MM-dd",i="default"){this._dateFormat=t,this._locale=i}format(t){return ns(t,this._dateFormat,this._locale)}}class os{constructor(t){this._formatStr=t||"%h:%m:%s"}format(t){return this._formatStr.replace("%h",rt(t.getUTCHours(),2)).replace("%m",rt(t.getUTCMinutes(),2)).replace("%s",rt(t.getUTCSeconds(),2))}}const ls={dateFormat:"yyyy-MM-dd",timeFormat:"%h:%m:%s",dateTimeSeparator:" ",locale:"default"};class as{constructor(t={}){const i=Object.assign(Object.assign({},ls),t);this._dateFormatter=new rs(i.dateFormat,i.locale),this._timeFormatter=new os(i.timeFormat),this._separator=i.dateTimeSeparator}format(t){return`${this._dateFormatter.format(t)}${this._separator}${this._timeFormatter.format(t)}`}}class us{constructor(t,i=50){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._cache=new Map,this._tick2Labels=new Map,this._format=t,this._maxSize=i}format(t){const i=t.time,s=void 0===i.businessDay?new Date(1e3*i.timestamp).getTime():new Date(Date.UTC(i.businessDay.year,i.businessDay.month-1,i.businessDay.day)).getTime(),e=this._cache.get(s);if(void 0!==e)return e.string;if(this._actualSize===this._maxSize){const t=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(n(t)),this._oldestTick++,this._actualSize--}const h=this._format(t);return this._cache.set(s,{string:h,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,s),this._actualSize++,this._usageTick++,h}}class cs{constructor(t,i){h(t<=i,"right should be >= left"),this._left=t,this._right=i}left(){return this._left}right(){return this._right}count(){return this._right-this._left+1}contains(t){return this._left<=t&&t<=this._right}equals(t){return this._left===t.left()&&this._right===t.right()}}function ds(t,i){return null===t||null===i?t===i:t.equals(i)}class fs{constructor(){this._marksByWeight=new Map,this._cache=null}setTimeScalePoints(t,i){this._removeMarksSinceIndex(i),this._cache=null;for(let s=i;s{t<=s[0].index?i.push(e):s.splice(St(s,t,(i=>i.indexi-t))){if(!this._marksByWeight.get(s))continue;const e=i;i=[];const h=e.length;let r=0;const o=n(this._marksByWeight.get(s)),l=o.length;let a=1/0,u=-1/0;for(let s=0;s=t&&l-u>=t&&(i.push(n),u=l)}for(;rthis._points[this._points.length-1].time.timestamp)return i?this._points.length-1:null;const s=St(this._points,t.timestamp,((t,i)=>t.time.timestamp0}visibleStrictRange(){return this._updateVisibleRange(),this._visibleRange.strictRange()}visibleLogicalRange(){return this._updateVisibleRange(),this._visibleRange.logicalRange()}visibleTimeRange(){const t=this.visibleStrictRange();if(null===t)return null;const i={from:t.left(),to:t.right()};return this.timeRangeForLogicalRange(i)}timeRangeForLogicalRange(t){const i=Math.round(t.from),s=Math.round(t.to),e=r(this._firstIndex()),h=r(this._lastIndex());return{from:r(this.indexToTime(Math.max(e,i))),to:r(this.indexToTime(Math.min(h,s)))}}logicalRangeForTimeRange(t){return{from:r(this.timeToIndex(t.from,!0)),to:r(this.timeToIndex(t.to,!0))}}width(){return this._width}setWidth(t){if(!isFinite(t)||t<=0)return;if(this._width===t)return;const i=this.visibleLogicalRange(),s=this._width;if(this._width=t,this._visibleRangeInvalidated=!0,this._options.lockVisibleTimeRangeOnResize&&0!==s){const i=this._barSpacing*t/s;this._barSpacing=i}if(this._options.fixLeftEdge&&null!==i&&i.left()<=0){const i=s-t;this._rightOffset-=Math.round(i/this._barSpacing)+1,this._visibleRangeInvalidated=!0}this._correctBarSpacing(),this._correctOffset()}indexToCoordinate(t){if(this.isEmpty()||!M(t))return 0;const i=this.baseIndex()+this._rightOffset-t;return this._width-(i+.5)*this._barSpacing-1}indexesToCoordinates(t,i){const s=this.baseIndex(),e=void 0===i?0:i.from,h=void 0===i?t.length:i.to;for(let i=e;ii/2&&!u?s.needAlignCoordinate=!1:s.needAlignCoordinate=c&&t.index<=l||d&&t.index>=a,f++}return this._labels.length=f,this._timeMarksCache=this._labels,this._labels}restoreDefault(){this._visibleRangeInvalidated=!0,this.setBarSpacing(this._options.barSpacing),this.setRightOffset(this._options.rightOffset)}setBaseIndex(t){this._visibleRangeInvalidated=!0,this._baseIndexOrNull=t,this._correctOffset(),this._doFixLeftEdge()}zoom(t,i){const s=this._coordinateToFloatIndex(t),e=this.barSpacing(),h=e+i*(e/10);this.setBarSpacing(h),this._options.rightBarStaysOnScroll||this.setRightOffset(this.rightOffset()+(s-this._coordinateToFloatIndex(t)))}startScale(t){this._scrollStartPoint&&this.endScroll(),null===this._scaleStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scaleStartPoint=t,this._saveCommonTransitionsStartState()))}scaleTo(t){if(null===this._commonTransitionStartState)return;const i=Bt(this._width-t,0,this._width),s=Bt(this._width-r(this._scaleStartPoint),0,this._width);0!==i&&0!==s&&this.setBarSpacing(this._commonTransitionStartState.barSpacing*i/s)}endScale(){null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._clearCommonTransitionsStartState())}startScroll(t){null===this._scrollStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scrollStartPoint=t,this._saveCommonTransitionsStartState()))}scrollTo(t){if(null===this._scrollStartPoint)return;const i=(this._scrollStartPoint-t)/this.barSpacing();this._rightOffset=r(this._commonTransitionStartState).rightOffset+i,this._visibleRangeInvalidated=!0,this._correctOffset()}endScroll(){null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._clearCommonTransitionsStartState())}scrollToRealTime(){this.scrollToOffsetAnimated(this._options.rightOffset)}scrollToOffsetAnimated(t,i=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const s=this._rightOffset,e=performance.now();this._model.setTimeScaleAnimation({finished:t=>(t-e)/i>=1,getPosition:h=>{const n=(h-e)/i;return n>=1?t:s+(t-s)*n}})}update(t,i){this._visibleRangeInvalidated=!0,this._points=t,this._tickMarks.setTimeScalePoints(t,i),this._correctOffset()}visibleBarsChanged(){return this._visibleBarsChanged}logicalRangeChanged(){return this._logicalRangeChanged}optionsApplied(){return this._optionsApplied}baseIndex(){return this._baseIndexOrNull||0}setVisibleRange(t){const i=t.count();this._setBarSpacing(this._width/i),this._rightOffset=t.right()-this.baseIndex(),this._correctOffset(),this._visibleRangeInvalidated=!0,this._model.recalculateAllPanes(),this._model.lightUpdate()}fitContent(){const t=this._firstIndex(),i=this._lastIndex();null!==t&&null!==i&&this.setVisibleRange(new cs(t,i+this._options.rightOffset))}setLogicalRange(t){const i=new cs(t.from,t.to);this.setVisibleRange(i)}formatDateTime(t){return void 0!==this._localizationOptions.timeFormatter?this._localizationOptions.timeFormatter(t.originalTime):this._dateTimeFormatter.format(new Date(1e3*t.time.timestamp))}_isAllScalingAndScrollingDisabled(){const{handleScroll:t,handleScale:i}=this._model.options();return!(t.horzTouchDrag||t.mouseWheel||t.pressedMouseMove||t.vertTouchDrag||i.axisDoubleClickReset.time||i.axisPressedMouseMove.time||i.mouseWheel||i.pinch)}_firstIndex(){return 0===this._points.length?null:0}_lastIndex(){return 0===this._points.length?null:this._points.length-1}_rightOffsetForCoordinate(t){return(this._width-1-t)/this._barSpacing}_coordinateToFloatIndex(t){const i=this._rightOffsetForCoordinate(t),s=this.baseIndex()+this._rightOffset-i;return Math.round(1e6*s)/1e6}_setBarSpacing(t){const i=this._barSpacing;this._barSpacing=t,this._correctBarSpacing(),i!==this._barSpacing&&(this._visibleRangeInvalidated=!0,this._resetTimeMarksCache())}_updateVisibleRange(){if(!this._visibleRangeInvalidated)return;if(this._visibleRangeInvalidated=!1,this.isEmpty())return void this._setVisibleRange(ps.invalid());const t=this.baseIndex(),i=this._width/this._barSpacing,s=this._rightOffset+t,e=new cs(s-i+1,s);this._setVisibleRange(new ps(e))}_correctBarSpacing(){const t=this._minBarSpacing();if(this._barSpacingt&&(this._barSpacing=t,this._visibleRangeInvalidated=!0)}}_minBarSpacing(){return this._options.fixLeftEdge&&this._options.fixRightEdge&&0!==this._points.length?this._width/this._points.length:this._options.minBarSpacing}_correctOffset(){const t=this._maxRightOffset();this._rightOffset>t&&(this._rightOffset=t,this._visibleRangeInvalidated=!0);const i=this._minRightOffset();null!==i&&this._rightOffsetthis._formatLabelImpl(t))),this._formattedByWeight.set(t.weight,i)),i.format(t)}_formatLabelImpl(t){const i=function(t,i,s){switch(t){case 0:case 10:return i?s?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this._options.timeVisible,this._options.secondsVisible);if(void 0!==this._options.tickMarkFormatter){const s=this._options.tickMarkFormatter(t.originalTime,i,this._localizationOptions.locale);if(null!==s)return s}return function(t,i,s){const e={};switch(i){case 0:e.year="numeric";break;case 1:e.month="short";break;case 2:e.day="numeric";break;case 3:e.hour12=!1,e.hour="2-digit",e.minute="2-digit";break;case 4:e.hour12=!1,e.hour="2-digit",e.minute="2-digit",e.second="2-digit"}const h=void 0===t.businessDay?new Date(1e3*t.timestamp):new Date(Date.UTC(t.businessDay.year,t.businessDay.month-1,t.businessDay.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(s,e)}(t.time,i,this._localizationOptions.locale)}_setVisibleRange(t){const i=this._visibleRange;this._visibleRange=t,ds(i.strictRange(),this._visibleRange.strictRange())||this._visibleBarsChanged.fire(),ds(i.logicalRange(),this._visibleRange.logicalRange())||this._logicalRangeChanged.fire(),this._resetTimeMarksCache()}_resetTimeMarksCache(){this._timeMarksCache=null}_invalidateTickMarks(){this._resetTimeMarksCache(),this._formattedByWeight.clear()}_updateDateTimeFormatter(){const t=this._localizationOptions.dateFormat;this._options.timeVisible?this._dateTimeFormatter=new as({dateFormat:t,timeFormat:this._options.secondsVisible?"%h:%m:%s":"%h:%m",dateTimeSeparator:" ",locale:this._localizationOptions.locale}):this._dateTimeFormatter=new rs(t,this._localizationOptions.locale)}_doFixLeftEdge(){if(!this._options.fixLeftEdge)return;const t=this._firstIndex();if(null===t)return;const i=this.visibleStrictRange();if(null===i)return;const s=i.left()-t;if(s<0){const t=this._rightOffset-s-1;this.setRightOffset(t)}this._correctBarSpacing()}_doFixRightEdge(){this._correctOffset(),this._correctBarSpacing()}}class ys extends A{constructor(t){super(),this._metricsCache=new Map,this._data=t}_drawImpl(t){}_drawBackgroundImpl(t){if(!this._data.visible)return;const{context:i,mediaSize:s}=t;let e=0;for(const t of this._data.lines){if(0===t.text.length)continue;i.font=t.font;const h=this._metrics(i,t.text);h>s.width?t.zoom=s.width/h:t.zoom=1,e+=t.lineHeight*t.zoom}let h=0;switch(this._data.vertAlign){case"top":h=0;break;case"center":h=Math.max((s.height-e)/2,0);break;case"bottom":h=Math.max(s.height-e,0)}i.fillStyle=this._data.color;for(const t of this._data.lines){i.save();let e=0;switch(this._data.horzAlign){case"left":i.textAlign="left",e=t.lineHeight/2;break;case"center":i.textAlign="center",e=s.width/2;break;case"right":i.textAlign="right",e=s.width-1-t.lineHeight/2}i.translate(e,h),i.textBaseline="top",i.font=t.font,i.scale(t.zoom,t.zoom),i.fillText(t.text,0,t.vertOffset),i.restore(),h+=t.lineHeight*t.zoom}}_metrics(t,i){const s=this._fontCache(t.font);let e=s.get(i);return void 0===e&&(e=t.measureText(i).width,s.set(i,e)),e}_fontCache(t){let i=this._metricsCache.get(t);return void 0===i&&(i=new Map,this._metricsCache.set(t,i)),i}}class ks{constructor(t){this._invalidated=!0,this._rendererData={visible:!1,color:"",lines:[],vertAlign:"center",horzAlign:"center"},this._renderer=new ys(this._rendererData),this._source=t}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){const t=this._source.options(),i=this._rendererData;i.visible=t.visible,i.visible&&(i.color=t.color,i.horzAlign=t.horzAlign,i.vertAlign=t.vertAlign,i.lines=[{text:t.text,font:T(t.fontSize,t.fontFamily,t.fontStyle),lineHeight:1.2*t.fontSize,vertOffset:0,zoom:0}])}}class Cs extends G{constructor(t,i){super(),this._options=i,this._paneView=new ks(this)}priceAxisViews(){return[]}paneViews(){return[this._paneView]}options(){return this._options}updateAllViews(){this._paneView.update()}}!function(t){t[t.Top=0]="Top",t[t.Bottom=1]="Bottom"}(bs||(bs={})),function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(gs||(gs={}));class Ts{constructor(t,i){this._panes=[],this._serieses=[],this._width=0,this._hoveredSource=null,this._priceScalesOptionsChanged=new b,this._crosshairMoved=new b,this._gradientColorsCache=null,this._invalidateHandler=t,this._options=i,this._rendererOptionsProvider=new R(this),this._timeScale=new _s(this,i.timeScale,this._options.localization),this._crosshair=new st(this,i.crosshair),this._magnet=new Li(i.crosshair),this._watermark=new Cs(this,i.watermark),this.createPane(),this._panes[0].setStretchFactor(2e3),this._backgroundTopColor=this._getBackgroundColor(0),this._backgroundBottomColor=this._getBackgroundColor(1)}fullUpdate(){this._invalidate(ht.full())}lightUpdate(){this._invalidate(ht.light())}cursorUpdate(){this._invalidate(new ht(1))}updateSource(t){const i=this._invalidationMaskForSource(t);this._invalidate(i)}hoveredSource(){return this._hoveredSource}setHoveredSource(t){const i=this._hoveredSource;this._hoveredSource=t,null!==i&&this.updateSource(i.source),null!==t&&this.updateSource(t.source)}options(){return this._options}applyOptions(t){g(this._options,t),this._panes.forEach((i=>i.applyScaleOptions(t))),void 0!==t.timeScale&&this._timeScale.applyOptions(t.timeScale),void 0!==t.localization&&this._timeScale.applyLocalizationOptions(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this._priceScalesOptionsChanged.fire(),this._backgroundTopColor=this._getBackgroundColor(0),this._backgroundBottomColor=this._getBackgroundColor(1),this.fullUpdate()}applyPriceScaleOptions(t,i){if("left"===t)return void this.applyOptions({leftPriceScale:i});if("right"===t)return void this.applyOptions({rightPriceScale:i});const s=this.findPriceScale(t);null!==s&&(s.priceScale.applyOptions(i),this._priceScalesOptionsChanged.fire())}findPriceScale(t){for(const i of this._panes){const s=i.priceScaleById(t);if(null!==s)return{pane:i,priceScale:s}}return null}timeScale(){return this._timeScale}panes(){return this._panes}watermarkSource(){return this._watermark}crosshairSource(){return this._crosshair}crosshairMoved(){return this._crosshairMoved}setPaneHeight(t,i){t.setHeight(i),this.recalculateAllPanes()}setWidth(t){this._width=t,this._timeScale.setWidth(this._width),this._panes.forEach((i=>i.setWidth(t))),this.recalculateAllPanes()}createPane(t){const i=new es(this._timeScale,this);void 0!==t?this._panes.splice(t,0,i):this._panes.push(i);const s=void 0===t?this._panes.length-1:t,e=ht.full();return e.invalidatePane(s,{level:0,autoScale:!0}),this._invalidate(e),i}startScalePrice(t,i,s){t.startScalePrice(i,s)}scalePriceTo(t,i,s){t.scalePriceTo(i,s),this.updateCrosshair(),this._invalidate(this._paneInvalidationMask(t,2))}endScalePrice(t,i){t.endScalePrice(i),this._invalidate(this._paneInvalidationMask(t,2))}startScrollPrice(t,i,s){i.isAutoScale()||t.startScrollPrice(i,s)}scrollPriceTo(t,i,s){i.isAutoScale()||(t.scrollPriceTo(i,s),this.updateCrosshair(),this._invalidate(this._paneInvalidationMask(t,2)))}endScrollPrice(t,i){i.isAutoScale()||(t.endScrollPrice(i),this._invalidate(this._paneInvalidationMask(t,2)))}resetPriceScale(t,i){t.resetPriceScale(i),this._invalidate(this._paneInvalidationMask(t,2))}startScaleTime(t){this._timeScale.startScale(t)}zoomTime(t,i){const s=this.timeScale();if(s.isEmpty()||0===i)return;const e=s.width();t=Math.max(1,Math.min(t,e)),s.zoom(t,i),this.recalculateAllPanes()}scrollChart(t){this.startScrollTime(0),this.scrollTimeTo(t),this.endScrollTime()}scaleTimeTo(t){this._timeScale.scaleTo(t),this.recalculateAllPanes()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate()}startScrollTime(t){this._timeScale.startScroll(t)}scrollTimeTo(t){this._timeScale.scrollTo(t),this.recalculateAllPanes()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate()}serieses(){return this._serieses}setAndSaveCurrentPosition(t,i,s,e){this._crosshair.saveOriginCoord(t,i);let h=NaN,n=this._timeScale.coordinateToIndex(t);const r=this._timeScale.visibleStrictRange();null!==r&&(n=Math.min(Math.max(r.left(),n),r.right()));const o=e.defaultPriceScale(),l=o.firstValue();null!==l&&(h=o.coordinateToPrice(i,l)),h=this._magnet.align(h,n,e),this._crosshair.setPosition(n,h,e),this.cursorUpdate(),this._crosshairMoved.fire(this._crosshair.appliedIndex(),{x:t,y:i},s)}setAndSaveCurrentPositionFire(t,i,s,e){this._crosshair.saveOriginCoord(t,i);let h=NaN,n=this._timeScale.coordinateToIndex(t);const r=this._timeScale.visibleStrictRange();null!==r&&(n=Math.min(Math.max(r.left(),n),r.right()));const o=e.defaultPriceScale(),l=o.firstValue();null!==l&&(h=o.coordinateToPrice(i,l)),h=this._magnet.align(h,n,e),this._crosshair.setPosition(n,h,e),this.cursorUpdate(),s&&this._crosshairMoved.fire(this._crosshair.appliedIndex(),{x:t,y:i},null)}clearCurrentPosition(){this.crosshairSource().clearPosition(),this.cursorUpdate(),this._crosshairMoved.fire(null,null,null)}updateCrosshair(){const t=this._crosshair.pane();if(null!==t){const i=this._crosshair.originCoordX(),s=this._crosshair.originCoordY();this.setAndSaveCurrentPosition(i,s,null,t)}this._crosshair.updateAllViews()}updateTimeScale(t,i,s){const e=this._timeScale.indexToTime(0);void 0!==i&&void 0!==s&&this._timeScale.update(i,s);const h=this._timeScale.indexToTime(0),n=this._timeScale.baseIndex(),r=this._timeScale.visibleStrictRange();if(null!==r&&null!==e&&null!==h){const i=r.contains(n),s=e.timestamp>h.timestamp,o=null!==t&&t>n&&!s,l=i&&this._timeScale.options().shiftVisibleRangeOnNewBar;if(o&&!l){const i=t-n;this._timeScale.setRightOffset(this._timeScale.rightOffset()-i)}}this._timeScale.setBaseIndex(t)}recalculatePane(t){null!==t&&t.recalculate()}paneForSource(t){const i=this._panes.find((i=>i.orderedSources().includes(t)));return void 0===i?null:i}recalculateAllPanes(){this._watermark.updateAllViews(),this._panes.forEach((t=>t.recalculate())),this.updateCrosshair()}destroy(){this._panes.forEach((t=>t.destroy())),this._panes.length=0,this._options.localization.priceFormatter=void 0,this._options.localization.percentageFormatter=void 0,this._options.localization.timeFormatter=void 0}rendererOptionsProvider(){return this._rendererOptionsProvider}priceAxisRendererOptions(){return this._rendererOptionsProvider.options()}priceScalesOptionsChanged(){return this._priceScalesOptionsChanged}createSeries(t,i){const s=this._panes[0],e=this._createSeries(i,t,s);return this._serieses.push(e),1===this._serieses.length?this.fullUpdate():this.lightUpdate(),e}removeSeries(t){const i=this.paneForSource(t),s=this._serieses.indexOf(t);h(-1!==s,"Series not found"),this._serieses.splice(s,1),r(i).removeDataSource(t),t.destroy&&t.destroy()}moveSeriesToScale(t,i){const s=r(this.paneForSource(t));s.removeDataSource(t);const e=this.findPriceScale(i);if(null===e){const e=t.zorder();s.addDataSource(t,i,e)}else{const h=e.pane===s?t.zorder():void 0;e.pane.addDataSource(t,i,h)}}fitContent(){const t=ht.light();t.setFitContent(),this._invalidate(t)}setTargetLogicalRange(t){const i=ht.light();i.applyRange(t),this._invalidate(i)}resetTimeScale(){const t=ht.light();t.resetTimeScale(),this._invalidate(t)}setBarSpacing(t){const i=ht.light();i.setBarSpacing(t),this._invalidate(i)}setRightOffset(t){const i=ht.light();i.setRightOffset(t),this._invalidate(i)}setTimeScaleAnimation(t){const i=ht.light();i.setTimeScaleAnimation(t),this._invalidate(i)}stopTimeScaleAnimation(){const t=ht.light();t.stopTimeScaleAnimation(),this._invalidate(t)}defaultVisiblePriceScaleId(){return this._options.rightPriceScale.visible?"right":"left"}backgroundBottomColor(){return this._backgroundBottomColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(t){const i=this._backgroundBottomColor,s=this._backgroundTopColor;if(i===s)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==s||this._gradientColorsCache.bottomColor!==i)this._gradientColorsCache={topColor:s,bottomColor:i,colors:new Map};else{const i=this._gradientColorsCache.colors.get(t);if(void 0!==i)return i}const e=function(t,i,s){const[e,h,n,r]=m(t),[o,l,c,d]=m(i),f=[a(e+s*(o-e)),a(h+s*(l-h)),a(n+s*(c-n)),u(r+s*(d-r))];return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${f[3]})`}(s,i,t/100);return this._gradientColorsCache.colors.set(t,e),e}_paneInvalidationMask(t,i){const s=new ht(i);if(null!==t){const e=this._panes.indexOf(t);s.invalidatePane(e,{level:i})}return s}_invalidationMaskForSource(t,i){return void 0===i&&(i=2),this._paneInvalidationMask(this.paneForSource(t),i)}_invalidate(t){this._invalidateHandler&&this._invalidateHandler(t),this._panes.forEach((t=>t.grid().paneView().update()))}_createSeries(t,i,s){const e=new Bi(this,t,i),h=void 0!==t.priceScaleId?t.priceScaleId:this.defaultVisiblePriceScaleId();return s.addDataSource(e,h),et(h)||e.applyOptions(t),e}_getBackgroundColor(t){const i=this._options.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}}function Ps(t){return!w(t)&&!S(t)}function Rs(t){return w(t)}function Ds(t){var i=t.width,s=t.height;if(i<0)throw new Error("Negative width is not allowed for Size");if(s<0)throw new Error("Negative height is not allowed for Size");return{width:i,height:s}}function As(t,i){return t.width===i.width&&t.height===i.height}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(ws||(ws={})),function(t){t[t.LastPriceAndPercentageValue=0]="LastPriceAndPercentageValue",t[t.LastValueAccordingToScale=1]="LastValueAccordingToScale"}(Ms||(Ms={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Ss||(Ss={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(xs||(xs={}));var Es=function(){function t(t){var i=this;this._resolutionListener=function(){return i._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(t){var i=this,s={next:t};return this._observers.push(s),{unsubscribe:function(){i._observers=i._observers.filter((function(t){return t!==s}))}}},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw new Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach((function(i){return i.next(t._window.devicePixelRatio)})),this._reinstallResolutionListener()},t}();var Os=function(){function t(t,i,s){var e;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=Ds({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(e=null==s?void 0:s.allowResizeObserver)||void 0===e||e,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw new Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return Ds({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=Ds(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter((function(i){return i!==t}))},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter((function(i){return i!==t}))},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;As(i,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var s=this;this._bitmapSizeChangedListeners.forEach((function(e){return e.call(s,t,i)}))},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,s=Ds(this._transformBitmapSize(t,this._canvasElementClientSize)),e=As(this.bitmapSize,s)?null:s;null===i&&null===e||null!==i&&null!==e&&As(i,e)||(this._suggestedBitmapSize=e,this._emitSuggestedBitmapSizeChanged(i,e))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var s=this;this._suggestedBitmapSizeChangedListeners.forEach((function(e){return e.call(s,t,i)}))},t.prototype._chooseAndInitObserver=function(){var t=this;this._allowResizeObserver?new Promise((function(t){var i=new ResizeObserver((function(s){t(s.every((function(t){return"devicePixelContentBoxSize"in t}))),i.disconnect()}));i.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1})).then((function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})):this._initDevicePixelRatioObservable()},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=Bs(this._canvasElement);if(null===i)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=function(t){return new Es(t)}(i),this._devicePixelRatioObservable.subscribe((function(){return t._invalidateBitmapSize()})),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var t,i;if(null!==this._canvasElement){var s=Bs(this._canvasElement);if(null!==s){var e=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:s.devicePixelRatio,h=this._canvasElement.getClientRects(),n=void 0!==h[0]?function(t,i){return Ds({width:Math.round(t.left*i+t.width*i)-Math.round(t.left*i),height:Math.round(t.top*i+t.height*i)-Math.round(t.top*i)})}(h[0],e):Ds({width:this._canvasElementClientSize.width*e,height:this._canvasElementClientSize.height*e});this._suggestNewBitmapSize(n)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver((function(i){var s=i.find((function(i){return i.target===t._canvasElement}));if(s&&s.devicePixelContentBoxSize&&s.devicePixelContentBoxSize[0]){var e=s.devicePixelContentBoxSize[0],h=Ds({width:e.inlineSize,height:e.blockSize});t._suggestNewBitmapSize(h)}})),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function Bs(t){return t.ownerDocument.defaultView}var Ls=function(){function t(t,i,s){if(0===i.width||0===i.height)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===s.width||0===s.height)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=s,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function zs(t,i){var s=t.canvasElementClientSize;if(0===s.width||0===s.height)return null;var e=t.bitmapSize;if(0===e.width||0===e.height)return null;var h=t.canvasElement.getContext("2d",i);return null===h?null:new Ls(h,s,e)}const Is="undefined"!=typeof window;function Ns(){return!!Is&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Vs(){return!!Is&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Fs(t){return t+t%2}var Ws,js,Hs,$s,Us,qs,Ys,Xs;function Zs(t,i){return t.position-i.position}function Ks(t,i,s){const e=(t.position-i.position)/(t.time-i.time);return Math.sign(e)*Math.min(Math.abs(e),s)}!function(t){t[t.MaxStartDelay=50]="MaxStartDelay",t[t.EpsilonDistance=1]="EpsilonDistance"}(Ws||(Ws={}));class Gs{constructor(t,i,s,e){this._position1=null,this._position2=null,this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._minSpeed=t,this._maxSpeed=i,this._dumpingCoeff=s,this._minMove=e}addPosition(t,i){if(null!==this._position1){if(this._position1.time===i)return void(this._position1.position=t);if(Math.abs(this._position1.position-t)50)return;let s=0;const e=Ks(this._position1,this._position2,this._maxSpeed),h=Zs(this._position1,this._position2),n=[e],r=[h];if(s+=h,null!==this._position3){const t=Ks(this._position2,this._position3,this._maxSpeed);if(Math.sign(t)===Math.sign(e)){const i=Zs(this._position2,this._position3);if(n.push(t),r.push(i),s+=i,null!==this._position4){const t=Ks(this._position3,this._position4,this._maxSpeed);if(Math.sign(t)===Math.sign(e)){const i=Zs(this._position3,this._position4);n.push(t),r.push(i),s+=i}}}}let o=0;for(let t=0;t({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})});return e.resizeCanvasElement(i),e}function Qs(t){Is&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}))}!function(t){t[t.ResetClick=500]="ResetClick",t[t.LongTap=240]="LongTap",t[t.PreventFiresTouchEvents=500]="PreventFiresTouchEvents"}(js||(js={})),function(t){t[t.CancelClickManhattanDistance=5]="CancelClickManhattanDistance",t[t.CancelTapManhattanDistance=5]="CancelTapManhattanDistance",t[t.DoubleClickManhattanDistance=5]="DoubleClickManhattanDistance",t[t.DoubleTapManhattanDistance=30]="DoubleTapManhattanDistance"}(Hs||(Hs={}));class te{constructor(t,i,s){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._startPinchMiddlePoint=null,this._startPinchDistance=0,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!Vs(),this._onFirefoxOutsideMouseUp=t=>{this._mouseUpHandler(t)},this._onMobileSafariDoubleClick=t=>{if(this._firesTouchEvents(t)){const i=this._makeCompatEvent(t);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:s}=this._touchMouseMoveWithDownInfo(ee(t),this._tapPosition);s<30&&!this._cancelTap&&this._processTouchEvent(i,this._handler.doubleTapEvent),this._resetTapTimeout()}}else{const i=this._makeCompatEvent(t);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:s}=this._touchMouseMoveWithDownInfo(ee(t),this._clickPosition);s<5&&!this._cancelClick&&this._processMouseEvent(i,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=t,this._handler=i,this._options=s,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),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(t){this._unsubscribeMousemove&&this._unsubscribeMousemove();const i=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",i)},this._target.addEventListener("mousemove",i),this._firesTouchEvents(t))return;const s=this._makeCompatEvent(t);this._processMouseEvent(s,this._handler.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(t){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(t))return;const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handler.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(t){const i=ne(t.changedTouches,r(this._activeTouchId));if(null===i)return;if(this._lastTouchEventTimeStamp=he(t),null!==this._startPinchMiddlePoint)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const s=this._touchMouseMoveWithDownInfo(ee(i),r(this._touchMoveStartPosition)),{xOffset:e,yOffset:h,manhattanDistance:n}=s;if(this._touchMoveExceededManhattanDistance||!(n<5)){if(!this._touchMoveExceededManhattanDistance){const t=.5*e,i=h>=t&&!this._options.treatVertTouchDragAsPageScroll(),s=t>h&&!this._options.treatHorzTouchDragAsPageScroll();i||s||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const s=this._makeCompatEvent(t,i);this._processTouchEvent(s,this._handler.touchMoveEvent),se(t)}}}_mouseMoveWithDownHandler(t){if(0!==t.button)return;const i=this._touchMouseMoveWithDownInfo(ee(t),r(this._mouseMoveStartPosition)),{manhattanDistance:s}=i;if(s>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handler.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(t,i){const s=Math.abs(i.x-t.x),e=Math.abs(i.y-t.y);return{xOffset:s,yOffset:e,manhattanDistance:s+e}}_touchEndHandler(t){let i=ne(t.changedTouches,r(this._activeTouchId));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=he(t),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const s=this._makeCompatEvent(t,i);if(this._processTouchEvent(s,this._handler.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:t}=this._touchMouseMoveWithDownInfo(ee(i),this._tapPosition);t<30&&!this._cancelTap&&this._processTouchEvent(s,this._handler.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(s,this._handler.tapEvent),this._handler.tapEvent&&se(t));0===this._tapCount&&se(t),0===t.touches.length&&this._longTapActive&&(this._longTapActive=!1,se(t))}_mouseUpHandler(t){if(0!==t.button)return;const i=this._makeCompatEvent(t);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),Ns()){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(t))if(this._processMouseEvent(i,this._handler.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:s}=this._touchMouseMoveWithDownInfo(ee(t),this._clickPosition);s<5&&!this._cancelClick&&this._processMouseEvent(i,this._handler.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(i,this._handler.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(t){if(null!==this._activeTouchId)return;const i=t.changedTouches[0];this._activeTouchId=i.identifier,this._lastTouchEventTimeStamp=he(t);const s=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=ee(i),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const i=this._touchMoveHandler.bind(this),e=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{s.removeEventListener("touchmove",i),s.removeEventListener("touchend",e)},s.addEventListener("touchmove",i,{passive:!1}),s.addEventListener("touchend",e,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,t),240)}const e=this._makeCompatEvent(t,i);this._processTouchEvent(e,this._handler.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=ee(i))}_mouseDownHandler(t){if(0!==t.button)return;const i=this._target.ownerDocument.documentElement;Ns()&&i.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=ee(t),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const t=this._mouseMoveWithDownHandler.bind(this),s=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",s)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",s)}if(this._mousePressed=!0,this._firesTouchEvents(t))return;const s=this._makeCompatEvent(t);this._processMouseEvent(s,this._handler.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=ee(t))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._clearLongTapTimeout.bind(this));{const t=this._target.ownerDocument,i=t=>{this._handler.mouseDownOutsideEvent&&(t.composed&&this._target.contains(t.composedPath()[0])||t.target&&this._target.contains(t.target)||this._handler.mouseDownOutsideEvent())};this._unsubscribeOutsideTouchEvents=()=>{t.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}Vs()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),Qs(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){void 0===this._handler.pinchStartEvent&&void 0===this._handler.pinchEvent&&void 0===this._handler.pinchEndEvent||(this._target.addEventListener("touchstart",(t=>this._checkPinchState(t.touches)),{passive:!0}),this._target.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this._startPinchMiddlePoint&&void 0!==this._handler.pinchEvent){const i=ie(t.touches[0],t.touches[1])/this._startPinchDistance;this._handler.pinchEvent(this._startPinchMiddlePoint,i),se(t)}}),{passive:!1}),this._target.addEventListener("touchend",(t=>{this._checkPinchState(t.touches)})))}_checkPinchState(t){1===t.length&&(this._pinchPrevented=!1),2!==t.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(t)}_startPinch(t){const i=this._target.getBoundingClientRect()||{left:0,top:0};this._startPinchMiddlePoint={x:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,y:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this._startPinchDistance=ie(t[0],t[1]),void 0!==this._handler.pinchStartEvent&&this._handler.pinchStartEvent(),this._clearLongTapTimeout()}_stopPinch(){null!==this._startPinchMiddlePoint&&(this._startPinchMiddlePoint=null,void 0!==this._handler.pinchEndEvent&&this._handler.pinchEndEvent())}_mouseLeaveHandler(t){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(t))return;if(!this._acceptMouseLeave)return;const i=this._makeCompatEvent(t);this._processMouseEvent(i,this._handler.mouseLeaveEvent),this._acceptMouseLeave=!Vs()}_longTapHandler(t){const i=ne(t.touches,r(this._activeTouchId));if(null===i)return;const s=this._makeCompatEvent(t,i);this._processTouchEvent(s,this._handler.longTapEvent),this._cancelTap=!0,this._longTapActive=!0}_firesTouchEvents(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:he(t){"touchstart"!==t.type&&se(t)}}}}function ie(t,i){const s=t.clientX-i.clientX,e=t.clientY-i.clientY;return Math.sqrt(s*s+e*e)}function se(t){t.cancelable&&t.preventDefault()}function ee(t){return{x:t.pageX,y:t.pageY}}function he(t){return t.timeStamp||performance.now()}function ne(t,i){for(let s=0;s{this._isSettingSize||this._pane.chart().model().lightUpdate()},this._topCanvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||this._pane.chart().model().lightUpdate()},this._pane=t,this._options=i,this._layoutOptions=i.layout,this._rendererOptionsProvider=s,this._isLeft="left"===e,this._cell=document.createElement("div"),this._cell.style.height="100%",this._cell.style.overflow="hidden",this._cell.style.width="25px",this._cell.style.left="0",this._cell.style.position="relative",this._canvasBinding=Js(this._cell,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler);const h=this._canvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this._topCanvasBinding=Js(this._cell,Ds({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler);const n=this._topCanvasBinding.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0";const r={mouseDownEvent:this._mouseDownEvent.bind(this),touchStartEvent:this._mouseDownEvent.bind(this),pressedMouseMoveEvent:this._pressedMouseMoveEvent.bind(this),touchMoveEvent:this._pressedMouseMoveEvent.bind(this),mouseDownOutsideEvent:this._mouseDownOutsideEvent.bind(this),mouseUpEvent:this._mouseUpEvent.bind(this),touchEndEvent:this._mouseUpEvent.bind(this),mouseDoubleClickEvent:this._mouseDoubleClickEvent.bind(this),doubleTapEvent:this._mouseDoubleClickEvent.bind(this),mouseEnterEvent:this._mouseEnterEvent.bind(this),mouseLeaveEvent:this._mouseLeaveEvent.bind(this)};this._mouseEventHandler=new te(this._topCanvasBinding.canvasElement,r,{treatVertTouchDragAsPageScroll:()=>!1,treatHorzTouchDragAsPageScroll:()=>!0})}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose(),null!==this._priceScale&&this._priceScale.onMarksChanged().unsubscribeAll(this),this._priceScale=null}getElement(){return this._cell}fontSize(){return this._layoutOptions.fontSize}rendererOptions(){const t=this._rendererOptionsProvider.options();return this._font!==t.font&&(this._widthCache.reset(),this._font=t.font),t}optimalWidth(){if(null===this._priceScale)return 0;let t=0;const i=this.rendererOptions(),s=r(this._canvasBinding.canvasElement.getContext("2d"));s.save();const e=this._priceScale.marks();s.font=this._baseFont(),e.length>0&&(t=Math.max(this._widthCache.measureText(s,e[0].label),this._widthCache.measureText(s,e[e.length-1].label)));const h=this._backLabels();for(let i=h.length;i--;){const e=this._widthCache.measureText(s,h[i].text());e>t&&(t=e)}const n=this._priceScale.firstValue();if(null!==n&&null!==this._size){const i=this._priceScale.coordinateToPrice(1,n),e=this._priceScale.coordinateToPrice(this._size.height-2,n);t=Math.max(t,this._widthCache.measureText(s,this._priceScale.formatPrice(Math.floor(Math.min(i,e))+.11111111111111,n)),this._widthCache.measureText(s,this._priceScale.formatPrice(Math.ceil(Math.max(i,e))-.11111111111111,n)))}s.restore();const o=t||34;return Fs(Math.ceil(i.borderSize+i.tickLength+i.paddingInner+i.paddingOuter+5+o))}setSize(t){null!==this._size&&As(this._size,t)||(this._size=t,this._isSettingSize=!0,this._canvasBinding.resizeCanvasElement(t),this._topCanvasBinding.resizeCanvasElement(t),this._isSettingSize=!1,this._cell.style.width=`${t.width}px`,this._cell.style.height=`${t.height}px`)}getWidth(){return r(this._size).width}setPriceScale(t){this._priceScale!==t&&(null!==this._priceScale&&this._priceScale.onMarksChanged().unsubscribeAll(this),this._priceScale=t,t.onMarksChanged().subscribe(this._onMarksChanged.bind(this),this))}priceScale(){return this._priceScale}reset(){const t=this._pane.state();this._pane.chart().model().resetPriceScale(t,r(this.priceScale()))}paint(t){if(null===this._size)return;if(1!==t){this._alignLabels(),this._canvasBinding.applySuggestedBitmapSize();const t=zs(this._canvasBinding);null!==t&&(t.useBitmapCoordinateSpace((t=>{this._drawBackground(t),this._drawBorder(t)})),this._drawTickMarks(t),this._drawBackLabels(t))}this._topCanvasBinding.applySuggestedBitmapSize();const i=zs(this._topCanvasBinding);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this._drawCrosshairLabel(i))}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}update(){var t;null===(t=this._priceScale)||void 0===t||t.marks()}_mouseDownEvent(t){if(null===this._priceScale||this._priceScale.isEmpty()||!this._options.handleScale.axisPressedMouseMove.price)return;const i=this._pane.chart().model(),s=this._pane.state();this._mousedown=!0,i.startScalePrice(s,this._priceScale,t.localY)}_pressedMouseMoveEvent(t){if(null===this._priceScale||!this._options.handleScale.axisPressedMouseMove.price)return;const i=this._pane.chart().model(),s=this._pane.state(),e=this._priceScale;i.scalePriceTo(s,e,t.localY)}_mouseDownOutsideEvent(){if(null===this._priceScale||!this._options.handleScale.axisPressedMouseMove.price)return;const t=this._pane.chart().model(),i=this._pane.state(),s=this._priceScale;this._mousedown&&(this._mousedown=!1,t.endScalePrice(i,s))}_mouseUpEvent(t){if(null===this._priceScale||!this._options.handleScale.axisPressedMouseMove.price)return;const i=this._pane.chart().model(),s=this._pane.state();this._mousedown=!1,i.endScalePrice(s,this._priceScale)}_mouseDoubleClickEvent(t){this._options.handleScale.axisDoubleClickReset.price&&this.reset()}_mouseEnterEvent(t){if(null===this._priceScale)return;!this._pane.chart().model().options().handleScale.axisPressedMouseMove.price||this._priceScale.isPercentage()||this._priceScale.isIndexedTo100()||this._setCursor(1)}_mouseLeaveEvent(t){this._setCursor(0)}_backLabels(){const t=[],i=null===this._priceScale?void 0:this._priceScale;return(s=>{for(let e=0;e{t.fillStyle=s.borderColor;const o=Math.max(1,Math.floor(r)),l=Math.floor(.5*r),a=Math.round(e.tickLength*n);t.beginPath();for(const s of i)t.rect(Math.floor(h*n),Math.round(s.coord*r)-l,a,o);t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{var n;t.font=this._baseFont(),t.fillStyle=null!==(n=s.textColor)&&void 0!==n?n:this._layoutOptions.textColor,t.textAlign=this._isLeft?"right":"left",t.textBaseline="middle";const r=this._isLeft?Math.round(h-e.paddingInner):Math.round(h+e.tickLength+e.paddingInner),o=i.map((i=>this._widthCache.yMidCorrection(t,i.label)));for(let s=i.length;s--;){const e=i[s];t.fillText(e.label,r,e.coord+o[s])}}))}_alignLabels(){if(null===this._size||null===this._priceScale)return;let t=this._size.height/2;const i=[],s=this._priceScale.orderedSources().slice(),e=this._pane.state(),h=this.rendererOptions();this._priceScale===e.defaultVisiblePriceScale()&&this._pane.state().orderedSources().forEach((t=>{e.isOverlay(t)&&s.push(t)}));const n=this._priceScale.dataSources()[0],r=this._priceScale;s.forEach((s=>{const h=s.priceAxisViews(e,r);h.forEach((t=>{t.setFixedCoordinate(null),t.isVisible()&&i.push(t)})),n===s&&h.length>0&&(t=h[0].coordinate())})),i.forEach((t=>t.setFixedCoordinate(t.coordinate())));this._priceScale.options().alignLabels&&this._fixLabelOverlap(i,h,t)}_fixLabelOverlap(t,i,s){if(null===this._size)return;const e=t.filter((t=>t.coordinate()<=s)),h=t.filter((t=>t.coordinate()>s));e.sort(((t,i)=>i.coordinate()-t.coordinate())),e.length&&h.length&&h.push(e[0]),h.sort(((t,i)=>t.coordinate()-i.coordinate()));for(const s of t){const t=Math.floor(s.height(i)/2),e=s.coordinate();e>-t&&ethis._size.height-t&&eo-n&&s.setFixedCoordinate(o-n)}for(let t=1;t{if(i.isAxisLabelVisible()){i.renderer(r(this._priceScale)).draw(t,s,this._widthCache,e)}}))}_drawCrosshairLabel(t){if(null===this._size||null===this._priceScale)return;const i=this._pane.chart().model(),s=[],e=this._pane.state(),h=i.crosshairSource().priceAxisViews(e,this._priceScale);h.length&&s.push(h);const n=this.rendererOptions(),o=this._isLeft?"right":"left";s.forEach((i=>{i.forEach((i=>{i.renderer(r(this._priceScale)).draw(t,n,this._widthCache,o)}))}))}_setCursor(t){this._cell.style.cursor=1===t?"ns-resize":"default"}_onMarksChanged(){const t=this.optimalWidth();this._prevOptimalWidth{this._isSettingSize||null===this._state||this._model().lightUpdate()},this._topCanvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||null===this._state||this._model().lightUpdate()},this._chart=t,this._state=i,this._state.onDestroyed().subscribe(this._onStateDestroyed.bind(this),this,!0),this._paneCell=document.createElement("td"),this._paneCell.style.padding="0",this._paneCell.style.position="relative";const s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this._leftAxisCell=document.createElement("td"),this._leftAxisCell.style.padding="0",this._rightAxisCell=document.createElement("td"),this._rightAxisCell.style.padding="0",this._paneCell.appendChild(s),this._canvasBinding=Js(s,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler);const e=this._canvasBinding.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this._topCanvasBinding=Js(s,Ds({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",this._rowElement=document.createElement("tr"),this._rowElement.appendChild(this._leftAxisCell),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rightAxisCell),this.updatePriceAxisWidgetsStates(),this._mouseEventHandler=new te(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:()=>null===this._startTrackPoint&&!this._chart.options().handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:()=>null===this._startTrackPoint&&!this._chart.options().handleScroll.horzTouchDrag})}destroy(){null!==this._leftPriceAxisWidget&&this._leftPriceAxisWidget.destroy(),null!==this._rightPriceAxisWidget&&this._rightPriceAxisWidget.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose(),null!==this._state&&this._state.onDestroyed().unsubscribeAll(this),this._mouseEventHandler.destroy()}state(){return r(this._state)}setState(t){null!==this._state&&this._state.onDestroyed().unsubscribeAll(this),this._state=t,null!==this._state&&this._state.onDestroyed().subscribe(de.prototype._onStateDestroyed.bind(this),this,!0),this.updatePriceAxisWidgetsStates()}chart(){return this._chart}getElement(){return this._rowElement}updatePriceAxisWidgetsStates(){if(null!==this._state&&(this._recreatePriceAxisWidgets(),0!==this._model().serieses().length)){if(null!==this._leftPriceAxisWidget){const t=this._state.leftPriceScale();this._leftPriceAxisWidget.setPriceScale(r(t))}if(null!==this._rightPriceAxisWidget){const t=this._state.rightPriceScale();this._rightPriceAxisWidget.setPriceScale(r(t))}}}updatePriceAxisWidgets(){null!==this._leftPriceAxisWidget&&this._leftPriceAxisWidget.update(),null!==this._rightPriceAxisWidget&&this._rightPriceAxisWidget.update()}stretchFactor(){return null!==this._state?this._state.stretchFactor():0}setStretchFactor(t){this._state&&this._state.setStretchFactor(t)}mouseEnterEvent(t){if(!this._state)return;this._onMouseEvent();const i=t.localX,s=t.localY;this._setCrosshairPosition(i,s,t)}mouseDownEvent(t){this._onMouseEvent(),this._mouseTouchDownEvent(),this._setCrosshairPosition(t.localX,t.localY,t)}mouseMoveEvent(t){if(!this._state)return;this._onMouseEvent();const i=t.localX,s=t.localY;this._setCrosshairPosition(i,s,t);const e=this.hitTest(i,s);this._model().setHoveredSource(e&&{source:e.source,object:e.object})}mouseClickEvent(t){null!==this._state&&(this._onMouseEvent(),this._fireClickedDelegate(t))}pressedMouseMoveEvent(t){this._onMouseEvent(),this._pressedMouseTouchMoveEvent(t),this._setCrosshairPosition(t.localX,t.localY,t)}mouseUpEvent(t){null!==this._state&&(this._onMouseEvent(),this._longTap=!1,this._endScroll(t))}tapEvent(t){null!==this._state&&this._fireClickedDelegate(t)}longTapEvent(t){if(this._longTap=!0,null===this._startTrackPoint){const i={x:t.localX,y:t.localY};this._startTrackingMode(i,i,t)}}mouseLeaveEvent(t){null!==this._state&&(this._onMouseEvent(),this._state.model().setHoveredSource(null),this._clearCrosshairPosition())}clicked(){return this._clicked}pinchStartEvent(){this._prevPinchScale=1,this._model().stopTimeScaleAnimation()}pinchEvent(t,i){if(!this._chart.options().handleScale.pinch)return;const s=5*(i-this._prevPinchScale);this._prevPinchScale=i,this._model().zoomTime(t.x,s)}touchStartEvent(t){if(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._mouseTouchDownEvent(),null!==this._startTrackPoint){const i=this._model().crosshairSource();this._initCrosshairPosition={x:i.appliedX(),y:i.appliedY()},this._startTrackPoint={x:t.localX,y:t.localY}}}touchMoveEvent(t){if(null===this._state)return;const i=t.localX,s=t.localY;if(null===this._startTrackPoint)this._pressedMouseTouchMoveEvent(t);else{this._exitTrackingModeOnNextTry=!1;const e=r(this._initCrosshairPosition),h=e.x+(i-this._startTrackPoint.x),n=e.y+(s-this._startTrackPoint.y);this._setCrosshairPosition(h,n,t)}}touchEndEvent(t){0===this.chart().options().trackingMode.exitMode&&(this._exitTrackingModeOnNextTry=!0),this._tryExitTrackingMode(),this._endScroll(t)}hitTest(t,i){const s=this._state;if(null===s)return null;const e=s.orderedSources();for(const h of e){const e=this._hitTestPaneView(h.paneViews(s),t,i);if(null!==e)return{source:h,view:e.view,object:e.object}}return null}setPriceAxisSize(t,i){r("left"===i?this._leftPriceAxisWidget:this._rightPriceAxisWidget).setSize(Ds({width:t,height:this._size.height}))}getSize(){return this._size}setSize(t){As(this._size,t)||(this._size=t,this._isSettingSize=!0,this._canvasBinding.resizeCanvasElement(t),this._topCanvasBinding.resizeCanvasElement(t),this._isSettingSize=!1,this._paneCell.style.width=t.width+"px",this._paneCell.style.height=t.height+"px")}recalculatePriceScales(){const t=r(this._state);t.recalculatePriceScale(t.leftPriceScale()),t.recalculatePriceScale(t.rightPriceScale());for(const i of t.dataSources())if(t.isOverlay(i)){const s=i.priceScale();null!==s&&t.recalculatePriceScale(s),i.updateAllViews()}}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}paint(t){if(0===t)return;if(null===this._state)return;if(t>1&&this.recalculatePriceScales(),null!==this._leftPriceAxisWidget&&this._leftPriceAxisWidget.paint(t),null!==this._rightPriceAxisWidget&&this._rightPriceAxisWidget.paint(t),1!==t){this._canvasBinding.applySuggestedBitmapSize();const t=zs(this._canvasBinding);null!==t&&(t.useBitmapCoordinateSpace((t=>{this._drawBackground(t)})),this._state&&(this._drawGrid(t),this._drawWatermark(t),this._drawSources(t,ae),this._drawSources(t,ue)))}this._topCanvasBinding.applySuggestedBitmapSize();const i=zs(this._topCanvasBinding);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this._drawSources(i,ce),this._drawCrosshair(i))}leftPriceAxisWidget(){return this._leftPriceAxisWidget}rightPriceAxisWidget(){return this._rightPriceAxisWidget}setCrosshair(t,i,s){if(this._state)if(s){const s=t,e=i;this._setCrosshairPositionNoFire(s,e)}else this._state.model().setHoveredSource(null),this._clearCrosshairPosition()}_onStateDestroyed(){null!==this._state&&this._state.onDestroyed().unsubscribeAll(this),this._state=null}_fireClickedDelegate(t){const i=t.localX,s=t.localY;this._clicked.hasListeners()&&this._clicked.fire(this._model().timeScale().coordinateToIndex(i),{x:i,y:s},t)}_drawBackground({context:t,bitmapSize:i}){const{width:s,height:e}=i,h=this._model(),n=h.backgroundTopColor(),r=h.backgroundBottomColor();n===r?F(t,0,0,s,e,r):$(t,0,0,s,e,n,r)}_drawGrid(t){const i=r(this._state).grid().paneView().renderer();null!==i&&i.draw(t,!1)}_drawWatermark(t){const i=this._model().watermarkSource();this._drawSourceImpl(t,ae,oe,i),this._drawSourceImpl(t,ae,le,i)}_drawCrosshair(t){this._drawSourceImpl(t,ae,le,this._model().crosshairSource())}_drawSources(t,i){const s=r(this._state).orderedSources();for(const e of s)this._drawSourceImpl(t,i,oe,e);for(const e of s)this._drawSourceImpl(t,i,le,e)}_drawSourceImpl(t,i,s,e){const h=r(this._state),n=i(e,h),o=h.model().hoveredSource(),l=null!==o&&o.source===e,a=null!==o&&l&&void 0!==o.object?o.object.hitTestData:void 0;for(const i of n){const e=i.renderer();null!==e&&s(e,t,l,a)}}_hitTestPaneView(t,i,s){for(const e of t){const t=e.renderer();if(null!==t&&t.hitTest){const h=t.hitTest(i,s);if(null!==h)return{view:e,object:h}}}return null}_recreatePriceAxisWidgets(){if(null===this._state)return;const t=this._chart,i=this._state.leftPriceScale().options().visible,s=this._state.rightPriceScale().options().visible;i||null===this._leftPriceAxisWidget||(this._leftAxisCell.removeChild(this._leftPriceAxisWidget.getElement()),this._leftPriceAxisWidget.destroy(),this._leftPriceAxisWidget=null),s||null===this._rightPriceAxisWidget||(this._rightAxisCell.removeChild(this._rightPriceAxisWidget.getElement()),this._rightPriceAxisWidget.destroy(),this._rightPriceAxisWidget=null);const e=t.model().rendererOptionsProvider();i&&null===this._leftPriceAxisWidget&&(this._leftPriceAxisWidget=new re(this,t.options(),e,"left"),this._leftAxisCell.appendChild(this._leftPriceAxisWidget.getElement())),s&&null===this._rightPriceAxisWidget&&(this._rightPriceAxisWidget=new re(this,t.options(),e,"right"),this._rightAxisCell.appendChild(this._rightPriceAxisWidget.getElement()))}_preventScroll(t){return t.isTouch&&this._longTap||null!==this._startTrackPoint}_correctXCoord(t){return Math.max(0,Math.min(t,this._size.width-1))}_correctYCoord(t){return Math.max(0,Math.min(t,this._size.height-1))}_setCrosshairPosition(t,i,s){this._model().setAndSaveCurrentPosition(this._correctXCoord(t),this._correctYCoord(i),s,r(this._state))}_setCrosshairPositionNoFire(t,i){this._model().setAndSaveCurrentPositionFire(this._correctXCoord(t),this._correctYCoord(i),!1,r(this._state))}_clearCrosshairPosition(){this._model().clearCurrentPosition()}_tryExitTrackingMode(){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,this._clearCrosshairPosition())}_startTrackingMode(t,i,s){this._startTrackPoint=t,this._exitTrackingModeOnNextTry=!1,this._setCrosshairPosition(i.x,i.y,s);const e=this._model().crosshairSource();this._initCrosshairPosition={x:e.appliedX(),y:e.appliedY()}}_model(){return this._chart.model()}_endScroll(t){if(!this._isScrolling)return;const i=this._model(),s=this.state();if(i.endScrollPrice(s,s.defaultPriceScale()),this._startScrollingPos=null,this._isScrolling=!1,i.endScrollTime(),null!==this._scrollXAnimation){const t=performance.now(),s=i.timeScale();this._scrollXAnimation.start(s.rightOffset(),t),this._scrollXAnimation.finished(t)||i.setTimeScaleAnimation(this._scrollXAnimation)}}_onMouseEvent(){this._startTrackPoint=null}_mouseTouchDownEvent(){if(!this._state)return;if(this._model().stopTimeScaleAnimation(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)r(document.activeElement).blur();else{const t=document.getSelection();null!==t&&t.removeAllRanges()}!this._state.defaultPriceScale().isEmpty()&&this._model().timeScale().isEmpty()}_pressedMouseTouchMoveEvent(t){if(null===this._state)return;const i=this._model(),s=i.timeScale();if(s.isEmpty())return;const e=this._chart.options(),h=e.handleScroll,n=e.kineticScroll;if((!h.pressedMouseMove||t.isTouch)&&(!h.horzTouchDrag&&!h.vertTouchDrag||!t.isTouch))return;const r=this._state.defaultPriceScale(),o=performance.now();if(null!==this._startScrollingPos||this._preventScroll(t)||(this._startScrollingPos={x:t.clientX,y:t.clientY,timestamp:o,localX:t.localX,localY:t.localY}),null!==this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==t.clientX||this._startScrollingPos.y!==t.clientY)){if(t.isTouch&&n.touch||!t.isTouch&&n.mouse){const t=s.barSpacing();this._scrollXAnimation=new Gs(.2/t,7/t,.997,15/t),this._scrollXAnimation.addPosition(s.rightOffset(),this._startScrollingPos.timestamp)}else this._scrollXAnimation=null;r.isEmpty()||i.startScrollPrice(this._state,r,t.localY),i.startScrollTime(t.localX),this._isScrolling=!0}this._isScrolling&&(r.isEmpty()||i.scrollPriceTo(this._state,r,t.localY),i.scrollTimeTo(t.localX),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(s.rightOffset(),o))}}class fe{constructor(t,i,s,e,h){this._invalidated=!0,this._size=Ds({width:0,height:0}),this._canvasSuggestedBitmapSizeChangedHandler=()=>this.paint(3),this._isLeft="left"===t,this._rendererOptionsProvider=s.rendererOptionsProvider,this._options=i,this._borderVisible=e,this._bottomColor=h,this._cell=document.createElement("div"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.overflow="hidden",this._canvasBinding=Js(this._cell,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler)}destroy(){this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose()}getElement(){return this._cell}getSize(){return this._size}setSize(t){As(this._size,t)||(this._size=t,this._canvasBinding.resizeCanvasElement(t),this._cell.style.width=`${t.width}px`,this._cell.style.height=`${t.height}px`,this._invalidated=!0)}paint(t){if(t<3&&!this._invalidated)return;if(0===this._size.width||0===this._size.height)return;this._invalidated=!1,this._canvasBinding.applySuggestedBitmapSize();const i=zs(this._canvasBinding);null!==i&&i.useBitmapCoordinateSpace((t=>{this._drawBackground(t),this._drawBorder(t)}))}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}_drawBorder({context:t,bitmapSize:i,horizontalPixelRatio:s,verticalPixelRatio:e}){if(!this._borderVisible())return;t.fillStyle=this._options.timeScale.borderColor;const h=Math.floor(this._rendererOptionsProvider.options().borderSize*s),n=Math.floor(this._rendererOptionsProvider.options().borderSize*e),r=this._isLeft?i.width-h:0;t.fillRect(r,0,h,n)}_drawBackground({context:t,bitmapSize:i}){F(t,0,0,i.width,i.height,this._bottomColor())}}function pe(t,i){return t.weight>i.weight?t:i}!function(t){t[t.BorderSize=1]="BorderSize",t[t.TickLength=5]="TickLength"}(Ys||(Ys={})),function(t){t[t.Default=0]="Default",t[t.EwResize=1]="EwResize"}(Xs||(Xs={}));class me{constructor(t){this._leftStub=null,this._rightStub=null,this._rendererOptions=null,this._mouseDown=!1,this._size=Ds({width:0,height:0}),this._sizeChanged=new b,this._widthCache=new Yt(5),this._isSettingSize=!1,this._canvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||this._chart.model().lightUpdate()},this._topCanvasSuggestedBitmapSizeChangedHandler=()=>{this._isSettingSize||this._chart.model().lightUpdate()},this._chart=t,this._options=t.options().layout,this._element=document.createElement("tr"),this._leftStubCell=document.createElement("td"),this._leftStubCell.style.padding="0",this._rightStubCell=document.createElement("td"),this._rightStubCell.style.padding="0",this._cell=document.createElement("td"),this._cell.style.height="25px",this._cell.style.padding="0",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._canvasBinding=Js(this._dv,Ds({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler);const i=this._canvasBinding.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this._topCanvasBinding=Js(this._dv,Ds({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler);const s=this._topCanvasBinding.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this._element.appendChild(this._leftStubCell),this._element.appendChild(this._cell),this._element.appendChild(this._rightStubCell),this._recreateStubs(),this._chart.model().priceScalesOptionsChanged().subscribe(this._recreateStubs.bind(this),this),this._mouseEventHandler=new te(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:()=>!0,treatHorzTouchDragAsPageScroll:()=>!1})}destroy(){this._mouseEventHandler.destroy(),null!==this._leftStub&&this._leftStub.destroy(),null!==this._rightStub&&this._rightStub.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._topCanvasSuggestedBitmapSizeChangedHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasSuggestedBitmapSizeChangedHandler),this._canvasBinding.dispose()}getElement(){return this._element}leftStub(){return this._leftStub}rightStub(){return this._rightStub}mouseDownEvent(t){if(this._mouseDown)return;this._mouseDown=!0;const i=this._chart.model();!i.timeScale().isEmpty()&&this._chart.options().handleScale.axisPressedMouseMove.time&&i.startScaleTime(t.localX)}touchStartEvent(t){this.mouseDownEvent(t)}mouseDownOutsideEvent(){const t=this._chart.model();!t.timeScale().isEmpty()&&this._mouseDown&&(this._mouseDown=!1,this._chart.options().handleScale.axisPressedMouseMove.time&&t.endScaleTime())}pressedMouseMoveEvent(t){const i=this._chart.model();!i.timeScale().isEmpty()&&this._chart.options().handleScale.axisPressedMouseMove.time&&i.scaleTimeTo(t.localX)}touchMoveEvent(t){this.pressedMouseMoveEvent(t)}mouseUpEvent(){this._mouseDown=!1;const t=this._chart.model();t.timeScale().isEmpty()&&!this._chart.options().handleScale.axisPressedMouseMove.time||t.endScaleTime()}touchEndEvent(){this.mouseUpEvent()}mouseDoubleClickEvent(){this._chart.options().handleScale.axisDoubleClickReset.time&&this._chart.model().resetTimeScale()}doubleTapEvent(){this.mouseDoubleClickEvent()}mouseEnterEvent(){this._chart.model().options().handleScale.axisPressedMouseMove.time&&this._setCursor(1)}mouseLeaveEvent(){this._setCursor(0)}getSize(){return this._size}sizeChanged(){return this._sizeChanged}setSizes(t,i,s){As(this._size,t)||(this._size=t,this._isSettingSize=!0,this._canvasBinding.resizeCanvasElement(t),this._topCanvasBinding.resizeCanvasElement(t),this._isSettingSize=!1,this._cell.style.width=`${t.width}px`,this._cell.style.height=`${t.height}px`,this._sizeChanged.fire(t)),null!==this._leftStub&&this._leftStub.setSize(Ds({width:i,height:t.height})),null!==this._rightStub&&this._rightStub.setSize(Ds({width:s,height:t.height}))}optimalHeight(){const t=this._getRendererOptions();return Math.ceil(t.borderSize+t.tickLength+t.fontSize+t.paddingTop+t.paddingBottom+t.labelBottomOffset)}update(){this._chart.model().timeScale().marks()}getBitmapSize(){return this._canvasBinding.bitmapSize}drawBitmap(t,i,s){const e=this.getBitmapSize();e.width>0&&e.height>0&&t.drawImage(this._canvasBinding.canvasElement,i,s)}paint(t){if(0===t)return;if(1!==t){this._canvasBinding.applySuggestedBitmapSize();const i=zs(this._canvasBinding);null!==i&&(i.useBitmapCoordinateSpace((t=>{this._drawBackground(t),this._drawBorder(t)})),this._drawTickMarks(i)),null!==this._leftStub&&this._leftStub.paint(t),null!==this._rightStub&&this._rightStub.paint(t)}this._topCanvasBinding.applySuggestedBitmapSize();const i=zs(this._topCanvasBinding);null!==i&&(i.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this._drawLabels([this._chart.model().crosshairSource()],i))}_drawBackground({context:t,bitmapSize:i}){F(t,0,0,i.width,i.height,this._chart.model().backgroundBottomColor())}_drawBorder({context:t,bitmapSize:i,verticalPixelRatio:s}){if(this._chart.options().timeScale.borderVisible){t.fillStyle=this._lineColor();const e=Math.max(1,Math.floor(this._getRendererOptions().borderSize*s));t.fillRect(0,0,i.width,e)}}_drawTickMarks(t){const i=this._chart.model().timeScale(),s=i.marks();if(!s||0===s.length)return;let e=s.reduce(pe,s[0]).weight;e>30&&e<50&&(e=30);const h=this._getRendererOptions(),n=i.options();n.borderVisible&&n.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:e})=>{t.strokeStyle=this._lineColor(),t.fillStyle=this._lineColor();const n=Math.max(1,Math.floor(i)),r=Math.floor(.5*i);t.beginPath();const o=Math.round(h.tickLength*e);for(let e=s.length;e--;){const h=Math.round(s[e].coord*i);t.rect(h-r,0,n,o)}t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{const i=h.borderSize+h.tickLength+h.paddingTop+h.fontSize/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this._textColor(),t.font=this._baseFont();for(const h of s)if(h.weight=e){const s=h.needAlignCoordinate?this._alignTickMarkLabelCoordinate(t,h.coord,h.label):h.coord;t.fillText(h.label,s,i)}}))}_alignTickMarkLabelCoordinate(t,i,s){const e=this._widthCache.measureText(t,s),h=e/2,n=Math.floor(i-h)+.5;return n<0?i+=Math.abs(0-n):n+e>this._size.width&&(i-=Math.abs(this._size.width-(n+e))),i}_drawLabels(t,i){const s=this._getRendererOptions();for(const e of t)for(const t of e.timeAxisViews())t.renderer().draw(i,s)}_lineColor(){return this._chart.options().timeScale.borderColor}_textColor(){return this._options.textColor}_fontSize(){return this._options.fontSize}_baseFont(){return T(this._fontSize(),this._options.fontFamily)}_baseBoldFont(){return T(this._fontSize(),this._options.fontFamily,"bold")}_getRendererOptions(){null===this._rendererOptions&&(this._rendererOptions={borderSize:1,baselineOffset:NaN,paddingTop:NaN,paddingBottom:NaN,paddingHorizontal:NaN,tickLength:5,fontSize:NaN,font:"",widthCache:new Yt,labelBottomOffset:0});const t=this._rendererOptions,i=this._baseFont();if(t.font!==i){const s=this._fontSize();t.fontSize=s,t.font=i,t.paddingTop=3*s/12,t.paddingBottom=3*s/12,t.paddingHorizontal=9*s/12,t.baselineOffset=0,t.labelBottomOffset=4*s/12,t.widthCache.reset()}return this._rendererOptions}_setCursor(t){this._cell.style.cursor=1===t?"ew-resize":"default"}_recreateStubs(){const t=this._chart.model(),i=t.options();i.leftPriceScale.visible||null===this._leftStub||(this._leftStubCell.removeChild(this._leftStub.getElement()),this._leftStub.destroy(),this._leftStub=null),i.rightPriceScale.visible||null===this._rightStub||(this._rightStubCell.removeChild(this._rightStub.getElement()),this._rightStub.destroy(),this._rightStub=null);const s={rendererOptionsProvider:this._chart.model().rendererOptionsProvider()},e=()=>i.leftPriceScale.borderVisible&&t.timeScale().options().borderVisible,h=()=>t.backgroundBottomColor();i.leftPriceScale.visible&&null===this._leftStub&&(this._leftStub=new fe("left",i,s,e,h),this._leftStubCell.appendChild(this._leftStub.getElement())),i.rightPriceScale.visible&&null===this._rightStub&&(this._rightStub=new fe("right",i,s,e,h),this._rightStubCell.appendChild(this._rightStub.getElement()))}}const ve=!!Is&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!Is&&((null===(be=null===navigator||void 0===navigator?void 0:navigator.userAgentData)||void 0===be?void 0:be.platform)?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);var be;class ge{constructor(t,i){var s;this._paneWidgets=[],this._drawRafId=0,this._height=0,this._width=0,this._leftPriceAxisWidth=0,this._rightPriceAxisWidth=0,this._invalidateMask=null,this._drawPlanned=!1,this._clicked=new b,this._crosshairMoved=new b,this._observer=null,this._container=t,this._options=i,this._element=document.createElement("div"),this._element.classList.add("tv-lightweight-charts"),this._element.style.overflow="hidden",this._element.style.direction="ltr",this._element.style.width="100%",this._element.style.height="100%",(s=this._element).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this._tableElement=document.createElement("table"),this._tableElement.setAttribute("cellspacing","0"),this._element.appendChild(this._tableElement),this._onWheelBound=this._onMousewheel.bind(this),we(this._options)&&this._setMouseWheelEventListener(!0),this._model=new Ts(this._invalidateHandler.bind(this),this._options),this.model().crosshairMoved().subscribe(this._onPaneWidgetCrosshairMoved.bind(this),this),this._timeAxisWidget=new me(this),this._tableElement.appendChild(this._timeAxisWidget.getElement());const e=i.autoSize&&this._installObserver();let h=this._options.width,n=this._options.height;if(e||0===h||0===n){const i=t.getBoundingClientRect();h=h||i.width,n=n||i.height}this.resize(h,n),this._syncGuiWithModel(),t.appendChild(this._element),this._updateTimeAxisVisibility(),this._model.timeScale().optionsApplied().subscribe(this._model.fullUpdate.bind(this._model),this),this._model.priceScalesOptionsChanged().subscribe(this._model.fullUpdate.bind(this._model),this)}model(){return this._model}options(){return this._options}paneWidgets(){return this._paneWidgets}timeAxisWidget(){return this._timeAxisWidget}destroy(){this._setMouseWheelEventListener(!1),0!==this._drawRafId&&window.cancelAnimationFrame(this._drawRafId),this._model.crosshairMoved().unsubscribeAll(this),this._model.timeScale().optionsApplied().unsubscribeAll(this),this._model.priceScalesOptionsChanged().unsubscribeAll(this),this._model.destroy();for(const t of this._paneWidgets)this._tableElement.removeChild(t.getElement()),t.clicked().unsubscribeAll(this),t.destroy();this._paneWidgets=[],r(this._timeAxisWidget).destroy(),null!==this._element.parentElement&&this._element.parentElement.removeChild(this._element),this._crosshairMoved.destroy(),this._clicked.destroy(),this._uninstallObserver()}resize(t,i,s=!1){if(this._height===i&&this._width===t)return;const e=function(t){const i=Math.floor(t.width),s=Math.floor(t.height);return Ds({width:i-i%2,height:s-s%2})}(Ds({width:t,height:i}));this._height=e.height,this._width=e.width;const h=this._height+"px",n=this._width+"px";r(this._element).style.height=h,r(this._element).style.width=n,this._tableElement.style.height=h,this._tableElement.style.width=n,s?this._drawImpl(ht.full(),performance.now()):this._model.fullUpdate()}paint(t){void 0===t&&(t=ht.full());for(let i=0;i{let e=0;for(let h=0;h{r("left"===i?this._timeAxisWidget.leftStub():this._timeAxisWidget.rightStub()).drawBitmap(r(t),s,e)};if(this._options.timeScale.visible){const i=this._timeAxisWidget.getBitmapSize();if(null!==t){let h=0;this._isLeftAxisVisible()&&(n("left",h,s),h=r(e.leftPriceAxisWidget()).getBitmapSize().width),this._timeAxisWidget.drawBitmap(t,h,s),h+=i.width,this._isRightAxisVisible()&&n("right",h,s)}s+=i.height}return Ds({width:i,height:s})}_adjustSizeImpl(){let t=0,i=0,s=0;for(const e of this._paneWidgets)this._isLeftAxisVisible()&&(i=Math.max(i,r(e.leftPriceAxisWidget()).optimalWidth())),this._isRightAxisVisible()&&(s=Math.max(s,r(e.rightPriceAxisWidget()).optimalWidth())),t+=e.stretchFactor();i=Fs(i),s=Fs(s);const e=this._width,h=this._height,n=Math.max(e-i-s,0),o=this._options.timeScale.visible;let l=o?this._timeAxisWidget.optimalHeight():0;var a;l=(a=l)+a%2;const u=0+l,c=h{t.updatePriceAxisWidgets()})),3===(null===(s=this._invalidateMask)||void 0===s?void 0:s.fullInvalidation())&&(this._invalidateMask.merge(t),this._updateGui(),this._applyMomentaryAutoScale(this._invalidateMask),this._applyTimeScaleInvalidations(this._invalidateMask,i),t=this._invalidateMask,this._invalidateMask=null)),this.paint(t)}_applyTimeScaleInvalidations(t,i){for(const s of t.timeScaleInvalidations())this._applyTimeScaleInvalidation(s,i)}_applyMomentaryAutoScale(t){const i=this._model.panes();for(let s=0;s{if(this._drawPlanned=!1,this._drawRafId=0,null!==this._invalidateMask){const i=this._invalidateMask;this._invalidateMask=null,this._drawImpl(i,t);for(const s of i.timeScaleInvalidations())if(5===s.type&&!s.value.finished(t)){this.model().setTimeScaleAnimation(s.value);break}}})))}_updateGui(){this._syncGuiWithModel()}_syncGuiWithModel(){const t=this._model.panes(),i=t.length,s=this._paneWidgets.length;for(let t=i;t{const s=i.bars().search(t);null!==s&&h.set(i,s)}))}let n;if(null!==t){const i=null===(e=this._model.timeScale().indexToTimeScalePoint(t))||void 0===e?void 0:e.originalTime;void 0!==i&&(n=i)}const r=this.model().hoveredSource(),o=null!==r&&r.source instanceof Bi?r.source:void 0,l=null!==r&&void 0!==r.object?r.object.externalId:void 0;return{time:n,index:null!=t?t:void 0,point:null!=i?i:void 0,hoveredSeries:o,seriesData:h,hoveredObject:l,touchMouseEventData:null!=s?s:void 0}}_onPaneWidgetClicked(t,i,s){this._clicked.fire((()=>this._getMouseEventParamsImpl(t,i,s)))}_onPaneWidgetCrosshairMoved(t,i,s){this._crosshairMoved.fire((()=>this._getMouseEventParamsImpl(t,i,s)))}_updateTimeAxisVisibility(){const t=this._options.timeScale.visible?"":"none";this._timeAxisWidget.getElement().style.display=t}_isLeftAxisVisible(){return this._paneWidgets[0].state().leftPriceScale().options().visible}_isRightAxisVisible(){return this._paneWidgets[0].state().rightPriceScale().options().visible}_installObserver(){return"ResizeObserver"in window&&(this._observer=new ResizeObserver((t=>{const i=t.find((t=>t.target===this._container));i&&this.resize(i.contentRect.width,i.contentRect.height)})),this._observer.observe(this._container,{box:"border-box"}),!0)}_uninstallObserver(){null!==this._observer&&this._observer.disconnect()}}function we(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function Me(t,i,s,e){const h=s.value,n={index:i,time:t,value:[h,h,h,h],originalTime:e};return void 0!==s.color&&(n.color=s.color),n}function Se(t){return void 0!==t.value}function xe(t){return(i,s,e,h)=>{return void 0===(n=e).open&&void 0===n.value?{time:i,index:s,originalTime:h}:t(i,s,e,h);var n}}const _e={Candlestick:xe((function(t,i,s,e){const h={index:i,time:t,value:[s.open,s.high,s.low,s.close],originalTime:e};return void 0!==s.color&&(h.color=s.color),void 0!==s.borderColor&&(h.borderColor=s.borderColor),void 0!==s.wickColor&&(h.wickColor=s.wickColor),h})),Bar:xe((function(t,i,s,e){const h={index:i,time:t,value:[s.open,s.high,s.low,s.close],originalTime:e};return void 0!==s.color&&(h.color=s.color),h})),Area:xe((function(t,i,s,e){const h=s.value,n={index:i,time:t,value:[h,h,h,h],originalTime:e};return void 0!==s.lineColor&&(n.lineColor=s.lineColor),void 0!==s.topColor&&(n.topColor=s.topColor),void 0!==s.bottomColor&&(n.bottomColor=s.bottomColor),n})),Baseline:xe((function(t,i,s,e){const h=s.value,n={index:i,time:t,value:[h,h,h,h],originalTime:e};return void 0!==s.topLineColor&&(n.topLineColor=s.topLineColor),void 0!==s.bottomLineColor&&(n.bottomLineColor=s.bottomLineColor),void 0!==s.topFillColor1&&(n.topFillColor1=s.topFillColor1),void 0!==s.topFillColor2&&(n.topFillColor2=s.topFillColor2),void 0!==s.bottomFillColor1&&(n.bottomFillColor1=s.bottomFillColor1),void 0!==s.bottomFillColor2&&(n.bottomFillColor2=s.bottomFillColor2),n})),Histogram:xe(Me),Line:xe(Me)};function ye(t){return _e[t]}function ke(t){return 60*t*60*1e3}function Ce(t){return 60*t*1e3}const Te=[{divisor:(Pe=1,1e3*Pe),weight:10},{divisor:Ce(1),weight:20},{divisor:Ce(5),weight:21},{divisor:Ce(30),weight:22},{divisor:ke(1),weight:30},{divisor:ke(3),weight:31},{divisor:ke(6),weight:32},{divisor:ke(12),weight:33}];var Pe;function Re(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let s=Te.length-1;s>=0;--s)if(Math.floor(i.getTime()/Te[s].divisor)!==Math.floor(t.getTime()/Te[s].divisor))return Te[s].weight;return 0}function De(t,i=0){if(0===t.length)return;let s=0===i?null:t[i-1].time.timestamp,e=null!==s?new Date(1e3*s):null,h=0;for(let n=i;n1){const i=Math.ceil(h/(t.length-1)),s=new Date(1e3*(t[0].time.timestamp-i));t[0].timeWeight=Re(new Date(1e3*t[0].time.timestamp),s)}}function Ae(t){if(!Ps(t))throw new Error("time must be of type BusinessDay");const i=new Date(Date.UTC(t.year,t.month-1,t.day,0,0,0,0));return{timestamp:Math.round(i.getTime()/1e3),businessDay:t}}function Ee(t){if(!Rs(t))throw new Error("time must be of type isUTCTimestamp");return{timestamp:t}}function Oe(t){return 0===t.length?null:Ps(t[0].time)?Ae:Ee}function Be(t){return Rs(t)?Ee(t):Ps(t)?Ae(t):Ae(Le(t))}function Le(t){const i=new Date(t);if(isNaN(i.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function ze(t){S(t.time)&&(t.time=Le(t.time))}function Ie(t){return{index:0,mapping:new Map,timePoint:t}}function Ne(t){if(void 0!==t&&0!==t.length)return{firstTime:t[0].time.timestamp,lastTime:t[t.length-1].time.timestamp}}function Ve(t){let i;return t.forEach((t=>{void 0===i&&(i=t.originalTime)})),n(i)}function Fe(t){void 0===t.originalTime&&(t.originalTime=t.time)}class We{constructor(){this._pointDataByTimePoint=new Map,this._seriesRowsBySeries=new Map,this._seriesLastTimePoint=new Map,this._sortedTimePoints=[]}destroy(){this._pointDataByTimePoint.clear(),this._seriesRowsBySeries.clear(),this._seriesLastTimePoint.clear(),this._sortedTimePoints=[]}setSeriesData(t,i){let s=0!==this._pointDataByTimePoint.size,e=!1;const h=this._seriesRowsBySeries.get(t);if(void 0!==h)if(1===this._seriesRowsBySeries.size)s=!1,e=!0,this._pointDataByTimePoint.clear();else for(const i of this._sortedTimePoints)i.pointData.mapping.delete(t)&&(e=!0);let n=[];if(0!==i.length){const s=i;s.forEach((t=>Fe(t))),function(t){t.forEach(ze)}(i);const h=r(Oe(i)),o=ye(t.seriesType());n=s.map((i=>{const s=h(i.time);let n=this._pointDataByTimePoint.get(s.timestamp);void 0===n&&(n=Ie(s),this._pointDataByTimePoint.set(s.timestamp,n),e=!0);const r=o(s,n.index,i,i.originalTime);return n.mapping.set(t,r),r}))}s&&this._cleanupPointsData(),this._setRowsToSeries(t,n);let o=-1;if(e){const t=[];this._pointDataByTimePoint.forEach((i=>{t.push({timeWeight:0,time:i.timePoint,pointData:i,originalTime:Ve(i.mapping)})})),t.sort(((t,i)=>t.time.timestamp-i.time.timestamp)),o=this._replaceTimeScalePoints(t)}return this._getUpdateResponse(t,o,function(t,i){const s=Ne(t),e=Ne(i);if(void 0!==s&&void 0!==e)return{lastBarUpdatedOrNewBarsAddedToTheRight:s.lastTime>=e.lastTime&&s.firstTime>=e.firstTime}}(this._seriesRowsBySeries.get(t),h))}removeSeries(t){return this.setSeriesData(t,[])}updateSeriesData(t,i){const s=i;Fe(s),ze(i);const e=r(Oe([i]))(i.time),h=this._seriesLastTimePoint.get(t);if(void 0!==h&&e.timestampt.time.timestampe.time.timestamp?Se(i)&&s.push(i):Se(i)?s[s.length-1]=i:s.splice(-1,1),this._seriesLastTimePoint.set(t,i.time)}_setRowsToSeries(t,i){0!==i.length?(this._seriesRowsBySeries.set(t,i.filter(Se)),this._seriesLastTimePoint.set(t,i[i.length-1].time)):(this._seriesRowsBySeries.delete(t),this._seriesLastTimePoint.delete(t))}_cleanupPointsData(){for(const t of this._sortedTimePoints)0===t.pointData.mapping.size&&this._pointDataByTimePoint.delete(t.time.timestamp)}_replaceTimeScalePoints(t){let i=-1;for(let s=0;s{0!==i.length&&(t=Math.max(t,i[i.length-1].index))})),t}_getUpdateResponse(t,i,s){const e={series:new Map,timeScale:{baseIndex:this._getBaseIndex()}};if(-1!==i)this._seriesRowsBySeries.forEach(((i,h)=>{e.series.set(h,{data:i,info:h===t?s:void 0})})),this._seriesRowsBySeries.has(t)||e.series.set(t,{data:[],info:s}),e.timeScale.points=this._sortedTimePoints,e.timeScale.firstChangedPointIndex=i;else{const i=this._seriesRowsBySeries.get(t);e.series.set(t,{data:i||[],info:s})}return e}}function je(t,i){t.index=i,t.mapping.forEach((t=>{t.index=i}))}function He(t){return{value:t.value[3],time:t.originalTime}}function $e(t){const i=He(t);return void 0!==t.color&&(i.color=t.color),i}function Ue(t){return{open:t.value[0],high:t.value[1],low:t.value[2],close:t.value[3],time:t.originalTime}}const qe={Area:function(t){const i=He(t);return void 0!==t.lineColor&&(i.lineColor=t.lineColor),void 0!==t.topColor&&(i.topColor=t.topColor),void 0!==t.bottomColor&&(i.bottomColor=t.bottomColor),i},Line:$e,Baseline:function(t){const i=He(t);return void 0!==t.topLineColor&&(i.topLineColor=t.topLineColor),void 0!==t.bottomLineColor&&(i.bottomLineColor=t.bottomLineColor),void 0!==t.topFillColor1&&(i.topFillColor1=t.topFillColor1),void 0!==t.topFillColor2&&(i.topFillColor2=t.topFillColor2),void 0!==t.bottomFillColor1&&(i.bottomFillColor1=t.bottomFillColor1),void 0!==t.bottomFillColor2&&(i.bottomFillColor2=t.bottomFillColor2),i},Histogram:$e,Bar:function(t){const i=Ue(t);return void 0!==t.color&&(i.color=t.color),i},Candlestick:function(t){const i=Ue(t),{color:s,borderColor:e,wickColor:h}=t;return void 0!==s&&(i.color=s),void 0!==e&&(i.borderColor=e),void 0!==h&&(i.wickColor=h),i}};function Ye(t){return qe[t]}const Xe={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2}},Ze={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:C,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"},Ke={width:0,height:0,autoSize:!1,layout:{background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:C},crosshair:{vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},grid:{vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},overlayPriceScales:Object.assign({},Xe),leftPriceScale:Object.assign(Object.assign({},Xe),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Xe),{visible:!0}),timeScale:{rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,ticksVisible:!1},watermark:Ze,localization:{locale:Is?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}},Ge={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Je={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Qe={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},th={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},ih={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},sh={color:"#26a69a",base:0},eh={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};class hh{constructor(t,i){this._chartWidget=t,this._priceScaleId=i}applyOptions(t){this._chartWidget.model().applyPriceScaleOptions(this._priceScaleId,t)}options(){return this._priceScale().options()}width(){return et(this._priceScaleId)?this._chartWidget.getPriceAxisWidth(this._priceScaleId):0}_priceScale(){return r(this._chartWidget.model().findPriceScale(this._priceScaleId)).priceScale}}const nh={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class rh{constructor(t){this._priceLine=t}applyOptions(t){this._priceLine.applyOptions(t)}options(){return this._priceLine.options()}priceLine(){return this._priceLine}}class oh{constructor(t,i,s){this._series=t,this._dataUpdatesConsumer=i,this._priceScaleApiProvider=s}priceFormatter(){return this._series.formatter()}priceToCoordinate(t){const i=this._series.firstValue();return null===i?null:this._series.priceScale().priceToCoordinate(t,i.value)}coordinateToPrice(t){const i=this._series.firstValue();return null===i?null:this._series.priceScale().coordinateToPrice(t,i.value)}barsInLogicalRange(t){if(null===t)return null;const i=new ps(new cs(t.from,t.to)).strictRange(),s=this._series.bars();if(s.isEmpty())return null;const e=s.search(i.left(),1),h=s.search(i.right(),-1),n=r(s.firstIndex()),o=r(s.lastIndex());if(null!==e&&null!==h&&e.index>h.index)return{barsBefore:t.from-n,barsAfter:o-t.to};const l={barsBefore:null===e||e.index===n?t.from-n:e.index-n,barsAfter:null===h||h.index===o?o-t.to:o-h.index};return null!==e&&null!==h&&(l.from=e.time.businessDay||e.time.timestamp,l.to=h.time.businessDay||h.time.timestamp),l}setData(t){this._series.seriesType(),this._dataUpdatesConsumer.applyNewData(this._series,t)}update(t){this._series.seriesType(),this._dataUpdatesConsumer.updateData(this._series,t)}dataByIndex(t,i){const s=this._series.bars().search(t,i);return null===s?null:Ye(this.seriesType())(s)}setMarkers(t){const i=t.map((t=>Object.assign(Object.assign({},t),{originalTime:t.time,time:Be(t.time)})));this._series.setMarkers(i)}markers(){return this._series.markers().map((t=>{const{originalTime:i,time:s}=t,e=function(t,i){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.indexOf(e)<0&&(s[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(e=Object.getOwnPropertySymbols(t);h=1)return 0;let i=0;for(;i<8;i++){const s=Math.round(t);if(Math.abs(s-t)<1e-8)return i;t*=10}return i}(i.minMove))}function ch(t){return function(t){if(x(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){const{axisPressedMouseMove:i,axisDoubleClickReset:s}=t.handleScale;x(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),x(s)&&(t.handleScale.axisDoubleClickReset={time:s,price:s})}const i=t.handleScroll;x(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class dh{constructor(t,i){this._dataLayer=new We,this._seriesMap=new Map,this._seriesMapReversed=new Map,this._clickedDelegate=new b,this._crosshairMovedDelegate=new b;const s=void 0===i?_(Ke):g(_(Ke),ch(i));this._chartWidget=new ge(t,s),this._chartWidget.clicked().subscribe((t=>{this._clickedDelegate.hasListeners()&&this._clickedDelegate.fire(this._convertMouseParams(t()))}),this),this._chartWidget.crosshairMoved().subscribe((t=>{this._crosshairMovedDelegate.hasListeners()&&this._crosshairMovedDelegate.fire(this._convertMouseParams(t()))}),this);const e=this._chartWidget.model();this._timeScaleApi=new ah(e,this._chartWidget.timeAxisWidget())}remove(){this._chartWidget.clicked().unsubscribeAll(this),this._chartWidget.crosshairMoved().unsubscribeAll(this),this._timeScaleApi.destroy(),this._chartWidget.destroy(),this._seriesMap.clear(),this._seriesMapReversed.clear(),this._clickedDelegate.destroy(),this._crosshairMovedDelegate.destroy(),this._dataLayer.destroy()}resize(t,i,s){this.autoSizeActive()||this._chartWidget.resize(t,i,s)}addAreaSeries(t){return this._addSeriesImpl("Area",th,t)}addBaselineSeries(t){return this._addSeriesImpl("Baseline",ih,t)}addBarSeries(t){return this._addSeriesImpl("Bar",Je,t)}addCandlestickSeries(t={}){return function(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}(t),this._addSeriesImpl("Candlestick",Ge,t)}addHistogramSeries(t){return this._addSeriesImpl("Histogram",sh,t)}addLineSeries(t){return this._addSeriesImpl("Line",Qe,t)}removeSeries(t){const i=n(this._seriesMap.get(t)),s=this._dataLayer.removeSeries(i);this._chartWidget.model().removeSeries(i),this._sendUpdateToChart(s),this._seriesMap.delete(t),this._seriesMapReversed.delete(i)}applyNewData(t,i){this._sendUpdateToChart(this._dataLayer.setSeriesData(t,i))}updateData(t,i){this._sendUpdateToChart(this._dataLayer.updateSeriesData(t,i))}subscribeClick(t){this._clickedDelegate.subscribe(t)}unsubscribeClick(t){this._clickedDelegate.unsubscribe(t)}subscribeCrosshairMove(t){this._crosshairMovedDelegate.subscribe(t)}setCrosshairXY(t,i,s){this._chartWidget.paneWidgets()[0].setCrosshair(t,i,s)}unsubscribeCrosshairMove(t){this._crosshairMovedDelegate.unsubscribe(t)}priceScale(t){return new hh(this._chartWidget,t)}timeScale(){return this._timeScaleApi}applyOptions(t){this._chartWidget.applyOptions(ch(t))}options(){return this._chartWidget.options()}takeScreenshot(){return this._chartWidget.takeScreenshot()}autoSizeActive(){return this._chartWidget.autoSizeActive()}_addSeriesImpl(t,i,s={}){uh(s.priceFormat);const e=g(_(eh),_(i),s),h=this._chartWidget.model().createSeries(t,e),n=new oh(h,this,this);return this._seriesMap.set(n,h),this._seriesMapReversed.set(h,n),n}_sendUpdateToChart(t){const i=this._chartWidget.model();i.updateTimeScale(t.timeScale.baseIndex,t.timeScale.points,t.timeScale.firstChangedPointIndex),t.series.forEach(((t,i)=>i.setData(t.data,t.info))),i.recalculateAllPanes()}_mapSeriesToApi(t){return n(this._seriesMapReversed.get(t))}_convertMouseParams(t){const i=new Map;t.seriesData.forEach(((t,s)=>{const e=Ye(s.seriesType())(t);h(function(t){return void 0!==t.open||void 0!==t.value}(e)),i.set(this._mapSeriesToApi(s),e)}));const s=void 0===t.hoveredSeries?void 0:this._mapSeriesToApi(t.hoveredSeries);return{time:t.time,logical:t.index,point:t.point,hoveredSeries:s,hoveredObjectId:t.hoveredObject,seriesData:i,sourceEvent:t.touchMouseEventData}}}var fh=Object.freeze({__proto__:null,get ColorType(){return xs},get CrosshairMode(){return J},get LastPriceAnimationMode(){return ws},get LineStyle(){return i},get LineType(){return t},get MismatchDirection(){return Di},get PriceLineSource(){return Ss},get PriceScaleMode(){return Qi},get TickMarkType(){return vs},get TrackingModeExitMode(){return gs},createChart:function(t,i){let s;if(S(t)){const i=document.getElementById(t);h(null!==i,`Cannot find element in DOM with id=${t}`),s=i}else s=t;return new dh(s,i)},isBusinessDay:Ps,isUTCTimestamp:Rs,version:function(){return"4.1.0-dev+202306102016"}});window.LightweightCharts=fh}(); \ No newline at end of file diff --git a/lightweight_charts/polygon.py b/lightweight_charts/polygon.py index f296630..bf62755 100644 --- a/lightweight_charts/polygon.py +++ b/lightweight_charts/polygon.py @@ -22,6 +22,12 @@ except ImportError: class PolygonAPI: + """ + Offers direct access to Polygon API data within all Chart objects. + + It is not designed to be initialized by the user, and should be utilised + through the `polygon` method of `LWC` (chart.polygon.). + """ def __init__(self, chart): ch = logging.StreamHandler() ch.setFormatter(logging.Formatter('%(asctime)s | [polygon.io] %(levelname)s: %(message)s', datefmt='%H:%M:%S')) @@ -30,23 +36,32 @@ class PolygonAPI: self._log.setLevel(logging.ERROR) self._log.addHandler(ch) + self.max_ticks_per_response = 20 + self._chart = chart - self._lasts = {} # $$ + self._lasts = {} self._key = None - self._using_live_data = False - self._using_live = {'stocks': False, 'options': False, 'indices': False, 'crypto': False, 'forex': False} - self._ws = {'stocks': None, 'options': None, 'indices': None, 'crypto': None, 'forex': None} - self._send_q = queue.Queue() + + self._ws_q = queue.Queue() self._q = queue.Queue() self._lock = threading.Lock() - def _subchart(self, subchart): - return PolygonAPISubChart(self, subchart) + self._using_live_data = False + self._using_live = {'stocks': False, 'options': False, 'indices': False, 'crypto': False, 'forex': False} + self._ws = {'stocks': None, 'options': None, 'indices': None, 'crypto': None, 'forex': None} + def log(self, info: bool): + """ + Streams informational messages related to Polygon.io. + """ self._log.setLevel(logging.INFO) if info else self._log.setLevel(logging.ERROR) - def api_key(self, key: str): self._key = key + def api_key(self, key: str): + """ + Sets the API key to be used with Polygon.io. + """ + self._key = key def stock(self, symbol: str, timeframe: str, start_date: str, end_date='now', limit: int = 5_000, live: bool = False): """ @@ -55,34 +70,74 @@ class PolygonAPI: :param timeframe: Timeframe to request (1min, 5min, 2H, 1D, 1W, 2M, etc). :param start_date: Start date of the data (YYYY-MM-DD). :param end_date: End date of the data (YYYY-MM-DD). If left blank, this will be set to today. - :param limit: The limit of base aggregates queried to create the timeframe given (max 50_000) + :param limit: The limit of base aggregates queried to create the timeframe given (max 50_000). :param live: If true, the data will be updated in real-time. """ - return True if self._set(self._chart, 'stocks', symbol, timeframe, start_date, end_date, limit, live) else False + return self._set(self._chart, 'stocks', symbol, timeframe, start_date, end_date, limit, live) def option(self, symbol: str, timeframe: str, start_date: str, expiration: str = None, right: Literal['C', 'P'] = None, strike: Union[int, float] = None, end_date: str = 'now', limit: int = 5_000, live: bool = False): + """ + Requests and displays option data pulled from Polygon.io.\n + :param symbol: The underlying ticker to request. A formatted option ticker can also be given instead of using the expiration, right, and strike parameters. + :param timeframe: Timeframe to request (1min, 5min, 2H, 1D, 1W, 2M, etc). + :param start_date: Start date of the data (YYYY-MM-DD). + :param expiration: Expiration of the option (YYYY-MM-DD). + :param right: Right of the option (C, P). + :param strike: The strike price of the option. + :param end_date: End date of the data (YYYY-MM-DD). If left blank, this will be set to today. + :param limit: The limit of base aggregates queried to create the timeframe given (max 50_000). + :param live: If true, the data will be updated in real-time. + """ if any((expiration, right, strike)): - symbol = f'O:{symbol}{dt.datetime.strptime(expiration, "%Y-%m-%d").strftime("%y%m%d")}{right}{strike * 1000:08d}' - return True if self._set(self._chart, 'options', symbol, timeframe, start_date, end_date, limit, live) else False + symbol = f'{symbol}{dt.datetime.strptime(expiration, "%Y-%m-%d").strftime("%y%m%d")}{right}{strike * 1000:08d}' + return self._set(self._chart, 'options', f'O:{symbol}', timeframe, start_date, end_date, limit, live) def index(self, symbol, timeframe, start_date, end_date='now', limit: int = 5_000, live=False): - return True if self._set(self._chart, 'indices', f'I:{symbol}', timeframe, start_date, end_date, limit, live) else False + """ + Requests and displays index data pulled from Polygon.io.\n + :param symbol: Ticker to request. + :param timeframe: Timeframe to request (1min, 5min, 2H, 1D, 1W, 2M, etc). + :param start_date: Start date of the data (YYYY-MM-DD). + :param end_date: End date of the data (YYYY-MM-DD). If left blank, this will be set to today. + :param limit: The limit of base aggregates queried to create the timeframe given (max 50_000). + :param live: If true, the data will be updated in real-time. + """ + return self._set(self._chart, 'indices', f'I:{symbol}', timeframe, start_date, end_date, limit, live) def forex(self, fiat_pair, timeframe, start_date, end_date='now', limit: int = 5_000, live=False): - return True if self._set(self._chart, 'forex', f'C:{fiat_pair}', timeframe, start_date, end_date, limit, live) else False + """ + Requests and displays forex data pulled from Polygon.io.\n + :param fiat_pair: The fiat pair to request. (USD-CAD, GBP-JPY etc.) + :param timeframe: Timeframe to request (1min, 5min, 2H, 1D, 1W, 2M, etc). + :param start_date: Start date of the data (YYYY-MM-DD). + :param end_date: End date of the data (YYYY-MM-DD). If left blank, this will be set to today. + :param limit: The limit of base aggregates queried to create the timeframe given (max 50_000). + :param live: If true, the data will be updated in real-time. + """ + return self._set(self._chart, 'forex', f'C:{fiat_pair}', timeframe, start_date, end_date, limit, live) def crypto(self, crypto_pair, timeframe, start_date, end_date='now', limit: int = 5_000, live=False): - return True if self._set(self._chart, 'crypto', f'X:{crypto_pair}', timeframe, start_date, end_date, limit, live) else False + """ + Requests and displays crypto data pulled from Polygon.io.\n + :param crypto_pair: The crypto pair to request. (BTC-USD, ETH-BTC etc.) + :param timeframe: Timeframe to request (1min, 5min, 2H, 1D, 1W, 2M, etc). + :param start_date: Start date of the data (YYYY-MM-DD). + :param end_date: End date of the data (YYYY-MM-DD). If left blank, this will be set to today. + :param limit: The limit of base aggregates queried to create the timeframe given (max 50_000). + :param live: If true, the data will be updated in real-time. + """ + return self._set(self._chart, 'crypto', f'X:{crypto_pair}', timeframe, start_date, end_date, limit, live) def _set(self, chart, sec_type, ticker, timeframe, start_date, end_date, limit, live): if requests is None: raise ImportError('The "requests" library was not found, and must be installed to use polygon.io.') + self._ws_q.put(('_unsubscribe', chart)) end_date = dt.datetime.now().strftime('%Y-%m-%d') if end_date == 'now' else end_date mult, span = _convert_timeframe(timeframe) - query_url = f"https://api.polygon.io/v2/aggs/ticker/{ticker.replace('-', '')}/range/{mult}/{span}/{start_date}/{end_date}?limit={limit}&apiKey={self._key}" + query_url = f"https://api.polygon.io/v2/aggs/ticker/{ticker.replace('-', '')}/range/{mult}/{span}/{start_date}/{end_date}?limit={limit}&apiKey={self._key}" response = requests.get(query_url, headers={'User-Agent': 'lightweight_charts/1.0'}) if response.status_code != 200: error = response.json() @@ -93,11 +148,6 @@ class PolygonAPI: self._log.error(f'No results for "{ticker}" ({sec_type})') return - for child in self._lasts.values(): - for subbed_chart in child['charts']: - if subbed_chart == chart: - self._send_q.put(('_unsubscribe', chart, ticker)) - df = pd.DataFrame(data['results']) columns = ['t', 'o', 'h', 'l', 'c'] rename = {'o': 'open', 'h': 'high', 'l': 'low', 'c': 'close', 't': 'time'} @@ -106,45 +156,40 @@ class PolygonAPI: columns.append('v') df = df[columns].rename(columns=rename) df['time'] = pd.to_datetime(df['time'], unit='ms') - chart.set(df) + if not live: return True - if not self._using_live_data: threading.Thread(target=asyncio.run, args=[self._thread_loop()], daemon=True).start() self._using_live_data = True with self._lock: if not self._ws[sec_type]: - self._send_q.put(('_websocket_connect', self._key, sec_type)) - self._send_q.put(('_subscribe', chart, sec_type, ticker)) + self._ws_q.put(('_websocket_connect', self._key, sec_type)) + self._ws_q.put(('_subscribe', chart, ticker, sec_type)) return True async def _thread_loop(self): while 1: - while self._send_q.empty(): + while self._ws_q.empty(): await asyncio.sleep(0.05) - value = self._send_q.get() + value = self._ws_q.get() func, args = value[0], value[1:] asyncio.create_task(getattr(self, func)(*args)) - def unsubscribe(self, symbol): - self._send_q.put(('_unsubscribe', self._chart, symbol)) - - async def _subscribe(self, chart, sec_type, ticker): - key = ticker if '.' not in ticker else ticker.split('.')[1] - key = key if ':' not in key else key.split(':')[1] + async def _subscribe(self, chart, ticker, sec_type): + key = ticker if ':' not in ticker else ticker.split(':')[1] if not self._lasts.get(key): - sub_type = { - 'stocks': ('Q', 'A'), - 'options': ('Q', 'A'), - 'indices': ('V', None), - 'forex': ('C', 'CA'), - 'crypto': ('XQ', 'XA'), - } self._lasts[key] = { + 'ticker': ticker, 'sec_type': sec_type, - 'sub_type': sub_type[sec_type], + 'sub_type': { + 'stocks': ('Q', 'A'), + 'options': ('Q', 'A'), + 'indices': ('V', None), + 'forex': ('C', 'CA'), + 'crypto': ('XQ', 'XA'), + }[sec_type], 'price': chart._last_bar['close'], 'charts': [], } @@ -158,18 +203,22 @@ class PolygonAPI: return self._lasts[key]['charts'].append(chart) - async def _unsubscribe(self, chart, ticker): - key = ticker if '.' not in ticker else ticker.split('.')[1] - key = key if ':' not in key else key.split(':')[1] - if chart in self._lasts[key]['charts']: - self._lasts[key]['charts'].remove(chart) - if self._lasts[key]['charts']: + async def _unsubscribe(self, chart): + for data in self._lasts.values(): + if chart in data['charts']: + break + else: return + if chart in data['charts']: + data['charts'].remove(chart) + if data['charts']: + return + while self._q.qsize(): self._q.get() # Flush the queue - quotes, aggs = self._lasts[key]['sub_type'] - await self._send(self._lasts[key]['sec_type'], 'unsubscribe', f'{quotes}.{ticker}') - await self._send(self._lasts[key]['sec_type'], 'unsubscribe', f'{aggs}.{ticker}') + quotes, aggs = data['sub_type'] + await self._send(data['sec_type'], 'unsubscribe', f'{quotes}.{data["ticker"]}') + await self._send(data['sec_type'], 'unsubscribe', f'{aggs}.{data["ticker"]}') async def _send(self, sec_type, action, params): while 1: @@ -213,7 +262,6 @@ class PolygonAPI: ssl_context = ssl.create_default_context() ssl_context.check_hostname = False ssl_context.verify_mode = ssl.CERT_NONE - max_ticks = 20 async with websockets.connect(f'wss://socket.polygon.io/{sec_type}', ssl=ssl_context) as ws: with self._lock: self._ws[sec_type] = ws @@ -225,10 +273,13 @@ class PolygonAPI: if data['ev'] == 'status': self._log.info(f'{data["message"]}') continue - elif data_list.index(data) < len(data_list)-max_ticks: + elif data_list.index(data) < len(data_list)-self.max_ticks_per_response: continue await self._handle_tick(sec_type, data) + def _subchart(self, subchart): + return PolygonAPISubChart(self, subchart) + class PolygonAPISubChart(PolygonAPI): def __init__(self, polygon, subchart): @@ -237,22 +288,33 @@ class PolygonAPISubChart(PolygonAPI): class PolygonChart(Chart): - def __init__(self, api_key: str, live: bool = False, num_bars: int = 200, limit: int = 5_000, + """ + A prebuilt callback chart object allowing for a standalone and plug-and-play + experience of Polygon.io's API. + + Tickers, security types and timeframes are to be defined within the chart window. + + If using the standard `show` method, the `block` parameter must be set to True. + When using `show_async`, either is acceptable. + """ + def __init__(self, api_key: str, live: bool = False, num_bars: int = 200, end_date: str = 'now', limit: int = 5_000, timeframe_options: tuple = ('1min', '5min', '30min', 'D', 'W'), security_options: tuple = ('Stock', 'Option', 'Index', 'Forex', 'Crypto'), - width: int = 800, height: int = 600, x: int = None, y: int = None, on_top: bool = False, debug=False): - super().__init__(volume_enabled=True, width=width, height=height, x=x, y=y, on_top=on_top, debug=debug, + width: int = 800, height: int = 600, x: int = None, y: int = None, + on_top: bool = False, maximize: bool = False, debug: bool = False): + super().__init__(volume_enabled=True, width=width, height=height, x=x, y=y, on_top=on_top, maximize=maximize, debug=debug, api=self, topbar=True, searchbox=True) self.chart = self self.num_bars = num_bars + self.end_date = end_date self.limit = limit self.live = live self.polygon.api_key(api_key) self.topbar.active_background_color = 'rgb(91, 98, 246)' self.topbar.textbox('symbol') - self.topbar.switcher('timeframe', self.on_timeframe_selection, *timeframe_options) - self.topbar.switcher('security', self.on_security_selection, *security_options) + self.topbar.switcher('timeframe', self._on_timeframe_selection, *timeframe_options) + self.topbar.switcher('security', self._on_security_selection, *security_options) self.legend(True) self.grid(False, False) self.crosshair(vert_visible=False, horz_visible=False) @@ -262,25 +324,26 @@ class PolygonChart(Chart): {self.id}.search.window.style.display = "block" {self.id}.search.box.focus() + + //let polyLogo = document.createElement('div') + //polyLogo.innerHTML = '' + //polyLogo.style.position = 'absolute' + //polyLogo.style.width = '28px' + //polyLogo.style.zIndex = 10000 + //polyLogo.style.right = '18px' + //polyLogo.style.top = '-1px' + //{self.id}.wrapper.appendChild(polyLogo) ''') - def show(self): - """ - Shows the PolygonChart window (this method will block). - """ - asyncio.run(self.show_async(block=True)) - def _polygon(self, symbol): self.spinner(True) self.set(pd.DataFrame()) self.crosshair(vert_visible=False, horz_visible=False) - if self.topbar['symbol'].value and self.topbar['symbol'].value != symbol: - self.polygon.unsubscribe(self.topbar['symbol'].value) mult, span = _convert_timeframe(self.topbar['timeframe'].value) delta = dt.timedelta(**{span + 's': int(mult)}) short_delta = (delta < dt.timedelta(days=7)) - start_date = dt.datetime.now() + start_date = dt.datetime.now() if self.end_date == 'now' else dt.datetime.strptime(self.end_date, '%Y-%m-%d') remaining_bars = self.num_bars while remaining_bars > 0: start_date -= delta @@ -293,20 +356,20 @@ class PolygonChart(Chart): symbol, timeframe=self.topbar['timeframe'].value, start_date=start_date.strftime('%Y-%m-%d'), + end_date=self.end_date, limit=self.limit, live=self.live ) self.spinner(False) self.crosshair(vert_visible=True, horz_visible=True) if success else None - return True if success else False + return success - async def on_search(self, searched_string): - self.topbar['symbol'].set(searched_string if self._polygon(searched_string) else '') + async def on_search(self, searched_string): self.topbar['symbol'].set(searched_string if self._polygon(searched_string) else '') - async def on_timeframe_selection(self): - self._polygon(self.topbar['symbol'].value) + async def _on_timeframe_selection(self): + self._polygon(self.topbar['symbol'].value) if self.topbar['symbol'].value else None - async def on_security_selection(self): + async def _on_security_selection(self): sec_type = self.topbar['security'].value self.volume_enabled = False if sec_type == 'Index' else True @@ -316,7 +379,3 @@ class PolygonChart(Chart): {self.chart.id}.series.applyOptions({{ priceFormat: {{precision: {precision}, minMove: {min_move}}} }})''') - - - - diff --git a/lightweight_charts/util.py b/lightweight_charts/util.py index c8c000f..dfba151 100644 --- a/lightweight_charts/util.py +++ b/lightweight_charts/util.py @@ -90,4 +90,4 @@ def _convert_timeframe(timeframe): except IndexError: return 1, spans[timeframe] timespan = spans[timeframe.replace(multiplier, '')] - return multiplier, timespan \ No newline at end of file + return multiplier, timespan diff --git a/lightweight_charts/widgets.py b/lightweight_charts/widgets.py index f5995dc..95f3248 100644 --- a/lightweight_charts/widgets.py +++ b/lightweight_charts/widgets.py @@ -4,7 +4,7 @@ from inspect import iscoroutinefunction try: import wx.html2 except ImportError: - pass + wx = None try: from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtWebChannel import QWebChannel @@ -19,17 +19,17 @@ try: def callback(self, message): _widget_message(self.chart, message) except ImportError: - pass + QWebEngineView = None try: from streamlit.components.v1 import html except ImportError: - pass + html = None try: from IPython.display import HTML, display except ImportError: - pass + HTML = None -from lightweight_charts.js import LWC, TopBar, CALLBACK_SCRIPT +from lightweight_charts.abstract import LWC, TopBar, JS def _widget_message(chart, string): @@ -47,13 +47,12 @@ def _widget_message(chart, string): class WxChart(LWC): def __init__(self, parent, volume_enabled: bool = True, inner_width: float = 1.0, inner_height: float = 1.0, - api: object = None, topbar: bool = False, searchbox: bool = False): - try: - self.webview: wx.html2.WebView = wx.html2.WebView.New(parent) - except NameError: + scale_candles_only: bool = False, api: object = None, topbar: bool = False, searchbox: bool = False): + if wx is None: raise ModuleNotFoundError('wx.html2 was not found, and must be installed to use WxChart.') + self.webview: wx.html2.WebView = wx.html2.WebView.New(parent) - super().__init__(volume_enabled, inner_width=inner_width, inner_height=inner_height) + super().__init__(volume_enabled, inner_width=inner_width, inner_height=inner_height, scale_candles_only=scale_candles_only) self.api = api self._script_func = self.webview.RunScript self._js_api_code = 'window.wx_msg.postMessage.bind(window.wx_msg)' @@ -63,7 +62,7 @@ class WxChart(LWC): self.webview.AddScriptMessageHandler('wx_msg') self.webview.SetPage(self._html, '') - self.webview.AddUserScript(CALLBACK_SCRIPT) + self.webview.AddUserScript(JS['callback']) self._create_chart() self.topbar = TopBar(self) if topbar else None self._make_search_box() if searchbox else None @@ -73,12 +72,12 @@ class WxChart(LWC): class QtChart(LWC): def __init__(self, widget=None, api: object = None, topbar: bool = False, searchbox: bool = False, - volume_enabled: bool = True, inner_width: float = 1.0, inner_height: float = 1.0): - try: - self.webview = QWebEngineView(widget) - except NameError: + volume_enabled: bool = True, inner_width: float = 1.0, inner_height: float = 1.0, scale_candles_only: bool = False): + if QWebEngineView is None: raise ModuleNotFoundError('QWebEngineView was not found, and must be installed to use QtChart.') - super().__init__(volume_enabled, inner_width=inner_width, inner_height=inner_height) + self.webview = QWebEngineView(widget) + + super().__init__(volume_enabled, inner_width=inner_width, inner_height=inner_height, scale_candles_only=scale_candles_only) self.api = api self._script_func = self.webview.page().runJavaScript self._js_api_code = 'window.pythonObject.callback' @@ -101,7 +100,7 @@ class QtChart(LWC): ''' self.webview.page().setHtml(self._html) - self.run_script(CALLBACK_SCRIPT) + self.run_script(JS['callback']) self._create_chart() self.topbar = TopBar(self) if topbar else None self._make_search_box() if searchbox else None @@ -110,8 +109,8 @@ class QtChart(LWC): class StaticLWC(LWC): - def __init__(self, volume_enabled=True, width=None, height=None, inner_width=1, inner_height=1): - super().__init__(volume_enabled, inner_width, inner_height) + def __init__(self, volume_enabled=True, width=None, height=None, inner_width=1, inner_height=1, scale_candles_only: bool = False): + super().__init__(volume_enabled, inner_width, inner_height, scale_candles_only=scale_candles_only) self.width = width self.height = height self._html = self._html.replace('\n\n', '') @@ -134,20 +133,19 @@ class StaticLWC(LWC): class StreamlitChart(StaticLWC): - def __init__(self, volume_enabled=True, width=None, height=None, inner_width=1, inner_height=1): - super().__init__(volume_enabled, width, height, inner_width, inner_height) + def __init__(self, volume_enabled=True, width=None, height=None, inner_width=1, inner_height=1, scale_candles_only: bool = False): + super().__init__(volume_enabled, width, height, inner_width, inner_height, scale_candles_only) self._create_chart() def _load(self): - try: - html(f'{self._html}', width=self.width, height=self.height) - except NameError: + if html is None: raise ModuleNotFoundError('streamlit.components.v1.html was not found, and must be installed to use StreamlitChart.') + html(f'{self._html}', width=self.width, height=self.height) class JupyterChart(StaticLWC): - def __init__(self, volume_enabled=True, width=800, height=350, inner_width=1, inner_height=1): - super().__init__(volume_enabled, width, height, inner_width, inner_height) + def __init__(self, volume_enabled=True, width=800, height=350, inner_width=1, inner_height=1, scale_candles_only: bool = False): + super().__init__(volume_enabled, width, height, inner_width, inner_height, scale_candles_only) self._position = "" self._create_chart(autosize=False) @@ -164,8 +162,6 @@ class JupyterChart(StaticLWC): self.run_script(f'{self.id}.chart.resize({width}, {height})') def _load(self): - try: - display(HTML(f'{self._html}')) - except NameError: + if HTML is None: raise ModuleNotFoundError('IPython.display.HTML was not found, and must be installed to use JupyterChart.') - + display(HTML(f'{self._html}')) diff --git a/setup.py b/setup.py index 67bd786..e5e8c48 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open('README.md', 'r', encoding='utf-8') as f: setup( name='lightweight_charts', - version='1.0.12', + version='1.0.13', packages=find_packages(), python_requires='>=3.9', install_requires=[